File "seamless.min.js.map"
Full Path: /home/siazco/grocery.siazco.se/wp-content/plugins/swedbank-pay-checkout/assets/js/seamless.min.js.map
File size: 12.02 KB
MIME-type: application/json
Charset: utf-8
{"version":3,"file":"seamless.min.js","names":["jQuery","$","window","wc_sb_checkout_seamless","xhr","init","form","this","form_submit","js_url","onSubmit","event","data","obj","validateForm","console","log","is","hasOwnProperty","wc_sb_checkin","isCheckinEnabled","isCheckinRequired","isCustomerIdentified","submit_error","WC_Gateway_Swedbank_Pay_Checkin","needs_checkin","waitForJsUrl","$required_inputs","validated","find","not","length","each","$this","$parent","closest","validate_required","validate_email","attr","val","RegExp","test","setJsUrl","url","self","interval","setInterval","clearInterval","initFrame","callback","loadJs","featherlight","variant","persist","closeOnClick","closeOnEsc","afterOpen","initPaymentMenu","afterClose","removeClass","unblock","js","script","document","createElement","setAttribute","addEventListener","oHead","getElementsByTagName","appendChild","error_message","remove","prepend","trigger","blur","scroll_to_notices","body","scrollElement","checkPaymentUrl","URLSearchParams","location","search","get","payment_url"],"sources":["seamless.js"],"sourcesContent":["/* global wc_checkout_params */\njQuery( function( $ ) {\n 'use strict';\n\n /**\n * Object to handle Seamless payment forms.\n */\n window.wc_sb_checkout_seamless = {\n xhr: false,\n\n /**\n * Initialize e handlers and UI state.\n */\n init: function( form ) {\n this.form = form;\n this.form_submit = false;\n this.js_url = null;\n\n $( this.form )\n // We need to bind directly to the click (and not checkout_place_order_payex_checkout) to avoid popup blockers\n // especially on mobile devices (like on Chrome for iOS) from blocking payex_checkout(payment_id, {}, 'open'); from opening a tab\n //.on( 'click', '#place_order', this.onSubmit )\n\n // WooCommerce lets us return a false on checkout_place_order_{gateway} to keep the form from submitting\n //.on( 'submit checkout_place_order_payex_psp_cc' );\n },\n\n onSubmit: function( event ) {\n if ( event.data.obj.form_submit ) {\n return true;\n }\n\n if ( ! event.data.obj.validateForm() ) {\n return false;\n }\n\n console.log( 'onSubmit' );\n\n if ( event.data.obj.form.is( '.processing' ) ) {\n return false;\n }\n\n // Verify the checkin\n if ( window.hasOwnProperty( 'wc_sb_checkin' ) && window.wc_sb_checkin.isCheckinEnabled() ) {\n if ( window.wc_sb_checkin.isCheckinRequired() && ! window.wc_sb_checkin.isCustomerIdentified() ) {\n event.data.obj.submit_error( '<div class=\"woocommerce-error\">' + WC_Gateway_Swedbank_Pay_Checkin.needs_checkin + '</div>' );\n return false;\n }\n }\n\n console.log(this.js_url);\n event.data.obj.waitForJsUrl();\n },\n\n /**\n * Validate checkout fields on the checkout form\n * @return {boolean}\n */\n validateForm: function () {\n var $required_inputs,\n validated = true;\n\n // check to see if we need to validate shipping address\n if ( $( '#ship-to-different-address-checkbox' ).is( ':checked' ) ) {\n $required_inputs = $( '.woocommerce-billing-fields .validate-required, .woocommerce-shipping-fields .validate-required' ).find('input, select').not( $( '#account_password, #account_username' ) );\n } else {\n $required_inputs = $( '.woocommerce-billing-fields .validate-required' ).find('input, select').not( $( '#account_password, #account_username' ) );\n }\n\n if ( $required_inputs.length ) {\n $required_inputs.each( function() {\n var $this = $( this ),\n $parent = $this.closest( '.form-row' ),\n validate_required = $parent.is( '.validate-required' ),\n validate_email = $parent.is( '.validate-email' );\n\n if ( validate_required ) {\n if ( 'checkbox' === $this.attr( 'type' ) && ! $this.is( ':checked' ) ) {\n validated = false;\n } else if ( $this.val() === '' ) {\n validated = false;\n }\n }\n\n if ( validate_email ) {\n if ( $this.val() ) {\n /* https://stackoverflow.com/questions/2855865/jquery-validate-e-mail-address-regex */\n var pattern = new RegExp(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i);\n if ( ! pattern.test( $this.val() ) ) {\n validated = false;\n }\n }\n }\n });\n }\n\n return validated;\n },\n\n /**\n * Set Js url.\n *\n * @param url\n */\n setJsUrl: function ( url ) {\n console.log( 'setJsUrl' );\n console.log( url );\n this.js_url = url;\n },\n\n /**\n * Wait for JS url availability\n */\n waitForJsUrl: function () {\n var self = this;\n let interval = window.setInterval( function () {\n if ( self.js_url ) {\n console.log( 'waitForJsUrl: ' + self.js_url )\n window.clearInterval( interval );\n self.initFrame( self.js_url );\n }\n }, 1000 );\n },\n\n /**\n * Init frame.\n *\n * @param url\n * @param callback\n */\n initFrame: function ( url, callback ) {\n if ( typeof callback === 'undefined' ) {\n callback = function () {};\n }\n\n // Load JS\n var self = this;\n this.loadJs( url, function () {\n $.featherlight( '<div id=\"swedbank-pay-seamless\"> </div>', {\n variant: 'featherlight-swedbank-seamless',\n persist: true,\n closeOnClick: false,\n closeOnEsc: false,\n afterOpen: function () {\n self.initPaymentMenu( 'swedbank-pay-seamless' );\n },\n afterClose: function () {\n self.form.removeClass( 'processing' ).unblock();\n }\n } );\n\n callback()\n } );\n },\n\n /**\n * Load JS\n * @param js\n * @param callback\n */\n loadJs: function ( js, callback ) {\n // Creates a new script tag\n let script = document.createElement( 'script' );\n\n // Set script tag params\n script.setAttribute( 'src', js );\n script.setAttribute( 'type', 'text/javascript' );\n script.setAttribute( 'async', '' );\n script.addEventListener( 'load', function () {\n callback();\n }, false );\n\n // Gets document head element\n let oHead = document.getElementsByTagName( 'head' )[0];\n if ( oHead ) {\n // Add script tag to head\n oHead.appendChild( script );\n }\n\n return script;\n },\n\n /**\n * Submit Error\n * @param error_message\n */\n submit_error: function( error_message ) {\n $( '.woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message' ).remove();\n this.form.prepend( '<div class=\"woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout\">' + error_message + '</div>' );\n this.form.removeClass( 'processing' ).unblock();\n this.form.find( '.input-text, select, input:checkbox' ).trigger( 'validate' ).blur();\n this.scroll_to_notices();\n $( document.body ).trigger( 'checkout_error' );\n },\n\n /**\n * Scroll to notices\n */\n scroll_to_notices: function() {\n let scrollElement = $( '.woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout' );\n if ( ! scrollElement.length ) {\n scrollElement = $( '.form.checkout' );\n }\n\n $.scroll_to_notices( scrollElement );\n },\n\n checkPaymentUrl: function () {\n if ( !! (new URLSearchParams(document.location.search)).get('payment_url') ) {\n this.initFrame( this.payment_url, function () {\n console.log( 'Payment url has been loaded.' );\n } );\n }\n }\n }\n} );\n"],"mappings":"AACAA,QA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