{"version":3,"sources":["webpack:///./cartridges/org_newbalance/cartridge/client/default/js/paypalMFRA.js","webpack:///./cartridges/org_newbalance/cartridge/client/default/js/paypalUtils.js"],"names":["initalizePaypal","console","paypalUtils","$","each","$paypalButton","this","data","config","billingAgreementFlow","billingAgreementFlowConfig","isShippingAddressExist","startBillingAgreementCheckoutUrl","style","layout","label","maxbuttons","fundingicons","shape","size","tagline","payment","onAuthorize","validate","actions","disable","onClick","$paypalAddShippingAddressModal","append","modal","window","location","href","initButton","error","$continueButton","$paymentOptionsTabs","continueButtonToggle","flag","stage","hash","substring","toggle","$paypalContent","parents","$useAnotherAccountCheckbox","find","$useAnotherAccountCheckboxWrap","$saveBillingAgreementCheckbox","$saveBillingAgreementWrap","$useCustomerBillingAgreementCheckbox","$errorContainer","$emailContainer","length","checked","change","hide","attr","show","removeAttr","val","$form","resolve","reject","ajax","url","method","serialize","success","paypalProcessorResult","text","fieldErrors","submit","serverErrors","forEach","cartError","redirectUrl","paypalToken","err","responseJSON","on","e","$tabContent","target","prop","$currentTabContent","initFraudnet","isDebugMode","paypalDebugOn","params","buttonEl","env","bmConfigurationInvalid","createPaymentUrl","createPaymentErrorHandle","reload","indexOf","defaultButtonConfig","locale","color","funding","allowed","paypal","FUNDING","CREDIT","disallowed","log","post","token","redirect","onCancel","onError","msg","document","trigger","extend","Button","render","dom","doc","where","iframe","createElement","src","title","role","frameElement","cssText","getElementsByTagName","parentNode","insertBefore","contentWindow","domain","open","_l","js","id","scriptBaseURL","body","appendChild","write","close"],"mappings":";;;;2JAKA,SAASA,IACL,IAAIC,EAAUC,YAAYD,QAC1BE,EAAE,qBAAqBC,MAAK,WACxB,IAAIC,EAAgBF,EAAEG,MACtB,IAAID,EAAcE,KAAK,YAAvB,CAGA,IAAIC,EAASH,EAAcE,KAAK,gBAChC,GAAsB,WAAlB,EAAOC,GAAX,CAIA,GAAIA,EAAOC,qBAAsB,CAC7B,IAAIC,EAA6B,CAC7BC,uBAAwBH,EAAOC,qBAAqB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Q,gBAAiBjC,KAI7CzE,EAASL,EAAEgH,OAAOlB,EAAqBzF,GAEvCP,QAAQyG,IAAI,2CAA4ClG,GAExD8F,OAAOc,OAAOC,OAAO7G,EAAQkF,IAGjCxF,EAAYoF,aAAe,WACvB,IACIgC,EACAC,EACAC,EACAC,EAASR,SAASS,cAAc,UACpCD,EAAOE,IAAM,cACbF,EAAOG,MAAQ,GACfH,EAAOI,KAAO,gBACbJ,EAAOK,cAAgBL,GAAQ5G,MAAMkH,QAAU,kCAEhDP,GADAA,EAAQP,SAASe,qBAAqB,WACxBR,EAAMnE,OAAS,IACvB4E,WAAWC,aAAaT,EAAQD,GACtC,IACID,EAAME,EAAOU,cAAclB,SAC7B,MAAOhC,GACLqC,EAAML,SAASmB,OACfX,EAAOE,IAAM,8CAAgDL,EAAM,aACnEC,EAAME,EAAOU,cAAclB,SAG/BM,EAAIc,OAAOC,GAAK,WACZ,IAAIC,EAAKjI,KAAKoH,cAAc,UACxBJ,IACAhH,KAAK8H,OAASd,GAElBiB,EAAGC,GAAK,kBACRD,EAAGZ,IAAMc,qEACTnI,KAAKoI,KAAKC,YAAYJ,IAE1BhB,EAAIqB,MAAM,kCACVrB,EAAIsB,SAGR/G,OAAO5B,YAAcA,EA9IxB","file":"paypal.js","sourcesContent":["/* global paypalUtils */\n\n'use strict';\n\n/** initialize paypal */\nfunction initalizePaypal() {\n var console = paypalUtils.console;\n $('.js_paypal_button').each(function () {\n var $paypalButton = $(this);\n if ($paypalButton.data('isInited')) {\n return;\n }\n var config = $paypalButton.data('paypalConfig');\n if (typeof config !== 'object') {\n console.error('paypalMFRA: not valid data-paypal-config');\n return;\n }\n if (config.billingAgreementFlow) {\n var billingAgreementFlowConfig = {\n isShippingAddressExist: config.billingAgreementFlow.isShippingAddressExist,\n startBillingAgreementCheckoutUrl: config.billingAgreementFlow.startBillingAgreementCheckoutUrl\n };\n if (!config.style) {\n config.style = {\n layout: 'horizontal',\n label: 'paypal',\n maxbuttons: 1,\n fundingicons: false,\n shape: 'rect',\n size: 'responsive',\n tagline: false\n };\n }\n config.style.maxbuttons = 1;\n config.payment = function () {};\n config.onAuthorize = function () {};\n config.validate = function (actions) {\n return actions.disable();\n };\n config.onClick = function () {\n if (billingAgreementFlowConfig.isShippingAddressExist === true) {\n window.location.href = billingAgreementFlowConfig.startBillingAgreementCheckoutUrl;\n return;\n }\n var $paypalAddShippingAddressModal = $('#paypalAddShippingAddressModal');\n $('body').append($paypalAddShippingAddressModal);\n $('#paypalAddShippingAddressModal').modal();\n };\n delete config.billingAgreementFlow;\n }\n paypalUtils.initButton(config, $paypalButton[0]);\n $paypalButton.data('isInited', true);\n });\n\n var $continueButton = $('button.submit-payment');\n var $paymentOptionsTabs = $('.payment-options[role=tablist] a[data-toggle=\"tab\"]');\n\n /**\n * Toggles a flag on the continue button\n * @param {*} flag The flag to toggle\n */\n function continueButtonToggle(flag) {\n var stage = window.location.hash.substring(1);\n if (stage !== 'placeOrder' && stage !== 'shipping' && stage !== null) {\n $continueButton.toggle(flag);\n }\n }\n\n $('.js_paypal_button_on_billing_form').each(function () {\n var $paypalButton = $(this);\n if ($paypalButton.data('isInited')) {\n return;\n }\n var config = $paypalButton.data('paypalConfig');\n if (typeof config !== 'object') {\n console.error('paypalMFRA: not valid data-paypal-config');\n return;\n }\n\n var $paypalContent = $paypalButton.parents('.paypal-content:first');\n var $useAnotherAccountCheckbox = $paypalContent.find('input[name$=\"billing_paypal_useAnotherAccount\"]');\n var $useAnotherAccountCheckboxWrap = $paypalContent.find('.js_paypal-use-another-account-wrap');\n var $saveBillingAgreementCheckbox = $paypalContent.find('input[name$=\"billing_paypal_saveBillingAgreement\"]');\n var $saveBillingAgreementWrap = $('.js_paypa-save-ba-wrap');\n var $useCustomerBillingAgreementCheckbox = $paypalContent.find('input[name$=\"billing_paypal_useCustomerBillingAgreement\"]');\n var $errorContainer = $paypalContent.find('.js_paypal_error');\n var $emailContainer = $paypalContent.find('.js_paypal_emailConainter');\n\n if ($useAnotherAccountCheckbox.length) {\n $useAnotherAccountCheckbox[0].checked = false;\n $useAnotherAccountCheckbox.change(function () {\n $paypalButton.parents('.js_paypal_button_parent').toggle(this.checked);\n continueButtonToggle(!this.checked);\n $paypalContent.data('paypalIsHideContinueButton', this.checked);\n $saveBillingAgreementWrap.toggle(this.checked);\n if ($useCustomerBillingAgreementCheckbox.length && this.checked) {\n $useCustomerBillingAgreementCheckbox[0].checked = !this.checked;\n }\n if (this.checked) {\n $emailContainer.hide();\n $emailContainer.find('input').attr('disabled', 'disabled');\n } else {\n $emailContainer.show();\n $emailContainer.find('input').removeAttr('disabled');\n }\n });\n }\n\n if ($useCustomerBillingAgreementCheckbox.length) {\n $useCustomerBillingAgreementCheckbox[0].checked = $useCustomerBillingAgreementCheckbox.data('paypalChecked');\n $useCustomerBillingAgreementCheckbox.change(function () {\n $useAnotherAccountCheckboxWrap.toggle(!this.checked);\n $paypalButton.parents('.js_paypal_button_parent').toggle(!this.checked);\n continueButtonToggle(this.checked);\n $paypalContent.data('paypalIsHideContinueButton', !this.checked);\n if ($saveBillingAgreementCheckbox.length) {\n $saveBillingAgreementCheckbox[0].checked = false;\n $saveBillingAgreementWrap.toggle(!this.checked);\n }\n if (this.checked === false) {\n $useAnotherAccountCheckbox.change();\n }\n if (this.checked) {\n $emailContainer.hide();\n $emailContainer.find('input').attr('disabled', 'disabled');\n } else {\n $emailContainer.show();\n $emailContainer.find('input').removeAttr('disabled');\n }\n });\n $useCustomerBillingAgreementCheckbox[0].checked = $paypalContent.find('.js_useCustomerFillingAgreementState').val();\n $useCustomerBillingAgreementCheckbox.change();\n }\n\n if ($saveBillingAgreementCheckbox.length) {\n $saveBillingAgreementCheckbox[0].checked = false;\n }\n\n var $form = $('#dwfrm_billing');\n\n config.payment = function (resolve, reject) {\n $errorContainer.hide();\n $.ajax({\n url: $form.attr('action'),\n method: 'POST',\n data: $form.serialize(),\n success: function (data) {\n if (data.error) {\n if (data.paypalProcessorResult && data.paypalProcessorResult.error) {\n $errorContainer.text(data.paypalProcessorResult.error).show();\n }\n if (data.fieldErrors.length) {\n $form.submit();\n }\n if (data.serverErrors.length) {\n data.serverErrors.forEach(function (error) {\n $('.error-message').show();\n $('.error-message-text').text(error);\n });\n }\n if (data.cartError) {\n window.location.href = data.redirectUrl;\n }\n reject();\n } else {\n resolve(data.paypalProcessorResult.paypalToken);\n }\n },\n error: function (err) {\n if (err.responseJSON.redirectUrl) {\n window.location.href = err.responseJSON.redirectUrl;\n }\n }\n });\n };\n\n paypalUtils.initButton(config, $paypalButton[0]);\n $paypalButton.data('isInited', true);\n });\n\n $paymentOptionsTabs.on('shown.bs.tab', function (e) {\n $paymentOptionsTabs.each(function () {\n var $tabContent = $($(this).attr('href'));\n if (this !== e.target) {\n $tabContent.find('input, textarea, select').prop('disabled', true);\n }\n });\n var $currentTabContent = $($(e.target).attr('href'));\n $currentTabContent.find('input, textarea, select').prop('disabled', false);\n if ($currentTabContent.find('.js_paypal_button_on_billing_form').length) {\n var isCheckboxPresent = $currentTabContent.find('.js_paypal-use-another-account-wrap').length;\n continueButtonToggle(isCheckboxPresent && !$currentTabContent.data('paypalIsHideContinueButton'));\n } else {\n continueButtonToggle(true);\n }\n });\n\n if ($('.js_paypal_fraudnet_data').length) {\n paypalUtils.initFraudnet();\n }\n}\n\n(function () {\n paypalUtils.initalizePaypal = initalizePaypal;\n paypalUtils.initalizePaypal();\n}());\n","'use strict';\n\n/* global paypal */\n/* eslint no-console: 'off' */\n\n(function () {\n var isDebugMode = window.paypalDebugOn;\n var paypalUtils = {};\n delete window.paypalDebugOn;\n\n paypalUtils.console = console;\n\n paypalUtils.initButton = function (params, buttonEl) {\n var config = params;\n if (isDebugMode) {\n if (typeof config.env !== 'string') {\n console.error('paypalUtils: env is mandatory parameter. The value can be \"production\" or \"sandbox\"');\n return;\n }\n if (!(config.env === 'production' || config.env === 'sandbox')) {\n console.error('paypalUtils: The value of env parameter must be \"production\" or \"sandbox\"');\n return;\n }\n if (config.bmConfigurationInvalid) {\n console.error('Invalid configuration in BM: Merchant Tools > Site Preferences > Custom Preference > Paypal_Express_Checkout > Field: ' + config.bmConfigurationInvalid);\n return;\n }\n }\n\n var createPaymentUrl = config.createPaymentUrl;\n delete config.createPaymentUrl;\n\n var createPaymentErrorHandle = config.createPaymentErrorHandle || function (error) {\n if (error === 'empty_cart') {\n window.location.reload();\n } else {\n var url = window.location.href;\n url += url.indexOf('?') > -1 ? '&' : '?';\n window.location.href = url + 'showPaypalError=true';\n }\n };\n delete config.createPaymentErrorHandle;\n\n // https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/customize-button/\n // https://developer.paypal.com/demo/checkout/#/pattern/client\n var defaultButtonConfig = {\n locale: 'en_US',\n style: {\n layout: 'vertical', // horizontal, vertical\n size: 'responsive', // small, medium, large, responsive\n shape: 'pill', // pill, rect\n color: 'gold' // gold, blue, silver, black\n // label: 'checkout',\n // checkout The PayPal Checkout button. The default button.\n // credit The PayPal Credit button. Initializes the credit flow. Cannot be used with any custom color option.\n // pay The Pay With PayPal button. Initializes the checkout flow.\n // buynow The Buy Now button. Initializes the checkout flow. The default Buy Now button is unbranded. To include PayPal branding, set branding: true.\n // paypal The generic PayPal button. Initializes the checkout flow. This button contains only the PayPal brand logo.\n // tagline: true, // false - to disable the tagline/text beneath the button\n // maxbuttons: 4, //1-4\n // fundingicons: true, // true Displays funding instrument icons. Not valid for the credit button.\n // false Hides funding instrument icons.\n },\n\n funding: {\n allowed: [paypal.FUNDING.CREDIT],\n disallowed: []\n // paypal.FUNDING.CREDIT Allow buyers to pay with PayPal Credit. Enabled by default for US buyers.\n // paypal.FUNDING.CARD Allow buyers to pay with their credit or debit card Enabled by default for all buyers.\n // paypal.FUNDING.ELV Allow German buyers to pay with their bank account Enabled by default for DE buyers.\n },\n\n payment: function (resolve, reject) {\n console.log('paypalUtils: payment', 'payment url:', createPaymentUrl);\n $.post(createPaymentUrl, {}, function (data) {\n console.log('paypalUtils: Getting token data response', data);\n if (data.error) {\n createPaymentErrorHandle(data.error);\n console.error('paypalUtils: ' + createPaymentUrl + ' returned data with error');\n reject(data.error);\n }\n if (!data.token) {\n console.error('paypalUtils: data does not have token property');\n reject('system_error');\n return;\n }\n resolve(data.token);\n });\n },\n onAuthorize: function (data, actions) {\n console.log('paypalUtils: onAuthorize.data', data);\n return actions.redirect();\n },\n onCancel: function (data, actions) { // eslint-disable-line no-unused-vars\n console.log('paypalUtils: onCancel.data', data);\n // return actions.redirect();\n },\n onError: function (msg) {\n $(document).trigger('paypal:error-tealium');\n console.log('paypalUtils: onError.msg', msg);\n },\n onClick: function (e) {\n $(document).trigger('paypaltrigger', e);\n }\n };\n\n config = $.extend(defaultButtonConfig, config); // eslint-disable-line no-param-reassign\n\n console.log('paypalUtils: paypal.Button.render config', config);\n\n paypal.Button.render(config, buttonEl);\n };\n\n paypalUtils.initFraudnet = function () {\n var scriptBaseURL = 'https://www.paypalobjects.com/webstatic/r/fb/';\n var dom;\n var doc;\n var where;\n var iframe = document.createElement('iframe');\n iframe.src = 'about:blank';\n iframe.title = '';\n iframe.role = 'presentation'; // a11y\n (iframe.frameElement || iframe).style.cssText = 'width: 0; height: 0; border: 0';\n where = document.getElementsByTagName('script');\n where = where[where.length - 1];\n where.parentNode.insertBefore(iframe, where);\n try {\n doc = iframe.contentWindow.document;\n } catch (e) {\n dom = document.domain;\n iframe.src = \"javascript:var d=document.open();d.domain='\" + dom + \"';void(0);\"; // eslint-disable-line no-script-url\n doc = iframe.contentWindow.document;\n }\n // eslint-disable-next-line no-underscore-dangle\n doc.open()._l = function () {\n var js = this.createElement('script');\n if (dom) {\n this.domain = dom;\n }\n js.id = 'js-iframe-async';\n js.src = scriptBaseURL + 'fb-all-prod.pp.min.js';\n this.body.appendChild(js);\n };\n doc.write('');\n doc.close();\n };\n\n window.paypalUtils = paypalUtils;\n}());\n"],"sourceRoot":""}