@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
package/bundles/index.mjs CHANGED
@@ -1,5 +1,3 @@
1
- import 'isomorphic-dompurify';
2
-
3
1
  function _arrayLikeToArray(r, a) {
4
2
  (null == a || a > r.length) && (a = r.length);
5
3
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
@@ -925,7 +923,7 @@ SDK.headerKeys = Object.freeze({
925
923
  version: 'x-sdk-version',
926
924
  type: 'x-sdk-type'
927
925
  });
928
- SDK._version = 'v1.121.0';
926
+ SDK._version = 'v1.122.2-beta';
929
927
 
930
928
  /******************************************************************************
931
929
  Copyright (c) Microsoft Corporation.
@@ -4201,8 +4199,8 @@ function createNewrelicConfig() {
4201
4199
  var params = {
4202
4200
  enabled: 'true',
4203
4201
  accountId: '974691',
4204
- agentId: '1386157152',
4205
- applicationId: '1386157152',
4202
+ agentId: '1386157150',
4203
+ applicationId: '1386157150',
4206
4204
  licenseKey: '4848a32285',
4207
4205
  trustKey: '974691'
4208
4206
  };
@@ -4710,7 +4708,7 @@ var VAULT_DISPLAY_WIDGET_LINK = '/vault-display';
4710
4708
  var PAYMENT_SOURCE_LINK = '/payment-sources';
4711
4709
  var SECURE_3D = '/3ds/webhook';
4712
4710
  var FLYPAY_LINK = '/wallet/flypay';
4713
- var FLYPAY_LOGO_LINK = '/images/logo.png';
4711
+ var FLYPAY_LOGO_LINK = '/images/coles-pay-logo.png';
4714
4712
  var MESSAGE_WIDGET_LINK = '/message-widget';
4715
4713
  var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
4716
4714
  var Link = /*#__PURE__*/function () {
@@ -10081,6 +10079,10 @@ var AfterPayWalletService = /*#__PURE__*/function (_WalletService) {
10081
10079
  resolve(res);
10082
10080
  },
10083
10081
  onError: function onError(message) {
10082
+ console.error('Error generating order id', message);
10083
+ _this5.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
10084
+ message: message
10085
+ });
10084
10086
  reject(message);
10085
10087
  }
10086
10088
  });
@@ -10134,6 +10136,1581 @@ var AfterPayWalletService = /*#__PURE__*/function (_WalletService) {
10134
10136
  }]);
10135
10137
  }(WalletService);
10136
10138
 
