@paydock/client-sdk 1.121.0 → 1.122.2-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +283 -1
  2. package/bundles/index.cjs +2067 -93
  3. package/bundles/index.cjs.d.ts +349 -6
  4. package/bundles/index.mjs +2067 -93
  5. package/bundles/index.mjs.d.ts +349 -6
  6. package/bundles/types/checkout/checkout.d.ts +2 -0
  7. package/bundles/types/checkout/checkout.d.ts.map +1 -1
  8. package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts.map +1 -1
  9. package/bundles/types/checkout/layout-widgets/payment-methods.d.ts.map +1 -1
  10. package/bundles/types/checkout/layout-widgets/payment-template.d.ts +1 -1
  11. package/bundles/types/checkout/layout-widgets/payment-template.d.ts.map +1 -1
  12. package/bundles/types/components/link.d.ts +1 -1
  13. package/bundles/types/components/link.d.ts.map +1 -1
  14. package/bundles/types/components/wallet-background.d.ts.map +1 -1
  15. package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts.map +1 -1
  16. package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -1
  17. package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts.map +1 -1
  18. package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts.map +1 -1
  19. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +70 -13
  20. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -1
  21. package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts +3 -1
  22. package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts.map +1 -1
  23. package/bundles/types/wallet-buttons-express/index.d.ts +109 -1
  24. package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
  25. package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts +30 -0
  26. package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts.map +1 -1
  27. package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts +2 -2
  28. package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts.map +1 -1
  29. package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts +2 -2
  30. package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts.map +1 -1
  31. package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts +2 -2
  32. package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts.map +1 -1
  33. package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts +2 -2
  34. package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts.map +1 -1
  35. package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts +2 -2
  36. package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts.map +1 -1
  37. package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts +2 -2
  38. package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts.map +1 -1
  39. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-data.interface.d.ts +21 -0
  40. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-data.interface.d.ts.map +1 -0
  41. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-response.interface.d.ts +9 -0
  42. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-response.interface.d.ts.map +1 -0
  43. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-data.interface.d.ts +13 -0
  44. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-data.interface.d.ts.map +1 -0
  45. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-response.interface.d.ts +9 -0
  46. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-response.interface.d.ts.map +1 -0
  47. package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts +2 -2
  48. package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts.map +1 -1
  49. package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts +7 -0
  50. package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -1
  51. package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-events.constant.d.ts +5 -0
  52. package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-events.constant.d.ts.map +1 -0
  53. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +7 -3
  54. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -1
  55. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-contact-editing-mode.type.d.ts +5 -0
  56. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-contact-editing-mode.type.d.ts.map +1 -0
  57. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts +21 -0
  58. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts.map +1 -0
  59. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-method.type.d.ts +21 -0
  60. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-method.type.d.ts.map +1 -0
  61. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-sdk.interface.d.ts +164 -0
  62. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-sdk.interface.d.ts.map +1 -0
  63. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +1 -1
  64. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
  65. package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts +9 -3
  66. package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -1
  67. package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts +6 -0
  68. package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts.map +1 -0
  69. package/bundles/widget.umd.js +2069 -93
  70. package/bundles/widget.umd.js.d.ts +349 -6
  71. package/bundles/widget.umd.js.min.d.ts +349 -6
  72. package/bundles/widget.umd.min.js +1 -1
  73. package/docs/wallet-buttons-express.md +283 -1
  74. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('isomorphic-dompurify')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'isomorphic-dompurify'], factory) :
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.paydock = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
@@ -929,7 +929,7 @@
929
929
  version: 'x-sdk-version',
930
930
  type: 'x-sdk-type'
931
931
  });
932
- SDK._version = 'v1.121.0';
932
+ SDK._version = 'v1.122.2-beta';
933
933
 
934
934
  /******************************************************************************
935
935
  Copyright (c) Microsoft Corporation.
@@ -4205,8 +4205,8 @@
4205
4205
  var params = {
4206
4206
  enabled: 'true',
4207
4207
  accountId: '974691',
4208
- agentId: '1386157152',
4209
- applicationId: '1386157152',
4208
+ agentId: '1386157150',
4209
+ applicationId: '1386157150',
4210
4210
  licenseKey: '4848a32285',
4211
4211
  trustKey: '974691'
4212
4212
  };
@@ -4714,7 +4714,7 @@
4714
4714
  var PAYMENT_SOURCE_LINK = '/payment-sources';
4715
4715
  var SECURE_3D = '/3ds/webhook';
4716
4716
  var FLYPAY_LINK = '/wallet/flypay';
4717
- var FLYPAY_LOGO_LINK = '/images/logo.png';
4717
+ var FLYPAY_LOGO_LINK = '/images/coles-pay-logo.png';
4718
4718
  var MESSAGE_WIDGET_LINK = '/message-widget';
4719
4719
  var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
4720
4720
  var Link = /*#__PURE__*/function () {
@@ -10085,6 +10085,10 @@
10085
10085
  resolve(res);
10086
10086
  },
10087
10087
  onError: function onError(message) {
10088
+ console.error('Error generating order id', message);
10089
+ _this5.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
10090
+ message: message
10091
+ });
10088
10092
  reject(message);
10089
10093
  }
10090
10094
  });
@@ -10138,6 +10142,1581 @@
10138
10142
  }]);
10139
10143
  }(WalletService);
10140
10144
 
