'\n + order.billing.payment.selectedPaymentInstruments[0].maskedCreditCardNumber\n + '
').promise(); // eslint-disable-line\n setTimeout(function () {\n p.done(); // eslint-disable-line\n }, 500);\n return p; // eslint-disable-line\n },\n\n /**\n * Initialize the checkout stage.\n *\n * TODO: update this to allow stage to be set from server?\n */\n initialize: function () {\n // set the initial state of checkout\n members.currentStage = checkoutStages\n .indexOf($('.data-checkout-stage').data('checkout-stage'));\n $(plugin).attr('data-checkout-stage', checkoutStages[members.currentStage]);\n\n //\n // Handle Payment option selection\n //\n $('input[name$=\"paymentMethod\"]', plugin).on('change', function () {\n $('.credit-card-form').toggle($(this).val() === 'CREDIT_CARD');\n });\n\n //\n // Handle Next State button click\n //\n $(plugin).on('click', '.next-step-button button', function () {\n members.nextStage();\n });\n\n //\n // Handle Edit buttons on shipping and payment summary cards\n //\n $('.shipping-summary .edit-button', plugin).on('click', function () {\n if (!$('#checkout-main').hasClass('multi-ship')) {\n $('body').trigger('shipping:selectSingleShipping');\n }\n\n members.gotoStage('shipping');\n });\n\n $('.payment-summary .edit-button', plugin).on('click', function () {\n members.gotoStage('payment');\n });\n\n //\n // remember stage (e.g. shipping)\n //\n updateUrl(members.currentStage);\n\n //\n // Listen for foward/back button press and move to correct checkout-stage\n //\n $(window).on('popstate', function (e) {\n //\n // Back button when event state less than current state in ordered\n // checkoutStages array.\n //\n if (e.state === null ||\n checkoutStages.indexOf(e.state) < members.currentStage) {\n members.handlePrevStage(false);\n } else if (checkoutStages.indexOf(e.state) > members.currentStage) {\n // Forward button pressed\n members.handleNextStage(false);\n }\n });\n\n //\n // Set the form data\n //\n plugin.data('formData', formData);\n },\n\n /**\n * The next checkout state step updates the css for showing correct buttons etc...\n */\n nextStage: function () {\n var promise = members.updateStage();\n\n promise.done(function () {\n // Update UI with new stage\n members.handleNextStage(true);\n });\n\n promise.fail(function (data) {\n // show errors\n if (data) {\n if (data.errorStage) {\n members.gotoStage(data.errorStage.stage);\n\n if (data.errorStage.step === 'billingAddress') {\n var $billingAddressSameAsShipping = $(\n 'input[name$=\"_shippingAddressUseAsBillingAddress\"]'\n );\n if ($billingAddressSameAsShipping.is(':checked')) {\n $billingAddressSameAsShipping.prop('checked', false);\n }\n }\n }\n\n if (data.errorMessage) {\n $('.error-message').show();\n $('.error-message-text').text(data.errorMessage);\n }\n }\n });\n },\n\n /**\n * The next checkout state step updates the css for showing correct buttons etc...\n *\n * @param {boolean} bPushState - boolean when true pushes state using the history api.\n */\n handleNextStage: function (bPushState) {\n if (members.currentStage < checkoutStages.length - 1) {\n // move stage forward\n members.currentStage++;\n\n //\n // show new stage in url (e.g.payment)\n //\n if (bPushState) {\n updateUrl(members.currentStage);\n }\n }\n\n // Set the next stage on the DOM\n $(plugin).attr('data-checkout-stage', checkoutStages[members.currentStage]);\n },\n\n /**\n * Previous State\n */\n handlePrevStage: function () {\n if (members.currentStage > 0) {\n // move state back\n members.currentStage--;\n updateUrl(members.currentStage);\n }\n\n $(plugin).attr('data-checkout-stage', checkoutStages[members.currentStage]);\n },\n\n /**\n * Use window history to go to a checkout stage\n * @param {string} stageName - the checkout state to goto\n */\n gotoStage: function (stageName) {\n members.currentStage = checkoutStages.indexOf(stageName);\n updateUrl(members.currentStage);\n $(plugin).attr('data-checkout-stage', checkoutStages[members.currentStage]);\n }\n };\n\n //\n // Initialize the checkout\n //\n members.initialize();\n\n return this;\n };\n}(jQuery));\n\n\nvar exports = {\n initialize: function () {\n $('#checkout-main').checkout();\n },\n\n updateCheckoutView: function () {\n $('body').on('checkout:updateCheckoutView', function (e, data) {\n shippingHelpers.methods.updateMultiShipInformation(data.order);\n summaryHelpers.updateTotals(data.order.totals);\n data.order.shipping.forEach(function (shipping) {\n shippingHelpers.methods.updateShippingInformation(\n shipping,\n data.order,\n data.customer,\n data.options\n );\n });\n billingHelpers.methods.updateBillingInformation(\n data.order,\n data.customer,\n data.options\n );\n billingHelpers.methods.updatePaymentInformation(data.order, data.options);\n summaryHelpers.updateOrderProductSummaryInformation(data.order, data.options);\n });\n },\n\n disableButton: function () {\n $('body').on('checkout:disableButton', function (e, button) {\n $(button).prop('disabled', true);\n });\n },\n\n enableButton: function () {\n $('body').on('checkout:enableButton', function (e, button) {\n $(button).prop('disabled', false);\n });\n }\n\n\n};\n\n[billingHelpers, shippingHelpers, addressHelpers].forEach(function (library) {\n Object.keys(library).forEach(function (item) {\n if (typeof library[item] === 'object') {\n exports[item] = $.extend({}, exports[item], library[item]);\n } else {\n exports[item] = library[item];\n }\n });\n});\n\nmodule.exports = exports;\n\n\n//# sourceURL=webpack:///../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/checkout.js?");
-
-/***/ }),
-
-/***/ "../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/formErrors.js":
-/*!******************************************************************************************************************************!*\
- !*** ../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/formErrors.js ***!
- \******************************************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nvar scrollAnimate = __webpack_require__(/*! ../components/scrollAnimate */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/scrollAnimate.js\");\n\n/**\n * Display error messages and highlight form fields with errors.\n * @param {string} parentSelector - the form which contains the fields\n * @param {Object} fieldErrors - the fields with errors\n */\nfunction loadFormErrors(parentSelector, fieldErrors) { // eslint-disable-line\n // Display error messages and highlight form fields with errors.\n $.each(fieldErrors, function (attr) {\n $('*[name=' + attr + ']', parentSelector)\n .addClass('is-invalid')\n .siblings('.invalid-feedback')\n .html(fieldErrors[attr]);\n });\n // Animate to top of form that has errors\n scrollAnimate($(parentSelector));\n}\n\n/**\n * Clear the form errors.\n * @param {string} parentSelector - the parent form selector.\n */\nfunction clearPreviousErrors(parentSelector) {\n $(parentSelector).find('.form-control.is-invalid').removeClass('is-invalid');\n $('.error-message').hide();\n}\n\nmodule.exports = {\n loadFormErrors: loadFormErrors,\n clearPreviousErrors: clearPreviousErrors\n};\n\n\n//# sourceURL=webpack:///../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/formErrors.js?");
-
-/***/ }),
-
-/***/ "../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/shipping.js":
-/*!****************************************************************************************************************************!*\
- !*** ../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/shipping.js ***!
- \****************************************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nvar addressHelpers = __webpack_require__(/*! ./address */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/address.js\");\nvar formHelpers = __webpack_require__(/*! ./formErrors */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/formErrors.js\");\nvar scrollAnimate = __webpack_require__(/*! ../components/scrollAnimate */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/scrollAnimate.js\");\n\n/**\n * updates the shipping address selector within shipping forms\n * @param {Object} productLineItem - the productLineItem model\n * @param {Object} shipping - the shipping (shipment model) model\n * @param {Object} order - the order model\n * @param {Object} customer - the customer model\n */\nfunction updateShippingAddressSelector(productLineItem, shipping, order, customer) {\n var uuidEl = $('input[value=' + productLineItem.UUID + ']');\n var shippings = order.shipping;\n\n var form;\n var $shippingAddressSelector;\n var hasSelectedAddress = false;\n\n if (uuidEl && uuidEl.length > 0) {\n form = uuidEl[0].form;\n $shippingAddressSelector = $('.addressSelector', form);\n }\n\n if ($shippingAddressSelector && $shippingAddressSelector.length === 1) {\n $shippingAddressSelector.empty();\n // Add New Address option\n $shippingAddressSelector.append(addressHelpers.methods.optionValueForAddress(\n null,\n false,\n order\n ));\n\n if (customer.addresses && customer.addresses.length > 0) {\n $shippingAddressSelector.append(addressHelpers.methods.optionValueForAddress(\n order.resources.accountAddresses,\n false,\n order\n ));\n\n customer.addresses.forEach(function (address) {\n var isSelected = shipping.matchingAddressId === address.ID;\n $shippingAddressSelector.append(\n addressHelpers.methods.optionValueForAddress(\n { UUID: 'ab_' + address.ID, shippingAddress: address },\n isSelected,\n order\n )\n );\n });\n }\n // Separator -\n $shippingAddressSelector.append(addressHelpers.methods.optionValueForAddress(\n order.resources.shippingAddresses, false, order, { className: 'multi-shipping' }\n ));\n shippings.forEach(function (aShipping) {\n var isSelected = shipping.UUID === aShipping.UUID;\n hasSelectedAddress = hasSelectedAddress || isSelected;\n var addressOption = addressHelpers.methods.optionValueForAddress(\n aShipping,\n isSelected,\n order,\n { className: 'multi-shipping' }\n );\n\n var newAddress = addressOption.html() === order.resources.addNewAddress;\n var matchingUUID = aShipping.UUID === shipping.UUID;\n if ((newAddress && matchingUUID) || (!newAddress && matchingUUID) || (!newAddress && !matchingUUID)) {\n $shippingAddressSelector.append(addressOption);\n }\n if (newAddress && !matchingUUID) {\n $(addressOption[0]).remove();\n }\n });\n }\n\n if (!hasSelectedAddress) {\n // show\n $(form).addClass('hide-details');\n } else {\n $(form).removeClass('hide-details');\n }\n\n $('body').trigger('shipping:updateShippingAddressSelector', {\n productLineItem: productLineItem,\n shipping: shipping,\n order: order,\n customer: customer\n });\n}\n\n/**\n * updates the shipping address form values within shipping forms\n * @param {Object} shipping - the shipping (shipment model) model\n */\nfunction updateShippingAddressFormValues(shipping) {\n var addressObject = $.extend({}, shipping.shippingAddress);\n\n if (!addressObject) {\n addressObject = {\n firstName: null,\n lastName: null,\n address1: null,\n address2: null,\n city: null,\n postalCode: null,\n stateCode: null,\n countryCode: null,\n phone: null\n };\n }\n\n addressObject.isGift = shipping.isGift;\n addressObject.giftMessage = shipping.giftMessage;\n\n $('input[value=' + shipping.UUID + ']').each(function (formIndex, el) {\n var form = el.form;\n if (!form) return;\n var countryCode = addressObject.countryCode;\n\n $('input[name$=_firstName]', form).val(addressObject.firstName);\n $('input[name$=_lastName]', form).val(addressObject.lastName);\n $('input[name$=_address1]', form).val(addressObject.address1);\n $('input[name$=_address2]', form).val(addressObject.address2);\n $('input[name$=_city]', form).val(addressObject.city);\n $('input[name$=_postalCode]', form).val(addressObject.postalCode);\n $('select[name$=_stateCode],input[name$=_stateCode]', form)\n .val(addressObject.stateCode);\n\n if (countryCode && typeof countryCode === 'object') {\n $('select[name$=_country]', form).val(addressObject.countryCode.value);\n } else {\n $('select[name$=_country]', form).val(addressObject.countryCode);\n }\n\n $('input[name$=_phone]', form).val(addressObject.phone);\n\n $('input[name$=_isGift]', form).prop('checked', addressObject.isGift);\n $('textarea[name$=_giftMessage]', form).val(addressObject.isGift && addressObject.giftMessage ? addressObject.giftMessage : '');\n });\n\n $('body').trigger('shipping:updateShippingAddressFormValues', { shipping: shipping });\n}\n\n/**\n * updates the shipping method radio buttons within shipping forms\n * @param {Object} shipping - the shipping (shipment model) model\n */\nfunction updateShippingMethods(shipping) {\n var uuidEl = $('input[value=' + shipping.UUID + ']');\n if (uuidEl && uuidEl.length > 0) {\n $.each(uuidEl, function (shipmentIndex, el) {\n var form = el.form;\n if (!form) return;\n\n var $shippingMethodList = $('.shipping-method-list', form);\n\n if ($shippingMethodList && $shippingMethodList.length > 0) {\n $shippingMethodList.empty();\n var shippingMethods = shipping.applicableShippingMethods;\n var selected = shipping.selectedShippingMethod || {};\n var shippingMethodFormID = form.name + '_shippingAddress_shippingMethodID';\n //\n // Create the new rows for each shipping method\n //\n $.each(shippingMethods, function (methodIndex, shippingMethod) {\n var tmpl = $('#shipping-method-template').clone();\n // set input\n $('input', tmpl)\n .prop('id', 'shippingMethod-' + shippingMethod.ID + '-' + shipping.UUID)\n .prop('name', shippingMethodFormID)\n .prop('value', shippingMethod.ID)\n .attr('checked', shippingMethod.ID === selected.ID);\n\n $('label', tmpl)\n .prop('for', 'shippingMethod-' + shippingMethod.ID + '-' + shipping.UUID);\n // set shipping method name\n $('.display-name', tmpl).text(shippingMethod.displayName);\n // set or hide arrival time\n if (shippingMethod.estimatedArrivalTime) {\n $('.arrival-time', tmpl)\n .text('(' + shippingMethod.estimatedArrivalTime + ')')\n .show();\n }\n // set shipping cost\n $('.shipping-cost', tmpl).text(shippingMethod.shippingCost);\n $shippingMethodList.append(tmpl.html());\n });\n }\n });\n }\n\n $('body').trigger('shipping:updateShippingMethods', { shipping: shipping });\n}\n\n/**\n * Update list of available shipping methods whenever user modifies shipping address details.\n * @param {jQuery} $shippingForm - current shipping form\n */\nfunction updateShippingMethodList($shippingForm) {\n // delay for autocomplete!\n setTimeout(function () {\n var $shippingMethodList = $shippingForm.find('.shipping-method-list');\n var urlParams = addressHelpers.methods.getAddressFieldsFromUI($shippingForm);\n var shipmentUUID = $shippingForm.find('[name=shipmentUUID]').val();\n var url = $shippingMethodList.data('actionUrl');\n urlParams.shipmentUUID = shipmentUUID;\n\n $shippingMethodList.spinner().start();\n $.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n data: urlParams,\n success: function (data) {\n if (data.error) {\n window.location.href = data.redirectUrl;\n } else {\n $('body').trigger('checkout:updateCheckoutView',\n {\n order: data.order,\n customer: data.customer,\n options: { keepOpen: true }\n });\n\n $shippingMethodList.spinner().stop();\n }\n }\n });\n }, 300);\n}\n\n/**\n * updates the order shipping summary for an order shipment model\n * @param {Object} shipping - the shipping (shipment model) model\n * @param {Object} order - the order model\n */\nfunction updateShippingSummaryInformation(shipping, order) {\n $('[data-shipment-summary=' + shipping.UUID + ']').each(function (i, el) {\n var $container = $(el);\n var $shippingAddressLabel = $container.find('.shipping-addr-label');\n var $addressContainer = $container.find('.address-summary');\n var $shippingPhone = $container.find('.shipping-phone');\n var $methodTitle = $container.find('.shipping-method-title');\n var $methodArrivalTime = $container.find('.shipping-method-arrival-time');\n var $methodPrice = $container.find('.shipping-method-price');\n var $shippingSummaryLabel = $container.find('.shipping-method-label');\n var $summaryDetails = $container.find('.row.summary-details');\n var giftMessageSummary = $container.find('.gift-summary');\n\n var address = shipping.shippingAddress;\n var selectedShippingMethod = shipping.selectedShippingMethod;\n var isGift = shipping.isGift;\n\n addressHelpers.methods.populateAddressSummary($addressContainer, address);\n\n if (address && address.phone) {\n $shippingPhone.text(address.phone);\n } else {\n $shippingPhone.empty();\n }\n\n if (selectedShippingMethod) {\n $('body').trigger('shipping:updateAddressLabelText',\n { selectedShippingMethod: selectedShippingMethod, resources: order.resources, shippingAddressLabel: $shippingAddressLabel });\n $shippingSummaryLabel.show();\n $summaryDetails.show();\n $methodTitle.text(selectedShippingMethod.displayName);\n if (selectedShippingMethod.estimatedArrivalTime) {\n $methodArrivalTime.text(\n '( ' + selectedShippingMethod.estimatedArrivalTime + ' )'\n );\n } else {\n $methodArrivalTime.empty();\n }\n $methodPrice.text(selectedShippingMethod.shippingCost);\n }\n\n if (isGift) {\n giftMessageSummary.find('.gift-message-summary').text(shipping.giftMessage);\n giftMessageSummary.removeClass('d-none');\n } else {\n giftMessageSummary.addClass('d-none');\n }\n });\n\n $('body').trigger('shipping:updateShippingSummaryInformation', { shipping: shipping, order: order });\n}\n\n/**\n * Update the read-only portion of the shipment display (per PLI)\n * @param {Object} productLineItem - the productLineItem model\n * @param {Object} shipping - the shipping (shipment model) model\n * @param {Object} order - the order model\n * @param {Object} [options] - options for updating PLI summary info\n * @param {Object} [options.keepOpen] - if true, prevent changing PLI view mode to 'view'\n */\nfunction updatePLIShippingSummaryInformation(productLineItem, shipping, order, options) {\n var $pli = $('input[value=' + productLineItem.UUID + ']');\n var form = $pli && $pli.length > 0 ? $pli[0].form : null;\n\n if (!form) return;\n\n var $viewBlock = $('.view-address-block', form);\n\n var address = shipping.shippingAddress || {};\n var selectedMethod = shipping.selectedShippingMethod;\n\n var nameLine = address.firstName ? address.firstName + ' ' : '';\n if (address.lastName) nameLine += address.lastName;\n\n var address1Line = address.address1;\n var address2Line = address.address2;\n\n var phoneLine = address.phone;\n\n var shippingCost = selectedMethod ? selectedMethod.shippingCost : '';\n var methodNameLine = selectedMethod ? selectedMethod.displayName : '';\n var methodArrivalTime = selectedMethod && selectedMethod.estimatedArrivalTime\n ? '(' + selectedMethod.estimatedArrivalTime + ')'\n : '';\n\n var tmpl = $('#pli-shipping-summary-template').clone();\n\n $('.ship-to-name', tmpl).text(nameLine);\n $('.ship-to-address1', tmpl).text(address1Line);\n $('.ship-to-address2', tmpl).text(address2Line);\n $('.ship-to-city', tmpl).text(address.city);\n if (address.stateCode) {\n $('.ship-to-st', tmpl).text(address.stateCode);\n }\n $('.ship-to-zip', tmpl).text(address.postalCode);\n $('.ship-to-phone', tmpl).text(phoneLine);\n\n if (!address2Line) {\n $('.ship-to-address2', tmpl).hide();\n }\n\n if (!phoneLine) {\n $('.ship-to-phone', tmpl).hide();\n }\n\n if (shipping.selectedShippingMethod) {\n $('.display-name', tmpl).text(methodNameLine);\n $('.arrival-time', tmpl).text(methodArrivalTime);\n $('.price', tmpl).text(shippingCost);\n }\n\n if (shipping.isGift) {\n $('.gift-message-summary', tmpl).text(shipping.giftMessage);\n var shipment = $('.gift-message-' + shipping.UUID);\n $(shipment).val(shipping.giftMessage);\n } else {\n $('.gift-summary', tmpl).addClass('d-none');\n }\n // checking h5 title shipping to or pickup\n var $shippingAddressLabel = $('.shipping-header-text', tmpl);\n $('body').trigger('shipping:updateAddressLabelText',\n { selectedShippingMethod: selectedMethod, resources: order.resources, shippingAddressLabel: $shippingAddressLabel });\n\n $viewBlock.html(tmpl.html());\n\n $('body').trigger('shipping:updatePLIShippingSummaryInformation', {\n productLineItem: productLineItem,\n shipping: shipping,\n order: order,\n options: options\n });\n}\n\n/**\n * Update the hidden form values that associate shipping info with product line items\n * @param {Object} productLineItem - the productLineItem model\n * @param {Object} shipping - the shipping (shipment model) model\n */\nfunction updateProductLineItemShipmentUUIDs(productLineItem, shipping) {\n $('input[value=' + productLineItem.UUID + ']').each(function (key, pli) {\n var form = pli.form;\n $('[name=shipmentUUID]', form).val(shipping.UUID);\n $('[name=originalShipmentUUID]', form).val(shipping.UUID);\n\n $(form).closest('.card').attr('data-shipment-uuid', shipping.UUID);\n });\n\n $('body').trigger('shipping:updateProductLineItemShipmentUUIDs', {\n productLineItem: productLineItem,\n shipping: shipping\n });\n}\n\n/**\n * Update the shipping UI for a single shipping info (shipment model)\n * @param {Object} shipping - the shipping (shipment model) model\n * @param {Object} order - the order/basket model\n * @param {Object} customer - the customer model\n * @param {Object} [options] - options for updating PLI summary info\n * @param {Object} [options.keepOpen] - if true, prevent changing PLI view mode to 'view'\n */\nfunction updateShippingInformation(shipping, order, customer, options) {\n // First copy over shipmentUUIDs from response, to each PLI form\n order.shipping.forEach(function (aShipping) {\n aShipping.productLineItems.items.forEach(function (productLineItem) {\n updateProductLineItemShipmentUUIDs(productLineItem, aShipping);\n });\n });\n\n // Now update shipping information, based on those associations\n updateShippingMethods(shipping);\n updateShippingAddressFormValues(shipping);\n updateShippingSummaryInformation(shipping, order);\n\n // And update the PLI-based summary information as well\n shipping.productLineItems.items.forEach(function (productLineItem) {\n updateShippingAddressSelector(productLineItem, shipping, order, customer);\n updatePLIShippingSummaryInformation(productLineItem, shipping, order, options);\n });\n\n $('body').trigger('shipping:updateShippingInformation', {\n order: order,\n shipping: shipping,\n customer: customer,\n options: options\n });\n}\n\n/**\n * Update the checkout state (single vs. multi-ship)\n * @param {Object} order - checkout model to use as basis of new truth\n */\nfunction updateMultiShipInformation(order) {\n var $checkoutMain = $('#checkout-main');\n var $checkbox = $('[name=usingMultiShipping]');\n var $submitShippingBtn = $('button.submit-shipping');\n $('.shipping-error .alert-danger').remove();\n\n if (order.usingMultiShipping) {\n $checkoutMain.addClass('multi-ship');\n $checkbox.prop('checked', true);\n } else {\n $checkoutMain.removeClass('multi-ship');\n $checkbox.prop('checked', null);\n $submitShippingBtn.prop('disabled', null);\n }\n\n $('body').trigger('shipping:updateMultiShipInformation', { order: order });\n}\n\n/**\n * Create an alert to display the error message\n * @param {Object} message - Error message to display\n */\nfunction createErrorNotification(message) {\n var errorHtml = '
' +\n '' +\n '× ' +\n ' ' + message + '
';\n\n $('.shipping-error').append(errorHtml);\n scrollAnimate($('.shipping-error'));\n}\n\n/**\n * Handle response from the server for valid or invalid form fields.\n * @param {Object} defer - the deferred object which will resolve on success or reject.\n * @param {Object} data - the response data with the invalid form fields or\n * valid model data.\n */\nfunction shippingFormResponse(defer, data) {\n var isMultiShip = $('#checkout-main').hasClass('multi-ship');\n var formSelector = isMultiShip\n ? '.multi-shipping .active form'\n : '.single-shipping form';\n\n // highlight fields with errors\n if (data.error) {\n if (data.fieldErrors.length) {\n data.fieldErrors.forEach(function (error) {\n if (Object.keys(error).length) {\n formHelpers.loadFormErrors(formSelector, error);\n }\n });\n defer.reject(data);\n }\n\n if (data.serverErrors && data.serverErrors.length) {\n $.each(data.serverErrors, function (index, element) {\n createErrorNotification(element);\n });\n\n defer.reject(data);\n }\n\n if (data.cartError) {\n window.location.href = data.redirectUrl;\n defer.reject();\n }\n } else {\n // Populate the Address Summary\n\n $('body').trigger('checkout:updateCheckoutView', {\n order: data.order,\n customer: data.customer\n });\n scrollAnimate($('.payment-form'));\n defer.resolve(data);\n }\n}\n/**\n * Clear out all the shipping form values and select the new address in the drop down\n * @param {Object} order - the order object\n */\nfunction clearShippingForms(order) {\n order.shipping.forEach(function (shipping) {\n $('input[value=' + shipping.UUID + ']').each(function (formIndex, el) {\n var form = el.form;\n if (!form) return;\n\n $('input[name$=_firstName]', form).val('');\n $('input[name$=_lastName]', form).val('');\n $('input[name$=_address1]', form).val('');\n $('input[name$=_address2]', form).val('');\n $('input[name$=_city]', form).val('');\n $('input[name$=_postalCode]', form).val('');\n $('select[name$=_stateCode],input[name$=_stateCode]', form).val('');\n $('select[name$=_country]', form).val('');\n\n $('input[name$=_phone]', form).val('');\n\n $('input[name$=_isGift]', form).prop('checked', false);\n $('textarea[name$=_giftMessage]', form).val('');\n $(form).find('.gift-message').addClass('d-none');\n\n $(form).attr('data-address-mode', 'new');\n var addressSelectorDropDown = $('.addressSelector option[value=new]', form);\n $(addressSelectorDropDown).prop('selected', true);\n });\n });\n\n $('body').trigger('shipping:clearShippingForms', { order: order });\n}\n\n/**\n * Does Ajax call to create a server-side shipment w/ pliUUID & URL\n * @param {string} url - string representation of endpoint URL\n * @param {Object} shipmentData - product line item UUID\n * @returns {Object} - promise value for async call\n */\nfunction createNewShipment(url, shipmentData) {\n $.spinner().start();\n return $.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n data: shipmentData\n });\n}\n\n/**\n * Does Ajax call to select shipping method\n * @param {string} url - string representation of endpoint URL\n * @param {Object} urlParams - url params\n * @param {Object} el - element that triggered this call\n */\nfunction selectShippingMethodAjax(url, urlParams, el) {\n $.spinner().start();\n $('body').trigger('checkout:beforeShippingMethodSelected');\n $.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n data: urlParams\n })\n .done(function (data) {\n if (data.error) {\n window.location.href = data.redirectUrl;\n } else {\n $('body').trigger('checkout:updateCheckoutView',\n {\n order: data.order,\n customer: data.customer,\n options: { keepOpen: true },\n urlParams: urlParams\n }\n );\n $('body').trigger('checkout:postUpdateCheckoutView',\n {\n el: el\n }\n );\n }\n $('body').trigger('checkout:shippingMethodSelected', data);\n $.spinner().stop();\n })\n .fail(function () {\n $.spinner().stop();\n });\n}\n\n/**\n * Hide and show to appropriate elements to show the multi ship shipment cards in the enter view\n * @param {jQuery} element - The shipping content\n */\nfunction enterMultishipView(element) {\n element.find('.btn-enter-multi-ship').removeClass('d-none');\n\n element.find('.view-address-block').addClass('d-none');\n element.find('.shipping-address').addClass('d-none');\n element.find('.btn-save-multi-ship.save-shipment').addClass('d-none');\n element.find('.btn-edit-multi-ship').addClass('d-none');\n element.find('.multi-ship-address-actions').addClass('d-none');\n}\n\n/**\n * Hide and show to appropriate elements to show the multi ship shipment cards in the view mode\n * @param {jQuery} element - The shipping content\n */\nfunction viewMultishipAddress(element) {\n element.find('.view-address-block').removeClass('d-none');\n element.find('.btn-edit-multi-ship').removeClass('d-none');\n\n element.find('.shipping-address').addClass('d-none');\n element.find('.btn-save-multi-ship.save-shipment').addClass('d-none');\n element.find('.btn-enter-multi-ship').addClass('d-none');\n element.find('.multi-ship-address-actions').addClass('d-none');\n}\n\n/**\n * Hide and show to appropriate elements that allows the user to edit multi ship address information\n * @param {jQuery} element - The shipping content\n */\nfunction editMultiShipAddress(element) {\n // Show\n element.find('.shipping-address').removeClass('d-none');\n element.find('.btn-save-multi-ship.save-shipment').removeClass('d-none');\n\n // Hide\n element.find('.view-address-block').addClass('d-none');\n element.find('.btn-enter-multi-ship').addClass('d-none');\n element.find('.btn-edit-multi-ship').addClass('d-none');\n element.find('.multi-ship-address-actions').addClass('d-none');\n\n $('body').trigger('shipping:editMultiShipAddress', { element: element, form: element.find('.shipping-form') });\n}\n\n/**\n * perform the proper actions once a user has clicked enter address or edit address for a shipment\n * @param {jQuery} element - The shipping content\n * @param {string} mode - the address mode\n */\nfunction editOrEnterMultiShipInfo(element, mode) {\n var form = $(element).closest('form');\n var root = $(element).closest('.shipping-content');\n\n $('body').trigger('shipping:updateDataAddressMode', { form: form, mode: mode });\n\n editMultiShipAddress(root);\n\n var addressInfo = addressHelpers.methods.getAddressFieldsFromUI(form);\n\n var savedState = {\n UUID: $('input[name=shipmentUUID]', form).val(),\n shippingAddress: addressInfo\n };\n\n root.data('saved-state', JSON.stringify(savedState));\n}\n\nmodule.exports = {\n methods: {\n updateShippingAddressSelector: updateShippingAddressSelector,\n updateShippingAddressFormValues: updateShippingAddressFormValues,\n updateShippingMethods: updateShippingMethods,\n updateShippingSummaryInformation: updateShippingSummaryInformation,\n updatePLIShippingSummaryInformation: updatePLIShippingSummaryInformation,\n updateProductLineItemShipmentUUIDs: updateProductLineItemShipmentUUIDs,\n updateShippingInformation: updateShippingInformation,\n updateMultiShipInformation: updateMultiShipInformation,\n shippingFormResponse: shippingFormResponse,\n createNewShipment: createNewShipment,\n selectShippingMethodAjax: selectShippingMethodAjax,\n updateShippingMethodList: updateShippingMethodList,\n clearShippingForms: clearShippingForms,\n editMultiShipAddress: editMultiShipAddress,\n editOrEnterMultiShipInfo: editOrEnterMultiShipInfo,\n createErrorNotification: createErrorNotification,\n viewMultishipAddress: viewMultishipAddress\n },\n\n selectShippingMethod: function () {\n var baseObj = this;\n\n $('.shipping-method-list').change(function () {\n var $shippingForm = $(this).parents('form');\n var methodID = $(':checked', this).val();\n var shipmentUUID = $shippingForm.find('[name=shipmentUUID]').val();\n var urlParams = addressHelpers.methods.getAddressFieldsFromUI($shippingForm);\n urlParams.shipmentUUID = shipmentUUID;\n urlParams.methodID = methodID;\n urlParams.isGift = $shippingForm.find('.gift').prop('checked');\n urlParams.giftMessage = $shippingForm.find('textarea[name$=_giftMessage]').val();\n\n var url = $(this).data('select-shipping-method-url');\n\n if (baseObj.methods && baseObj.methods.selectShippingMethodAjax) {\n baseObj.methods.selectShippingMethodAjax(url, urlParams, $(this));\n } else {\n selectShippingMethodAjax(url, urlParams, $(this));\n }\n });\n },\n\n toggleMultiship: function () {\n var baseObj = this;\n\n $('input[name=\"usingMultiShipping\"]').on('change', function () {\n var url = $('.multi-shipping-checkbox-block form').attr('action');\n var usingMultiShip = this.checked;\n\n $.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n data: { usingMultiShip: usingMultiShip },\n success: function (response) {\n if (response.error) {\n window.location.href = response.redirectUrl;\n } else {\n $('body').trigger('checkout:updateCheckoutView', {\n order: response.order,\n customer: response.customer\n });\n\n if ($('#checkout-main').data('customer-type') === 'guest') {\n if (baseObj.methods && baseObj.methods.clearShippingForms) {\n baseObj.methods.clearShippingForms(response.order);\n } else {\n clearShippingForms(response.order);\n }\n } else {\n response.order.shipping.forEach(function (shipping) {\n $('input[value=' + shipping.UUID + ']').each(function (formIndex, el) {\n var form = el.form;\n if (!form) return;\n\n $(form).attr('data-address-mode', 'edit');\n var addressSelectorDropDown = $(form).find('.addressSelector option[value=\"ab_' + shipping.matchingAddressId + '\"]');\n $(addressSelectorDropDown).prop('selected', true);\n $('input[name$=_isGift]', form).prop('checked', false);\n $('textarea[name$=_giftMessage]', form).val('');\n $(form).find('.gift-message').addClass('d-none');\n });\n });\n }\n\n if (usingMultiShip) {\n $('body').trigger('shipping:selectMultiShipping', { data: response });\n } else {\n $('body').trigger('shipping:selectSingleShipping', { data: response });\n }\n }\n\n $.spinner().stop();\n },\n error: function () {\n $.spinner().stop();\n }\n });\n });\n },\n\n selectSingleShipping: function () {\n $('body').on('shipping:selectSingleShipping', function () {\n $('.single-shipping .shipping-address').removeClass('d-none');\n });\n },\n\n selectMultiShipping: function () {\n var baseObj = this;\n\n $('body').on('shipping:selectMultiShipping', function (e, data) {\n $('.multi-shipping .shipping-address').addClass('d-none');\n\n data.data.order.shipping.forEach(function (shipping) {\n var element = $('.multi-shipping .card[data-shipment-uuid=\"' + shipping.UUID + '\"]');\n\n if (shipping.shippingAddress) {\n if (baseObj.methods && baseObj.methods.viewMultishipAddress) {\n baseObj.methods.viewMultishipAddress($(element));\n } else {\n viewMultishipAddress($(element));\n }\n } else {\n /* eslint-disable no-lonely-if */\n if (baseObj.methods && baseObj.methods.enterMultishipView) {\n baseObj.methods.enterMultishipView($(element));\n } else {\n enterMultishipView($(element));\n }\n /* eslint-enable no-lonely-if */\n }\n });\n });\n },\n\n selectSingleShipAddress: function () {\n $('.single-shipping .addressSelector').on('change', function () {\n var form = $(this).parents('form')[0];\n var selectedOption = $('option:selected', this);\n var attrs = selectedOption.data();\n var shipmentUUID = selectedOption[0].value;\n var originalUUID = $('input[name=shipmentUUID]', form).val();\n var element;\n Object.keys(attrs).forEach(function (attr) {\n element = attr === 'countryCode' ? 'country' : attr;\n $('[name$=' + element + ']', form).val(attrs[attr]);\n });\n $('[name$=stateCode]', form).trigger('change');\n if (shipmentUUID === 'new') {\n $(form).attr('data-address-mode', 'new');\n $(form).find('.shipping-address-block').removeClass('d-none');\n } else if (shipmentUUID === originalUUID) {\n $(form).attr('data-address-mode', 'shipment');\n } else if (shipmentUUID.indexOf('ab_') === 0) {\n $(form).attr('data-address-mode', 'customer');\n } else {\n $(form).attr('data-address-mode', 'edit');\n }\n });\n },\n\n selectMultiShipAddress: function () {\n var baseObj = this;\n\n $('.multi-shipping .addressSelector').on('change', function () {\n var form = $(this).closest('form');\n var selectedOption = $('option:selected', this);\n var attrs = selectedOption.data();\n var shipmentUUID = selectedOption[0].value;\n var originalUUID = $('input[name=shipmentUUID]', form).val();\n var pliUUID = $('input[name=productLineItemUUID]', form).val();\n var createNewShipmentScoped = baseObj.methods && baseObj.methods.createNewShipment ? baseObj.methods.createNewShipment : createNewShipment;\n\n var element;\n Object.keys(attrs).forEach(function (attr) {\n if (attr === 'isGift') {\n $('[name$=' + attr + ']', form).prop('checked', attrs[attr]);\n $('[name$=' + attr + ']', form).trigger('change');\n } else {\n element = attr === 'countryCode' ? 'country' : attr;\n $('[name$=' + element + ']', form).val(attrs[attr]);\n }\n });\n\n if (shipmentUUID === 'new' && pliUUID) {\n var createShipmentUrl = $(this).attr('data-create-shipment-url');\n createNewShipmentScoped(createShipmentUrl, { productLineItemUUID: pliUUID })\n .done(function (response) {\n $.spinner().stop();\n if (response.error) {\n if (response.redirectUrl) {\n window.location.href = response.redirectUrl;\n }\n return;\n }\n\n $('body').trigger('checkout:updateCheckoutView',\n {\n order: response.order,\n customer: response.customer,\n options: { keepOpen: true }\n }\n );\n\n $(form).attr('data-address-mode', 'new');\n })\n .fail(function () {\n $.spinner().stop();\n });\n } else if (shipmentUUID === originalUUID) {\n $('select[name$=stateCode]', form).trigger('change');\n $(form).attr('data-address-mode', 'shipment');\n } else if (shipmentUUID.indexOf('ab_') === 0) {\n var url = $(form).attr('action');\n var serializedData = $(form).serialize();\n createNewShipmentScoped(url, serializedData)\n .done(function (response) {\n $.spinner().stop();\n if (response.error) {\n if (response.redirectUrl) {\n window.location.href = response.redirectUrl;\n }\n return;\n }\n\n $('body').trigger('checkout:updateCheckoutView',\n {\n order: response.order,\n customer: response.customer,\n options: { keepOpen: true }\n }\n );\n\n $(form).attr('data-address-mode', 'customer');\n var $rootEl = $(form).closest('.shipping-content');\n editMultiShipAddress($rootEl);\n })\n .fail(function () {\n $.spinner().stop();\n });\n } else {\n var updatePLIShipmentUrl = $(form).attr('action');\n var serializedAddress = $(form).serialize();\n createNewShipmentScoped(updatePLIShipmentUrl, serializedAddress)\n .done(function (response) {\n $.spinner().stop();\n if (response.error) {\n if (response.redirectUrl) {\n window.location.href = response.redirectUrl;\n }\n return;\n }\n\n $('body').trigger('checkout:updateCheckoutView',\n {\n order: response.order,\n customer: response.customer,\n options: { keepOpen: true }\n }\n );\n\n $(form).attr('data-address-mode', 'edit');\n })\n .fail(function () {\n $.spinner().stop();\n });\n }\n });\n },\n\n updateShippingList: function () {\n var baseObj = this;\n\n $('select[name$=\"shippingAddress_addressFields_states_stateCode\"]')\n .on('change', function (e) {\n if (baseObj.methods && baseObj.methods.updateShippingMethodList) {\n baseObj.methods.updateShippingMethodList($(e.currentTarget.form));\n } else {\n updateShippingMethodList($(e.currentTarget.form));\n }\n });\n },\n\n updateDataAddressMode: function () {\n $('body').on('shipping:updateDataAddressMode', function (e, data) {\n $(data.form).attr('data-address-mode', data.mode);\n });\n },\n\n enterMultiShipInfo: function () {\n var baseObj = this;\n\n $('.btn-enter-multi-ship').on('click', function (e) {\n e.preventDefault();\n\n if (baseObj.methods && baseObj.methods.editOrEnterMultiShipInfo) {\n baseObj.methods.editOrEnterMultiShipInfo($(this), 'new');\n } else {\n editOrEnterMultiShipInfo($(this), 'new');\n }\n });\n },\n\n editMultiShipInfo: function () {\n var baseObj = this;\n\n $('.btn-edit-multi-ship').on('click', function (e) {\n e.preventDefault();\n\n if (baseObj.methods && baseObj.methods.editOrEnterMultiShipInfo) {\n baseObj.methods.editOrEnterMultiShipInfo($(this), 'edit');\n } else {\n editOrEnterMultiShipInfo($(this), 'edit');\n }\n });\n },\n\n saveMultiShipInfo: function () {\n var baseObj = this;\n\n $('.btn-save-multi-ship').on('click', function (e) {\n e.preventDefault();\n\n // Save address to checkoutAddressBook\n var form = $(this).closest('form');\n var $rootEl = $(this).closest('.shipping-content');\n var data = $(form).serialize();\n var url = $(form).attr('action');\n\n $rootEl.spinner().start();\n $.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n data: data\n })\n .done(function (response) {\n formHelpers.clearPreviousErrors(form);\n if (response.error) {\n if (response.fieldErrors && response.fieldErrors.length) {\n response.fieldErrors.forEach(function (error) {\n if (Object.keys(error).length) {\n formHelpers.loadFormErrors(form, error);\n }\n });\n } else if (response.serverErrors && response.serverErrors.length) {\n $.each(response.serverErrors, function (index, element) {\n createErrorNotification(element);\n });\n } else if (response.redirectUrl) {\n window.location.href = response.redirectUrl;\n }\n } else {\n // Update UI from response\n $('body').trigger('checkout:updateCheckoutView',\n {\n order: response.order,\n customer: response.customer\n }\n );\n\n if (baseObj.methods && baseObj.methods.viewMultishipAddress) {\n baseObj.methods.viewMultishipAddress($rootEl);\n } else {\n viewMultishipAddress($rootEl);\n }\n }\n\n if (response.order && response.order.shippable) {\n $('button.submit-shipping').attr('disabled', null);\n }\n\n $rootEl.spinner().stop();\n })\n .fail(function (err) {\n if (err.responseJSON.redirectUrl) {\n window.location.href = err.responseJSON.redirectUrl;\n }\n\n $rootEl.spinner().stop();\n });\n\n return false;\n });\n },\n\n cancelMultiShipAddress: function () {\n var baseObj = this;\n\n $('.btn-cancel-multi-ship-address').on('click', function (e) {\n e.preventDefault();\n\n var form = $(this).closest('form');\n var $rootEl = $(this).closest('.shipping-content');\n var restoreState = $rootEl.data('saved-state');\n\n // Should clear out changes / restore previous state\n if (restoreState) {\n var restoreStateObj = JSON.parse(restoreState);\n var originalStateCode = restoreStateObj.shippingAddress.stateCode;\n var stateCode = $('[name$=_stateCode]', form).val();\n\n if (baseObj.methods && baseObj.methods.updateShippingAddressFormValues) {\n baseObj.methods.updateShippingAddressFormValues(restoreStateObj);\n } else {\n updateShippingAddressFormValues(restoreStateObj);\n }\n\n if (stateCode !== originalStateCode) {\n $('[data-action=save]', form).trigger('click');\n } else {\n $(form).attr('data-address-mode', 'edit');\n if (baseObj.methods && baseObj.methods.editMultiShipAddress) {\n baseObj.methods.editMultiShipAddress($rootEl);\n } else {\n editMultiShipAddress($rootEl);\n }\n }\n }\n\n return false;\n });\n },\n\n isGift: function () {\n $('.gift').on('change', function (e) {\n e.preventDefault();\n var form = $(this).closest('form');\n\n if (this.checked) {\n $(form).find('.gift-message').removeClass('d-none');\n } else {\n $(form).find('.gift-message').addClass('d-none');\n $(form).find('.gift-message').val('');\n }\n });\n }\n};\n\n\n//# sourceURL=webpack:///../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/shipping.js?");
-
-/***/ }),
-
-/***/ "../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/summary.js":
-/*!***************************************************************************************************************************!*\
- !*** ../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/summary.js ***!
- \***************************************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\n/**\n * updates the totals summary\n * @param {Array} totals - the totals data\n */\nfunction updateTotals(totals) {\n $('.shipping-total-cost').text(totals.totalShippingCost);\n $('.tax-total').text(totals.totalTax);\n $('.sub-total').text(totals.subTotal);\n $('.grand-total-sum').text(totals.grandTotal);\n\n if (totals.orderLevelDiscountTotal.value > 0) {\n $('.order-discount').removeClass('hide-order-discount');\n $('.order-discount-total').text('- ' + totals.orderLevelDiscountTotal.formatted);\n } else {\n $('.order-discount').addClass('hide-order-discount');\n }\n\n if (totals.shippingLevelDiscountTotal.value > 0) {\n $('.shipping-discount').removeClass('hide-shipping-discount');\n $('.shipping-discount-total').text('- ' +\n totals.shippingLevelDiscountTotal.formatted);\n } else {\n $('.shipping-discount').addClass('hide-shipping-discount');\n }\n}\n\n/**\n * updates the order product shipping summary for an order model\n * @param {Object} order - the order model\n */\nfunction updateOrderProductSummaryInformation(order) {\n var $productSummary = $('
');\n order.shipping.forEach(function (shipping) {\n shipping.productLineItems.items.forEach(function (lineItem) {\n var pli = $('[data-product-line-item=' + lineItem.UUID + ']');\n $productSummary.append(pli);\n });\n\n var address = shipping.shippingAddress || {};\n var selectedMethod = shipping.selectedShippingMethod;\n\n var nameLine = address.firstName ? address.firstName + ' ' : '';\n if (address.lastName) nameLine += address.lastName;\n\n var address1Line = address.address1;\n var address2Line = address.address2;\n\n var phoneLine = address.phone;\n\n var shippingCost = selectedMethod ? selectedMethod.shippingCost : '';\n var methodNameLine = selectedMethod ? selectedMethod.displayName : '';\n var methodArrivalTime = selectedMethod && selectedMethod.estimatedArrivalTime\n ? '( ' + selectedMethod.estimatedArrivalTime + ' )'\n : '';\n\n var tmpl = $('#pli-shipping-summary-template').clone();\n\n if (shipping.productLineItems.items && shipping.productLineItems.items.length > 1) {\n $('h5 > span').text(' - ' + shipping.productLineItems.items.length + ' '\n + order.resources.items);\n } else {\n $('h5 > span').text('');\n }\n\n var stateRequiredAttr = $('#shippingState').attr('required');\n var isRequired = stateRequiredAttr !== undefined && stateRequiredAttr !== false;\n var stateExists = (shipping.shippingAddress && shipping.shippingAddress.stateCode)\n ? shipping.shippingAddress.stateCode\n : false;\n var stateBoolean = false;\n if ((isRequired && stateExists) || (!isRequired)) {\n stateBoolean = true;\n }\n\n var shippingForm = $('.multi-shipping input[name=\"shipmentUUID\"][value=\"' + shipping.UUID + '\"]').parent();\n\n if (shipping.shippingAddress\n && shipping.shippingAddress.firstName\n && shipping.shippingAddress.address1\n && shipping.shippingAddress.city\n && stateBoolean\n && shipping.shippingAddress.countryCode\n && (shipping.shippingAddress.phone || shipping.productLineItems.items[0].fromStoreId)) {\n $('.ship-to-name', tmpl).text(nameLine);\n $('.ship-to-address1', tmpl).text(address1Line);\n $('.ship-to-address2', tmpl).text(address2Line);\n $('.ship-to-city', tmpl).text(address.city);\n if (address.stateCode) {\n $('.ship-to-st', tmpl).text(address.stateCode);\n }\n $('.ship-to-zip', tmpl).text(address.postalCode);\n $('.ship-to-phone', tmpl).text(phoneLine);\n\n if (!address2Line) {\n $('.ship-to-address2', tmpl).hide();\n }\n\n if (!phoneLine) {\n $('.ship-to-phone', tmpl).hide();\n }\n\n shippingForm.find('.ship-to-message').text('');\n } else {\n shippingForm.find('.ship-to-message').text(order.resources.addressIncomplete);\n }\n\n if (shipping.isGift) {\n $('.gift-message-summary', tmpl).text(shipping.giftMessage);\n } else {\n $('.gift-summary', tmpl).addClass('d-none');\n }\n\n // checking h5 title shipping to or pickup\n var $shippingAddressLabel = $('.shipping-header-text', tmpl);\n $('body').trigger('shipping:updateAddressLabelText',\n { selectedShippingMethod: selectedMethod, resources: order.resources, shippingAddressLabel: $shippingAddressLabel });\n\n if (shipping.selectedShippingMethod) {\n $('.display-name', tmpl).text(methodNameLine);\n $('.arrival-time', tmpl).text(methodArrivalTime);\n $('.price', tmpl).text(shippingCost);\n }\n\n var $shippingSummary = $('
');\n $shippingSummary.html(tmpl.html());\n $productSummary.append($shippingSummary);\n });\n\n $('.product-summary-block').html($productSummary.html());\n\n // Also update the line item prices, as they might have been altered\n $('.grand-total-price').text(order.totals.subTotal);\n order.items.items.forEach(function (item) {\n if (item.priceTotal && item.priceTotal.renderedPrice) {\n $('.item-total-' + item.UUID).empty().append(item.priceTotal.renderedPrice);\n }\n });\n}\n\nmodule.exports = {\n updateTotals: updateTotals,\n updateOrderProductSummaryInformation: updateOrderProductSummaryInformation\n};\n\n\n//# sourceURL=webpack:///../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/summary.js?");
-
-/***/ }),
-
-/***/ "../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/cleave.js":
-/*!****************************************************************************************************************************!*\
- !*** ../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/cleave.js ***!
- \****************************************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nvar Cleave = __webpack_require__(/*! cleave.js */ \"../storefront-reference-architecture/node_modules/cleave.js/dist/cleave-esm.js\").default;\n\nmodule.exports = {\n handleCreditCardNumber: function (cardFieldSelector, cardTypeSelector) {\n var cleave = new Cleave(cardFieldSelector, {\n creditCard: true,\n onCreditCardTypeChanged: function (type) {\n var creditCardTypes = {\n visa: 'Visa',\n mastercard: 'Master Card',\n amex: 'Amex',\n discover: 'Discover',\n unknown: 'Unknown'\n };\n\n var cardType = creditCardTypes[Object.keys(creditCardTypes).indexOf(type) > -1\n ? type\n : 'unknown'];\n $(cardTypeSelector).val(cardType);\n $('.card-number-wrapper').attr('data-type', type);\n if (type === 'visa' || type === 'mastercard' || type === 'discover') {\n $('#securityCode').attr('maxlength', 3);\n } else {\n $('#securityCode').attr('maxlength', 4);\n }\n }\n });\n\n $(cardFieldSelector).data('cleave', cleave);\n },\n\n serializeData: function (form) {\n var serializedArray = form.serializeArray();\n\n serializedArray.forEach(function (item) {\n if (item.name.indexOf('cardNumber') > -1) {\n item.value = $('#cardNumber').data('cleave').getRawValue(); // eslint-disable-line\n }\n });\n\n return $.param(serializedArray);\n }\n};\n\n\n//# sourceURL=webpack:///../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/cleave.js?");
-
-/***/ }),
-
-/***/ "../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/scrollAnimate.js":
-/*!***********************************************************************************************************************************!*\
- !*** ../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/scrollAnimate.js ***!
- \***********************************************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nmodule.exports = function (element) {\n var position = element && element.length ? element.offset().top : 0;\n $('html, body').animate({\n scrollTop: position\n }, 500);\n if (!element) {\n $('.logo-home').focus();\n }\n};\n\n\n//# sourceURL=webpack:///../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/scrollAnimate.js?");
-
-/***/ }),
-
-/***/ "../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.js":
-/*!***************************************************************************************************************!*\
- !*** ../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.js ***!
- \***************************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nmodule.exports = function (include) {\n if (typeof include === 'function') {\n include();\n } else if (typeof include === 'object') {\n Object.keys(include).forEach(function (key) {\n if (typeof include[key] === 'function') {\n include[key]();\n }\n });\n }\n};\n\n\n//# sourceURL=webpack:///../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.js?");
-
-/***/ }),
-
-/***/ "../storefront-reference-architecture/node_modules/cleave.js/dist/cleave-esm.js":
-/*!**************************************************************************************!*\
- !*** ../storefront-reference-architecture/node_modules/cleave.js/dist/cleave-esm.js ***!
- \**************************************************************************************/
-/*! exports provided: default */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(global) {var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nvar NumeralFormatter = function (numeralDecimalMark,\n numeralIntegerScale,\n numeralDecimalScale,\n numeralThousandsGroupStyle,\n numeralPositiveOnly,\n stripLeadingZeroes,\n prefix,\n signBeforePrefix,\n tailPrefix,\n delimiter) {\n var owner = this;\n\n owner.numeralDecimalMark = numeralDecimalMark || '.';\n owner.numeralIntegerScale = numeralIntegerScale > 0 ? numeralIntegerScale : 0;\n owner.numeralDecimalScale = numeralDecimalScale >= 0 ? numeralDecimalScale : 2;\n owner.numeralThousandsGroupStyle = numeralThousandsGroupStyle || NumeralFormatter.groupStyle.thousand;\n owner.numeralPositiveOnly = !!numeralPositiveOnly;\n owner.stripLeadingZeroes = stripLeadingZeroes !== false;\n owner.prefix = (prefix || prefix === '') ? prefix : '';\n owner.signBeforePrefix = !!signBeforePrefix;\n owner.tailPrefix = !!tailPrefix;\n owner.delimiter = (delimiter || delimiter === '') ? delimiter : ',';\n owner.delimiterRE = delimiter ? new RegExp('\\\\' + delimiter, 'g') : '';\n};\n\nNumeralFormatter.groupStyle = {\n thousand: 'thousand',\n lakh: 'lakh',\n wan: 'wan',\n none: 'none' \n};\n\nNumeralFormatter.prototype = {\n getRawValue: function (value) {\n return value.replace(this.delimiterRE, '').replace(this.numeralDecimalMark, '.');\n },\n\n format: function (value) {\n var owner = this, parts, partSign, partSignAndPrefix, partInteger, partDecimal = '';\n\n // strip alphabet letters\n value = value.replace(/[A-Za-z]/g, '')\n // replace the first decimal mark with reserved placeholder\n .replace(owner.numeralDecimalMark, 'M')\n\n // strip non numeric letters except minus and \"M\"\n // this is to ensure prefix has been stripped\n .replace(/[^\\dM-]/g, '')\n\n // replace the leading minus with reserved placeholder\n .replace(/^\\-/, 'N')\n\n // strip the other minus sign (if present)\n .replace(/\\-/g, '')\n\n // replace the minus sign (if present)\n .replace('N', owner.numeralPositiveOnly ? '' : '-')\n\n // replace decimal mark\n .replace('M', owner.numeralDecimalMark);\n\n // strip any leading zeros\n if (owner.stripLeadingZeroes) {\n value = value.replace(/^(-)?0+(?=\\d)/, '$1');\n }\n\n partSign = value.slice(0, 1) === '-' ? '-' : '';\n if (typeof owner.prefix != 'undefined') {\n if (owner.signBeforePrefix) {\n partSignAndPrefix = partSign + owner.prefix;\n } else {\n partSignAndPrefix = owner.prefix + partSign;\n }\n } else {\n partSignAndPrefix = partSign;\n }\n \n partInteger = value;\n\n if (value.indexOf(owner.numeralDecimalMark) >= 0) {\n parts = value.split(owner.numeralDecimalMark);\n partInteger = parts[0];\n partDecimal = owner.numeralDecimalMark + parts[1].slice(0, owner.numeralDecimalScale);\n }\n\n if(partSign === '-') {\n partInteger = partInteger.slice(1);\n }\n\n if (owner.numeralIntegerScale > 0) {\n partInteger = partInteger.slice(0, owner.numeralIntegerScale);\n }\n\n switch (owner.numeralThousandsGroupStyle) {\n case NumeralFormatter.groupStyle.lakh:\n partInteger = partInteger.replace(/(\\d)(?=(\\d\\d)+\\d$)/g, '$1' + owner.delimiter);\n\n break;\n\n case NumeralFormatter.groupStyle.wan:\n partInteger = partInteger.replace(/(\\d)(?=(\\d{4})+$)/g, '$1' + owner.delimiter);\n\n break;\n\n case NumeralFormatter.groupStyle.thousand:\n partInteger = partInteger.replace(/(\\d)(?=(\\d{3})+$)/g, '$1' + owner.delimiter);\n\n break;\n }\n\n if (owner.tailPrefix) {\n return partSign + partInteger.toString() + (owner.numeralDecimalScale > 0 ? partDecimal.toString() : '') + owner.prefix;\n }\n\n return partSignAndPrefix + partInteger.toString() + (owner.numeralDecimalScale > 0 ? partDecimal.toString() : '');\n }\n};\n\nvar NumeralFormatter_1 = NumeralFormatter;\n\nvar DateFormatter = function (datePattern, dateMin, dateMax) {\n var owner = this;\n\n owner.date = [];\n owner.blocks = [];\n owner.datePattern = datePattern;\n owner.dateMin = dateMin\n .split('-')\n .reverse()\n .map(function(x) {\n return parseInt(x, 10);\n });\n if (owner.dateMin.length === 2) owner.dateMin.unshift(0);\n\n owner.dateMax = dateMax\n .split('-')\n .reverse()\n .map(function(x) {\n return parseInt(x, 10);\n });\n if (owner.dateMax.length === 2) owner.dateMax.unshift(0);\n \n owner.initBlocks();\n};\n\nDateFormatter.prototype = {\n initBlocks: function () {\n var owner = this;\n owner.datePattern.forEach(function (value) {\n if (value === 'Y') {\n owner.blocks.push(4);\n } else {\n owner.blocks.push(2);\n }\n });\n },\n\n getISOFormatDate: function () {\n var owner = this,\n date = owner.date;\n\n return date[2] ? (\n date[2] + '-' + owner.addLeadingZero(date[1]) + '-' + owner.addLeadingZero(date[0])\n ) : '';\n },\n\n getBlocks: function () {\n return this.blocks;\n },\n\n getValidatedDate: function (value) {\n var owner = this, result = '';\n\n value = value.replace(/[^\\d]/g, '');\n\n owner.blocks.forEach(function (length, index) {\n if (value.length > 0) {\n var sub = value.slice(0, length),\n sub0 = sub.slice(0, 1),\n rest = value.slice(length);\n\n switch (owner.datePattern[index]) {\n case 'd':\n if (sub === '00') {\n sub = '01';\n } else if (parseInt(sub0, 10) > 3) {\n sub = '0' + sub0;\n } else if (parseInt(sub, 10) > 31) {\n sub = '31';\n }\n\n break;\n\n case 'm':\n if (sub === '00') {\n sub = '01';\n } else if (parseInt(sub0, 10) > 1) {\n sub = '0' + sub0;\n } else if (parseInt(sub, 10) > 12) {\n sub = '12';\n }\n\n break;\n }\n\n result += sub;\n\n // update remaining string\n value = rest;\n }\n });\n\n return this.getFixedDateString(result);\n },\n\n getFixedDateString: function (value) {\n var owner = this, datePattern = owner.datePattern, date = [],\n dayIndex = 0, monthIndex = 0, yearIndex = 0,\n dayStartIndex = 0, monthStartIndex = 0, yearStartIndex = 0,\n day, month, year, fullYearDone = false;\n\n // mm-dd || dd-mm\n if (value.length === 4 && datePattern[0].toLowerCase() !== 'y' && datePattern[1].toLowerCase() !== 'y') {\n dayStartIndex = datePattern[0] === 'd' ? 0 : 2;\n monthStartIndex = 2 - dayStartIndex;\n day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10);\n month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);\n\n date = this.getFixedDate(day, month, 0);\n }\n\n // yyyy-mm-dd || yyyy-dd-mm || mm-dd-yyyy || dd-mm-yyyy || dd-yyyy-mm || mm-yyyy-dd\n if (value.length === 8) {\n datePattern.forEach(function (type, index) {\n switch (type) {\n case 'd':\n dayIndex = index;\n break;\n case 'm':\n monthIndex = index;\n break;\n default:\n yearIndex = index;\n break;\n }\n });\n\n yearStartIndex = yearIndex * 2;\n dayStartIndex = (dayIndex <= yearIndex) ? dayIndex * 2 : (dayIndex * 2 + 2);\n monthStartIndex = (monthIndex <= yearIndex) ? monthIndex * 2 : (monthIndex * 2 + 2);\n\n day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10);\n month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);\n year = parseInt(value.slice(yearStartIndex, yearStartIndex + 4), 10);\n\n fullYearDone = value.slice(yearStartIndex, yearStartIndex + 4).length === 4;\n\n date = this.getFixedDate(day, month, year);\n }\n\n // mm-yy || yy-mm\n if (value.length === 4 && (datePattern[0] === 'y' || datePattern[1] === 'y')) {\n monthStartIndex = datePattern[0] === 'm' ? 0 : 2;\n yearStartIndex = 2 - monthStartIndex;\n month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);\n year = parseInt(value.slice(yearStartIndex, yearStartIndex + 2), 10);\n\n fullYearDone = value.slice(yearStartIndex, yearStartIndex + 2).length === 2;\n\n date = [0, month, year];\n }\n\n // mm-yyyy || yyyy-mm\n if (value.length === 6 && (datePattern[0] === 'Y' || datePattern[1] === 'Y')) {\n monthStartIndex = datePattern[0] === 'm' ? 0 : 4;\n yearStartIndex = 2 - 0.5 * monthStartIndex;\n month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);\n year = parseInt(value.slice(yearStartIndex, yearStartIndex + 4), 10);\n\n fullYearDone = value.slice(yearStartIndex, yearStartIndex + 4).length === 4;\n\n date = [0, month, year];\n }\n\n date = owner.getRangeFixedDate(date);\n owner.date = date;\n\n var result = date.length === 0 ? value : datePattern.reduce(function (previous, current) {\n switch (current) {\n case 'd':\n return previous + (date[0] === 0 ? '' : owner.addLeadingZero(date[0]));\n case 'm':\n return previous + (date[1] === 0 ? '' : owner.addLeadingZero(date[1]));\n case 'y':\n return previous + (fullYearDone ? owner.addLeadingZeroForYear(date[2], false) : '');\n case 'Y':\n return previous + (fullYearDone ? owner.addLeadingZeroForYear(date[2], true) : '');\n }\n }, '');\n\n return result;\n },\n\n getRangeFixedDate: function (date) {\n var owner = this,\n datePattern = owner.datePattern,\n dateMin = owner.dateMin || [],\n dateMax = owner.dateMax || [];\n\n if (!date.length || (dateMin.length < 3 && dateMax.length < 3)) return date;\n\n if (\n datePattern.find(function(x) {\n return x.toLowerCase() === 'y';\n }) &&\n date[2] === 0\n ) return date;\n\n if (dateMax.length && (dateMax[2] < date[2] || (\n dateMax[2] === date[2] && (dateMax[1] < date[1] || (\n dateMax[1] === date[1] && dateMax[0] < date[0]\n ))\n ))) return dateMax;\n\n if (dateMin.length && (dateMin[2] > date[2] || (\n dateMin[2] === date[2] && (dateMin[1] > date[1] || (\n dateMin[1] === date[1] && dateMin[0] > date[0]\n ))\n ))) return dateMin;\n\n return date;\n },\n\n getFixedDate: function (day, month, year) {\n day = Math.min(day, 31);\n month = Math.min(month, 12);\n year = parseInt((year || 0), 10);\n\n if ((month < 7 && month % 2 === 0) || (month > 8 && month % 2 === 1)) {\n day = Math.min(day, month === 2 ? (this.isLeapYear(year) ? 29 : 28) : 30);\n }\n\n return [day, month, year];\n },\n\n isLeapYear: function (year) {\n return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);\n },\n\n addLeadingZero: function (number) {\n return (number < 10 ? '0' : '') + number;\n },\n\n addLeadingZeroForYear: function (number, fullYearMode) {\n if (fullYearMode) {\n return (number < 10 ? '000' : (number < 100 ? '00' : (number < 1000 ? '0' : ''))) + number;\n }\n\n return (number < 10 ? '0' : '') + number;\n }\n};\n\nvar DateFormatter_1 = DateFormatter;\n\nvar TimeFormatter = function (timePattern, timeFormat) {\n var owner = this;\n\n owner.time = [];\n owner.blocks = [];\n owner.timePattern = timePattern;\n owner.timeFormat = timeFormat;\n owner.initBlocks();\n};\n\nTimeFormatter.prototype = {\n initBlocks: function () {\n var owner = this;\n owner.timePattern.forEach(function () {\n owner.blocks.push(2);\n });\n },\n\n getISOFormatTime: function () {\n var owner = this,\n time = owner.time;\n\n return time[2] ? (\n owner.addLeadingZero(time[0]) + ':' + owner.addLeadingZero(time[1]) + ':' + owner.addLeadingZero(time[2])\n ) : '';\n },\n\n getBlocks: function () {\n return this.blocks;\n },\n\n getTimeFormatOptions: function () {\n var owner = this;\n if (String(owner.timeFormat) === '12') {\n return {\n maxHourFirstDigit: 1,\n maxHours: 12,\n maxMinutesFirstDigit: 5,\n maxMinutes: 60\n };\n }\n\n return {\n maxHourFirstDigit: 2,\n maxHours: 23,\n maxMinutesFirstDigit: 5,\n maxMinutes: 60\n };\n },\n\n getValidatedTime: function (value) {\n var owner = this, result = '';\n\n value = value.replace(/[^\\d]/g, '');\n\n var timeFormatOptions = owner.getTimeFormatOptions();\n\n owner.blocks.forEach(function (length, index) {\n if (value.length > 0) {\n var sub = value.slice(0, length),\n sub0 = sub.slice(0, 1),\n rest = value.slice(length);\n\n switch (owner.timePattern[index]) {\n\n case 'h':\n if (parseInt(sub0, 10) > timeFormatOptions.maxHourFirstDigit) {\n sub = '0' + sub0;\n } else if (parseInt(sub, 10) > timeFormatOptions.maxHours) {\n sub = timeFormatOptions.maxHours + '';\n }\n\n break;\n\n case 'm':\n case 's':\n if (parseInt(sub0, 10) > timeFormatOptions.maxMinutesFirstDigit) {\n sub = '0' + sub0;\n } else if (parseInt(sub, 10) > timeFormatOptions.maxMinutes) {\n sub = timeFormatOptions.maxMinutes + '';\n }\n break;\n }\n\n result += sub;\n\n // update remaining string\n value = rest;\n }\n });\n\n return this.getFixedTimeString(result);\n },\n\n getFixedTimeString: function (value) {\n var owner = this, timePattern = owner.timePattern, time = [],\n secondIndex = 0, minuteIndex = 0, hourIndex = 0,\n secondStartIndex = 0, minuteStartIndex = 0, hourStartIndex = 0,\n second, minute, hour;\n\n if (value.length === 6) {\n timePattern.forEach(function (type, index) {\n switch (type) {\n case 's':\n secondIndex = index * 2;\n break;\n case 'm':\n minuteIndex = index * 2;\n break;\n case 'h':\n hourIndex = index * 2;\n break;\n }\n });\n\n hourStartIndex = hourIndex;\n minuteStartIndex = minuteIndex;\n secondStartIndex = secondIndex;\n\n second = parseInt(value.slice(secondStartIndex, secondStartIndex + 2), 10);\n minute = parseInt(value.slice(minuteStartIndex, minuteStartIndex + 2), 10);\n hour = parseInt(value.slice(hourStartIndex, hourStartIndex + 2), 10);\n\n time = this.getFixedTime(hour, minute, second);\n }\n\n if (value.length === 4 && owner.timePattern.indexOf('s') < 0) {\n timePattern.forEach(function (type, index) {\n switch (type) {\n case 'm':\n minuteIndex = index * 2;\n break;\n case 'h':\n hourIndex = index * 2;\n break;\n }\n });\n\n hourStartIndex = hourIndex;\n minuteStartIndex = minuteIndex;\n\n second = 0;\n minute = parseInt(value.slice(minuteStartIndex, minuteStartIndex + 2), 10);\n hour = parseInt(value.slice(hourStartIndex, hourStartIndex + 2), 10);\n\n time = this.getFixedTime(hour, minute, second);\n }\n\n owner.time = time;\n\n return time.length === 0 ? value : timePattern.reduce(function (previous, current) {\n switch (current) {\n case 's':\n return previous + owner.addLeadingZero(time[2]);\n case 'm':\n return previous + owner.addLeadingZero(time[1]);\n case 'h':\n return previous + owner.addLeadingZero(time[0]);\n }\n }, '');\n },\n\n getFixedTime: function (hour, minute, second) {\n second = Math.min(parseInt(second || 0, 10), 60);\n minute = Math.min(minute, 60);\n hour = Math.min(hour, 60);\n\n return [hour, minute, second];\n },\n\n addLeadingZero: function (number) {\n return (number < 10 ? '0' : '') + number;\n }\n};\n\nvar TimeFormatter_1 = TimeFormatter;\n\nvar PhoneFormatter = function (formatter, delimiter) {\n var owner = this;\n\n owner.delimiter = (delimiter || delimiter === '') ? delimiter : ' ';\n owner.delimiterRE = delimiter ? new RegExp('\\\\' + delimiter, 'g') : '';\n\n owner.formatter = formatter;\n};\n\nPhoneFormatter.prototype = {\n setFormatter: function (formatter) {\n this.formatter = formatter;\n },\n\n format: function (phoneNumber) {\n var owner = this;\n\n owner.formatter.clear();\n\n // only keep number and +\n phoneNumber = phoneNumber.replace(/[^\\d+]/g, '');\n\n // strip non-leading +\n phoneNumber = phoneNumber.replace(/^\\+/, 'B').replace(/\\+/g, '').replace('B', '+');\n\n // strip delimiter\n phoneNumber = phoneNumber.replace(owner.delimiterRE, '');\n\n var result = '', current, validated = false;\n\n for (var i = 0, iMax = phoneNumber.length; i < iMax; i++) {\n current = owner.formatter.inputDigit(phoneNumber.charAt(i));\n\n // has ()- or space inside\n if (/[\\s()-]/g.test(current)) {\n result = current;\n\n validated = true;\n } else {\n if (!validated) {\n result = current;\n }\n // else: over length input\n // it turns to invalid number again\n }\n }\n\n // strip ()\n // e.g. US: 7161234567 returns (716) 123-4567\n result = result.replace(/[()]/g, '');\n // replace library delimiter with user customized delimiter\n result = result.replace(/[\\s-]/g, owner.delimiter);\n\n return result;\n }\n};\n\nvar PhoneFormatter_1 = PhoneFormatter;\n\nvar CreditCardDetector = {\n blocks: {\n uatp: [4, 5, 6],\n amex: [4, 6, 5],\n diners: [4, 6, 4],\n discover: [4, 4, 4, 4],\n mastercard: [4, 4, 4, 4],\n dankort: [4, 4, 4, 4],\n instapayment: [4, 4, 4, 4],\n jcb15: [4, 6, 5],\n jcb: [4, 4, 4, 4],\n maestro: [4, 4, 4, 4],\n visa: [4, 4, 4, 4],\n mir: [4, 4, 4, 4],\n unionPay: [4, 4, 4, 4],\n general: [4, 4, 4, 4]\n },\n\n re: {\n // starts with 1; 15 digits, not starts with 1800 (jcb card)\n uatp: /^(?!1800)1\\d{0,14}/,\n\n // starts with 34/37; 15 digits\n amex: /^3[47]\\d{0,13}/,\n\n // starts with 6011/65/644-649; 16 digits\n discover: /^(?:6011|65\\d{0,2}|64[4-9]\\d?)\\d{0,12}/,\n\n // starts with 300-305/309 or 36/38/39; 14 digits\n diners: /^3(?:0([0-5]|9)|[689]\\d?)\\d{0,11}/,\n\n // starts with 51-55/2221–2720; 16 digits\n mastercard: /^(5[1-5]\\d{0,2}|22[2-9]\\d{0,1}|2[3-7]\\d{0,2})\\d{0,12}/,\n\n // starts with 5019/4175/4571; 16 digits\n dankort: /^(5019|4175|4571)\\d{0,12}/,\n\n // starts with 637-639; 16 digits\n instapayment: /^63[7-9]\\d{0,13}/,\n\n // starts with 2131/1800; 15 digits\n jcb15: /^(?:2131|1800)\\d{0,11}/,\n\n // starts with 2131/1800/35; 16 digits\n jcb: /^(?:35\\d{0,2})\\d{0,12}/,\n\n // starts with 50/56-58/6304/67; 16 digits\n maestro: /^(?:5[0678]\\d{0,2}|6304|67\\d{0,2})\\d{0,12}/,\n\n // starts with 22; 16 digits\n mir: /^220[0-4]\\d{0,12}/,\n\n // starts with 4; 16 digits\n visa: /^4\\d{0,15}/,\n\n // starts with 62/81; 16 digits\n unionPay: /^(62|81)\\d{0,14}/\n },\n\n getStrictBlocks: function (block) {\n var total = block.reduce(function (prev, current) {\n return prev + current;\n }, 0);\n\n return block.concat(19 - total);\n },\n\n getInfo: function (value, strictMode) {\n var blocks = CreditCardDetector.blocks,\n re = CreditCardDetector.re;\n\n // Some credit card can have up to 19 digits number.\n // Set strictMode to true will remove the 16 max-length restrain,\n // however, I never found any website validate card number like\n // this, hence probably you don't want to enable this option.\n strictMode = !!strictMode;\n\n for (var key in re) {\n if (re[key].test(value)) {\n var matchedBlocks = blocks[key];\n return {\n type: key,\n blocks: strictMode ? this.getStrictBlocks(matchedBlocks) : matchedBlocks\n };\n }\n }\n\n return {\n type: 'unknown',\n blocks: strictMode ? this.getStrictBlocks(blocks.general) : blocks.general\n };\n }\n};\n\nvar CreditCardDetector_1 = CreditCardDetector;\n\nvar Util = {\n noop: function () {\n },\n\n strip: function (value, re) {\n return value.replace(re, '');\n },\n\n getPostDelimiter: function (value, delimiter, delimiters) {\n // single delimiter\n if (delimiters.length === 0) {\n return value.slice(-delimiter.length) === delimiter ? delimiter : '';\n }\n\n // multiple delimiters\n var matchedDelimiter = '';\n delimiters.forEach(function (current) {\n if (value.slice(-current.length) === current) {\n matchedDelimiter = current;\n }\n });\n\n return matchedDelimiter;\n },\n\n getDelimiterREByDelimiter: function (delimiter) {\n return new RegExp(delimiter.replace(/([.?*+^$[\\]\\\\(){}|-])/g, '\\\\$1'), 'g');\n },\n\n getNextCursorPosition: function (prevPos, oldValue, newValue, delimiter, delimiters) {\n // If cursor was at the end of value, just place it back.\n // Because new value could contain additional chars.\n if (oldValue.length === prevPos) {\n return newValue.length;\n }\n\n return prevPos + this.getPositionOffset(prevPos, oldValue, newValue, delimiter ,delimiters);\n },\n\n getPositionOffset: function (prevPos, oldValue, newValue, delimiter, delimiters) {\n var oldRawValue, newRawValue, lengthOffset;\n\n oldRawValue = this.stripDelimiters(oldValue.slice(0, prevPos), delimiter, delimiters);\n newRawValue = this.stripDelimiters(newValue.slice(0, prevPos), delimiter, delimiters);\n lengthOffset = oldRawValue.length - newRawValue.length;\n\n return (lengthOffset !== 0) ? (lengthOffset / Math.abs(lengthOffset)) : 0;\n },\n\n stripDelimiters: function (value, delimiter, delimiters) {\n var owner = this;\n\n // single delimiter\n if (delimiters.length === 0) {\n var delimiterRE = delimiter ? owner.getDelimiterREByDelimiter(delimiter) : '';\n\n return value.replace(delimiterRE, '');\n }\n\n // multiple delimiters\n delimiters.forEach(function (current) {\n current.split('').forEach(function (letter) {\n value = value.replace(owner.getDelimiterREByDelimiter(letter), '');\n });\n });\n\n return value;\n },\n\n headStr: function (str, length) {\n return str.slice(0, length);\n },\n\n getMaxLength: function (blocks) {\n return blocks.reduce(function (previous, current) {\n return previous + current;\n }, 0);\n },\n\n // strip prefix\n // Before type | After type | Return value\n // PEFIX-... | PEFIX-... | ''\n // PREFIX-123 | PEFIX-123 | 123\n // PREFIX-123 | PREFIX-23 | 23\n // PREFIX-123 | PREFIX-1234 | 1234\n getPrefixStrippedValue: function (value, prefix, prefixLength, prevResult, delimiter, delimiters, noImmediatePrefix, tailPrefix, signBeforePrefix) {\n // No prefix\n if (prefixLength === 0) {\n return value;\n }\n\n // Value is prefix\n if (value === prefix && value !== '') {\n return '';\n }\n\n if (signBeforePrefix && (value.slice(0, 1) == '-')) {\n var prev = (prevResult.slice(0, 1) == '-') ? prevResult.slice(1) : prevResult;\n return '-' + this.getPrefixStrippedValue(value.slice(1), prefix, prefixLength, prev, delimiter, delimiters, noImmediatePrefix, tailPrefix, signBeforePrefix);\n }\n\n // Pre result prefix string does not match pre-defined prefix\n if (prevResult.slice(0, prefixLength) !== prefix && !tailPrefix) {\n // Check if the first time user entered something\n if (noImmediatePrefix && !prevResult && value) return value;\n return '';\n } else if (prevResult.slice(-prefixLength) !== prefix && tailPrefix) {\n // Check if the first time user entered something\n if (noImmediatePrefix && !prevResult && value) return value;\n return '';\n }\n\n var prevValue = this.stripDelimiters(prevResult, delimiter, delimiters);\n\n // New value has issue, someone typed in between prefix letters\n // Revert to pre value\n if (value.slice(0, prefixLength) !== prefix && !tailPrefix) {\n return prevValue.slice(prefixLength);\n } else if (value.slice(-prefixLength) !== prefix && tailPrefix) {\n return prevValue.slice(0, -prefixLength - 1);\n }\n\n // No issue, strip prefix for new value\n return tailPrefix ? value.slice(0, -prefixLength) : value.slice(prefixLength);\n },\n\n getFirstDiffIndex: function (prev, current) {\n var index = 0;\n\n while (prev.charAt(index) === current.charAt(index)) {\n if (prev.charAt(index++) === '') {\n return -1;\n }\n }\n\n return index;\n },\n\n getFormattedValue: function (value, blocks, blocksLength, delimiter, delimiters, delimiterLazyShow) {\n var result = '',\n multipleDelimiters = delimiters.length > 0,\n currentDelimiter = '';\n\n // no options, normal input\n if (blocksLength === 0) {\n return value;\n }\n\n blocks.forEach(function (length, index) {\n if (value.length > 0) {\n var sub = value.slice(0, length),\n rest = value.slice(length);\n\n if (multipleDelimiters) {\n currentDelimiter = delimiters[delimiterLazyShow ? (index - 1) : index] || currentDelimiter;\n } else {\n currentDelimiter = delimiter;\n }\n\n if (delimiterLazyShow) {\n if (index > 0) {\n result += currentDelimiter;\n }\n\n result += sub;\n } else {\n result += sub;\n\n if (sub.length === length && index < blocksLength - 1) {\n result += currentDelimiter;\n }\n }\n\n // update remaining string\n value = rest;\n }\n });\n\n return result;\n },\n\n // move cursor to the end\n // the first time user focuses on an input with prefix\n fixPrefixCursor: function (el, prefix, delimiter, delimiters) {\n if (!el) {\n return;\n }\n\n var val = el.value,\n appendix = delimiter || (delimiters[0] || ' ');\n\n if (!el.setSelectionRange || !prefix || (prefix.length + appendix.length) <= val.length) {\n return;\n }\n\n var len = val.length * 2;\n\n // set timeout to avoid blink\n setTimeout(function () {\n el.setSelectionRange(len, len);\n }, 1);\n },\n\n // Check if input field is fully selected\n checkFullSelection: function(value) {\n try {\n var selection = window.getSelection() || document.getSelection() || {};\n return selection.toString().length === value.length;\n } catch (ex) {\n // Ignore\n }\n\n return false;\n },\n\n setSelection: function (element, position, doc) {\n if (element !== this.getActiveElement(doc)) {\n return;\n }\n\n // cursor is already in the end\n if (element && element.value.length <= position) {\n return;\n }\n\n if (element.createTextRange) {\n var range = element.createTextRange();\n\n range.move('character', position);\n range.select();\n } else {\n try {\n element.setSelectionRange(position, position);\n } catch (e) {\n // eslint-disable-next-line\n console.warn('The input element type does not support selection');\n }\n }\n },\n\n getActiveElement: function(parent) {\n var activeElement = parent.activeElement;\n if (activeElement && activeElement.shadowRoot) {\n return this.getActiveElement(activeElement.shadowRoot);\n }\n return activeElement;\n },\n\n isAndroid: function () {\n return navigator && /android/i.test(navigator.userAgent);\n },\n\n // On Android chrome, the keyup and keydown events\n // always return key code 229 as a composition that\n // buffers the user’s keystrokes\n // see https://github.com/nosir/cleave.js/issues/147\n isAndroidBackspaceKeydown: function (lastInputValue, currentInputValue) {\n if (!this.isAndroid() || !lastInputValue || !currentInputValue) {\n return false;\n }\n\n return currentInputValue === lastInputValue.slice(0, -1);\n }\n};\n\nvar Util_1 = Util;\n\n/**\n * Props Assignment\n *\n * Separate this, so react module can share the usage\n */\nvar DefaultProperties = {\n // Maybe change to object-assign\n // for now just keep it as simple\n assign: function (target, opts) {\n target = target || {};\n opts = opts || {};\n\n // credit card\n target.creditCard = !!opts.creditCard;\n target.creditCardStrictMode = !!opts.creditCardStrictMode;\n target.creditCardType = '';\n target.onCreditCardTypeChanged = opts.onCreditCardTypeChanged || (function () {});\n\n // phone\n target.phone = !!opts.phone;\n target.phoneRegionCode = opts.phoneRegionCode || 'AU';\n target.phoneFormatter = {};\n\n // time\n target.time = !!opts.time;\n target.timePattern = opts.timePattern || ['h', 'm', 's'];\n target.timeFormat = opts.timeFormat || '24';\n target.timeFormatter = {};\n\n // date\n target.date = !!opts.date;\n target.datePattern = opts.datePattern || ['d', 'm', 'Y'];\n target.dateMin = opts.dateMin || '';\n target.dateMax = opts.dateMax || '';\n target.dateFormatter = {};\n\n // numeral\n target.numeral = !!opts.numeral;\n target.numeralIntegerScale = opts.numeralIntegerScale > 0 ? opts.numeralIntegerScale : 0;\n target.numeralDecimalScale = opts.numeralDecimalScale >= 0 ? opts.numeralDecimalScale : 2;\n target.numeralDecimalMark = opts.numeralDecimalMark || '.';\n target.numeralThousandsGroupStyle = opts.numeralThousandsGroupStyle || 'thousand';\n target.numeralPositiveOnly = !!opts.numeralPositiveOnly;\n target.stripLeadingZeroes = opts.stripLeadingZeroes !== false;\n target.signBeforePrefix = !!opts.signBeforePrefix;\n target.tailPrefix = !!opts.tailPrefix;\n\n // others\n target.swapHiddenInput = !!opts.swapHiddenInput;\n \n target.numericOnly = target.creditCard || target.date || !!opts.numericOnly;\n\n target.uppercase = !!opts.uppercase;\n target.lowercase = !!opts.lowercase;\n\n target.prefix = (target.creditCard || target.date) ? '' : (opts.prefix || '');\n target.noImmediatePrefix = !!opts.noImmediatePrefix;\n target.prefixLength = target.prefix.length;\n target.rawValueTrimPrefix = !!opts.rawValueTrimPrefix;\n target.copyDelimiter = !!opts.copyDelimiter;\n\n target.initValue = (opts.initValue !== undefined && opts.initValue !== null) ? opts.initValue.toString() : '';\n\n target.delimiter =\n (opts.delimiter || opts.delimiter === '') ? opts.delimiter :\n (opts.date ? '/' :\n (opts.time ? ':' :\n (opts.numeral ? ',' :\n (opts.phone ? ' ' :\n ' '))));\n target.delimiterLength = target.delimiter.length;\n target.delimiterLazyShow = !!opts.delimiterLazyShow;\n target.delimiters = opts.delimiters || [];\n\n target.blocks = opts.blocks || [];\n target.blocksLength = target.blocks.length;\n\n target.root = (typeof commonjsGlobal === 'object' && commonjsGlobal) ? commonjsGlobal : window;\n target.document = opts.document || target.root.document;\n\n target.maxLength = 0;\n\n target.backspace = false;\n target.result = '';\n\n target.onValueChanged = opts.onValueChanged || (function () {});\n\n return target;\n }\n};\n\nvar DefaultProperties_1 = DefaultProperties;\n\n/**\n * Construct a new Cleave instance by passing the configuration object\n *\n * @param {String | HTMLElement} element\n * @param {Object} opts\n */\nvar Cleave = function (element, opts) {\n var owner = this;\n var hasMultipleElements = false;\n\n if (typeof element === 'string') {\n owner.element = document.querySelector(element);\n hasMultipleElements = document.querySelectorAll(element).length > 1;\n } else {\n if (typeof element.length !== 'undefined' && element.length > 0) {\n owner.element = element[0];\n hasMultipleElements = element.length > 1;\n } else {\n owner.element = element;\n }\n }\n\n if (!owner.element) {\n throw new Error('[cleave.js] Please check the element');\n }\n\n if (hasMultipleElements) {\n try {\n // eslint-disable-next-line\n console.warn('[cleave.js] Multiple input fields matched, cleave.js will only take the first one.');\n } catch (e) {\n // Old IE\n }\n }\n\n opts.initValue = owner.element.value;\n\n owner.properties = Cleave.DefaultProperties.assign({}, opts);\n\n owner.init();\n};\n\nCleave.prototype = {\n init: function () {\n var owner = this, pps = owner.properties;\n\n // no need to use this lib\n if (!pps.numeral && !pps.phone && !pps.creditCard && !pps.time && !pps.date && (pps.blocksLength === 0 && !pps.prefix)) {\n owner.onInput(pps.initValue);\n\n return;\n }\n\n pps.maxLength = Cleave.Util.getMaxLength(pps.blocks);\n\n owner.isAndroid = Cleave.Util.isAndroid();\n owner.lastInputValue = '';\n owner.isBackward = '';\n\n owner.onChangeListener = owner.onChange.bind(owner);\n owner.onKeyDownListener = owner.onKeyDown.bind(owner);\n owner.onFocusListener = owner.onFocus.bind(owner);\n owner.onCutListener = owner.onCut.bind(owner);\n owner.onCopyListener = owner.onCopy.bind(owner);\n\n owner.initSwapHiddenInput();\n\n owner.element.addEventListener('input', owner.onChangeListener);\n owner.element.addEventListener('keydown', owner.onKeyDownListener);\n owner.element.addEventListener('focus', owner.onFocusListener);\n owner.element.addEventListener('cut', owner.onCutListener);\n owner.element.addEventListener('copy', owner.onCopyListener);\n\n\n owner.initPhoneFormatter();\n owner.initDateFormatter();\n owner.initTimeFormatter();\n owner.initNumeralFormatter();\n\n // avoid touch input field if value is null\n // otherwise Firefox will add red box-shadow for
\n if (pps.initValue || (pps.prefix && !pps.noImmediatePrefix)) {\n owner.onInput(pps.initValue);\n }\n },\n\n initSwapHiddenInput: function () {\n var owner = this, pps = owner.properties;\n if (!pps.swapHiddenInput) return;\n\n var inputFormatter = owner.element.cloneNode(true);\n owner.element.parentNode.insertBefore(inputFormatter, owner.element);\n\n owner.elementSwapHidden = owner.element;\n owner.elementSwapHidden.type = 'hidden';\n\n owner.element = inputFormatter;\n owner.element.id = '';\n },\n\n initNumeralFormatter: function () {\n var owner = this, pps = owner.properties;\n\n if (!pps.numeral) {\n return;\n }\n\n pps.numeralFormatter = new Cleave.NumeralFormatter(\n pps.numeralDecimalMark,\n pps.numeralIntegerScale,\n pps.numeralDecimalScale,\n pps.numeralThousandsGroupStyle,\n pps.numeralPositiveOnly,\n pps.stripLeadingZeroes,\n pps.prefix,\n pps.signBeforePrefix,\n pps.tailPrefix,\n pps.delimiter\n );\n },\n\n initTimeFormatter: function() {\n var owner = this, pps = owner.properties;\n\n if (!pps.time) {\n return;\n }\n\n pps.timeFormatter = new Cleave.TimeFormatter(pps.timePattern, pps.timeFormat);\n pps.blocks = pps.timeFormatter.getBlocks();\n pps.blocksLength = pps.blocks.length;\n pps.maxLength = Cleave.Util.getMaxLength(pps.blocks);\n },\n\n initDateFormatter: function () {\n var owner = this, pps = owner.properties;\n\n if (!pps.date) {\n return;\n }\n\n pps.dateFormatter = new Cleave.DateFormatter(pps.datePattern, pps.dateMin, pps.dateMax);\n pps.blocks = pps.dateFormatter.getBlocks();\n pps.blocksLength = pps.blocks.length;\n pps.maxLength = Cleave.Util.getMaxLength(pps.blocks);\n },\n\n initPhoneFormatter: function () {\n var owner = this, pps = owner.properties;\n\n if (!pps.phone) {\n return;\n }\n\n // Cleave.AsYouTypeFormatter should be provided by\n // external google closure lib\n try {\n pps.phoneFormatter = new Cleave.PhoneFormatter(\n new pps.root.Cleave.AsYouTypeFormatter(pps.phoneRegionCode),\n pps.delimiter\n );\n } catch (ex) {\n throw new Error('[cleave.js] Please include phone-type-formatter.{country}.js lib');\n }\n },\n\n onKeyDown: function (event) {\n var owner = this,\n charCode = event.which || event.keyCode;\n\n owner.lastInputValue = owner.element.value;\n owner.isBackward = charCode === 8;\n },\n\n onChange: function (event) {\n var owner = this, pps = owner.properties,\n Util = Cleave.Util;\n\n owner.isBackward = owner.isBackward || event.inputType === 'deleteContentBackward';\n\n var postDelimiter = Util.getPostDelimiter(owner.lastInputValue, pps.delimiter, pps.delimiters);\n\n if (owner.isBackward && postDelimiter) {\n pps.postDelimiterBackspace = postDelimiter;\n } else {\n pps.postDelimiterBackspace = false;\n }\n\n this.onInput(this.element.value);\n },\n\n onFocus: function () {\n var owner = this,\n pps = owner.properties;\n owner.lastInputValue = owner.element.value;\n\n if (pps.prefix && pps.noImmediatePrefix && !owner.element.value) {\n this.onInput(pps.prefix);\n }\n\n Cleave.Util.fixPrefixCursor(owner.element, pps.prefix, pps.delimiter, pps.delimiters);\n },\n\n onCut: function (e) {\n if (!Cleave.Util.checkFullSelection(this.element.value)) return;\n this.copyClipboardData(e);\n this.onInput('');\n },\n\n onCopy: function (e) {\n if (!Cleave.Util.checkFullSelection(this.element.value)) return;\n this.copyClipboardData(e);\n },\n\n copyClipboardData: function (e) {\n var owner = this,\n pps = owner.properties,\n Util = Cleave.Util,\n inputValue = owner.element.value,\n textToCopy = '';\n\n if (!pps.copyDelimiter) {\n textToCopy = Util.stripDelimiters(inputValue, pps.delimiter, pps.delimiters);\n } else {\n textToCopy = inputValue;\n }\n\n try {\n if (e.clipboardData) {\n e.clipboardData.setData('Text', textToCopy);\n } else {\n window.clipboardData.setData('Text', textToCopy);\n }\n\n e.preventDefault();\n } catch (ex) {\n // empty\n }\n },\n\n onInput: function (value) {\n var owner = this, pps = owner.properties,\n Util = Cleave.Util;\n\n // case 1: delete one more character \"4\"\n // 1234*| -> hit backspace -> 123|\n // case 2: last character is not delimiter which is:\n // 12|34* -> hit backspace -> 1|34*\n // note: no need to apply this for numeral mode\n var postDelimiterAfter = Util.getPostDelimiter(value, pps.delimiter, pps.delimiters);\n if (!pps.numeral && pps.postDelimiterBackspace && !postDelimiterAfter) {\n value = Util.headStr(value, value.length - pps.postDelimiterBackspace.length);\n }\n\n // phone formatter\n if (pps.phone) {\n if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {\n pps.result = pps.prefix + pps.phoneFormatter.format(value).slice(pps.prefix.length);\n } else {\n pps.result = pps.phoneFormatter.format(value);\n }\n owner.updateValueState();\n\n return;\n }\n\n // numeral formatter\n if (pps.numeral) {\n // Do not show prefix when noImmediatePrefix is specified\n // This mostly because we need to show user the native input placeholder\n if (pps.prefix && pps.noImmediatePrefix && value.length === 0) {\n pps.result = '';\n } else {\n pps.result = pps.numeralFormatter.format(value);\n }\n owner.updateValueState();\n\n return;\n }\n\n // date\n if (pps.date) {\n value = pps.dateFormatter.getValidatedDate(value);\n }\n\n // time\n if (pps.time) {\n value = pps.timeFormatter.getValidatedTime(value);\n }\n\n // strip delimiters\n value = Util.stripDelimiters(value, pps.delimiter, pps.delimiters);\n\n // strip prefix\n value = Util.getPrefixStrippedValue(value, pps.prefix, pps.prefixLength, pps.result, pps.delimiter, pps.delimiters, pps.noImmediatePrefix, pps.tailPrefix, pps.signBeforePrefix);\n\n // strip non-numeric characters\n value = pps.numericOnly ? Util.strip(value, /[^\\d]/g) : value;\n\n // convert case\n value = pps.uppercase ? value.toUpperCase() : value;\n value = pps.lowercase ? value.toLowerCase() : value;\n\n // prevent from showing prefix when no immediate option enabled with empty input value\n if (pps.prefix) {\n if (pps.tailPrefix) {\n value = value + pps.prefix;\n } else {\n value = pps.prefix + value;\n }\n\n\n // no blocks specified, no need to do formatting\n if (pps.blocksLength === 0) {\n pps.result = value;\n owner.updateValueState();\n\n return;\n }\n }\n\n // update credit card props\n if (pps.creditCard) {\n owner.updateCreditCardPropsByValue(value);\n }\n\n // strip over length characters\n value = Util.headStr(value, pps.maxLength);\n\n // apply blocks\n pps.result = Util.getFormattedValue(\n value,\n pps.blocks, pps.blocksLength,\n pps.delimiter, pps.delimiters, pps.delimiterLazyShow\n );\n\n owner.updateValueState();\n },\n\n updateCreditCardPropsByValue: function (value) {\n var owner = this, pps = owner.properties,\n Util = Cleave.Util,\n creditCardInfo;\n\n // At least one of the first 4 characters has changed\n if (Util.headStr(pps.result, 4) === Util.headStr(value, 4)) {\n return;\n }\n\n creditCardInfo = Cleave.CreditCardDetector.getInfo(value, pps.creditCardStrictMode);\n\n pps.blocks = creditCardInfo.blocks;\n pps.blocksLength = pps.blocks.length;\n pps.maxLength = Util.getMaxLength(pps.blocks);\n\n // credit card type changed\n if (pps.creditCardType !== creditCardInfo.type) {\n pps.creditCardType = creditCardInfo.type;\n\n pps.onCreditCardTypeChanged.call(owner, pps.creditCardType);\n }\n },\n\n updateValueState: function () {\n var owner = this,\n Util = Cleave.Util,\n pps = owner.properties;\n\n if (!owner.element) {\n return;\n }\n\n var endPos = owner.element.selectionEnd;\n var oldValue = owner.element.value;\n var newValue = pps.result;\n\n endPos = Util.getNextCursorPosition(endPos, oldValue, newValue, pps.delimiter, pps.delimiters);\n\n // fix Android browser type=\"text\" input field\n // cursor not jumping issue\n if (owner.isAndroid) {\n window.setTimeout(function () {\n owner.element.value = newValue;\n Util.setSelection(owner.element, endPos, pps.document, false);\n owner.callOnValueChanged();\n }, 1);\n\n return;\n }\n\n owner.element.value = newValue;\n if (pps.swapHiddenInput) owner.elementSwapHidden.value = owner.getRawValue();\n\n Util.setSelection(owner.element, endPos, pps.document, false);\n owner.callOnValueChanged();\n },\n\n callOnValueChanged: function () {\n var owner = this,\n pps = owner.properties;\n\n pps.onValueChanged.call(owner, {\n target: {\n name: owner.element.name,\n value: pps.result,\n rawValue: owner.getRawValue()\n }\n });\n },\n\n setPhoneRegionCode: function (phoneRegionCode) {\n var owner = this, pps = owner.properties;\n\n pps.phoneRegionCode = phoneRegionCode;\n owner.initPhoneFormatter();\n owner.onChange();\n },\n\n setRawValue: function (value) {\n var owner = this, pps = owner.properties;\n\n value = value !== undefined && value !== null ? value.toString() : '';\n\n if (pps.numeral) {\n value = value.replace('.', pps.numeralDecimalMark);\n }\n\n pps.postDelimiterBackspace = false;\n\n owner.element.value = value;\n owner.onInput(value);\n },\n\n getRawValue: function () {\n var owner = this,\n pps = owner.properties,\n Util = Cleave.Util,\n rawValue = owner.element.value;\n\n if (pps.rawValueTrimPrefix) {\n rawValue = Util.getPrefixStrippedValue(rawValue, pps.prefix, pps.prefixLength, pps.result, pps.delimiter, pps.delimiters, pps.noImmediatePrefix, pps.tailPrefix, pps.signBeforePrefix);\n }\n\n if (pps.numeral) {\n rawValue = pps.numeralFormatter.getRawValue(rawValue);\n } else {\n rawValue = Util.stripDelimiters(rawValue, pps.delimiter, pps.delimiters);\n }\n\n return rawValue;\n },\n\n getISOFormatDate: function () {\n var owner = this,\n pps = owner.properties;\n\n return pps.date ? pps.dateFormatter.getISOFormatDate() : '';\n },\n\n getISOFormatTime: function () {\n var owner = this,\n pps = owner.properties;\n\n return pps.time ? pps.timeFormatter.getISOFormatTime() : '';\n },\n\n getFormattedValue: function () {\n return this.element.value;\n },\n\n destroy: function () {\n var owner = this;\n\n owner.element.removeEventListener('input', owner.onChangeListener);\n owner.element.removeEventListener('keydown', owner.onKeyDownListener);\n owner.element.removeEventListener('focus', owner.onFocusListener);\n owner.element.removeEventListener('cut', owner.onCutListener);\n owner.element.removeEventListener('copy', owner.onCopyListener);\n },\n\n toString: function () {\n return '[Cleave Object]';\n }\n};\n\nCleave.NumeralFormatter = NumeralFormatter_1;\nCleave.DateFormatter = DateFormatter_1;\nCleave.TimeFormatter = TimeFormatter_1;\nCleave.PhoneFormatter = PhoneFormatter_1;\nCleave.CreditCardDetector = CreditCardDetector_1;\nCleave.Util = Util_1;\nCleave.DefaultProperties = DefaultProperties_1;\n\n// for angular directive\n((typeof commonjsGlobal === 'object' && commonjsGlobal) ? commonjsGlobal : window)['Cleave'] = Cleave;\n\n// CommonJS\nvar Cleave_1 = Cleave;\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Cleave_1);\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../adyen-salesforce-commerce-cloud/node_modules/sgmf-scripts/node_modules/webpack/buildin/global.js */ \"./node_modules/sgmf-scripts/node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///../storefront-reference-architecture/node_modules/cleave.js/dist/cleave-esm.js?");
-
-/***/ }),
-
-/***/ "./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js":
-/*!********************************************************************************!*\
- !*** ./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js ***!
- \********************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nvar store = __webpack_require__(/*! ../../../store */ \"./cartridges/int_adyen_SFRA/cartridge/store/index.js\");\nvar _require = __webpack_require__(/*! ./adyen_checkout/renderGenericComponent */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGenericComponent.js\"),\n renderGenericComponent = _require.renderGenericComponent;\nvar _require2 = __webpack_require__(/*! ./adyen_checkout/checkoutConfiguration */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js\"),\n setCheckoutConfiguration = _require2.setCheckoutConfiguration,\n actionHandler = _require2.actionHandler;\nvar _require3 = __webpack_require__(/*! ./adyen_checkout/helpers */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js\"),\n assignPaymentMethodValue = _require3.assignPaymentMethodValue,\n showValidation = _require3.showValidation,\n paymentFromComponent = _require3.paymentFromComponent;\nvar _require4 = __webpack_require__(/*! ./adyen_checkout/validateComponents */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/validateComponents.js\"),\n validateComponents = _require4.validateComponents;\n$('#dwfrm_billing').submit(function apiRequest(e) {\n e.preventDefault();\n var form = $(this);\n var url = form.attr('action');\n $.ajax({\n type: 'POST',\n url: url,\n data: form.serialize(),\n async: false,\n success: function success(data) {\n store.formErrorsExist = 'fieldErrors' in data;\n }\n });\n});\nsetCheckoutConfiguration();\nif (window.cardholderNameBool !== 'null') {\n store.checkoutConfiguration.paymentMethodsConfiguration.card.hasHolderName = true;\n store.checkoutConfiguration.paymentMethodsConfiguration.card.holderNameRequired = true;\n}\nif (window.googleMerchantID !== 'null' && window.Configuration.environment === 'live') {\n var id = 'merchantId';\n store.checkoutConfiguration.paymentMethodsConfiguration.paywithgoogle.configuration[id] = window.googleMerchantID;\n store.checkoutConfiguration.paymentMethodsConfiguration.googlepay.configuration[id] = window.googleMerchantID;\n}\n\n// Submit the payment\n$('button[value=\"submit-payment\"]').on('click', function () {\n if (store.paypalTerminatedEarly) {\n paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value\n });\n store.paypalTerminatedEarly = false;\n }\n if (document.querySelector('#selectedPaymentOption').value === 'AdyenPOS') {\n document.querySelector('#terminalId').value = document.querySelector('#terminalList').value;\n }\n if (document.querySelector('#selectedPaymentOption').value === 'AdyenComponent') {\n assignPaymentMethodValue();\n validateComponents();\n return showValidation();\n }\n return true;\n});\nmodule.exports = {\n renderGenericComponent: renderGenericComponent,\n actionHandler: actionHandler\n};\n\n//# sourceURL=webpack:///./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js?");
-
-/***/ }),
-
-/***/ "./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js":
-/*!*******************************************************************************************************!*\
- !*** ./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js ***!
- \*******************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nvar helpers = __webpack_require__(/*! ./helpers */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js\");\nvar _require = __webpack_require__(/*! ../commons */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/commons/index.js\"),\n onBrand = _require.onBrand,\n onFieldValid = _require.onFieldValid;\nvar store = __webpack_require__(/*! ../../../../store */ \"./cartridges/int_adyen_SFRA/cartridge/store/index.js\");\nvar constants = __webpack_require__(/*! ../constants */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/constants.js\");\nvar _require2 = __webpack_require__(/*! ./renderGiftcardComponent */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js\"),\n createElementsToShowRemainingGiftCardAmount = _require2.createElementsToShowRemainingGiftCardAmount,\n renderAddedGiftCard = _require2.renderAddedGiftCard,\n getGiftCardElements = _require2.getGiftCardElements;\nfunction getCardConfig() {\n return {\n enableStoreDetails: window.showStoreDetails,\n showBrandsUnderCardNumber: false,\n onChange: function onChange(state) {\n store.isValid = state.isValid;\n var method = state.data.paymentMethod.storedPaymentMethodId ? \"storedCard\".concat(state.data.paymentMethod.storedPaymentMethodId) : store.selectedMethod;\n store.updateSelectedPayment(method, 'isValid', store.isValid);\n store.updateSelectedPayment(method, 'stateData', state.data);\n },\n onFieldValid: onFieldValid,\n onBrand: onBrand\n };\n}\nfunction getPaypalConfig() {\n store.paypalTerminatedEarly = false;\n return {\n showPayButton: true,\n environment: window.Configuration.environment,\n onSubmit: function onSubmit(state, component) {\n helpers.assignPaymentMethodValue();\n document.querySelector('#adyenStateData').value = JSON.stringify(store.selectedPayment.stateData);\n helpers.paymentFromComponent(state.data, component);\n },\n onCancel: function onCancel(data, component) {\n store.paypalTerminatedEarly = false;\n helpers.paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value,\n orderToken: document.querySelector('#orderToken').value\n }, component);\n },\n onError: function onError(error, component) {\n store.paypalTerminatedEarly = false;\n if (component) {\n component.setStatus('ready');\n }\n document.querySelector('#showConfirmationForm').submit();\n },\n onAdditionalDetails: function onAdditionalDetails(state) {\n store.paypalTerminatedEarly = false;\n document.querySelector('#additionalDetailsHidden').value = JSON.stringify(state.data);\n document.querySelector('#showConfirmationForm').submit();\n },\n onClick: function onClick(data, actions) {\n if (store.paypalTerminatedEarly) {\n helpers.paymentFromComponent({\n cancelTransaction: true,\n merchantReference: document.querySelector('#merchantReference').value\n });\n store.paypalTerminatedEarly = false;\n return actions.resolve();\n }\n store.paypalTerminatedEarly = true;\n $('#dwfrm_billing').trigger('submit');\n if (store.formErrorsExist) {\n return actions.reject();\n }\n return null;\n }\n };\n}\nfunction getGooglePayConfig() {\n return {\n environment: window.Configuration.environment,\n onSubmit: function onSubmit() {\n helpers.assignPaymentMethodValue();\n document.querySelector('button[value=\"submit-payment\"]').disabled = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n },\n configuration: {\n gatewayMerchantId: window.merchantAccount\n },\n showPayButton: true,\n buttonColor: 'white'\n };\n}\nfunction handlePartialPaymentSuccess() {\n var _getGiftCardElements = getGiftCardElements(),\n giftCardSelectContainer = _getGiftCardElements.giftCardSelectContainer,\n giftCardSelect = _getGiftCardElements.giftCardSelect;\n giftCardSelectContainer.classList.add('invisible');\n giftCardSelect.value = null;\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n renderAddedGiftCard();\n createElementsToShowRemainingGiftCardAmount();\n}\nfunction getGiftCardConfig() {\n var giftcardBalance;\n return {\n showPayButton: true,\n onChange: function onChange(state) {\n store.updateSelectedPayment(constants.GIFTCARD, 'isValid', state.isValid);\n store.updateSelectedPayment(constants.GIFTCARD, 'stateData', state.data);\n },\n onBalanceCheck: function onBalanceCheck(resolve, reject, requestData) {\n $.ajax({\n type: 'POST',\n url: 'Adyen-CheckBalance',\n data: JSON.stringify(requestData),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n giftcardBalance = data.balance;\n if (data.resultCode === constants.SUCCESS) {\n var giftCardSelect = document.querySelector('#giftCardSelect');\n if (giftCardSelect) {\n giftCardSelect.classList.add('invisible');\n }\n resolve(data);\n } else if (data.resultCode === constants.NOTENOUGHBALANCE) {\n resolve(data);\n } else {\n reject();\n }\n },\n fail: function fail() {\n reject();\n }\n });\n },\n onOrderRequest: function onOrderRequest(resolve, reject, requestData) {\n // Make a POST /orders request\n // Create an order for the total transaction amount\n var giftCardData = requestData.paymentMethod;\n $.ajax({\n type: 'POST',\n url: 'Adyen-PartialPaymentsOrder',\n data: JSON.stringify(requestData),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n if (data.resultCode === 'Success') {\n // make payments call including giftcard data and order data\n var brandSelect = document.getElementById('giftCardSelect');\n var selectedBrandIndex = brandSelect.selectedIndex;\n var giftcardBrand = brandSelect.options[selectedBrandIndex].text;\n var partialPaymentRequest = {\n paymentMethod: giftCardData,\n amount: giftcardBalance,\n partialPaymentsOrder: {\n pspReference: data.pspReference,\n orderData: data.orderData\n },\n giftcardBrand: giftcardBrand\n };\n var partialPaymentResponse = helpers.makePartialPayment(partialPaymentRequest, data.expiresAt, data.remainingAmount);\n if (partialPaymentResponse !== null && partialPaymentResponse !== void 0 && partialPaymentResponse.error) {\n reject();\n } else {\n handlePartialPaymentSuccess();\n }\n }\n }\n });\n },\n onSubmit: function onSubmit(state, component) {\n store.selectedMethod = state.data.paymentMethod.type;\n store.brand = component === null || component === void 0 ? void 0 : component.displayName;\n document.querySelector('input[name=\"brandCode\"]').checked = false;\n document.querySelector('button[value=\"submit-payment\"]').click();\n }\n };\n}\nfunction handleOnChange(state) {\n store.isValid = state.isValid;\n if (!store.componentsObj[store.selectedMethod]) {\n store.componentsObj[store.selectedMethod] = {};\n }\n store.componentsObj[store.selectedMethod].isValid = store.isValid;\n store.componentsObj[store.selectedMethod].stateData = state.data;\n}\nvar actionHandler = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(action) {\n var checkout;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return AdyenCheckout(store.checkoutConfiguration);\n case 2:\n checkout = _context.sent;\n checkout.createFromAction(action).mount('#action-container');\n $('#action-modal').modal({\n backdrop: 'static',\n keyboard: false\n });\n case 5:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return function actionHandler(_x) {\n return _ref.apply(this, arguments);\n };\n}();\nfunction handleOnAdditionalDetails(state) {\n $.ajax({\n type: 'POST',\n url: 'Adyen-PaymentsDetails',\n data: JSON.stringify({\n data: state.data,\n orderToken: window.orderToken\n }),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(data) {\n if (!data.isFinal && _typeof(data.action) === 'object') {\n actionHandler(data.action);\n } else {\n window.location.href = data.redirectUrl;\n }\n }\n });\n}\nfunction getAmazonpayConfig() {\n return {\n showPayButton: true,\n productType: 'PayAndShip',\n checkoutMode: 'ProcessOrder',\n locale: window.Configuration.locale,\n returnUrl: window.returnURL,\n onClick: function onClick(resolve, reject) {\n $('#dwfrm_billing').trigger('submit');\n if (store.formErrorsExist) {\n reject();\n } else {\n helpers.assignPaymentMethodValue();\n resolve();\n }\n },\n onError: function onError() {}\n };\n}\nfunction setCheckoutConfiguration() {\n store.checkoutConfiguration.onChange = handleOnChange;\n store.checkoutConfiguration.onAdditionalDetails = handleOnAdditionalDetails;\n store.checkoutConfiguration.showPayButton = false;\n store.checkoutConfiguration.clientKey = window.adyenClientKey;\n store.checkoutConfiguration.paymentMethodsConfiguration = {\n card: getCardConfig(),\n bcmc: getCardConfig(),\n storedCard: getCardConfig(),\n boletobancario: {\n personalDetailsRequired: true,\n // turn personalDetails section on/off\n billingAddressRequired: false,\n // turn billingAddress section on/off\n showEmailAddress: false // allow shopper to specify their email address\n },\n\n paywithgoogle: getGooglePayConfig(),\n googlepay: getGooglePayConfig(),\n paypal: getPaypalConfig(),\n amazonpay: getAmazonpayConfig(),\n giftcard: getGiftCardConfig()\n };\n}\nmodule.exports = {\n getCardConfig: getCardConfig,\n getPaypalConfig: getPaypalConfig,\n getGooglePayConfig: getGooglePayConfig,\n setCheckoutConfiguration: setCheckoutConfiguration,\n actionHandler: actionHandler\n};\n\n//# sourceURL=webpack:///./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/checkoutConfiguration.js?");
-
-/***/ }),
-
-/***/ "./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js":
-/*!*****************************************************************************************!*\
- !*** ./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js ***!
- \*****************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar store = __webpack_require__(/*! ../../../../store */ \"./cartridges/int_adyen_SFRA/cartridge/store/index.js\");\nvar constants = __webpack_require__(/*! ../constants */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/constants.js\");\nfunction assignPaymentMethodValue() {\n var adyenPaymentMethod = document.querySelector('#adyenPaymentMethodName');\n // if currently selected paymentMethod contains a brand it will be part of the label ID\n var paymentMethodlabelId = \"#lb_\".concat(store.selectedMethod);\n if (adyenPaymentMethod) {\n var _document$querySelect;\n adyenPaymentMethod.value = store.brand ? store.brand : (_document$querySelect = document.querySelector(paymentMethodlabelId)) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.innerHTML;\n }\n}\nfunction setOrderFormData(response) {\n if (response.orderNo) {\n document.querySelector('#merchantReference').value = response.orderNo;\n }\n if (response.orderToken) {\n document.querySelector('#orderToken').value = response.orderToken;\n }\n}\nfunction setPartialPaymentOrderObject(response) {\n var giftcard = store.partialPaymentsOrderObj.giftcard;\n store.partialPaymentsOrderObj = {\n giftcard: giftcard,\n partialPaymentsOrder: {\n pspReference: response.order.pspReference,\n orderData: response.order.orderData\n },\n remainingAmount: response.remainingAmountFormatted,\n discountedAmount: response.discountAmountFormatted,\n orderAmount: response.orderAmount,\n expiresAt: response.expiresAt\n };\n window.sessionStorage.setItem(constants.GIFTCARD_DATA_ADDED, JSON.stringify(store.partialPaymentsOrderObj));\n}\n\n/**\n * Makes an ajax call to the controller function PaymentFromComponent.\n * Used by certain payment methods like paypal\n */\nfunction paymentFromComponent(data) {\n var component = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var requestData = store.partialPaymentsOrderObj ? _objectSpread(_objectSpread({}, data), {}, {\n partialPaymentsOrder: store.partialPaymentsOrderObj\n }) : data;\n $.ajax({\n url: window.paymentFromComponentURL,\n type: 'post',\n data: {\n data: JSON.stringify(requestData),\n paymentMethod: document.querySelector('#adyenPaymentMethodName').value\n },\n success: function success(response) {\n var _response$fullRespons;\n setOrderFormData(response);\n if ((_response$fullRespons = response.fullResponse) !== null && _response$fullRespons !== void 0 && _response$fullRespons.action) {\n component.handleAction(response.fullResponse.action);\n }\n if (response.paymentError || response.error) {\n component.handleError();\n }\n }\n });\n}\nfunction makePartialPayment(requestData, expiresAt, orderAmount) {\n var error;\n $.ajax({\n url: 'Adyen-partialPayment',\n type: 'POST',\n data: JSON.stringify(requestData),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(response) {\n if (response.error) {\n error = {\n error: true\n };\n } else {\n setPartialPaymentOrderObject(_objectSpread(_objectSpread({}, response), {}, {\n expiresAt: expiresAt,\n orderAmount: orderAmount\n }));\n setOrderFormData(response);\n }\n }\n }).fail(function () {});\n return error;\n}\nfunction resetPaymentMethod() {\n $('#requiredBrandCode').hide();\n $('#selectedIssuer').val('');\n $('#adyenIssuerName').val('');\n $('#dateOfBirth').val('');\n $('#telephoneNumber').val('');\n $('#gender').val('');\n $('#bankAccountOwnerName').val('');\n $('#bankAccountNumber').val('');\n $('#bankLocationId').val('');\n $('.additionalFields').hide();\n}\n\n/**\n * Changes the \"display\" attribute of the selected method from hidden to visible\n */\nfunction displaySelectedMethod(type) {\n var _document$querySelect2;\n // If 'type' input field is present use this as type, otherwise default to function input param\n store.selectedMethod = document.querySelector(\"#component_\".concat(type, \" .type\")) ? document.querySelector(\"#component_\".concat(type, \" .type\")).value : type;\n resetPaymentMethod();\n document.querySelector('button[value=\"submit-payment\"]').disabled = ['paypal', 'paywithgoogle', 'googlepay', 'amazonpay'].indexOf(type) > -1;\n document.querySelector(\"#component_\".concat(type)).setAttribute('style', 'display:block');\n // set brand for giftcards if hidden inputfield is present\n store.brand = (_document$querySelect2 = document.querySelector(\"#component_\".concat(type, \" .brand\"))) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.value;\n}\nfunction displayValidationErrors() {\n store.selectedPayment.node.showValidation();\n return false;\n}\nvar selectedMethods = {};\nfunction doCustomValidation() {\n return store.selectedMethod in selectedMethods ? selectedMethods[store.selectedMethod]() : true;\n}\nfunction showValidation() {\n return store.selectedPaymentIsValid ? doCustomValidation() : displayValidationErrors();\n}\nfunction getInstallmentValues(maxValue) {\n var values = [];\n for (var i = 1; i <= maxValue; i += 1) {\n values.push(i);\n }\n return values;\n}\nfunction createShowConfirmationForm(action) {\n if (document.querySelector('#showConfirmationForm')) {\n return;\n }\n var template = document.createElement('template');\n var form = \"
\");\n template.innerHTML = form;\n document.querySelector('body').appendChild(template.content);\n}\nmodule.exports = {\n setOrderFormData: setOrderFormData,\n assignPaymentMethodValue: assignPaymentMethodValue,\n paymentFromComponent: paymentFromComponent,\n resetPaymentMethod: resetPaymentMethod,\n displaySelectedMethod: displaySelectedMethod,\n showValidation: showValidation,\n createShowConfirmationForm: createShowConfirmationForm,\n getInstallmentValues: getInstallmentValues,\n makePartialPayment: makePartialPayment\n};\n\n//# sourceURL=webpack:///./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js?");
-
-/***/ }),
-
-/***/ "./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/localesUsingInstallments.js":
-/*!**********************************************************************************************************!*\
- !*** ./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/localesUsingInstallments.js ***!
- \**********************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nmodule.exports.installmentLocales = ['pt_BR', 'ja_JP', 'tr_TR', 'es_MX'];\n\n//# sourceURL=webpack:///./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/localesUsingInstallments.js?");
-
-/***/ }),
-
-/***/ "./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGenericComponent.js":
-/*!********************************************************************************************************!*\
- !*** ./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGenericComponent.js ***!
- \********************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar store = __webpack_require__(/*! ../../../../store */ \"./cartridges/int_adyen_SFRA/cartridge/store/index.js\");\nvar _require = __webpack_require__(/*! ./renderPaymentMethod */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderPaymentMethod.js\"),\n renderPaymentMethod = _require.renderPaymentMethod;\nvar helpers = __webpack_require__(/*! ./helpers */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js\");\nvar _require2 = __webpack_require__(/*! ./localesUsingInstallments */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/localesUsingInstallments.js\"),\n installmentLocales = _require2.installmentLocales;\nvar _require3 = __webpack_require__(/*! ../commons */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/commons/index.js\"),\n createSession = _require3.createSession;\nvar constants = __webpack_require__(/*! ../constants */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/constants.js\");\nvar _require4 = __webpack_require__(/*! ./renderGiftcardComponent */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js\"),\n createElementsToShowRemainingGiftCardAmount = _require4.createElementsToShowRemainingGiftCardAmount,\n removeGiftCard = _require4.removeGiftCard,\n renderAddedGiftCard = _require4.renderAddedGiftCard,\n showGiftCardWarningMessage = _require4.showGiftCardWarningMessage,\n renderGiftCardSelectForm = _require4.renderGiftCardSelectForm;\nfunction addPosTerminals(terminals) {\n var ddTerminals = document.createElement('select');\n ddTerminals.id = 'terminalList';\n Object.keys(terminals).forEach(function (t) {\n var option = document.createElement('option');\n option.value = terminals[t];\n option.text = terminals[t];\n ddTerminals.appendChild(option);\n });\n document.querySelector('#adyenPosTerminals').append(ddTerminals);\n}\nfunction setCheckoutConfiguration(checkoutOptions) {\n var setField = function setField(key, val) {\n return val && _defineProperty({}, key, val);\n };\n store.checkoutConfiguration = _objectSpread(_objectSpread(_objectSpread({}, store.checkoutConfiguration), setField('amount', checkoutOptions.amount)), setField('countryCode', checkoutOptions.countryCode));\n}\nfunction resolveUnmount(key, val) {\n try {\n return Promise.resolve(val.node.unmount(\"component_\".concat(key)));\n } catch (e) {\n // try/catch block for val.unmount\n return Promise.resolve(false);\n }\n}\n\n/**\n * To avoid re-rendering components twice, unmounts existing components from payment methods list\n */\nfunction unmountComponents() {\n var promises = Object.entries(store.componentsObj).map(function (_ref2) {\n var _ref3 = _slicedToArray(_ref2, 2),\n key = _ref3[0],\n val = _ref3[1];\n delete store.componentsObj[key];\n return resolveUnmount(key, val);\n });\n return Promise.all(promises);\n}\nfunction renderGiftCardLogo(imagePath) {\n var headingImg = document.querySelector('#headingImg');\n if (headingImg) {\n headingImg.src = \"\".concat(imagePath, \"genericgiftcard.png\");\n }\n}\nfunction applyGiftCard() {\n var now = new Date().toISOString();\n var amount = store.checkoutConfiguration.amount;\n var _store$partialPayment = store.partialPaymentsOrderObj,\n orderAmount = _store$partialPayment.orderAmount,\n expiresAt = _store$partialPayment.expiresAt;\n var isPartialPaymentExpired = expiresAt && now > expiresAt;\n var isCartModified = amount.currency !== orderAmount.currency || amount.value !== orderAmount.value;\n if (isPartialPaymentExpired) {\n removeGiftCard();\n renderGiftCardSelectForm();\n } else if (isCartModified) {\n removeGiftCard();\n renderGiftCardSelectForm();\n showGiftCardWarningMessage();\n } else {\n renderAddedGiftCard();\n createElementsToShowRemainingGiftCardAmount();\n }\n}\nfunction renderStoredPaymentMethod(imagePath) {\n return function (pm) {\n if (pm.supportedShopperInteractions.includes('Ecommerce')) {\n renderPaymentMethod(pm, true, imagePath);\n }\n };\n}\nfunction renderStoredPaymentMethods(data, imagePath) {\n if (data.storedPaymentMethods) {\n var storedPaymentMethods = data.storedPaymentMethods;\n storedPaymentMethods.forEach(renderStoredPaymentMethod(imagePath));\n }\n}\nfunction renderPaymentMethods(data, imagePath, adyenDescriptions) {\n data.paymentMethods.forEach(function (pm) {\n if (pm.type !== constants.GIFTCARD) {\n renderPaymentMethod(pm, false, imagePath, adyenDescriptions[pm.type]);\n }\n });\n}\nfunction renderPosTerminals(adyenConnectedTerminals) {\n var _adyenConnectedTermin;\n var removeChilds = function removeChilds() {\n var posTerminals = document.querySelector('#adyenPosTerminals');\n while (posTerminals.firstChild) {\n posTerminals.removeChild(posTerminals.firstChild);\n }\n };\n if (adyenConnectedTerminals !== null && adyenConnectedTerminals !== void 0 && (_adyenConnectedTermin = adyenConnectedTerminals.uniqueTerminalIds) !== null && _adyenConnectedTermin !== void 0 && _adyenConnectedTermin.length) {\n removeChilds();\n addPosTerminals(adyenConnectedTerminals.uniqueTerminalIds);\n }\n}\nfunction setAmazonPayConfig(adyenPaymentMethods) {\n var amazonpay = adyenPaymentMethods.paymentMethods.find(function (paymentMethod) {\n return paymentMethod.type === 'amazonpay';\n });\n if (amazonpay) {\n var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4, _document$querySelect5, _document$querySelect6, _document$querySelect7, _document$querySelect8;\n store.checkoutConfiguration.paymentMethodsConfiguration.amazonpay.configuration = amazonpay.configuration;\n store.checkoutConfiguration.paymentMethodsConfiguration.amazonpay.addressDetails = {\n name: \"\".concat((_document$querySelect = document.querySelector('#shippingFirstNamedefault')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.value, \" \").concat((_document$querySelect2 = document.querySelector('#shippingLastNamedefault')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.value),\n addressLine1: (_document$querySelect3 = document.querySelector('#shippingAddressOnedefault')) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.value,\n city: (_document$querySelect4 = document.querySelector('#shippingAddressCitydefault')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.value,\n stateOrRegion: (_document$querySelect5 = document.querySelector('#shippingAddressCitydefault')) === null || _document$querySelect5 === void 0 ? void 0 : _document$querySelect5.value,\n postalCode: (_document$querySelect6 = document.querySelector('#shippingZipCodedefault')) === null || _document$querySelect6 === void 0 ? void 0 : _document$querySelect6.value,\n countryCode: (_document$querySelect7 = document.querySelector('#shippingCountrydefault')) === null || _document$querySelect7 === void 0 ? void 0 : _document$querySelect7.value,\n phoneNumber: (_document$querySelect8 = document.querySelector('#shippingPhoneNumberdefault')) === null || _document$querySelect8 === void 0 ? void 0 : _document$querySelect8.value\n };\n }\n}\nfunction setInstallments(amount) {\n try {\n var _window$installments;\n if (installmentLocales.indexOf(window.Configuration.locale) < 0) {\n return;\n }\n var _window$installments$ = (_window$installments = window.installments) === null || _window$installments === void 0 ? void 0 : _window$installments.replace(/\\[|]/g, '').split(','),\n _window$installments$2 = _slicedToArray(_window$installments$, 2),\n minAmount = _window$installments$2[0],\n numOfInstallments = _window$installments$2[1];\n if (minAmount <= amount.value) {\n store.checkoutConfiguration.paymentMethodsConfiguration.card.installmentOptions = {\n card: {}\n }; // eslint-disable-next-line max-len\n store.checkoutConfiguration.paymentMethodsConfiguration.card.installmentOptions.card.values = helpers.getInstallmentValues(numOfInstallments);\n store.checkoutConfiguration.paymentMethodsConfiguration.card.showInstallmentAmounts = true;\n }\n } catch (e) {} // eslint-disable-line no-empty\n}\n\n/**\n * Calls createSession and then renders the retrieved payment methods (including card component)\n */\nmodule.exports.renderGenericComponent = /*#__PURE__*/function () {\n var _renderGenericComponent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var session, firstPaymentMethod;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(Object.keys(store.componentsObj).length !== 0)) {\n _context.next = 3;\n break;\n }\n _context.next = 3;\n return unmountComponents();\n case 3:\n _context.next = 5;\n return createSession();\n case 5:\n session = _context.sent;\n store.checkoutConfiguration.session = {\n id: session.id,\n sessionData: session.sessionData,\n imagePath: session.imagePath,\n adyenDescriptions: session.adyenDescriptions\n };\n _context.next = 9;\n return AdyenCheckout(store.checkoutConfiguration);\n case 9:\n store.checkout = _context.sent;\n store.partialPaymentsOrderObj = JSON.parse(window.sessionStorage.getItem(constants.GIFTCARD_DATA_ADDED));\n setCheckoutConfiguration(store.checkout.options);\n setInstallments(store.checkout.options.amount);\n setAmazonPayConfig(store.checkout.paymentMethodsResponse);\n document.querySelector('#paymentMethodsList').innerHTML = '';\n renderStoredPaymentMethods(store.checkout.paymentMethodsResponse, session.imagePath);\n renderPaymentMethods(store.checkout.paymentMethodsResponse, session.imagePath, session.adyenDescriptions);\n renderPosTerminals(session.adyenConnectedTerminals);\n renderGiftCardLogo(session.imagePath);\n if (store.partialPaymentsOrderObj) {\n applyGiftCard();\n } else {\n renderGiftCardSelectForm();\n }\n firstPaymentMethod = document.querySelector('input[type=radio][name=brandCode]');\n firstPaymentMethod.checked = true;\n helpers.displaySelectedMethod(firstPaymentMethod.value);\n helpers.createShowConfirmationForm(window.ShowConfirmationPaymentFromComponent);\n case 24:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n function renderGenericComponent() {\n return _renderGenericComponent.apply(this, arguments);\n }\n return renderGenericComponent;\n}();\n\n//# sourceURL=webpack:///./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGenericComponent.js?");
-
-/***/ }),
-
-/***/ "./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js":
-/*!*********************************************************************************************************!*\
- !*** ./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js ***!
- \*********************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar store = __webpack_require__(/*! ../../../../store */ \"./cartridges/int_adyen_SFRA/cartridge/store/index.js\");\nvar constants = __webpack_require__(/*! ../constants */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/constants.js\");\nfunction showGiftCardWarningMessage() {\n var alertContainer = document.createElement('div');\n alertContainer.setAttribute('id', 'giftCardWarningMessage');\n alertContainer.classList.add('alert', 'alert-warning', 'error-message', 'gift-card-warning-msg');\n alertContainer.setAttribute('role', 'alert');\n var alertContainerP = document.createElement('p');\n alertContainerP.classList.add('error-message-text');\n alertContainerP.textContent = window.giftCardWarningMessage;\n alertContainer.appendChild(alertContainerP);\n var orderTotalSummaryEl = document.querySelector('.card-body.order-total-summary');\n orderTotalSummaryEl.appendChild(alertContainer);\n}\nfunction getGiftCardElements() {\n var giftCardSelect = document.querySelector('#giftCardSelect');\n var giftCardUl = document.querySelector('#giftCardUl');\n var giftCardContainer = document.querySelector('#giftCardContainer');\n var giftCardAddButton = document.querySelector('#giftCardAddButton');\n var giftCardSelectContainer = document.querySelector('#giftCardSelectContainer');\n var giftCardsList = document.querySelector('#giftCardsList');\n return {\n giftCardSelect: giftCardSelect,\n giftCardUl: giftCardUl,\n giftCardContainer: giftCardContainer,\n giftCardAddButton: giftCardAddButton,\n giftCardSelectContainer: giftCardSelectContainer,\n giftCardsList: giftCardsList\n };\n}\nfunction attachGiftCardFormListeners() {\n if (store.giftCardComponentListenersAdded) {\n return;\n }\n store.giftCardComponentListenersAdded = true;\n var _getGiftCardElements = getGiftCardElements(),\n giftCardUl = _getGiftCardElements.giftCardUl,\n giftCardSelect = _getGiftCardElements.giftCardSelect,\n giftCardContainer = _getGiftCardElements.giftCardContainer,\n giftCardAddButton = _getGiftCardElements.giftCardAddButton,\n giftCardSelectContainer = _getGiftCardElements.giftCardSelectContainer;\n if (giftCardUl) {\n giftCardUl.addEventListener('click', function (event) {\n var _store$partialPayment;\n giftCardUl.classList.toggle('invisible');\n var selectedGiftCard = {\n name: event.target.dataset.name,\n brand: event.target.dataset.brand,\n type: event.target.dataset.type\n };\n if (selectedGiftCard.brand !== ((_store$partialPayment = store.partialPaymentsOrderObj) === null || _store$partialPayment === void 0 ? void 0 : _store$partialPayment.giftcard.brand)) {\n var _store$componentsObj;\n if ((_store$componentsObj = store.componentsObj) !== null && _store$componentsObj !== void 0 && _store$componentsObj.giftcard) {\n store.componentsObj.giftcard.node.unmount('component_giftcard');\n }\n if (!store.partialPaymentsOrderObj) {\n store.partialPaymentsOrderObj = {};\n }\n store.partialPaymentsOrderObj.giftcard = selectedGiftCard;\n giftCardSelect.value = selectedGiftCard.brand;\n giftCardContainer.innerHTML = '';\n var giftCardNode = store.checkout.create(constants.GIFTCARD, _objectSpread(_objectSpread({}, store.checkoutConfiguration.giftcard), {}, {\n brand: selectedGiftCard.brand,\n name: selectedGiftCard.name\n })).mount(giftCardContainer);\n store.componentsObj.giftcard = {\n node: giftCardNode\n };\n }\n });\n }\n if (giftCardAddButton) {\n giftCardAddButton.addEventListener('click', function () {\n giftCardAddButton.setAttribute('click-listener', 'true');\n if (store.partialPaymentsOrderObj) {\n return;\n }\n var giftCardWarningMessageEl = document.querySelector('#giftCardWarningMessage');\n if (giftCardWarningMessageEl) {\n giftCardWarningMessageEl.style.display = 'none';\n }\n giftCardAddButton.style.display = 'none';\n giftCardSelectContainer.classList.remove('invisible');\n });\n }\n if (giftCardSelect) {\n giftCardSelect.addEventListener('click', function () {\n giftCardUl.classList.toggle('invisible');\n });\n }\n}\nfunction removeGiftCardFormListeners() {\n var _getGiftCardElements2 = getGiftCardElements(),\n giftCardUl = _getGiftCardElements2.giftCardUl,\n giftCardSelect = _getGiftCardElements2.giftCardSelect,\n giftCardAddButton = _getGiftCardElements2.giftCardAddButton;\n giftCardUl.replaceWith(giftCardUl.cloneNode(true));\n giftCardSelect.replaceWith(giftCardSelect.cloneNode(true));\n giftCardAddButton.replaceWith(giftCardAddButton.cloneNode(true));\n store.giftCardComponentListenersAdded = false;\n}\nfunction renderGiftCardSelectForm() {\n var _getGiftCardElements3 = getGiftCardElements(),\n giftCardSelect = _getGiftCardElements3.giftCardSelect,\n giftCardUl = _getGiftCardElements3.giftCardUl;\n if (giftCardUl !== null && giftCardUl !== void 0 && giftCardUl.innerHTML) {\n return;\n }\n var paymentMethodsResponse = store.checkout.paymentMethodsResponse;\n var imagePath = store.checkoutConfiguration.session.imagePath;\n var giftCardBrands = paymentMethodsResponse.paymentMethods.filter(function (pm) {\n return pm.type === constants.GIFTCARD;\n });\n giftCardBrands.forEach(function (giftCard) {\n var newListItem = document.createElement('li');\n newListItem.setAttribute('data-brand', giftCard.brand);\n newListItem.setAttribute('data-name', giftCard.name);\n newListItem.setAttribute('data-type', giftCard.type);\n var span = document.createElement('span');\n span.textContent = giftCard.name;\n var img = document.createElement('img');\n img.src = \"\".concat(imagePath).concat(giftCard.brand, \".png\");\n img.width = 40;\n img.height = 26;\n newListItem.appendChild(span);\n newListItem.appendChild(img);\n giftCardUl.appendChild(newListItem);\n var newOption = document.createElement('option');\n newOption.textContent = giftCard.name;\n newOption.value = giftCard.brand;\n newOption.style.visibility = 'hidden';\n giftCardSelect.appendChild(newOption);\n });\n attachGiftCardFormListeners();\n}\nfunction removeGiftCard() {\n $.ajax({\n type: 'POST',\n url: 'Adyen-CancelPartialPaymentOrder',\n data: JSON.stringify(store.partialPaymentsOrderObj),\n contentType: 'application/json; charset=utf-8',\n async: false,\n success: function success(res) {\n var adyenPartialPaymentsOrder = document.querySelector('#adyenPartialPaymentsOrder');\n var _getGiftCardElements4 = getGiftCardElements(),\n giftCardsList = _getGiftCardElements4.giftCardsList,\n giftCardAddButton = _getGiftCardElements4.giftCardAddButton,\n giftCardSelect = _getGiftCardElements4.giftCardSelect,\n giftCardUl = _getGiftCardElements4.giftCardUl;\n adyenPartialPaymentsOrder.value = null;\n giftCardsList.innerHTML = '';\n giftCardAddButton.style.display = 'block';\n giftCardSelect.value = null;\n giftCardUl.innerHTML = '';\n store.partialPaymentsOrderObj = null;\n window.sessionStorage.removeItem(constants.GIFTCARD_DATA_ADDED);\n if (res.resultCode === constants.RECEIVED) {\n var _document$querySelect, _store$componentsObj2, _store$componentsObj3;\n (_document$querySelect = document.querySelector('#cancelGiftCardContainer')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.parentNode.remove();\n (_store$componentsObj2 = store.componentsObj) === null || _store$componentsObj2 === void 0 ? void 0 : (_store$componentsObj3 = _store$componentsObj2.giftcard) === null || _store$componentsObj3 === void 0 ? void 0 : _store$componentsObj3.node.unmount('component_giftcard');\n }\n }\n });\n}\nfunction renderAddedGiftCard() {\n var giftCardData = store.partialPaymentsOrderObj.giftcard;\n var imagePath = store.checkoutConfiguration.session.imagePath;\n var _getGiftCardElements5 = getGiftCardElements(),\n giftCardsList = _getGiftCardElements5.giftCardsList,\n giftCardAddButton = _getGiftCardElements5.giftCardAddButton;\n var giftCardDiv = document.createElement('div');\n giftCardDiv.classList.add('gift-card');\n var brandContainer = document.createElement('div');\n brandContainer.classList.add('brand-container');\n var giftCardImg = document.createElement('img');\n var giftCardImgSrc = \"\".concat(imagePath).concat(giftCardData.brand, \".png\");\n giftCardImg.setAttribute('src', giftCardImgSrc);\n giftCardImg.classList.add('gift-card-logo');\n var giftCardNameP = document.createElement('p');\n giftCardNameP.textContent = giftCardData.name;\n brandContainer.appendChild(giftCardImg);\n brandContainer.appendChild(giftCardNameP);\n var giftCardAction = document.createElement('div');\n giftCardAction.classList.add('gift-card-action');\n var removeAnchor = document.createElement('a');\n removeAnchor.textContent = window.removeGiftCardButtonText;\n removeAnchor.addEventListener('click', function () {\n removeGiftCard();\n renderGiftCardSelectForm();\n });\n giftCardAction.appendChild(removeAnchor);\n var brandAndRemoveActionWrapper = document.createElement('div');\n brandAndRemoveActionWrapper.classList.add('wrapper');\n brandAndRemoveActionWrapper.appendChild(brandContainer);\n brandAndRemoveActionWrapper.appendChild(giftCardAction);\n var giftCardAmountDiv = document.createElement('div');\n giftCardAmountDiv.classList.add('wrapper');\n var amountLabel = document.createElement('p');\n amountLabel.textContent = window.discountedAmountGiftCardResource;\n var amountValue = document.createElement('strong');\n amountValue.textContent = store.partialPaymentsOrderObj.discountedAmount;\n giftCardAmountDiv.appendChild(amountLabel);\n giftCardAmountDiv.appendChild(amountValue);\n giftCardDiv.appendChild(brandAndRemoveActionWrapper);\n giftCardDiv.appendChild(giftCardAmountDiv);\n giftCardsList.appendChild(giftCardDiv);\n giftCardAddButton.style.display = 'none';\n removeGiftCardFormListeners();\n}\nfunction createElementsToShowRemainingGiftCardAmount() {\n var mainContainer = document.createElement('div');\n var remainingAmountContainer = document.createElement('div');\n var remainingAmountStart = document.createElement('div');\n var remainingAmountEnd = document.createElement('div');\n var discountedAmountContainer = document.createElement('div');\n var discountedAmountStart = document.createElement('div');\n var discountedAmountEnd = document.createElement('div');\n var cancelGiftCard = document.createElement('a');\n var remainingAmountStartP = document.createElement('p');\n var remainingAmountEndP = document.createElement('p');\n var discountedAmountStartP = document.createElement('p');\n var discountedAmountEndP = document.createElement('p');\n var cancelGiftCardP = document.createElement('p');\n var remainingAmountStartSpan = document.createElement('span');\n var discountedAmountStartSpan = document.createElement('span');\n var cancelGiftCardSpan = document.createElement('span');\n var remainingAmountEndSpan = document.createElement('span');\n var discountedAmountEndSpan = document.createElement('span');\n remainingAmountContainer.classList.add('row', 'grand-total', 'leading-lines');\n remainingAmountStart.classList.add('col-6', 'start-lines');\n remainingAmountEnd.classList.add('col-6', 'end-lines');\n remainingAmountStartP.classList.add('order-receipt-label');\n discountedAmountContainer.classList.add('row', 'grand-total', 'leading-lines');\n discountedAmountStart.classList.add('col-6', 'start-lines');\n discountedAmountEnd.classList.add('col-6', 'end-lines');\n discountedAmountStartP.classList.add('order-receipt-label');\n cancelGiftCardP.classList.add('order-receipt-label');\n remainingAmountEndP.classList.add('text-right');\n discountedAmountEndP.classList.add('text-right');\n cancelGiftCard.id = 'cancelGiftCardContainer';\n cancelGiftCard.role = 'button';\n discountedAmountContainer.id = 'discountedAmountContainer';\n remainingAmountContainer.id = 'remainingAmountContainer';\n remainingAmountStartSpan.innerText = window.remainingAmountGiftCardResource;\n discountedAmountStartSpan.innerText = window.discountedAmountGiftCardResource;\n cancelGiftCardSpan.innerText = window.cancelGiftCardResource;\n remainingAmountEndSpan.innerText = store.partialPaymentsOrderObj.remainingAmount;\n discountedAmountEndSpan.innerText = store.partialPaymentsOrderObj.discountedAmount;\n cancelGiftCard.addEventListener('click', function () {\n removeGiftCard();\n renderGiftCardSelectForm();\n });\n remainingAmountContainer.appendChild(remainingAmountStart);\n remainingAmountContainer.appendChild(remainingAmountEnd);\n remainingAmountContainer.appendChild(cancelGiftCard);\n remainingAmountStart.appendChild(remainingAmountStartP);\n discountedAmountContainer.appendChild(discountedAmountStart);\n discountedAmountContainer.appendChild(discountedAmountEnd);\n discountedAmountStart.appendChild(discountedAmountStartP);\n cancelGiftCard.appendChild(cancelGiftCardP);\n remainingAmountEnd.appendChild(remainingAmountEndP);\n remainingAmountStartP.appendChild(remainingAmountStartSpan);\n discountedAmountEnd.appendChild(discountedAmountEndP);\n discountedAmountStartP.appendChild(discountedAmountStartSpan);\n cancelGiftCardP.appendChild(cancelGiftCardSpan);\n remainingAmountEndP.appendChild(remainingAmountEndSpan);\n discountedAmountEndP.appendChild(discountedAmountEndSpan);\n var pricingContainer = document.querySelector('.card-body.order-total-summary');\n mainContainer.appendChild(discountedAmountContainer);\n mainContainer.appendChild(remainingAmountContainer);\n mainContainer.appendChild(cancelGiftCard);\n pricingContainer.appendChild(mainContainer);\n}\nmodule.exports = {\n removeGiftCard: removeGiftCard,\n renderAddedGiftCard: renderAddedGiftCard,\n renderGiftCardSelectForm: renderGiftCardSelectForm,\n getGiftCardElements: getGiftCardElements,\n showGiftCardWarningMessage: showGiftCardWarningMessage,\n createElementsToShowRemainingGiftCardAmount: createElementsToShowRemainingGiftCardAmount\n};\n\n//# sourceURL=webpack:///./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderGiftcardComponent.js?");
-
-/***/ }),
-
-/***/ "./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderPaymentMethod.js":
-/*!*****************************************************************************************************!*\
- !*** ./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderPaymentMethod.js ***!
- \*****************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nvar store = __webpack_require__(/*! ../../../../store */ \"./cartridges/int_adyen_SFRA/cartridge/store/index.js\");\nvar helpers = __webpack_require__(/*! ./helpers */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js\");\nvar constants = __webpack_require__(/*! ../constants */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/constants.js\");\nfunction getFallback(paymentMethod) {\n var fallback = {};\n if (fallback[paymentMethod.type]) {\n store.componentsObj[paymentMethod.type] = {};\n }\n return fallback[paymentMethod.type];\n}\nfunction getPersonalDetails() {\n var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;\n return {\n firstName: (_document$querySelect = document.querySelector('#shippingFirstNamedefault')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.value,\n lastName: (_document$querySelect2 = document.querySelector('#shippingLastNamedefault')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.value,\n telephoneNumber: (_document$querySelect3 = document.querySelector('#shippingPhoneNumberdefault')) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.value,\n shopperEmail: (_document$querySelect4 = document.querySelector('.customer-summary-email')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.textContent\n };\n}\nfunction setNode(paymentMethodID) {\n var createNode = function createNode() {\n if (!store.componentsObj[paymentMethodID]) {\n store.componentsObj[paymentMethodID] = {};\n }\n try {\n var _store$checkout;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n // ALl nodes created for the checkout component are enriched with shopper personal details\n var node = (_store$checkout = store.checkout).create.apply(_store$checkout, args.concat([{\n data: _objectSpread(_objectSpread({}, getPersonalDetails()), {}, {\n personalDetails: getPersonalDetails()\n }),\n visibility: {\n personalDetails: 'editable',\n billingAddress: 'hidden',\n deliveryAddress: 'hidden'\n }\n }]));\n store.componentsObj[paymentMethodID].node = node;\n store.componentsObj[paymentMethodID].isValid = node.isValid;\n } catch (e) {\n /* No component for payment method */\n }\n };\n return createNode;\n}\nfunction getPaymentMethodID(isStored, paymentMethod) {\n if (isStored) {\n return \"storedCard\".concat(paymentMethod.id);\n }\n if (paymentMethod.type === constants.GIFTCARD) {\n return constants.GIFTCARD;\n }\n if (paymentMethod.brand) {\n return \"\".concat(paymentMethod.type, \"_\").concat(paymentMethod.brand);\n }\n return paymentMethod.type;\n}\nfunction getImage(isStored, paymentMethod) {\n return isStored ? paymentMethod.brand : paymentMethod.type;\n}\nfunction getLabel(isStored, paymentMethod) {\n var label = isStored ? \" \".concat(store.MASKED_CC_PREFIX).concat(paymentMethod.lastFour) : '';\n return \"\".concat(paymentMethod.name).concat(label);\n}\nfunction handleFallbackPayment(_ref) {\n var paymentMethod = _ref.paymentMethod,\n container = _ref.container,\n paymentMethodID = _ref.paymentMethodID;\n var fallback = getFallback(paymentMethod);\n var createTemplate = function createTemplate() {\n var template = document.createElement('template');\n template.innerHTML = fallback;\n container.append(template.content);\n };\n return fallback ? createTemplate() : setNode(paymentMethod.type)(paymentMethodID);\n}\nfunction handlePayment(options) {\n return options.isStored ? setNode(options.paymentMethodID)('card', options.paymentMethod) : handleFallbackPayment(options);\n}\nfunction getListContents(_ref2) {\n var imagePath = _ref2.imagePath,\n isStored = _ref2.isStored,\n paymentMethod = _ref2.paymentMethod,\n description = _ref2.description;\n var paymentMethodID = getPaymentMethodID(isStored, paymentMethod);\n var label = getLabel(isStored, paymentMethod);\n var liContents = \"\\n
\\n
\\n
\").concat(label, \" \\n \");\n return description ? \"\".concat(liContents, \"
\").concat(description, \"
\") : liContents;\n}\nfunction getImagePath(_ref3) {\n var isStored = _ref3.isStored,\n paymentMethod = _ref3.paymentMethod,\n path = _ref3.path,\n isSchemeNotStored = _ref3.isSchemeNotStored;\n var paymentMethodImage = \"\".concat(path).concat(getImage(isStored, paymentMethod), \".png\");\n var cardImage = \"\".concat(path, \"card.png\");\n return isSchemeNotStored ? cardImage : paymentMethodImage;\n}\nfunction setValid(_ref4) {\n var isStored = _ref4.isStored,\n paymentMethodID = _ref4.paymentMethodID;\n if (isStored && ['bcmc', 'scheme'].indexOf(paymentMethodID) > -1) {\n store.componentsObj[paymentMethodID].isValid = true;\n }\n}\nfunction configureContainer(_ref5) {\n var paymentMethodID = _ref5.paymentMethodID,\n container = _ref5.container;\n container.classList.add('additionalFields');\n container.setAttribute('id', \"component_\".concat(paymentMethodID));\n container.setAttribute('style', 'display:none');\n}\nfunction handleInput(_ref6) {\n var paymentMethodID = _ref6.paymentMethodID;\n var input = document.querySelector(\"#rb_\".concat(paymentMethodID));\n input.onchange = /*#__PURE__*/function () {\n var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n helpers.displaySelectedMethod(event.target.value);\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return function (_x) {\n return _ref7.apply(this, arguments);\n };\n }();\n}\n// eslint-disable-next-line complexity\nmodule.exports.renderPaymentMethod = function renderPaymentMethod(paymentMethod, isStored, path) {\n var _store$componentsObj$;\n var description = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n var rerender = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n var paymentMethodsUI = document.querySelector('#paymentMethodsList');\n var paymentMethodID = getPaymentMethodID(isStored, paymentMethod);\n if (paymentMethodID === constants.GIFTCARD) {\n return;\n }\n var isSchemeNotStored = paymentMethod.type === 'scheme' && !isStored;\n var container = document.createElement('div');\n var options = {\n container: container,\n paymentMethod: paymentMethod,\n isStored: isStored,\n path: path,\n description: description,\n paymentMethodID: paymentMethodID,\n isSchemeNotStored: isSchemeNotStored\n };\n var imagePath = getImagePath(options);\n var liContents = getListContents(_objectSpread(_objectSpread({}, options), {}, {\n imagePath: imagePath,\n description: description\n }));\n var li;\n if (rerender) {\n li = document.querySelector(\"#rb_\".concat(paymentMethodID)).closest('li');\n } else {\n li = document.createElement('li');\n li.innerHTML = liContents;\n li.classList.add('paymentMethod');\n paymentMethodsUI.append(li);\n }\n handlePayment(options);\n configureContainer(options);\n li.append(container);\n var node = (_store$componentsObj$ = store.componentsObj[paymentMethodID]) === null || _store$componentsObj$ === void 0 ? void 0 : _store$componentsObj$.node;\n if (node) {\n node.mount(container);\n }\n if (paymentMethodID === 'giropay') {\n container.innerHTML = '';\n }\n handleInput(options);\n setValid(options);\n};\n\n//# sourceURL=webpack:///./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/renderPaymentMethod.js?");
-
-/***/ }),
-
-/***/ "./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/validateComponents.js":
-/*!****************************************************************************************************!*\
- !*** ./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/validateComponents.js ***!
- \****************************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nvar store = __webpack_require__(/*! ../../../../store */ \"./cartridges/int_adyen_SFRA/cartridge/store/index.js\");\nmodule.exports.validateComponents = function validateComponents() {\n var customMethods = {};\n if (store.selectedMethod in customMethods) {\n customMethods[store.selectedMethod]();\n }\n document.querySelector('#adyenStateData').value = JSON.stringify(store.stateData);\n if (store.partialPaymentsOrderObj) {\n document.querySelector('#adyenPartialPaymentsOrder').value = JSON.stringify(store.partialPaymentsOrderObj);\n }\n};\n\n//# sourceURL=webpack:///./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyen_checkout/validateComponents.js?");
-
-/***/ }),
-
-/***/ "./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout.js":
-/*!***************************************************************************!*\
- !*** ./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout.js ***!
- \***************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nvar processInclude = __webpack_require__(/*! base/util */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.js\");\nvar baseCheckout = __webpack_require__(/*! base/checkout/checkout */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/checkout.js\");\nvar adyenCheckout = __webpack_require__(/*! ./adyenCheckout */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js\");\nvar billing = __webpack_require__(/*! ./checkout/billing */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/billing.js\");\n\n// Compatibility Adyen SFRA 5.x.x & 6.x.x\nvar checkout = window.AdyenSFRA6Enabled !== 'null' ? __webpack_require__(/*! ./checkout/checkoutSFRA6 */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/checkoutSFRA6.js\") : __webpack_require__(/*! ./checkout/checkoutSFRA5 */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/checkoutSFRA5.js\");\n$(document).ready(function () {\n // eslint-disable-line\n var name = 'paymentError';\n var error = new RegExp(\"[?&]\".concat(encodeURIComponent(name), \"=([^&]*)\")).exec(window.location.search);\n var paymentStage = new RegExp('[?&]stage=payment([^&]*)').exec(window.location.search);\n if (error || paymentStage) {\n if (error) {\n $('.error-message').show();\n $('.error-message-text').text(decodeURIComponent(error[1]));\n }\n adyenCheckout.renderGenericComponent();\n }\n processInclude(baseCheckout);\n processInclude(billing);\n processInclude(checkout);\n $('#selectedPaymentOption').val($('.payment-options .nav-item .active').parent().attr('data-method-id'));\n});\n$('.payment-options .nav-link').click(function setAttr() {\n $('#selectedPaymentOption').val($(this).parent().attr('data-method-id'));\n});\n\n//# sourceURL=webpack:///./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout.js?");
-
-/***/ }),
-
-/***/ "./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/billing.js":
-/*!***********************************************************************************!*\
- !*** ./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/billing.js ***!
- \***********************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nfunction hasData() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return args.every(function (arg) {\n return !!arg;\n });\n}\nfunction appendToPaymentSummary(html) {\n // update payment details\n var paymentSummary = document.querySelector('.payment-details');\n paymentSummary.innerHTML += html;\n}\nfunction appendMaskedCC(_ref) {\n var maskedCreditCardNumber = _ref.maskedCreditCardNumber;\n var innerHTML = \"
\".concat(maskedCreditCardNumber, \"
\");\n return maskedCreditCardNumber && appendToPaymentSummary(innerHTML);\n}\nfunction appendIssuerName(_ref2) {\n var selectedIssuerName = _ref2.selectedIssuerName;\n var innerHTML = \"
\".concat(selectedIssuerName, \"
\");\n return selectedIssuerName && appendToPaymentSummary(innerHTML);\n}\nfunction appendExpiration(_ref3, order) {\n var expirationMonth = _ref3.expirationMonth,\n expirationYear = _ref3.expirationYear;\n var innerHTML = \"
\".concat(order.resources.cardEnding, \" \").concat(expirationMonth, \"/\").concat(expirationYear, \"
\");\n return hasData(expirationMonth, expirationYear) && appendToPaymentSummary(innerHTML);\n}\nfunction appendPaymentMethod(_ref4) {\n var selectedAdyenPM = _ref4.selectedAdyenPM;\n var innerHTML = \"
\".concat(selectedAdyenPM, \"
\");\n return selectedAdyenPM && appendToPaymentSummary(innerHTML);\n}\n\n/**\n * Updates the payment information in checkout, based on the supplied order model\n * @param {Object} order - checkout model to use as basis of new truth\n */\nfunction updatePaymentInformation(order) {\n var _order$billing$paymen;\n if ((_order$billing$paymen = order.billing.payment.selectedPaymentInstruments) !== null && _order$billing$paymen !== void 0 && _order$billing$paymen.length) {\n var selectedPaymentInstrument = order.billing.payment.selectedPaymentInstruments[0];\n document.querySelector('.payment-details').innerHTML = '';\n appendPaymentMethod(selectedPaymentInstrument);\n appendIssuerName(selectedPaymentInstrument);\n appendMaskedCC(selectedPaymentInstrument);\n appendExpiration(selectedPaymentInstrument, order);\n }\n}\nmodule.exports.methods = {\n updatePaymentInformation: updatePaymentInformation\n};\n\n//# sourceURL=webpack:///./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/billing.js?");
-
-/***/ }),
-
-/***/ "./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/checkoutSFRA5.js":
-/*!*****************************************************************************************!*\
- !*** ./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/checkoutSFRA5.js ***!
- \*****************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nvar shippingHelpers = __webpack_require__(/*! base/checkout/shipping */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/shipping.js\");\nvar billingHelpers = __webpack_require__(/*! base/checkout/billing */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/billing.js\");\nvar summaryHelpers = __webpack_require__(/*! base/checkout/summary */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/summary.js\");\nvar formHelpers = __webpack_require__(/*! base/checkout/formErrors */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/formErrors.js\");\nvar scrollAnimate = __webpack_require__(/*! base/components/scrollAnimate */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/scrollAnimate.js\");\nvar billing = __webpack_require__(/*! ./billing */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/billing.js\");\n// ### Custom Adyen cartridge start ###\nvar adyenCheckout = __webpack_require__(/*! ../adyenCheckout */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js\");\n// ### Custom Adyen cartridge end ###\n\n/**\n * Create the jQuery Checkout Plugin.\n *\n * This jQuery plugin will be registered on the dom element in checkout.isml with the\n * id of \"checkout-main\".\n *\n * The checkout plugin will handle the different state the user interface is in as the user\n * progresses through the varying forms such as shipping and payment.\n *\n * Billing info and payment info are used a bit synonymously in this code.\n *\n */\n(function ($) {\n $.fn.checkout = function () {\n // eslint-disable-line\n var plugin = this;\n\n //\n // Collect form data from user input\n //\n var formData = {\n // Shipping Address\n shipping: {},\n // Billing Address\n billing: {},\n // Payment\n payment: {},\n // Gift Codes\n giftCode: {}\n };\n\n //\n // The different states/stages of checkout\n //\n var checkoutStages = ['shipping', 'payment', 'placeOrder', 'submitted'];\n\n /**\n * Updates the URL to determine stage\n * @param {number} currentStage - The current stage the user is currently on in the checkout\n */\n function updateUrl(currentStage) {\n history.pushState(checkoutStages[currentStage], document.title, location.pathname + '?stage=' + checkoutStages[currentStage] + '#' + checkoutStages[currentStage]);\n }\n\n //\n // Local member methods of the Checkout plugin\n //\n var members = {\n // initialize the currentStage variable for the first time\n currentStage: 0,\n /**\n * Set or update the checkout stage (AKA the shipping, billing, payment, etc... steps)\n * @returns {Object} a promise\n */\n updateStage: function updateStage() {\n var stage = checkoutStages[members.currentStage];\n var defer = $.Deferred(); // eslint-disable-line\n\n if (stage === 'shipping') {\n //\n // Clear Previous Errors\n //\n formHelpers.clearPreviousErrors('.shipping-form');\n\n //\n // Submit the Shipping Address Form\n //\n var isMultiShip = $('#checkout-main').hasClass('multi-ship');\n var formSelector = isMultiShip ? '.multi-shipping .active form' : '.single-shipping .shipping-form';\n var form = $(formSelector);\n if (isMultiShip && form.length === 0) {\n // disable the next:Payment button here\n $('body').trigger('checkout:disableButton', '.next-step-button button');\n // in case the multi ship form is already submitted\n var url = $('#checkout-main').attr('data-checkout-get-url');\n $.ajax({\n url: url,\n method: 'GET',\n success: function success(data) {\n // enable the next:Payment button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n if (!data.error) {\n $('body').trigger('checkout:updateCheckoutView', {\n order: data.order,\n customer: data.customer\n });\n defer.resolve();\n } else if (data.message && $('.shipping-error .alert-danger').length < 1) {\n var errorMsg = data.message;\n var errorHtml = '
' + '' + '× ' + ' ' + errorMsg + '
';\n $('.shipping-error').append(errorHtml);\n scrollAnimate($('.shipping-error'));\n defer.reject();\n } else if (data.redirectUrl) {\n window.location.href = data.redirectUrl;\n }\n },\n error: function error() {\n // enable the next:Payment button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n // Server error submitting form\n defer.reject();\n }\n });\n } else {\n var shippingFormData = form.serialize();\n $('body').trigger('checkout:serializeShipping', {\n form: form,\n data: shippingFormData,\n callback: function callback(data) {\n shippingFormData = data;\n }\n });\n // disable the next:Payment button here\n $('body').trigger('checkout:disableButton', '.next-step-button button');\n $.ajax({\n url: form.attr('action'),\n type: 'post',\n data: shippingFormData,\n success: function success(data) {\n // enable the next:Payment button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n shippingHelpers.methods.shippingFormResponse(defer, data);\n },\n error: function error(err) {\n // enable the next:Payment button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n if (err.responseJSON && err.responseJSON.redirectUrl) {\n window.location.href = err.responseJSON.redirectUrl;\n }\n // Server error submitting form\n defer.reject(err.responseJSON);\n }\n });\n }\n return defer;\n } else if (stage === 'payment') {\n //\n // Submit the Billing Address Form\n //\n\n formHelpers.clearPreviousErrors('.payment-form');\n var billingAddressForm = $('#dwfrm_billing .billing-address-block :input').serialize();\n $('body').trigger('checkout:serializeBilling', {\n form: $('#dwfrm_billing .billing-address-block'),\n data: billingAddressForm,\n callback: function callback(data) {\n if (data) {\n billingAddressForm = data;\n }\n }\n });\n var contactInfoForm = $('#dwfrm_billing .contact-info-block :input').serialize();\n $('body').trigger('checkout:serializeBilling', {\n form: $('#dwfrm_billing .contact-info-block'),\n data: contactInfoForm,\n callback: function callback(data) {\n if (data) {\n contactInfoForm = data;\n }\n }\n });\n var activeTabId = $('.tab-pane.active').attr('id');\n var paymentInfoSelector = '#dwfrm_billing .' + activeTabId + ' .payment-form-fields :input';\n var paymentInfoForm = $(paymentInfoSelector).serialize();\n $('body').trigger('checkout:serializeBilling', {\n form: $(paymentInfoSelector),\n data: paymentInfoForm,\n callback: function callback(data) {\n if (data) {\n paymentInfoForm = data;\n }\n }\n });\n var paymentForm = billingAddressForm + '&' + contactInfoForm + '&' + paymentInfoForm;\n if ($('.data-checkout-stage').data('customer-type') === 'registered') {\n // if payment method is credit card\n if ($('.payment-information').data('payment-method-id') === 'CREDIT_CARD') {\n if (!$('.payment-information').data('is-new-payment')) {\n var cvvCode = $('.saved-payment-instrument.' + 'selected-payment .saved-payment-security-code').val();\n if (cvvCode === '') {\n var cvvElement = $('.saved-payment-instrument.' + 'selected-payment ' + '.form-control');\n cvvElement.addClass('is-invalid');\n scrollAnimate(cvvElement);\n defer.reject();\n return defer;\n }\n var $savedPaymentInstrument = $('.saved-payment-instrument' + '.selected-payment');\n paymentForm += '&storedPaymentUUID=' + $savedPaymentInstrument.data('uuid');\n paymentForm += '&securityCode=' + cvvCode;\n }\n }\n }\n // disable the next:Place Order button here\n $('body').trigger('checkout:disableButton', '.next-step-button button');\n $.ajax({\n url: $('#dwfrm_billing').attr('action'),\n method: 'POST',\n data: paymentForm,\n success: function success(data) {\n // enable the next:Place Order button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n // look for field validation errors\n if (data.error) {\n if (data.fieldErrors.length) {\n data.fieldErrors.forEach(function (error) {\n if (Object.keys(error).length) {\n formHelpers.loadFormErrors('.payment-form', error);\n }\n });\n }\n if (data.serverErrors.length) {\n data.serverErrors.forEach(function (error) {\n $('.error-message').show();\n $('.error-message-text').text(error);\n scrollAnimate($('.error-message'));\n });\n }\n if (data.cartError) {\n window.location.href = data.redirectUrl;\n }\n defer.reject();\n } else {\n //\n // Populate the Address Summary\n //\n $('body').trigger('checkout:updateCheckoutView', {\n order: data.order,\n customer: data.customer\n });\n if (data.renderedPaymentInstruments) {\n $('.stored-payments').empty().html(data.renderedPaymentInstruments);\n }\n if (data.customer.registeredUser && data.customer.customerPaymentInstruments.length) {\n $('.cancel-new-payment').removeClass('checkout-hidden');\n }\n scrollAnimate();\n defer.resolve(data);\n }\n },\n error: function error(err) {\n // enable the next:Place Order button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n if (err.responseJSON && err.responseJSON.redirectUrl) {\n window.location.href = err.responseJSON.redirectUrl;\n }\n }\n });\n return defer;\n } else if (stage === 'placeOrder') {\n // disable the placeOrder button here\n $('body').trigger('checkout:disableButton', '.next-step-button button');\n $.ajax({\n url: $('.place-order').data('action'),\n method: 'POST',\n success: function success(data) {\n // enable the placeOrder button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n if (data.error) {\n if (data.cartError) {\n window.location.href = data.redirectUrl;\n defer.reject();\n } else {\n // go to appropriate stage and display error message\n defer.reject(data);\n }\n // ### Custom Adyen cartridge start ###\n } else if (data.adyenAction) {\n window.orderToken = data.orderToken;\n adyenCheckout.actionHandler(data.adyenAction);\n // ### Custom Adyen cartridge end ###\n } else {\n var continueUrl = data.continueUrl;\n var urlParams = {\n ID: data.orderID,\n token: data.orderToken\n };\n continueUrl += (continueUrl.indexOf('?') !== -1 ? '&' : '?') + Object.keys(urlParams).map(function (key) {\n return key + '=' + encodeURIComponent(urlParams[key]);\n }).join('&');\n window.location.href = continueUrl;\n defer.resolve(data);\n }\n },\n error: function error() {\n // enable the placeOrder button here\n $('body').trigger('checkout:enableButton', $('.next-step-button button'));\n }\n });\n return defer;\n }\n var p = $('
').promise(); // eslint-disable-line\n setTimeout(function () {\n p.done(); // eslint-disable-line\n }, 500);\n return p; // eslint-disable-line\n },\n\n /**\n * Initialize the checkout stage.\n *\n * TODO: update this to allow stage to be set from server?\n */\n initialize: function initialize() {\n // set the initial state of checkout\n members.currentStage = checkoutStages.indexOf($('.data-checkout-stage').data('checkout-stage'));\n $(plugin).attr('data-checkout-stage', checkoutStages[members.currentStage]);\n\n //\n // Handle Payment option selection\n //\n $('input[name$=\"paymentMethod\"]', plugin).on('change', function () {\n $('.credit-card-form').toggle($(this).val() === 'CREDIT_CARD');\n });\n\n //\n // Handle Next State button click\n //\n $(plugin).on('click', '.next-step-button button', function () {\n members.nextStage();\n });\n\n //\n // Handle Edit buttons on shipping and payment summary cards\n //\n $('.shipping-summary .edit-button', plugin).on('click', function () {\n if (!$('#checkout-main').hasClass('multi-ship')) {\n $('body').trigger('shipping:selectSingleShipping');\n }\n members.gotoStage('shipping');\n });\n $('.payment-summary .edit-button', plugin).on('click', function () {\n members.gotoStage('payment');\n });\n\n //\n // remember stage (e.g. shipping)\n //\n updateUrl(members.currentStage);\n\n //\n // Listen for foward/back button press and move to correct checkout-stage\n //\n $(window).on('popstate', function (e) {\n //\n // Back button when event state less than current state in ordered\n // checkoutStages array.\n //\n if (e.state === null || checkoutStages.indexOf(e.state) < members.currentStage) {\n members.handlePrevStage(false);\n } else if (checkoutStages.indexOf(e.state) > members.currentStage) {\n // Forward button pressed\n members.handleNextStage(false);\n }\n });\n\n //\n // Set the form data\n //\n plugin.data('formData', formData);\n },\n /**\n * The next checkout state step updates the css for showing correct buttons etc...\n */\n nextStage: function nextStage() {\n var promise = members.updateStage();\n promise.done(function () {\n // Update UI with new stage\n members.handleNextStage(true);\n });\n promise.fail(function (data) {\n // show errors\n if (data) {\n if (data.errorStage) {\n members.gotoStage(data.errorStage.stage);\n if (data.errorStage.step === 'billingAddress') {\n var $billingAddressSameAsShipping = $('input[name$=\"_shippingAddressUseAsBillingAddress\"]');\n if ($billingAddressSameAsShipping.is(':checked')) {\n $billingAddressSameAsShipping.prop('checked', false);\n }\n }\n }\n if (data.errorMessage) {\n $('.error-message').show();\n $('.error-message-text').text(data.errorMessage);\n }\n }\n });\n },\n /**\n * The next checkout state step updates the css for showing correct buttons etc...\n *\n * @param {boolean} bPushState - boolean when true pushes state using the history api.\n */\n handleNextStage: function handleNextStage(bPushState) {\n if (members.currentStage < checkoutStages.length - 1) {\n // move stage forward\n members.currentStage++;\n\n //\n // show new stage in url (e.g.payment)\n //\n if (bPushState) {\n updateUrl(members.currentStage);\n }\n }\n\n // Set the next stage on the DOM\n $(plugin).attr('data-checkout-stage', checkoutStages[members.currentStage]);\n },\n /**\n * Previous State\n */\n handlePrevStage: function handlePrevStage() {\n if (members.currentStage > 0) {\n // move state back\n members.currentStage--;\n updateUrl(members.currentStage);\n }\n $(plugin).attr('data-checkout-stage', checkoutStages[members.currentStage]);\n },\n /**\n * Use window history to go to a checkout stage\n * @param {string} stageName - the checkout state to goto\n */\n gotoStage: function gotoStage(stageName) {\n members.currentStage = checkoutStages.indexOf(stageName);\n updateUrl(members.currentStage);\n $(plugin).attr('data-checkout-stage', checkoutStages[members.currentStage]);\n }\n };\n\n //\n // Initialize the checkout\n //\n members.initialize();\n return this;\n };\n})(jQuery);\nmodule.exports = {\n updateCheckoutView: function updateCheckoutView() {\n $('body').on('checkout:updateCheckoutView', function (e, data) {\n shippingHelpers.methods.updateMultiShipInformation(data.order);\n summaryHelpers.updateTotals(data.order.totals);\n data.order.shipping.forEach(function (shipping) {\n shippingHelpers.methods.updateShippingInformation(shipping, data.order, data.customer, data.options);\n });\n var currentStage = window.location.search.substring(window.location.search.indexOf('=') + 1);\n if (currentStage === ('shipping' || false)) {\n adyenCheckout.renderGenericComponent();\n }\n billingHelpers.methods.updateBillingInformation(data.order, data.customer, data.options);\n billing.methods.updatePaymentInformation(data.order, data.options);\n summaryHelpers.updateOrderProductSummaryInformation(data.order, data.options);\n });\n }\n};\n\n//# sourceURL=webpack:///./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/checkoutSFRA5.js?");
-
-/***/ }),
-
-/***/ "./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/checkoutSFRA6.js":
-/*!*****************************************************************************************!*\
- !*** ./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/checkoutSFRA6.js ***!
- \*****************************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nvar customerHelpers = __webpack_require__(!(function webpackMissingModule() { var e = new Error(\"Cannot find module 'base/checkout/customer'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }()));\nvar shippingHelpers = __webpack_require__(/*! base/checkout/shipping */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/shipping.js\");\nvar billingHelpers = __webpack_require__(/*! base/checkout/billing */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/billing.js\");\nvar summaryHelpers = __webpack_require__(/*! base/checkout/summary */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/summary.js\");\nvar formHelpers = __webpack_require__(/*! base/checkout/formErrors */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/checkout/formErrors.js\");\nvar scrollAnimate = __webpack_require__(/*! base/components/scrollAnimate */ \"../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/scrollAnimate.js\");\nvar billing = __webpack_require__(/*! ./billing */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/checkout/billing.js\");\n// ### Custom Adyen cartridge start ###\nvar adyenCheckout = __webpack_require__(/*! ../adyenCheckout */ \"./cartridges/int_adyen_SFRA/cartridge/client/default/js/adyenCheckout.js\");\n// ### Custom Adyen cartridge end ###\n\n/**\n * Create the jQuery Checkout Plugin.\n *\n * This jQuery plugin will be registered on the dom element in checkout.isml with the\n * id of \"checkout-main\".\n *\n * The checkout plugin will handle the different state the user interface is in as the user\n * progresses through the varying forms such as shipping and payment.\n *\n * Billing info and payment info are used a bit synonymously in this code.\n *\n */\n(function ($) {\n $.fn.checkout = function () {\n var plugin = this;\n\n //\n // Collect form data from user input\n //\n var formData = {\n // Customer Data\n customer: {},\n // Shipping Address\n shipping: {},\n // Billing Address\n billing: {},\n // Payment\n payment: {},\n // Gift Codes\n giftCode: {}\n };\n\n //\n // The different states/stages of checkout\n //\n var checkoutStages = ['customer', 'shipping', 'payment', 'placeOrder', 'submitted'];\n\n /**\n * Updates the URL to determine stage\n * @param {number} currentStage - The current stage the user is currently on in the checkout\n */\n function updateUrl(currentStage) {\n history.pushState(checkoutStages[currentStage], document.title, location.pathname + '?stage=' + checkoutStages[currentStage] + '#' + checkoutStages[currentStage]);\n }\n\n //\n // Local member methods of the Checkout plugin\n //\n var members = {\n // initialize the currentStage variable for the first time\n currentStage: 0,\n /**\n * Set or update the checkout stage (AKA the shipping, billing, payment, etc... steps)\n * @returns {Object} a promise\n */\n updateStage: function updateStage() {\n var stage = checkoutStages[members.currentStage];\n var defer = $.Deferred(); // eslint-disable-line\n\n if (stage === 'customer') {\n //\n // Clear Previous Errors\n //\n customerHelpers.methods.clearErrors();\n //\n // Submit the Customer Form\n //\n var customerFormSelector = customerHelpers.methods.isGuestFormActive() ? customerHelpers.vars.GUEST_FORM : customerHelpers.vars.REGISTERED_FORM;\n var customerForm = $(customerFormSelector);\n $.ajax({\n url: customerForm.attr('action'),\n type: 'post',\n data: customerForm.serialize(),\n success: function success(data) {\n if (data.redirectUrl) {\n window.location.href = data.redirectUrl;\n } else {\n customerHelpers.methods.customerFormResponse(defer, data);\n }\n },\n error: function error(err) {\n if (err.responseJSON && err.responseJSON.redirectUrl) {\n window.location.href = err.responseJSON.redirectUrl;\n }\n // Server error submitting form\n defer.reject(err.responseJSON);\n }\n });\n return defer;\n } else if (stage === 'shipping') {\n //\n // Clear Previous Errors\n //\n formHelpers.clearPreviousErrors('.shipping-form');\n\n //\n // Submit the Shipping Address Form\n //\n var isMultiShip = $('#checkout-main').hasClass('multi-ship');\n var formSelector = isMultiShip ? '.multi-shipping .active form' : '.single-shipping .shipping-form';\n var form = $(formSelector);\n if (isMultiShip && form.length === 0) {\n // disable the next:Payment button here\n $('body').trigger('checkout:disableButton', '.next-step-button button');\n // in case the multi ship form is already submitted\n var url = $('#checkout-main').attr('data-checkout-get-url');\n $.ajax({\n url: url,\n method: 'GET',\n success: function success(data) {\n // enable the next:Payment button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n if (!data.error) {\n $('body').trigger('checkout:updateCheckoutView', {\n order: data.order,\n customer: data.customer\n });\n defer.resolve();\n } else if (data.message && $('.shipping-error .alert-danger').length < 1) {\n var errorMsg = data.message;\n var errorHtml = '
' + '' + '× ' + ' ' + errorMsg + '
';\n $('.shipping-error').append(errorHtml);\n scrollAnimate($('.shipping-error'));\n defer.reject();\n } else if (data.redirectUrl) {\n window.location.href = data.redirectUrl;\n }\n },\n error: function error() {\n // enable the next:Payment button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n // Server error submitting form\n defer.reject();\n }\n });\n } else {\n var shippingFormData = form.serialize();\n $('body').trigger('checkout:serializeShipping', {\n form: form,\n data: shippingFormData,\n callback: function callback(data) {\n shippingFormData = data;\n }\n });\n // disable the next:Payment button here\n $('body').trigger('checkout:disableButton', '.next-step-button button');\n $.ajax({\n url: form.attr('action'),\n type: 'post',\n data: shippingFormData,\n success: function success(data) {\n // enable the next:Payment button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n shippingHelpers.methods.shippingFormResponse(defer, data);\n },\n error: function error(err) {\n // enable the next:Payment button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n if (err.responseJSON && err.responseJSON.redirectUrl) {\n window.location.href = err.responseJSON.redirectUrl;\n }\n // Server error submitting form\n defer.reject(err.responseJSON);\n }\n });\n }\n return defer;\n } else if (stage === 'payment') {\n //\n // Submit the Billing Address Form\n //\n\n formHelpers.clearPreviousErrors('.payment-form');\n var billingAddressForm = $('#dwfrm_billing .billing-address-block :input').serialize();\n $('body').trigger('checkout:serializeBilling', {\n form: $('#dwfrm_billing .billing-address-block'),\n data: billingAddressForm,\n callback: function callback(data) {\n if (data) {\n billingAddressForm = data;\n }\n }\n });\n var contactInfoForm = $('#dwfrm_billing .contact-info-block :input').serialize();\n $('body').trigger('checkout:serializeBilling', {\n form: $('#dwfrm_billing .contact-info-block'),\n data: contactInfoForm,\n callback: function callback(data) {\n if (data) {\n contactInfoForm = data;\n }\n }\n });\n var activeTabId = $('.tab-pane.active').attr('id');\n var paymentInfoSelector = '#dwfrm_billing .' + activeTabId + ' .payment-form-fields :input';\n var paymentInfoForm = $(paymentInfoSelector).serialize();\n $('body').trigger('checkout:serializeBilling', {\n form: $(paymentInfoSelector),\n data: paymentInfoForm,\n callback: function callback(data) {\n if (data) {\n paymentInfoForm = data;\n }\n }\n });\n var paymentForm = billingAddressForm + '&' + contactInfoForm + '&' + paymentInfoForm;\n if ($('.data-checkout-stage').data('customer-type') === 'registered') {\n // if payment method is credit card\n if ($('.payment-information').data('payment-method-id') === 'CREDIT_CARD') {\n if (!$('.payment-information').data('is-new-payment')) {\n var cvvCode = $('.saved-payment-instrument.' + 'selected-payment .saved-payment-security-code').val();\n if (cvvCode === '') {\n var cvvElement = $('.saved-payment-instrument.' + 'selected-payment ' + '.form-control');\n cvvElement.addClass('is-invalid');\n scrollAnimate(cvvElement);\n defer.reject();\n return defer;\n }\n var $savedPaymentInstrument = $('.saved-payment-instrument' + '.selected-payment');\n paymentForm += '&storedPaymentUUID=' + $savedPaymentInstrument.data('uuid');\n paymentForm += '&securityCode=' + cvvCode;\n }\n }\n }\n // disable the next:Place Order button here\n $('body').trigger('checkout:disableButton', '.next-step-button button');\n $.ajax({\n url: $('#dwfrm_billing').attr('action'),\n method: 'POST',\n data: paymentForm,\n success: function success(data) {\n // enable the next:Place Order button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n // look for field validation errors\n if (data.error) {\n if (data.fieldErrors.length) {\n data.fieldErrors.forEach(function (error) {\n if (Object.keys(error).length) {\n formHelpers.loadFormErrors('.payment-form', error);\n }\n });\n }\n if (data.serverErrors.length) {\n data.serverErrors.forEach(function (error) {\n $('.error-message').show();\n $('.error-message-text').text(error);\n scrollAnimate($('.error-message'));\n });\n }\n if (data.cartError) {\n window.location.href = data.redirectUrl;\n }\n defer.reject();\n } else {\n //\n // Populate the Address Summary\n //\n $('body').trigger('checkout:updateCheckoutView', {\n order: data.order,\n customer: data.customer\n });\n if (data.renderedPaymentInstruments) {\n $('.stored-payments').empty().html(data.renderedPaymentInstruments);\n }\n if (data.customer.registeredUser && data.customer.customerPaymentInstruments.length) {\n $('.cancel-new-payment').removeClass('checkout-hidden');\n }\n scrollAnimate();\n defer.resolve(data);\n }\n },\n error: function error(err) {\n // enable the next:Place Order button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n if (err.responseJSON && err.responseJSON.redirectUrl) {\n window.location.href = err.responseJSON.redirectUrl;\n }\n }\n });\n return defer;\n } else if (stage === 'placeOrder') {\n // disable the placeOrder button here\n $('body').trigger('checkout:disableButton', '.next-step-button button');\n $.ajax({\n url: $('.place-order').data('action'),\n method: 'POST',\n success: function success(data) {\n // enable the placeOrder button here\n $('body').trigger('checkout:enableButton', '.next-step-button button');\n if (data.error) {\n if (data.cartError) {\n window.location.href = data.redirectUrl;\n defer.reject();\n } else {\n // go to appropriate stage and display error message\n defer.reject(data);\n }\n // ### Custom Adyen cartridge start ###\n } else if (data.adyenAction) {\n window.orderToken = data.orderToken;\n adyenCheckout.actionHandler(data.adyenAction);\n // ### Custom Adyen cartridge end ###\n } else {\n var redirect = $('