10139
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10140
+
10141
+ var purify = {exports: {}};
10142
+
10143
+ /*! @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 */
10144
+
10145
+ var hasRequiredPurify;
10146
+
10147
+ function requirePurify () {
10148
+ if (hasRequiredPurify) return purify.exports;
10149
+ hasRequiredPurify = 1;
10150
+ (function (module, exports) {
10151
+ (function (global, factory) {
10152
+ module.exports = factory() ;
10153
+ })(commonjsGlobal, (function () {
10154
+ const {
10155
+ entries,
10156
+ setPrototypeOf,
10157
+ isFrozen,
10158
+ getPrototypeOf,
10159
+ getOwnPropertyDescriptor
10160
+ } = Object;
10161
+ let {
10162
+ freeze,
10163
+ seal,
10164
+ create
10165
+ } = Object; // eslint-disable-line import/no-mutable-exports
10166
+ let {
10167
+ apply,
10168
+ construct
10169
+ } = typeof Reflect !== 'undefined' && Reflect;
10170
+ if (!freeze) {
10171
+ freeze = function freeze(x) {
10172
+ return x;
10173
+ };
10174
+ }
10175
+ if (!seal) {
10176
+ seal = function seal(x) {
10177
+ return x;
10178
+ };
10179
+ }
10180
+ if (!apply) {
10181
+ apply = function apply(fun, thisValue, args) {
10182
+ return fun.apply(thisValue, args);
10183
+ };
10184
+ }
10185
+ if (!construct) {
10186
+ construct = function construct(Func, args) {
10187
+ return new Func(...args);
10188
+ };
10189
+ }
10190
+ const arrayForEach = unapply(Array.prototype.forEach);
10191
+ const arrayPop = unapply(Array.prototype.pop);
10192
+ const arrayPush = unapply(Array.prototype.push);
10193
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
10194
+ const stringToString = unapply(String.prototype.toString);
10195
+ const stringMatch = unapply(String.prototype.match);
10196
+ const stringReplace = unapply(String.prototype.replace);
10197
+ const stringIndexOf = unapply(String.prototype.indexOf);
10198
+ const stringTrim = unapply(String.prototype.trim);
10199
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
10200
+ const regExpTest = unapply(RegExp.prototype.test);
10201
+ const typeErrorCreate = unconstruct(TypeError);
10202
+
10203
+ /**
10204
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
10205
+ *
10206
+ * @param {Function} func - The function to be wrapped and called.
10207
+ * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.
10208
+ */
10209
+ function unapply(func) {
10210
+ return function (thisArg) {
10211
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
10212
+ args[_key - 1] = arguments[_key];
10213
+ }
10214
+ return apply(func, thisArg, args);
10215
+ };
10216
+ }
10217
+
10218
+ /**
10219
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
10220
+ *
10221
+ * @param {Function} func - The constructor function to be wrapped and called.
10222
+ * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.
10223
+ */
10224
+ function unconstruct(func) {
10225
+ return function () {
10226
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
10227
+ args[_key2] = arguments[_key2];
10228
+ }
10229
+ return construct(func, args);
10230
+ };
10231
+ }
10232
+
10233
+ /**
10234
+ * Add properties to a lookup table
10235
+ *
10236
+ * @param {Object} set - The set to which elements will be added.
10237
+ * @param {Array} array - The array containing elements to be added to the set.
10238
+ * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.
10239
+ * @returns {Object} The modified set with added elements.
10240
+ */
10241
+ function addToSet(set, array) {
10242
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
10243
+ if (setPrototypeOf) {
10244
+ // Make 'in' and truthy checks like Boolean(set.constructor)
10245
+ // independent of any properties defined on Object.prototype.
10246
+ // Prevent prototype setters from intercepting set as a this value.
10247
+ setPrototypeOf(set, null);
10248
+ }
10249
+ let l = array.length;
10250
+ while (l--) {
10251
+ let element = array[l];
10252
+ if (typeof element === 'string') {
10253
+ const lcElement = transformCaseFunc(element);
10254
+ if (lcElement !== element) {
10255
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
10256
+ if (!isFrozen(array)) {
10257
+ array[l] = lcElement;
10258
+ }
10259
+ element = lcElement;
10260
+ }
10261
+ }
10262
+ set[element] = true;
10263
+ }
10264
+ return set;
10265
+ }
10266
+
10267
+ /**
10268
+ * Clean up an array to harden against CSPP
10269
+ *
10270
+ * @param {Array} array - The array to be cleaned.
10271
+ * @returns {Array} The cleaned version of the array
10272
+ */
10273
+ function cleanArray(array) {
10274
+ for (let index = 0; index < array.length; index++) {
10275
+ const isPropertyExist = objectHasOwnProperty(array, index);
10276
+ if (!isPropertyExist) {
10277
+ array[index] = null;
10278
+ }
10279
+ }
10280
+ return array;
10281
+ }
10282
+
10283
+ /**
10284
+ * Shallow clone an object
10285
+ *
10286
+ * @param {Object} object - The object to be cloned.
10287
+ * @returns {Object} A new object that copies the original.
10288
+ */
10289
+ function clone(object) {
10290
+ const newObject = create(null);
10291
+ for (const [property, value] of entries(object)) {
10292
+ const isPropertyExist = objectHasOwnProperty(object, property);
10293
+ if (isPropertyExist) {
10294
+ if (Array.isArray(value)) {
10295
+ newObject[property] = cleanArray(value);
10296
+ } else if (value && typeof value === 'object' && value.constructor === Object) {
10297
+ newObject[property] = clone(value);
10298
+ } else {
10299
+ newObject[property] = value;
10300
+ }
10301
+ }
10302
+ }
10303
+ return newObject;
10304
+ }
10305
+
10306
+ /**
10307
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
10308
+ *
10309
+ * @param {Object} object - The object to look up the getter function in its prototype chain.
10310
+ * @param {String} prop - The property name for which to find the getter function.
10311
+ * @returns {Function} The getter function found in the prototype chain or a fallback function.
10312
+ */
10313
+ function lookupGetter(object, prop) {
10314
+ while (object !== null) {
10315
+ const desc = getOwnPropertyDescriptor(object, prop);
10316
+ if (desc) {
10317
+ if (desc.get) {
10318
+ return unapply(desc.get);
10319
+ }
10320
+ if (typeof desc.value === 'function') {
10321
+ return unapply(desc.value);
10322
+ }
10323
+ }
10324
+ object = getPrototypeOf(object);
10325
+ }
10326
+ function fallbackValue() {
10327
+ return null;
10328
+ }
10329
+ return fallbackValue;
10330
+ }
10331
+
10332
+ 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']);
10333
+
10334
+ // SVG
10335
+ 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']);
10336
+ 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']);
10337
+
10338
+ // List of SVG elements that are disallowed by default.
10339
+ // We still need to know them so that we can do namespace
10340
+ // checks properly in case one wants to add them to
10341
+ // allow-list.
10342
+ 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']);
10343
+ 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']);
10344
+
10345
+ // Similarly to SVG, we want to know all MathML elements,
10346
+ // even those that we disallow by default.
10347
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
10348
+ const text = freeze(['#text']);
10349
+
10350
+ 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']);
10351
+ 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']);
10352
+ 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']);
10353
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
10354
+
10355
+ // eslint-disable-next-line unicorn/better-regex
10356
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
10357
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
10358
+ const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
10359
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
10360
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
10361
+ 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
10362
+ );
10363
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
10364
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
10365
+ );
10366
+ const DOCTYPE_NAME = seal(/^html$/i);
10367
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
10368
+
10369
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
10370
+ __proto__: null,
10371
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
10372
+ ERB_EXPR: ERB_EXPR,
10373
+ TMPLIT_EXPR: TMPLIT_EXPR,
10374
+ DATA_ATTR: DATA_ATTR,
10375
+ ARIA_ATTR: ARIA_ATTR,
10376
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
10377
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
10378
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
10379
+ DOCTYPE_NAME: DOCTYPE_NAME,
10380
+ CUSTOM_ELEMENT: CUSTOM_ELEMENT
10381
+ });
10382
+
10383
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
10384
+ const NODE_TYPE = {
10385
+ element: 1,
10386
+ attribute: 2,
10387
+ text: 3,
10388
+ cdataSection: 4,
10389
+ entityReference: 5,
10390
+ // Deprecated
10391
+ entityNode: 6,
10392
+ // Deprecated
10393
+ progressingInstruction: 7,
10394
+ comment: 8,
10395
+ document: 9,
10396
+ documentType: 10,
10397
+ documentFragment: 11,
10398
+ notation: 12 // Deprecated
10399
+ };
10400
+ const getGlobal = function getGlobal() {
10401
+ return typeof window === 'undefined' ? null : window;
10402
+ };
10403
+
10404
+ /**
10405
+ * Creates a no-op policy for internal use only.
10406
+ * Don't export this function outside this module!
10407
+ * @param {TrustedTypePolicyFactory} trustedTypes The policy factory.
10408
+ * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
10409
+ * @return {TrustedTypePolicy} The policy created (or null, if Trusted Types
10410
+ * are not supported or creating the policy failed).
10411
+ */
10412
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
10413
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
10414
+ return null;
10415
+ }
10416
+
10417
+ // Allow the callers to control the unique policy name
10418
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
10419
+ // Policy creation with duplicate names throws in Trusted Types.
10420
+ let suffix = null;
10421
+ const ATTR_NAME = 'data-tt-policy-suffix';
10422
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
10423
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
10424
+ }
10425
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
10426
+ try {
10427
+ return trustedTypes.createPolicy(policyName, {
10428
+ createHTML(html) {
10429
+ return html;
10430
+ },
10431
+ createScriptURL(scriptUrl) {
10432
+ return scriptUrl;
10433
+ }
10434
+ });
10435
+ } catch (_) {
10436
+ // Policy creation failed (most likely another DOMPurify script has
10437
+ // already run). Skip creating the policy, as this will only cause errors
10438
+ // if TT are enforced.
10439
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
10440
+ return null;
10441
+ }
10442
+ };
10443
+ function createDOMPurify() {
10444
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
10445
+ const DOMPurify = root => createDOMPurify(root);
10446
+
10447
+ /**
10448
+ * Version label, exposed for easier checks
10449
+ * if DOMPurify is up to date or not
10450
+ */
10451
+ DOMPurify.version = '3.1.6';
10452
+
10453
+ /**
10454
+ * Array of elements that DOMPurify removed during sanitation.
10455
+ * Empty if nothing was removed.
10456
+ */
10457
+ DOMPurify.removed = [];
10458
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) {
10459
+ // Not running in a browser, provide a factory function
10460
+ // so that you can pass your own Window
10461
+ DOMPurify.isSupported = false;
10462
+ return DOMPurify;
10463
+ }
10464
+ let {
10465
+ document
10466
+ } = window;
10467
+ const originalDocument = document;
10468
+ const currentScript = originalDocument.currentScript;
10469
+ const {
10470
+ DocumentFragment,
10471
+ HTMLTemplateElement,
10472
+ Node,
10473
+ Element,
10474
+ NodeFilter,
10475
+ NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
10476
+ HTMLFormElement,
10477
+ DOMParser,
10478
+ trustedTypes
10479
+ } = window;
10480
+ const ElementPrototype = Element.prototype;
10481
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
10482
+ const remove = lookupGetter(ElementPrototype, 'remove');
10483
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
10484
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
10485
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
10486
+
10487
+ // As per issue #47, the web-components registry is inherited by a
10488
+ // new document created via createHTMLDocument. As per the spec
10489
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
10490
+ // a new empty registry is used when creating a template contents owner
10491
+ // document, so we use that as our parent document to ensure nothing
10492
+ // is inherited.
10493
+ if (typeof HTMLTemplateElement === 'function') {
10494
+ const template = document.createElement('template');
10495
+ if (template.content && template.content.ownerDocument) {
10496
+ document = template.content.ownerDocument;
10497
+ }
10498
+ }
10499
+ let trustedTypesPolicy;
10500
+ let emptyHTML = '';
10501
+ const {
10502
+ implementation,
10503
+ createNodeIterator,
10504
+ createDocumentFragment,
10505
+ getElementsByTagName
10506
+ } = document;
10507
+ const {
10508
+ importNode
10509
+ } = originalDocument;
10510
+ let hooks = {};
10511
+
10512
+ /**
10513
+ * Expose whether this browser supports running the full DOMPurify.
10514
+ */
10515
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
10516
+ const {
10517
+ MUSTACHE_EXPR,
10518
+ ERB_EXPR,
10519
+ TMPLIT_EXPR,
10520
+ DATA_ATTR,
10521
+ ARIA_ATTR,
10522
+ IS_SCRIPT_OR_DATA,
10523
+ ATTR_WHITESPACE,
10524
+ CUSTOM_ELEMENT
10525
+ } = EXPRESSIONS;
10526
+ let {
10527
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
10528
+ } = EXPRESSIONS;
10529
+
10530
+ /**
10531
+ * We consider the elements and attributes below to be safe. Ideally
10532
+ * don't add any new ones but feel free to remove unwanted ones.
10533
+ */
10534
+
10535
+ /* allowed element names */
10536
+ let ALLOWED_TAGS = null;
10537
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
10538
+
10539
+ /* Allowed attribute names */
10540
+ let ALLOWED_ATTR = null;
10541
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
10542
+
10543
+ /*
10544
+ * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
10545
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
10546
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
10547
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
10548
+ */
10549
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
10550
+ tagNameCheck: {
10551
+ writable: true,
10552
+ configurable: false,
10553
+ enumerable: true,
10554
+ value: null
10555
+ },
10556
+ attributeNameCheck: {
10557
+ writable: true,
10558
+ configurable: false,
10559
+ enumerable: true,
10560
+ value: null
10561
+ },
10562
+ allowCustomizedBuiltInElements: {
10563
+ writable: true,
10564
+ configurable: false,
10565
+ enumerable: true,
10566
+ value: false
10567
+ }
10568
+ }));
10569
+
10570
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
10571
+ let FORBID_TAGS = null;
10572
+
10573
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
10574
+ let FORBID_ATTR = null;
10575
+
10576
+ /* Decide if ARIA attributes are okay */
10577
+ let ALLOW_ARIA_ATTR = true;
10578
+
10579
+ /* Decide if custom data attributes are okay */
10580
+ let ALLOW_DATA_ATTR = true;
10581
+
10582
+ /* Decide if unknown protocols are okay */
10583
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
10584
+
10585
+ /* Decide if self-closing tags in attributes are allowed.
10586
+ * Usually removed due to a mXSS issue in jQuery 3.0 */
10587
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
10588
+
10589
+ /* Output should be safe for common template engines.
10590
+ * This means, DOMPurify removes data attributes, mustaches and ERB
10591
+ */
10592
+ let SAFE_FOR_TEMPLATES = false;
10593
+
10594
+ /* Output should be safe even for XML used within HTML and alike.
10595
+ * This means, DOMPurify removes comments when containing risky content.
10596
+ */
10597
+ let SAFE_FOR_XML = true;
10598
+
10599
+ /* Decide if document with <html>... should be returned */
10600
+ let WHOLE_DOCUMENT = false;
10601
+
10602
+ /* Track whether config is already set on this instance of DOMPurify. */
10603
+ let SET_CONFIG = false;
10604
+
10605
+ /* Decide if all elements (e.g. style, script) must be children of
10606
+ * document.body. By default, browsers might move them to document.head */
10607
+ let FORCE_BODY = false;
10608
+
10609
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
10610
+ * string (or a TrustedHTML object if Trusted Types are supported).
10611
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
10612
+ */
10613
+ let RETURN_DOM = false;
10614
+
10615
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
10616
+ * string (or a TrustedHTML object if Trusted Types are supported) */
10617
+ let RETURN_DOM_FRAGMENT = false;
10618
+
10619
+ /* Try to return a Trusted Type object instead of a string, return a string in
10620
+ * case Trusted Types are not supported */
10621
+ let RETURN_TRUSTED_TYPE = false;
10622
+
10623
+ /* Output should be free from DOM clobbering attacks?
10624
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
10625
+ */
10626
+ let SANITIZE_DOM = true;
10627
+
10628
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
10629
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
10630
+ *
10631
+ * HTML/DOM spec rules that enable DOM Clobbering:
10632
+ * - Named Access on Window (§7.3.3)
10633
+ * - DOM Tree Accessors (§3.1.5)
10634
+ * - Form Element Parent-Child Relations (§4.10.3)
10635
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
10636
+ * - HTMLCollection (§4.2.10.2)
10637
+ *
10638
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
10639
+ * with a constant string, i.e., `user-content-`
10640
+ */
10641
+ let SANITIZE_NAMED_PROPS = false;
10642
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
10643
+
10644
+ /* Keep element content when removing element? */
10645
+ let KEEP_CONTENT = true;
10646
+
10647
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
10648
+ * of importing it into a new Document and returning a sanitized copy */
10649
+ let IN_PLACE = false;
10650
+
10651
+ /* Allow usage of profiles like html, svg and mathMl */
10652
+ let USE_PROFILES = {};
10653
+
10654
+ /* Tags to ignore content of when KEEP_CONTENT is true */
10655
+ let FORBID_CONTENTS = null;
10656
+ 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']);
10657
+
10658
+ /* Tags that are safe for data: URIs */
10659
+ let DATA_URI_TAGS = null;
10660
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
10661
+
10662
+ /* Attributes safe for values like "javascript:" */
10663
+ let URI_SAFE_ATTRIBUTES = null;
10664
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
10665
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
10666
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
10667
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
10668
+ /* Document namespace */
10669
+ let NAMESPACE = HTML_NAMESPACE;
10670
+ let IS_EMPTY_INPUT = false;
10671
+
10672
+ /* Allowed XHTML+XML namespaces */
10673
+ let ALLOWED_NAMESPACES = null;
10674
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
10675
+
10676
+ /* Parsing of strict XHTML documents */
10677
+ let PARSER_MEDIA_TYPE = null;
10678
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
10679
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
10680
+ let transformCaseFunc = null;
10681
+
10682
+ /* Keep a reference to config to pass to hooks */
10683
+ let CONFIG = null;
10684
+
10685
+ /* Ideally, do not touch anything below this line */
10686
+ /* ______________________________________________ */
10687
+
10688
+ const formElement = document.createElement('form');
10689
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
10690
+ return testValue instanceof RegExp || testValue instanceof Function;
10691
+ };
10692
+
10693
+ /**
10694
+ * _parseConfig
10695
+ *
10696
+ * @param {Object} cfg optional config literal
10697
+ */
10698
+ // eslint-disable-next-line complexity
10699
+ const _parseConfig = function _parseConfig() {
10700
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
10701
+ if (CONFIG && CONFIG === cfg) {
10702
+ return;
10703
+ }
10704
+
10705
+ /* Shield configuration object from tampering */
10706
+ if (!cfg || typeof cfg !== 'object') {
10707
+ cfg = {};
10708
+ }
10709
+
10710
+ /* Shield configuration object from prototype pollution */
10711
+ cfg = clone(cfg);
10712
+ PARSER_MEDIA_TYPE =
10713
+ // eslint-disable-next-line unicorn/prefer-includes
10714
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
10715
+
10716
+ // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
10717
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
10718
+
10719
+ /* Set configuration parameters */
10720
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
10721
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
10722
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
10723
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),
10724
+ // eslint-disable-line indent
10725
+ cfg.ADD_URI_SAFE_ATTR,
10726
+ // eslint-disable-line indent
10727
+ transformCaseFunc // eslint-disable-line indent
10728
+ ) // eslint-disable-line indent
10729
+ : DEFAULT_URI_SAFE_ATTRIBUTES;
10730
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS),
10731
+ // eslint-disable-line indent
10732
+ cfg.ADD_DATA_URI_TAGS,
10733
+ // eslint-disable-line indent
10734
+ transformCaseFunc // eslint-disable-line indent
10735
+ ) // eslint-disable-line indent
10736
+ : DEFAULT_DATA_URI_TAGS;
10737
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
10738
+ FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
10739
+ FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
10740
+ USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
10741
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
10742
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
10743
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
10744
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
10745
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
10746
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
10747
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
10748
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
10749
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
10750
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
10751
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
10752
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
10753
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
10754
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
10755
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
10756
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
10757
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
10758
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
10759
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
10760
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
10761
+ }
10762
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
10763
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
10764
+ }
10765
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
10766
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
10767
+ }
10768
+ if (SAFE_FOR_TEMPLATES) {
10769
+ ALLOW_DATA_ATTR = false;
10770
+ }
10771
+ if (RETURN_DOM_FRAGMENT) {
10772
+ RETURN_DOM = true;
10773
+ }
10774
+
10775
+ /* Parse profile info */
10776
+ if (USE_PROFILES) {
10777
+ ALLOWED_TAGS = addToSet({}, text);
10778
+ ALLOWED_ATTR = [];
10779
+ if (USE_PROFILES.html === true) {
10780
+ addToSet(ALLOWED_TAGS, html$1);
10781
+ addToSet(ALLOWED_ATTR, html);
10782
+ }
10783
+ if (USE_PROFILES.svg === true) {
10784
+ addToSet(ALLOWED_TAGS, svg$1);
10785
+ addToSet(ALLOWED_ATTR, svg);
10786
+ addToSet(ALLOWED_ATTR, xml);
10787
+ }
10788
+ if (USE_PROFILES.svgFilters === true) {
10789
+ addToSet(ALLOWED_TAGS, svgFilters);
10790
+ addToSet(ALLOWED_ATTR, svg);
10791
+ addToSet(ALLOWED_ATTR, xml);
10792
+ }
10793
+ if (USE_PROFILES.mathMl === true) {
10794
+ addToSet(ALLOWED_TAGS, mathMl$1);
10795
+ addToSet(ALLOWED_ATTR, mathMl);
10796
+ addToSet(ALLOWED_ATTR, xml);
10797
+ }
10798
+ }
10799
+
10800
+ /* Merge configuration parameters */
10801
+ if (cfg.ADD_TAGS) {
10802
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
10803
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
10804
+ }
10805
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
10806
+ }
10807
+ if (cfg.ADD_ATTR) {
10808
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
10809
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
10810
+ }
10811
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
10812
+ }
10813
+ if (cfg.ADD_URI_SAFE_ATTR) {
10814
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
10815
+ }
10816
+ if (cfg.FORBID_CONTENTS) {
10817
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
10818
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
10819
+ }
10820
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
10821
+ }
10822
+
10823
+ /* Add #text in case KEEP_CONTENT is set to true */
10824
+ if (KEEP_CONTENT) {
10825
+ ALLOWED_TAGS['#text'] = true;
10826
+ }
10827
+
10828
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
10829
+ if (WHOLE_DOCUMENT) {
10830
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
10831
+ }
10832
+
10833
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
10834
+ if (ALLOWED_TAGS.table) {
10835
+ addToSet(ALLOWED_TAGS, ['tbody']);
10836
+ delete FORBID_TAGS.tbody;
10837
+ }
10838
+ if (cfg.TRUSTED_TYPES_POLICY) {
10839
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
10840
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
10841
+ }
10842
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
10843
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
10844
+ }
10845
+
10846
+ // Overwrite existing TrustedTypes policy.
10847
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
10848
+
10849
+ // Sign local variables required by `sanitize`.
10850
+ emptyHTML = trustedTypesPolicy.createHTML('');
10851
+ } else {
10852
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
10853
+ if (trustedTypesPolicy === undefined) {
10854
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
10855
+ }
10856
+
10857
+ // If creating the internal policy succeeded sign internal variables.
10858
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
10859
+ emptyHTML = trustedTypesPolicy.createHTML('');
10860
+ }
10861
+ }
10862
+
10863
+ // Prevent further manipulation of configuration.
10864
+ // Not available in IE8, Safari 5, etc.
10865
+ if (freeze) {
10866
+ freeze(cfg);
10867
+ }
10868
+ CONFIG = cfg;
10869
+ };
10870
+ const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
10871
+ const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'annotation-xml']);
10872
+
10873
+ // Certain elements are allowed in both SVG and HTML
10874
+ // namespace. We need to specify them explicitly
10875
+ // so that they don't get erroneously deleted from
10876
+ // HTML namespace.
10877
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
10878
+
10879
+ /* Keep track of all possible SVG and MathML tags
10880
+ * so that we can perform the namespace checks
10881
+ * correctly. */
10882
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
10883
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
10884
+
10885
+ /**
10886
+ * @param {Element} element a DOM element whose namespace is being checked
10887
+ * @returns {boolean} Return false if the element has a
10888
+ * namespace that a spec-compliant parser would never
10889
+ * return. Return true otherwise.
10890
+ */
10891
+ const _checkValidNamespace = function _checkValidNamespace(element) {
10892
+ let parent = getParentNode(element);
10893
+
10894
+ // In JSDOM, if we're inside shadow DOM, then parentNode
10895
+ // can be null. We just simulate parent in this case.
10896
+ if (!parent || !parent.tagName) {
10897
+ parent = {
10898
+ namespaceURI: NAMESPACE,
10899
+ tagName: 'template'
10900
+ };
10901
+ }
10902
+ const tagName = stringToLowerCase(element.tagName);
10903
+ const parentTagName = stringToLowerCase(parent.tagName);
10904
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
10905
+ return false;
10906
+ }
10907
+ if (element.namespaceURI === SVG_NAMESPACE) {
10908
+ // The only way to switch from HTML namespace to SVG
10909
+ // is via <svg>. If it happens via any other tag, then
10910
+ // it should be killed.
10911
+ if (parent.namespaceURI === HTML_NAMESPACE) {
10912
+ return tagName === 'svg';
10913
+ }
10914
+
10915
+ // The only way to switch from MathML to SVG is via`
10916
+ // svg if parent is either <annotation-xml> or MathML
10917
+ // text integration points.
10918
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
10919
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
10920
+ }
10921
+
10922
+ // We only allow elements that are defined in SVG
10923
+ // spec. All others are disallowed in SVG namespace.
10924
+ return Boolean(ALL_SVG_TAGS[tagName]);
10925
+ }
10926
+ if (element.namespaceURI === MATHML_NAMESPACE) {
10927
+ // The only way to switch from HTML namespace to MathML
10928
+ // is via <math>. If it happens via any other tag, then
10929
+ // it should be killed.
10930
+ if (parent.namespaceURI === HTML_NAMESPACE) {
10931
+ return tagName === 'math';
10932
+ }
10933
+
10934
+ // The only way to switch from SVG to MathML is via
10935
+ // <math> and HTML integration points
10936
+ if (parent.namespaceURI === SVG_NAMESPACE) {
10937
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
10938
+ }
10939
+
10940
+ // We only allow elements that are defined in MathML
10941
+ // spec. All others are disallowed in MathML namespace.
10942
+ return Boolean(ALL_MATHML_TAGS[tagName]);
10943
+ }
10944
+ if (element.namespaceURI === HTML_NAMESPACE) {
10945
+ // The only way to switch from SVG to HTML is via
10946
+ // HTML integration points, and from MathML to HTML
10947
+ // is via MathML text integration points
10948
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
10949
+ return false;
10950
+ }
10951
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
10952
+ return false;
10953
+ }
10954
+
10955
+ // We disallow tags that are specific for MathML
10956
+ // or SVG and should never appear in HTML namespace
10957
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
10958
+ }
10959
+
10960
+ // For XHTML and XML documents that support custom namespaces
10961
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
10962
+ return true;
10963
+ }
10964
+
10965
+ // The code should never reach this place (this means
10966
+ // that the element somehow got namespace that is not
10967
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
10968
+ // Return false just in case.
10969
+ return false;
10970
+ };
10971
+
10972
+ /**
10973
+ * _forceRemove
10974
+ *
10975
+ * @param {Node} node a DOM node
10976
+ */
10977
+ const _forceRemove = function _forceRemove(node) {
10978
+ arrayPush(DOMPurify.removed, {
10979
+ element: node
10980
+ });
10981
+ try {
10982
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
10983
+ getParentNode(node).removeChild(node);
10984
+ } catch (_) {
10985
+ remove(node);
10986
+ }
10987
+ };
10988
+
10989
+ /**
10990
+ * _removeAttribute
10991
+ *
10992
+ * @param {String} name an Attribute name
10993
+ * @param {Node} node a DOM node
10994
+ */
10995
+ const _removeAttribute = function _removeAttribute(name, node) {
10996
+ try {
10997
+ arrayPush(DOMPurify.removed, {
10998
+ attribute: node.getAttributeNode(name),
10999
+ from: node
11000
+ });
11001
+ } catch (_) {
11002
+ arrayPush(DOMPurify.removed, {
11003
+ attribute: null,
11004
+ from: node
11005
+ });
11006
+ }
11007
+ node.removeAttribute(name);
11008
+
11009
+ // We void attribute values for unremovable "is"" attributes
11010
+ if (name === 'is' && !ALLOWED_ATTR[name]) {
11011
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
11012
+ try {
11013
+ _forceRemove(node);
11014
+ } catch (_) {}
11015
+ } else {
11016
+ try {
11017
+ node.setAttribute(name, '');
11018
+ } catch (_) {}
11019
+ }
11020
+ }
11021
+ };
11022
+
11023
+ /**
11024
+ * _initDocument
11025
+ *
11026
+ * @param {String} dirty a string of dirty markup
11027
+ * @return {Document} a DOM, filled with the dirty markup
11028
+ */
11029
+ const _initDocument = function _initDocument(dirty) {
11030
+ /* Create a HTML document */
11031
+ let doc = null;
11032
+ let leadingWhitespace = null;
11033
+ if (FORCE_BODY) {
11034
+ dirty = '<remove></remove>' + dirty;
11035
+ } else {
11036
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
11037
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
11038
+ leadingWhitespace = matches && matches[0];
11039
+ }
11040
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
11041
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
11042
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
11043
+ }
11044
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
11045
+ /*
11046
+ * Use the DOMParser API by default, fallback later if needs be
11047
+ * DOMParser not work for svg when has multiple root element.
11048
+ */
11049
+ if (NAMESPACE === HTML_NAMESPACE) {
11050
+ try {
11051
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
11052
+ } catch (_) {}
11053
+ }
11054
+
11055
+ /* Use createHTMLDocument in case DOMParser is not available */
11056
+ if (!doc || !doc.documentElement) {
11057
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
11058
+ try {
11059
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
11060
+ } catch (_) {
11061
+ // Syntax error if dirtyPayload is invalid xml
11062
+ }
11063
+ }
11064
+ const body = doc.body || doc.documentElement;
11065
+ if (dirty && leadingWhitespace) {
11066
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
11067
+ }
11068
+
11069
+ /* Work on whole document or just its body */
11070
+ if (NAMESPACE === HTML_NAMESPACE) {
11071
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
11072
+ }
11073
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
11074
+ };
11075
+
11076
+ /**
11077
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
11078
+ *
11079
+ * @param {Node} root The root element or node to start traversing on.
11080
+ * @return {NodeIterator} The created NodeIterator
11081
+ */
11082
+ const _createNodeIterator = function _createNodeIterator(root) {
11083
+ return createNodeIterator.call(root.ownerDocument || root, root,
11084
+ // eslint-disable-next-line no-bitwise
11085
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
11086
+ };
11087
+
11088
+ /**
11089
+ * _isClobbered
11090
+ *
11091
+ * @param {Node} elm element to check for clobbering attacks
11092
+ * @return {Boolean} true if clobbered, false if safe
11093
+ */
11094
+ const _isClobbered = function _isClobbered(elm) {
11095
+ 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');
11096
+ };
11097
+
11098
+ /**
11099
+ * Checks whether the given object is a DOM node.
11100
+ *
11101
+ * @param {Node} object object to check whether it's a DOM node
11102
+ * @return {Boolean} true is object is a DOM node
11103
+ */
11104
+ const _isNode = function _isNode(object) {
11105
+ return typeof Node === 'function' && object instanceof Node;
11106
+ };
11107
+
11108
+ /**
11109
+ * _executeHook
11110
+ * Execute user configurable hooks
11111
+ *
11112
+ * @param {String} entryPoint Name of the hook's entry point
11113
+ * @param {Node} currentNode node to work on with the hook
11114
+ * @param {Object} data additional hook parameters
11115
+ */
11116
+ const _executeHook = function _executeHook(entryPoint, currentNode, data) {
11117
+ if (!hooks[entryPoint]) {
11118
+ return;
11119
+ }
11120
+ arrayForEach(hooks[entryPoint], hook => {
11121
+ hook.call(DOMPurify, currentNode, data, CONFIG);
11122
+ });
11123
+ };
11124
+
11125
+ /**
11126
+ * _sanitizeElements
11127
+ *
11128
+ * @protect nodeName
11129
+ * @protect textContent
11130
+ * @protect removeChild
11131
+ *
11132
+ * @param {Node} currentNode to check for permission to exist
11133
+ * @return {Boolean} true if node was killed, false if left alive
11134
+ */
11135
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
11136
+ let content = null;
11137
+
11138
+ /* Execute a hook if present */
11139
+ _executeHook('beforeSanitizeElements', currentNode, null);
11140
+
11141
+ /* Check if element is clobbered or can clobber */
11142
+ if (_isClobbered(currentNode)) {
11143
+ _forceRemove(currentNode);
11144
+ return true;
11145
+ }
11146
+
11147
+ /* Now let's check the element's type and name */
11148
+ const tagName = transformCaseFunc(currentNode.nodeName);
11149
+
11150
+ /* Execute a hook if present */
11151
+ _executeHook('uponSanitizeElement', currentNode, {
11152
+ tagName,
11153
+ allowedTags: ALLOWED_TAGS
11154
+ });
11155
+
11156
+ /* Detect mXSS attempts abusing namespace confusion */
11157
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
11158
+ _forceRemove(currentNode);
11159
+ return true;
11160
+ }
11161
+
11162
+ /* Remove any occurrence of processing instructions */
11163
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
11164
+ _forceRemove(currentNode);
11165
+ return true;
11166
+ }
11167
+
11168
+ /* Remove any kind of possibly harmful comments */
11169
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
11170
+ _forceRemove(currentNode);
11171
+ return true;
11172
+ }
11173
+
11174
+ /* Remove element if anything forbids its presence */
11175
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
11176
+ /* Check if we have a custom element to handle */
11177
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
11178
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
11179
+ return false;
11180
+ }
11181
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
11182
+ return false;
11183
+ }
11184
+ }
11185
+
11186
+ /* Keep content except for bad-listed elements */
11187
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
11188
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
11189
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
11190
+ if (childNodes && parentNode) {
11191
+ const childCount = childNodes.length;
11192
+ for (let i = childCount - 1; i >= 0; --i) {
11193
+ const childClone = cloneNode(childNodes[i], true);
11194
+ childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
11195
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
11196
+ }
11197
+ }
11198
+ }
11199
+ _forceRemove(currentNode);
11200
+ return true;
11201
+ }
11202
+
11203
+ /* Check whether element has a valid namespace */
11204
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
11205
+ _forceRemove(currentNode);
11206
+ return true;
11207
+ }
11208
+
11209
+ /* Make sure that older browsers don't get fallback-tag mXSS */
11210
+ if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
11211
+ _forceRemove(currentNode);
11212
+ return true;
11213
+ }
11214
+
11215
+ /* Sanitize element content to be template-safe */
11216
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
11217
+ /* Get the element's text content */
11218
+ content = currentNode.textContent;
11219
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
11220
+ content = stringReplace(content, expr, ' ');
11221
+ });
11222
+ if (currentNode.textContent !== content) {
11223
+ arrayPush(DOMPurify.removed, {
11224
+ element: currentNode.cloneNode()
11225
+ });
11226
+ currentNode.textContent = content;
11227
+ }
11228
+ }
11229
+
11230
+ /* Execute a hook if present */
11231
+ _executeHook('afterSanitizeElements', currentNode, null);
11232
+ return false;
11233
+ };
11234
+
11235
+ /**
11236
+ * _isValidAttribute
11237
+ *
11238
+ * @param {string} lcTag Lowercase tag name of containing element.
11239
+ * @param {string} lcName Lowercase attribute name.
11240
+ * @param {string} value Attribute value.
11241
+ * @return {Boolean} Returns true if `value` is valid, otherwise false.
11242
+ */
11243
+ // eslint-disable-next-line complexity
11244
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
11245
+ /* Make sure attribute cannot clobber */
11246
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
11247
+ return false;
11248
+ }
11249
+
11250
+ /* Allow valid data-* attributes: At least one character after "-"
11251
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
11252
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
11253
+ We don't need to check the value; it's always URI safe. */
11254
+ 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]) {
11255
+ if (
11256
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
11257
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
11258
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
11259
+ _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)) ||
11260
+ // Alternative, second condition checks if it's an `is`-attribute, AND
11261
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
11262
+ 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 {
11263
+ return false;
11264
+ }
11265
+ /* Check value is safe. First, is attr inert? If so, is safe */
11266
+ } 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) {
11267
+ return false;
11268
+ } else ;
11269
+ return true;
11270
+ };
11271
+
11272
+ /**
11273
+ * _isBasicCustomElement
11274
+ * checks if at least one dash is included in tagName, and it's not the first char
11275
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
11276
+ *
11277
+ * @param {string} tagName name of the tag of the node to sanitize
11278
+ * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
11279
+ */
11280
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
11281
+ return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
11282
+ };
11283
+
11284
+ /**
11285
+ * _sanitizeAttributes
11286
+ *
11287
+ * @protect attributes
11288
+ * @protect nodeName
11289
+ * @protect removeAttribute
11290
+ * @protect setAttribute
11291
+ *
11292
+ * @param {Node} currentNode to sanitize
11293
+ */
11294
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
11295
+ /* Execute a hook if present */
11296
+ _executeHook('beforeSanitizeAttributes', currentNode, null);
11297
+ const {
11298
+ attributes
11299
+ } = currentNode;
11300
+
11301
+ /* Check if we have attributes; if not we might have a text node */
11302
+ if (!attributes) {
11303
+ return;
11304
+ }
11305
+ const hookEvent = {
11306
+ attrName: '',
11307
+ attrValue: '',
11308
+ keepAttr: true,
11309
+ allowedAttributes: ALLOWED_ATTR
11310
+ };
11311
+ let l = attributes.length;
11312
+
11313
+ /* Go backwards over all attributes; safely remove bad ones */
11314
+ while (l--) {
11315
+ const attr = attributes[l];
11316
+ const {
11317
+ name,
11318
+ namespaceURI,
11319
+ value: attrValue
11320
+ } = attr;
11321
+ const lcName = transformCaseFunc(name);
11322
+ let value = name === 'value' ? attrValue : stringTrim(attrValue);
11323
+
11324
+ /* Execute a hook if present */
11325
+ hookEvent.attrName = lcName;
11326
+ hookEvent.attrValue = value;
11327
+ hookEvent.keepAttr = true;
11328
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
11329
+ _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
11330
+ value = hookEvent.attrValue;
11331
+
11332
+ /* Work around a security issue with comments inside attributes */
11333
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
11334
+ _removeAttribute(name, currentNode);
11335
+ continue;
11336
+ }
11337
+
11338
+ /* Did the hooks approve of the attribute? */
11339
+ if (hookEvent.forceKeepAttr) {
11340
+ continue;
11341
+ }
11342
+
11343
+ /* Remove attribute */
11344
+ _removeAttribute(name, currentNode);
11345
+
11346
+ /* Did the hooks approve of the attribute? */
11347
+ if (!hookEvent.keepAttr) {
11348
+ continue;
11349
+ }
11350
+
11351
+ /* Work around a security issue in jQuery 3.0 */
11352
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
11353
+ _removeAttribute(name, currentNode);
11354
+ continue;
11355
+ }
11356
+
11357
+ /* Sanitize attribute content to be template-safe */
11358
+ if (SAFE_FOR_TEMPLATES) {
11359
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
11360
+ value = stringReplace(value, expr, ' ');
11361
+ });
11362
+ }
11363
+
11364
+ /* Is `value` valid for this attribute? */
11365
+ const lcTag = transformCaseFunc(currentNode.nodeName);
11366
+ if (!_isValidAttribute(lcTag, lcName, value)) {
11367
+ continue;
11368
+ }
11369
+
11370
+ /* Full DOM Clobbering protection via namespace isolation,
11371
+ * Prefix id and name attributes with `user-content-`
11372
+ */
11373
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
11374
+ // Remove the attribute with this value
11375
+ _removeAttribute(name, currentNode);
11376
+
11377
+ // Prefix the value and later re-create the attribute with the sanitized value
11378
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
11379
+ }
11380
+
11381
+ /* Handle attributes that require Trusted Types */
11382
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
11383
+ if (namespaceURI) ; else {
11384
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
11385
+ case 'TrustedHTML':
11386
+ {
11387
+ value = trustedTypesPolicy.createHTML(value);
11388
+ break;
11389
+ }
11390
+ case 'TrustedScriptURL':
11391
+ {
11392
+ value = trustedTypesPolicy.createScriptURL(value);
11393
+ break;
11394
+ }
11395
+ }
11396
+ }
11397
+ }
11398
+
11399
+ /* Handle invalid data-* attribute set by try-catching it */
11400
+ try {
11401
+ if (namespaceURI) {
11402
+ currentNode.setAttributeNS(namespaceURI, name, value);
11403
+ } else {
11404
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
11405
+ currentNode.setAttribute(name, value);
11406
+ }
11407
+ if (_isClobbered(currentNode)) {
11408
+ _forceRemove(currentNode);
11409
+ } else {
11410
+ arrayPop(DOMPurify.removed);
11411
+ }
11412
+ } catch (_) {}
11413
+ }
11414
+
11415
+ /* Execute a hook if present */
11416
+ _executeHook('afterSanitizeAttributes', currentNode, null);
11417
+ };
11418
+
11419
+ /**
11420
+ * _sanitizeShadowDOM
11421
+ *
11422
+ * @param {DocumentFragment} fragment to iterate over recursively
11423
+ */
11424
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
11425
+ let shadowNode = null;
11426
+ const shadowIterator = _createNodeIterator(fragment);
11427
+
11428
+ /* Execute a hook if present */
11429
+ _executeHook('beforeSanitizeShadowDOM', fragment, null);
11430
+ while (shadowNode = shadowIterator.nextNode()) {
11431
+ /* Execute a hook if present */
11432
+ _executeHook('uponSanitizeShadowNode', shadowNode, null);
11433
+
11434
+ /* Sanitize tags and elements */
11435
+ if (_sanitizeElements(shadowNode)) {
11436
+ continue;
11437
+ }
11438
+
11439
+ /* Deep shadow DOM detected */
11440
+ if (shadowNode.content instanceof DocumentFragment) {
11441
+ _sanitizeShadowDOM(shadowNode.content);
11442
+ }
11443
+
11444
+ /* Check attributes, sanitize if necessary */
11445
+ _sanitizeAttributes(shadowNode);
11446
+ }
11447
+
11448
+ /* Execute a hook if present */
11449
+ _executeHook('afterSanitizeShadowDOM', fragment, null);
11450
+ };
11451
+
11452
+ /**
11453
+ * Sanitize
11454
+ * Public method providing core sanitation functionality
11455
+ *
11456
+ * @param {String|Node} dirty string or DOM node
11457
+ * @param {Object} cfg object
11458
+ */
11459
+ // eslint-disable-next-line complexity
11460
+ DOMPurify.sanitize = function (dirty) {
11461
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
11462
+ let body = null;
11463
+ let importedNode = null;
11464
+ let currentNode = null;
11465
+ let returnNode = null;
11466
+ /* Make sure we have a string to sanitize.
11467
+ DO NOT return early, as this will return the wrong type if
11468
+ the user has requested a DOM object rather than a string */
11469
+ IS_EMPTY_INPUT = !dirty;
11470
+ if (IS_EMPTY_INPUT) {
11471
+ dirty = '<!-->';
11472
+ }
11473
+
11474
+ /* Stringify, in case dirty is an object */
11475
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
11476
+ if (typeof dirty.toString === 'function') {
11477
+ dirty = dirty.toString();
11478
+ if (typeof dirty !== 'string') {
11479
+ throw typeErrorCreate('dirty is not a string, aborting');
11480
+ }
11481
+ } else {
11482
+ throw typeErrorCreate('toString is not a function');
11483
+ }
11484
+ }
11485
+
11486
+ /* Return dirty HTML if DOMPurify cannot run */
11487
+ if (!DOMPurify.isSupported) {
11488
+ return dirty;
11489
+ }
11490
+
11491
+ /* Assign config vars */
11492
+ if (!SET_CONFIG) {
11493
+ _parseConfig(cfg);
11494
+ }
11495
+
11496
+ /* Clean up removed elements */
11497
+ DOMPurify.removed = [];
11498
+
11499
+ /* Check if dirty is correctly typed for IN_PLACE */
11500
+ if (typeof dirty === 'string') {
11501
+ IN_PLACE = false;
11502
+ }
11503
+ if (IN_PLACE) {
11504
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
11505
+ if (dirty.nodeName) {
11506
+ const tagName = transformCaseFunc(dirty.nodeName);
11507
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
11508
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
11509
+ }
11510
+ }
11511
+ } else if (dirty instanceof Node) {
11512
+ /* If dirty is a DOM element, append to an empty document to avoid
11513
+ elements being stripped by the parser */
11514
+ body = _initDocument('<!---->');
11515
+ importedNode = body.ownerDocument.importNode(dirty, true);
11516
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
11517
+ /* Node is already a body, use as is */
11518
+ body = importedNode;
11519
+ } else if (importedNode.nodeName === 'HTML') {
11520
+ body = importedNode;
11521
+ } else {
11522
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
11523
+ body.appendChild(importedNode);
11524
+ }
11525
+ } else {
11526
+ /* Exit directly if we have nothing to do */
11527
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
11528
+ // eslint-disable-next-line unicorn/prefer-includes
11529
+ dirty.indexOf('<') === -1) {
11530
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
11531
+ }
11532
+
11533
+ /* Initialize the document to work on */
11534
+ body = _initDocument(dirty);
11535
+
11536
+ /* Check we have a DOM node from the data */
11537
+ if (!body) {
11538
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
11539
+ }
11540
+ }
11541
+
11542
+ /* Remove first element node (ours) if FORCE_BODY is set */
11543
+ if (body && FORCE_BODY) {
11544
+ _forceRemove(body.firstChild);
11545
+ }
11546
+
11547
+ /* Get node iterator */
11548
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
11549
+
11550
+ /* Now start iterating over the created document */
11551
+ while (currentNode = nodeIterator.nextNode()) {
11552
+ /* Sanitize tags and elements */
11553
+ if (_sanitizeElements(currentNode)) {
11554
+ continue;
11555
+ }
11556
+
11557
+ /* Shadow DOM detected, sanitize it */
11558
+ if (currentNode.content instanceof DocumentFragment) {
11559
+ _sanitizeShadowDOM(currentNode.content);
11560
+ }
11561
+
11562
+ /* Check attributes, sanitize if necessary */
11563
+ _sanitizeAttributes(currentNode);
11564
+ }
11565
+
11566
+ /* If we sanitized `dirty` in-place, return it. */
11567
+ if (IN_PLACE) {
11568
+ return dirty;
11569
+ }
11570
+
11571
+ /* Return sanitized string or DOM */
11572
+ if (RETURN_DOM) {
11573
+ if (RETURN_DOM_FRAGMENT) {
11574
+ returnNode = createDocumentFragment.call(body.ownerDocument);
11575
+ while (body.firstChild) {
11576
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
11577
+ returnNode.appendChild(body.firstChild);
11578
+ }
11579
+ } else {
11580
+ returnNode = body;
11581
+ }
11582
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
11583
+ /*
11584
+ AdoptNode() is not used because internal state is not reset
11585
+ (e.g. the past names map of a HTMLFormElement), this is safe
11586
+ in theory but we would rather not risk another attack vector.
11587
+ The state that is cloned by importNode() is explicitly defined
11588
+ by the specs.
11589
+ */
11590
+ returnNode = importNode.call(originalDocument, returnNode, true);
11591
+ }
11592
+ return returnNode;
11593
+ }
11594
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
11595
+
11596
+ /* Serialize doctype if allowed */
11597
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
11598
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
11599
+ }
11600
+
11601
+ /* Sanitize final string template-safe */
11602
+ if (SAFE_FOR_TEMPLATES) {
11603
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
11604
+ serializedHTML = stringReplace(serializedHTML, expr, ' ');
11605
+ });
11606
+ }
11607
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
11608
+ };
11609
+
11610
+ /**
11611
+ * Public method to set the configuration once
11612
+ * setConfig
11613
+ *
11614
+ * @param {Object} cfg configuration object
11615
+ */
11616
+ DOMPurify.setConfig = function () {
11617
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11618
+ _parseConfig(cfg);
11619
+ SET_CONFIG = true;
11620
+ };
11621
+
11622
+ /**
11623
+ * Public method to remove the configuration
11624
+ * clearConfig
11625
+ *
11626
+ */
11627
+ DOMPurify.clearConfig = function () {
11628
+ CONFIG = null;
11629
+ SET_CONFIG = false;
11630
+ };
11631
+
11632
+ /**
11633
+ * Public method to check if an attribute value is valid.
11634
+ * Uses last set config, if any. Otherwise, uses config defaults.
11635
+ * isValidAttribute
11636
+ *
11637
+ * @param {String} tag Tag name of containing element.
11638
+ * @param {String} attr Attribute name.
11639
+ * @param {String} value Attribute value.
11640
+ * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
11641
+ */
11642
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
11643
+ /* Initialize shared config vars if necessary. */
11644
+ if (!CONFIG) {
11645
+ _parseConfig({});
11646
+ }
11647
+ const lcTag = transformCaseFunc(tag);
11648
+ const lcName = transformCaseFunc(attr);
11649
+ return _isValidAttribute(lcTag, lcName, value);
11650
+ };
11651
+
11652
+ /**
11653
+ * AddHook
11654
+ * Public method to add DOMPurify hooks
11655
+ *
11656
+ * @param {String} entryPoint entry point for the hook to add
11657
+ * @param {Function} hookFunction function to execute
11658
+ */
11659
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
11660
+ if (typeof hookFunction !== 'function') {
11661
+ return;
11662
+ }
11663
+ hooks[entryPoint] = hooks[entryPoint] || [];
11664
+ arrayPush(hooks[entryPoint], hookFunction);
11665
+ };
11666
+
11667
+ /**
11668
+ * RemoveHook
11669
+ * Public method to remove a DOMPurify hook at a given entryPoint
11670
+ * (pops it from the stack of hooks if more are present)
11671
+ *
11672
+ * @param {String} entryPoint entry point for the hook to remove
11673
+ * @return {Function} removed(popped) hook
11674
+ */
11675
+ DOMPurify.removeHook = function (entryPoint) {
11676
+ if (hooks[entryPoint]) {
11677
+ return arrayPop(hooks[entryPoint]);
11678
+ }
11679
+ };
11680
+
11681
+ /**
11682
+ * RemoveHooks
11683
+ * Public method to remove all DOMPurify hooks at a given entryPoint
11684
+ *
11685
+ * @param {String} entryPoint entry point for the hooks to remove
11686
+ */
11687
+ DOMPurify.removeHooks = function (entryPoint) {
11688
+ if (hooks[entryPoint]) {
11689
+ hooks[entryPoint] = [];
11690
+ }
11691
+ };
11692
+
11693
+ /**
11694
+ * RemoveAllHooks
11695
+ * Public method to remove all DOMPurify hooks
11696
+ */
11697
+ DOMPurify.removeAllHooks = function () {
11698
+ hooks = {};
11699
+ };
11700
+ return DOMPurify;
11701
+ }
11702
+ var purify = createDOMPurify();
11703
+
11704
+ return purify;
11705
+
11706
+ }));
11707
+
11708
+ } (purify));
11709
+ return purify.exports;
11710
+ }
11711
+
11712
+ window.DOMPurify || (window.DOMPurify = requirePurify().default || requirePurify());
11713
+
10137
11714
  // src/utils/entries-to-string.ts
