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C,EAAAT,OAAA4C,0BAAArC,IAAAwB,EAAA/B,OAAAO,IAAAkC,SAAA,SAAAjC,GAAAR,OAAAC,eAAAQ,EAAAD,EAAAR,OAAAmC,yBAAA5B,EAAAC,GAAA,WAAAC,CAAA,CAEvE,IAAMqC,EAAoB,SAACrC,GAGvBsC,EAAAA,iBAASN,SAAQ,SAAAO,GACTA,EAAQC,sBAERD,EAAQC,sBAGhB,GACJ,GASA,EAAAC,EAAAA,UAAE,WACMH,EAAAA,iBAASP,SAETO,EAAAA,iBAASN,SAAQ,SAAAO,GAEb,IAAMG,EAAmBH,EAAQI,qBACjCJ,EAAQI,qBAAuB,WAC3B,OAAAd,EAAAA,EAAA,GACOa,EAAiBtC,KAAKmC,KAd5B,EAAAE,EAAAA,SAAE,yBAAyBG,iBAAiBC,QAAO,SAACC,EAAO1D,GACpE,OAAAyC,EAAAA,EAAA,GAAWiB,GAAK,MAAAb,EAAAC,SAAA,GAAG9C,EAAI2D,KAAO3D,EAAIE,OACtC,GAAG,CAAC,GAeI,CACJ,KAEA,EAAAmD,EAAAA,SAAEO,SAASC,MAAMC,GAAG,SAAU,wBAAyBb,GAE/D,G","sources":["webpack://wc_stripe/external window \"jQuery\"","webpack://wc_stripe/external window [\"wc_stripe\"]","webpack://wc_stripe/./node_modules/@babel/runtime/helpers/defineProperty.js","webpack://wc_stripe/./node_modules/@babel/runtime/helpers/interopRequireDefault.js","webpack://wc_stripe/./node_modules/@babel/runtime/helpers/toPrimitive.js","webpack://wc_stripe/./node_modules/@babel/runtime/helpers/toPropertyKey.js","webpack://wc_stripe/./node_modules/@babel/runtime/helpers/typeof.js","webpack://wc_stripe/webpack/bootstrap","webpack://wc_stripe/./packages/woocommerce-tm-extra-product-options/assets/js/product.js"],"sourcesContent":["module.exports = window[\"jQuery\"];","module.exports = window[\"wc_stripe\"];","var toPropertyKey = require(\"./toPropertyKey.js\");\nfunction _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\nmodule.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nmodule.exports = toPrimitive, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nvar toPrimitive = require(\"./toPrimitive.js\");\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nmodule.exports = toPropertyKey, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _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 }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(o);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// 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","import $ from 'jquery';\nimport {product_gateways as gateways} from '@paymentplugins/wc-stripe';\n\nconst handleFieldChange = (e) => {\n let tmcpCalculation = false;\n // when a extra product option field changes, update the cart calculation\n gateways.forEach(gateway => {\n if (gateway.maybe_calculate_cart) {\n tmcpCalculation = true;\n gateway.maybe_calculate_cart();\n tmcpCalculation = false;\n }\n });\n}\n\nconst getExtraProductData = () => {\n const data = $('form.cart .tmcp-field').serializeArray().reduce((carry, obj) => {\n return {...carry, [obj.name]: obj.value};\n }, {});\n return data;\n}\n\n$(() => {\n if (gateways.length) {\n\n gateways.forEach(gateway => {\n // add to cart data function wrapper\n const getAddToCartData = gateway.get_add_to_cart_data;\n gateway.get_add_to_cart_data = () => {\n return {\n ...getAddToCartData.call(gateway),\n ...getExtraProductData()\n }\n }\n });\n\n $(document.body).on('change', 'form.cart .tmcp-field', handleFieldChange);\n }\n})"],"names":["module","exports","window","toPropertyKey","obj","key","value","Object","defineProperty","enumerable","configurable","writable","__esModule","_typeof","t","r","e","Symbol","toPrimitive","i","call","TypeError","String","Number","o","iterator","constructor","prototype","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","_jquery","_interopRequireDefault","require","_wcStripe","ownKeys","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","handleFieldChange","gateways","gateway","maybe_calculate_cart","$","getAddToCartData","get_add_to_cart_data","serializeArray","reduce","carry","name","document","body","on"],"sourceRoot":""}