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C,KAAF,IAAa;AAC1B,QAAM;AAAEC,IAAAA;AAAF,MAAyBD,KAAK,CAACE,UAArC;AACA,SAAO,kEAAC,kBAAD;AAAoB,QAAI,EAAG3B;AAA3B,IAAP;AACA,CAHD;AAKA;AACD;AACA;;;AACC,MAAM4B,qBAAqB,GAAG;AAC7BC,EAAAA,IAAI,EAAEvC,2DADuB;AAE7BU,EAAAA,KAAK,EAAE,kEAAC,KAAD,OAFsB;AAG7B8B,EAAAA,OAAO,EAAE,kEAAC,eAAD,OAHoB;AAI7BC,EAAAA,IAAI,EAAE,kEAAC,eAAD,OAJuB;AAK7BC,EAAAA,cAAc,EAAE,MAAM,IALO;AAM7BC,EAAAA,eAAe,EAAE3C,2DANY;AAO7B4C,EAAAA,QAAQ,EAAE;AACTC,IAAAA,QAAQ,EAAE,CAAE,UAAF;AADD,GAPmB;AAU7BC,EAAAA,SAAS,EAAEpC;AAVkB,CAA9B;AAaAP,mFAAqB,CAAEmC,qBAAF,CAArB,C","sources":["webpack://zipmoney-payments-woocommerce/./client/blocks/constants.js","webpack://zipmoney-payments-woocommerce/external window [\"wc\",\"wcBlocksRegistry\"]","webpack://zipmoney-payments-woocommerce/external window [\"wc\",\"wcSettings\"]","webpack://zipmoney-payments-woocommerce/external window [\"wp\",\"element\"]","webpack://zipmoney-payments-woocommerce/external window [\"wp\",\"i18n\"]","webpack://zipmoney-payments-woocommerce/webpack/bootstrap","webpack://zipmoney-payments-woocommerce/webpack/runtime/compat get default export","webpack://zipmoney-payments-woocommerce/webpack/runtime/define property getters","webpack://zipmoney-payments-woocommerce/webpack/runtime/hasOwnProperty shorthand","webpack://zipmoney-payments-woocommerce/webpack/runtime/make namespace object","webpack://zipmoney-payments-woocommerce/./client/blocks/index.js"],"sourcesContent":["export const PAYMENT_METHOD_NAME = 'zipmoney';\r\n","module.exports = window[\"wc\"][\"wcBlocksRegistry\"];","module.exports = window[\"wc\"][\"wcSettings\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// 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","// 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); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\r\n * External dependencies\r\n */\r\n import { __ } from '@wordpress/i18n';\r\n import { getSetting } from '@woocommerce/settings';\r\n import { registerPaymentMethod } from '@woocommerce/blocks-registry';\r\n import { useEffect, useState } from '@wordpress/element';\r\n \r\n /**\r\n  * Internal dependencies\r\n  */\r\n import { PAYMENT_METHOD_NAME } from './constants';\r\n \r\n const settings = getSetting( 'zipmoney_data', {} );\r\n console.log('zip settings:'.settings);\r\n const defaultLabel = __( 'Zip now, pay later', 'zippayment' );\r\n const label = settings.title ? settings.title : defaultLabel;\r\n \r\n /**\r\n  * @typedef {import('@woocommerce/type-defs/registered-payment-method-props').RegisteredPaymentMethodProps} RegisteredPaymentMethodProps\r\n  */\r\n \r\n const saveZip = () => {\r\n\t return settings.savezip;\r\n }\r\n \r\n const SaveZipCheckbox = () => {\r\n\tconst [ isChecked, setChecked ] = useState( saveZip );\r\n\tconst handleChange = (event) => {\r\n\t\tsetChecked(!isChecked);\r\n\t\tlet formData = new FormData();\r\n            formData.append(\"savezipaccount\", !isChecked);\r\n\t\tconst requestOptions = {\r\n\t\t\tmethod: 'POST',\r\n\t\t\tbody: formData\r\n\t\t};\r\n\t\tfetch(settings.sessionUrl, requestOptions)\r\n\t\t\t.then(response => response.json());\r\n\t  };\r\n\t  useEffect(() => {\r\n\t\tZip.Widget.render();\r\n\t  }, []);\r\n\t  if(settings.tokenisation === true) {\r\n\treturn (\r\n\t\t<>\r\n\t\t\t{ ' ' }\r\n\t\t\t<div class=\"zip-overlay\" onclick=\"this.style.display = 'none';\">\r\n    \t\t\t<div class=\"zip-overlay-text\">Creating charge, please wait...</div>\r\n\t\t\t</div>\r\n\t\t\t<a  id=\"zipmoney-learn-more\" class=\"zip-hover\"  zm-widget=\"popup\"  zm-popup-asset=\"checkoutdialog\">Learn More</a>\r\n\t\t\t<input\r\n\t\t\t\ttype=\"checkbox\"\r\n\t\t\t\trel=\"saveZipAccount\"\r\n\t\t\t\tvalue=\"{isChecked}\"\r\n\t\t\t\tid=\"saveZipAccount\"\r\n\t\t\t\tchecked={ isChecked }\r\n\t\t\t\tonChange={ handleChange }\r\n\t\t\t\tdisabled={ false }\r\n\r\n\t\t\t/>\r\n\t\t\t<label className='save-zip-account' htmlFor={ \"saveZipAccount\" }>\r\n\t\t\t\t\t\t\t\t{ \"Save Zip Account for future purchases\" }\r\n\t\t\t</label>\r\n\t\t</>\t\r\n\t\t\r\n\t);\r\n\t  }\r\n\t return (\r\n\t\t<>\r\n\t\t{ ' ' }\r\n\t\t<div class=\"zip-overlay\" onclick=\"this.style.display = 'none';\">\r\n    \t\t<div class=\"zip-overlay-text\">Creating charge, please wait...</div>\r\n\t\t</div>\r\n\t\t<a  id=\"zipmoney-learn-more\" class=\"zip-hover\"  zm-widget=\"popup\"  zm-popup-asset=\"checkoutdialog\">Learn More</a>\r\n\t\t</>\r\n\t ); \r\n};\r\n\r\n /**\r\n  * Label component\r\n  *\r\n  * @param {*} props Props from payment API.\r\n  */\r\n const Label = ( props ) => {\r\n\t const { PaymentMethodLabel } = props.components;\r\n\t return <PaymentMethodLabel text={ label } />;\r\n };\r\n \r\n /**\r\n  * Zipmoney payment method config object.\r\n  */\r\n const zipMoneyPaymentMethod = {\r\n\t name: PAYMENT_METHOD_NAME,\r\n\t label: <Label />,\r\n\t content: <SaveZipCheckbox />,\r\n\t edit: <SaveZipCheckbox />,\r\n\t canMakePayment: () => true,\r\n\t paymentMethodId: PAYMENT_METHOD_NAME,\r\n\t supports: {\r\n\t\t features: [ 'products' ],\r\n\t },\r\n\t ariaLabel: label,\r\n };\r\n \r\n registerPaymentMethod( zipMoneyPaymentMethod );\r\n "],"names":["PAYMENT_METHOD_NAME","__","getSetting","registerPaymentMethod","useEffect","useState","settings","console","log","defaultLabel","label","title","saveZip","savezip","SaveZipCheckbox","isChecked","setChecked","handleChange","event","formData","FormData","append","requestOptions","method","body","fetch","sessionUrl","then","response","json","Zip","Widget","render","tokenisation","Label","props","PaymentMethodLabel","components","zipMoneyPaymentMethod","name","content","edit","canMakePayment","paymentMethodId","supports","features","ariaLabel"],"sourceRoot":""}