10138
11715
  function entriesToString(obj, separator = "=") {
10139
11716
  return !!Object.keys(obj).length ? Object.entries(obj).reduce((str, [key, value]) => [...str, `${key}${separator}${value}`], []).join(",") : "";
@@ -10317,7 +11894,7 @@ var Checkout$1 = class Checkout {
10317
11894
  };
10318
11895
 
10319
11896
  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";
10320
- 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";
11897
+ 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";
10321
11898
  var WalletBackground = /*#__PURE__*/function (_Background) {
10322
11899
  function WalletBackground(bgImageUrl) {
10323
11900
  var _this;
@@ -10391,10 +11968,10 @@ function getOverlayId(widgetId) {
10391
11968
  }
10392
11969
  function createFlypayV2ButtonStyle(widgetId) {
10393
11970
  var widgetClassName = getWidgetClassName(widgetId);
10394
- 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 ");
11971
+ 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 ");
10395
11972
  }
10396
11973
  function getButtonWithClassNames(classNames, containerId) {
10397
- 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 ");
11974
+ 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 ");
10398
11975
  }
10399
11976
 
10400
11977
  /**
@@ -10498,7 +12075,7 @@ var FlypayV2WalletService = /*#__PURE__*/function (_WalletService) {
10498
12075
  this.flypayV2Button = document.createElement('button');
10499
12076
  this.flypayV2Button.classList.add(getWidgetClassName(this.widgetId));
10500
12077
  this.flypayV2Button.setAttribute('type', 'button');
10501
- this.flypayV2Button.setAttribute('aria-label', 'Pay with flypay');
12078
+ this.flypayV2Button.setAttribute('aria-label', 'Pay with Coles Pay');
10502
12079
  this.flypayV2Button.setAttribute('id', this.widgetId);
10503
12080
  this.flypayV2Button.innerHTML = getFlypayV2Button(this.widgetId);
10504
12081
  return this.flypayV2Button;
@@ -10538,7 +12115,11 @@ var FlypayV2WalletService = /*#__PURE__*/function (_WalletService) {
10538
12115
  return resolve(res.id);
10539
12116
  },
10540
12117
  onError: function onError(message, code) {
10541
- return reject({
12118
+ console.error('Error generating order id', message);
12119
+ _this4.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
12120
+ message: message
12121
+ });
12122
+ reject({
10542
12123
  message: message,
10543
12124
  code: code
10544
12125
  });
@@ -11190,7 +12771,11 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
11190
12771
  return resolve(res);
11191
12772
  },
11192
12773
  onError: function onError(message) {
11193
- return reject(message);
12774
+ console.error('Error generating order id', message);
12775
+ _this4.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
12776
+ message: message
12777
+ });
12778
+ reject(message);
11194
12779
  }
11195
12780
  });
