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AAO,CACHC,MAAO,QACPC,MAAO,OACPC,SAAS,EACT1D,MAAOzC,EAAOyC,MACd2D,OAAQ,aACRC,KAAM,aACNC,OAAQ,KAGhBtG,EAAOsC,UACTO,MAAK,WAGH,GAER,EACAR,mBAAoB,SAASrC,GACzBU,KAAKZ,cACD,SAASS,GACLG,KAAKG,sBACDN,EACA,SAASS,GACLN,KAAKyD,oBAAoBnD,EAAwBhB,EACrD,EAAEY,KAAKF,MACPV,EAER,EAAEY,KAAKF,MACPV,EAER,GAGJ,SAASqF,EAAekB,EAAQC,GAC5B,IAAIC,EAAID,GAAe,CAAC,EAUxB,OARAE,OAAOC,KAAKJ,GAAQK,SAAQ,SAASC,GACN,iBAAhBN,EAAOM,GACdJ,EAAEI,GAAON,EAAOM,GAEhBxB,EAAekB,EAAOM,GAAMJ,EAEpC,IAEOA,CACX,CAEAlH,OAAOuH,SAAWvH,OAAOuH,UAAY,CAAC,EACtCvH,OAAOuH,SAAS7G,UAAYJ,C,2DC9P5B,QArBuB,CACnBkH,WAAW,EACX/B,KAAM,SAASgC,GACNtG,KAAKqG,YACFC,GACA1B,IAAE,0CAA0C2B,SAAS,QAEzD3B,IACI,4KACF2B,SAAS,QACXvG,KAAKqG,WAAY,EAEzB,EACAnB,KAAM,WACElF,KAAKqG,YACLzB,IAAE,8CAA8C4B,SAChDxG,KAAKqG,WAAY,EAEzB,E,YCpBJI,EAAOC,QAAUC,M","sources":["webpack://front-end-build-system/./src/smartpak/httpstatus.js","webpack://front-end-build-system/./src/smartpak/modal.js","webpack://front-end-build-system/./src/vendor/braintree/braintree.js","webpack://front-end-build-system/./src/views/shared/loadingmessage.js","webpack://front-end-build-system/external var \"jQuery\""],"sourcesContent":["/* eslint-disable one-var */\nexport const HTTP_STATUS_OK = 200;\nexport const HTTP_STATUS_CREATED = 201;\nexport const HTTP_STATUS_NOCONTENT = 204;\nexport const HTTP_STATUS_BADREQUEST = 400;\nexport const HTTP_STATUS_UNAUTHORIZED = 401;\nexport const HTTP_STATUS_NOTFOUND = 404;\nexport const HTTP_STATUS_INTERNALSERVERERROR = 500;\nexport const HTTP_STATUS_SERVICEUNAVAILABLE = 503;\n","/* eslint-disable switch-colon-spacing */\r\n// Add modal HTML here\r\n\r\n/* prevents unit tests from blowing up */\r\nconst Dialog = window.ds && window.ds.Dialog ? window.ds.Dialog : class Noop{};\r\nclass Modal extends Dialog{\r\n constructor(content, opts){\r\n super(content, opts);\r\n }\r\n}\r\nexport default function modal(content, options) {\r\n return new Modal(content, options);\r\n}","import $ from 'jquery';\nimport { HTTP_STATUS_OK } from '../../smartpak/httpstatus';\nimport loadingMessage from \"../../views/shared/loadingmessage\";\nimport modal from '../../smartpak/modal';\n\nconst userStatus = {\n SUCCESS: 0,\n USER_NAME_EXISTS: 1\n};\n\nvar braintreeWrapper = {\n _clientCreate: function(onCreate, config) {\n window.braintree.client.create(\n {\n authorization:\n config.env === 'production'\n ? 'production_3833xk8m_zw2jcdvqjy6w8yx4'\n : 'sandbox_fwz8cscb_svz9tvmr2cgyktx5'\n },\n function(clientErr, clientInstance) {\n // Stop if there was a problem creating the client.\n // This could happen if there is a network error or if the authorization\n // is invalid.\n if (clientErr) {\n // eslint-disable-next-line no-console\n console.error('Error creating client:', clientErr);\n this._showErrorMessage(config);\n return;\n }\n\n if (onCreate) {\n onCreate(clientInstance);\n }\n }.bind(this)\n );\n },\n _paypalCheckoutCreate: function(clientInstance, onCreate, config) {\n // Create a PayPal Checkout component.\n window.braintree.paypalCheckout.create(\n {\n client: clientInstance\n },\n function(paypalCheckoutErr, paypalCheckoutInstance) {\n // Stop if there was a problem creating PayPal Checkout.\n // This could happen if there was a network error or if it's incorrectly\n // configured.\n if (paypalCheckoutErr) {\n // eslint-disable-next-line no-console\n console.error('Error creating PayPal Checkout:', paypalCheckoutErr);\n this._showErrorMessage(config);\n return;\n }\n\n if (onCreate) {\n onCreate(paypalCheckoutInstance);\n }\n }.bind(this)\n );\n },\n _getCopy: function(pathname) {\n return /cart/gi.test(pathname)\n ? \"We're sorry, there was an error preventing us from connecting to your PayPal account. Please try logging into PayPal again, or use our SmartPak checkout, in order to complete your order.\"\n : /checkout/gi.test(pathname)\n ? \"We're sorry, there was an error preventing us from connecting to your PayPal account. Please try logging into PayPal again, or enter a credit card instead, in order to complete your order.\"\n : \"We're sorry, there was an error preventing us from connecting to your PayPal account. Please try logging into PayPal again, or enter a credit card instead.\";\n },\n _getButtonCopy: function(pathname) {\n return /cart/gi.test(pathname) ? 'Complete Checkout' : 'Enter Credit Card';\n },\n _showErrorMessage: function(config) {\n if (this._errorModal) {\n return;\n }\n\n var modalButtonID = 'paypal-error-modal',\n buttons =\n '
',\n html = '' + this._getCopy(location.pathname) + '
' + buttons,\n $content = document.createElement('div');\n\n $content.classList.add('jsHide');\n $content.classList.add('paypal-error-modal-wrap');\n $content.innerHTML = html;\n\n document.body.appendChild($content);\n\n this._errorModal = this._modal($content, {\n removeContents: true,\n open: function() {\n this.createPayPalButton({\n buttonID: modalButtonID,\n env: config.env,\n postURL: config.postURL,\n returnURL: config.returnURL,\n label: 'paypal'\n });\n }.bind(this),\n close: function() {\n if (this._errorModal) {\n this._errorModal = null;\n }\n }.bind(this)\n });\n },\n _modal: function (content, options) {\n return modal(content, options);\n },\n _signIn: function (onLogin) {\n import('../../views/customeraccount/launchmodal.js').then(({ default: launchModal }) =>\n launchModal({\n success: onLogin\n })\n );\n },\n _userExistsPrompt: function (email, onLogin) {\n const $element = document.createElement('div');\n\n $element.innerHTML = `We found an account associated with your email, ${email}
`;\n\n this._modal($element, {\n title: 'Please sign in to check out',\n buttons: {\n 'Sign In': (modal) => {\n modal.close();\n this._signIn(onLogin);\n }\n }\n });\n },\n _handlePostResponse: function ({ postResponse, payloadResponse, config }) {\n if (!postResponse || postResponse.status !== HTTP_STATUS_OK || !postResponse.content) {\n this._showErrorMessage(config);\n return;\n }\n\n const handleSuccess = () => {\n if (typeof config.onsuccess === 'function') {\n config.onsuccess(payloadResponse);\n return;\n }\n\n if (config.returnURL) {\n this._redirectToUrl(config.returnURL);\n }\n };\n\n if (postResponse.content?.status === userStatus.USER_NAME_EXISTS) {\n this._userExistsPrompt(payloadResponse.email, handleSuccess);\n return;\n }\n\n handleSuccess();\n },\n _redirectToUrl(url) {\n if (!url) {\n return;\n }\n\n location.href = url;\n },\n _paypalButtonRender: function(paypalCheckoutInstance, config) {\n // Set up PayPal with the checkout.js library\n window.paypal.Button.render(\n {\n env: config.env, // 'sandbox' or 'production'\n\n payment: function() {\n return paypalCheckoutInstance.createPayment({\n flow: 'vault',\n billingAgreementDescription: '',\n enableShippingAddress: true,\n shippingAddressEditable: false\n });\n },\n\n onAuthorize: function(data) {\n loadingMessage.show(true);\n\n return paypalCheckoutInstance.tokenizePayment(\n data,\n function(err, payload) {\n if (err) {\n return;\n }\n\n var payloadResponse = flattenPayload(payload);\n\n if (this._errorModal) {\n this._errorModal.close();\n }\n\n $.ajax({\n url: config.postURL,\n type: 'POST',\n data: JSON.stringify({\n payload: payloadResponse\n }),\n contentType: 'application/json'\n })\n .done(postResponse => {\n loadingMessage.hide();\n this._handlePostResponse({ postResponse, payloadResponse, config });\n })\n .fail(\n function() {\n this._showErrorMessage(config);\n }.bind(this)\n );\n }.bind(this)\n );\n }.bind(this),\n\n onCancel: function() {\n if (this._errorModal) {\n this._errorModal.close();\n }\n }.bind(this),\n\n onError: function(err) {\n // eslint-disable-next-line no-console\n console.error('checkout.js error', err);\n if (this._errorModal) {\n this._errorModal.close();\n }\n }.bind(this),\n style: {\n color: 'white',\n shape: 'rect',\n tagline: false,\n label: config.label,\n layout: 'horizontal',\n size: 'responsive',\n height: 48\n }\n },\n config.buttonID\n ).then(function() {\n // The PayPal button will be rendered in an html element with the id\n // `paypal-button`. This function will be called when the PayPal button\n // is set up and ready to be used.\n });\n },\n createPayPalButton: function(config) {\n this._clientCreate(\n function(clientInstance) {\n this._paypalCheckoutCreate(\n clientInstance,\n function(paypalCheckoutInstance) {\n this._paypalButtonRender(paypalCheckoutInstance, config);\n }.bind(this),\n config\n );\n }.bind(this),\n config\n );\n }\n};\n\nfunction flattenPayload(source, destination) {\n var d = destination || {};\n\n Object.keys(source).forEach(function(key) {\n if (typeof source[key] === 'string') {\n d[key] = source[key];\n } else {\n flattenPayload(source[key], d);\n }\n });\n\n return d;\n}\n\nwindow.smartPak = window.smartPak || {};\nwindow.smartPak.braintree = braintreeWrapper;","import $ from 'jquery';\r\n\r\nconst loadingMessage = {\r\n isVisible: false,\r\n show: function(includeOverlay) {\r\n if (!this.isVisible) {\r\n if (includeOverlay) {\r\n $('').appendTo('body');\r\n }\r\n $(\r\n '