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/webpack/runtime/chunk loaded","webpack://wcStripeModules/./assets/js/frontend/bnpl-messages/afterpay/afterpay-mixin.js","webpack://wcStripeModules/./assets/js/frontend/bnpl-messages/afterpay/index.js","webpack://wcStripeModules/external window [\"wcStripeModules\",\"checkoutModules\"]","webpack://wcStripeModules/external window [\"wcStripeModules\",\"messageModules\"]","webpack://wcStripeModules/external window [\"wc_stripe\"]","webpack://wcStripeModules/webpack/bootstrap","webpack://wcStripeModules/webpack/runtime/hasOwnProperty shorthand","webpack://wcStripeModules/webpack/runtime/jsonp chunk loading","webpack://wcStripeModules/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","export default function (Base) {\n return class Afterpay extends Base {\n\n getMessageOptions() {\n return {\n ...super.getMessageOptions(),\n isEligible: this.isEligible(this.getTotalPrice())\n }\n }\n\n isEligible(price) {\n return (price >= this.getMin() && price <= this.getMax());\n }\n\n getMin() {\n const currency = this.gateway.get_currency();\n const params = this.gateway.params.requirements[currency];\n return params ? params[1] : 0;\n }\n\n getMax() {\n const currency = this.gateway.get_currency();\n const params = this.gateway.params.requirements[currency];\n return params ? params[2] : 0;\n }\n }\n}\n\n","import {BaseGateway, ProductGateway, stripe} from '@paymentplugins/wc-stripe';\nimport {getPaymentMethod} from '@paymentplugins/wc-stripe/checkout';\nimport {\n CartMessage,\n CheckoutMessage,\n CategoryMessage,\n ProductMessage\n} from '@paymentplugins/wc-stripe/message-modules';\nimport Mixin from './afterpay-mixin';\n\nconst elementType = 'afterpayClearpayMessage';\nconst isSupported = (gateway) => {\n const {currencies = [], currency} = gateway.params;\n return currencies.includes(currency);\n}\n\nclass AfterpayGateway extends BaseGateway {\n constructor(params) {\n super(params);\n }\n};\n\nif (typeof wc_stripe_afterpay_cart_params !== 'undefined') {\n const clazz = Mixin(CartMessage);\n new clazz(new AfterpayGateway(wc_stripe_afterpay_cart_params), {\n elementType,\n elementId: 'wc-stripe-afterpay-cart-msg',\n containerId: 'wc-stripe-afterpay-cart-container',\n isSupported\n });\n}\nif (typeof wc_stripe_afterpay_product_params !== 'undefined') {\n Object.assign(AfterpayGateway.prototype, ProductGateway.prototype);\n new ProductMessage(new AfterpayGateway(wc_stripe_afterpay_product_params), {\n elementType,\n elementId: 'wc-stripe-afterpay-product-msg',\n isSupported\n });\n}\nif (typeof wc_stripe_local_payment_params !== 'undefined') {\n if (wc_stripe_local_payment_params?.gateways?.stripe_afterpay) {\n const clazz = Mixin(CheckoutMessage);\n new clazz(getPaymentMethod('stripe_afterpay'), {\n elementType,\n elementId: 'wc-stripe-afterpay-message-container',\n isSupported\n });\n }\n}\nif (typeof wc_stripe_bnpl_shop_params !== 'undefined') {\n new CategoryMessage(stripe, wc_stripe_bnpl_shop_params, {\n id: 'stripe_afterpay',\n elementType,\n isSupported: (instance) => {\n const {currency} = instance.data;\n return instance.data.stripe_afterpay.supportedCurrencies.includes(currency);\n },\n isSupportedProduct: (instance, product) => {\n const price = product.price;\n const {currency} = instance.data;\n const {hideIneligible} = instance.data.stripe_afterpay;\n const [country, min, max] = instance.data[instance.id].requiredParams[currency];\n return !hideIneligible || min <= price && price <= max;\n }\n });\n}","module.exports = window[\"wcStripeModules\"][\"checkoutModules\"];","module.exports = window[\"wcStripeModules\"][\"messageModules\"];","module.exports = window[\"wc_stripe\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t28: 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkwcStripeModules\"] = self[\"webpackChunkwcStripeModules\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [96], () => (__webpack_require__(891)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["deferred","Base","_Base","Afterpay","_classCallCheck2","default","arguments","_inherits2","_createClass2","key","value","_objectSpread","_get2","_getPrototypeOf2","prototype","call","isEligible","this","getTotalPrice","price","getMin","getMax","currency","gateway","get_currency","params","requirements","_wcStripe","require","_checkout","_messageModules","_afterpayMixin","_interopRequireDefault","_callSuper","t","o","e","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","valueOf","_wc_stripe_local_paym","elementType","isSupported","_gateway$params","_gateway$params$curre","currencies","includes","AfterpayGateway","_BaseGateway","BaseGateway","wc_stripe_afterpay_cart_params","Mixin","CartMessage","elementId","containerId","wc_stripe_afterpay_product_params","Object","assign","ProductGateway","ProductMessage","wc_stripe_local_payment_params","gateways","stripe_afterpay","CheckoutMessage","getPaymentMethod","wc_stripe_bnpl_shop_params","CategoryMessage","stripe","id","instance","data","supportedCurrencies","isSupportedProduct","product","hideIneligible","_instance$data$instan","_slicedToArray2","requiredParams","min","max","module","exports","window","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","m","O","result","chunkIds","fn","priority","notFulfilled","Infinity","i","length","fulfilled","j","keys","every","splice","r","obj","prop","hasOwnProperty","installedChunks","chunkId","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","chunkLoadingGlobal","self","forEach","bind","push","__webpack_exports__"],"sourceRoot":""}