11196
12781
  });
@@ -11846,8 +13431,12 @@ var PaypalWalletService = /*#__PURE__*/function (_WalletService) {
11846
13431
  onSuccess: function onSuccess(res) {
11847
13432
  return resolve(res.id);
11848
13433
  },
11849
- onError: function onError(err) {
11850
- return reject(err);
13434
+ onError: function onError(error) {
13435
+ console.error('Error generating order id', error);
13436
+ _this4.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
13437
+ error: error
13438
+ });
13439
+ reject(error);
11851
13440
  }
11852
13441
  });
11853
13442
  });
@@ -15452,18 +17041,18 @@ var InstructionCardFormShow = /*#__PURE__*/function (_InstructionHandler) {
15452
17041
  }(InstructionHandler);
15453
17042
  InstructionCardFormShow = __decorate([Instruction('instruction.card_form.show')], InstructionCardFormShow);
15454
17043
 
15455
- 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";
17044
+ 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";
15456
17045
 
15457
17046
  var PAYMENT_METHOD = {
15458
- 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>",
15459
- 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>",
15460
- 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>",
15461
- 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>",
15462
- 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>",
15463
- 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>",
15464
- 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",
15465
- 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>"),
15466
- 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>")
17047
+ 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>",
17048
+ 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>",
17049
+ 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>",
17050
+ 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>",
17051
+ 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>",
17052
+ 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 ",
17053
+ 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>",
17054
+ 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>"),
17055
+ 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>")
15467
17056
  };