10145
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10146
+
10147
+ var purify = {exports: {}};
10148
+
10149
+ /*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
10150
+
10151
+ var hasRequiredPurify;
10152
+
10153
+ function requirePurify () {
10154
+ if (hasRequiredPurify) return purify.exports;
10155
+ hasRequiredPurify = 1;
10156
+ (function (module, exports) {
10157
+ (function (global, factory) {
10158
+ module.exports = factory() ;
10159
+ })(commonjsGlobal, (function () {
10160
+ const {
10161
+ entries,
10162
+ setPrototypeOf,
10163
+ isFrozen,
10164
+ getPrototypeOf,
10165
+ getOwnPropertyDescriptor
10166
+ } = Object;
10167
+ let {
10168
+ freeze,
10169
+ seal,
10170
+ create
10171
+ } = Object; // eslint-disable-line import/no-mutable-exports
10172
+ let {
10173
+ apply,
10174
+ construct
10175
+ } = typeof Reflect !== 'undefined' && Reflect;
10176
+ if (!freeze) {
10177
+ freeze = function freeze(x) {
10178
+ return x;
10179
+ };
10180
+ }
10181
+ if (!seal) {
10182
+ seal = function seal(x) {
10183
+ return x;
10184
+ };
10185
+ }
10186
+ if (!apply) {
10187
+ apply = function apply(fun, thisValue, args) {
10188
+ return fun.apply(thisValue, args);
10189
+ };
10190
+ }
10191
+ if (!construct) {
10192
+ construct = function construct(Func, args) {
10193
+ return new Func(...args);
10194
+ };
10195
+ }
10196
+ const arrayForEach = unapply(Array.prototype.forEach);
10197
+ const arrayPop = unapply(Array.prototype.pop);
10198
+ const arrayPush = unapply(Array.prototype.push);
10199
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
10200
+ const stringToString = unapply(String.prototype.toString);
10201
+ const stringMatch = unapply(String.prototype.match);
10202
+ const stringReplace = unapply(String.prototype.replace);
10203
+ const stringIndexOf = unapply(String.prototype.indexOf);
10204
+ const stringTrim = unapply(String.prototype.trim);
10205
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
10206
+ const regExpTest = unapply(RegExp.prototype.test);
10207
+ const typeErrorCreate = unconstruct(TypeError);
10208
+
10209
+ /**
10210
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
10211
+ *
10212
+ * @param {Function} func - The function to be wrapped and called.
10213
+ * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.
10214
+ */
10215
+ function unapply(func) {
10216
+ return function (thisArg) {
10217
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
10218
+ args[_key - 1] = arguments[_key];
10219
+ }
10220
+ return apply(func, thisArg, args);
10221
+ };
10222
+ }
10223
+
10224
+ /**
10225
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
10226
+ *
10227
+ * @param {Function} func - The constructor function to be wrapped and called.
10228
+ * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.
10229
+ */
10230
+ function unconstruct(func) {
10231
+ return function () {
10232
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
10233
+ args[_key2] = arguments[_key2];
10234
+ }
10235
+ return construct(func, args);
10236
+ };
10237
+ }
10238
+
10239
+ /**
10240
+ * Add properties to a lookup table
10241
+ *
10242
+ * @param {Object} set - The set to which elements will be added.
10243
+ * @param {Array} array - The array containing elements to be added to the set.
10244
+ * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.
10245
+ * @returns {Object} The modified set with added elements.
10246
+ */
10247
+ function addToSet(set, array) {
10248
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
10249
+ if (setPrototypeOf) {
10250
+ // Make 'in' and truthy checks like Boolean(set.constructor)
10251
+ // independent of any properties defined on Object.prototype.
10252
+ // Prevent prototype setters from intercepting set as a this value.
10253
+ setPrototypeOf(set, null);
10254
+ }
10255
+ let l = array.length;
10256
+ while (l--) {
10257
+ let element = array[l];
10258
+ if (typeof element === 'string') {
10259
+ const lcElement = transformCaseFunc(element);
10260
+ if (lcElement !== element) {
10261
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
10262
+ if (!isFrozen(array)) {
10263
+ array[l] = lcElement;
10264
+ }
10265
+ element = lcElement;
10266
+ }
10267
+ }
10268
+ set[element] = true;
10269
+ }
10270
+ return set;
10271
+ }
10272
+
10273
+ /**
10274
+ * Clean up an array to harden against CSPP
10275
+ *
10276
+ * @param {Array} array - The array to be cleaned.
10277
+ * @returns {Array} The cleaned version of the array
10278
+ */
10279
+ function cleanArray(array) {
10280
+ for (let index = 0; index < array.length; index++) {
10281
+ const isPropertyExist = objectHasOwnProperty(array, index);
10282
+ if (!isPropertyExist) {
10283
+ array[index] = null;
10284
+ }
10285
+ }
10286
+ return array;
10287
+ }
10288
+
10289
+ /**
10290
+ * Shallow clone an object
10291
+ *
10292
+ * @param {Object} object - The object to be cloned.
10293
+ * @returns {Object} A new object that copies the original.
10294
+ */
10295
+ function clone(object) {
10296
+ const newObject = create(null);
10297
+ for (const [property, value] of entries(object)) {
10298
+ const isPropertyExist = objectHasOwnProperty(object, property);
10299
+ if (isPropertyExist) {
10300
+ if (Array.isArray(value)) {
10301
+ newObject[property] = cleanArray(value);
10302
+ } else if (value && typeof value === 'object' && value.constructor === Object) {
10303
+ newObject[property] = clone(value);
10304
+ } else {
10305
+ newObject[property] = value;
10306
+ }
10307
+ }
10308
+ }
10309
+ return newObject;
10310
+ }
10311
+
10312
+ /**
10313
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
10314
+ *
10315
+ * @param {Object} object - The object to look up the getter function in its prototype chain.
10316
+ * @param {String} prop - The property name for which to find the getter function.
10317
+ * @returns {Function} The getter function found in the prototype chain or a fallback function.
10318
+ */
10319
+ function lookupGetter(object, prop) {
10320
+ while (object !== null) {
10321
+ const desc = getOwnPropertyDescriptor(object, prop);
10322
+ if (desc) {
10323
+ if (desc.get) {
10324
+ return unapply(desc.get);
10325
+ }
10326
+ if (typeof desc.value === 'function') {
10327
+ return unapply(desc.value);
10328
+ }
10329
+ }
10330
+ object = getPrototypeOf(object);
10331
+ }
10332
+ function fallbackValue() {
10333
+ return null;
10334
+ }
10335
+ return fallbackValue;
10336
+ }
10337
+
10338
+ const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
10339
+
10340
+ // SVG
10341
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
10342
+ const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
10343
+
10344
+ // List of SVG elements that are disallowed by default.
10345
+ // We still need to know them so that we can do namespace
10346
+ // checks properly in case one wants to add them to
10347
+ // allow-list.
10348
+ const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
10349
+ const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);
10350
+
10351
+ // Similarly to SVG, we want to know all MathML elements,
10352
+ // even those that we disallow by default.
10353
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
10354
+ const text = freeze(['#text']);
10355
+
10356
+ const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
10357
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
10358
+ const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
10359
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
10360
+
10361
+ // eslint-disable-next-line unicorn/better-regex
10362
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
10363
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
10364
+ const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
10365
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
10366
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
10367
+ const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
10368
+ );
10369
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
10370
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
10371
+ );
10372
+ const DOCTYPE_NAME = seal(/^html$/i);
10373
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
10374
+
10375
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
10376
+ __proto__: null,
10377
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
10378
+ ERB_EXPR: ERB_EXPR,
10379
+ TMPLIT_EXPR: TMPLIT_EXPR,
10380
+ DATA_ATTR: DATA_ATTR,
10381
+ ARIA_ATTR: ARIA_ATTR,
10382
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
10383
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
10384
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
10385
+ DOCTYPE_NAME: DOCTYPE_NAME,
10386
+ CUSTOM_ELEMENT: CUSTOM_ELEMENT
10387
+ });
10388
+
10389
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
10390
+ const NODE_TYPE = {
10391
+ element: 1,
10392
+ attribute: 2,
10393
+ text: 3,
10394
+ cdataSection: 4,
10395
+ entityReference: 5,
10396
+ // Deprecated
10397
+ entityNode: 6,
10398
+ // Deprecated
10399
+ progressingInstruction: 7,
10400
+ comment: 8,
10401
+ document: 9,
10402
+ documentType: 10,
10403
+ documentFragment: 11,
10404
+ notation: 12 // Deprecated
10405
+ };
10406
+ const getGlobal = function getGlobal() {
10407
+ return typeof window === 'undefined' ? null : window;
10408
+ };
10409
+
10410
+ /**
10411
+ * Creates a no-op policy for internal use only.
10412
+ * Don't export this function outside this module!
10413
+ * @param {TrustedTypePolicyFactory} trustedTypes The policy factory.
10414
+ * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
10415
+ * @return {TrustedTypePolicy} The policy created (or null, if Trusted Types
10416
+ * are not supported or creating the policy failed).
10417
+ */
10418
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
10419
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
10420
+ return null;
10421
+ }
10422
+
10423
+ // Allow the callers to control the unique policy name
10424
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
10425
+ // Policy creation with duplicate names throws in Trusted Types.
10426
+ let suffix = null;
10427
+ const ATTR_NAME = 'data-tt-policy-suffix';
10428
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
10429
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
10430
+ }
10431
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
10432
+ try {
10433
+ return trustedTypes.createPolicy(policyName, {
10434
+ createHTML(html) {
10435
+ return html;
10436
+ },
10437
+ createScriptURL(scriptUrl) {
10438
+ return scriptUrl;
10439
+ }
10440
+ });
10441
+ } catch (_) {
10442
+ // Policy creation failed (most likely another DOMPurify script has
10443
+ // already run). Skip creating the policy, as this will only cause errors
10444
+ // if TT are enforced.
10445
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
10446
+ return null;
10447
+ }
10448
+ };
10449
+ function createDOMPurify() {
10450
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
10451
+ const DOMPurify = root => createDOMPurify(root);
10452
+
10453
+ /**
10454
+ * Version label, exposed for easier checks
10455
+ * if DOMPurify is up to date or not
10456
+ */
10457
+ DOMPurify.version = '3.1.6';
10458
+
10459
+ /**
10460
+ * Array of elements that DOMPurify removed during sanitation.
10461
+ * Empty if nothing was removed.
10462
+ */
10463
+ DOMPurify.removed = [];
10464
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) {
10465
+ // Not running in a browser, provide a factory function
10466
+ // so that you can pass your own Window
10467
+ DOMPurify.isSupported = false;
10468
+ return DOMPurify;
10469
+ }
10470
+ let {
10471
+ document
10472
+ } = window;
10473
+ const originalDocument = document;
10474
+ const currentScript = originalDocument.currentScript;
10475
+ const {
10476
+ DocumentFragment,
10477
+ HTMLTemplateElement,
10478
+ Node,
10479
+ Element,
10480
+ NodeFilter,
10481
+ NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
10482
+ HTMLFormElement,
10483
+ DOMParser,
10484
+ trustedTypes
10485
+ } = window;
10486
+ const ElementPrototype = Element.prototype;
10487
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
10488
+ const remove = lookupGetter(ElementPrototype, 'remove');
10489
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
10490
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
10491
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
10492
+
10493
+ // As per issue #47, the web-components registry is inherited by a
10494
+ // new document created via createHTMLDocument. As per the spec
10495
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
10496
+ // a new empty registry is used when creating a template contents owner
10497
+ // document, so we use that as our parent document to ensure nothing
10498
+ // is inherited.
10499
+ if (typeof HTMLTemplateElement === 'function') {
10500
+ const template = document.createElement('template');
10501
+ if (template.content && template.content.ownerDocument) {
10502
+ document = template.content.ownerDocument;
10503
+ }
10504
+ }
10505
+ let trustedTypesPolicy;
10506
+ let emptyHTML = '';
10507
+ const {
10508
+ implementation,
10509
+ createNodeIterator,
10510
+ createDocumentFragment,
10511
+ getElementsByTagName
10512
+ } = document;
10513
+ const {
10514
+ importNode
10515
+ } = originalDocument;
10516
+ let hooks = {};
10517
+
10518
+ /**
10519
+ * Expose whether this browser supports running the full DOMPurify.
10520
+ */
10521
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
10522
+ const {
10523
+ MUSTACHE_EXPR,
10524
+ ERB_EXPR,
10525
+ TMPLIT_EXPR,
10526
+ DATA_ATTR,
10527
+ ARIA_ATTR,
10528
+ IS_SCRIPT_OR_DATA,
10529
+ ATTR_WHITESPACE,
10530
+ CUSTOM_ELEMENT
10531
+ } = EXPRESSIONS;
10532
+ let {
10533
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
10534
+ } = EXPRESSIONS;
10535
+
10536
+ /**
10537
+ * We consider the elements and attributes below to be safe. Ideally
10538
+ * don't add any new ones but feel free to remove unwanted ones.
10539
+ */
10540
+
10541
+ /* allowed element names */
10542
+ let ALLOWED_TAGS = null;
10543
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
10544
+
10545
+ /* Allowed attribute names */
10546
+ let ALLOWED_ATTR = null;
10547
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
10548
+
10549
+ /*
10550
+ * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
10551
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
10552
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
10553
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
10554
+ */
10555
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
10556
+ tagNameCheck: {
10557
+ writable: true,
10558
+ configurable: false,
10559
+ enumerable: true,
10560
+ value: null
10561
+ },
10562
+ attributeNameCheck: {
10563
+ writable: true,
10564
+ configurable: false,
10565
+ enumerable: true,
10566
+ value: null
10567
+ },
10568
+ allowCustomizedBuiltInElements: {
10569
+ writable: true,
10570
+ configurable: false,
10571
+ enumerable: true,
10572
+ value: false
10573
+ }
10574
+ }));
10575
+
10576
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
10577
+ let FORBID_TAGS = null;
10578
+
10579
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
10580
+ let FORBID_ATTR = null;
10581
+
10582
+ /* Decide if ARIA attributes are okay */
10583
+ let ALLOW_ARIA_ATTR = true;
10584
+
10585
+ /* Decide if custom data attributes are okay */
10586
+ let ALLOW_DATA_ATTR = true;
10587
+
10588
+ /* Decide if unknown protocols are okay */
10589
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
10590
+
10591
+ /* Decide if self-closing tags in attributes are allowed.
10592
+ * Usually removed due to a mXSS issue in jQuery 3.0 */
10593
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
10594
+
10595
+ /* Output should be safe for common template engines.
10596
+ * This means, DOMPurify removes data attributes, mustaches and ERB
10597
+ */
10598
+ let SAFE_FOR_TEMPLATES = false;
10599
+
10600
+ /* Output should be safe even for XML used within HTML and alike.
10601
+ * This means, DOMPurify removes comments when containing risky content.
10602
+ */
10603
+ let SAFE_FOR_XML = true;
10604
+
10605
+ /* Decide if document with <html>... should be returned */
10606
+ let WHOLE_DOCUMENT = false;
10607
+
10608
+ /* Track whether config is already set on this instance of DOMPurify. */
10609
+ let SET_CONFIG = false;
10610
+
10611
+ /* Decide if all elements (e.g. style, script) must be children of
10612
+ * document.body. By default, browsers might move them to document.head */
10613
+ let FORCE_BODY = false;
10614
+
10615
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
10616
+ * string (or a TrustedHTML object if Trusted Types are supported).
10617
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
10618
+ */
10619
+ let RETURN_DOM = false;
10620
+
10621
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
10622
+ * string (or a TrustedHTML object if Trusted Types are supported) */
10623
+ let RETURN_DOM_FRAGMENT = false;
10624
+
10625
+ /* Try to return a Trusted Type object instead of a string, return a string in
10626
+ * case Trusted Types are not supported */
10627
+ let RETURN_TRUSTED_TYPE = false;
10628
+
10629
+ /* Output should be free from DOM clobbering attacks?
10630
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
10631
+ */
10632
+ let SANITIZE_DOM = true;
10633
+
10634
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
10635
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
10636
+ *
10637
+ * HTML/DOM spec rules that enable DOM Clobbering:
10638
+ * - Named Access on Window (§7.3.3)
10639
+ * - DOM Tree Accessors (§3.1.5)
10640
+ * - Form Element Parent-Child Relations (§4.10.3)
10641
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
10642
+ * - HTMLCollection (§4.2.10.2)
10643
+ *
10644
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
10645
+ * with a constant string, i.e., `user-content-`
10646
+ */
10647
+ let SANITIZE_NAMED_PROPS = false;
10648
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
10649
+
10650
+ /* Keep element content when removing element? */
10651
+ let KEEP_CONTENT = true;
10652
+
10653
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
10654
+ * of importing it into a new Document and returning a sanitized copy */
10655
+ let IN_PLACE = false;
10656
+
10657
+ /* Allow usage of profiles like html, svg and mathMl */
10658
+ let USE_PROFILES = {};
10659
+
10660
+ /* Tags to ignore content of when KEEP_CONTENT is true */
10661
+ let FORBID_CONTENTS = null;
10662
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
10663
+
10664
+ /* Tags that are safe for data: URIs */
10665
+ let DATA_URI_TAGS = null;
10666
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
10667
+
10668
+ /* Attributes safe for values like "javascript:" */
10669
+ let URI_SAFE_ATTRIBUTES = null;
10670
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
10671
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
10672
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
10673
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
10674
+ /* Document namespace */
10675
+ let NAMESPACE = HTML_NAMESPACE;
10676
+ let IS_EMPTY_INPUT = false;
10677
+
10678
+ /* Allowed XHTML+XML namespaces */
10679
+ let ALLOWED_NAMESPACES = null;
10680
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
10681
+
10682
+ /* Parsing of strict XHTML documents */
10683
+ let PARSER_MEDIA_TYPE = null;
10684
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
10685
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
10686
+ let transformCaseFunc = null;
10687
+
10688
+ /* Keep a reference to config to pass to hooks */
10689
+ let CONFIG = null;
10690
+
10691
+ /* Ideally, do not touch anything below this line */
10692
+ /* ______________________________________________ */
10693
+
10694
+ const formElement = document.createElement('form');
10695
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
10696
+ return testValue instanceof RegExp || testValue instanceof Function;
10697
+ };
10698
+
10699
+ /**
10700
+ * _parseConfig
10701
+ *
10702
+ * @param {Object} cfg optional config literal
10703
+ */
10704
+ // eslint-disable-next-line complexity
10705
+ const _parseConfig = function _parseConfig() {
10706
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
10707
+ if (CONFIG && CONFIG === cfg) {
10708
+ return;
10709
+ }
10710
+
10711
+ /* Shield configuration object from tampering */
10712
+ if (!cfg || typeof cfg !== 'object') {
10713
+ cfg = {};
10714
+ }
10715
+
10716
+ /* Shield configuration object from prototype pollution */
10717
+ cfg = clone(cfg);
10718
+ PARSER_MEDIA_TYPE =
10719
+ // eslint-disable-next-line unicorn/prefer-includes
10720
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
10721
+
10722
+ // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
10723
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
10724
+
10725
+ /* Set configuration parameters */
10726
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
10727
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
10728
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
10729
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),
10730
+ // eslint-disable-line indent
10731
+ cfg.ADD_URI_SAFE_ATTR,
10732
+ // eslint-disable-line indent
10733
+ transformCaseFunc // eslint-disable-line indent
10734
+ ) // eslint-disable-line indent
10735
+ : DEFAULT_URI_SAFE_ATTRIBUTES;
10736
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS),
10737
+ // eslint-disable-line indent
10738
+ cfg.ADD_DATA_URI_TAGS,
10739
+ // eslint-disable-line indent
10740
+ transformCaseFunc // eslint-disable-line indent
10741
+ ) // eslint-disable-line indent
10742
+ : DEFAULT_DATA_URI_TAGS;
10743
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
10744
+ FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
10745
+ FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
10746
+ USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
10747
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
10748
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
10749
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
10750
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
10751
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
10752
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
10753
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
10754
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
10755
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
10756
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
10757
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
10758
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
10759
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
10760
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
10761
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
10762
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
10763
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
10764
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
10765
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
10766
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
10767
+ }
10768
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
10769
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
10770
+ }
10771
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
10772
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
10773
+ }
10774
+ if (SAFE_FOR_TEMPLATES) {
10775
+ ALLOW_DATA_ATTR = false;
10776
+ }
10777
+ if (RETURN_DOM_FRAGMENT) {
10778
+ RETURN_DOM = true;
10779
+ }
10780
+
10781
+ /* Parse profile info */
10782
+ if (USE_PROFILES) {
10783
+ ALLOWED_TAGS = addToSet({}, text);
10784
+ ALLOWED_ATTR = [];
10785
+ if (USE_PROFILES.html === true) {
10786
+ addToSet(ALLOWED_TAGS, html$1);
10787
+ addToSet(ALLOWED_ATTR, html);
10788
+ }
10789
+ if (USE_PROFILES.svg === true) {
10790
+ addToSet(ALLOWED_TAGS, svg$1);
10791
+ addToSet(ALLOWED_ATTR, svg);
10792
+ addToSet(ALLOWED_ATTR, xml);
10793
+ }
10794
+ if (USE_PROFILES.svgFilters === true) {
10795
+ addToSet(ALLOWED_TAGS, svgFilters);
10796
+ addToSet(ALLOWED_ATTR, svg);
10797
+ addToSet(ALLOWED_ATTR, xml);
10798
+ }
10799
+ if (USE_PROFILES.mathMl === true) {
10800
+ addToSet(ALLOWED_TAGS, mathMl$1);
10801
+ addToSet(ALLOWED_ATTR, mathMl);
10802
+ addToSet(ALLOWED_ATTR, xml);
10803
+ }
10804
+ }
10805
+
10806
+ /* Merge configuration parameters */
10807
+ if (cfg.ADD_TAGS) {
10808
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
10809
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
10810
+ }
10811
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
10812
+ }
10813
+ if (cfg.ADD_ATTR) {
10814
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
10815
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
10816
+ }
10817
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
10818
+ }
10819
+ if (cfg.ADD_URI_SAFE_ATTR) {
10820
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
10821
+ }
10822
+ if (cfg.FORBID_CONTENTS) {
10823
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
10824
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
10825
+ }
10826
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
10827
+ }
10828
+
10829
+ /* Add #text in case KEEP_CONTENT is set to true */
10830
+ if (KEEP_CONTENT) {
10831
+ ALLOWED_TAGS['#text'] = true;
10832
+ }
10833
+
10834
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
10835
+ if (WHOLE_DOCUMENT) {
10836
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
10837
+ }
10838
+
10839
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
10840
+ if (ALLOWED_TAGS.table) {
10841
+ addToSet(ALLOWED_TAGS, ['tbody']);
10842
+ delete FORBID_TAGS.tbody;
10843
+ }
10844
+ if (cfg.TRUSTED_TYPES_POLICY) {
10845
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
10846
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
10847
+ }
10848
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
10849
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
10850
+ }
10851
+
10852
+ // Overwrite existing TrustedTypes policy.
10853
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
10854
+
10855
+ // Sign local variables required by `sanitize`.
10856
+ emptyHTML = trustedTypesPolicy.createHTML('');
10857
+ } else {
10858
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
10859
+ if (trustedTypesPolicy === undefined) {
10860
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
10861
+ }
10862
+
10863
+ // If creating the internal policy succeeded sign internal variables.
10864
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
10865
+ emptyHTML = trustedTypesPolicy.createHTML('');
10866
+ }
10867
+ }
10868
+
10869
+ // Prevent further manipulation of configuration.
10870
+ // Not available in IE8, Safari 5, etc.
10871
+ if (freeze) {
10872
+ freeze(cfg);
10873
+ }
10874
+ CONFIG = cfg;
10875
+ };
10876
+ const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
10877
+ const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'annotation-xml']);
10878
+
10879
+ // Certain elements are allowed in both SVG and HTML
10880
+ // namespace. We need to specify them explicitly
10881
+ // so that they don't get erroneously deleted from
10882
+ // HTML namespace.
10883
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
10884
+
10885
+ /* Keep track of all possible SVG and MathML tags
10886
+ * so that we can perform the namespace checks
10887
+ * correctly. */
10888
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
10889
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
10890
+
10891
+ /**
10892
+ * @param {Element} element a DOM element whose namespace is being checked
10893
+ * @returns {boolean} Return false if the element has a
10894
+ * namespace that a spec-compliant parser would never
10895
+ * return. Return true otherwise.
10896
+ */
10897
+ const _checkValidNamespace = function _checkValidNamespace(element) {
10898
+ let parent = getParentNode(element);
10899
+
10900
+ // In JSDOM, if we're inside shadow DOM, then parentNode
10901
+ // can be null. We just simulate parent in this case.
10902
+ if (!parent || !parent.tagName) {
10903
+ parent = {
10904
+ namespaceURI: NAMESPACE,
10905
+ tagName: 'template'
10906
+ };
10907
+ }
10908
+ const tagName = stringToLowerCase(element.tagName);
10909
+ const parentTagName = stringToLowerCase(parent.tagName);
10910
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
10911
+ return false;
10912
+ }
10913
+ if (element.namespaceURI === SVG_NAMESPACE) {
10914
+ // The only way to switch from HTML namespace to SVG
10915
+ // is via <svg>. If it happens via any other tag, then
10916
+ // it should be killed.
10917
+ if (parent.namespaceURI === HTML_NAMESPACE) {
10918
+ return tagName === 'svg';
10919
+ }
10920
+
10921
+ // The only way to switch from MathML to SVG is via`
10922
+ // svg if parent is either <annotation-xml> or MathML
10923
+ // text integration points.
10924
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
10925
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
10926
+ }
10927
+
10928
+ // We only allow elements that are defined in SVG
10929
+ // spec. All others are disallowed in SVG namespace.
10930
+ return Boolean(ALL_SVG_TAGS[tagName]);
10931
+ }
10932
+ if (element.namespaceURI === MATHML_NAMESPACE) {
10933
+ // The only way to switch from HTML namespace to MathML
10934
+ // is via <math>. If it happens via any other tag, then
10935
+ // it should be killed.
10936
+ if (parent.namespaceURI === HTML_NAMESPACE) {
10937
+ return tagName === 'math';
10938
+ }
10939
+
10940
+ // The only way to switch from SVG to MathML is via
10941
+ // <math> and HTML integration points
10942
+ if (parent.namespaceURI === SVG_NAMESPACE) {
10943
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
10944
+ }
10945
+
10946
+ // We only allow elements that are defined in MathML
10947
+ // spec. All others are disallowed in MathML namespace.
10948
+ return Boolean(ALL_MATHML_TAGS[tagName]);
10949
+ }
10950
+ if (element.namespaceURI === HTML_NAMESPACE) {
10951
+ // The only way to switch from SVG to HTML is via
10952
+ // HTML integration points, and from MathML to HTML
10953
+ // is via MathML text integration points
10954
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
10955
+ return false;
10956
+ }
10957
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
10958
+ return false;
10959
+ }
10960
+
10961
+ // We disallow tags that are specific for MathML
10962
+ // or SVG and should never appear in HTML namespace
10963
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
10964
+ }
10965
+
10966
+ // For XHTML and XML documents that support custom namespaces
10967
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
10968
+ return true;
10969
+ }
10970
+
10971
+ // The code should never reach this place (this means
10972
+ // that the element somehow got namespace that is not
10973
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
10974
+ // Return false just in case.
10975
+ return false;
10976
+ };
10977
+
10978
+ /**
10979
+ * _forceRemove
10980
+ *
10981
+ * @param {Node} node a DOM node
10982
+ */
10983
+ const _forceRemove = function _forceRemove(node) {
10984
+ arrayPush(DOMPurify.removed, {
10985
+ element: node
10986
+ });
10987
+ try {
10988
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
10989
+ getParentNode(node).removeChild(node);
10990
+ } catch (_) {
10991
+ remove(node);
10992
+ }
10993
+ };
10994
+
10995
+ /**
10996
+ * _removeAttribute
10997
+ *
10998
+ * @param {String} name an Attribute name
10999
+ * @param {Node} node a DOM node
11000
+ */
11001
+ const _removeAttribute = function _removeAttribute(name, node) {
11002
+ try {
11003
+ arrayPush(DOMPurify.removed, {
11004
+ attribute: node.getAttributeNode(name),
11005
+ from: node
11006
+ });
11007
+ } catch (_) {
11008
+ arrayPush(DOMPurify.removed, {
11009
+ attribute: null,
11010
+ from: node
11011
+ });
11012
+ }
11013
+ node.removeAttribute(name);
11014
+
11015
+ // We void attribute values for unremovable "is"" attributes
11016
+ if (name === 'is' && !ALLOWED_ATTR[name]) {
11017
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
11018
+ try {
11019
+ _forceRemove(node);
11020
+ } catch (_) {}
11021
+ } else {
11022
+ try {
11023
+ node.setAttribute(name, '');
11024
+ } catch (_) {}
11025
+ }
11026
+ }
11027
+ };
11028
+
11029
+ /**
11030
+ * _initDocument
11031
+ *
11032
+ * @param {String} dirty a string of dirty markup
11033
+ * @return {Document} a DOM, filled with the dirty markup
11034
+ */
11035
+ const _initDocument = function _initDocument(dirty) {
11036
+ /* Create a HTML document */
11037
+ let doc = null;
11038
+ let leadingWhitespace = null;
11039
+ if (FORCE_BODY) {
11040
+ dirty = '<remove></remove>' + dirty;
11041
+ } else {
11042
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
11043
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
11044
+ leadingWhitespace = matches && matches[0];
11045
+ }
11046
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
11047
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
11048
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
11049
+ }
11050
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
11051
+ /*
11052
+ * Use the DOMParser API by default, fallback later if needs be
11053
+ * DOMParser not work for svg when has multiple root element.
11054
+ */
11055
+ if (NAMESPACE === HTML_NAMESPACE) {
11056
+ try {
11057
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
11058
+ } catch (_) {}
11059
+ }
11060
+
11061
+ /* Use createHTMLDocument in case DOMParser is not available */
11062
+ if (!doc || !doc.documentElement) {
11063
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
11064
+ try {
11065
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
11066
+ } catch (_) {
11067
+ // Syntax error if dirtyPayload is invalid xml
11068
+ }
11069
+ }
11070
+ const body = doc.body || doc.documentElement;
11071
+ if (dirty && leadingWhitespace) {
11072
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
11073
+ }
11074
+
11075
+ /* Work on whole document or just its body */
11076
+ if (NAMESPACE === HTML_NAMESPACE) {
11077
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
11078
+ }
11079
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
11080
+ };
11081
+
11082
+ /**
11083
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
11084
+ *
11085
+ * @param {Node} root The root element or node to start traversing on.
11086
+ * @return {NodeIterator} The created NodeIterator
11087
+ */
11088
+ const _createNodeIterator = function _createNodeIterator(root) {
11089
+ return createNodeIterator.call(root.ownerDocument || root, root,
11090
+ // eslint-disable-next-line no-bitwise
11091
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
11092
+ };
11093
+
11094
+ /**
11095
+ * _isClobbered
11096
+ *
11097
+ * @param {Node} elm element to check for clobbering attacks
11098
+ * @return {Boolean} true if clobbered, false if safe
11099
+ */
11100
+ const _isClobbered = function _isClobbered(elm) {
11101
+ return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
11102
+ };
11103
+
11104
+ /**
11105
+ * Checks whether the given object is a DOM node.
11106
+ *
11107
+ * @param {Node} object object to check whether it's a DOM node
11108
+ * @return {Boolean} true is object is a DOM node
11109
+ */
11110
+ const _isNode = function _isNode(object) {
11111
+ return typeof Node === 'function' && object instanceof Node;
11112
+ };
11113
+
11114
+ /**
11115
+ * _executeHook
11116
+ * Execute user configurable hooks
11117
+ *
11118
+ * @param {String} entryPoint Name of the hook's entry point
11119
+ * @param {Node} currentNode node to work on with the hook
11120
+ * @param {Object} data additional hook parameters
11121
+ */
11122
+ const _executeHook = function _executeHook(entryPoint, currentNode, data) {
11123
+ if (!hooks[entryPoint]) {
11124
+ return;
11125
+ }
11126
+ arrayForEach(hooks[entryPoint], hook => {
11127
+ hook.call(DOMPurify, currentNode, data, CONFIG);
11128
+ });
11129
+ };
11130
+
11131
+ /**
11132
+ * _sanitizeElements
11133
+ *
11134
+ * @protect nodeName
11135
+ * @protect textContent
11136
+ * @protect removeChild
11137
+ *
11138
+ * @param {Node} currentNode to check for permission to exist
11139
+ * @return {Boolean} true if node was killed, false if left alive
11140
+ */
11141
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
11142
+ let content = null;
11143
+
11144
+ /* Execute a hook if present */
11145
+ _executeHook('beforeSanitizeElements', currentNode, null);
11146
+
11147
+ /* Check if element is clobbered or can clobber */
11148
+ if (_isClobbered(currentNode)) {
11149
+ _forceRemove(currentNode);
11150
+ return true;
11151
+ }
11152
+
11153
+ /* Now let's check the element's type and name */
11154
+ const tagName = transformCaseFunc(currentNode.nodeName);
11155
+
11156
+ /* Execute a hook if present */
11157
+ _executeHook('uponSanitizeElement', currentNode, {
11158
+ tagName,
11159
+ allowedTags: ALLOWED_TAGS
11160
+ });
11161
+
11162
+ /* Detect mXSS attempts abusing namespace confusion */
11163
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
11164
+ _forceRemove(currentNode);
11165
+ return true;
11166
+ }
11167
+
11168
+ /* Remove any occurrence of processing instructions */
11169
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
11170
+ _forceRemove(currentNode);
11171
+ return true;
11172
+ }
11173
+
11174
+ /* Remove any kind of possibly harmful comments */
11175
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
11176
+ _forceRemove(currentNode);
11177
+ return true;
11178
+ }
11179
+
11180
+ /* Remove element if anything forbids its presence */
11181
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
11182
+ /* Check if we have a custom element to handle */
11183
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
11184
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
11185
+ return false;
11186
+ }
11187
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
11188
+ return false;
11189
+ }
11190
+ }
11191
+
11192
+ /* Keep content except for bad-listed elements */
11193
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
11194
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
11195
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
11196
+ if (childNodes && parentNode) {
11197
+ const childCount = childNodes.length;
11198
+ for (let i = childCount - 1; i >= 0; --i) {
11199
+ const childClone = cloneNode(childNodes[i], true);
11200
+ childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
11201
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
11202
+ }
11203
+ }
11204
+ }
11205
+ _forceRemove(currentNode);
11206
+ return true;
11207
+ }
11208
+
11209
+ /* Check whether element has a valid namespace */
11210
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
11211
+ _forceRemove(currentNode);
11212
+ return true;
11213
+ }
11214
+
11215
+ /* Make sure that older browsers don't get fallback-tag mXSS */
11216
+ if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
11217
+ _forceRemove(currentNode);
11218
+ return true;
11219
+ }
11220
+
11221
+ /* Sanitize element content to be template-safe */
11222
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
11223
+ /* Get the element's text content */
11224
+ content = currentNode.textContent;
11225
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
11226
+ content = stringReplace(content, expr, ' ');
11227
+ });
11228
+ if (currentNode.textContent !== content) {
11229
+ arrayPush(DOMPurify.removed, {
11230
+ element: currentNode.cloneNode()
11231
+ });
11232
+ currentNode.textContent = content;
11233
+ }
11234
+ }
11235
+
11236
+ /* Execute a hook if present */
11237
+ _executeHook('afterSanitizeElements', currentNode, null);
11238
+ return false;
11239
+ };
11240
+
11241
+ /**
11242
+ * _isValidAttribute
11243
+ *
11244
+ * @param {string} lcTag Lowercase tag name of containing element.
11245
+ * @param {string} lcName Lowercase attribute name.
11246
+ * @param {string} value Attribute value.
11247
+ * @return {Boolean} Returns true if `value` is valid, otherwise false.
11248
+ */
11249
+ // eslint-disable-next-line complexity
11250
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
11251
+ /* Make sure attribute cannot clobber */
11252
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
11253
+ return false;
11254
+ }
11255
+
11256
+ /* Allow valid data-* attributes: At least one character after "-"
11257
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
11258
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
11259
+ We don't need to check the value; it's always URI safe. */
11260
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
11261
+ if (
11262
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
11263
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
11264
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
11265
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
11266
+ // Alternative, second condition checks if it's an `is`-attribute, AND
11267
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
11268
+ lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
11269
+ return false;
11270
+ }
11271
+ /* Check value is safe. First, is attr inert? If so, is safe */
11272
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
11273
+ return false;
11274
+ } else ;
11275
+ return true;
11276
+ };
11277
+
11278
+ /**
11279
+ * _isBasicCustomElement
11280
+ * checks if at least one dash is included in tagName, and it's not the first char
11281
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
11282
+ *
11283
+ * @param {string} tagName name of the tag of the node to sanitize
11284
+ * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
11285
+ */
11286
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
11287
+ return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
11288
+ };
11289
+
11290
+ /**
11291
+ * _sanitizeAttributes
11292
+ *
11293
+ * @protect attributes
11294
+ * @protect nodeName
11295
+ * @protect removeAttribute
11296
+ * @protect setAttribute
11297
+ *
11298
+ * @param {Node} currentNode to sanitize
11299
+ */
11300
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
11301
+ /* Execute a hook if present */
11302
+ _executeHook('beforeSanitizeAttributes', currentNode, null);
11303
+ const {
11304
+ attributes
11305
+ } = currentNode;
11306
+
11307
+ /* Check if we have attributes; if not we might have a text node */
11308
+ if (!attributes) {
11309
+ return;
11310
+ }
11311
+ const hookEvent = {
11312
+ attrName: '',
11313
+ attrValue: '',
11314
+ keepAttr: true,
11315
+ allowedAttributes: ALLOWED_ATTR
11316
+ };
11317
+ let l = attributes.length;
11318
+
11319
+ /* Go backwards over all attributes; safely remove bad ones */
11320
+ while (l--) {
11321
+ const attr = attributes[l];
11322
+ const {
11323
+ name,
11324
+ namespaceURI,
11325
+ value: attrValue
11326
+ } = attr;
11327
+ const lcName = transformCaseFunc(name);
11328
+ let value = name === 'value' ? attrValue : stringTrim(attrValue);
11329
+
11330
+ /* Execute a hook if present */
11331
+ hookEvent.attrName = lcName;
11332
+ hookEvent.attrValue = value;
11333
+ hookEvent.keepAttr = true;
11334
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
11335
+ _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
11336
+ value = hookEvent.attrValue;
11337
+
11338
+ /* Work around a security issue with comments inside attributes */
11339
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
11340
+ _removeAttribute(name, currentNode);
11341
+ continue;
11342
+ }
11343
+
11344
+ /* Did the hooks approve of the attribute? */
11345
+ if (hookEvent.forceKeepAttr) {
11346
+ continue;
11347
+ }
11348
+
11349
+ /* Remove attribute */
11350
+ _removeAttribute(name, currentNode);
11351
+
11352
+ /* Did the hooks approve of the attribute? */
11353
+ if (!hookEvent.keepAttr) {
11354
+ continue;
11355
+ }
11356
+
11357
+ /* Work around a security issue in jQuery 3.0 */
11358
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
11359
+ _removeAttribute(name, currentNode);
11360
+ continue;
11361
+ }
11362
+
11363
+ /* Sanitize attribute content to be template-safe */
11364
+ if (SAFE_FOR_TEMPLATES) {
11365
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
11366
+ value = stringReplace(value, expr, ' ');
11367
+ });
11368
+ }
11369
+
11370
+ /* Is `value` valid for this attribute? */
11371
+ const lcTag = transformCaseFunc(currentNode.nodeName);
11372
+ if (!_isValidAttribute(lcTag, lcName, value)) {
11373
+ continue;
11374
+ }
11375
+
11376
+ /* Full DOM Clobbering protection via namespace isolation,
11377
+ * Prefix id and name attributes with `user-content-`
11378
+ */
11379
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
11380
+ // Remove the attribute with this value
11381
+ _removeAttribute(name, currentNode);
11382
+
11383
+ // Prefix the value and later re-create the attribute with the sanitized value
11384
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
11385
+ }
11386
+
11387
+ /* Handle attributes that require Trusted Types */
11388
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
11389
+ if (namespaceURI) ; else {
11390
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
11391
+ case 'TrustedHTML':
11392
+ {
11393
+ value = trustedTypesPolicy.createHTML(value);
11394
+ break;
11395
+ }
11396
+ case 'TrustedScriptURL':
11397
+ {
11398
+ value = trustedTypesPolicy.createScriptURL(value);
11399
+ break;
11400
+ }
11401
+ }
11402
+ }
11403
+ }
11404
+
11405
+ /* Handle invalid data-* attribute set by try-catching it */
11406
+ try {
11407
+ if (namespaceURI) {
11408
+ currentNode.setAttributeNS(namespaceURI, name, value);
11409
+ } else {
11410
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
11411
+ currentNode.setAttribute(name, value);
11412
+ }
11413
+ if (_isClobbered(currentNode)) {
11414
+ _forceRemove(currentNode);
11415
+ } else {
11416
+ arrayPop(DOMPurify.removed);
11417
+ }
11418
+ } catch (_) {}
11419
+ }
11420
+
11421
+ /* Execute a hook if present */
11422
+ _executeHook('afterSanitizeAttributes', currentNode, null);
11423
+ };
11424
+
11425
+ /**
11426
+ * _sanitizeShadowDOM
11427
+ *
11428
+ * @param {DocumentFragment} fragment to iterate over recursively
11429
+ */
11430
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
11431
+ let shadowNode = null;
11432
+ const shadowIterator = _createNodeIterator(fragment);
11433
+
11434
+ /* Execute a hook if present */
11435
+ _executeHook('beforeSanitizeShadowDOM', fragment, null);
11436
+ while (shadowNode = shadowIterator.nextNode()) {
11437
+ /* Execute a hook if present */
11438
+ _executeHook('uponSanitizeShadowNode', shadowNode, null);
11439
+
11440
+ /* Sanitize tags and elements */
11441
+ if (_sanitizeElements(shadowNode)) {
11442
+ continue;
11443
+ }
11444
+
11445
+ /* Deep shadow DOM detected */
11446
+ if (shadowNode.content instanceof DocumentFragment) {
11447
+ _sanitizeShadowDOM(shadowNode.content);
11448
+ }
11449
+
11450
+ /* Check attributes, sanitize if necessary */
11451
+ _sanitizeAttributes(shadowNode);
11452
+ }
11453
+
11454
+ /* Execute a hook if present */
11455
+ _executeHook('afterSanitizeShadowDOM', fragment, null);
11456
+ };
11457
+
11458
+ /**
11459
+ * Sanitize
11460
+ * Public method providing core sanitation functionality
11461
+ *
11462
+ * @param {String|Node} dirty string or DOM node
11463
+ * @param {Object} cfg object
11464
+ */
11465
+ // eslint-disable-next-line complexity
11466
+ DOMPurify.sanitize = function (dirty) {
11467
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
11468
+ let body = null;
11469
+ let importedNode = null;
11470
+ let currentNode = null;
11471
+ let returnNode = null;
11472
+ /* Make sure we have a string to sanitize.
11473
+ DO NOT return early, as this will return the wrong type if
11474
+ the user has requested a DOM object rather than a string */
11475
+ IS_EMPTY_INPUT = !dirty;
11476
+ if (IS_EMPTY_INPUT) {
11477
+ dirty = '<!-->';
11478
+ }
11479
+
11480
+ /* Stringify, in case dirty is an object */
11481
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
11482
+ if (typeof dirty.toString === 'function') {
11483
+ dirty = dirty.toString();
11484
+ if (typeof dirty !== 'string') {
11485
+ throw typeErrorCreate('dirty is not a string, aborting');
11486
+ }
11487
+ } else {
11488
+ throw typeErrorCreate('toString is not a function');
11489
+ }
11490
+ }
11491
+
11492
+ /* Return dirty HTML if DOMPurify cannot run */
11493
+ if (!DOMPurify.isSupported) {
11494
+ return dirty;
11495
+ }
11496
+
11497
+ /* Assign config vars */
11498
+ if (!SET_CONFIG) {
11499
+ _parseConfig(cfg);
11500
+ }
11501
+
11502
+ /* Clean up removed elements */
11503
+ DOMPurify.removed = [];
11504
+
11505
+ /* Check if dirty is correctly typed for IN_PLACE */
11506
+ if (typeof dirty === 'string') {
11507
+ IN_PLACE = false;
11508
+ }
11509
+ if (IN_PLACE) {
11510
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
11511
+ if (dirty.nodeName) {
11512
+ const tagName = transformCaseFunc(dirty.nodeName);
11513
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
11514
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
11515
+ }
11516
+ }
11517
+ } else if (dirty instanceof Node) {
11518
+ /* If dirty is a DOM element, append to an empty document to avoid
11519
+ elements being stripped by the parser */
11520
+ body = _initDocument('<!---->');
11521
+ importedNode = body.ownerDocument.importNode(dirty, true);
11522
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
11523
+ /* Node is already a body, use as is */
11524
+ body = importedNode;
11525
+ } else if (importedNode.nodeName === 'HTML') {
11526
+ body = importedNode;
11527
+ } else {
11528
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
11529
+ body.appendChild(importedNode);
11530
+ }
11531
+ } else {
11532
+ /* Exit directly if we have nothing to do */
11533
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
11534
+ // eslint-disable-next-line unicorn/prefer-includes
11535
+ dirty.indexOf('<') === -1) {
11536
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
11537
+ }
11538
+
11539
+ /* Initialize the document to work on */
11540
+ body = _initDocument(dirty);
11541
+
11542
+ /* Check we have a DOM node from the data */
11543
+ if (!body) {
11544
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
11545
+ }
11546
+ }
11547
+
11548
+ /* Remove first element node (ours) if FORCE_BODY is set */
11549
+ if (body && FORCE_BODY) {
11550
+ _forceRemove(body.firstChild);
11551
+ }
11552
+
11553
+ /* Get node iterator */
11554
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
11555
+
11556
+ /* Now start iterating over the created document */
11557
+ while (currentNode = nodeIterator.nextNode()) {
11558
+ /* Sanitize tags and elements */
11559
+ if (_sanitizeElements(currentNode)) {
11560
+ continue;
11561
+ }
11562
+
11563
+ /* Shadow DOM detected, sanitize it */
11564
+ if (currentNode.content instanceof DocumentFragment) {
11565
+ _sanitizeShadowDOM(currentNode.content);
11566
+ }
11567
+
11568
+ /* Check attributes, sanitize if necessary */
11569
+ _sanitizeAttributes(currentNode);
11570
+ }
11571
+
11572
+ /* If we sanitized `dirty` in-place, return it. */
11573
+ if (IN_PLACE) {
11574
+ return dirty;
11575
+ }
11576
+
11577
+ /* Return sanitized string or DOM */
11578
+ if (RETURN_DOM) {
11579
+ if (RETURN_DOM_FRAGMENT) {
11580
+ returnNode = createDocumentFragment.call(body.ownerDocument);
11581
+ while (body.firstChild) {
11582
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
11583
+ returnNode.appendChild(body.firstChild);
11584
+ }
11585
+ } else {
11586
+ returnNode = body;
11587
+ }
11588
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
11589
+ /*
11590
+ AdoptNode() is not used because internal state is not reset
11591
+ (e.g. the past names map of a HTMLFormElement), this is safe
11592
+ in theory but we would rather not risk another attack vector.
11593
+ The state that is cloned by importNode() is explicitly defined
11594
+ by the specs.
11595
+ */
11596
+ returnNode = importNode.call(originalDocument, returnNode, true);
11597
+ }
11598
+ return returnNode;
11599
+ }
11600
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
11601
+
11602
+ /* Serialize doctype if allowed */
11603
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
11604
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
11605
+ }
11606
+
11607
+ /* Sanitize final string template-safe */
11608
+ if (SAFE_FOR_TEMPLATES) {
11609
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
11610
+ serializedHTML = stringReplace(serializedHTML, expr, ' ');
11611
+ });
11612
+ }
11613
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
11614
+ };
11615
+
11616
+ /**
11617
+ * Public method to set the configuration once
11618
+ * setConfig
11619
+ *
11620
+ * @param {Object} cfg configuration object
11621
+ */
11622
+ DOMPurify.setConfig = function () {
11623
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11624
+ _parseConfig(cfg);
11625
+ SET_CONFIG = true;
11626
+ };
11627
+
11628
+ /**
11629
+ * Public method to remove the configuration
11630
+ * clearConfig
11631
+ *
11632
+ */
11633
+ DOMPurify.clearConfig = function () {
11634
+ CONFIG = null;
11635
+ SET_CONFIG = false;
11636
+ };
11637
+
11638
+ /**
11639
+ * Public method to check if an attribute value is valid.
11640
+ * Uses last set config, if any. Otherwise, uses config defaults.
11641
+ * isValidAttribute
11642
+ *
11643
+ * @param {String} tag Tag name of containing element.
11644
+ * @param {String} attr Attribute name.
11645
+ * @param {String} value Attribute value.
11646
+ * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
11647
+ */
11648
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
11649
+ /* Initialize shared config vars if necessary. */
11650
+ if (!CONFIG) {
11651
+ _parseConfig({});
11652
+ }
11653
+ const lcTag = transformCaseFunc(tag);
11654
+ const lcName = transformCaseFunc(attr);
11655
+ return _isValidAttribute(lcTag, lcName, value);
11656
+ };
11657
+
11658
+ /**
11659
+ * AddHook
11660
+ * Public method to add DOMPurify hooks
11661
+ *
11662
+ * @param {String} entryPoint entry point for the hook to add
11663
+ * @param {Function} hookFunction function to execute
11664
+ */
11665
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
11666
+ if (typeof hookFunction !== 'function') {
11667
+ return;
11668
+ }
11669
+ hooks[entryPoint] = hooks[entryPoint] || [];
11670
+ arrayPush(hooks[entryPoint], hookFunction);
11671
+ };
11672
+
11673
+ /**
11674
+ * RemoveHook
11675
+ * Public method to remove a DOMPurify hook at a given entryPoint
11676
+ * (pops it from the stack of hooks if more are present)
11677
+ *
11678
+ * @param {String} entryPoint entry point for the hook to remove
11679
+ * @return {Function} removed(popped) hook
11680
+ */
11681
+ DOMPurify.removeHook = function (entryPoint) {
11682
+ if (hooks[entryPoint]) {
11683
+ return arrayPop(hooks[entryPoint]);
11684
+ }
11685
+ };
11686
+
11687
+ /**
11688
+ * RemoveHooks
11689
+ * Public method to remove all DOMPurify hooks at a given entryPoint
11690
+ *
11691
+ * @param {String} entryPoint entry point for the hooks to remove
11692
+ */
11693
+ DOMPurify.removeHooks = function (entryPoint) {
11694
+ if (hooks[entryPoint]) {
11695
+ hooks[entryPoint] = [];
11696
+ }
11697
+ };
11698
+
11699
+ /**
11700
+ * RemoveAllHooks
11701
+ * Public method to remove all DOMPurify hooks
11702
+ */
11703
+ DOMPurify.removeAllHooks = function () {
11704
+ hooks = {};
11705
+ };
11706
+ return DOMPurify;
11707
+ }
11708
+ var purify = createDOMPurify();
11709
+
11710
+ return purify;
11711
+
11712
+ }));
11713
+
11714
+ } (purify));
11715
+ return purify.exports;
11716
+ }
11717
+
11718
+ window.DOMPurify || (window.DOMPurify = requirePurify().default || requirePurify());
11719
+
10141
11720
  // src/utils/entries-to-string.ts
