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XtEzBuC,EAAMG,MAAO,CACZC,QAAS,KACTC,WAAY,CACXC,WAAY,OACZC,QAAS,MAIJ/C,IAAAA,KAAQ,CACdgD,KAAM,OACNrC,IAAKzI,OAAO+K,mBAAmBC,SAC/BC,UAAW,CAEVC,iBAAiB,GAElBC,SAAU,OACVjD,KAAM,CACLkD,OAAQ,qBACRC,OAAQf,EAAMgB,YACdC,OAAQ,IAAI3I,IAAKnC,SAASiI,UAAWC,aAAalD,cAEhD+F,QAAQ,kBAAMlB,EAAMD,SAAS,KWkD7B5L,MAAM,kBAAMmL,GAAc,IAC1BJ,OAAO,WAKPxJ,OAAOyL,SAAU,EAAG,GACpBzL,OAAO0I,SAASgD,QACjB,IACF,IAMKnK,KACJgI,GAEF,IACA,E","sources":["webpack://payoneer-embedded-payment/webpack/bootstrap","webpack://payoneer-embedded-payment/./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","webpack://payoneer-embedded-payment/webpack/runtime/compat get default export","webpack://payoneer-embedded-payment/webpack/runtime/define property getters","webpack://payoneer-embedded-payment/webpack/runtime/hasOwnProperty shorthand","webpack://payoneer-embedded-payment/external window \"regeneratorRuntime\"","webpack://payoneer-embedded-payment/external window \"jQuery\"","webpack://payoneer-embedded-payment/./resources/js/src/util/woocommerce.js","webpack://payoneer-embedded-payment/./resources/js/src/util/sdk/umdLoader.js","webpack://payoneer-embedded-payment/./resources/js/src/util/sdk.js","webpack://payoneer-embedded-payment/./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://payoneer-embedded-payment/./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","webpack://payoneer-embedded-payment/./resources/js/src/util/components.js","webpack://payoneer-embedded-payment/./node_modules/@babel/runtime/helpers/esm/slicedToArray.js","webpack://payoneer-embedded-payment/./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","webpack://payoneer-embedded-payment/./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","webpack://payoneer-embedded-payment/./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","webpack://payoneer-embedded-payment/./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","webpack://payoneer-embedded-payment/./resources/js/payoneer-checkout.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","function asyncGeneratorStep(n, t, e, r, o, a, c) {\n try {\n var i = n[a](c),\n u = i.value;\n } catch (n) {\n return void e(n);\n }\n i.done ? t(u) : Promise.resolve(u).then(r, o);\n}\nfunction _asyncToGenerator(n) {\n return function () {\n var t = this,\n e = arguments;\n return new Promise(function (r, o) {\n var a = n.apply(t, e);\n function _next(n) {\n asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n);\n }\n function _throw(n) {\n asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n);\n }\n _next(void 0);\n });\n };\n}\nexport { _asyncToGenerator as default };","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","var __WEBPACK_NAMESPACE_OBJECT__ = window[\"regeneratorRuntime\"];","var __WEBPACK_NAMESPACE_OBJECT__ = window[\"jQuery\"];","import $ from 'jquery';\n\nconst {\n\tpaymentFieldsComponentAttribute,\n\tlistUrlContainerId,\n\tlistIdAttribute,\n\tlistEnvAttribute,\n} = window.PayoneerData;\n\nexport const selectedPaymentGatewayId = () => {\n\treturn document.querySelector(\n\t\t'.woocommerce-checkout input[name=\"payment_method\"]:checked'\n\t)?.id;\n};\n\nexport const getSelectedGatewayComponentName = () => {\n\treturn getComponentNameFromPaymentBox( getSelectedPaymentBox() );\n};\n\nexport const getComponentNameFromPaymentBox = function ( paymentBox ) {\n\treturn paymentBox\n\t\t?.querySelector( `[${ paymentFieldsComponentAttribute }]` )\n\t\t?.getAttribute( paymentFieldsComponentAttribute );\n};\n\nexport const getLongId = () => {\n\treturn getListInput()?.getAttribute( listIdAttribute );\n};\n\nexport const getEnv = () => {\n\treturn getListInput()?.getAttribute( listEnvAttribute );\n};\n\nconst getListInput = () => {\n\treturn document.getElementById( listUrlContainerId );\n};\n\nexport const isPayoneerGateway = ( gatewayId ) => {\n\treturn /^payment_method_payoneer-(checkout|afterpay)/i.test( gatewayId );\n};\n\nexport const isPayoneerGatewaySelected = () =>\n\tisPayoneerGateway( selectedPaymentGatewayId() );\n\nexport const isPayForOrder = () => {\n\treturn window.PayoneerData.isPayForOrder === '1';\n};\n\nexport const getPaymentBox = ( gatewayId ) => {\n\tconst selector = '.payment_box.' + gatewayId;\n\treturn document.querySelector( selector );\n};\n\nexport const getSelectedPaymentBox = () =>\n\tgetPaymentBox( selectedPaymentGatewayId() );\n\nexport const payoneerGateways = () => {\n\treturn Array.from(\n\t\tdocument.querySelectorAll(\n\t\t\t'.woocommerce-checkout input[name=\"payment_method\"]'\n\t\t)\n\t)\n\t\t.map( ( input ) => input.id )\n\t\t.filter( isPayoneerGateway );\n};\n\nexport const hostedOverrideFlagInput = () => {\n\tconst { hostedFlowOverrideFlag } = window.PayoneerData;\n\treturn document.querySelector(\n\t\t`input[name=\"${ hostedFlowOverrideFlag }\"]`\n\t);\n};\n\nexport const hostedOverrideActive = () => {\n\tconst input = hostedOverrideFlagInput();\n\treturn input?.disabled === true;\n};\n\nexport const setHostedOverride = ( enabled ) => {\n\tconst input = hostedOverrideFlagInput();\n\tif ( input ) {\n\t\tinput.disabled = ! enabled;\n\t}\n};\n\nexport const submitOrderPayViaAjax = ( $form ) => {\n\t//Blocks the UI in the same way Woocommerce does (source: https://github.com/woocommerce/woocommerce/blob/6.0.1/plugins/woocommerce/assets/js/frontend/checkout.js#L454-L466)\n\t$form.block( {\n\t\tmessage: null,\n\t\toverlayCSS: {\n\t\t\tbackground: '#fff',\n\t\t\topacity: 0.6,\n\t\t},\n\t} );\n\n\treturn $.ajax( {\n\t\ttype: 'POST',\n\t\turl: window.wc_checkout_params.ajax_url,\n\t\txhrFields: {\n\t\t\t// This is important. We need the session cookie to access the LIST in the back-end\n\t\t\twithCredentials: true,\n\t\t},\n\t\tdataType: 'json',\n\t\tdata: {\n\t\t\taction: 'payoneer_order_pay',\n\t\t\tfields: $form.serialize(),\n\t\t\tparams: new URL( document.location ).searchParams.toString(),\n\t\t},\n\t} ).always( () => $form.unblock() );\n};\n","/*\n * Since the WebSDK is not yet available on npm, we asynchronously\n * load the UMD version from the appropriate env whenever the SDK is initialized\n * for the first time.\n */\n\nconst formatUmdUrl = ( env ) => {\n\treturn new URL(\n\t\twindow.PayoneerData.webSdkUmdUrlTemplate?.replace( '', env )\n\t);\n};\n\nconst sdkLoader = ( config ) => {\n\tif ( window.Payoneer?.CheckoutWeb ) {\n\t\treturn window.Payoneer.CheckoutWeb( config );\n\t}\n\n\treturn new Promise( ( resolve, reject ) => {\n\t\tconst script = document.createElement( 'script' );\n\t\tscript.src = formatUmdUrl( config.env );\n\t\tscript.onload = resolve;\n\t\tscript.onerror = reject;\n\t\tdocument.head.appendChild( script );\n\t} ).then( () => {\n\t\treturn window.Payoneer.CheckoutWeb( config );\n\t} );\n};\n\nexport default sdkLoader;\n","import initializeSdk from './sdk/umdLoader';\nimport { getEnv } from './woocommerce';\n\nexport const createSdk = async ( onSdkError, onComponentListChange ) => {\n\tconst { websdkStyles: styles } = window.PayoneerData;\n\n\tconst env = getEnv();\n\n\treturn await initializeSdk( {\n\t\tenv,\n\t\tonBeforeError: onSdkError,\n\t\tonComponentListChange,\n\t\tpreload: [ 'cards' ],\n\t\tstyles,\n\t} );\n};\n","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","function _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nexport { _arrayLikeToArray as default };","import {\n\tpayoneerGateways,\n\tgetPaymentBox,\n\tgetComponentNameFromPaymentBox,\n} from './woocommerce';\n\nexport const applyComponentListChange = function (\n\tsdk,\n\tchangeInfo,\n\tcomponentsList\n) {\n\tinitNewComponents( sdk, changeInfo.availableComponents, componentsList );\n\tremoveRemovedComponents(\n\t\tsdk,\n\t\tchangeInfo.removedComponents,\n\t\tcomponentsList\n\t);\n\thidePayoneerGatewaysWithoutComponents( componentsList, payoneerGateways() );\n};\n\nconst { paymentFieldsComponentAttribute } = window.PayoneerData;\n\nexport const mountComponents = ( components, sdk ) => {\n\tfor ( const [ componentName, component ] of Object.entries( components ) ) {\n\t\tconst container = findComponentContainer( componentName );\n\t\tif (\n\t\t\tcontainer instanceof Element &&\n\t\t\tsdk.isAvailable( componentName )\n\t\t) {\n\t\t\tcomponent.mount( container );\n\t\t}\n\t}\n};\n\nconst initNewComponents = function (\n\tsdk,\n\tavailableComponents,\n\tcomponentsList\n) {\n\tavailableComponents.forEach( ( componentName ) => {\n\t\tif (\n\t\t\t! sdk.isDroppedIn( componentName ) &&\n\t\t\ttypeof findComponentContainer( componentName ) === 'object'\n\t\t) {\n\t\t\ttry {\n\t\t\t\tcomponentsList[ componentName ] = sdk.dropIn( componentName, {\n\t\t\t\t\thidePaymentButton: true,\n\t\t\t\t} );\n\t\t\t} catch ( e ) {\n\t\t\t\tconsole.log(\n\t\t\t\t\t`Failed to drop in component ${ componentName }. Error details: ${ e }`\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconsole.log(\n\t\t\t`Component ${ componentName } already dropped in. Skipping.`\n\t\t);\n\t} );\n};\n\nconst removeRemovedComponents = function (\n\tsdk,\n\tremovedComponents,\n\tcomponentsList\n) {\n\tremovedComponents.forEach( ( componentName ) => {\n\t\tdelete componentsList[ componentName ];\n\t\tif ( sdk.isDroppedIn( componentName ) ) {\n\t\t\tsdk.remove( componentName );\n\t\t}\n\t} );\n};\n\nconst findComponentContainer = function ( componentName ) {\n\treturn document.querySelector(\n\t\t`[${ paymentFieldsComponentAttribute }=${ componentName }]`\n\t);\n};\n\nconst hidePayoneerGatewaysWithoutComponents = function (\n\tcomponentsList,\n\tpayoneerGateways\n) {\n\tfor ( const gatewayId of payoneerGateways ) {\n\t\tconst componentName = getComponentNameFromPaymentBox(\n\t\t\tgetPaymentBox( gatewayId )\n\t\t);\n\t\tif ( componentsList[ componentName ] === undefined ) {\n\t\t\tfindComponentContainer( componentName ).closest(\n\t\t\t\t'li.wc_payment_method'\n\t\t\t).style.display = 'none';\n\t\t}\n\t}\n};\n","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nfunction _slicedToArray(r, e) {\n return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest();\n}\nexport { _slicedToArray as default };","function _arrayWithHoles(r) {\n if (Array.isArray(r)) return r;\n}\nexport { _arrayWithHoles as default };","function _iterableToArrayLimit(r, l) {\n var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (null != t) {\n var e,\n n,\n i,\n u,\n a = [],\n f = !0,\n o = !1;\n try {\n if (i = (t = t.call(r)).next, 0 === l) {\n if (Object(t) !== t) return;\n f = !1;\n } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);\n } catch (r) {\n o = !0, n = r;\n } finally {\n try {\n if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return;\n } finally {\n if (o) throw n;\n }\n }\n return a;\n }\n}\nexport { _iterableToArrayLimit as default };","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;\n }\n}\nexport { _unsupportedIterableToArray as default };","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nexport { _nonIterableRest as default };","import $ from 'jquery';\nimport {\n\tgetSelectedGatewayComponentName,\n\tgetSelectedPaymentBox,\n\thostedOverrideActive,\n\tisPayForOrder,\n\tisPayoneerGatewaySelected,\n\tpayoneerGateways,\n\tsetHostedOverride,\n\tsubmitOrderPayViaAjax,\n\tgetLongId\n} from './src/util/woocommerce';\nimport { createSdk } from './src/util/sdk';\nimport { applyComponentListChange, mountComponents } from './src/util/components';\n\ndocument.addEventListener(\n\t'DOMContentLoaded',\n\tfunction () {\n\t\tconst $checkoutForm = $( 'form.checkout' );\n\t\tconst $orderReviewForm = $( '#order_review' );\n\t\t/**\n\t\t * We may not track droppedInComponents in the future. WebSDK instance has dropInComponents\n\t\t * property with the same components, although the keys are different.\n\t\t * But now this is not a part of the public API, so it is better to not rely on that until it\n\t\t * is guaranteed.\n\t */\n\t\tconst droppedInComponents = {};\n\t\tlet sdk = null;\n\t\tlet longId = null;\n\n\t\tconst onSdkError = ( checkout, component, data ) => {\n\t\t\tconst { onErrorRefreshFragmentFlag } = window.PayoneerData;\n\t\t\tconsole.error( \"WebSDK error:\", { checkout, component, data } );\n\n\t\t\t//Only act on expired session or system failure, for anything else a refresh won't resolve the error.\n\t\t\tif ( ! [\"EXPIRED_SESSION\", \"SYSTEM_FAILURE\"].includes(data?.interaction?.reason) ) {\n\t\t\t\t//Re-enable hosted override so we don't block the checkout flow completely.\n\t\t\t\tsetHostedOverride( true );\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif ( isPayForOrder() ) {\n\t\t\t\tconst url = new URL( document.location );\n\t\t\t\turl.searchParams.set( window.PayoneerData.payOrderErrorFlag, true );\n\t\t\t\twindow.location.href = url.toString();\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tlet errorFlag = document.querySelector( `input[name=\"${onErrorRefreshFragmentFlag}\"]` );\n\t\t\tif ( errorFlag ) {\n\t\t\t\terrorFlag.value = 'true';\n\t\t\t}\n\n\t\t\t$( document.body ).trigger( 'update_checkout' );\n\t\t};\n\n\t\tconst onComponentListChange = ( sdk, changeInfo ) => {\n\t\t\tapplyComponentListChange( sdk, changeInfo, droppedInComponents );\n\t\t\tmountComponents(droppedInComponents, sdk);\n\t\t}\n\n\t\t/**\n\t\t * Create SDK instance if not created.\n\t\t * Mount components.\n\t\t *\n\t\t * We mount them in the `onComponentListChange` callback and that is the main place for\n\t\t * components mounting. But we need to mount them here as well because fragment update\n\t\t * removes DOM elements with mounted components. If there were no components list\n\t\t * change, then `onComponentListChange` will not be triggered, so our mounting there\n\t\t * will not be called. As a result, we will have no mounted components after fragments\n\t\t * update.\n\t\t */\n\t\tconst onUpdatedCheckout = async () => {\n\t\t\tif (! sdk ) {\n\t\t\t\tsdk = await createSdk( onSdkError, onComponentListChange ).catch( err => {\n\t\t\t\t\tconsole.error( \"WebSDK creation error:\", err );\n\t\t\t\t\tsetHostedOverride( true )\n\t\t\t\t} );\n\t\t\t\tif (sdk.state == 'ERROR') {\n\t\t\t\t\tsetHostedOverride(true);\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tmountComponents(droppedInComponents, sdk); // to mount pre-loaded previews\n\t\t\tsetHostedOverride(false);\n\t\t\tsdk.updateLongId(getLongId());\n\t\t}\n\n\t\tconst startPayment = () => {\n\t\t\tconst selectedComponentName = getSelectedGatewayComponentName();\n\t\t\tif(! selectedComponentName) {\n\t\t\t\tconsole.log(\n\t\t\t\t\t'Cannot find component name for selected payment gateway. Switching to the HPP.'\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tconst componentToPayWith = droppedInComponents[selectedComponentName];\n\n\t\t\tif(! componentToPayWith ) {\n\t\t\t\tconsole.log(\n\t\t\t\t\t'Cannot find component for selected payment gateway.'\n\t\t\t\t);\n\t\t\t\t//todo: improve fallback with preselection to make only selected payment available\n\n\n\t\t\t}\n\n\t\t\tif(typeof componentToPayWith.pay !== 'function') {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`Selected component ${selectedComponentName} doesn't support the 'pay' method.`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tcomponentToPayWith.pay();\n\t\t};\n\n\t\t/**\n\t\t * Cannot use native event listener for events dispatched by jQuery\n\t\t * https://github.com/jquery/jquery/issues/3347\n\t\t */\n\t\t$( document.body ).on( 'updated_checkout', onUpdatedCheckout );\n\n\t\t$checkoutForm.on( 'checkout_place_order_success', ( e, result ) => {\n\t\t\tif ( !isPayoneerGatewaySelected() || !hostedOverrideActive() ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstartPayment();\n\t\t\t//Override default redirect to hosted payment page\n\t\t\tresult.redirect = '#payoneer-redirect';\n\n\t\t\t/**\n\t\t\t * Create a timeout that races the SDK's payment handling.\n\t\t\t * If the handling is not done after 1,5 second, it unblocks\n\t\t\t * the checkout form and scrolls the users to the payment fields\n\t\t\t * because probably there is an error displayed there\n\t\t\t *\n\t\t\t * This is done since the SDK does not have any validation callback\n\t\t\t * or Promise we could attach to.\n\t\t\t */\n\t\t\tsetTimeout( () => {\n\t\t\t\t$checkoutForm.removeClass( 'processing' ).unblock();\n\t\t\t\t$.scroll_to_notices(\n\t\t\t\t\t$( getSelectedPaymentBox() )\n\t\t\t\t);\n\t\t\t}, 1500 );\n\n\t\t\treturn true;\n\t\t} );\n\n\t\t$orderReviewForm.on( 'submit', ( e ) => {\n\t\t\tif ( !isPayoneerGatewaySelected() || !hostedOverrideActive() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\te.preventDefault();\n\t\t\te.stopImmediatePropagation();\n\n\t\t\tsubmitOrderPayViaAjax( $orderReviewForm )\n\t\t\t\t.then( () => startPayment() )\n\t\t\t\t.catch( () => {\n\t\t\t\t\t/**\n\t\t\t\t\t * Reloading enables us to see error messages added via wc_add_notice()\n\t\t\t\t\t * Scrolling up makes sure the notices are in the viewport after the refresh\n\t\t\t\t\t */\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t\twindow.location.reload();\n\t\t\t\t} );\n\t\t} );\n\n\t\t/**\n\t\t * No fragment update on 'order-pay'. So we manually initialize our widget\n\t\t * and listen to the native JS change event for the radio button\n\t\t */\n\t\tif ( isPayForOrder() ) {\n\t\t\tonUpdatedCheckout();\n\t\t}\n\t},\n\tfalse,\n);\n"],"names":["__webpack_require__","asyncGeneratorStep","n","t","e","r","o","a","c","i","u","value","done","Promise","resolve","then","_asyncToGenerator","this","arguments","apply","_next","_throw","module","getter","__esModule","d","exports","definition","key","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","window","_window$PayoneerData","PayoneerData","paymentFieldsComponentAttribute","listUrlContainerId","listIdAttribute","listEnvAttribute","selectedPaymentGatewayId","_document$querySelect","document","querySelector","id","getComponentNameFromPaymentBox","paymentBox","_paymentBox$querySele","concat","getAttribute","getListInput","getElementById","isPayoneerGateway","gatewayId","test","isPayoneerGatewaySelected","isPayForOrder","getPaymentBox","selector","getSelectedPaymentBox","hostedOverrideFlagInput","hostedFlowOverrideFlag","hostedOverrideActive","input","disabled","setHostedOverride","enabled","config","_window$Payoneer","Payoneer","CheckoutWeb","reject","env","_window$PayoneerData$","script","createElement","src","URL","webSdkUmdUrlTemplate","replace","onload","onerror","head","appendChild","createSdk","_ref","_regeneratorRuntime","_callee","onSdkError","onComponentListChange","styles","_context","prev","next","websdkStyles","_getListInput2","initializeSdk","onBeforeError","preload","abrupt","sent","stop","_x","_x2","_typeof","Symbol","iterator","constructor","_arrayLikeToArray","length","Array","mountComponents","components","sdk","_i","_Object$entries","entries","_Object$entries$_i","isArray","l","f","push","toString","slice","name","from","TypeError","componentName","component","container","findComponentContainer","Element","isAvailable","mount","initNewComponents","availableComponents","componentsList","forEach","isDroppedIn","console","log","dropIn","hidePaymentButton","removeRemovedComponents","removedComponents","remove","hidePayoneerGatewaysWithoutComponents","payoneerGateways","_step","_iterator","_createForOfIteratorHelper","s","undefined","closest","style","display","err","addEventListener","$checkoutForm","$","$orderReviewForm","droppedInComponents","checkout","data","_data$interaction","onErrorRefreshFragmentFlag","error","includes","interaction","reason","url","location","searchParams","set","payOrderErrorFlag","href","errorFlag","body","trigger","changeInfo","querySelectorAll","map","filter","applyComponentListChange","onUpdatedCheckout","catch","state","updateLongId","_getListInput","startPayment","selectedComponentName","componentToPayWith","pay","on","result","redirect","setTimeout","removeClass","unblock","$form","preventDefault","stopImmediatePropagation","block","message","overlayCSS","background","opacity","type","wc_checkout_params","ajax_url","xhrFields","withCredentials","dataType","action","fields","serialize","params","always","scrollTo","reload"],"sourceRoot":""}