15468
17057
 
15469
17058
  var PAYMENTS_METHODS = {
@@ -15627,7 +17216,15 @@ var PaymentMethods = /*#__PURE__*/function () {
15627
17216
  var iframeDocument = iframe.contentDocument || ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.document);
15628
17217
  if (iframeDocument) {
15629
17218
  var radiosButtons = iframeDocument.querySelectorAll('input[type="radio"].payment-source__radio');
17219
+ var labels = iframeDocument.querySelectorAll('.payment-source');
17220
+ labels.forEach(function (label) {
17221
+ label.style.cursor = "not-allowed";
17222
+ });
15630
17223
  radiosButtons.forEach(function (radioButton) {
17224
+ var labels = iframeDocument.querySelectorAll('.payment-source');
17225
+ labels.forEach(function (label) {
17226
+ label.style.cursor = "not-allowed";
17227
+ });
15631
17228
  radioButton.style.cursor = "not-allowed";
15632
17229
  if (!radioButton.checked) {
15633
17230
  radioButton.style.border = "9px solid #EBEBE4";
@@ -16246,9 +17843,19 @@ var Checkout = /*#__PURE__*/function () {
16246
17843
  var tokenContent = AccessToken.validateJWT(intentToken);
16247
17844
  if (!tokenContent) throw new Error('Intent token is broken or expired. Please, issue new one.');
16248
17845
  var payload = AccessToken.extractData(tokenContent.body);
16249
- 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.');
17846
+ var allowed = this.validateJWTWhitelistedDomains(payload.whitelist_domains);
17847
+ if (!allowed) {
17848
+ throw new Error("Intent Token is not valid for current domain");
17849
+ }
17850
+ 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.");
16250
17851
  return payload;
16251
17852
  }
17853
+ }, {
17854
+ key: "validateJWTWhitelistedDomains",
17855
+ value: function validateJWTWhitelistedDomains(whitelist_domains) {
17856
+ if (!whitelist_domains) return true;
17857
+ return whitelist_domains.includes(window.location.hostname);
17858
+ }
16252
17859
  }, {
16253
17860
  key: "ready",
16254
17861
  value: function ready() {
@@ -16403,12 +18010,15 @@ var EVENT;
16403
18010
  EVENT["PAYMENT_IN_REVIEW"] = "paymentInReview";
16404
18011
  EVENT["ON_CLICK"] = "onClick";
16405
18012
  EVENT["ON_CHECKOUT_CLOSE"] = "onCheckoutClose";
18013
+ EVENT["ON_SHIPPING_ADDRESS_CHANGE"] = "onShippingAddressChange";
18014
+ EVENT["ON_SHIPPING_OPTIONS_CHANGE"] = "onShippingOptionsChange";
16406
18015
  })(EVENT || (EVENT = {}));
16407
18016
 
16408
18017
  var BaseWalletButton = /*#__PURE__*/function () {
16409
18018
  function BaseWalletButton(selector, publicKeyOrAccessToken, gatewayId, meta, requiredMetaFields) {
16410
18019
  _classCallCheck(this, BaseWalletButton);
16411
18020
  this.env = DEFAULT_ENV;
18021
+ this.onShippingOptionsChangeHandlerRegistered = false;
16412
18022
  this.eventEmitter = new EventEmitter();
16413
18023
  this.container = new Container(selector);
16414
18024
  this.api = new ApiInternal(publicKeyOrAccessToken, this.getApiAuthType(publicKeyOrAccessToken));
@@ -16419,11 +18029,8 @@ var BaseWalletButton = /*#__PURE__*/function () {
16419
18029
  return _createClass(BaseWalletButton, [{
16420
18030
  key: "getApiAuthType",
16421
18031
  value: function getApiAuthType(publicKeyOrAccessToken) {
16422
- if (AccessToken.validateJWT(publicKeyOrAccessToken)) {
16423
- return API_AUTH_TYPE.TOKEN;
16424
- } else {
16425
- return API_AUTH_TYPE.PUBLIC_KEY;
16426
- }
18032
+ if (AccessToken.validateJWT(publicKeyOrAccessToken)) return API_AUTH_TYPE.TOKEN;
18033
+ return API_AUTH_TYPE.PUBLIC_KEY;
16427
18034
  }
16428
18035
  /**
16429
18036
  * Current method can change environment. By default environment = sandbox.
@@ -16590,6 +18197,67 @@ var BaseWalletButton = /*#__PURE__*/function () {
16590
18197
  });
16591
18198
  });
16592
18199
  }
18200
+ /**
18201
+ * Callback for onShippingAddressChange method.
18202
+ *
18203
+ * @callback OnShippingAddressChangeCallback
18204
+ * @param {OnShippingAddressChangeEventData} data
18205
+ * @return {Promise<OnShippingAddressChangeEventResponse>} Address update result
18206
+ */
18207
+ /**
18208
+ * If shipping address data is updated, the function passed as parameter will be called.
18209
+ * Use this method to listen for shipping address selection or input from customer when shipping is enabled.
18210
+ * The event handler needs to return a new token in case a backend to backend wallet update call was executed.
18211
+ * In addition, if any error occured, an error string must be supplied.
18212
+ * By default, the event handler will be processed successfuly if neither token nor error is returned.
18213
+ *
18214
+ * @example
18215
+ * button.onShippingAddressChange((data) => {
18216
+ * const responseData = await fetch('https://your-server.com/update-shipping-info');
18217
+ * return { error: null, token: responseData.walletToken };
18218
+ * });
18219
+ *
18220
+ * @param {OnShippingAddressChangeCallback} [handler] - Function to be called when the shipping address data is updated.
18221
+ */
18222
+ }, {
18223
+ key: "onShippingAddressChange",
18224
+ value: function onShippingAddressChange(handler) {
18225
+ if (typeof handler === 'function') {
18226
+ return this.eventEmitter.subscribe(EVENT.ON_SHIPPING_ADDRESS_CHANGE, handler);
18227
+ }
18228
+ this.handleOnError(new Error('onShippingAddressChange event handler is required to return the wallet token string or reject.'));
18229
+ }
18230
+ /**
18231
+ * Callback for onShippingOptionsChange method.
18232
+ *
18233
+ * @callback OnShippingOptionsChangeCallback
18234
+ * @param {OnShippingOptionChangeEventData} data
18235
+ * @return {Promise<OnShippingOptionChangeEventResponse>} Address update result
18236
+ */
18237
+ /**
18238
+ * If shipping options data is updated, the function passed as parameter will be called.
18239
+ * Use this method to listen for shipping option selection from customer when shipping is enabled.
18240
+ * The event handler needs to return a new token in case a backend to backend wallet update call was executed.
18241
+ * In addition, if any error occured, an error string must be supplied.
18242
+ * By default, the event handler will be processed successfuly if neither token nor error is returned.
18243
+ *
18244
+ * @example
18245
+ * button.onShippingOptionsChange((data) => {
18246
+ * const responseData = await fetch('https://your-server.com/update-shipping-info');
18247
+ * return { error: null, token: responseData.walletToken };
18248
+ * });
18249
+ *
18250
+ * @param {OnShippingOptionsChangeCallback} [handler] - Function to be called when the shipping options data is updated.
18251
+ */
18252
+ }, {
18253
+ key: "onShippingOptionsChange",
18254
+ value: function onShippingOptionsChange(handler) {
18255
+ if (typeof handler === 'function') {
18256
+ this.onShippingOptionsChangeHandlerRegistered = true;
18257
+ return this.eventEmitter.subscribe(EVENT.ON_SHIPPING_OPTIONS_CHANGE, handler);
18258
+ }
18259
+ this.handleOnError(new Error('onShippingOptionsChange event handler is required to return the wallet token string or reject.'));
18260
+ }
16593
18261
  /**
16594
18262
  * Callback for onUnavailable method.
16595
18263
  *
@@ -16714,6 +18382,7 @@ var BaseWalletButton = /*#__PURE__*/function () {
16714
18382
  return this.eventEmitter.emitWithResult(EVENT.ON_CLICK, {
16715
18383
  event: EVENT.ON_CLICK
16716
18384
  }).then(function (result) {
18385
+ var _a;
16717
18386
  if (!result || result.length === 0) {
16718
18387
  var error = new Error('No result from onClick event');
16719
18388
  _this10.handleOnError(error);
@@ -16731,15 +18400,50 @@ var BaseWalletButton = /*#__PURE__*/function () {
16731
18400
  _this10.handleOnError(_error2);
16732
18401
  throw _error2;
16733
18402
  }
18403
+ if (((_a = _this10.chargeWalletTokenMeta.charge.shipping) === null || _a === void 0 ? void 0 : _a.options) && _this10.chargeWalletTokenMeta.charge.shipping.options.length > 0) {
18404
+ if (!_this10.onShippingOptionsChangeHandlerRegistered) {
18405
+ var _error3 = new Error("There is no event handler registered for shipping options change. Consider using \"onShippingOptionsChange\" SDK method to register the event handler.");
18406
+ _this10.handleOnError(_error3);
18407
+ throw _error3;
18408
+ }
18409
+ }
16734
18410
  });
16735
18411
  }
18412
+ }, {
18413
+ key: "handleMerchantOnShippingChangedEvent",
18414
+ value: function handleMerchantOnShippingChangedEvent(eventData) {
18415
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
18416
+ var _this11 = this;
18417
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
18418
+ while (1) switch (_context.prev = _context.next) {
18419
+ case 0:
18420
+ return _context.abrupt("return", this.eventEmitter.emitWithResult(eventData.event, eventData).then(function (result) {
18421
+ if (!result || result.length === 0) {
18422
+ var error = new Error('No result from shippingUpdate event');
18423
+ _this11.handleOnError(error);
18424
+ throw error;
18425
+ }
18426
+ var shippingResponse = result[0];
18427
+ if (shippingResponse.token) _this11.setWalletToken(shippingResponse.token, {
18428
+ skipApiAuth: true
18429
+ });
18430
+ return shippingResponse;
18431
+ }));
18432
+ case 1:
18433
+ case "end":
18434
+ return _context.stop();
18435
+ }
18436
+ }, _callee, this);
18437
+ }));
18438
+ }
16736
18439
  }, {
16737
18440
  key: "setWalletToken",
16738
- value: function setWalletToken(token) {
18441
+ value: function setWalletToken(token, opts) {
16739
18442
  var parsedToken = AccessToken.validateJWT(token);
16740
18443
  if (!parsedToken) return this.handleOnError(new Error("Invalid charge token"));
16741
18444
  this.chargeWalletTokenMeta = AccessToken.extractMeta(parsedToken.body);
16742
18445
  if (!this.chargeWalletTokenMeta) return this.handleOnError(new Error('Invalid charge token'));
18446
+ if ((opts === null || opts === void 0 ? void 0 : opts.skipApiAuth) === true) return;
16743
18447
  this.api.auth = token;
16744
18448
  this.api.authType = API_AUTH_TYPE.TOKEN;
16745
18449
  }
@@ -16775,6 +18479,7 @@ var BaseWalletButton = /*#__PURE__*/function () {
16775
18479
  data: error
16776
18480
  }));
16777
18481
  }
