{"version":3,"file":"../checkout-208.min.js","sources":["checkout-208.js"],"sourcesContent":["/**\n * Checkout Script\n * \n * Replaces the original WooCommerce `checkout.js`.\n */\n\n/* global wc_checkout_params */\njQuery( function( $ ) {\n\n\t// wc_checkout_params is required to continue, ensure the object exists\n\tif ( typeof wc_checkout_params === 'undefined' ) {\n\t\treturn false;\n\t}\n\n\t// CHANGE: Create flag to allow or block updating the checkout\n\twindow.can_update_checkout = true;\n\n\t$.blockUI.defaults.overlayCSS.cursor = 'default';\n\n\t// CHANGE: Add flag to up prevent users from leaving the page when there is unsaved data\n\tvar _updateBeforeUnload = false;\n\n\t// CHANGE: Add default settings object\n\tvar _settings = {\n\t\tcheckoutPlaceOrderSelector: '#place_order, .fc-place-order-button',\n\t\tcheckoutTermsSelector: '.fc-terms-checkbox',\n\t\tcheckoutUpdateFieldsSelector: '.address-field input.input-text, .update_totals_on_change input.input-text',\n\t\tcheckoutUpdateBeforeUnload: 'yes',\n\n\t\tfocusedFieldSkipFragmentReplaceSelector: 'input[type=\"text\"], input[type=\"color\"], input[type=\"date\"], input[type=\"datetime\"], input[type=\"datetime-local\"], input[type=\"email\"], input[type=\"file\"], input[type=\"image\"], input[type=\"month\"], input[type=\"number\"], input[type=\"password\"], input[type=\"search\"], input[type=\"tel\"], input[type=\"time\"], input[type=\"url\"], input[type=\"week\"], select, textarea, .fc-select2-field',\n\n\t\tphoneFieldSelector: 'input[type=\"tel\"], [data-phone-field], input.js-phone-field, .js-phone-field input',\n\t};\n\n\t// CHANGE: Add auxiliar function to merge objects\n\t/*!\n\t* Merge two or more objects together.\n\t* (c) 2017 Chris Ferdinandi, MIT License, https://gomakethings.com\n\t* @param {Boolean} deep If true, do a deep (or recursive) merge [optional]\n\t* @param {Object} objects The objects to merge together\n\t* @returns {Object} Merged values of defaults and options\n\t*/\n\tvar extend = function () {\n\t\t// Variables\n\t\tvar extended = {};\n\t\tvar deep = false;\n\t\tvar i = 0;\n\n\t\t// Check if a deep merge\n\t\tif ( Object.prototype.toString.call( arguments[0] ) === '[object Boolean]' ) {\n\t\t\tdeep = arguments[0];\n\t\t\ti++;\n\t\t}\n\n\t\t// Merge the object into the extended object\n\t\tvar merge = function (obj) {\n\t\t\tfor (var prop in obj) {\n\t\t\t\tif (obj.hasOwnProperty(prop)) {\n\t\t\t\t\t// If property is an object, merge properties\n\t\t\t\t\tif (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') {\n\t\t\t\t\t\textended[prop] = extend(extended[prop], obj[prop]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\textended[prop] = obj[prop];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t// Loop through each object and conduct a merge\n\t\tfor (; i < arguments.length; i++) {\n\t\t\tvar obj = arguments[i];\n\t\t\tmerge(obj);\n\t\t}\n\n\t\treturn extended;\n };\n\n\tvar wc_checkout_form = {\n\t\tupdateTimer: false,\n\t\tdirtyInput: false,\n\t\tselectedPaymentMethod: false,\n\t\txhr: false,\n\t\t$order_review: $( '#order_review' ),\n\t\t$checkout_form: $( 'form.checkout' ),\n\t\tinit: function() {\n\t\t\t// CHANGE: Merge default settings object with values from the server settings object\n\t\t\t_settings = extend( true, _settings, window.fcSettings );\n\n\t\t\t$( document.body ).on( 'update_checkout', this.update_checkout );\n\t\t\t$( document.body ).on( 'init_checkout', this.init_checkout );\n\n\t\t\t// Set autocomplete attributes\n\t\t\t$( document.body ).on( 'init_checkout', this.set_autocomplete_attribute_from_data );\n\t\t\t$( document.body ).on( 'updated_checkout', this.set_autocomplete_attribute_from_data );\n\n\t\t\t// Payment methods\n\t\t\tthis.$checkout_form.on( 'click', 'input[name=\"payment_method\"]', this.payment_method_selected );\n\n\t\t\tif ( $( document.body ).hasClass( 'woocommerce-order-pay' ) ) {\n\t\t\t\tthis.$order_review.on( 'click', 'input[name=\"payment_method\"]', this.payment_method_selected );\n\t\t\t\tthis.$order_review.on( 'submit', this.submitOrder );\n\t\t\t\tthis.$order_review.attr( 'novalidate', 'novalidate' );\n\t\t\t}\n\n\t\t\t// Prevent HTML5 validation which can conflict.\n\t\t\tthis.$checkout_form.attr( 'novalidate', 'novalidate' );\n\n\t\t\t// Form submission\n\t\t\tthis.$checkout_form.on( 'submit', this.submit );\n\n\t\t\t// Inline validation\n\t\t\tthis.$checkout_form.on( 'input validate change', '.input-text, select, input:checkbox', this.validate_field );\n\n\t\t\t// Manual trigger\n\t\t\tthis.$checkout_form.on( 'update', this.trigger_update_checkout );\n\n\t\t\t// Inputs/selects which update totals\n\t\t\t// CHANGE: Removed selector `#ship-to-different-address input`\n\t\t\tthis.$checkout_form.on( 'change', 'select.shipping_method, input[name^=\"shipping_method\"], .update_totals_on_change select, .update_totals_on_change input[type=\"radio\"], .update_totals_on_change input[type=\"checkbox\"]', this.trigger_update_checkout ); // eslint-disable-line max-len\n\t\t\tthis.$checkout_form.on( 'change', '.address-field select', this.input_changed );\n\n\t\t\t// CHANGE: Move CSS selector for fields that trigger update checkout when value is changed\n\t\t\tthis.$checkout_form.on( 'change', _settings.checkoutUpdateFieldsSelector, this.maybe_input_changed ); // eslint-disable-line max-len\n\t\t\tthis.$checkout_form.on( 'keydown', _settings.checkoutUpdateFieldsSelector, this.queue_update_checkout ); // eslint-disable-line max-len\n\n\t\t\t// Address fields\n\t\t\t// CHANGE: Removed shipping to different address checkout `change` listener\n\n\t\t\t// CHANGE: Update checkout totals to save data to session when user switches tabs, apps, goes to homescreen, etc.\n\t\t\tdocument.addEventListener( 'visibilitychange', this.maybe_update_checkout_visibility_change );\n\n\t\t\t// CHANGE: Maybe prevent leaving the page if there are unsaved changes, and trigger `update_checkout` to save the data.\n\t\t\tif ( 'yes' === _settings.checkoutUpdateBeforeUnload ) {\n\t\t\t\tthis.$checkout_form.on( 'change, input', 'select, input, textarea', this.maybe_prevent_unload );\n\t\t\t}\n\n\t\t\t// CHANGE: Update checkout when \"billing same as shipping\" checked state changes\n\t\t\tthis.$checkout_form.on( 'change', '#billing_same_as_shipping', this.billing_same_shipping_changed );\n\t\t\t$( document.body ).on( 'updated_checkout', this.maybe_reinitialize_collapsible_blocks );\n\n\t\t\t// CHANGE: Add event listener to sync terms checkbox state\n\t\t\tthis.$checkout_form.on( 'change', _settings.checkoutTermsSelector, this.terms_checked_changed );\n\n\t\t\t// Trigger events\n\t\t\t// CHANGE: Removed shipping to different address checkout `change` trigger\n\t\t\tthis.init_payment_methods();\n\n\t\t\t// Update on page load\n\t\t\tif ( wc_checkout_params.is_checkout === '1' ) {\n\t\t\t\t$( document.body ).trigger( 'init_checkout' );\n\t\t\t}\n\t\t\tif ( wc_checkout_params.option_guest_checkout === 'yes' ) {\n\t\t\t\t$( 'input#createaccount' ).on( 'change', this.toggle_create_account ).trigger( 'change' );\n\t\t\t}\n\t\t},\n\t\t// CHANGE: Update checkout when \"billing same as shipping\" checked state changes\n\t\tbilling_same_shipping_changed: function( e ) {\n\t\t\tif ( window.CollapsibleBlock ) {\n\t\t\t\tvar checkbox = document.querySelector( '#billing_same_as_shipping' );\n\t\t\t\tvar fieldsWrapper = document.querySelector( '#woocommerce-billing-fields__field-wrapper' );\n\n\t\t\t\t// Toggle state\n\t\t\t\tif ( ! checkbox.checked ) {\n\t\t\t\t\tCollapsibleBlock.expand( fieldsWrapper );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tCollapsibleBlock.collapse( fieldsWrapper );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$( document.body ).trigger( 'update_checkout' );\n\t\t},\n\t\t// CHANGE: Reinitialize billing fields collapsible block after checkout update\n\t\tmaybe_reinitialize_collapsible_blocks: function() {\n\t\t\tif ( window.CollapsibleBlock ) {\n\t\t\t\t// Try to initialize collapsible blocks if not yet initialized\n\t\t\t\tCollapsibleBlock.init( window.fcSettings ? fcSettings.collapsibleBlock : null );\n\n\t\t\t\tvar collapsibleBlocks = document.querySelectorAll( '[data-collapsible]' );\n\t\t\t\tfor ( var i = 0; i < collapsibleBlocks.length; i++ ) {\n\t\t\t\t\tvar collapsibleBlock = collapsibleBlocks[i];\n\n\t\t\t\t\t// Maybe initialize the collapsible block\n\t\t\t\t\tif ( ! CollapsibleBlock.getInstance( collapsibleBlock ) ) {\n\t\t\t\t\t\tCollapsibleBlock.initializeElement( collapsibleBlock );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// CHANGE: Update checkout when page gets hidden or visible again\n\t\tmaybe_update_checkout_visibility_change: function() {\n\t\t\tif ( 'hidden' == document.visibilityState || 'visible' == document.visibilityState ) {\n\t\t\t\t$( document.body ).trigger( 'update_checkout' );\n\t\t\t}\n\t\t},\n\t\t// CHANGE: Prompt user that they might lose data when closing tab or leaving the current page after they change some values in the checkout form\n\t\tmaybe_prevent_unload: function( e ) {\n\t\t\t// Ignore some fields\n\t\t\tif ( e && e.target.closest( '.payment_box, input#createaccount' ) ) { return; }\n\n\t\t\tif ( ! _updateBeforeUnload ) {\n\n\t\t\t\tvar preventUnload = function( e ) {\n\t\t\t\t\t// Prompt user if there is unsaved data\n\t\t\t\t\tif ( _updateBeforeUnload ) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\te.returnValue = '';\n\n\t\t\t\t\t\t// Proceed to update the checkout totals if the user cancel the event\n\t\t\t\t\t\t$( document.body ).trigger( 'update_checkout' );\n\n\t\t\t\t\t\t// Reset flag to update on `beforeunload`\n\t\t\t\t\t\t_updateBeforeUnload = false;\n\t\t\t\t\t\twindow.removeEventListener( 'beforeunload', preventUnload );\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\twindow.addEventListener( 'beforeunload', preventUnload );\n\t\t\t\t_updateBeforeUnload = true;\n\t\t\t}\n\t\t},\n\t\tinit_payment_methods: function() {\n\t\t\tvar $payment_methods = $( '.woocommerce-checkout' ).find( 'input[name=\"payment_method\"]' );\n\n\t\t\t// If there is one method, we can hide the radio input\n\t\t\tif ( 1 === $payment_methods.length ) {\n\t\t\t\t$payment_methods.eq(0).hide();\n\t\t\t}\n\n\t\t\t// If there was a previously selected method, check that one.\n\t\t\tif ( wc_checkout_form.selectedPaymentMethod ) {\n\t\t\t\t$( '#' + wc_checkout_form.selectedPaymentMethod ).prop( 'checked', true );\n\t\t\t}\n\n\t\t\t// If there are none selected, select the first.\n\t\t\tif ( 0 === $payment_methods.filter( ':checked' ).length ) {\n\t\t\t\t$payment_methods.eq(0).prop( 'checked', true );\n\t\t\t}\n\n\t\t\t// Get name of new selected method.\n\t\t\tvar checkedPaymentMethod = $payment_methods.filter( ':checked' ).eq(0).prop( 'id' );\n\n\t\t\tif ( $payment_methods.length > 1 ) {\n\t\t\t\t// Hide open descriptions.\n\t\t\t\t$( 'div.payment_box:not(\".' + checkedPaymentMethod + '\")' ).filter( ':visible' ).slideUp( 0 );\n\t\t\t}\n\n\t\t\t// Trigger click event for selected method\n\t\t\t$payment_methods.filter( ':checked' ).eq(0).trigger( 'click' );\n\t\t},\n\t\tget_payment_method: function() {\n\t\t\treturn wc_checkout_form.$checkout_form.find( 'input[name=\"payment_method\"]:checked' ).val();\n\t\t},\n\t\tpayment_method_selected: function( e ) {\n\t\t\te.stopPropagation();\n\n\t\t\tif ( $( '.payment_methods input.input-radio' ).length > 1 ) {\n\t\t\t\tvar target_payment_box = $( 'div.payment_box.' + $( this ).attr( 'ID' ) ),\n\t\t\t\t\tis_checked = $( this ).is( ':checked' );\n\n\t\t\t\tif ( is_checked && ! target_payment_box.is( ':visible' ) ) {\n\t\t\t\t\t$( 'div.payment_box' ).filter( ':visible' ).slideUp( 230 );\n\n\t\t\t\t\tif ( is_checked ) {\n\t\t\t\t\t\ttarget_payment_box.slideDown( 230 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$( 'div.payment_box' ).show();\n\t\t\t}\n\n\t\t\tif ( $( this ).data( 'order_button_text' ) ) {\n\t\t\t\t// CHANGE: replaced the place order button css selector with an extended custom selector\n\t\t\t\t$( _settings.checkoutPlaceOrderSelector ).text( $( this ).data( 'order_button_text' ) );\n\t\t\t} else {\n\t\t\t\t// CHANGE: replaced the place order button css selector with an extended custom selector\n\t\t\t\t$( _settings.checkoutPlaceOrderSelector ).text( $( _settings.checkoutPlaceOrderSelector ).data( 'value' ) );\n\t\t\t}\n\n\t\t\tvar selectedPaymentMethod = $( '.woocommerce-checkout input[name=\"payment_method\"]:checked' ).attr( 'id' );\n\n\t\t\tif ( selectedPaymentMethod !== wc_checkout_form.selectedPaymentMethod ) {\n\t\t\t\t$( document.body ).trigger( 'payment_method_selected' );\n\t\t\t}\n\n\t\t\t// CHANGE: Add body class for selected payment method\n\t\t\tdocument.body.classList.remove( 'has-payment-method-selected--' + wc_checkout_form.selectedPaymentMethod );\n\t\t\tdocument.body.classList.add( 'has-payment-method-selected--' + selectedPaymentMethod );\n\n\t\t\twc_checkout_form.selectedPaymentMethod = selectedPaymentMethod;\n\t\t},\n\t\ttoggle_create_account: function() {\n\t\t\t$( 'div.create-account' ).hide();\n\n\t\t\tif ( $( this ).is( ':checked' ) ) {\n\t\t\t\t// Ensure password is not pre-populated.\n\t\t\t\t$( '#account_password' ).val( '' ).trigger( 'change' );\n\t\t\t\t$( 'div.create-account' ).slideDown();\n\t\t\t}\n\t\t},\n\t\tinit_checkout: function() {\n\t\t\t$( document.body ).trigger( 'update_checkout' );\n\t\t},\n\t\tmaybe_input_changed: function( e ) {\n\t\t\tif ( wc_checkout_form.dirtyInput ) {\n\t\t\t\twc_checkout_form.input_changed( e );\n\t\t\t}\n\t\t},\n\t\t// CHANGE: Add function to set the autocomplete attribute values form data attributes. This fixes issue with lost user data when refreshing the page while using the Firefox Browser.\n\t\tset_autocomplete_attribute_from_data: function( e ) {\n\t\t\tvar $fields = $( 'form.checkout' ).find( 'input, select, textarea' );\n\t\t\t$fields.each( function() {\n\t\t\t\tif ( $( this ).attr( 'data-autocomplete' ) ) {\n\t\t\t\t\t$( this ).attr( 'autocomplete', $( this ).attr( 'data-autocomplete' ) );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\t// CHANGE: Add function to sync the terms checkbox state\n\t\tterms_checked_changed: function( e ) {\n\t\t\tvar termsCheckBoxChecked = $( e.target ).prop( 'checked' );\n\t\t\t$( _settings.checkoutTermsSelector ).prop( 'checked', termsCheckBoxChecked );\n\t\t},\n\t\tinput_changed: function( e ) {\n\t\t\twc_checkout_form.dirtyInput = e.target;\n\t\t\twc_checkout_form.maybe_update_checkout();\n\t\t},\n\t\tqueue_update_checkout: function( e ) {\n\t\t\tvar code = e.keyCode || e.which || 0;\n\n\t\t\t// CHANGE: Also skip `update_checkout` when pressing other controls keys such as \"Shift\", \"Control\", \"Command\", \"Alt\" and \"Arrows\"\n\t\t\tif ( code === 9 || code === 16 || code === 17 || code === 18 || code === 91 || code === 92 || code === 37 || code === 38 || code === 39 || code === 40 ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\twc_checkout_form.dirtyInput = this;\n\t\t\twc_checkout_form.reset_update_checkout_timer();\n\t\t\twc_checkout_form.updateTimer = setTimeout( wc_checkout_form.maybe_update_checkout, '1000' );\n\t\t},\n\t\ttrigger_update_checkout: function() {\n\t\t\twc_checkout_form.reset_update_checkout_timer();\n\t\t\twc_checkout_form.dirtyInput = false;\n\t\t\t$( document.body ).trigger( 'update_checkout' );\n\t\t},\n\t\tmaybe_update_checkout: function() {\n\t\t\tvar update_totals = true;\n\n\t\t\tif ( $( wc_checkout_form.dirtyInput ).length ) {\n\t\t\t\tvar $required_inputs = $( wc_checkout_form.dirtyInput ).closest( 'div' ).find( '.address-field.validate-required' );\n\n\t\t\t\tif ( $required_inputs.length ) {\n\t\t\t\t\t$required_inputs.each( function() {\n\t\t\t\t\t\tif ( $( this ).find( 'input.input-text' ).val() === '' ) {\n\t\t\t\t\t\t\tupdate_totals = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( update_totals ) {\n\t\t\t\twc_checkout_form.trigger_update_checkout();\n\t\t\t}\n\t\t},\n\t\t// CHANGE: Removed shipping to different address checkout `change` listener handler function\n\t\treset_update_checkout_timer: function() {\n\t\t\tclearTimeout( wc_checkout_form.updateTimer );\n\t\t},\n\t\tis_valid_json: function( raw_json ) {\n\t\t\ttry {\n\t\t\t\tvar json = JSON.parse( raw_json );\n\n\t\t\t\treturn ( json && 'object' === typeof json );\n\t\t\t} catch ( e ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\tvalidate_field: function( e ) {\n\t\t\tvar $this = $( this ),\n\t\t\t\t$parent = $this.closest( '.form-row' ),\n\t\t\t\tvalidated = true,\n\t\t\t\tvalidate_required = $parent.is( '.validate-required' ),\n\t\t\t\tvalidate_email = $parent.is( '.validate-email' ),\n\t\t\t\tvalidate_phone = $parent.is( '.validate-phone' ),\n\t\t\t\tpattern = '',\n\t\t\t\tevent_type = e.type;\n\n\t\t\tif ( 'input' === event_type ) {\n\t\t\t\t$parent.removeClass( 'woocommerce-invalid woocommerce-invalid-required-field woocommerce-invalid-email woocommerce-invalid-phone woocommerce-validated' ); // eslint-disable-line max-len\n\t\t\t}\n\n\t\t\tif ( 'validate' === event_type || 'change' === event_type ) {\n\n\t\t\t\tif ( validate_required ) {\n\t\t\t\t\tif ( 'checkbox' === $this.attr( 'type' ) && ! $this.is( ':checked' ) ) {\n\t\t\t\t\t\t$parent.removeClass( 'woocommerce-validated' ).addClass( 'woocommerce-invalid woocommerce-invalid-required-field' );\n\t\t\t\t\t\tvalidated = false;\n\t\t\t\t\t} else if ( $this.val() === '' ) {\n\t\t\t\t\t\t$parent.removeClass( 'woocommerce-validated' ).addClass( 'woocommerce-invalid woocommerce-invalid-required-field' );\n\t\t\t\t\t\tvalidated = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( validate_email ) {\n\t\t\t\t\tif ( $this.val() ) {\n\t\t\t\t\t\t/* https://stackoverflow.com/questions/2855865/jquery-validate-e-mail-address-regex */\n\t\t\t\t\t\tpattern = new RegExp( /^([a-z\\d!#$%&'*+\\-\\/=?^_`{|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+(\\.[a-z\\d!#$%&'*+\\-\\/=?^_`{|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+)*|\"((([ \\t]*\\r\\n)?[ \\t]+)?([\\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]))*(([ \\t]*\\r\\n)?[ \\t]+)?\")@(([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]*[0-9a-z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])\\.?$/i ); // eslint-disable-line max-len\n\n\t\t\t\t\t\tif ( ! pattern.test( $this.val() ) ) {\n\t\t\t\t\t\t\t$parent.removeClass( 'woocommerce-validated' ).addClass( 'woocommerce-invalid woocommerce-invalid-email woocommerce-invalid-phone' ); // eslint-disable-line max-len\n\t\t\t\t\t\t\tvalidated = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( validate_phone ) {\n\t\t\t\t\tpattern = new RegExp( /[\\s\\#0-9_\\-\\+\\/\\(\\)\\.]/g );\n\n\t\t\t\t\tif ( 0 < $this.val().replace( pattern, '' ).length ) {\n\t\t\t\t\t\t$parent.removeClass( 'woocommerce-validated' ).addClass( 'woocommerce-invalid woocommerce-invalid-phone' );\n\t\t\t\t\t\tvalidated = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( validated ) {\n\t\t\t\t\t$parent.removeClass( 'woocommerce-invalid woocommerce-invalid-required-field woocommerce-invalid-email woocommerce-invalid-phone' ).addClass( 'woocommerce-validated' ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tupdate_checkout: function( event, args ) {\n\t\t\t// Small timeout to prevent multiple requests when several fields update at the same time\n\t\t\twc_checkout_form.reset_update_checkout_timer();\n\t\t\twc_checkout_form.updateTimer = setTimeout( wc_checkout_form.update_checkout_action, '5', args );\n\t\t},\n\t\t// CHANGE: Add function to re-focus and keep value of the element that was previously focused before submitting an ajax request\n\t\tmaybe_refocus_element: function( currentFocusedElement, currentValue ) {\n\t\t\t// Bail if no element to focus\n\t\t\tif ( null === currentFocusedElement ) { return; }\n\n\t\t\trequestAnimationFrame( function() {\n\t\t\t\tvar elementToFocus;\n\n\t\t\t\t// Try findind the `select2` focusable element\n\t\t\t\tif ( currentFocusedElement.matches( '.fc-select2-field' ) ) {\n\t\t\t\t\telementToFocus = document.querySelector( '.form-row[id=\"' + currentFocusedElement.id + '\"] .select2-selection' );\n\t\t\t\t}\n\t\t\t\t// Try findind the the current focused element after updating updated element by ID\n\t\t\t\telse if ( currentFocusedElement.id ) {\n\t\t\t\t\telementToFocus = document.getElementById( currentFocusedElement.id );\n\t\t\t\t}\n\t\t\t\t// Try findind the updated element by classes\n\t\t\t\telse if ( currentFocusedElement.getAttribute( 'name' ) ) {\n\t\t\t\t\tvar nameAttr = currentFocusedElement.getAttribute( 'name' );\n\t\t\t\t\telementToFocus = document.querySelector( '[name=\"'+nameAttr+'\"]' );\n\t\t\t\t}\n\n\t\t\t\t// Try setting focus if element is found\n\t\t\t\tif ( elementToFocus && elementToFocus !== currentFocusedElement ) {\n\t\t\t\t\telementToFocus.focus();\n\n\t\t\t\t\t// Try to set current value to the focused element\n\t\t\t\t\tif ( null !== currentValue && currentValue !== elementToFocus.value ) {\n\t\t\t\t\t\telementToFocus.value = currentValue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set keyboard track position back to that previously to update\n\t\t\t\t\tsetTimeout( function(){\n\t\t\t\t\t\t// Try to set the same track position\n\t\t\t\t\t\tif( null !== elementToFocus.selectionStart && null !== elementToFocus.selectionEnd ) {\n\t\t\t\t\t\t\tif ( currentFocusedElement.selectionStart && currentFocusedElement.selectionEnd ) {\n\t\t\t\t\t\t\t\telementToFocus.selectionStart = currentFocusedElement.selectionStart;\n\t\t\t\t\t\t\t\telementToFocus.selectionEnd = currentFocusedElement.selectionEnd;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Otherwise try set the track position to the end of the field\n\t\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange\n\t\t\t\t\t\t\t// @see https://html.spec.whatwg.org/multipage/input.html#concept-input-apply\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\telementToFocus.selectionStart = elementToFocus.selectionEnd = Number.MAX_SAFE_INTEGER || 10000;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Try to select the entire content of the field\n\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select\n\t\t\t\t\t\t// @see https://html.spec.whatwg.org/multipage/input.html#concept-input-apply\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\ttry { elementToFocus.select(); }\n\t\t\t\t\t\t\tcatch { /* Do nothing */ }\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 0 );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\tupdate_checkout_action: function( args ) {\n\t\t\t// CHANGE: Check flag that allows or block updating the checkout\n\t\t\tif ( ! window.can_update_checkout ) { return; }\n\n\t\t\tif ( wc_checkout_form.xhr ) {\n\t\t\t\twc_checkout_form.xhr.abort();\n\t\t\t}\n\n\t\t\tif ( $( 'form.checkout' ).length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\targs = typeof args !== 'undefined' ? args : {\n\t\t\t\tupdate_shipping_method: true\n\t\t\t};\n\n\t\t\tvar country\t\t\t = $( '#billing_country' ).val(),\n\t\t\t\tstate\t\t\t = $( '#billing_state' ).val(),\n\t\t\t\tpostcode\t\t = $( ':input#billing_postcode' ).val(),\n\t\t\t\tcity\t\t\t = $( '#billing_city' ).val(),\n\t\t\t\taddress\t\t\t = $( ':input#billing_address_1' ).val(),\n\t\t\t\taddress_2\t\t = $( ':input#billing_address_2' ).val(),\n\t\t\t\t// CHANGE: Always get shipping address values from shipping fields\n\t\t\t\ts_country\t\t = $( '#shipping_country' ).val(),\n\t\t\t\ts_state\t\t\t = $( '#shipping_state' ).val(),\n\t\t\t\ts_postcode\t\t = $( ':input#shipping_postcode' ).val(),\n\t\t\t\ts_city\t\t\t = $( '#shipping_city' ).val(),\n\t\t\t\ts_address\t\t = $( ':input#shipping_address_1' ).val(),\n\t\t\t\ts_address_2\t\t = $( ':input#shipping_address_2' ).val(),\n\t\t\t\t// END - CHANGE: Always get shipping address values from shipping fields\n\t\t\t\t$required_inputs = $( wc_checkout_form.$checkout_form ).find( '.address-field.validate-required:visible' ),\n\t\t\t\thas_full_address = true;\n\n\t\t\tif ( $required_inputs.length ) {\n\t\t\t\t$required_inputs.each( function() {\n\t\t\t\t\tif ( $( this ).find( ':input' ).val() === '' ) {\n\t\t\t\t\t\thas_full_address = false;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// CHANGE: Removed if handling of different shipping address checkbox, always get shipping address values from shipping fields (see above)\n\n\t\t\tvar data = {\n\t\t\t\tsecurity : wc_checkout_params.update_order_review_nonce,\n\t\t\t\tpayment_method : wc_checkout_form.get_payment_method(),\n\t\t\t\tcountry : country,\n\t\t\t\tstate : state,\n\t\t\t\tpostcode : postcode,\n\t\t\t\tcity : city,\n\t\t\t\taddress : address,\n\t\t\t\taddress_2 : address_2,\n\t\t\t\ts_country : s_country,\n\t\t\t\ts_state : s_state,\n\t\t\t\ts_postcode : s_postcode,\n\t\t\t\ts_city : s_city,\n\t\t\t\ts_address : s_address,\n\t\t\t\ts_address_2 : s_address_2,\n\t\t\t\thas_full_address: has_full_address,\n\t\t\t\tpost_data : $( 'form.checkout' ).serialize()\n\t\t\t};\n\n\t\t\tif ( false !== args.update_shipping_method ) {\n\t\t\t\tvar shipping_methods = {};\n\n\t\t\t\t// eslint-disable-next-line max-len\n\t\t\t\t$( 'select.shipping_method, input[name^=\"shipping_method\"][type=\"radio\"]:checked, input[name^=\"shipping_method\"][type=\"hidden\"]' ).each( function() {\n\t\t\t\t\tshipping_methods[ $( this ).data( 'index' ) ] = $( this ).val();\n\t\t\t\t} );\n\n\t\t\t\tdata.shipping_method = shipping_methods;\n\t\t\t}\n\n\t\t\t// CHANGE: Also block the shipping methods section when updating\n\t\t\t$( '.woocommerce-checkout-payment, .woocommerce-checkout-review-order-table .fc-shipping-method__packages' ).block({\n\t\t\t\tmessage: null,\n\t\t\t\toverlayCSS: {\n\t\t\t\t\tbackground: '#fff',\n\t\t\t\t\topacity: 0.6\n\t\t\t\t}\n\t\t\t});\n\n\t\t\twc_checkout_form.xhr = $.ajax({\n\t\t\t\ttype:\t\t'POST',\n\t\t\t\turl:\t\twc_checkout_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'update_order_review' ),\n\t\t\t\tdata:\t\tdata,\n\t\t\t\tsuccess:\tfunction( data ) {\n\n\t\t\t\t\t// Reload the page if requested\n\t\t\t\t\tif ( data && true === data.reload ) {\n\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Remove any notices added previously\n\t\t\t\t\t$( '.woocommerce-NoticeGroup-updateOrderReview' ).remove();\n\n\t\t\t\t\t// CHANGE: replaced the terms checkbox css selector\n\t\t\t\t\tvar termsCheckBoxChecked = $( _settings.checkoutTermsSelector ).prop( 'checked' );\n\n\t\t\t\t\t// Save payment details to a temporary object\n\t\t\t\t\tvar paymentDetails = {};\n\t\t\t\t\t$( '.payment_box :input' ).each( function() {\n\t\t\t\t\t\tvar ID = $( this ).attr( 'id' );\n\n\t\t\t\t\t\tif ( ID ) {\n\t\t\t\t\t\t\tif ( $.inArray( $( this ).attr( 'type' ), [ 'checkbox', 'radio' ] ) !== -1 ) {\n\t\t\t\t\t\t\t\tpaymentDetails[ ID ] = $( this ).prop( 'checked' );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tpaymentDetails[ ID ] = $( this ).val();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\t// CHANGE: Get current element with focus, will re-set focus after updating the fragments\n\t\t\t\t\tvar currentFocusedElement = document.activeElement;\n\t\t\t\t\tvar currentValue = document.activeElement.value;\n\n\t\t\t\t\t// Maybe set current element with focus to the form row for `select2` fields\n\t\t\t\t\tvar currentFocusedFormRow = currentFocusedElement.closest( '.fc-select2-field' );\n\t\t\t\t\tif ( currentFocusedFormRow ) {\n\t\t\t\t\t\t// Remove focus from current element as it will be replaced\n\t\t\t\t\t\t// This fixes an issue where `select2` fields would not work properly\n\t\t\t\t\t\t// after checkout is updated while focus is on a `select2` field\n\t\t\t\t\t\tif ( currentFocusedElement ) { currentFocusedElement.blur(); }\n\n\t\t\t\t\t\tcurrentFocusedElement = currentFocusedFormRow;\n\t\t\t\t\t}\n\t\t\t\t\t// CHANGE: END - Get current element with focus, will re-set focus after updating the fragments\n\n\t\t\t\t\t// Always update the fragments\n\t\t\t\t\tif ( data && data.fragments ) {\n\t\t\t\t\t\t// CHANGE: Try to remove select2 components from existing fields before replacing fragments\n\t\t\t\t\t\t$( 'select.country_select, select.state_select' ).each( function() {\n\t\t\t\t\t\t\tvar field = $( this );\n\t\t\t\t\t\t\tif ( field.hasClass( 'select2-hidden-accessible' ) ) { // Field has `select2` initialized\n\t\t\t\t\t\t\t\tif ( typeof field.selectWoo === 'function' ) { field.selectWoo( 'destroy' ); }\n\t\t\t\t\t\t\t\telse if ( typeof field.select2 === 'function' ) { field.select2( 'destroy' ); }\n\t\t\t\t\t\t\t\tfield.off( 'select2:select' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\t// CHANGE: END - Try to remove select2 components from existing fields before replacing fragments\n\n\t\t\t\t\t\t// CHANGE: Try to remove intl-tel-input components from existing fields before replacing fragments\n\t\t\t\t\t\tif ( window.intlTelInput && window.intlTelInputGlobals ) {\n\t\t\t\t\t\t\tvar allPhoneFields = document.querySelectorAll( _settings.phoneFieldSelector );\n\t\t\t\t\t\t\tfor ( var i = 0; i < allPhoneFields.length; i++ ) {\n\t\t\t\t\t\t\t\tvar field = allPhoneFields[i];\n\t\t\t\t\t\t\t\tvar phoneField = window.intlTelInputGlobals.getInstance( field );\n\t\t\t\t\t\t\t\tif ( phoneField ) {\n\t\t\t\t\t\t\t\t\tvar preservedValue = phoneField.getNumber();\n\t\t\t\t\t\t\t\t\tphoneField.destroy();\n\t\t\t\t\t\t\t\t\tfield.value = preservedValue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// CHANGE: END - Try to remove intl-tel-input components from existing fields before replacing fragments\n\n\t\t\t\t\t\t$.each( data.fragments, function ( key, value ) {\n\t\t\t\t\t\t\t// CHANGE: Maybe set to skip fragment with the focus within it. This avoids unexpected closing of mobile keyboard and lost of focus when updating fragments.\n\t\t\t\t\t\t\tvar fragmentToReplace = document.querySelector( key );\n\t\t\t\t\t\t\tvar skipReplace = false;\n\t\t\t\t\t\t\tif ( fragmentToReplace && currentFocusedElement.closest( key ) && currentFocusedElement.closest( _settings.focusedFieldSkipFragmentReplaceSelector ) ) {\n\t\t\t\t\t\t\t\tskipReplace = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// CHANGE: Allow fragments to be replaced every time even when their contents are equal the existing elements in the DOM\n\t\t\t\t\t\t\tif ( ! skipReplace && ( ! wc_checkout_form.fragments || wc_checkout_form.fragments[ key ] !== value || ( value && -1 !== value.toString().indexOf( 'fc-fragment-always-replace' ) ) ) ) {\n\t\t\t\t\t\t\t\t$( key ).replaceWith( value );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$( key ).unblock();\n\t\t\t\t\t\t} );\n\t\t\t\t\t\twc_checkout_form.fragments = data.fragments;\n\t\t\t\t\t}\n\n\t\t\t\t\t// CHANGE: Re-set focus to the element with focus previously to updating fragments\n\t\t\t\t\twc_checkout_form.maybe_refocus_element( currentFocusedElement, currentValue );\n\n\t\t\t\t\t// Recheck the terms and conditions box, if needed\n\t\t\t\t\tif ( termsCheckBoxChecked ) {\n\t\t\t\t\t\t// CHANGE: replaced the terms checkbox css selector\n\t\t\t\t\t\t$( _settings.checkoutTermsSelector ).prop( 'checked', true );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Fill in the payment details if possible without overwriting data if set.\n\t\t\t\t\tif ( ! $.isEmptyObject( paymentDetails ) ) {\n\t\t\t\t\t\t$( '.payment_box :input' ).each( function() {\n\t\t\t\t\t\t\tvar ID = $( this ).attr( 'id' );\n\t\t\t\t\t\t\tif ( ID ) {\n\t\t\t\t\t\t\t\tif ( $.inArray( $( this ).attr( 'type' ), [ 'checkbox', 'radio' ] ) !== -1 ) {\n\t\t\t\t\t\t\t\t\t$( this ).prop( 'checked', paymentDetails[ ID ] ).trigger( 'change' );\n\t\t\t\t\t\t\t\t} else if ( $.inArray( $( this ).attr( 'type' ), [ 'select' ] ) !== -1 ) {\n\t\t\t\t\t\t\t\t\t$( this ).val( paymentDetails[ ID ] ).trigger( 'change' );\n\t\t\t\t\t\t\t\t} else if ( null !== $( this ).val() && 0 === $( this ).val().length ) {\n\t\t\t\t\t\t\t\t\t$( this ).val( paymentDetails[ ID ] ).trigger( 'change' );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check for error\n\t\t\t\t\tif ( data && 'failure' === data.result ) {\n\n\t\t\t\t\t\tvar $form = $( 'form.checkout' );\n\n\t\t\t\t\t\t// Remove notices from all sources\n\t\t\t\t\t\t$( '.woocommerce-error, .woocommerce-message' ).remove();\n\n\t\t\t\t\t\t// Add new errors returned by this event\n\t\t\t\t\t\tif ( data.messages ) {\n\t\t\t\t\t\t\t$form.prepend( '
' + data.messages + '
' ); // eslint-disable-line max-len\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$form.prepend( data );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Lose focus for all fields\n\t\t\t\t\t\t$form.find( '.input-text, select, input:checkbox' ).trigger( 'validate' ).trigger( 'blur' );\n\n\t\t\t\t\t\twc_checkout_form.scroll_to_notices();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Re-init methods\n\t\t\t\t\twc_checkout_form.init_payment_methods();\n\n\t\t\t\t\t// CHANGE: Set to not prompt user before leaving the page\n\t\t\t\t\t_updateBeforeUnload = false;\n\n\t\t\t\t\t// Fire updated_checkout event.\n\t\t\t\t\t$( document.body ).trigger( 'updated_checkout', [ data ] );\n\t\t\t\t}\n\n\t\t\t});\n\t\t},\n\t\thandleUnloadEvent: function( e ) {\n\t\t\t// Modern browsers have their own standard generic messages that they will display.\n\t\t\t// Confirm, alert, prompt or custom message are not allowed during the unload event\n\t\t\t// Browsers will display their own standard messages\n\n\t\t\t// Check if the browser is Internet Explorer\n\t\t\tif((navigator.userAgent.indexOf('MSIE') !== -1 ) || (!!document.documentMode)) {\n\t\t\t\t// IE handles unload events differently than modern browsers\n\t\t\t\te.preventDefault();\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t\tattachUnloadEventsOnSubmit: function() {\n\t\t\t$( window ).on('beforeunload', this.handleUnloadEvent);\n\t\t},\n\t\tdetachUnloadEventsOnSubmit: function() {\n\t\t\t$( window ).off('beforeunload', this.handleUnloadEvent);\n\t\t},\n\t\tblockOnSubmit: function( $form ) {\n\t\t\tvar isBlocked = $form.data( 'blockUI.isBlocked' );\n\n\t\t\tif ( 1 !== isBlocked ) {\n\t\t\t\t$form.block({\n\t\t\t\t\tmessage: null,\n\t\t\t\t\toverlayCSS: {\n\t\t\t\t\t\tbackground: '#fff',\n\t\t\t\t\t\topacity: 0.6\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tsubmitOrder: function() {\n\t\t\twc_checkout_form.blockOnSubmit( $( this ) );\n\t\t},\n\t\tsubmit: function() {\n\t\t\twc_checkout_form.reset_update_checkout_timer();\n\t\t\tvar $form = $( this );\n\n\t\t\tif ( $form.is( '.processing' ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// CHANGE: Reset flag to update on `beforeunload`\n\t\t\t_updateBeforeUnload = false;\n\n\t\t\t// Trigger a handler to let gateways manipulate the checkout if needed\n\t\t\t// eslint-disable-next-line max-len\n\t\t\tif ( $form.triggerHandler( 'checkout_place_order' ) !== false && $form.triggerHandler( 'checkout_place_order_' + wc_checkout_form.get_payment_method() ) !== false ) {\n\n\t\t\t\t$form.addClass( 'processing' );\n\n\t\t\t\t// CHANGE: Disable place order button\n\t\t\t\tvar currentFocusedElement = document.activeElement;\n\t\t\t\t$( _settings.checkoutPlaceOrderSelector ).attr( 'disabled', 'disabled' );\n\t\t\t\t$( _settings.checkoutPlaceOrderSelector ).addClass( 'disabled' );\n\t\t\t\t// END - Disable place order button\n\n\t\t\t\twc_checkout_form.blockOnSubmit( $form );\n\n\t\t\t\t// Attach event to block reloading the page when the form has been submitted\n\t\t\t\twc_checkout_form.attachUnloadEventsOnSubmit();\n\n\t\t\t\t// ajaxSetup is global, but we use it to ensure JSON is valid once returned.\n\t\t\t\t$.ajaxSetup( {\n\t\t\t\t\tdataFilter: function( raw_response, dataType ) {\n\t\t\t\t\t\t// We only want to work with JSON\n\t\t\t\t\t\tif ( 'json' !== dataType ) {\n\t\t\t\t\t\t\treturn raw_response;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( wc_checkout_form.is_valid_json( raw_response ) ) {\n\t\t\t\t\t\t\treturn raw_response;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Attempt to fix the malformed JSON\n\t\t\t\t\t\t\tvar maybe_valid_json = raw_response.match( /{\"result.*}/ );\n\n\t\t\t\t\t\t\tif ( null === maybe_valid_json ) {\n\t\t\t\t\t\t\t\tconsole.log( 'Unable to fix malformed JSON' );\n\t\t\t\t\t\t\t} else if ( wc_checkout_form.is_valid_json( maybe_valid_json[0] ) ) {\n\t\t\t\t\t\t\t\tconsole.log( 'Fixed malformed JSON. Original:' );\n\t\t\t\t\t\t\t\tconsole.log( raw_response );\n\t\t\t\t\t\t\t\traw_response = maybe_valid_json[0];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconsole.log( 'Unable to fix malformed JSON' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn raw_response;\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\t$.ajax({\n\t\t\t\t\ttype:\t\t'POST',\n\t\t\t\t\turl:\t\twc_checkout_params.checkout_url,\n\t\t\t\t\tdata:\t\t$form.serialize(),\n\t\t\t\t\tdataType: 'json',\n\t\t\t\t\tsuccess:\tfunction( result ) {\n\t\t\t\t\t\t// Detach the unload handler that prevents a reload / redirect\n\t\t\t\t\t\twc_checkout_form.detachUnloadEventsOnSubmit();\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif ( 'success' === result.result && $form.triggerHandler( 'checkout_place_order_success', result ) !== false ) {\n\t\t\t\t\t\t\t\tif ( -1 === result.redirect.indexOf( 'https://' ) || -1 === result.redirect.indexOf( 'http://' ) ) {\n\t\t\t\t\t\t\t\t\twindow.location = result.redirect;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\twindow.location = decodeURI( result.redirect );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if ( 'failure' === result.result ) {\n\t\t\t\t\t\t\t\tthrow 'Result failure';\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthrow 'Invalid response';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch( err ) {\n\t\t\t\t\t\t\t// Reload page\n\t\t\t\t\t\t\tif ( true === result.reload ) {\n\t\t\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// CHANGE: Unblock the place order button\n\t\t\t\t\t\t\t$( _settings.checkoutPlaceOrderSelector ).removeAttr( 'disabled' );\n\t\t\t\t\t\t\t$( _settings.checkoutPlaceOrderSelector ).removeClass( 'disabled' );\n\t\t\t\t\t\t\twc_checkout_form.maybe_refocus_element( currentFocusedElement );\n\t\t\t\t\t\t\t// END - Unblock the place order button\n\n\t\t\t\t\t\t\t// Trigger update in case we need a fresh nonce\n\t\t\t\t\t\t\tif ( true === result.refresh ) {\n\t\t\t\t\t\t\t\t$( document.body ).trigger( 'update_checkout' );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Add new errors\n\t\t\t\t\t\t\tif ( result.messages ) {\n\t\t\t\t\t\t\t\twc_checkout_form.submit_error( result.messages );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twc_checkout_form.submit_error( '
' + wc_checkout_params.i18n_checkout_error + '
' ); // eslint-disable-line max-len\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror:\tfunction( jqXHR, textStatus, errorThrown ) {\n\t\t\t\t\t\t// Detach the unload handler that prevents a reload / redirect\n\t\t\t\t\t\twc_checkout_form.detachUnloadEventsOnSubmit();\n\n\t\t\t\t\t\twc_checkout_form.submit_error(\n\t\t\t\t\t\t\t'
' +\n\t\t\t\t\t\t\t( errorThrown || wc_checkout_params.i18n_checkout_error ) +\n\t\t\t\t\t\t\t'
'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\t\tsubmit_error: function( error_message ) {\n\t\t\t$( '.woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message' ).remove();\n\t\t\twc_checkout_form.$checkout_form.prepend( '
' + error_message + '
' ); // eslint-disable-line max-len\n\t\t\twc_checkout_form.$checkout_form.removeClass( 'processing' ).unblock();\n\t\t\t// CHANGE: Unblock the place order button\n\t\t\t$( _settings.checkoutPlaceOrderSelector ).removeAttr( 'disabled' );\n\t\t\t$( _settings.checkoutPlaceOrderSelector ).removeClass( 'disabled' );\n\t\t\t// END - Unblock the place order button\n\t\t\twc_checkout_form.$checkout_form.find( '.input-text, select, input:checkbox' ).trigger( 'validate' ).trigger( 'blur' );\n\t\t\twc_checkout_form.scroll_to_notices();\n\t\t\t$( document.body ).trigger( 'checkout_error' , [ error_message ] );\n\t\t},\n\t\tscroll_to_notices: function() {\n\t\t\tvar scrollElement = $( '.woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout' );\n\n\t\t\tif ( ! scrollElement.length ) {\n\t\t\t\tscrollElement = $( 'form.checkout' );\n\t\t\t}\n\t\t\t$.scroll_to_notices( scrollElement );\n\t\t}\n\t};\n\n\tvar wc_checkout_coupons = {\n\t\tinit: function() {\n\t\t\t$( document.body ).on( 'click', 'a.showcoupon', this.show_coupon_form );\n\t\t\t$( document.body ).on( 'click', '.woocommerce-remove-coupon', this.remove_coupon );\n\t\t\t$( 'form.checkout_coupon' ).hide().on( 'submit', this.submit );\n\t\t},\n\t\tshow_coupon_form: function() {\n\t\t\t$( '.checkout_coupon' ).slideToggle( 400, function() {\n\t\t\t\t$( '.checkout_coupon' ).find( ':input:eq(0)' ).trigger( 'focus' );\n\t\t\t});\n\t\t\treturn false;\n\t\t},\n\t\tsubmit: function() {\n\t\t\tvar $form = $( this );\n\n\t\t\tif ( $form.is( '.processing' ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t$form.addClass( 'processing' ).block({\n\t\t\t\tmessage: null,\n\t\t\t\toverlayCSS: {\n\t\t\t\t\tbackground: '#fff',\n\t\t\t\t\topacity: 0.6\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tvar data = {\n\t\t\t\tsecurity:\t\twc_checkout_params.apply_coupon_nonce,\n\t\t\t\tcoupon_code:\t$form.find( 'input[name=\"coupon_code\"]' ).val()\n\t\t\t};\n\n\t\t\t$.ajax({\n\t\t\t\ttype:\t\t'POST',\n\t\t\t\turl:\t\twc_checkout_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'apply_coupon' ),\n\t\t\t\tdata:\t\tdata,\n\t\t\t\tsuccess:\tfunction( code ) {\n\t\t\t\t\t$( '.woocommerce-error, .woocommerce-message' ).remove();\n\t\t\t\t\t$form.removeClass( 'processing' ).unblock();\n\n\t\t\t\t\tif ( code ) {\n\t\t\t\t\t\t$form.before( code );\n\t\t\t\t\t\t$form.slideUp();\n\n\t\t\t\t\t\t$( document.body ).trigger( 'applied_coupon_in_checkout', [ data.coupon_code ] );\n\t\t\t\t\t\t$( document.body ).trigger( 'update_checkout', { update_shipping_method: false } );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdataType: 'html'\n\t\t\t});\n\n\t\t\treturn false;\n\t\t},\n\t\tremove_coupon: function( e ) {\n\t\t\t// CHANGE: Bail when Fluid Checkout integrated coupon code feature is enabled\n\t\t\tif ( _settings.checkoutCoupons && 'yes' === _settings.checkoutCoupons.isEnabled ) { return; }\n\n\t\t\te.preventDefault();\n\n\t\t\tvar container = $( this ).parents( '.woocommerce-checkout-review-order' ),\n\t\t\t\tcoupon = $( this ).data( 'coupon' );\n\n\t\t\tcontainer.addClass( 'processing' ).block({\n\t\t\t\tmessage: null,\n\t\t\t\toverlayCSS: {\n\t\t\t\t\tbackground: '#fff',\n\t\t\t\t\topacity: 0.6\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tvar data = {\n\t\t\t\tsecurity: wc_checkout_params.remove_coupon_nonce,\n\t\t\t\tcoupon: coupon\n\t\t\t};\n\n\t\t\t$.ajax({\n\t\t\t\ttype: 'POST',\n\t\t\t\turl: wc_checkout_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'remove_coupon' ),\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function( code ) {\n\t\t\t\t\t$( '.woocommerce-error, .woocommerce-message' ).remove();\n\t\t\t\t\tcontainer.removeClass( 'processing' ).unblock();\n\n\t\t\t\t\tif ( code ) {\n\t\t\t\t\t\t$( 'form.woocommerce-checkout' ).before( code );\n\n\t\t\t\t\t\t$( document.body ).trigger( 'removed_coupon_in_checkout', [ data.coupon ] );\n\t\t\t\t\t\t$( document.body ).trigger( 'update_checkout', { update_shipping_method: false } );\n\n\t\t\t\t\t\t// Remove coupon code from coupon field\n\t\t\t\t\t\t$( 'form.checkout_coupon' ).find( 'input[name=\"coupon_code\"]' ).val( '' );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: function ( jqXHR ) {\n\t\t\t\t\tif ( wc_checkout_params.debug_mode ) {\n\t\t\t\t\t\t/* jshint devel: true */\n\t\t\t\t\t\tconsole.log( jqXHR.responseText );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdataType: 'html'\n\t\t\t});\n\t\t}\n\t};\n\n\tvar wc_checkout_login_form = {\n\t\tinit: function() {\n\t\t\t$( document.body ).on( 'click', 'a.showlogin', this.show_login_form );\n\t\t},\n\t\tshow_login_form: function() {\n\t\t\t$( 'form.login, form.woocommerce-form--login' ).slideToggle();\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tvar wc_terms_toggle = {\n\t\tinit: function() {\n\t\t\t$( document.body ).on( 'click', 'a.woocommerce-terms-and-conditions-link', this.toggle_terms );\n\t\t},\n\n\t\ttoggle_terms: function() {\n\t\t\tif ( $( '.woocommerce-terms-and-conditions' ).length ) {\n\t\t\t\t$( '.woocommerce-terms-and-conditions' ).slideToggle( function() {\n\t\t\t\t\tvar link_toggle = $( '.woocommerce-terms-and-conditions-link' );\n\n\t\t\t\t\tif ( $( '.woocommerce-terms-and-conditions' ).is( ':visible' ) ) {\n\t\t\t\t\t\tlink_toggle.addClass( 'woocommerce-terms-and-conditions-link--open' );\n\t\t\t\t\t\tlink_toggle.removeClass( 'woocommerce-terms-and-conditions-link--closed' );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlink_toggle.removeClass( 'woocommerce-terms-and-conditions-link--open' );\n\t\t\t\t\t\tlink_toggle.addClass( 'woocommerce-terms-and-conditions-link--closed' );\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t};\n\n\twc_checkout_form.init();\n\twc_checkout_coupons.init();\n\twc_checkout_login_form.init();\n\twc_terms_toggle.init();\n});\n"],"names":["jQuery","$","wc_checkout_params","window","can_update_checkout","extend","extended","deep","i","Object","prototype","toString","call","arguments","length","prop","obj","hasOwnProperty","_updateBeforeUnload","blockUI","defaults","overlayCSS","cursor","_settings","checkoutPlaceOrderSelector","checkoutTermsSelector","checkoutUpdateFieldsSelector","checkoutUpdateBeforeUnload","focusedFieldSkipFragmentReplaceSelector","phoneFieldSelector","wc_checkout_form","updateTimer","dirtyInput","selectedPaymentMethod","xhr","$order_review","$checkout_form","init","fcSettings","document","body","on","this","update_checkout","init_checkout","set_autocomplete_attribute_from_data","payment_method_selected","hasClass","submitOrder","attr","submit","validate_field","trigger_update_checkout","input_changed","maybe_input_changed","queue_update_checkout","addEventListener","maybe_update_checkout_visibility_change","maybe_prevent_unload","billing_same_shipping_changed","maybe_reinitialize_collapsible_blocks","terms_checked_changed","init_payment_methods","is_checkout","trigger","option_guest_checkout","toggle_create_account","e","checkbox","fieldsWrapper","CollapsibleBlock","querySelector","checked","collapse","expand","collapsibleBlock","collapsibleBlocks","querySelectorAll","getInstance","initializeElement","visibilityState","preventUnload","target","closest","preventDefault","returnValue","removeEventListener","$payment_methods","find","checkedPaymentMethod","eq","hide","filter","slideUp","get_payment_method","val","stopPropagation","target_payment_box","is_checked","is","slideDown","show","data","text","classList","remove","add","each","termsCheckBoxChecked","maybe_update_checkout","code","keyCode","which","reset_update_checkout_timer","setTimeout","$required_inputs","update_totals","clearTimeout","is_valid_json","raw_json","json","JSON","parse","$this","$parent","validated","validate_required","validate_email","validate_phone","pattern","event_type","type","removeClass","addClass","RegExp","test","replace","event","args","update_checkout_action","maybe_refocus_element","currentFocusedElement","currentValue","requestAnimationFrame","nameAttr","elementToFocus","matches","id","getElementById","getAttribute","focus","value","selectionStart","selectionEnd","Number","MAX_SAFE_INTEGER","select","country","state","postcode","city","address","address_2","s_country","s_state","s_postcode","s_city","s_address","s_address_2","has_full_address","shipping_methods","abort","update_shipping_method","security","update_order_review_nonce","payment_method","post_data","serialize","shipping_method","block","message","background","opacity","ajax","url","wc_ajax_url","success","reload","location","paymentDetails","ID","inArray","activeElement","currentFocusedFormRow","blur","fragments","field","selectWoo","select2","off","intlTelInput","intlTelInputGlobals","allPhoneFields","preservedValue","phoneField","getNumber","destroy","key","skipReplace","indexOf","replaceWith","unblock","isEmptyObject","result","$form","messages","prepend","scroll_to_notices","handleUnloadEvent","navigator","userAgent","documentMode","attachUnloadEventsOnSubmit","detachUnloadEventsOnSubmit","blockOnSubmit","triggerHandler","ajaxSetup","dataFilter","raw_response","dataType","maybe_valid_json","match","console","log","checkout_url","redirect","decodeURI","err","removeAttr","refresh","submit_error","i18n_checkout_error","error","jqXHR","textStatus","errorThrown","error_message","scrollElement","wc_checkout_coupons","show_coupon_form","remove_coupon","slideToggle","apply_coupon_nonce","coupon_code","before","container","checkoutCoupons","isEnabled","parents","coupon","remove_coupon_nonce","debug_mode","responseText","wc_checkout_login_form","show_login_form","wc_terms_toggle","toggle_terms","link_toggle"],"mappings":"AAOAA,OAAQ,SAAUC,GAGjB,GAAmC,oBAAvBC,mBACX,OAAO,EAIRC,OAAOC,qBAAsB,EA2BhB,SAATC,IAEH,IAAIC,EAAW,GACXC,GAAO,EACPC,EAAI,EAuBR,IApBwD,qBAAnDC,OAAOC,UAAUC,SAASC,KAAMC,UAAU,MAC9CN,EAAOM,UAAU,GACjBL,KAkBMA,EAAIK,UAAUC,OAAQN,IAAK,CAbxBO,OAAAA,EAcT,IAdSA,EADYC,EAeXH,UAAUL,GAdpB,IAASO,KAAQC,EACZA,EAAIC,eAAeF,KAElBR,GAAsD,oBAA9CE,OAAOC,UAAUC,SAASC,KAAKI,EAAID,IAC9CT,EAASS,GAAQV,EAAOC,EAASS,GAAOC,EAAID,IAE5CT,EAASS,GAAQC,EAAID,IAYzB,OAAOT,EAtDR,IAAIY,IAHJjB,EAAEkB,QAAQC,SAASC,WAAWC,OAAS,WAMnCC,EAAY,CACfC,2BAA4B,uCAC5BC,sBAAuB,qBACvBC,6BAA8B,6EAC9BC,2BAA4B,MAE5BC,wCAAyC,8XAEzCC,mBAAoB,sFA8CjBC,EAAmB,CACtBC,aAAa,EACbC,YAAY,EACZC,uBAAuB,EACvBC,KAAK,EACLC,cAAelC,EAAG,iBAClBmC,eAAgBnC,EAAG,iBACnBoC,KAAM,WAELd,EAAYlB,GAAQ,EAAMkB,EAAWpB,OAAOmC,YAE5CrC,EAAGsC,SAASC,MAAOC,GAAI,kBAAmBC,KAAKC,iBAC/C1C,EAAGsC,SAASC,MAAOC,GAAI,gBAAiBC,KAAKE,eAG7C3C,EAAGsC,SAASC,MAAOC,GAAI,gBAAiBC,KAAKG,sCAC7C5C,EAAGsC,SAASC,MAAOC,GAAI,mBAAoBC,KAAKG,sCAGhDH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