10142
11721
  function entriesToString(obj, separator = "=") {
10143
11722
  return !!Object.keys(obj).length ? Object.entries(obj).reduce((str, [key, value]) => [...str, `${key}${separator}${value}`], []).join(",") : "";
@@ -10321,7 +11900,7 @@
10321
11900
  };
10322
11901
 
10323
11902
  var TEMPLATE$1 = "\n <div class=\"checkout-container\">\n <div class=\"checkout-bg-logo\"></div>\n <a href=\"#\" data-continue>Continue</a>\n <a href=\"#\" data-close>Close</a>\n </div>\n";
10324
- var STYLES$3 = "\n .checkout-bg-logo {\n display: block;\n background: url({{url}}) no-repeat;\n width: 100px;\n height: 50px;\n margin: 0 auto;\n border-radius: 10px;\n background-size: contain;\n }\n [data-continue] {\n margin-top: 24px;\n display: block;\n font-family: Helvetica, sans-serif;\n text-decoration: none;\n color: #fff !important;\n border: 1px solid white;\n width: 100px;\n border-radius: 16px;\n padding: 5px;\n }\n [data-continue]:hover {\n background-color: #f2f2f2;\n border: none;\n color: rgba(0, 0, 0, 0.7) !important;\n }\n .checkout-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n\n .checkout-overlay {\n z-index: 2147483647;\n }\n\n .checkout-container [data-close] {\n opacity: 1;\n }\n .checkout-container [data-close]:before,\n .checkout-container [data-close]:after {\n background-color: #fff;\n }\n";
11903
+ var STYLES$3 = "\n .checkout-bg-logo {\n display: block;\n background: url({{url}}) no-repeat;\n width: 100px;\n height: 50px;\n margin: 0 auto;\n border-radius: 10px;\n background-size: contain;\n background-position: 50% 50%;\n }\n [data-continue] {\n margin-top: 24px;\n display: block;\n font-family: Helvetica, sans-serif;\n text-decoration: none;\n color: #fff !important;\n border: 1px solid white;\n width: 100px;\n border-radius: 16px;\n padding: 5px;\n }\n [data-continue]:hover {\n background-color: #f2f2f2;\n border: none;\n color: rgba(0, 0, 0, 0.7) !important;\n }\n .checkout-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n\n .checkout-overlay {\n z-index: 2147483647;\n }\n\n .checkout-container [data-close] {\n opacity: 1;\n }\n .checkout-container [data-close]:before,\n .checkout-container [data-close]:after {\n background-color: #fff;\n }\n";
10325
11904
  var WalletBackground = /*#__PURE__*/function (_Background) {
10326
11905
  function WalletBackground(bgImageUrl) {
10327
11906
  var _this;
@@ -10395,10 +11974,10 @@
10395
11974
  }
10396
11975
  function createFlypayV2ButtonStyle(widgetId) {
10397
11976
  var widgetClassName = getWidgetClassName(widgetId);
10398
- return "\n .".concat(widgetClassName, " {\n position: relative;\n height: 100%;\n width: 100%;\n border: none; /* Remove borders */\n background: transparent; /* Make the button background transparent */\n cursor: pointer; /* Make it look clickable */\n outline: none; /* Remove focus outline */\n padding: 0; /* Remove any default padding */\n }\n\n .").concat(widgetClassName, " .paydock-flypay-button {\n background-color: #212121;\n border-radius: 9999px;\n width: 100%; /* set hard pixel dimensions here for a button with intrinsic dimensions */\n height: 100%; /* and leave the 100% settings for the Coles use case (enabled by extra param object flag) */\n display: grid;\n grid-template-columns: 20% 1fr 20%;\n grid-template-rows: 20% 1fr 20%;\n grid-template-areas:\n \". . .\"\n \". center .\"\n \". . .\";\n box-sizing: border-box;\n }\n \n .").concat(widgetClassName, " .paydock-flypay-button:hover {\n background-color: #3d3d3d;\n }\n \n .").concat(widgetClassName, " .paydock-flypay-button:focus-visible {\n outline-color: transparent;\n box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2670ee;\n outline-color: transparent;\n }\n \n .").concat(widgetClassName, " .paydock-flypay-button:active {\n background-color: #6f6f6f;\n }\n \n .").concat(widgetClassName, " .paydock-flypay-button:disabled,\n .").concat(widgetClassName, " .paydock-flypay-button__disabled {\n opacity: 25%;\n cursor: not-allowed;\n }\n \n #").concat(widgetId, "-loading-overlay {\n position: absolute;\n height: 100%;\n width: 100%;\n background: rgba(255, 255, 255, 0.7);\n display: none;\n justify-content: center;\n align-items: center;\n cursor: not-allowed; /* Make it look not clickable */ \n }\n \n #").concat(widgetId, "-loading-overlay::after {\n content: \"\";\n height: 60%;\n aspect-ratio: 1 / 1;\n display: inline-block;\n border: 4px solid #ccc;\n border-top-color: #333;\n border-radius: 50%;\n /* Vendor prefixes for animation property */\n -webkit-animation: spin 1s infinite linear;\n -moz-animation: spin 1s infinite linear;\n -o-animation: spin 1s infinite linear;\n animation: spin 1s infinite linear;\n }\n \n @-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); \n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n \n @-moz-keyframes spin {\n 0% {\n -moz-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -moz-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n \n @-o-keyframes spin {\n 0% {\n -o-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -o-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n \n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n } \n ");
11977
+ return "\n .".concat(widgetClassName, " {\n position: relative;\n height: 100%;\n width: 100%;\n border: none; /* Remove borders */\n background: transparent; /* Make the button background transparent */\n cursor: pointer; /* Make it look clickable */\n outline: none; /* Remove focus outline */\n padding: 0; /* Remove any default padding */\n }\n\n .").concat(widgetClassName, " .paydock-flypay-button {\n background-color: #212121;\n border-radius: 9999px;\n width: 100%; /* set hard pixel dimensions here for a button with intrinsic dimensions */\n height: 100%; /* and leave the 100% settings for the Coles use case (enabled by extra param object flag) */\n display: grid;\n grid-template-columns: 20% 1fr 20%;\n grid-template-rows: 20% 1fr 20%;\n grid-template-areas:\n \". . .\"\n \". center .\"\n \". . .\";\n box-sizing: border-box;\n }\n\n .").concat(widgetClassName, " .paydock-flypay-button:hover {\n background-color: #3d3d3d;\n }\n\n .").concat(widgetClassName, " .paydock-flypay-button:focus-visible {\n outline-color: transparent;\n box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2670ee;\n outline-color: transparent;\n }\n\n .").concat(widgetClassName, " .paydock-flypay-button:active {\n background-color: #6f6f6f;\n }\n\n .").concat(widgetClassName, " .paydock-flypay-button:disabled,\n .").concat(widgetClassName, " .paydock-flypay-button__disabled {\n opacity: 25%;\n cursor: not-allowed;\n }\n\n #").concat(widgetId, "-loading-overlay {\n position: absolute;\n height: 100%;\n width: 100%;\n background: rgba(255, 255, 255, 0.7);\n display: none;\n justify-content: center;\n align-items: center;\n cursor: not-allowed; /* Make it look not clickable */\n }\n\n #").concat(widgetId, "-loading-overlay::after {\n content: \"\";\n height: 60%;\n aspect-ratio: 1 / 1;\n display: inline-block;\n border: 4px solid #ccc;\n border-top-color: #333;\n border-radius: 50%;\n /* Vendor prefixes for animation property */\n -webkit-animation: spin 1s infinite linear;\n -moz-animation: spin 1s infinite linear;\n -o-animation: spin 1s infinite linear;\n animation: spin 1s infinite linear;\n }\n\n @-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @-moz-keyframes spin {\n 0% {\n -moz-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -moz-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @-o-keyframes spin {\n 0% {\n -o-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -o-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n ");
10399
11978
  }
10400
11979
  function getButtonWithClassNames(classNames, containerId) {
10401
- return "\n <div id=\"".concat(containerId, "-loading-overlay\"></div>\n <div class=\"").concat(classNames, "\" tabindex=\"0\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 125.2 21\" data-name=\"pay-with-flypay\"\n style=\"grid-area: center; width: 100%; height: 100%\"\n fill=\"none\"\n >\n <path\n fill=\"#fff\"\n d=\"M89 .5a.5.5 0 0 1 .5-.5h15a.5.5 0 0 1 0 1h-15a.5.5 0 0 1-.5-.5ZM98 22.5a.5.5 0 0 1 .5-.5h15a.5.5 0 0 1 0 1h-15a.5.5 0 0 1-.5-.5ZM87 3.5a.5.5 0 0 1 .5-.5H121c.758 0 1.42.031 1.974.133.553.102 1.044.284 1.421.618.78.694.849 1.829.598 3.331-.258 1.552-1.025 3.843-1.711 5.715a100.003 100.003 0 0 1-1.211 3.128l-.081.198-.021.051v.001c-.531 1.583-1.345 2.557-2.269 3.126-.92.566-1.898.699-2.7.699H96.5a.5.5 0 1 1 0-1v.5-.5H117c.698 0 1.47-.117 2.175-.55.697-.43 1.382-1.2 1.851-2.608l.005-.017.008-.018.006-.016.021-.05.079-.194a94.823 94.823 0 0 0 1.198-3.094c.689-1.878 1.422-4.087 1.664-5.535.249-1.498.068-2.113-.277-2.42-.186-.165-.476-.296-.938-.381C122.33 4.03 121.742 4 121 4H87.5a.5.5 0 0 1-.5-.5ZM76.512 9.512h3.157V7.34h-3.157v-.01h-.02c.01-1.196.841-2.17 2.52-2.17H81V3h-1.988C75.547 3 74.008 4.936 74 7.326V16h2.512V9.512ZM82 3.55 84.987 3H85v13h-3V3.55Z\"\n />\n <path\n fill=\"#fff\"\n d=\"M91.592 15.365a4.557 4.557 0 0 1-1.595.33c-2.391 0-4-1.68-3.997-4.092V7.546l2.41-.543V11.6c0 1.118.536 1.738 1.59 1.738 1.055 0 1.592-.622 1.592-1.738V7.543L94 7v9.855C94 19.41 92.497 21 90.073 21h-.596v-2.359h.59c.71 0 1.525-.641 1.525-1.786v-1.49Z\"\n />\n <path\n fill=\"#fff\"\n fill-rule=\"evenodd\"\n d=\"M2.54 11.6h2.598c1.356 0 2.399-.299 3.129-.896.731-.598 1.096-1.62 1.096-3.063 0-1.323-.365-2.3-1.096-2.93-.73-.631-1.71-.947-2.938-.947H0V16h2.54v-4.4Zm4.291-3.943c0 .637-.166 1.102-.498 1.395-.337.293-.808.44-1.411.44H2.54V5.889h2.382c.603 0 1.071.136 1.403.407.337.271.506.725.506 1.361ZM14.651 6.736c-1.522 0-2.596.398-3.221 1.195-.393.51-.614 1.16-.664 1.95h2.283c.055-.348.166-.624.332-.83.232-.276.628-.414 1.187-.414.498 0 .874.072 1.128.216.261.138.391.392.391.763 0 .305-.169.529-.507.673-.188.083-.501.152-.938.207l-.805.1c-.913.116-1.605.31-2.075.58-.858.499-1.287 1.304-1.287 2.416 0 .858.266 1.522.797 1.993.537.464 1.215.697 2.034.697.642 0 1.217-.147 1.726-.44a4.83 4.83 0 0 0 1.129-.905c.017.205.039.388.067.548.027.16.077.332.149.515h2.573v-.349a.843.843 0 0 1-.348-.274c-.078-.11-.125-.32-.141-.63-.011-.41-.017-.759-.017-1.047V9.55c0-1.09-.385-1.832-1.154-2.225-.769-.393-1.649-.59-2.639-.59Zm-.648 7.828c-.321 0-.592-.092-.813-.274-.227-.177-.341-.468-.341-.872 0-.454.183-.788.548-1.004.216-.128.573-.236 1.071-.324l.531-.1c.266-.05.473-.102.623-.157.155-.061.307-.139.456-.233v.88c-.016.791-.24 1.336-.672 1.635a2.39 2.39 0 0 1-1.403.449Z\"\n clip-rule=\"evenodd\"\n />\n <path\n fill=\"#fff\"\n d=\"m26.097 6.952-1.867 6.674-1.976-6.674h-2.631l3.32 9.446c.022.066-.028.25-.149.548-.117.299-.244.495-.382.59-.144.099-.321.162-.531.19a3.752 3.752 0 0 1-.665.025l-.298-.017v1.893c.254.017.445.025.572.025.128.005.296.008.507.008 1.046 0 1.743-.207 2.092-.622.348-.41.821-1.472 1.419-3.188l3.104-8.898h-2.515ZM40.192 9.409l1.419 6.59h2.433l2.623-9.047h-2.466l-1.411 6.516-1.378-6.516h-2.399l-1.303 6.491-1.411-6.491h-2.54L36.299 16h2.457l1.436-6.591ZM50.41 16V6.952h-2.399V16h2.399ZM50.41 5.873V3.689h-2.399v2.184h2.399ZM56.852 16.083v-1.768l-.241.016h-.224c-.482 0-.769-.044-.863-.133-.094-.094-.142-.326-.142-.697V8.72h1.47V7.035h-1.47V4.51h-2.34v2.524H51.78V8.72h1.262v5.57c0 .564.132.982.398 1.253.41.426 1.173.62 2.291.581l1.121-.041ZM66.547 16v-5.313c0-.808-.028-1.389-.083-1.743a2.347 2.347 0 0 0-.457-1.046 2.656 2.656 0 0 0-1.128-.888 3.836 3.836 0 0 0-1.519-.29c-.499 0-.974.104-1.428.315-.448.204-.844.57-1.187 1.095V3.806h-2.358V16h2.358v-4.898c0-.775.16-1.37.481-1.785.327-.42.803-.63 1.428-.63.603 0 1.013.21 1.228.63.167.3.25.692.25 1.18V16h2.415Z\"\n />\n <path\n fill=\"#fff\"\n fill-rule=\"evenodd\"\n d=\"M103 16h1.997l1.276-2.003h3.56l.265 2.003H112l-1.337-9h-1.778L103 16Zm6.231-6.674.383 2.954h-2.237l1.854-2.954ZM98.02 16l.754-2.72h1.752a6.36 6.36 0 0 0 1.762-.228c.512-.139.992-.37 1.412-.683.398-.299.721-.677.95-1.107.24-.465.36-.978.349-1.496 0-.772-.239-1.389-.716-1.85a2.871 2.871 0 0 0-1.195-.7A5.816 5.816 0 0 0 101.401 7h-2.926L96 16h2.02Zm3.307-7.205c.257-.007.512.026.757.097.194.06.368.165.51.304.101.098.18.215.232.344a.977.977 0 0 1 .072.402c.012.232-.039.463-.147.671-.108.209-.27.387-.471.519-.413.279-.955.418-1.635.418h-1.38l.751-2.752h1.314l-.003-.003Z\"\n clip-rule=\"evenodd\"\n />\n <path\n fill=\"#fff\"\n d=\"m113.439 16 .982-3.548L112.5 7h2.266l1.087 3.73L119.112 7h2.388l-5.078 5.63-.939 3.37h-2.044Z\"\n />\n </svg>\n </div>\n ");
11980
+ return "\n <div id=\"".concat(containerId, "-loading-overlay\"></div>\n <div class=\"").concat(classNames, "\" tabindex=\"0\">\n <svg\n viewBox=\"0 0 356 74\"\n data-name=\"pay-with-coles-pay\"\n fill=\"none\"\n style=\"grid-area: center; width: 100%; height: 100%\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M274.326 54.9868H280.946L282.661 45.6527C284.218 47.6804 286.291 48.3936 288.803 48.3936C295.623 48.3936 301.962 42.0781 301.962 34.2162C301.962 28.3776 298.69 24.8447 293.149 24.8447C290.275 24.8447 287.766 25.9146 285.693 28.0209H285.57L286.009 25.5993H279.787L274.326 54.9868ZM283.973 37.6743C283.973 34.1788 287.203 31.0023 290.633 31.0023L290.631 30.9983C293.502 30.9983 295.255 32.9058 295.255 35.6051C295.255 38.9847 292.103 42.24 288.558 42.24C285.888 42.24 283.973 40.4153 283.973 37.6743ZM318.51 47.643L318.946 45.2588H318.868C317.311 47.3237 314.641 48.3976 311.81 48.3976C306.306 48.3976 302.638 44.7818 302.638 39.1837C302.638 31.1228 309.298 24.8447 316.156 24.8447C318.988 24.8447 321.304 25.9185 322.098 27.9421H322.178L322.614 25.5993H329.236L325.125 47.643H318.51ZM320.663 35.5305C320.663 32.7896 318.825 31.0023 315.994 31.0023C312.646 31.0023 309.416 34.1414 309.416 37.5957C309.416 40.3367 311.131 42.244 313.963 42.244C317.593 42.244 320.663 39.0677 320.663 35.5305ZM329.356 54.991L334.419 46.5317L330.112 25.5993H337.17L339.204 38.3877H339.281L345.901 25.5993H352.922L336.372 54.991H329.356Z\" fill=\"white\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M221.032 18.351H226.224V48.4268H221.032V18.351ZM250.228 37.6828C250.261 37.2972 250.277 36.9033 250.277 36.5052C250.299 27.764 243.627 24.82 239.026 24.8158C234.423 24.8158 227.755 27.764 227.772 36.5052C227.76 43.7494 233.044 48.4228 239.031 48.4228C244.006 48.4353 248.383 45.1468 249.731 40.3781H244.64C243.599 42.5303 241.424 43.907 239.026 43.9402C235.888 43.9402 233.084 41.5268 232.585 37.6828H250.228ZM239.026 29.0661C241.876 29.067 244.381 30.9494 245.165 33.6814H232.887C233.669 30.9494 236.173 29.067 239.026 29.0661ZM260.582 48.3605C254.591 48.3605 251.156 45.4868 251.156 40.4776V40.3741H255.84V40.4736C256.047 43.14 257.729 44.4419 260.994 44.4419C263.706 44.4419 265.39 43.339 265.39 41.5642C265.39 40.063 264.245 39.495 261.988 38.931L258.678 38.0976C256.214 37.4962 254.565 36.783 253.495 35.8626C252.313 34.8341 251.677 33.3207 251.771 31.7574C251.717 29.8332 252.563 27.988 254.059 26.7729C255.585 25.5289 257.793 24.8779 260.441 24.8779C263.088 24.8779 265.482 25.5539 267.093 26.8353C268.684 28.0793 269.593 29.999 269.541 32.0103V32.0517H264.895V32.0103C264.771 29.8539 263.18 28.7136 260.29 28.7136C258.016 28.7136 256.61 29.6094 256.61 31.044C256.61 32.6447 258.009 33.2875 260.266 33.7974L263.072 34.4235C267.685 35.4894 270.184 36.8494 270.184 40.9713C270.262 43.0652 269.334 45.0765 267.685 46.3826C266.052 47.6598 263.576 48.3565 260.591 48.3565L260.582 48.3605ZM219.496 36.6172C219.496 30.0986 214.191 24.8158 207.646 24.8158C201.101 24.8158 195.796 30.0986 195.796 36.6172C195.796 43.1357 201.101 48.4186 207.646 48.4186C214.191 48.4186 219.496 43.1357 219.496 36.6172ZM214.754 36.6172C214.754 40.5275 211.568 43.6998 207.641 43.6998C203.716 43.6998 200.531 40.5275 200.531 36.6172C200.531 32.7068 203.716 29.5346 207.641 29.5346C211.568 29.5346 214.754 32.7068 214.754 36.6172ZM180.333 25.1765C186.679 23.58 193.122 27.4075 194.727 33.727V33.731H189.725C189.009 32.1388 187.732 30.8699 186.137 30.1567C182.552 28.5602 178.347 30.1609 176.744 33.731C175.14 37.3014 176.748 41.4894 180.333 43.0859C183.918 44.6823 188.123 43.0819 189.725 39.5115H194.727C193.659 43.7162 190.363 47.0005 186.142 48.0619C179.795 49.6583 173.35 45.831 171.747 39.5115C170.144 33.192 173.987 26.7729 180.333 25.1765Z\" fill=\"white\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M8.47326 37.2345H14.5938C17.7883 37.2345 20.2454 36.531 21.9652 35.1263C23.6873 33.7192 24.5472 31.3145 24.5472 27.9192C24.5472 24.8063 23.6873 22.5075 21.9652 21.0251C20.2454 19.5404 17.9367 18.7969 15.0437 18.7969H2.48941V47.5875H8.47326V37.2345ZM18.5822 27.9569C18.5822 29.4557 18.1911 30.5498 17.409 31.2392C16.6151 31.9286 15.5055 32.2745 14.0849 32.2745H8.47326V23.7969H14.0849C15.5055 23.7969 16.608 24.1169 17.3901 24.7545C18.1841 25.3922 18.5822 26.4604 18.5822 27.9569ZM37.0049 25.7898C33.4193 25.7898 30.8891 26.7263 29.4167 28.6016C28.4909 29.8016 27.9702 31.331 27.8525 33.1898H33.2308C33.3604 32.371 33.6219 31.7216 34.013 31.2369C34.5595 30.5875 35.4925 30.2628 36.8094 30.2628C37.9826 30.2628 38.8684 30.4322 39.4668 30.771C40.0816 31.0957 40.3879 31.6933 40.3879 32.5663C40.3879 33.2839 39.9898 33.811 39.1935 34.1498C38.7506 34.3451 38.0132 34.5075 36.9837 34.6369L35.0873 34.8722C32.9364 35.1451 31.3061 35.6016 30.1989 36.2369C28.1776 37.411 27.1669 39.3051 27.1669 41.9216C27.1669 43.9404 27.7936 45.5028 29.0445 46.611C30.3096 47.7028 31.9069 48.251 33.8363 48.251C35.3488 48.251 36.7034 47.9051 37.9025 47.2157C38.891 46.6432 39.7876 45.9253 40.5622 45.0863C40.6023 45.5686 40.6541 45.9992 40.7201 46.3757C40.7837 46.7522 40.9015 47.1569 41.0711 47.5875H47.1327V46.7663C46.8069 46.6282 46.5237 46.4056 46.3129 46.1216C46.1291 45.8628 46.0184 45.3686 45.9807 44.6392C45.9548 43.6745 45.9406 42.8533 45.9406 42.1757V32.411C45.9406 29.8463 45.0336 28.1004 43.222 27.1757C41.4104 26.251 39.3372 25.7898 37.0049 25.7898ZM35.4783 44.2086C34.7221 44.2086 34.0837 43.9922 33.563 43.5639C33.0282 43.1475 32.7597 42.4628 32.7597 41.5122C32.7597 40.4439 33.1908 39.6581 34.0507 39.1498C34.5595 38.8486 35.4006 38.5945 36.5738 38.3875L37.8248 38.1522C38.4514 38.0345 38.9391 37.9122 39.2924 37.7828C39.6576 37.6392 40.0157 37.4557 40.3667 37.2345V39.3051C40.329 41.1663 39.8013 42.4486 38.7836 43.1522C37.8207 43.843 36.664 44.2129 35.4783 44.2086Z\" fill=\"white\"/>\n <path d=\"M63.9699 26.3L59.5716 42.0035L54.9164 26.3H48.7182L56.5396 48.5258C56.5914 48.6811 56.4736 49.1141 56.1886 49.8153C55.9129 50.5188 55.6138 50.98 55.2887 51.2035C54.9494 51.4364 54.5324 51.5847 54.0377 51.6506C53.5185 51.7164 52.9941 51.736 52.4711 51.7094L51.769 51.6694V56.1235C52.3674 56.1635 52.8174 56.1823 53.1166 56.1823C53.4181 56.1941 53.8139 56.2011 54.311 56.2011C56.7752 56.2011 58.4172 55.7141 59.2394 54.7376C60.0592 53.7729 61.1736 51.2741 62.5824 47.2364L69.8949 26.3H63.9699ZM97.1756 32.0811L100.519 47.587H106.25L112.43 26.3H106.62L103.296 41.6317L100.05 26.3H94.3981L91.3284 41.5729L88.0043 26.3H82.0204L88.0043 47.5894H93.7926L97.1756 32.0811ZM121.248 47.5894V26.3H115.596V47.5894H121.248ZM121.248 23.7611V18.6223H115.596V23.7611H121.248ZM136.424 47.7847V43.6247L135.856 43.6623H135.329C134.193 43.6623 133.517 43.5588 133.295 43.3494C133.074 43.1282 132.961 42.5823 132.961 41.7094V30.46H136.424V26.4953H132.961V20.5541H127.448V26.4929H124.475V30.46H127.448V43.5658C127.448 44.8929 127.759 45.8764 128.386 46.5141C129.352 47.5164 131.149 47.9729 133.783 47.8811L136.424 47.7847ZM159.264 47.5894V35.0882C159.264 33.187 159.198 31.82 159.068 30.987C158.918 30.0906 158.548 29.2451 157.992 28.5258C157.315 27.5988 156.395 26.876 155.334 26.4364C154.2 25.9687 152.983 25.7364 151.756 25.7541C150.58 25.7541 149.461 25.9988 148.392 26.4953C147.336 26.9753 146.403 27.8364 145.595 29.0717V18.8976H140.04V47.5894H145.595V36.0647C145.595 34.2411 145.972 32.8411 146.729 31.8647C147.499 30.8764 148.62 30.3823 150.093 30.3823C151.513 30.3823 152.479 30.8764 152.986 31.8647C153.379 32.5705 153.575 33.4929 153.575 34.6411V47.5894H159.264Z\" fill=\"white\"/>\n </svg>\n </div>\n ");
10402
11981
  }
10403
11982
 
10404
11983
  /**
@@ -10502,7 +12081,7 @@
10502
12081
  this.flypayV2Button = document.createElement('button');
10503
12082
  this.flypayV2Button.classList.add(getWidgetClassName(this.widgetId));
10504
12083
  this.flypayV2Button.setAttribute('type', 'button');
10505
- this.flypayV2Button.setAttribute('aria-label', 'Pay with flypay');
12084
+ this.flypayV2Button.setAttribute('aria-label', 'Pay with Coles Pay');
10506
12085
  this.flypayV2Button.setAttribute('id', this.widgetId);
10507
12086
  this.flypayV2Button.innerHTML = getFlypayV2Button(this.widgetId);
10508
12087
  return this.flypayV2Button;
@@ -10542,7 +12121,11 @@
10542
12121
  return resolve(res.id);
10543
12122
  },
10544
12123
  onError: function onError(message, code) {
10545
- return reject({
12124
+ console.error('Error generating order id', message);
12125
+ _this4.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
12126
+ message: message
12127
+ });
12128
+ reject({
10546
12129
  message: message,
10547
12130
  code: code
10548
12131
  });
@@ -11194,7 +12777,11 @@
11194
12777
  return resolve(res);
11195
12778
  },
11196
12779
  onError: function onError(message) {
11197
- return reject(message);
12780
+ console.error('Error generating order id', message);
12781
+ _this4.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
12782
+ message: message
12783
+ });
12784
+ reject(message);
11198
12785
  }
11199
12786
  });
11200
12787
  });
@@ -11850,8 +13437,12 @@
11850
13437
  onSuccess: function onSuccess(res) {
11851
13438
  return resolve(res.id);
11852
13439
  },
11853
- onError: function onError(err) {
11854
- return reject(err);
13440
+ onError: function onError(error) {
13441
+ console.error('Error generating order id', error);
13442
+ _this4.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
13443
+ error: error
13444
+ });
13445
+ reject(error);
11855
13446
  }
11856
13447
  });
11857
13448
  });
@@ -15456,18 +17047,18 @@
15456
17047
  }(InstructionHandler);
15457
17048
  InstructionCardFormShow = __decorate([Instruction('instruction.card_form.show')], InstructionCardFormShow);
15458
17049
 
15459
- var TEMPLATE = "\n<style>\n @import url('https://fonts.cdnfonts.com/css/segoe-ui-4');\n @import url('https://fonts.cdnfonts.com/css/droid-sans-2');\n @import url('https://fonts.cdnfonts.com/css/helvetica-neue-55');\n @import url('https://fonts.googleapis.com/css2?family=Cantarell&family=Fira+Sans&family=Oxygen&family=Roboto&family=Ubuntu&display=swap');\n \n /* RESET DEFAULT STYLES */\n *,\n *:before,\n *:after {\n box-sizing: border-box;\n }\n\n html,\n body,\n div,\n span,\n applet,\n object,\n iframe,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n p,\n blockquote,\n pre,\n a,\n abbr,\n acronym,\n address,\n big,\n cite,\n code,\n del,\n dfn,\n em,\n img,\n ins,\n kbd,\n q,\n s,\n samp,\n small,\n strike,\n strong,\n sub,\n sup,\n tt,\n var,\n b,\n u,\n i,\n center,\n dl,\n dt,\n dd,\n ol,\n ul,\n li,\n fieldset,\n form,\n label,\n legend,\n table,\n caption,\n tbody,\n tfoot,\n thead,\n tr,\n th,\n td,\n article,\n aside,\n canvas,\n details,\n embed,\n figure,\n figcaption,\n footer,\n header,\n hgroup,\n menu,\n nav,\n output,\n ruby,\n section,\n summary,\n time,\n mark,\n audio,\n video,\n input {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n article,\n aside,\n details,\n figcaption,\n figure,\n footer,\n header,\n hgroup,\n menu,\n nav,\n section {\n display: block;\n }\n\n body {\n line-height: 1;\n }\n\n ol,\n ul {\n list-style: none;\n }\n\n ul {\n padding: 0;\n margin: 0;\n }\n\n /* MAIN STYLES */\n .wrap {\n padding: 10px;\n background-color: {{background_color}};\n }\n\n .widget-body {\n background-color: #fff;\n border: 1px solid {{border_color}};\n }\n\n .payment-source {\n padding: 1em 0.8em;\n display: flex;\n align-items: center;\n height: 70px;\n }\n\n .payment-source:not(:last-child) {\n border-bottom: 1px solid {{border_color}};\n }\n\n .payment-source__wrap {\n display: flex;\n align-items: center;\n font-family: {{font_family}};\n font-size: {{font_size}};\n color: {{text_color}}\n }\n\n .payment-source__radio {\n margin-right: 2em;\n width: 18px;\n min-width: 18px;\n height: 18px;\n border: 1px solid {{button_color}};\n border-radius: 50%;\n appearance: none;\n cursor: pointer;\n\n @media screen and (max-width: 380px) {\n margin-right: 1em;\n }\n }\n\n .payment-source__radio::before {\n content: \"\";\n display: block;\n width: 100%;\n height: 100%;\n background-color: #fff;\n border-radius: 50%;\n }\n\n .payment-source__radio:checked::before {\n border: 4px solid {{button_color}};\n outline: 1px solid {{button_color}};\n }\n\n .payment-source__title {\n margin-right: 2em;\n font-weight: 400;\n line-height: 1.2;\n\n @media screen and (max-width: 380px) {\n margin-right: 1em;\n font-size: 14px;\n }\n }\n\n .payment-source__icon {\n margin-right: 2em;\n max-height: 35px;\n\n @media screen and (max-width: 380px) {\n margin-right: 1em;\n }\n }\n\n .payment-source .card__scheme {\n margin-left: auto;\n display: flex;\n align-items: center;\n }\n\n .payment-source .card__scheme__item:not(:last-child) {\n margin-right: 10px;\n }\n\n .payment-source .card__scheme__img {\n max-width: 50px;\n\n @media screen and (max-width: 460px) {\n max-width: 40px;\n }\n\n @media screen and (max-width: 410px) {\n max-width: 30px;\n }\n }\n\n .payment-source__form {\n margin-top: 1em;\n margin-bottom: 1em;\n margin-left: calc(2em + 18px);\n\n @media screen and (max-width: 380px) {\n margin-left: calc(1em + 18px);\n }\n }\n\n .payment-source__form .form-group:not(:last-child) {\n margin-bottom: 1.5em;\n }\n\n .payment-source__form .form-control {\n padding: 10px 2px 10px 10px;\n height: 40px;\n background: #F9F9F9;\n border: 1px solid {{border_color}};\n }\n\n .payment-source__form .form-control:not(:last-child) {\n margin-right: 1.5em;\n }\n\n .payment-source__form .form-control.col-12 {\n width: calc(100% - 1.5em);\n }\n\n .payment-source__form .form-control.col-3 {\n width: calc(33.33% - 1.5em);\n }\n\n .footer__pay-btn {\n margin-left: auto;\n padding: 10px 2em;\n height: 50px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #F6F0EB;\n font-size: 16px;\n background-color: {{button_color}};\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.10), 0 0 0 0.5px rgba(0, 0, 0, 0.10);\n border: none;\n border-radius: 6px;\n cursor: pointer;\n }\n\n .footer__pay-btn--paypal {\n padding: 5px 2em;\n background-color: #FFC43A;\n }\n\n .footer__pay-btn--gpay {\n font-size: 22px;\n }\n\n .footer__pay-btn--gpay img {\n margin-left: 5px;\n }\n\n .footer__pay-btn img {\n max-height: 100%;\n }\n</style>\n<main class=\"wrap\">\n <div class=\"widget-body\">\n <ul class=\"payment-sources__list\">\n {{paymentMethods}}\n </ul>\n </div>\n</main>\n</div>\n";
17050
+ var TEMPLATE = "\n<style>\n @import url('https://fonts.cdnfonts.com/css/segoe-ui-4');\n @import url('https://fonts.cdnfonts.com/css/droid-sans-2');\n @import url('https://fonts.cdnfonts.com/css/helvetica-neue-55');\n @import url('https://fonts.googleapis.com/css2?family=Cantarell&family=Fira+Sans&family=Oxygen&family=Roboto&family=Ubuntu&display=swap');\n \n /* RESET DEFAULT STYLES */\n *,\n *:before,\n *:after {\n box-sizing: border-box;\n }\n\n html,\n body,\n div,\n span,\n applet,\n object,\n iframe,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n p,\n blockquote,\n pre,\n a,\n abbr,\n acronym,\n address,\n big,\n cite,\n code,\n del,\n dfn,\n em,\n img,\n ins,\n kbd,\n q,\n s,\n samp,\n small,\n strike,\n strong,\n sub,\n sup,\n tt,\n var,\n b,\n u,\n i,\n center,\n dl,\n dt,\n dd,\n ol,\n ul,\n li,\n fieldset,\n form,\n label,\n legend,\n table,\n caption,\n tbody,\n tfoot,\n thead,\n tr,\n th,\n td,\n article,\n aside,\n canvas,\n details,\n embed,\n figure,\n figcaption,\n footer,\n header,\n hgroup,\n menu,\n nav,\n output,\n ruby,\n section,\n summary,\n time,\n mark,\n audio,\n video,\n input {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n article,\n aside,\n details,\n figcaption,\n figure,\n footer,\n header,\n hgroup,\n menu,\n nav,\n section {\n display: block;\n }\n\n body {\n line-height: 1;\n }\n\n ol,\n ul {\n list-style: none;\n }\n\n ul {\n padding: 0;\n margin: 0;\n }\n\n /* MAIN STYLES */\n .wrap {\n padding: 10px;\n background-color: {{background_color}};\n }\n\n .widget-body {\n background-color: #fff;\n border: 1px solid {{border_color}};\n }\n\n .payment-source {\n cursor: pointer;\n padding: 1em 0.8em;\n display: flex;\n align-items: center;\n height: 70px;\n }\n\n .payment-source:not(:last-child) {\n border-bottom: 1px solid {{border_color}};\n }\n\n .payment-source__wrap {\n display: flex;\n align-items: center;\n font-family: {{font_family}};\n font-size: {{font_size}};\n color: {{text_color}}\n }\n\n .payment-source__radio {\n margin-right: 2em;\n width: 18px;\n min-width: 18px;\n height: 18px;\n border: 1px solid {{button_color}};\n border-radius: 50%;\n appearance: none;\n cursor: pointer;\n\n @media screen and (max-width: 380px) {\n margin-right: 1em;\n }\n }\n\n .payment-source__radio::before {\n content: \"\";\n display: block;\n width: 100%;\n height: 100%;\n background-color: #fff;\n border-radius: 50%;\n }\n\n .payment-source__radio:checked::before {\n border: 4px solid {{button_color}};\n outline: 1px solid {{button_color}};\n }\n\n .payment-source__title {\n margin-right: 2em;\n font-weight: 400;\n line-height: 1.2;\n\n @media screen and (max-width: 380px) {\n margin-right: 1em;\n font-size: 14px;\n }\n }\n\n .payment-source__icon {\n margin-right: 2em;\n max-height: 35px;\n\n @media screen and (max-width: 380px) {\n margin-right: 1em;\n }\n }\n\n .payment-source .card__scheme {\n margin-left: auto;\n display: flex;\n align-items: center;\n }\n\n .payment-source .card__scheme__item:not(:last-child) {\n margin-right: 10px;\n }\n\n .payment-source .card__scheme__img {\n max-width: 50px;\n\n @media screen and (max-width: 460px) {\n max-width: 40px;\n }\n\n @media screen and (max-width: 410px) {\n max-width: 30px;\n }\n }\n\n .payment-source__form {\n margin-top: 1em;\n margin-bottom: 1em;\n margin-left: calc(2em + 18px);\n\n @media screen and (max-width: 380px) {\n margin-left: calc(1em + 18px);\n }\n }\n\n .payment-source__form .form-group:not(:last-child) {\n margin-bottom: 1.5em;\n }\n\n .payment-source__form .form-control {\n padding: 10px 2px 10px 10px;\n height: 40px;\n background: #F9F9F9;\n border: 1px solid {{border_color}};\n }\n\n .payment-source__form .form-control:not(:last-child) {\n margin-right: 1.5em;\n }\n\n .payment-source__form .form-control.col-12 {\n width: calc(100% - 1.5em);\n }\n\n .payment-source__form .form-control.col-3 {\n width: calc(33.33% - 1.5em);\n }\n\n .footer__pay-btn {\n margin-left: auto;\n padding: 10px 2em;\n height: 50px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #F6F0EB;\n font-size: 16px;\n background-color: {{button_color}};\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.10), 0 0 0 0.5px rgba(0, 0, 0, 0.10);\n border: none;\n border-radius: 6px;\n cursor: pointer;\n }\n\n .footer__pay-btn--paypal {\n padding: 5px 2em;\n background-color: #FFC43A;\n }\n\n .footer__pay-btn--gpay {\n font-size: 22px;\n }\n\n .footer__pay-btn--gpay img {\n margin-left: 5px;\n }\n\n .footer__pay-btn img {\n max-height: 100%;\n }\n</style>\n<main class=\"wrap\">\n <div class=\"widget-body\">\n <ul class=\"payment-sources__list\">\n {{paymentMethods}}\n </ul>\n </div>\n</main>\n</div>\n";
15460
17051
 
15461
17052
  var PAYMENT_METHOD = {
15462
- card: "<li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"card\" type=\"radio\" name=\"radio-group\" />\n <h2 class=\"payment-source__title\">Pay with Credit or Debit card</h2>\n </div>\n</li>",
15463
- bank_account: "<li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"bank_account\" type=\"radio\" name=\"radio-group\" />\n <h2 class=\"payment-source__title\">Pay Bank Account</h2>\n </div>\n</li>",
15464
- paypal_wallet: "<li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"paypal_wallet\" type=\"radio\" name=\"radio-group\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"28\" viewBox=\"0 0 338.667 89.785\" xmlns:v=\"https://vecta.io/nano\"><g transform=\"translate(936.898 -21.779)\"><path clip-path=\"none\" d=\"M-828.604 39.734c-.697 0-1.289.506-1.398 1.195l-8.068 51.165a1.31 1.31 0 0 0 1.294 1.513h9.568c.696 0 1.289-.507 1.398-1.195l2.37-15.025c.108-.688.701-1.195 1.398-1.195h8.699c10.164 0 18.792-7.416 20.368-17.465 1.589-10.134-6.328-18.971-17.549-18.993zm9.301 11.422h6.96c5.73 0 7.596 3.381 7.006 7.12-.59 3.747-3.488 6.507-9.031 6.507h-7.084zm45.788 3.478c-2.416.009-5.196.504-8.317 1.804-7.159 2.984-10.597 9.151-12.057 13.647 0 0-4.647 13.717 5.852 21.253 0 0 9.737 7.255 20.698-.447l-.189 1.203a1.31 1.31 0 0 0 1.292 1.513h9.083c.697 0 1.289-.507 1.398-1.195l5.525-35.038a1.31 1.31 0 0 0-1.292-1.515h-9.083c-.697 0-1.29.507-1.398 1.195l-.297 1.886s-3.967-4.333-11.216-4.306zm.297 11.067c1.043 0 1.997.144 2.853.419 3.919 1.258 6.141 5.023 5.498 9.104-.793 5.025-4.914 8.725-10.199 8.725-1.042 0-1.996-.143-2.853-.418-3.918-1.258-6.154-5.023-5.511-9.104.793-5.025 4.927-8.727 10.212-8.727z\" fill=\"#003087\"/><path clip-path=\"none\" d=\"M-697.804 39.734c-.697 0-1.289.506-1.398 1.195l-8.068 51.165a1.31 1.31 0 0 0 1.294 1.513h9.568c.696 0 1.289-.507 1.398-1.195l2.37-15.025c.108-.688.701-1.195 1.398-1.195h8.699c10.164 0 18.791-7.416 20.366-17.465 1.59-10.134-6.326-18.971-17.547-18.993zm9.301 11.422h6.96c5.73 0 7.596 3.381 7.006 7.12-.59 3.747-3.487 6.507-9.031 6.507h-7.084zm45.787 3.478c-2.416.009-5.196.504-8.317 1.804-7.159 2.984-10.597 9.151-12.057 13.647 0 0-4.645 13.717 5.854 21.253 0 0 9.735 7.255 20.697-.447l-.189 1.203a1.31 1.31 0 0 0 1.294 1.513h9.082c.697 0 1.289-.507 1.398-1.195l5.527-35.038a1.31 1.31 0 0 0-1.294-1.515h-9.083c-.697 0-1.29.507-1.398 1.195l-.297 1.886s-3.967-4.333-11.216-4.306zm.297 11.067c1.043 0 1.997.144 2.853.419 3.919 1.258 6.141 5.023 5.498 9.104-.793 5.025-4.914 8.725-10.199 8.725-1.042 0-1.996-.143-2.853-.418-3.918-1.258-6.154-5.023-5.511-9.104.793-5.025 4.927-8.727 10.212-8.727z\" fill=\"#0070e0\"/><path clip-path=\"none\" d=\"M-745.92 55.859c-.72 0-1.232.703-1.012 1.388l9.958 30.901-9.004 14.562c-.437.707.071 1.62.902 1.62h10.642a1.77 1.77 0 0 0 1.513-.854l27.811-46.007c.427-.707-.083-1.611-.909-1.611h-10.641a1.77 1.77 0 0 0-1.522.869l-10.947 18.482-5.557-18.345c-.181-.597-.732-1.006-1.355-1.006z\" fill=\"#003087\"/><path clip-path=\"none\" d=\"M-609.107 39.734c-.696 0-1.289.507-1.398 1.195l-8.07 51.163a1.31 1.31 0 0 0 1.294 1.515h9.568c.696 0 1.289-.507 1.398-1.195l8.068-51.165a1.31 1.31 0 0 0-1.292-1.513z\" fill=\"#0070e0\"/><path clip-path=\"none\" d=\"M-908.37 39.734a2.59 2.59 0 0 0-2.556 2.185l-4.247 26.936c.198-1.258 1.282-2.185 2.556-2.185h12.445c12.525 0 23.153-9.137 25.095-21.519a20.76 20.76 0 0 0 .245-2.793c-3.183-1.669-6.922-2.624-11.019-2.624z\" fill=\"#001c64\"/><path clip-path=\"none\" d=\"M-874.832 42.359a20.76 20.76 0 0 1-.245 2.793c-1.942 12.382-12.571 21.519-25.095 21.519h-12.445c-1.273 0-2.358.926-2.556 2.185l-3.905 24.752-2.446 15.528a2.1 2.1 0 0 0 2.075 2.43h13.508a2.59 2.59 0 0 0 2.556-2.185l3.558-22.567a2.59 2.59 0 0 1 2.558-2.185h7.953c12.525 0 23.153-9.137 25.095-21.519 1.379-8.788-3.047-16.784-10.611-20.75z\" fill=\"#0070e0\"/><path clip-path=\"none\" d=\"M-923.716 21.779c-1.273 0-2.358.926-2.556 2.183l-10.6 67.216c-.201 1.276.785 2.43 2.077 2.43h15.719l3.903-24.752 4.247-26.936a2.59 2.59 0 0 1 2.556-2.185h22.519c4.098 0 7.836.956 11.019 2.624.218-11.273-9.084-20.58-21.873-20.58z\" fill=\"#003087\"/></g></svg>\n </div>\n</li>",
15465
- googlepay_wallet: "<li class=\"payment-source\">\n <div max-height: \"28px\" class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"googlepay_wallet\" type=\"radio\" name=\"radio-group\" />\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n width=\"80px\" height=\"38px\" viewBox=\"0 0 80 38.1\" xml:space=\"preserve\">\n <style type=\"text/css\">\n .st0{fill:#5F6368;}\n .st1{fill:#4285F4;}\n .st2{fill:#34A853;}\n .st3{fill:#FBBC04;}\n .st4{fill:#EA4335;}\n </style>\n <path class=\"st0\" d=\"M37.8,19.7V29h-3V6h7.8c1.9,0,3.7,0.7,5.1,2c1.4,1.2,2.1,3,2.1,4.9c0,1.9-0.7,3.6-2.1,4.9c-1.4,1.3-3.1,2-5.1,2\n L37.8,19.7L37.8,19.7z M37.8,8.8v8h5c1.1,0,2.2-0.4,2.9-1.2c1.6-1.5,1.6-4,0.1-5.5c0,0-0.1-0.1-0.1-0.1c-0.8-0.8-1.8-1.3-2.9-1.2\n L37.8,8.8L37.8,8.8z\"/>\n <path class=\"st0\" d=\"M56.7,12.8c2.2,0,3.9,0.6,5.2,1.8s1.9,2.8,1.9,4.8V29H61v-2.2h-0.1c-1.2,1.8-2.9,2.7-4.9,2.7\n c-1.7,0-3.2-0.5-4.4-1.5c-1.1-1-1.8-2.4-1.8-3.9c0-1.6,0.6-2.9,1.8-3.9c1.2-1,2.9-1.4,4.9-1.4c1.8,0,3.2,0.3,4.3,1v-0.7\n c0-1-0.4-2-1.2-2.6c-0.8-0.7-1.8-1.1-2.9-1.1c-1.7,0-3,0.7-3.9,2.1l-2.6-1.6C51.8,13.8,53.9,12.8,56.7,12.8z M52.9,24.2\n c0,0.8,0.4,1.5,1,1.9c0.7,0.5,1.5,0.8,2.3,0.8c1.2,0,2.4-0.5,3.3-1.4c1-0.9,1.5-2,1.5-3.2c-0.9-0.7-2.2-1.1-3.9-1.1\n c-1.2,0-2.2,0.3-3,0.9C53.3,22.6,52.9,23.3,52.9,24.2z\"/>\n <path class=\"st0\" d=\"M80,13.3l-9.9,22.7h-3l3.7-7.9l-6.5-14.7h3.2l4.7,11.3h0.1l4.6-11.3H80z\"/>\n <path class=\"st1\" d=\"M25.9,17.7c0-0.9-0.1-1.8-0.2-2.7H13.2v5.1h7.1c-0.3,1.6-1.2,3.1-2.6,4v3.3H22C24.5,25.1,25.9,21.7,25.9,17.7z\"\n />\n <path class=\"st2\" d=\"M13.2,30.6c3.6,0,6.6-1.2,8.8-3.2l-4.3-3.3c-1.2,0.8-2.7,1.3-4.5,1.3c-3.4,0-6.4-2.3-7.4-5.5H1.4v3.4\n C3.7,27.8,8.2,30.6,13.2,30.6z\"/>\n <path class=\"st3\" d=\"M5.8,19.9c-0.6-1.6-0.6-3.4,0-5.1v-3.4H1.4c-1.9,3.7-1.9,8.1,0,11.9L5.8,19.9z\"/>\n <path class=\"st4\" d=\"M13.2,9.4c1.9,0,3.7,0.7,5.1,2l0,0l3.8-3.8c-2.4-2.2-5.6-3.5-8.8-3.4c-5,0-9.6,2.8-11.8,7.3l4.4,3.4\n C6.8,11.7,9.8,9.4,13.2,9.4z\"/>\n </svg>\n </div>\n</li>",
15466
- flypay: "<li class=\"payment-source\">\n<div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"flypay\" type=\"radio\" name=\"radio-group\" />\n <div class=\"payment-source__icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"38\" viewBox=\"0 0 82 40\" fill=\"none\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M18.2312 5.46959C18.2312 4.98803 18.6216 4.59766 19.1031 4.59766H77.3212C80.3349 4.59766 82.5618 7.40629 81.8747 10.3406L77.3202 29.7913C76.5899 32.9099 73.8086 35.1152 70.6056 35.1152H34.1637C33.6822 35.1152 33.2918 34.7248 33.2918 34.2432C33.2918 33.7617 33.6822 33.3713 34.1637 33.3713H70.6056C72.9986 33.3713 75.0766 31.7237 75.6222 29.3937L80.1768 9.94303C80.6077 8.10286 79.2111 6.34151 77.3212 6.34151H19.1031C18.6216 6.34151 18.2312 5.95114 18.2312 5.46959Z\" fill=\"black\"/>\n <path d=\"M4.29622 16.0912V27.204H0V13.6759C0 7.20014 3.7341 4.69238 7.7376 4.69238H11.5729V8.47799H7.7376C4.9845 8.47799 4.29622 11.0155 4.29622 12.2865H9.44925V16.0912H4.29622Z\" fill=\"black\"/>\n <path d=\"M17.2811 4.677L13.0007 5.78525V27.1886H17.2811V4.677Z\" fill=\"black\"/>\n <path d=\"M32.9749 29.2495V12.2073L28.7738 13.4755V19.579C28.7738 22.2741 28.0128 23.5424 25.9202 23.5424C23.8275 23.5424 23.1458 21.957 23.1458 20.1339V12.2073L19.1033 13.4755V20.451C19.1033 22.0363 19.3601 24.0179 21.2435 25.7618C23.3944 27.7535 27.0299 27.4 28.7738 26.7923V28.3776C28.7738 31.9287 27.7433 33.1336 25.0482 33.1336V36.9384C30.3591 36.9384 32.9749 33.9262 32.9749 29.2495Z\" fill=\"black\"/>\n <path d=\"M67.6141 27.1889H64.1264L65.6302 21.3583L62.72 12.2192H66.1873L68.0897 18.311L73.1558 12.2192H76.809L69.0409 21.6442L67.6141 27.1889Z\" fill=\"black\"/>\n <path d=\"M58.3963 23.8804H52.1572L50.166 27.1889H46.5293L56.4376 12.2192H59.9253L62.1448 27.1889H58.7363L58.3963 23.8804ZM57.8959 21.006L57.3095 16.3293L54.2181 21.006H57.8959Z\" fill=\"black\"/>\n <path d=\"M39.0708 27.1886H35.6699L39.1218 12.219H45.2077C49.3432 12.219 50.6898 15.7935 49.2718 19.256C47.7393 22.9981 43.469 22.5543 40.1532 22.5543L39.0708 27.1886ZM40.6637 19.8061C42.0281 19.8061 43.578 19.9845 44.8707 19.4997C46.1635 19.015 46.6087 18.4033 46.6087 16.9632C46.6087 15.3689 45.0509 15.2193 43.8905 15.2193H41.6848L40.6637 19.8061Z\" fill=\"black\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M23.2249 0.713641C23.2249 0.319643 23.5443 0.000244169 23.9382 0.000244203L47.7181 0.000246282C48.1121 0.000246316 48.4315 0.319645 48.4315 0.713643C48.4315 1.10764 48.1121 1.42704 47.7181 1.42704L23.9382 1.42704C23.5443 1.42704 23.2249 1.10764 23.2249 0.713641Z\" fill=\"black\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M39.2368 38.6028C39.2368 38.2088 39.5562 37.8894 39.9502 37.8894L63.7301 37.8894C64.1241 37.8894 64.4435 38.2088 64.4435 38.6028C64.4435 38.9968 64.1241 39.3162 63.7301 39.3162L39.9502 39.3162C39.5562 39.3162 39.2368 38.9968 39.2368 38.6028Z\" fill=\"black\"/>\n </svg>\n </div>\n</div>\n</li>",
15467
- zip_checkout: "<li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"zip_checkout\" type=\"radio\" name=\"radio-group\" />\n <svg height=\"30\" viewBox=\"0 0 768 285\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <g clip-path=\"url(#clip0)\">\n <path d=\"M19.53 227.27L26.19 281.53H259.36L251.73 219.39H143.01L142.06 211.69L242.19 141.72L235.5 87.3601H2.34998L9.97998 149.49H118.88L119.83 157.26L19.53 227.27Z\" fill=\"black\"/>\n <path d=\"M262.59 87.3601L286.44 281.53H519.78L495.93 87.3601H262.59Z\" fill=\"#AA8FFF\"/>\n <path d=\"M764.47 157.26C759.09 113.62 724.81 87.1701 678.21 87.3601H523L546.84 281.54H616.67L611.89 242.7H685.78C743.93 242.69 770.54 206.46 764.47 157.26ZM678.23 188.26L605.23 188.34L599.51 141.74L672.92 141.8C690.18 142.01 699.01 151.73 700.44 165.03C701.32 173.59 697.4 188.25 678.23 188.25V188.26Z\" fill=\"black\"/>\n <path d=\"M332.303 61.5598C344.584 48.3762 342.443 26.4212 327.522 12.522C312.601 -1.37727 290.549 -1.95741 278.269 11.2262C265.988 24.4098 268.129 46.3647 283.05 60.264C297.971 74.1632 320.023 74.7434 332.303 61.5598Z\" fill=\"black\"/>\n </g>\n <defs>\n <clipPath id=\"clip0\">\n <rect width=\"768\" height=\"285\" fill=\"white\"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n</li>",
15468
- applepay_wallet: "<li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"applepay_wallet\" type=\"radio\" name=\"radio-group\" />\n <svg version=\"1.1\" baseProfile=\"tiny\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n width=\"78px\" height=\"32px\" viewBox=\"0 0 512 210.2\" xml:space=\"preserve\">\n <path id=\"XMLID_34_\" d=\"M93.6,27.1C87.6,34.2,78,39.8,68.4,39c-1.2-9.6,3.5-19.8,9-26.1c6-7.3,16.5-12.5,25-12.9\n C103.4,10,99.5,19.8,93.6,27.1 M102.3,40.9c-13.9-0.8-25.8,7.9-32.4,7.9c-6.7,0-16.8-7.5-27.8-7.3c-14.3,0.2-27.6,8.3-34.9,21.2\n c-15,25.8-3.9,64,10.6,85c7.1,10.4,15.6,21.8,26.8,21.4c10.6-0.4,14.8-6.9,27.6-6.9c12.9,0,16.6,6.9,27.8,6.7\n c11.6-0.2,18.9-10.4,26-20.8c8.1-11.8,11.4-23.3,11.6-23.9c-0.2-0.2-22.4-8.7-22.6-34.3c-0.2-21.4,17.5-31.6,18.3-32.2\n C123.3,42.9,107.7,41.3,102.3,40.9 M182.6,11.9v155.9h24.2v-53.3h33.5c30.6,0,52.1-21,52.1-51.4c0-30.4-21.1-51.2-51.3-51.2H182.6z\n M206.8,32.3h27.9c21,0,33,11.2,33,30.9c0,19.7-12,31-33.1,31h-27.8V32.3z M336.6,169c15.2,0,29.3-7.7,35.7-19.9h0.5v18.7h22.4V90.2\n c0-22.5-18-37-45.7-37c-25.7,0-44.7,14.7-45.4,34.9h21.8c1.8-9.6,10.7-15.9,22.9-15.9c14.8,0,23.1,6.9,23.1,19.6v8.6l-30.2,1.8\n c-28.1,1.7-43.3,13.2-43.3,33.2C298.4,155.6,314.1,169,336.6,169z M343.1,150.5c-12.9,0-21.1-6.2-21.1-15.7c0-9.8,7.9-15.5,23-16.4\n l26.9-1.7v8.8C371.9,140.1,359.5,150.5,343.1,150.5z M425.1,210.2c23.6,0,34.7-9,44.4-36.3L512,54.7h-24.6l-28.5,92.1h-0.5\n l-28.5-92.1h-25.3l41,113.5l-2.2,6.9c-3.7,11.7-9.7,16.2-20.4,16.2c-1.9,0-5.6-0.2-7.1-0.4v18.7C417.3,210,423.3,210.2,425.1,210.2z\n \"/>\n </svg>\n </div>\n</li>\n",
15469
- afterpay_wallet: "<li class=\"payment-source\">\n<div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"afterpay_wallet\" type=\"radio\" name=\"radio-group\">\n ".concat(getIcon(paymentMethods.AFTERPAY), "\n</div>\n</li>"),
15470
- afterpay_checkout: "<li class=\"payment-source\">\n<div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"afterpay_checkout\" type=\"radio\" name=\"radio-group\">\n ".concat(getIcon(paymentMethods.AFTERPAY), "\n</div>\n</li>")
17053
+ card: "<label class=\"payment-source\">\n <li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"card\" type=\"radio\" name=\"radio-group\" />\n <h2 class=\"payment-source__title\">Pay with Credit or Debit card</h2>\n </div>\n </li>\n </label>",
17054
+ bank_account: "<label class=\"payment-source\">\n <li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"bank_account\" type=\"radio\" name=\"radio-group\" />\n <h2 class=\"payment-source__title\">Pay Bank Account</h2>\n </div>\n </li>\n </label>",
17055
+ paypal_wallet: "<label class=\"payment-source\">\n <li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"paypal_wallet\" type=\"radio\" name=\"radio-group\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"28\" viewBox=\"0 0 338.667 89.785\" xmlns:v=\"https://vecta.io/nano\"><g transform=\"translate(936.898 -21.779)\"><path clip-path=\"none\" d=\"M-828.604 39.734c-.697 0-1.289.506-1.398 1.195l-8.068 51.165a1.31 1.31 0 0 0 1.294 1.513h9.568c.696 0 1.289-.507 1.398-1.195l2.37-15.025c.108-.688.701-1.195 1.398-1.195h8.699c10.164 0 18.792-7.416 20.368-17.465 1.589-10.134-6.328-18.971-17.549-18.993zm9.301 11.422h6.96c5.73 0 7.596 3.381 7.006 7.12-.59 3.747-3.488 6.507-9.031 6.507h-7.084zm45.788 3.478c-2.416.009-5.196.504-8.317 1.804-7.159 2.984-10.597 9.151-12.057 13.647 0 0-4.647 13.717 5.852 21.253 0 0 9.737 7.255 20.698-.447l-.189 1.203a1.31 1.31 0 0 0 1.292 1.513h9.083c.697 0 1.289-.507 1.398-1.195l5.525-35.038a1.31 1.31 0 0 0-1.292-1.515h-9.083c-.697 0-1.29.507-1.398 1.195l-.297 1.886s-3.967-4.333-11.216-4.306zm.297 11.067c1.043 0 1.997.144 2.853.419 3.919 1.258 6.141 5.023 5.498 9.104-.793 5.025-4.914 8.725-10.199 8.725-1.042 0-1.996-.143-2.853-.418-3.918-1.258-6.154-5.023-5.511-9.104.793-5.025 4.927-8.727 10.212-8.727z\" fill=\"#003087\"/><path clip-path=\"none\" d=\"M-697.804 39.734c-.697 0-1.289.506-1.398 1.195l-8.068 51.165a1.31 1.31 0 0 0 1.294 1.513h9.568c.696 0 1.289-.507 1.398-1.195l2.37-15.025c.108-.688.701-1.195 1.398-1.195h8.699c10.164 0 18.791-7.416 20.366-17.465 1.59-10.134-6.326-18.971-17.547-18.993zm9.301 11.422h6.96c5.73 0 7.596 3.381 7.006 7.12-.59 3.747-3.487 6.507-9.031 6.507h-7.084zm45.787 3.478c-2.416.009-5.196.504-8.317 1.804-7.159 2.984-10.597 9.151-12.057 13.647 0 0-4.645 13.717 5.854 21.253 0 0 9.735 7.255 20.697-.447l-.189 1.203a1.31 1.31 0 0 0 1.294 1.513h9.082c.697 0 1.289-.507 1.398-1.195l5.527-35.038a1.31 1.31 0 0 0-1.294-1.515h-9.083c-.697 0-1.29.507-1.398 1.195l-.297 1.886s-3.967-4.333-11.216-4.306zm.297 11.067c1.043 0 1.997.144 2.853.419 3.919 1.258 6.141 5.023 5.498 9.104-.793 5.025-4.914 8.725-10.199 8.725-1.042 0-1.996-.143-2.853-.418-3.918-1.258-6.154-5.023-5.511-9.104.793-5.025 4.927-8.727 10.212-8.727z\" fill=\"#0070e0\"/><path clip-path=\"none\" d=\"M-745.92 55.859c-.72 0-1.232.703-1.012 1.388l9.958 30.901-9.004 14.562c-.437.707.071 1.62.902 1.62h10.642a1.77 1.77 0 0 0 1.513-.854l27.811-46.007c.427-.707-.083-1.611-.909-1.611h-10.641a1.77 1.77 0 0 0-1.522.869l-10.947 18.482-5.557-18.345c-.181-.597-.732-1.006-1.355-1.006z\" fill=\"#003087\"/><path clip-path=\"none\" d=\"M-609.107 39.734c-.696 0-1.289.507-1.398 1.195l-8.07 51.163a1.31 1.31 0 0 0 1.294 1.515h9.568c.696 0 1.289-.507 1.398-1.195l8.068-51.165a1.31 1.31 0 0 0-1.292-1.513z\" fill=\"#0070e0\"/><path clip-path=\"none\" d=\"M-908.37 39.734a2.59 2.59 0 0 0-2.556 2.185l-4.247 26.936c.198-1.258 1.282-2.185 2.556-2.185h12.445c12.525 0 23.153-9.137 25.095-21.519a20.76 20.76 0 0 0 .245-2.793c-3.183-1.669-6.922-2.624-11.019-2.624z\" fill=\"#001c64\"/><path clip-path=\"none\" d=\"M-874.832 42.359a20.76 20.76 0 0 1-.245 2.793c-1.942 12.382-12.571 21.519-25.095 21.519h-12.445c-1.273 0-2.358.926-2.556 2.185l-3.905 24.752-2.446 15.528a2.1 2.1 0 0 0 2.075 2.43h13.508a2.59 2.59 0 0 0 2.556-2.185l3.558-22.567a2.59 2.59 0 0 1 2.558-2.185h7.953c12.525 0 23.153-9.137 25.095-21.519 1.379-8.788-3.047-16.784-10.611-20.75z\" fill=\"#0070e0\"/><path clip-path=\"none\" d=\"M-923.716 21.779c-1.273 0-2.358.926-2.556 2.183l-10.6 67.216c-.201 1.276.785 2.43 2.077 2.43h15.719l3.903-24.752 4.247-26.936a2.59 2.59 0 0 1 2.556-2.185h22.519c4.098 0 7.836.956 11.019 2.624.218-11.273-9.084-20.58-21.873-20.58z\" fill=\"#003087\"/></g></svg>\n </div>\n </li>\n </label>",
17056
+ googlepay_wallet: "<label class=\"payment-source\">\n <li class=\"payment-source\">\n <div max-height: \"28px\" class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"googlepay_wallet\" type=\"radio\" name=\"radio-group\" />\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n width=\"80px\" height=\"38px\" viewBox=\"0 0 80 38.1\" xml:space=\"preserve\">\n <style type=\"text/css\">\n .st0{fill:#5F6368;}\n .st1{fill:#4285F4;}\n .st2{fill:#34A853;}\n .st3{fill:#FBBC04;}\n .st4{fill:#EA4335;}\n </style>\n <path class=\"st0\" d=\"M37.8,19.7V29h-3V6h7.8c1.9,0,3.7,0.7,5.1,2c1.4,1.2,2.1,3,2.1,4.9c0,1.9-0.7,3.6-2.1,4.9c-1.4,1.3-3.1,2-5.1,2\n L37.8,19.7L37.8,19.7z M37.8,8.8v8h5c1.1,0,2.2-0.4,2.9-1.2c1.6-1.5,1.6-4,0.1-5.5c0,0-0.1-0.1-0.1-0.1c-0.8-0.8-1.8-1.3-2.9-1.2\n L37.8,8.8L37.8,8.8z\"/>\n <path class=\"st0\" d=\"M56.7,12.8c2.2,0,3.9,0.6,5.2,1.8s1.9,2.8,1.9,4.8V29H61v-2.2h-0.1c-1.2,1.8-2.9,2.7-4.9,2.7\n c-1.7,0-3.2-0.5-4.4-1.5c-1.1-1-1.8-2.4-1.8-3.9c0-1.6,0.6-2.9,1.8-3.9c1.2-1,2.9-1.4,4.9-1.4c1.8,0,3.2,0.3,4.3,1v-0.7\n c0-1-0.4-2-1.2-2.6c-0.8-0.7-1.8-1.1-2.9-1.1c-1.7,0-3,0.7-3.9,2.1l-2.6-1.6C51.8,13.8,53.9,12.8,56.7,12.8z M52.9,24.2\n c0,0.8,0.4,1.5,1,1.9c0.7,0.5,1.5,0.8,2.3,0.8c1.2,0,2.4-0.5,3.3-1.4c1-0.9,1.5-2,1.5-3.2c-0.9-0.7-2.2-1.1-3.9-1.1\n c-1.2,0-2.2,0.3-3,0.9C53.3,22.6,52.9,23.3,52.9,24.2z\"/>\n <path class=\"st0\" d=\"M80,13.3l-9.9,22.7h-3l3.7-7.9l-6.5-14.7h3.2l4.7,11.3h0.1l4.6-11.3H80z\"/>\n <path class=\"st1\" d=\"M25.9,17.7c0-0.9-0.1-1.8-0.2-2.7H13.2v5.1h7.1c-0.3,1.6-1.2,3.1-2.6,4v3.3H22C24.5,25.1,25.9,21.7,25.9,17.7z\"\n />\n <path class=\"st2\" d=\"M13.2,30.6c3.6,0,6.6-1.2,8.8-3.2l-4.3-3.3c-1.2,0.8-2.7,1.3-4.5,1.3c-3.4,0-6.4-2.3-7.4-5.5H1.4v3.4\n C3.7,27.8,8.2,30.6,13.2,30.6z\"/>\n <path class=\"st3\" d=\"M5.8,19.9c-0.6-1.6-0.6-3.4,0-5.1v-3.4H1.4c-1.9,3.7-1.9,8.1,0,11.9L5.8,19.9z\"/>\n <path class=\"st4\" d=\"M13.2,9.4c1.9,0,3.7,0.7,5.1,2l0,0l3.8-3.8c-2.4-2.2-5.6-3.5-8.8-3.4c-5,0-9.6,2.8-11.8,7.3l4.4,3.4\n C6.8,11.7,9.8,9.4,13.2,9.4z\"/>\n </svg>\n </div>\n </li>\n </label>",
17057
+ flypay: "<label class=\"payment-source\">\n <li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"flypay\" type=\"radio\" name=\"radio-group\" />\n <div class=\"payment-source__icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"38\" viewBox=\"0 0 82 40\" fill=\"none\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M18.2312 5.46959C18.2312 4.98803 18.6216 4.59766 19.1031 4.59766H77.3212C80.3349 4.59766 82.5618 7.40629 81.8747 10.3406L77.3202 29.7913C76.5899 32.9099 73.8086 35.1152 70.6056 35.1152H34.1637C33.6822 35.1152 33.2918 34.7248 33.2918 34.2432C33.2918 33.7617 33.6822 33.3713 34.1637 33.3713H70.6056C72.9986 33.3713 75.0766 31.7237 75.6222 29.3937L80.1768 9.94303C80.6077 8.10286 79.2111 6.34151 77.3212 6.34151H19.1031C18.6216 6.34151 18.2312 5.95114 18.2312 5.46959Z\" fill=\"black\"/>\n <path d=\"M4.29622 16.0912V27.204H0V13.6759C0 7.20014 3.7341 4.69238 7.7376 4.69238H11.5729V8.47799H7.7376C4.9845 8.47799 4.29622 11.0155 4.29622 12.2865H9.44925V16.0912H4.29622Z\" fill=\"black\"/>\n <path d=\"M17.2811 4.677L13.0007 5.78525V27.1886H17.2811V4.677Z\" fill=\"black\"/>\n <path d=\"M32.9749 29.2495V12.2073L28.7738 13.4755V19.579C28.7738 22.2741 28.0128 23.5424 25.9202 23.5424C23.8275 23.5424 23.1458 21.957 23.1458 20.1339V12.2073L19.1033 13.4755V20.451C19.1033 22.0363 19.3601 24.0179 21.2435 25.7618C23.3944 27.7535 27.0299 27.4 28.7738 26.7923V28.3776C28.7738 31.9287 27.7433 33.1336 25.0482 33.1336V36.9384C30.3591 36.9384 32.9749 33.9262 32.9749 29.2495Z\" fill=\"black\"/>\n <path d=\"M67.6141 27.1889H64.1264L65.6302 21.3583L62.72 12.2192H66.1873L68.0897 18.311L73.1558 12.2192H76.809L69.0409 21.6442L67.6141 27.1889Z\" fill=\"black\"/>\n <path d=\"M58.3963 23.8804H52.1572L50.166 27.1889H46.5293L56.4376 12.2192H59.9253L62.1448 27.1889H58.7363L58.3963 23.8804ZM57.8959 21.006L57.3095 16.3293L54.2181 21.006H57.8959Z\" fill=\"black\"/>\n <path d=\"M39.0708 27.1886H35.6699L39.1218 12.219H45.2077C49.3432 12.219 50.6898 15.7935 49.2718 19.256C47.7393 22.9981 43.469 22.5543 40.1532 22.5543L39.0708 27.1886ZM40.6637 19.8061C42.0281 19.8061 43.578 19.9845 44.8707 19.4997C46.1635 19.015 46.6087 18.4033 46.6087 16.9632C46.6087 15.3689 45.0509 15.2193 43.8905 15.2193H41.6848L40.6637 19.8061Z\" fill=\"black\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M23.2249 0.713641C23.2249 0.319643 23.5443 0.000244169 23.9382 0.000244203L47.7181 0.000246282C48.1121 0.000246316 48.4315 0.319645 48.4315 0.713643C48.4315 1.10764 48.1121 1.42704 47.7181 1.42704L23.9382 1.42704C23.5443 1.42704 23.2249 1.10764 23.2249 0.713641Z\" fill=\"black\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M39.2368 38.6028C39.2368 38.2088 39.5562 37.8894 39.9502 37.8894L63.7301 37.8894C64.1241 37.8894 64.4435 38.2088 64.4435 38.6028C64.4435 38.9968 64.1241 39.3162 63.7301 39.3162L39.9502 39.3162C39.5562 39.3162 39.2368 38.9968 39.2368 38.6028Z\" fill=\"black\"/>\n </svg>\n </div>\n </div>\n </li>\n </label>",
17058
+ zip_checkout: "<label class=\"payment-source\">\n <li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"zip_checkout\" type=\"radio\" name=\"radio-group\" />\n <svg height=\"30\" viewBox=\"0 0 768 285\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <g clip-path=\"url(#clip0)\">\n <path d=\"M19.53 227.27L26.19 281.53H259.36L251.73 219.39H143.01L142.06 211.69L242.19 141.72L235.5 87.3601H2.34998L9.97998 149.49H118.88L119.83 157.26L19.53 227.27Z\" fill=\"black\"/>\n <path d=\"M262.59 87.3601L286.44 281.53H519.78L495.93 87.3601H262.59Z\" fill=\"#AA8FFF\"/>\n <path d=\"M764.47 157.26C759.09 113.62 724.81 87.1701 678.21 87.3601H523L546.84 281.54H616.67L611.89 242.7H685.78C743.93 242.69 770.54 206.46 764.47 157.26ZM678.23 188.26L605.23 188.34L599.51 141.74L672.92 141.8C690.18 142.01 699.01 151.73 700.44 165.03C701.32 173.59 697.4 188.25 678.23 188.25V188.26Z\" fill=\"black\"/>\n <path d=\"M332.303 61.5598C344.584 48.3762 342.443 26.4212 327.522 12.522C312.601 -1.37727 290.549 -1.95741 278.269 11.2262C265.988 24.4098 268.129 46.3647 283.05 60.264C297.971 74.1632 320.023 74.7434 332.303 61.5598Z\" fill=\"black\"/>\n </g>\n <defs>\n <clipPath id=\"clip0\">\n <rect width=\"768\" height=\"285\" fill=\"white\"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n </li>\n ",
17059
+ applepay_wallet: "<label class=\"payment-source\">\n <li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"applepay_wallet\" type=\"radio\" name=\"radio-group\" />\n <svg version=\"1.1\" baseProfile=\"tiny\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n width=\"78px\" height=\"32px\" viewBox=\"0 0 512 210.2\" xml:space=\"preserve\">\n <path id=\"XMLID_34_\" d=\"M93.6,27.1C87.6,34.2,78,39.8,68.4,39c-1.2-9.6,3.5-19.8,9-26.1c6-7.3,16.5-12.5,25-12.9\n C103.4,10,99.5,19.8,93.6,27.1 M102.3,40.9c-13.9-0.8-25.8,7.9-32.4,7.9c-6.7,0-16.8-7.5-27.8-7.3c-14.3,0.2-27.6,8.3-34.9,21.2\n c-15,25.8-3.9,64,10.6,85c7.1,10.4,15.6,21.8,26.8,21.4c10.6-0.4,14.8-6.9,27.6-6.9c12.9,0,16.6,6.9,27.8,6.7\n c11.6-0.2,18.9-10.4,26-20.8c8.1-11.8,11.4-23.3,11.6-23.9c-0.2-0.2-22.4-8.7-22.6-34.3c-0.2-21.4,17.5-31.6,18.3-32.2\n C123.3,42.9,107.7,41.3,102.3,40.9 M182.6,11.9v155.9h24.2v-53.3h33.5c30.6,0,52.1-21,52.1-51.4c0-30.4-21.1-51.2-51.3-51.2H182.6z\n M206.8,32.3h27.9c21,0,33,11.2,33,30.9c0,19.7-12,31-33.1,31h-27.8V32.3z M336.6,169c15.2,0,29.3-7.7,35.7-19.9h0.5v18.7h22.4V90.2\n c0-22.5-18-37-45.7-37c-25.7,0-44.7,14.7-45.4,34.9h21.8c1.8-9.6,10.7-15.9,22.9-15.9c14.8,0,23.1,6.9,23.1,19.6v8.6l-30.2,1.8\n c-28.1,1.7-43.3,13.2-43.3,33.2C298.4,155.6,314.1,169,336.6,169z M343.1,150.5c-12.9,0-21.1-6.2-21.1-15.7c0-9.8,7.9-15.5,23-16.4\n l26.9-1.7v8.8C371.9,140.1,359.5,150.5,343.1,150.5z M425.1,210.2c23.6,0,34.7-9,44.4-36.3L512,54.7h-24.6l-28.5,92.1h-0.5\n l-28.5-92.1h-25.3l41,113.5l-2.2,6.9c-3.7,11.7-9.7,16.2-20.4,16.2c-1.9,0-5.6-0.2-7.1-0.4v18.7C417.3,210,423.3,210.2,425.1,210.2z\n \"/>\n </svg>\n </div>\n </li>\n </label>",
17060
+ afterpay_wallet: "<label class=\"payment-source\">\n <li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"afterpay_wallet\" type=\"radio\" name=\"radio-group\">\n ".concat(getIcon(paymentMethods.AFTERPAY), "\n </div>\n </li>\n </label>"),
17061
+ afterpay_checkout: "<label class=\"payment-source\">\n <li class=\"payment-source\">\n <div class=\"payment-source__wrap\">\n <input class=\"payment-source__radio\" pm-button=\"afterpay_checkout\" type=\"radio\" name=\"radio-group\">\n ".concat(getIcon(paymentMethods.AFTERPAY), "\n </div>\n </li>\n </label>")
15471
17062
  };
15472
17063
 
15473
17064
  var PAYMENTS_METHODS = {
@@ -15631,7 +17222,15 @@
15631
17222
  var iframeDocument = iframe.contentDocument || ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.document);
15632
17223
  if (iframeDocument) {
15633
17224
  var radiosButtons = iframeDocument.querySelectorAll('input[type="radio"].payment-source__radio');
17225
+ var labels = iframeDocument.querySelectorAll('.payment-source');
17226
+ labels.forEach(function (label) {
17227
+ label.style.cursor = "not-allowed";
17228
+ });
15634
17229
  radiosButtons.forEach(function (radioButton) {
17230
+ var labels = iframeDocument.querySelectorAll('.payment-source');
17231
+ labels.forEach(function (label) {
17232
+ label.style.cursor = "not-allowed";
17233
+ });
15635
17234
  radioButton.style.cursor = "not-allowed";
15636
17235
  if (!radioButton.checked) {
15637
17236
  radioButton.style.border = "9px solid #EBEBE4";
@@ -16250,9 +17849,19 @@
16250
17849
  var tokenContent = AccessToken.validateJWT(intentToken);
16251
17850
  if (!tokenContent) throw new Error('Intent token is broken or expired. Please, issue new one.');
16252
17851
  var payload = AccessToken.extractData(tokenContent.body);
16253
- if (!payload || !payload.intent_id || !payload.version || !payload.env || !payload.env_alias) throw new Error('Inconsistent structure of intent token. Please, be sure that you are using correct token.');
17852
+ var allowed = this.validateJWTWhitelistedDomains(payload.whitelist_domains);
17853
+ if (!allowed) {
17854
+ throw new Error("Intent Token is not valid for current domain");
17855
+ }
17856
+ if (!payload || !payload.intent_id || !payload.version || !payload.env || !payload.env_alias) throw new Error("Inconsistent structure of intent token. Please, be sure that you are using correct token.");
16254
17857
  return payload;
16255
17858
  }
17859
+ }, {
17860
+ key: "validateJWTWhitelistedDomains",
17861
+ value: function validateJWTWhitelistedDomains(whitelist_domains) {
17862
+ if (!whitelist_domains) return true;
17863
+ return whitelist_domains.includes(window.location.hostname);
17864
+ }
16256
17865
  }, {
16257
17866
  key: "ready",
16258
17867
  value: function ready() {
@@ -16407,12 +18016,15 @@
16407
18016
  EVENT["PAYMENT_IN_REVIEW"] = "paymentInReview";
16408
18017
  EVENT["ON_CLICK"] = "onClick";
16409
18018
  EVENT["ON_CHECKOUT_CLOSE"] = "onCheckoutClose";
18019
+ EVENT["ON_SHIPPING_ADDRESS_CHANGE"] = "onShippingAddressChange";
18020
+ EVENT["ON_SHIPPING_OPTIONS_CHANGE"] = "onShippingOptionsChange";
16410
18021
  })(EVENT || (EVENT = {}));
16411
18022
 
16412
18023
  var BaseWalletButton = /*#__PURE__*/function () {
16413
18024
  function BaseWalletButton(selector, publicKeyOrAccessToken, gatewayId, meta, requiredMetaFields) {
16414
18025
  _classCallCheck(this, BaseWalletButton);
16415
18026
  this.env = DEFAULT_ENV;
18027
+ this.onShippingOptionsChangeHandlerRegistered = false;
16416
18028
  this.eventEmitter = new EventEmitter();
16417
18029
  this.container = new Container(selector);
16418
18030
  this.api = new ApiInternal(publicKeyOrAccessToken, this.getApiAuthType(publicKeyOrAccessToken));
@@ -16423,11 +18035,8 @@
16423
18035
  return _createClass(BaseWalletButton, [{
16424
18036
  key: "getApiAuthType",
16425
18037
  value: function getApiAuthType(publicKeyOrAccessToken) {
16426
- if (AccessToken.validateJWT(publicKeyOrAccessToken)) {
16427
- return API_AUTH_TYPE.TOKEN;
16428
- } else {
16429
- return API_AUTH_TYPE.PUBLIC_KEY;
16430
- }
18038
+ if (AccessToken.validateJWT(publicKeyOrAccessToken)) return API_AUTH_TYPE.TOKEN;
18039
+ return API_AUTH_TYPE.PUBLIC_KEY;
16431
18040
  }
16432
18041
  /**
16433
18042
  * Current method can change environment. By default environment = sandbox.
@@ -16594,6 +18203,67 @@
16594
18203
  });
16595
18204
  });
16596
18205
  }
18206
+ /**
18207
+ * Callback for onShippingAddressChange method.
18208
+ *
18209
+ * @callback OnShippingAddressChangeCallback
18210
+ * @param {OnShippingAddressChangeEventData} data
18211
+ * @return {Promise<OnShippingAddressChangeEventResponse>} Address update result
18212
+ */
18213
+ /**
18214
+ * If shipping address data is updated, the function passed as parameter will be called.
18215
+ * Use this method to listen for shipping address selection or input from customer when shipping is enabled.
18216
+ * The event handler needs to return a new token in case a backend to backend wallet update call was executed.
18217
+ * In addition, if any error occured, an error string must be supplied.
18218
+ * By default, the event handler will be processed successfuly if neither token nor error is returned.
18219
+ *
18220
+ * @example
18221
+ * button.onShippingAddressChange((data) => {
18222
+ * const responseData = await fetch('https://your-server.com/update-shipping-info');
18223
+ * return { error: null, token: responseData.walletToken };
18224
+ * });
18225
+ *
18226
+ * @param {OnShippingAddressChangeCallback} [handler] - Function to be called when the shipping address data is updated.
18227
+ */
18228
+ }, {
18229
+ key: "onShippingAddressChange",
18230
+ value: function onShippingAddressChange(handler) {
18231
+ if (typeof handler === 'function') {
18232
+ return this.eventEmitter.subscribe(EVENT.ON_SHIPPING_ADDRESS_CHANGE, handler);
18233
+ }
18234
+ this.handleOnError(new Error('onShippingAddressChange event handler is required to return the wallet token string or reject.'));
18235
+ }
18236
+ /**
18237
+ * Callback for onShippingOptionsChange method.
18238
+ *
18239
+ * @callback OnShippingOptionsChangeCallback
18240
+ * @param {OnShippingOptionChangeEventData} data
18241
+ * @return {Promise<OnShippingOptionChangeEventResponse>} Address update result
18242
+ */
18243
+ /**
18244
+ * If shipping options data is updated, the function passed as parameter will be called.
18245
+ * Use this method to listen for shipping option selection from customer when shipping is enabled.
18246
+ * The event handler needs to return a new token in case a backend to backend wallet update call was executed.
18247
+ * In addition, if any error occured, an error string must be supplied.
18248
+ * By default, the event handler will be processed successfuly if neither token nor error is returned.
18249
+ *
18250
+ * @example
18251
+ * button.onShippingOptionsChange((data) => {
18252
+ * const responseData = await fetch('https://your-server.com/update-shipping-info');
18253
+ * return { error: null, token: responseData.walletToken };
18254
+ * });
18255
+ *
18256
+ * @param {OnShippingOptionsChangeCallback} [handler] - Function to be called when the shipping options data is updated.
18257
+ */
18258
+ }, {
18259
+ key: "onShippingOptionsChange",
18260
+ value: function onShippingOptionsChange(handler) {
18261
+ if (typeof handler === 'function') {
18262
+ this.onShippingOptionsChangeHandlerRegistered = true;
18263
+ return this.eventEmitter.subscribe(EVENT.ON_SHIPPING_OPTIONS_CHANGE, handler);
18264
+ }
18265
+ this.handleOnError(new Error('onShippingOptionsChange event handler is required to return the wallet token string or reject.'));
18266
+ }
16597
18267
  /**
16598
18268
  * Callback for onUnavailable method.
16599
18269
  *
@@ -16718,6 +18388,7 @@
16718
18388
  return this.eventEmitter.emitWithResult(EVENT.ON_CLICK, {
16719
18389
  event: EVENT.ON_CLICK
16720
18390
  }).then(function (result) {
18391
+ var _a;
16721
18392
  if (!result || result.length === 0) {
16722
18393
  var error = new Error('No result from onClick event');
16723
18394
  _this10.handleOnError(error);
@@ -16735,15 +18406,50 @@
16735
18406
  _this10.handleOnError(_error2);
16736
18407
  throw _error2;
16737
18408
  }
18409
+ if (((_a = _this10.chargeWalletTokenMeta.charge.shipping) === null || _a === void 0 ? void 0 : _a.options) && _this10.chargeWalletTokenMeta.charge.shipping.options.length > 0) {
18410
+ if (!_this10.onShippingOptionsChangeHandlerRegistered) {
18411
+ var _error3 = new Error("There is no event handler registered for shipping options change. Consider using \"onShippingOptionsChange\" SDK method to register the event handler.");
18412
+ _this10.handleOnError(_error3);
18413
+ throw _error3;
18414
+ }
18415
+ }
16738
18416
  });
16739
18417
  }
18418
+ }, {
18419
+ key: "handleMerchantOnShippingChangedEvent",
18420
+ value: function handleMerchantOnShippingChangedEvent(eventData) {
18421
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
18422
+ var _this11 = this;
18423
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
18424
+ while (1) switch (_context.prev = _context.next) {
18425
+ case 0:
18426
+ return _context.abrupt("return", this.eventEmitter.emitWithResult(eventData.event, eventData).then(function (result) {
18427
+ if (!result || result.length === 0) {
18428
+ var error = new Error('No result from shippingUpdate event');
18429
+ _this11.handleOnError(error);
18430
+ throw error;
18431
+ }
18432
+ var shippingResponse = result[0];
18433
+ if (shippingResponse.token) _this11.setWalletToken(shippingResponse.token, {
18434
+ skipApiAuth: true
18435
+ });
18436
+ return shippingResponse;
18437
+ }));
18438
+ case 1:
18439
+ case "end":
18440
+ return _context.stop();
18441
+ }
18442
+ }, _callee, this);
18443
+ }));
18444
+ }
16740
18445
  }, {
16741
18446
  key: "setWalletToken",
16742
- value: function setWalletToken(token) {
18447
+ value: function setWalletToken(token, opts) {
16743
18448
  var parsedToken = AccessToken.validateJWT(token);
16744
18449
  if (!parsedToken) return this.handleOnError(new Error("Invalid charge token"));
16745
18450
  this.chargeWalletTokenMeta = AccessToken.extractMeta(parsedToken.body);
16746
18451
  if (!this.chargeWalletTokenMeta) return this.handleOnError(new Error('Invalid charge token'));
18452
+ if ((opts === null || opts === void 0 ? void 0 : opts.skipApiAuth) === true) return;
16747
18453
  this.api.auth = token;
16748
18454
  this.api.authType = API_AUTH_TYPE.TOKEN;
16749
18455
  }
@@ -16779,6 +18485,7 @@
16779
18485
  data: error
16780
18486
  }));
16781
18487
  }
18488
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
16782
18489
  }, {
16783
18490
  key: "eventDataFromApiError",
16784
18491
  value: function eventDataFromApiError(err) {
@@ -16791,13 +18498,14 @@
16791
18498
  }, {
16792
18499
  key: "validateRequiredMetaFields",
16793
18500
  value: function validateRequiredMetaFields(requiredMetaFields) {
16794
- var _this11 = this;
18501
+ var _this12 = this;
16795
18502
  if (!this.meta) throw new Error('Meta is required');
16796
18503
  if (typeof this.meta.amount !== 'number') throw new Error('meta.amount needs to be numeric');
16797
18504
  if (typeof this.meta.currency !== 'string') throw new Error('meta.amount needs to be a string');
18505
+ // biome-ignore lint/complexity/noForEach: <explanation>
16798
18506
  requiredMetaFields.forEach(function (field) {
16799
18507
  var keys = field.split('.');
16800
- var current = _this11.meta;
18508
+ var current = _this12.meta;
16801
18509
  // Traverse the nested structure
16802
18510
  var _iterator = _createForOfIteratorHelper(keys),
16803
18511
  _step;
@@ -16821,6 +18529,12 @@
16821
18529
  return "\n apple-pay-button {\n display: inline-block;\n --apple-pay-button-width: 100%;\n --apple-pay-button-height: 40px;\n --apple-pay-button-border-radius: 5px;\n --apple-pay-button-padding: 5px 0px;\n }\n ";
16822
18530
  };
16823
18531
 
18532
+ var ContactShippingEditingMode;
18533
+ (function (ContactShippingEditingMode) {
18534
+ ContactShippingEditingMode["AVAILABLE"] = "available";
18535
+ ContactShippingEditingMode["STORE_PICKUP"] = "store_pickup";
18536
+ })(ContactShippingEditingMode || (ContactShippingEditingMode = {}));
18537
+
16824
18538
  var DEFAULT_APPLE_PAY_CAPABILITIES = ['paymentCredentialsAvailable'];
16825
18539
  /**
16826
18540
  * Class ApplePayWalletButtonExpress to work with Apple Pay Wallet.
@@ -16843,6 +18557,19 @@
16843
18557
  var _this;
16844
18558
  _classCallCheck(this, ApplePayWalletButtonExpress);
16845
18559
  _this = _callSuper(this, ApplePayWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, ['amount_label', 'country']]);
18560
+ _this.onApplePayButtonClicked = function () {
18561
+ return _this.handleMerchantOnExpressButtonClickEvent().then(function () {
18562
+ _this.paymentSession = new ApplePaySession(14, _this.createRequest());
18563
+ _this.paymentSession.onvalidatemerchant = _this.onValidateMerchant;
18564
+ _this.paymentSession.onpaymentauthorized = _this.onPaymentAuthorized;
18565
+ _this.paymentSession.oncancel = _this.onCancelPayment;
18566
+ _this.paymentSession.onshippingmethodselected = _this.onApplePayShippingMethodUpdate;
18567
+ _this.paymentSession.onshippingcontactselected = _this.onApplePayShippingContactUpdate;
18568
+ _this.paymentSession.begin();
18569
+ })["catch"](function () {
18570
+ _this.handleCheckoutClose();
18571
+ });
18572
+ };
16846
18573
  _this.onValidateMerchant = function (event) {
16847
18574
  _this.handleMerchantOnExpressButtonClickEvent().then(function () {
16848
18575
  _this.getMerchantSession().then(function (merchantSession) {
@@ -16888,6 +18615,70 @@
16888
18615
  _this.onCancelPayment = function () {
16889
18616
  return _this.handleCheckoutClose();
16890
18617
  };
18618
+ _this.onApplePayShippingContactUpdate = function (data) {
18619
+ return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
18620
+ var _this2 = this;
18621
+ var _a;
18622
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
18623
+ while (1) switch (_context.prev = _context.next) {
18624
+ case 0:
18625
+ return _context.abrupt("return", this.handleMerchantOnShippingChangedEvent({
18626
+ event: EVENT.ON_SHIPPING_ADDRESS_CHANGE,
18627
+ chargeId: (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
18628
+ data: this.parseShippingContactUpdateEvent(data)
18629
+ }).then(function (response) {
18630
+ var _a, _b, _c, _d, _e, _f;
18631
+ var mappedErrors = [];
18632
+ var mappedNewShippingMethods = [];
18633
+ if (((_c = (_b = (_a = _this2.chargeWalletTokenMeta.charge) === null || _a === void 0 ? void 0 : _a.shipping) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.length) > 0) {
18634
+ mappedNewShippingMethods = _this2.parseShippingMethod(_this2.chargeWalletTokenMeta.charge.shipping.options);
18635
+ }
18636
+ if ((_d = response.error) === null || _d === void 0 ? void 0 : _d.code) {
18637
+ mappedErrors = [_this2.formatErrorFields(response.error)];
18638
+ }
18639
+ _this2.paymentSession.completeShippingContactSelection({
18640
+ newTotal: {
18641
+ label: _this2.meta.amount_label,
18642
+ amount: String((_f = (_e = _this2.chargeWalletTokenMeta.charge.shipping) === null || _e === void 0 ? void 0 : _e.amount) !== null && _f !== void 0 ? _f : _this2.chargeWalletTokenMeta.charge.amount)
18643
+ },
18644
+ newShippingMethods: mappedNewShippingMethods,
18645
+ errors: mappedErrors
18646
+ });
18647
+ }));
18648
+ case 1:
18649
+ case "end":
18650
+ return _context.stop();
18651
+ }
18652
+ }, _callee, this);
18653
+ }));
18654
+ };
18655
+ _this.onApplePayShippingMethodUpdate = function (data) {
18656
+ return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
18657
+ var _this3 = this;
18658
+ var _b;
18659
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
18660
+ while (1) switch (_context2.prev = _context2.next) {
18661
+ case 0:
18662
+ return _context2.abrupt("return", this.handleMerchantOnShippingChangedEvent({
18663
+ event: EVENT.ON_SHIPPING_OPTIONS_CHANGE,
18664
+ chargeId: (_b = this.chargeWalletTokenMeta) === null || _b === void 0 ? void 0 : _b.charge.id,
18665
+ data: this.parseShippingMethodUpdateEvent(data)
18666
+ }).then(function (_response) {
18667
+ var _a, _b;
18668
+ _this3.paymentSession.completeShippingMethodSelection({
18669
+ newTotal: {
18670
+ label: _this3.meta.amount_label,
18671
+ amount: String((_b = (_a = _this3.chargeWalletTokenMeta.charge.shipping) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : _this3.chargeWalletTokenMeta.charge.amount)
18672
+ }
18673
+ });
18674
+ }));
18675
+ case 1:
18676
+ case "end":
18677
+ return _context2.stop();
18678
+ }
18679
+ }, _callee2, this);
18680
+ }));
18681
+ };
16891
18682
  return _this;
16892
18683
  }
16893
18684
  /**
@@ -16902,27 +18693,27 @@
16902
18693
  return _createClass(ApplePayWalletButtonExpress, [{
16903
18694
  key: "load",
16904
18695
  value: function load() {
16905
- var _this2 = this;
18696
+ var _this4 = this;
16906
18697
  if (!window.Promise) return this.handleOnUnavailable();
16907
18698
  var applePayScript = document.createElement('script');
16908
18699
  applePayScript.src = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js";
16909
18700
  applePayScript.type = "text/javascript";
16910
18701
  applePayScript.crossOrigin = 'anonymous';
16911
18702
  applePayScript.onload = function () {
16912
- _this2.getGatewayWalletConfig().then(function (config) {
18703
+ _this4.getGatewayWalletConfig().then(function (config) {
16913
18704
  if (!config || config.type !== 'MasterCard' || !config.credentials || !config.credentials.apple || !config.credentials.apple.merchant) throw new Error('Invalid configuration');
16914
- return _this2.checkAvailability(config);
18705
+ return _this4.checkAvailability(config);
16915
18706
  }).then(function (available) {
16916
- if (!available) return _this2.handleOnUnavailable();
16917
- return _this2.mount();
18707
+ if (!available) return _this4.handleOnUnavailable();
18708
+ return _this4.mount();
16918
18709
  })["catch"](function (err) {
16919
- if (err) _this2.handleOnError(err);
16920
- _this2.handleOnUnavailable();
18710
+ if (err) _this4.handleOnError(err);
18711
+ _this4.handleOnUnavailable();
16921
18712
  });
16922
18713
  };
16923
18714
  applePayScript.onerror = function (err) {
16924
18715
  console.error("ApplePayWalletButtonExpress: Error loading ApplePay script", err);
16925
- _this2.handleOnUnavailable();
18716
+ _this4.handleOnUnavailable();
16926
18717
  return;
16927
18718
  };
16928
18719
  document.head.appendChild(applePayScript);
@@ -16944,15 +18735,15 @@
16944
18735
  }, {
16945
18736
  key: "checkAvailability",
16946
18737
  value: function checkAvailability(config) {
16947
- var _this3 = this;
18738
+ var _this5 = this;
16948
18739
  return new Promise(function (resolve, _reject) {
16949
18740
  var _a;
16950
18741
  if (!window.ApplePaySession || !ApplePaySession) {
16951
18742
  resolve(false);
16952
18743
  }
16953
18744
  var formattedCapabilities = DEFAULT_APPLE_PAY_CAPABILITIES;
16954
- if (((_a = _this3.meta.apple_pay_capabilities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
16955
- formattedCapabilities = _this3.formatCapabilities(_this3.meta.apple_pay_capabilities);
18745
+ if (((_a = _this5.meta.apple_pay_capabilities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
18746
+ formattedCapabilities = _this5.formatCapabilities(_this5.meta.apple_pay_capabilities);
16956
18747
  }
16957
18748
  ApplePaySession.applePayCapabilities(config.credentials[WALLET_TYPE.APPLE].merchant).then(function (capabilities) {
16958
18749
  var canMakePayment = formattedCapabilities.includes(capabilities === null || capabilities === void 0 ? void 0 : capabilities.paymentCredentialStatus);
@@ -16981,21 +18772,16 @@
16981
18772
  }
16982
18773
  applePayButton.addEventListener('click', this.onApplePayButtonClicked.bind(this));
16983
18774
  }
16984
- }, {
16985
- key: "onApplePayButtonClicked",
16986
- value: function onApplePayButtonClicked() {
16987
- this.paymentSession = new ApplePaySession(14, this.createRequest());
16988
- this.paymentSession.onvalidatemerchant = this.onValidateMerchant;
16989
- this.paymentSession.onpaymentauthorized = this.onPaymentAuthorized;
16990
- this.paymentSession.oncancel = this.onCancelPayment;
16991
- this.paymentSession.begin();
16992
- }
16993
18775
  }, {
16994
18776
  key: "createRequest",
16995
18777
  value: function createRequest() {
18778
+ var _a, _b, _c, _d;
16996
18779
  // https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest
16997
- var _a;
16998
- return {
18780
+ var shippingContactEditingMode;
18781
+ if (this.meta.shipping_editing_mode) {
18782
+ shippingContactEditingMode = this.meta.shipping_editing_mode === ContactShippingEditingMode.AVAILABLE ? 'available' : 'storePickup';
18783
+ }
18784
+ return _extends(_extends({
16999
18785
  countryCode: this.meta.country,
17000
18786
  currencyCode: this.meta.currency,
17001
18787
  merchantCapabilities: this.meta.merchant_capabilities || ['supports3DS', 'supportsCredit', 'supportsDebit'],
@@ -17008,7 +18794,12 @@
17008
18794
  amount: (_a = this.meta.amount) === null || _a === void 0 ? void 0 : _a.toFixed(2),
17009
18795
  type: 'final'
17010
18796
  }
17011
- };
18797
+ }, shippingContactEditingMode && {
18798
+ shippingContactEditingMode: shippingContactEditingMode
18799
+ }), {
18800
+ shippingContact: this.parseShippingContact(),
18801
+ shippingMethods: this.parseShippingMethod((_d = (_c = (_b = this.chargeWalletTokenMeta) === null || _b === void 0 ? void 0 : _b.charge) === null || _c === void 0 ? void 0 : _c.shipping) === null || _d === void 0 ? void 0 : _d.options)
18802
+ });
17012
18803
  }
17013
18804
  }, {
17014
18805
  key: "getMerchantSession",
@@ -17031,6 +18822,93 @@
17031
18822
  return fieldMap[capability] || capability;
17032
18823
  });
17033
18824
  }
18825
+ }, {
18826
+ key: "parseShippingContact",
18827
+ value: function parseShippingContact() {
18828
+ var _a, _b, _c, _d, _e;
18829
+ if (!((_b = (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge) === null || _b === void 0 ? void 0 : _b.shipping)) return {};
18830
+ return _extends(_extends({}, ((_e = (_d = (_c = this.chargeWalletTokenMeta) === null || _c === void 0 ? void 0 : _c.charge) === null || _d === void 0 ? void 0 : _d.shipping) === null || _e === void 0 ? void 0 : _e.contact) && {
18831
+ phoneNumber: this.chargeWalletTokenMeta.charge.shipping.contact.phone,
18832
+ emailAddress: this.chargeWalletTokenMeta.charge.shipping.contact.email,
18833
+ givenName: this.chargeWalletTokenMeta.charge.shipping.contact.first_name,
18834
+ familyName: this.chargeWalletTokenMeta.charge.shipping.contact.last_name
18835
+ }), {
18836
+ addressLines: [this.chargeWalletTokenMeta.charge.shipping.address_line1, this.chargeWalletTokenMeta.charge.shipping.address_line2, this.chargeWalletTokenMeta.charge.shipping.address_line3].filter(Boolean),
18837
+ locality: this.chargeWalletTokenMeta.charge.shipping.address_city,
18838
+ postalCode: this.chargeWalletTokenMeta.charge.shipping.address_postcode,
18839
+ administrativeArea: this.chargeWalletTokenMeta.charge.shipping.address_state,
18840
+ country: this.chargeWalletTokenMeta.charge.shipping.address_country,
18841
+ countryCode: this.chargeWalletTokenMeta.charge.shipping.address_country
18842
+ });
18843
+ }
18844
+ }, {
18845
+ key: "parseShippingMethod",
18846
+ value: function parseShippingMethod() {
18847
+ var shippingOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
18848
+ return shippingOptions.map(function (option) {
18849
+ return {
18850
+ label: option.label,
18851
+ detail: option.detail,
18852
+ amount: option.amount,
18853
+ identifier: option.id
18854
+ };
18855
+ });
18856
+ }
18857
+ }, {
18858
+ key: "parseShippingMethodUpdateEvent",
18859
+ value: function parseShippingMethodUpdateEvent(data) {
18860
+ return {
18861
+ shipping_option_id: data.shippingMethod.identifier,
18862
+ label: data.shippingMethod.label,
18863
+ detail: data.shippingMethod.detail,
18864
+ amount: data.shippingMethod.amount
18865
+ };
18866
+ }
18867
+ }, {
18868
+ key: "parseShippingContactUpdateEvent",
18869
+ value: function parseShippingContactUpdateEvent(data) {
18870
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
18871
+ return _extends(_extends(_extends({
18872
+ contact: {
18873
+ phone: (_e = (_d = (_c = (_b = (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge) === null || _b === void 0 ? void 0 : _b.shipping) === null || _c === void 0 ? void 0 : _c.contact) === null || _d === void 0 ? void 0 : _d.phone) !== null && _e !== void 0 ? _e : data.shippingContact.phoneNumber,
18874
+ email: (_k = (_j = (_h = (_g = (_f = this.chargeWalletTokenMeta) === null || _f === void 0 ? void 0 : _f.charge) === null || _g === void 0 ? void 0 : _g.shipping) === null || _h === void 0 ? void 0 : _h.contact) === null || _j === void 0 ? void 0 : _j.email) !== null && _k !== void 0 ? _k : data.shippingContact.emailAddress,
18875
+ first_name: (_q = (_p = (_o = (_m = (_l = this.chargeWalletTokenMeta) === null || _l === void 0 ? void 0 : _l.charge) === null || _m === void 0 ? void 0 : _m.shipping) === null || _o === void 0 ? void 0 : _o.contact) === null || _p === void 0 ? void 0 : _p.first_name) !== null && _q !== void 0 ? _q : data.shippingContact.givenName,
18876
+ last_name: (_v = (_u = (_t = (_s = (_r = this.chargeWalletTokenMeta) === null || _r === void 0 ? void 0 : _r.charge) === null || _s === void 0 ? void 0 : _s.shipping) === null || _t === void 0 ? void 0 : _t.contact) === null || _u === void 0 ? void 0 : _u.last_name) !== null && _v !== void 0 ? _v : data.shippingContact.familyName
18877
+ }
18878
+ }, ((_w = data.shippingContact.addressLines) === null || _w === void 0 ? void 0 : _w[0]) && {
18879
+ address_line1: data.shippingContact.addressLines[0]
18880
+ }), ((_x = data.shippingContact.addressLines) === null || _x === void 0 ? void 0 : _x[1]) && {
18881
+ address_line2: data.shippingContact.addressLines[1]
18882
+ }), {
18883
+ address_city: data.shippingContact.locality,
18884
+ address_postcode: data.shippingContact.postalCode,
18885
+ address_state: data.shippingContact.administrativeArea,
18886
+ address_country: data.shippingContact.countryCode
18887
+ });
18888
+ }
18889
+ }, {
18890
+ key: "formatErrorFields",
18891
+ value: function formatErrorFields(error) {
18892
+ var fieldMap = {
18893
+ phone: "phoneNumber",
18894
+ email: "emailAddress",
18895
+ phonetic_name: "phoneticName",
18896
+ address_lines: "addressLines",
18897
+ address_city: "locality",
18898
+ address_postcode: "postalCode",
18899
+ address_state: "administrativeArea",
18900
+ address_country: "country",
18901
+ address_country_code: "countryCode"
18902
+ };
18903
+ var contactField = fieldMap[error.field] || error.field;
18904
+ var codeMap = {
18905
+ address_error: "addressUnserviceable",
18906
+ shipping_contact_invalid: "shippingContactInvalid",
18907
+ billing_contact_invalid: "billingContactInvalid"
18908
+ };
18909
+ var code = codeMap[error.code] || 'unknown';
18910
+ return new ApplePayError(code, contactField, error.message);
18911
+ }
17034
18912
  }]);
17035
18913
  }(BaseWalletButton);
17036
18914
 
@@ -17052,8 +18930,11 @@
17052
18930
  var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
17053
18931
  /** @constructs */ // constructs added for correct parse classes jsdoc2md
17054
18932
  function PaypalWalletButtonExpress(selector, publicKeyOrAccessToken, gatewayId, meta) {
18933
+ var _this;
17055
18934
  _classCallCheck(this, PaypalWalletButtonExpress);
17056
- return _callSuper(this, PaypalWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, []]);
18935
+ _this = _callSuper(this, PaypalWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, []]);
18936
+ _this.shippingRequested = false;
18937
+ return _this;
17057
18938
  }
17058
18939
  /**
17059
18940
  * Initializes the availability checks and inserts the button if possible.
@@ -17067,15 +18948,15 @@
17067
18948
  return _createClass(PaypalWalletButtonExpress, [{
17068
18949
  key: "load",
17069
18950
  value: function load() {
17070
- var _this = this;
18951
+ var _this2 = this;
17071
18952
  if (!window.Promise) return this.handleOnUnavailable();
17072
18953
  this.getGatewayWalletConfig().then(function (config) {
17073
18954
  if (!config || config.type !== 'Paypal' || !config.credentials || !config.credentials.client_auth) throw new Error('Invalid configuration');
17074
- _this.config = config;
17075
- _this.renderPaypalButton();
18955
+ _this2.config = config;
18956
+ _this2.renderPaypalButton();
17076
18957
  })["catch"](function (err) {
17077
- if (err) _this.handleOnError(err);
17078
- _this.handleOnUnavailable();
18958
+ if (err) _this2.handleOnError(err);
18959
+ _this2.handleOnUnavailable();
17079
18960
  });
17080
18961
  }
17081
18962
  /**
@@ -17104,18 +18985,18 @@
17104
18985
  }, {
17105
18986
  key: "renderPaypalCommonComponent",
17106
18987
  value: function renderPaypalCommonComponent() {
17107
- var _this2 = this;
18988
+ var _this3 = this;
17108
18989
  var _a, _b;
17109
18990
  var buttonId = ((_a = this.container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
17110
18991
  var paypalScript = document.createElement("script");
17111
- paypalScript.src = "https://www.paypal.com/sdk/js?client-id=".concat((_b = this.config.credentials) === null || _b === void 0 ? void 0 : _b.client_auth, "&currency=").concat(this.meta.currency).concat(this.meta.pay_later === true ? '&enable-funding=paylater&disable-funding=card' : "&disable-funding=credit,card").concat(!this.meta.capture ? "&intent=authorize" : '');
18992
+ paypalScript.src = "https://www.paypal.com/sdk/js?client-id=".concat((_b = this.config.credentials) === null || _b === void 0 ? void 0 : _b.client_auth, "&currency=").concat(this.meta.currency).concat(this.meta.pay_later === true ? '&enable-funding=paylater&disable-funding=card' : '&disable-funding=credit,card').concat(!this.meta.capture ? '&intent=authorize' : '');
17112
18993
  paypalScript.async = true;
17113
18994
  paypalScript.onload = function () {
17114
18995
  if (window.paypal) {
17115
- _this2.paypal = window.paypal;
17116
- _this2.paypal.Buttons(_extends({}, _this2.paypalSharedProps())).render("#".concat(buttonId));
18996
+ _this3.paypal = window.paypal;
18997
+ _this3.paypal.Buttons(_extends({}, _this3.paypalSharedProps())).render("#".concat(buttonId));
17117
18998
  } else {
17118
- _this2.handleOnUnavailable();
18999
+ _this3.handleOnUnavailable();
17119
19000
  }
17120
19001
  };
17121
19002
  document.head.appendChild(paypalScript);
@@ -17123,38 +19004,38 @@
17123
19004
  }, {
17124
19005
  key: "renderPaypalStandaloneComponent",
17125
19006
  value: function renderPaypalStandaloneComponent() {
17126
- var _this3 = this;
19007
+ var _this4 = this;
17127
19008
  var _a, _b, _c;
17128
19009
  var buttonId = ((_a = this.container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
17129
19010
  var paypalScript = document.createElement("script");
17130
19011
  // buyer-country is only used in Sandbox. It shouldn't be used in production. Based on buyer's geolocation this parameter determine which funding sources are eligible for a given buyer. Refer the link https://developer.paypal.com/sdk/js/configuration/#link-buyercountry
17131
- paypalScript.src = "https://www.paypal.com/sdk/js?client-id=".concat((_b = this.config.credentials) === null || _b === void 0 ? void 0 : _b.client_auth, "&currency=").concat(this.meta.currency, "&components=buttons,funding-eligibility,messages&enable-funding=paylater").concat(!this.meta.capture ? "&intent=authorize" : '').concat(((_c = this.config) === null || _c === void 0 ? void 0 : _c.mode) === 'live' ? '' : '&buyer-country=AU');
19012
+ paypalScript.src = "https://www.paypal.com/sdk/js?client-id=".concat((_b = this.config.credentials) === null || _b === void 0 ? void 0 : _b.client_auth, "&currency=").concat(this.meta.currency, "&components=buttons,funding-eligibility,messages&enable-funding=paylater").concat(!this.meta.capture ? '&intent=authorize' : '').concat(((_c = this.config) === null || _c === void 0 ? void 0 : _c.mode) === 'live' ? '' : '&buyer-country=AU');
17132
19013
  paypalScript.async = true;
17133
19014
  paypalScript.onload = function () {
17134
19015
  var _a;
17135
19016
  if (window.paypal) {
17136
- _this3.paypal = window.paypal;
17137
- var isPayLater = !!_this3.meta.pay_later;
17138
- var button = _this3.paypal.Buttons(_extends({
17139
- fundingSource: isPayLater ? _this3.paypal.FUNDING.PAYLATER : _this3.paypal.FUNDING.PAYPAL
17140
- }, _this3.paypalSharedProps()));
19017
+ _this4.paypal = window.paypal;
19018
+ var isPayLater = !!_this4.meta.pay_later;
19019
+ var button = _this4.paypal.Buttons(_extends({
19020
+ fundingSource: isPayLater ? _this4.paypal.FUNDING.PAYLATER : _this4.paypal.FUNDING.PAYPAL
19021
+ }, _this4.paypalSharedProps()));
17141
19022
  if (button.isEligible()) {
17142
19023
  button.render("#".concat(buttonId));
17143
- if (isPayLater && !_this3.meta.hide_message) {
17144
- var messaging = _this3.paypal.Messages(_extends({
17145
- amount: _this3.meta.amount,
17146
- currency: _this3.meta.currency,
19024
+ if (isPayLater && !_this4.meta.hide_message) {
19025
+ var messaging = _this4.paypal.Messages(_extends({
19026
+ amount: _this4.meta.amount,
19027
+ currency: _this4.meta.currency,
17147
19028
  placement: 'payment'
17148
- }, ((_a = _this3.meta.style) === null || _a === void 0 ? void 0 : _a.messages) && {
17149
- style: _this3.meta.style.messages
19029
+ }, ((_a = _this4.meta.style) === null || _a === void 0 ? void 0 : _a.messages) && {
19030
+ style: _this4.meta.style.messages
17150
19031
  }));
17151
19032
  messaging.render("#".concat(buttonId));
17152
19033
  }
17153
19034
  } else {
17154
- _this3.handleOnUnavailable();
19035
+ _this4.handleOnUnavailable();
17155
19036
  }
17156
19037
  } else {
17157
- _this3.handleOnUnavailable();
19038
+ _this4.handleOnUnavailable();
17158
19039
  }
17159
19040
  };
17160
19041
  document.head.appendChild(paypalScript);
@@ -17162,23 +19043,32 @@
17162
19043
  }, {
17163
19044
  key: "paypalSharedProps",
17164
19045
  value: function paypalSharedProps() {
17165
- var _this4 = this;
19046
+ var _this5 = this;
17166
19047
  return _extends(_extends({}, this.meta.style && {
17167
19048
  style: this.meta.style
17168
19049
  }), {
17169
19050
  onClick: function onClick(_data, actions) {
17170
- return _this4.handleMerchantOnExpressButtonClickEvent().then(function () {
19051
+ return _this5.handleMerchantOnExpressButtonClickEvent().then(function () {
17171
19052
  return actions.resolve();
17172
19053
  })["catch"](function () {
17173
- _this4.handleCheckoutClose();
19054
+ _this5.handleCheckoutClose();
17174
19055
  return actions.reject();
17175
19056
  });
17176
19057
  },
17177
19058
  createOrder: function createOrder() {
17178
19059
  return new Promise(function (resolve, reject) {
17179
- if (!_this4.api.auth) return reject(new Error('Wallet Token not injected. Please handle onClick correctly.'));
17180
- return _this4.executeWalletCallback({
17181
- request_type: 'CREATE_TRANSACTION'
19060
+ var _a, _b;
19061
+ if (!_this5.api.auth) return reject(new Error('Wallet Token not injected. Please handle onClick correctly.'));
19062
+ var shipping = (_b = (_a = _this5.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge) === null || _b === void 0 ? void 0 : _b.shipping;
19063
+ if (shipping) {
19064
+ var hasCompleteShippingAddress = ['address_line1', 'address_city', 'address_country', 'address_state', 'address_postcode'].every(function (key) {
19065
+ return Boolean(shipping[key]);
19066
+ });
19067
+ _this5.shippingRequested = !hasCompleteShippingAddress;
19068
+ }
19069
+ return _this5.executeWalletCallback({
19070
+ request_type: 'CREATE_TRANSACTION',
19071
+ request_shipping: _this5.shippingRequested
17182
19072
  }).then(function (res) {
17183
19073
  resolve(res.id);
17184
19074
  })["catch"](function (err) {
@@ -17187,8 +19077,8 @@
17187
19077
  });
17188
19078
  },
17189
19079
  onApprove: function onApprove(data) {
17190
- if (_this4.pendingApprovalPromise) return _this4.pendingApprovalPromise;
17191
- _this4.pendingApprovalPromise = _this4.executeWalletCapture({
19080
+ if (_this5.pendingApprovalPromise) return _this5.pendingApprovalPromise;
19081
+ _this5.pendingApprovalPromise = _this5.executeWalletCapture({
17192
19082
  payment_method_id: data.orderID,
17193
19083
  customer: {
17194
19084
  payment_source: {
@@ -17197,19 +19087,105 @@
17197
19087
  }
17198
19088
  }
17199
19089
  })["finally"](function () {
17200
- _this4.pendingApprovalPromise = undefined;
19090
+ _this5.pendingApprovalPromise = undefined;
17201
19091
  });
17202
- return _this4.pendingApprovalPromise;
19092
+ return _this5.pendingApprovalPromise;
17203
19093
  },
17204
19094
  onCancel: function onCancel() {
17205
- return _this4.handleCheckoutClose();
19095
+ return _this5.handleCheckoutClose();
17206
19096
  },
17207
19097
  onError: function onError() {
17208
19098
  // Error handling so that paypal does not throw an uncaught error
17209
19099
  // We're already handling errors and notifying Merchants at "wallet-buttons.ts"
19100
+ },
19101
+ onShippingAddressChange: function onShippingAddressChange(data, actions) {
19102
+ return _this5.handleShippingAddressUpdate(data, actions);
19103
+ },
19104
+ onShippingOptionsChange: function onShippingOptionsChange(data, actions) {
19105
+ return _this5.handleShippingOptionsUpdate(data, actions);
17210
19106
  }
17211
19107
  });
17212
19108
  }
19109
+ }, {
19110
+ key: "handleShippingAddressUpdate",
19111
+ value: function handleShippingAddressUpdate(data, actions) {
19112
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
19113
+ var _a;
19114
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
19115
+ while (1) switch (_context.prev = _context.next) {
19116
+ case 0:
19117
+ if (this.shippingRequested) {
19118
+ _context.next = 2;
19119
+ break;
19120
+ }
19121
+ return _context.abrupt("return");
19122
+ case 2:
19123
+ return _context.abrupt("return", this.handleMerchantOnShippingChangedEvent({
19124
+ event: EVENT.ON_SHIPPING_ADDRESS_CHANGE,
19125
+ chargeId: (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
19126
+ data: {
19127
+ address_city: data.shippingAddress.city,
19128
+ address_state: data.shippingAddress.state,
19129
+ address_postcode: data.shippingAddress.postalCode,
19130
+ address_country: data.shippingAddress.countryCode
19131
+ }
19132
+ }).then(function (response) {
19133
+ var _a;
19134
+ if ((_a = response.error) === null || _a === void 0 ? void 0 : _a.code) {
19135
+ var errorKey = response.error.code.toUpperCase();
19136
+ var errorMessage = data.errors[errorKey];
19137
+ if (errorMessage) {
19138
+ return actions.reject(errorMessage);
19139
+ }
19140
+ return actions.reject();
19141
+ }
19142
+ })["catch"](function (err) {
19143
+ // If err is not one of Paypal's data.errros, it defaults to "Unable to update address. Please try again" by Paypal
19144
+ return actions.reject(err);
19145
+ }));
19146
+ case 3:
19147
+ case "end":
19148
+ return _context.stop();
19149
+ }
19150
+ }, _callee, this);
19151
+ }));
19152
+ }
19153
+ }, {
19154
+ key: "handleShippingOptionsUpdate",
19155
+ value: function handleShippingOptionsUpdate(data, actions) {
19156
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
19157
+ var _a;
19158
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
19159
+ while (1) switch (_context2.prev = _context2.next) {
19160
+ case 0:
19161
+ return _context2.abrupt("return", this.handleMerchantOnShippingChangedEvent({
19162
+ event: EVENT.ON_SHIPPING_OPTIONS_CHANGE,
19163
+ chargeId: (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
19164
+ data: {
19165
+ shipping_option_id: data.selectedShippingOption.id,
19166
+ amount: data.selectedShippingOption.amount.value
19167
+ }
19168
+ }).then(function (response) {
19169
+ var _a;
19170
+ if ((_a = response.error) === null || _a === void 0 ? void 0 : _a.code) {
19171
+ var errorKey = response.error.code.toUpperCase();
19172
+ var errorMessage = data.errors[errorKey];
19173
+ if (errorMessage) {
19174
+ return actions.reject(errorMessage);
19175
+ }
19176
+ return actions.reject();
19177
+ }
19178
+ })["catch"](function (err) {
19179
+ // If err is not one of Paypal's data.errros, it defaults to "Unable to update address. Please try again" by Paypal
19180
+ return actions.reject(err);
19181
+ }));
19182
+ case 1:
19183
+ case "end":
19184
+ return _context2.stop();
19185
+ }
19186
+ }, _callee2, this);
19187
+ }));
19188
+ }
17213
19189
  }]);
17214
19190
  }(BaseWalletButton);
17215
19191