18482
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
16778
18483
  }, {
16779
18484
  key: "eventDataFromApiError",
16780
18485
  value: function eventDataFromApiError(err) {
@@ -16787,13 +18492,14 @@ var BaseWalletButton = /*#__PURE__*/function () {
16787
18492
  }, {
16788
18493
  key: "validateRequiredMetaFields",
16789
18494
  value: function validateRequiredMetaFields(requiredMetaFields) {
16790
- var _this11 = this;
18495
+ var _this12 = this;
16791
18496
  if (!this.meta) throw new Error('Meta is required');
16792
18497
  if (typeof this.meta.amount !== 'number') throw new Error('meta.amount needs to be numeric');
16793
18498
  if (typeof this.meta.currency !== 'string') throw new Error('meta.amount needs to be a string');
18499
+ // biome-ignore lint/complexity/noForEach: <explanation>
16794
18500
  requiredMetaFields.forEach(function (field) {
16795
18501
  var keys = field.split('.');
16796
- var current = _this11.meta;
18502
+ var current = _this12.meta;
16797
18503
  // Traverse the nested structure
16798
18504
  var _iterator = _createForOfIteratorHelper(keys),
16799
18505
  _step;
@@ -16817,6 +18523,12 @@ var generateApplePayButtonStyles = function generateApplePayButtonStyles() {
16817
18523
  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 ";
16818
18524
  };
16819
18525
 
18526
+ var ContactShippingEditingMode;
18527
+ (function (ContactShippingEditingMode) {
18528
+ ContactShippingEditingMode["AVAILABLE"] = "available";
18529
+ ContactShippingEditingMode["STORE_PICKUP"] = "store_pickup";
18530
+ })(ContactShippingEditingMode || (ContactShippingEditingMode = {}));
18531
+
16820
18532
  var DEFAULT_APPLE_PAY_CAPABILITIES = ['paymentCredentialsAvailable'];
16821
18533
  /**
16822
18534
  * Class ApplePayWalletButtonExpress to work with Apple Pay Wallet.
@@ -16839,6 +18551,19 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
16839
18551
  var _this;
16840
18552
  _classCallCheck(this, ApplePayWalletButtonExpress);
16841
18553
  _this = _callSuper(this, ApplePayWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, ['amount_label', 'country']]);
18554
+ _this.onApplePayButtonClicked = function () {
18555
+ return _this.handleMerchantOnExpressButtonClickEvent().then(function () {
18556
+ _this.paymentSession = new ApplePaySession(14, _this.createRequest());
18557
+ _this.paymentSession.onvalidatemerchant = _this.onValidateMerchant;
18558
+ _this.paymentSession.onpaymentauthorized = _this.onPaymentAuthorized;
18559
+ _this.paymentSession.oncancel = _this.onCancelPayment;
18560
+ _this.paymentSession.onshippingmethodselected = _this.onApplePayShippingMethodUpdate;
18561
+ _this.paymentSession.onshippingcontactselected = _this.onApplePayShippingContactUpdate;
18562
+ _this.paymentSession.begin();
18563
+ })["catch"](function () {
18564
+ _this.handleCheckoutClose();
18565
+ });
18566
+ };
16842
18567
  _this.onValidateMerchant = function (event) {
16843
18568
  _this.handleMerchantOnExpressButtonClickEvent().then(function () {
16844
18569
  _this.getMerchantSession().then(function (merchantSession) {
@@ -16884,6 +18609,70 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
16884
18609
  _this.onCancelPayment = function () {
16885
18610
  return _this.handleCheckoutClose();
16886
18611
  };
18612
+ _this.onApplePayShippingContactUpdate = function (data) {
18613
+ return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
18614
+ var _this2 = this;
18615
+ var _a;
18616
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
18617
+ while (1) switch (_context.prev = _context.next) {
18618
+ case 0:
18619
+ return _context.abrupt("return", this.handleMerchantOnShippingChangedEvent({
18620
+ event: EVENT.ON_SHIPPING_ADDRESS_CHANGE,
18621
+ chargeId: (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
18622
+ data: this.parseShippingContactUpdateEvent(data)
18623
+ }).then(function (response) {
18624
+ var _a, _b, _c, _d, _e, _f;
18625
+ var mappedErrors = [];
18626
+ var mappedNewShippingMethods = [];
18627
+ 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) {
18628
+ mappedNewShippingMethods = _this2.parseShippingMethod(_this2.chargeWalletTokenMeta.charge.shipping.options);
18629
+ }
18630
+ if ((_d = response.error) === null || _d === void 0 ? void 0 : _d.code) {
18631
+ mappedErrors = [_this2.formatErrorFields(response.error)];
18632
+ }
18633
+ _this2.paymentSession.completeShippingContactSelection({
18634
+ newTotal: {
18635
+ label: _this2.meta.amount_label,
18636
+ 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)
18637
+ },
18638
+ newShippingMethods: mappedNewShippingMethods,
18639
+ errors: mappedErrors
18640
+ });
18641
+ }));
18642
+ case 1:
18643
+ case "end":
18644
+ return _context.stop();
18645
+ }
18646
+ }, _callee, this);
18647
+ }));
18648
+ };
18649
+ _this.onApplePayShippingMethodUpdate = function (data) {
18650
+ return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
18651
+ var _this3 = this;
18652
+ var _b;
18653
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
18654
+ while (1) switch (_context2.prev = _context2.next) {
18655
+ case 0:
18656
+ return _context2.abrupt("return", this.handleMerchantOnShippingChangedEvent({
18657
+ event: EVENT.ON_SHIPPING_OPTIONS_CHANGE,
18658
+ chargeId: (_b = this.chargeWalletTokenMeta) === null || _b === void 0 ? void 0 : _b.charge.id,
18659
+ data: this.parseShippingMethodUpdateEvent(data)
18660
+ }).then(function (_response) {
18661
+ var _a, _b;
18662
+ _this3.paymentSession.completeShippingMethodSelection({
18663
+ newTotal: {
18664
+ label: _this3.meta.amount_label,
18665
+ 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)
18666
+ }
18667
+ });
18668
+ }));
18669
+ case 1:
18670
+ case "end":
18671
+ return _context2.stop();
18672
+ }
18673
+ }, _callee2, this);
18674
+ }));
18675
+ };
16887
18676
  return _this;
16888
18677
  }
16889
18678
  /**
@@ -16898,27 +18687,27 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
16898
18687
  return _createClass(ApplePayWalletButtonExpress, [{
16899
18688
  key: "load",
16900
18689
  value: function load() {
16901
- var _this2 = this;
18690
+ var _this4 = this;
16902
18691
  if (!window.Promise) return this.handleOnUnavailable();
16903
18692
  var applePayScript = document.createElement('script');
16904
18693
  applePayScript.src = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js";
16905
18694
  applePayScript.type = "text/javascript";
16906
18695
  applePayScript.crossOrigin = 'anonymous';
16907
18696
  applePayScript.onload = function () {
16908
- _this2.getGatewayWalletConfig().then(function (config) {
18697
+ _this4.getGatewayWalletConfig().then(function (config) {
16909
18698
  if (!config || config.type !== 'MasterCard' || !config.credentials || !config.credentials.apple || !config.credentials.apple.merchant) throw new Error('Invalid configuration');
16910
- return _this2.checkAvailability(config);
18699
+ return _this4.checkAvailability(config);
16911
18700
  }).then(function (available) {
16912
- if (!available) return _this2.handleOnUnavailable();
16913
- return _this2.mount();
18701
+ if (!available) return _this4.handleOnUnavailable();
18702
+ return _this4.mount();
16914
18703
  })["catch"](function (err) {
16915
- if (err) _this2.handleOnError(err);
16916
- _this2.handleOnUnavailable();
18704
+ if (err) _this4.handleOnError(err);
18705
+ _this4.handleOnUnavailable();
16917
18706
  });
16918
18707
  };
16919
18708
  applePayScript.onerror = function (err) {
16920
18709
  console.error("ApplePayWalletButtonExpress: Error loading ApplePay script", err);
16921
- _this2.handleOnUnavailable();
18710
+ _this4.handleOnUnavailable();
16922
18711
  return;
16923
18712
  };
16924
18713
  document.head.appendChild(applePayScript);
@@ -16940,15 +18729,15 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
16940
18729
  }, {
16941
18730
  key: "checkAvailability",
16942
18731
  value: function checkAvailability(config) {
16943
- var _this3 = this;
18732
+ var _this5 = this;
16944
18733
  return new Promise(function (resolve, _reject) {
16945
18734
  var _a;
16946
18735
  if (!window.ApplePaySession || !ApplePaySession) {
16947
18736
  resolve(false);
16948
18737
  }
16949
18738
  var formattedCapabilities = DEFAULT_APPLE_PAY_CAPABILITIES;
16950
- if (((_a = _this3.meta.apple_pay_capabilities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
16951
- formattedCapabilities = _this3.formatCapabilities(_this3.meta.apple_pay_capabilities);
18739
+ if (((_a = _this5.meta.apple_pay_capabilities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
18740
+ formattedCapabilities = _this5.formatCapabilities(_this5.meta.apple_pay_capabilities);
16952
18741
  }
16953
18742
  ApplePaySession.applePayCapabilities(config.credentials[WALLET_TYPE.APPLE].merchant).then(function (capabilities) {
16954
18743
  var canMakePayment = formattedCapabilities.includes(capabilities === null || capabilities === void 0 ? void 0 : capabilities.paymentCredentialStatus);
@@ -16977,21 +18766,16 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
16977
18766
  }
16978
18767
  applePayButton.addEventListener('click', this.onApplePayButtonClicked.bind(this));
16979
18768
  }
16980
- }, {
16981
- key: "onApplePayButtonClicked",
16982
- value: function onApplePayButtonClicked() {
16983
- this.paymentSession = new ApplePaySession(14, this.createRequest());
16984
- this.paymentSession.onvalidatemerchant = this.onValidateMerchant;
16985
- this.paymentSession.onpaymentauthorized = this.onPaymentAuthorized;
16986
- this.paymentSession.oncancel = this.onCancelPayment;
16987
- this.paymentSession.begin();
16988
- }
16989
18769
  }, {
16990
18770
  key: "createRequest",
16991
18771
  value: function createRequest() {
18772
+ var _a, _b, _c, _d;
16992
18773
  // https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest
16993
- var _a;
16994
- return {
18774
+ var shippingContactEditingMode;
18775
+ if (this.meta.shipping_editing_mode) {
18776
+ shippingContactEditingMode = this.meta.shipping_editing_mode === ContactShippingEditingMode.AVAILABLE ? 'available' : 'storePickup';
18777
+ }
18778
+ return _extends(_extends({
16995
18779
  countryCode: this.meta.country,
16996
18780
  currencyCode: this.meta.currency,
16997
18781
  merchantCapabilities: this.meta.merchant_capabilities || ['supports3DS', 'supportsCredit', 'supportsDebit'],
@@ -17004,7 +18788,12 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
17004
18788
  amount: (_a = this.meta.amount) === null || _a === void 0 ? void 0 : _a.toFixed(2),
17005
18789
  type: 'final'
17006
18790
  }
17007
- };
18791
+ }, shippingContactEditingMode && {
18792
+ shippingContactEditingMode: shippingContactEditingMode
18793
+ }), {
18794
+ shippingContact: this.parseShippingContact(),
18795
+ 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)
18796
+ });
17008
18797
  }
17009
18798
  }, {
17010
18799
  key: "getMerchantSession",
@@ -17027,6 +18816,93 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
17027
18816
  return fieldMap[capability] || capability;
17028
18817
  });
17029
18818
  }
18819
+ }, {
18820
+ key: "parseShippingContact",
18821
+ value: function parseShippingContact() {
18822
+ var _a, _b, _c, _d, _e;
18823
+ if (!((_b = (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge) === null || _b === void 0 ? void 0 : _b.shipping)) return {};
18824
+ 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) && {
18825
+ phoneNumber: this.chargeWalletTokenMeta.charge.shipping.contact.phone,
18826
+ emailAddress: this.chargeWalletTokenMeta.charge.shipping.contact.email,
18827
+ givenName: this.chargeWalletTokenMeta.charge.shipping.contact.first_name,
18828
+ familyName: this.chargeWalletTokenMeta.charge.shipping.contact.last_name
18829
+ }), {
18830
+ addressLines: [this.chargeWalletTokenMeta.charge.shipping.address_line1, this.chargeWalletTokenMeta.charge.shipping.address_line2, this.chargeWalletTokenMeta.charge.shipping.address_line3].filter(Boolean),
18831
+ locality: this.chargeWalletTokenMeta.charge.shipping.address_city,
18832
+ postalCode: this.chargeWalletTokenMeta.charge.shipping.address_postcode,
18833
+ administrativeArea: this.chargeWalletTokenMeta.charge.shipping.address_state,
18834
+ country: this.chargeWalletTokenMeta.charge.shipping.address_country,
18835
+ countryCode: this.chargeWalletTokenMeta.charge.shipping.address_country
18836
+ });
18837
+ }
18838
+ }, {
18839
+ key: "parseShippingMethod",
18840
+ value: function parseShippingMethod() {
18841
+ var shippingOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
18842
+ return shippingOptions.map(function (option) {
18843
+ return {
18844
+ label: option.label,
18845
+ detail: option.detail,
18846
+ amount: option.amount,
18847
+ identifier: option.id
18848
+ };
18849
+ });
18850
+ }
18851
+ }, {
18852
+ key: "parseShippingMethodUpdateEvent",
18853
+ value: function parseShippingMethodUpdateEvent(data) {
18854
+ return {
18855
+ shipping_option_id: data.shippingMethod.identifier,
18856
+ label: data.shippingMethod.label,
18857
+ detail: data.shippingMethod.detail,
18858
+ amount: data.shippingMethod.amount
18859
+ };
18860
+ }
18861
+ }, {
18862
+ key: "parseShippingContactUpdateEvent",
18863
+ value: function parseShippingContactUpdateEvent(data) {
18864
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
18865
+ return _extends(_extends(_extends({
18866
+ contact: {
18867
+ 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,
18868
+ 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,
18869
+ 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,
18870
+ 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
18871
+ }
18872
+ }, ((_w = data.shippingContact.addressLines) === null || _w === void 0 ? void 0 : _w[0]) && {
18873
+ address_line1: data.shippingContact.addressLines[0]
18874
+ }), ((_x = data.shippingContact.addressLines) === null || _x === void 0 ? void 0 : _x[1]) && {
18875
+ address_line2: data.shippingContact.addressLines[1]
18876
+ }), {
18877
+ address_city: data.shippingContact.locality,
18878
+ address_postcode: data.shippingContact.postalCode,
18879
+ address_state: data.shippingContact.administrativeArea,
18880
+ address_country: data.shippingContact.countryCode
18881
+ });
18882
+ }
18883
+ }, {
18884
+ key: "formatErrorFields",
18885
+ value: function formatErrorFields(error) {
18886
+ var fieldMap = {
18887
+ phone: "phoneNumber",
18888
+ email: "emailAddress",
18889
+ phonetic_name: "phoneticName",
18890
+ address_lines: "addressLines",
18891
+ address_city: "locality",
18892
+ address_postcode: "postalCode",
18893
+ address_state: "administrativeArea",
18894
+ address_country: "country",
18895
+ address_country_code: "countryCode"
18896
+ };
18897
+ var contactField = fieldMap[error.field] || error.field;
18898
+ var codeMap = {
18899
+ address_error: "addressUnserviceable",
18900
+ shipping_contact_invalid: "shippingContactInvalid",
18901
+ billing_contact_invalid: "billingContactInvalid"
18902
+ };
18903
+ var code = codeMap[error.code] || 'unknown';
18904
+ return new ApplePayError(code, contactField, error.message);
18905
+ }
17030
18906
  }]);
17031
18907
  }(BaseWalletButton);
17032
18908
 
@@ -17048,8 +18924,11 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
17048
18924
  var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
17049
18925
  /** @constructs */ // constructs added for correct parse classes jsdoc2md
17050
18926
  function PaypalWalletButtonExpress(selector, publicKeyOrAccessToken, gatewayId, meta) {
18927
+ var _this;
17051
18928
  _classCallCheck(this, PaypalWalletButtonExpress);
17052
- return _callSuper(this, PaypalWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, []]);
18929
+ _this = _callSuper(this, PaypalWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, []]);
18930
+ _this.shippingRequested = false;
18931
+ return _this;
17053
18932
  }
17054
18933
  /**
17055
18934
  * Initializes the availability checks and inserts the button if possible.
@@ -17063,15 +18942,15 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
17063
18942
  return _createClass(PaypalWalletButtonExpress, [{
17064
18943
  key: "load",
17065
18944
  value: function load() {
17066
- var _this = this;
18945
+ var _this2 = this;
17067
18946
  if (!window.Promise) return this.handleOnUnavailable();
17068
18947
  this.getGatewayWalletConfig().then(function (config) {
17069
18948
  if (!config || config.type !== 'Paypal' || !config.credentials || !config.credentials.client_auth) throw new Error('Invalid configuration');
17070
- _this.config = config;
17071
- _this.renderPaypalButton();
18949
+ _this2.config = config;
18950
+ _this2.renderPaypalButton();
17072
18951
  })["catch"](function (err) {
17073
- if (err) _this.handleOnError(err);
17074
- _this.handleOnUnavailable();
18952
+ if (err) _this2.handleOnError(err);
18953
+ _this2.handleOnUnavailable();
17075
18954
  });
17076
18955
  }
17077
18956
  /**
@@ -17100,18 +18979,18 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
17100
18979
  }, {
17101
18980
  key: "renderPaypalCommonComponent",
17102
18981
  value: function renderPaypalCommonComponent() {
17103
- var _this2 = this;
18982
+ var _this3 = this;
17104
18983
  var _a, _b;
17105
18984
  var buttonId = ((_a = this.container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
17106
18985
  var paypalScript = document.createElement("script");
17107
- 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" : '');
18986
+ 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' : '');
17108
18987
  paypalScript.async = true;
17109
18988
  paypalScript.onload = function () {
17110
18989
  if (window.paypal) {
17111
- _this2.paypal = window.paypal;
17112
- _this2.paypal.Buttons(_extends({}, _this2.paypalSharedProps())).render("#".concat(buttonId));
18990
+ _this3.paypal = window.paypal;
18991
+ _this3.paypal.Buttons(_extends({}, _this3.paypalSharedProps())).render("#".concat(buttonId));
17113
18992
  } else {
17114
- _this2.handleOnUnavailable();
18993
+ _this3.handleOnUnavailable();
17115
18994
  }
17116
18995
  };
17117
18996
  document.head.appendChild(paypalScript);
@@ -17119,38 +18998,38 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
17119
18998
  }, {
17120
18999
  key: "renderPaypalStandaloneComponent",
17121
19000
  value: function renderPaypalStandaloneComponent() {
17122
- var _this3 = this;
19001
+ var _this4 = this;
17123
19002
  var _a, _b, _c;
17124
19003
  var buttonId = ((_a = this.container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
17125
19004
  var paypalScript = document.createElement("script");
17126
19005
  // 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
17127
- 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');
19006
+ 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');
17128
19007
  paypalScript.async = true;
17129
19008
  paypalScript.onload = function () {
17130
19009
  var _a;
17131
19010
  if (window.paypal) {
17132
- _this3.paypal = window.paypal;
17133
- var isPayLater = !!_this3.meta.pay_later;
17134
- var button = _this3.paypal.Buttons(_extends({
17135
- fundingSource: isPayLater ? _this3.paypal.FUNDING.PAYLATER : _this3.paypal.FUNDING.PAYPAL
17136
- }, _this3.paypalSharedProps()));
19011
+ _this4.paypal = window.paypal;
19012
+ var isPayLater = !!_this4.meta.pay_later;
19013
+ var button = _this4.paypal.Buttons(_extends({
19014
+ fundingSource: isPayLater ? _this4.paypal.FUNDING.PAYLATER : _this4.paypal.FUNDING.PAYPAL
19015
+ }, _this4.paypalSharedProps()));
17137
19016
  if (button.isEligible()) {
17138
19017
  button.render("#".concat(buttonId));
17139
- if (isPayLater && !_this3.meta.hide_message) {
17140
- var messaging = _this3.paypal.Messages(_extends({
17141
- amount: _this3.meta.amount,
17142
- currency: _this3.meta.currency,
19018
+ if (isPayLater && !_this4.meta.hide_message) {
19019
+ var messaging = _this4.paypal.Messages(_extends({
19020
+ amount: _this4.meta.amount,
19021
+ currency: _this4.meta.currency,
17143
19022
  placement: 'payment'
17144
- }, ((_a = _this3.meta.style) === null || _a === void 0 ? void 0 : _a.messages) && {
17145
- style: _this3.meta.style.messages
19023
+ }, ((_a = _this4.meta.style) === null || _a === void 0 ? void 0 : _a.messages) && {
19024
+ style: _this4.meta.style.messages
17146
19025
  }));
17147
19026
  messaging.render("#".concat(buttonId));
17148
19027
  }
17149
19028
  } else {
17150
- _this3.handleOnUnavailable();
19029
+ _this4.handleOnUnavailable();
17151
19030
  }
17152
19031
  } else {
17153
- _this3.handleOnUnavailable();
19032
+ _this4.handleOnUnavailable();
17154
19033
  }
17155
19034
  };
17156
19035
  document.head.appendChild(paypalScript);
@@ -17158,23 +19037,32 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
17158
19037
  }, {
17159
19038
  key: "paypalSharedProps",
17160
19039
  value: function paypalSharedProps() {
17161
- var _this4 = this;
19040
+ var _this5 = this;
17162
19041
  return _extends(_extends({}, this.meta.style && {
17163
19042
  style: this.meta.style
17164
19043
  }), {
17165
19044
  onClick: function onClick(_data, actions) {
17166
- return _this4.handleMerchantOnExpressButtonClickEvent().then(function () {
19045
+ return _this5.handleMerchantOnExpressButtonClickEvent().then(function () {
17167
19046
  return actions.resolve();
17168
19047
  })["catch"](function () {
17169
- _this4.handleCheckoutClose();
19048
+ _this5.handleCheckoutClose();
17170
19049
  return actions.reject();
17171
19050
  });
17172
19051
  },
17173
19052
  createOrder: function createOrder() {
17174
19053
  return new Promise(function (resolve, reject) {
17175
- if (!_this4.api.auth) return reject(new Error('Wallet Token not injected. Please handle onClick correctly.'));
17176
- return _this4.executeWalletCallback({
17177
- request_type: 'CREATE_TRANSACTION'
19054
+ var _a, _b;
19055
+ if (!_this5.api.auth) return reject(new Error('Wallet Token not injected. Please handle onClick correctly.'));
19056
+ var shipping = (_b = (_a = _this5.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge) === null || _b === void 0 ? void 0 : _b.shipping;
19057
+ if (shipping) {
19058
+ var hasCompleteShippingAddress = ['address_line1', 'address_city', 'address_country', 'address_state', 'address_postcode'].every(function (key) {
19059
+ return Boolean(shipping[key]);
19060
+ });
19061
+ _this5.shippingRequested = !hasCompleteShippingAddress;
19062
+ }
19063
+ return _this5.executeWalletCallback({
19064
+ request_type: 'CREATE_TRANSACTION',
19065
+ request_shipping: _this5.shippingRequested
17178
19066
  }).then(function (res) {
17179
19067
  resolve(res.id);
17180
19068
  })["catch"](function (err) {
@@ -17183,8 +19071,8 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
17183
19071
  });
17184
19072
  },
17185
19073
  onApprove: function onApprove(data) {
17186
- if (_this4.pendingApprovalPromise) return _this4.pendingApprovalPromise;
17187
- _this4.pendingApprovalPromise = _this4.executeWalletCapture({
19074
+ if (_this5.pendingApprovalPromise) return _this5.pendingApprovalPromise;
19075
+ _this5.pendingApprovalPromise = _this5.executeWalletCapture({
17188
19076
  payment_method_id: data.orderID,
17189
19077
  customer: {
17190
19078
  payment_source: {
@@ -17193,19 +19081,105 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
17193
19081
  }
17194
19082
  }
17195
19083
  })["finally"](function () {
17196
- _this4.pendingApprovalPromise = undefined;
19084
+ _this5.pendingApprovalPromise = undefined;
17197
19085
  });
17198
- return _this4.pendingApprovalPromise;
19086
+ return _this5.pendingApprovalPromise;
17199
19087
  },
17200
19088
  onCancel: function onCancel() {
17201
- return _this4.handleCheckoutClose();
19089
+ return _this5.handleCheckoutClose();
17202
19090
  },
17203
19091
  onError: function onError() {
17204
19092
  // Error handling so that paypal does not throw an uncaught error
17205
19093
  // We're already handling errors and notifying Merchants at "wallet-buttons.ts"
19094
+ },
19095
+ onShippingAddressChange: function onShippingAddressChange(data, actions) {
19096
+ return _this5.handleShippingAddressUpdate(data, actions);
19097
+ },
19098
+ onShippingOptionsChange: function onShippingOptionsChange(data, actions) {
19099
+ return _this5.handleShippingOptionsUpdate(data, actions);
17206
19100
  }
17207
19101
  });
17208
19102
  }
19103
+ }, {
19104
+ key: "handleShippingAddressUpdate",
19105
+ value: function handleShippingAddressUpdate(data, actions) {
19106
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
19107
+ var _a;
19108
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
19109
+ while (1) switch (_context.prev = _context.next) {
19110
+ case 0:
19111
+ if (this.shippingRequested) {
19112
+ _context.next = 2;
19113
+ break;
19114
+ }
19115
+ return _context.abrupt("return");
19116
+ case 2:
19117
+ return _context.abrupt("return", this.handleMerchantOnShippingChangedEvent({
19118
+ event: EVENT.ON_SHIPPING_ADDRESS_CHANGE,
19119
+ chargeId: (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
19120
+ data: {
19121
+ address_city: data.shippingAddress.city,
19122
+ address_state: data.shippingAddress.state,
19123
+ address_postcode: data.shippingAddress.postalCode,
19124
+ address_country: data.shippingAddress.countryCode
19125
+ }
19126
+ }).then(function (response) {
19127
+ var _a;
19128
+ if ((_a = response.error) === null || _a === void 0 ? void 0 : _a.code) {
19129
+ var errorKey = response.error.code.toUpperCase();
19130
+ var errorMessage = data.errors[errorKey];
19131
+ if (errorMessage) {
19132
+ return actions.reject(errorMessage);
19133
+ }
19134
+ return actions.reject();
19135
+ }
19136
+ })["catch"](function (err) {
19137
+ // If err is not one of Paypal's data.errros, it defaults to "Unable to update address. Please try again" by Paypal
19138
+ return actions.reject(err);
19139
+ }));
19140
+ case 3:
19141
+ case "end":
19142
+ return _context.stop();
19143
+ }
19144
+ }, _callee, this);
19145
+ }));
19146
+ }
19147
+ }, {
19148
+ key: "handleShippingOptionsUpdate",
19149
+ value: function handleShippingOptionsUpdate(data, actions) {
19150
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
19151
+ var _a;
19152
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
19153
+ while (1) switch (_context2.prev = _context2.next) {
19154
+ case 0:
19155
+ return _context2.abrupt("return", this.handleMerchantOnShippingChangedEvent({
19156
+ event: EVENT.ON_SHIPPING_OPTIONS_CHANGE,
19157
+ chargeId: (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge.id,
19158
+ data: {
19159
+ shipping_option_id: data.selectedShippingOption.id,
19160
+ amount: data.selectedShippingOption.amount.value
19161
+ }
19162
+ }).then(function (response) {
19163
+ var _a;
19164
+ if ((_a = response.error) === null || _a === void 0 ? void 0 : _a.code) {
19165
+ var errorKey = response.error.code.toUpperCase();
19166
+ var errorMessage = data.errors[errorKey];
19167
+ if (errorMessage) {
19168
+ return actions.reject(errorMessage);
19169
+ }
19170
+ return actions.reject();
19171
+ }
19172
+ })["catch"](function (err) {
19173
+ // If err is not one of Paypal's data.errros, it defaults to "Unable to update address. Please try again" by Paypal
19174
+ return actions.reject(err);
19175
+ }));
19176
+ case 1:
19177
+ case "end":
19178
+ return _context2.stop();
19179
+ }
19180
+ }, _callee2, this);
19181
+ }));
19182
+ }
17209
19183
  }]);
17210
19184
  }(BaseWalletButton);
17211
19185