@zonos/elements 1.3.87 → 1.3.89

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 (94) hide show
  1. package/dist/cjs/{cart-120d68f9.js → cart-e15290ab.js} +15 -7
  2. package/dist/cjs/{createCustomEvent-ed9156dc.js → createCustomEvent-3da45800.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{paypal-875cfaf1.js → paypal-47b71e3b.js} +1 -1
  5. package/dist/cjs/zonos-address_7.cjs.entry.js +8 -6
  6. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +1022 -11
  7. package/dist/cjs/zonos-checkout.cjs.entry.js +4 -6
  8. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  9. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-notification_3.cjs.entry.js +2 -2
  15. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js +4 -4
  16. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +20 -4
  17. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +2 -4
  18. package/dist/collection/components/store/checkout/stripe.js +2 -3
  19. package/dist/collection/components/store/hello/localization.js +13 -4
  20. package/dist/collection/components/stripe/zonos-address/zonos-address.js +9 -6
  21. package/dist/collection/components/utils/cleanHtmlMarkdown.js +28 -0
  22. package/dist/esm/{cart-9f1caabf.js → cart-08c2a740.js} +15 -7
  23. package/dist/esm/{createCustomEvent-464c49c0.js → createCustomEvent-a8a9fe09.js} +1 -1
  24. package/dist/esm/index.js +7 -7
  25. package/dist/esm/{paypal-fb449438.js → paypal-4a21792c.js} +1 -1
  26. package/dist/esm/zonos-address_7.entry.js +9 -7
  27. package/dist/esm/zonos-cart-items_12.entry.js +1022 -11
  28. package/dist/esm/zonos-checkout.entry.js +4 -6
  29. package/dist/esm/zonos-controller.entry.js +1 -1
  30. package/dist/esm/zonos-country-flag.entry.js +1 -1
  31. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  32. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  33. package/dist/esm/zonos-hello.entry.js +1 -1
  34. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  35. package/dist/esm/zonos-notification_3.entry.js +2 -2
  36. package/dist/esm-es5/{cart-9f1caabf.js → cart-08c2a740.js} +1 -1
  37. package/dist/esm-es5/{createCustomEvent-464c49c0.js → createCustomEvent-a8a9fe09.js} +1 -1
  38. package/dist/esm-es5/index.js +1 -1
  39. package/dist/esm-es5/{paypal-fb449438.js → paypal-4a21792c.js} +1 -1
  40. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  41. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  42. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  43. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  44. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  45. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  46. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  47. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  48. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  49. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  50. package/dist/scripts/index.d.ts +1 -1
  51. package/dist/scripts/index.js +1 -1
  52. package/dist/scripts/loadZonos.js +1 -1
  53. package/dist/scripts/zonos.js +1 -1
  54. package/dist/types/components/store/hello/localization.d.ts +1 -4
  55. package/dist/types/components/utils/cleanHtmlMarkdown.d.ts +16 -0
  56. package/dist/types/types/checkout/CheckoutConfig.d.ts +1 -1
  57. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  58. package/dist/zonos-elements/index.esm.js +1 -1
  59. package/dist/zonos-elements/p-0033c20b.system.entry.js +1 -0
  60. package/dist/zonos-elements/{p-89d2a27b.system.js → p-00706ef7.system.js} +1 -1
  61. package/dist/zonos-elements/{p-d7cf2a25.system.js → p-05b75d37.system.js} +1 -1
  62. package/dist/zonos-elements/{p-3d521899.system.entry.js → p-12f25739.system.entry.js} +1 -1
  63. package/dist/zonos-elements/{p-9f36076f.entry.js → p-2aeb1f26.entry.js} +1 -1
  64. package/dist/zonos-elements/{p-cb9ff4df.js → p-3214b2df.js} +1 -1
  65. package/dist/zonos-elements/{p-7fce2a19.entry.js → p-3951ac01.entry.js} +1 -1
  66. package/dist/zonos-elements/{p-e6129027.entry.js → p-3ac3a8be.entry.js} +1 -1
  67. package/dist/zonos-elements/p-48b151ae.entry.js +1 -0
  68. package/dist/zonos-elements/{p-5bef550e.system.entry.js → p-49010cea.system.entry.js} +1 -1
  69. package/dist/zonos-elements/{p-35577bd8.system.entry.js → p-4a417566.system.entry.js} +1 -1
  70. package/dist/zonos-elements/{p-72513d54.entry.js → p-4f13a851.entry.js} +1 -1
  71. package/dist/zonos-elements/{p-d33a87fc.entry.js → p-531973ca.entry.js} +1 -1
  72. package/dist/zonos-elements/{p-294026a0.system.js → p-5f0c4397.system.js} +1 -1
  73. package/dist/zonos-elements/{p-92f1cf70.entry.js → p-6d5d31ac.entry.js} +1 -1
  74. package/dist/zonos-elements/{p-0b01b9b1.system.entry.js → p-76015899.system.entry.js} +1 -1
  75. package/dist/zonos-elements/{p-f7ec6999.js → p-7c8ad901.js} +1 -1
  76. package/dist/zonos-elements/p-8bbe007f.system.entry.js +1 -0
  77. package/dist/zonos-elements/p-9773abc9.entry.js +1 -0
  78. package/dist/zonos-elements/{p-253cbdae.entry.js → p-aab5ccde.entry.js} +1 -1
  79. package/dist/zonos-elements/{p-6c380fa8.system.js → p-c1f0aeb4.system.js} +1 -1
  80. package/dist/zonos-elements/p-c28824a0.system.entry.js +1 -0
  81. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  82. package/dist/zonos-elements/{p-d81f35bf.js → p-db4c833d.js} +2 -2
  83. package/dist/zonos-elements/{p-c0a7750c.system.entry.js → p-dbd51a62.system.entry.js} +1 -1
  84. package/dist/zonos-elements/p-f49ca64f.entry.js +1 -0
  85. package/dist/zonos-elements/{p-69bb9b53.system.entry.js → p-f5e29ed6.system.entry.js} +1 -1
  86. package/dist/zonos-elements/{p-94589f18.system.entry.js → p-fc2191b7.system.entry.js} +1 -1
  87. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  88. package/package.json +5 -4
  89. package/dist/zonos-elements/p-4412b94b.system.entry.js +0 -1
  90. package/dist/zonos-elements/p-49a3a2a5.system.entry.js +0 -1
  91. package/dist/zonos-elements/p-7f21c1c4.entry.js +0 -1
  92. package/dist/zonos-elements/p-a7b6fd9c.entry.js +0 -1
  93. package/dist/zonos-elements/p-b58f4433.entry.js +0 -1
  94. package/dist/zonos-elements/p-e05eed8e.system.entry.js +0 -1
@@ -1,9 +1,9 @@
1
1
  import { r as registerInstance, a as getAssetPath, h, H as Host, F as Fragment, c as createEvent, d as getElement } from './index-86b8247e.js';
2
- import { d as cartStore, t as translate, F as currencyFormat, G as cartStoreHasOneEligibleItem, H as stripeStoreApplyPromoCode, I as stripeStoreRemovePromoCode, v as stripeStoreReset, j as stripeStore, J as stripeStoreRetrievePayment, K as stripeStoreMessageBasedOnStatus, L as stripeStoreResetPromoCode, l as localizationStore, M as stripeStoreTranslateAddressToLatin, N as cartStoreUpdateSelectedShippingOption, O as cartStoreGetShippingTransitInfo, P as sortServiceLevelOptionsByAmount } from './cart-9f1caabf.js';
2
+ import { d as cartStore, t as translate, E as currencyFormat, F as cartStoreHasOneEligibleItem, G as stripeStoreApplyPromoCode, H as stripeStoreRemovePromoCode, v as stripeStoreReset, j as stripeStore, I as stripeStoreRetrievePayment, J as stripeStoreMessageBasedOnStatus, K as stripeStoreResetPromoCode, l as localizationStore, L as stripeStoreTranslateAddressToLatin, M as cartStoreUpdateSelectedShippingOption, N as cartStoreGetShippingTransitInfo, O as sortServiceLevelOptionsByAmount } from './cart-08c2a740.js';
3
3
  import { c as classes } from './classes-0d95c529.js';
4
- import { s as submitGtag, a as paypalStore, b as paypalStoreReset, c as paypalStoreHasPaypalEnabled, i as isContrastColor } from './paypal-fb449438.js';
4
+ import { s as submitGtag, a as paypalStore, b as paypalStoreReset, c as paypalStoreHasPaypalEnabled, i as isContrastColor } from './paypal-4a21792c.js';
5
5
  import { z as zonosStore, g as getZonosStoreTheme, d as zonosStoreFontFamily } from './zonosStore-0dc7a947.js';
6
- import { t as trackConversionEvent, c as createCustomEvent, g as getIsTestMode } from './createCustomEvent-464c49c0.js';
6
+ import { t as trackConversionEvent, c as createCustomEvent, g as getIsTestMode } from './createCustomEvent-a8a9fe09.js';
7
7
  import { g as getBorderRadius } from './getBorderRadius-cff1e39b.js';
8
8
  import { h as handleFetch, s as sendErrorLog } from './handleFetch-0133265e.js';
9
9
  import { i as isCheckoutMobile } from './isCheckoutMobile-8846dccb.js';
@@ -12,6 +12,1002 @@ import { i as isDarkColor, t as tinycolor } from './isDarkColor-b3afa948.js';
12
12
  import { i as isColorVariable } from './isColorVariable-82457bef.js';
13
13
  import { c as containsNonLatinChars } from './containsNonLatinChars-2d8810c3.js';
14
14
 
15
+ function extend (destination) {
16
+ for (var i = 1; i < arguments.length; i++) {
17
+ var source = arguments[i];
18
+ for (var key in source) {
19
+ if (source.hasOwnProperty(key)) destination[key] = source[key];
20
+ }
21
+ }
22
+ return destination
23
+ }
24
+
25
+ function repeat (character, count) {
26
+ return Array(count + 1).join(character)
27
+ }
28
+
29
+ function trimLeadingNewlines (string) {
30
+ return string.replace(/^\n*/, '')
31
+ }
32
+
33
+ function trimTrailingNewlines (string) {
34
+ // avoid match-at-end regexp bottleneck, see #370
35
+ var indexEnd = string.length;
36
+ while (indexEnd > 0 && string[indexEnd - 1] === '\n') indexEnd--;
37
+ return string.substring(0, indexEnd)
38
+ }
39
+
40
+ var blockElements = [
41
+ 'ADDRESS', 'ARTICLE', 'ASIDE', 'AUDIO', 'BLOCKQUOTE', 'BODY', 'CANVAS',
42
+ 'CENTER', 'DD', 'DIR', 'DIV', 'DL', 'DT', 'FIELDSET', 'FIGCAPTION', 'FIGURE',
43
+ 'FOOTER', 'FORM', 'FRAMESET', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HEADER',
44
+ 'HGROUP', 'HR', 'HTML', 'ISINDEX', 'LI', 'MAIN', 'MENU', 'NAV', 'NOFRAMES',
45
+ 'NOSCRIPT', 'OL', 'OUTPUT', 'P', 'PRE', 'SECTION', 'TABLE', 'TBODY', 'TD',
46
+ 'TFOOT', 'TH', 'THEAD', 'TR', 'UL'
47
+ ];
48
+
49
+ function isBlock (node) {
50
+ return is(node, blockElements)
51
+ }
52
+
53
+ var voidElements = [
54
+ 'AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT',
55
+ 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR'
56
+ ];
57
+
58
+ function isVoid (node) {
59
+ return is(node, voidElements)
60
+ }
61
+
62
+ function hasVoid (node) {
63
+ return has(node, voidElements)
64
+ }
65
+
66
+ var meaningfulWhenBlankElements = [
67
+ 'A', 'TABLE', 'THEAD', 'TBODY', 'TFOOT', 'TH', 'TD', 'IFRAME', 'SCRIPT',
68
+ 'AUDIO', 'VIDEO'
69
+ ];
70
+
71
+ function isMeaningfulWhenBlank (node) {
72
+ return is(node, meaningfulWhenBlankElements)
73
+ }
74
+
75
+ function hasMeaningfulWhenBlank (node) {
76
+ return has(node, meaningfulWhenBlankElements)
77
+ }
78
+
79
+ function is (node, tagNames) {
80
+ return tagNames.indexOf(node.nodeName) >= 0
81
+ }
82
+
83
+ function has (node, tagNames) {
84
+ return (
85
+ node.getElementsByTagName &&
86
+ tagNames.some(function (tagName) {
87
+ return node.getElementsByTagName(tagName).length
88
+ })
89
+ )
90
+ }
91
+
92
+ var rules = {};
93
+
94
+ rules.paragraph = {
95
+ filter: 'p',
96
+
97
+ replacement: function (content) {
98
+ return '\n\n' + content + '\n\n'
99
+ }
100
+ };
101
+
102
+ rules.lineBreak = {
103
+ filter: 'br',
104
+
105
+ replacement: function (content, node, options) {
106
+ return options.br + '\n'
107
+ }
108
+ };
109
+
110
+ rules.heading = {
111
+ filter: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
112
+
113
+ replacement: function (content, node, options) {
114
+ var hLevel = Number(node.nodeName.charAt(1));
115
+
116
+ if (options.headingStyle === 'setext' && hLevel < 3) {
117
+ var underline = repeat((hLevel === 1 ? '=' : '-'), content.length);
118
+ return (
119
+ '\n\n' + content + '\n' + underline + '\n\n'
120
+ )
121
+ } else {
122
+ return '\n\n' + repeat('#', hLevel) + ' ' + content + '\n\n'
123
+ }
124
+ }
125
+ };
126
+
127
+ rules.blockquote = {
128
+ filter: 'blockquote',
129
+
130
+ replacement: function (content) {
131
+ content = content.replace(/^\n+|\n+$/g, '');
132
+ content = content.replace(/^/gm, '> ');
133
+ return '\n\n' + content + '\n\n'
134
+ }
135
+ };
136
+
137
+ rules.list = {
138
+ filter: ['ul', 'ol'],
139
+
140
+ replacement: function (content, node) {
141
+ var parent = node.parentNode;
142
+ if (parent.nodeName === 'LI' && parent.lastElementChild === node) {
143
+ return '\n' + content
144
+ } else {
145
+ return '\n\n' + content + '\n\n'
146
+ }
147
+ }
148
+ };
149
+
150
+ rules.listItem = {
151
+ filter: 'li',
152
+
153
+ replacement: function (content, node, options) {
154
+ content = content
155
+ .replace(/^\n+/, '') // remove leading newlines
156
+ .replace(/\n+$/, '\n') // replace trailing newlines with just a single one
157
+ .replace(/\n/gm, '\n '); // indent
158
+ var prefix = options.bulletListMarker + ' ';
159
+ var parent = node.parentNode;
160
+ if (parent.nodeName === 'OL') {
161
+ var start = parent.getAttribute('start');
162
+ var index = Array.prototype.indexOf.call(parent.children, node);
163
+ prefix = (start ? Number(start) + index : index + 1) + '. ';
164
+ }
165
+ return (
166
+ prefix + content + (node.nextSibling && !/\n$/.test(content) ? '\n' : '')
167
+ )
168
+ }
169
+ };
170
+
171
+ rules.indentedCodeBlock = {
172
+ filter: function (node, options) {
173
+ return (
174
+ options.codeBlockStyle === 'indented' &&
175
+ node.nodeName === 'PRE' &&
176
+ node.firstChild &&
177
+ node.firstChild.nodeName === 'CODE'
178
+ )
179
+ },
180
+
181
+ replacement: function (content, node, options) {
182
+ return (
183
+ '\n\n ' +
184
+ node.firstChild.textContent.replace(/\n/g, '\n ') +
185
+ '\n\n'
186
+ )
187
+ }
188
+ };
189
+
190
+ rules.fencedCodeBlock = {
191
+ filter: function (node, options) {
192
+ return (
193
+ options.codeBlockStyle === 'fenced' &&
194
+ node.nodeName === 'PRE' &&
195
+ node.firstChild &&
196
+ node.firstChild.nodeName === 'CODE'
197
+ )
198
+ },
199
+
200
+ replacement: function (content, node, options) {
201
+ var className = node.firstChild.getAttribute('class') || '';
202
+ var language = (className.match(/language-(\S+)/) || [null, ''])[1];
203
+ var code = node.firstChild.textContent;
204
+
205
+ var fenceChar = options.fence.charAt(0);
206
+ var fenceSize = 3;
207
+ var fenceInCodeRegex = new RegExp('^' + fenceChar + '{3,}', 'gm');
208
+
209
+ var match;
210
+ while ((match = fenceInCodeRegex.exec(code))) {
211
+ if (match[0].length >= fenceSize) {
212
+ fenceSize = match[0].length + 1;
213
+ }
214
+ }
215
+
216
+ var fence = repeat(fenceChar, fenceSize);
217
+
218
+ return (
219
+ '\n\n' + fence + language + '\n' +
220
+ code.replace(/\n$/, '') +
221
+ '\n' + fence + '\n\n'
222
+ )
223
+ }
224
+ };
225
+
226
+ rules.horizontalRule = {
227
+ filter: 'hr',
228
+
229
+ replacement: function (content, node, options) {
230
+ return '\n\n' + options.hr + '\n\n'
231
+ }
232
+ };
233
+
234
+ rules.inlineLink = {
235
+ filter: function (node, options) {
236
+ return (
237
+ options.linkStyle === 'inlined' &&
238
+ node.nodeName === 'A' &&
239
+ node.getAttribute('href')
240
+ )
241
+ },
242
+
243
+ replacement: function (content, node) {
244
+ var href = node.getAttribute('href');
245
+ if (href) href = href.replace(/([()])/g, '\\$1');
246
+ var title = cleanAttribute(node.getAttribute('title'));
247
+ if (title) title = ' "' + title.replace(/"/g, '\\"') + '"';
248
+ return '[' + content + '](' + href + title + ')'
249
+ }
250
+ };
251
+
252
+ rules.referenceLink = {
253
+ filter: function (node, options) {
254
+ return (
255
+ options.linkStyle === 'referenced' &&
256
+ node.nodeName === 'A' &&
257
+ node.getAttribute('href')
258
+ )
259
+ },
260
+
261
+ replacement: function (content, node, options) {
262
+ var href = node.getAttribute('href');
263
+ var title = cleanAttribute(node.getAttribute('title'));
264
+ if (title) title = ' "' + title + '"';
265
+ var replacement;
266
+ var reference;
267
+
268
+ switch (options.linkReferenceStyle) {
269
+ case 'collapsed':
270
+ replacement = '[' + content + '][]';
271
+ reference = '[' + content + ']: ' + href + title;
272
+ break
273
+ case 'shortcut':
274
+ replacement = '[' + content + ']';
275
+ reference = '[' + content + ']: ' + href + title;
276
+ break
277
+ default:
278
+ var id = this.references.length + 1;
279
+ replacement = '[' + content + '][' + id + ']';
280
+ reference = '[' + id + ']: ' + href + title;
281
+ }
282
+
283
+ this.references.push(reference);
284
+ return replacement
285
+ },
286
+
287
+ references: [],
288
+
289
+ append: function (options) {
290
+ var references = '';
291
+ if (this.references.length) {
292
+ references = '\n\n' + this.references.join('\n') + '\n\n';
293
+ this.references = []; // Reset references
294
+ }
295
+ return references
296
+ }
297
+ };
298
+
299
+ rules.emphasis = {
300
+ filter: ['em', 'i'],
301
+
302
+ replacement: function (content, node, options) {
303
+ if (!content.trim()) return ''
304
+ return options.emDelimiter + content + options.emDelimiter
305
+ }
306
+ };
307
+
308
+ rules.strong = {
309
+ filter: ['strong', 'b'],
310
+
311
+ replacement: function (content, node, options) {
312
+ if (!content.trim()) return ''
313
+ return options.strongDelimiter + content + options.strongDelimiter
314
+ }
315
+ };
316
+
317
+ rules.code = {
318
+ filter: function (node) {
319
+ var hasSiblings = node.previousSibling || node.nextSibling;
320
+ var isCodeBlock = node.parentNode.nodeName === 'PRE' && !hasSiblings;
321
+
322
+ return node.nodeName === 'CODE' && !isCodeBlock
323
+ },
324
+
325
+ replacement: function (content) {
326
+ if (!content) return ''
327
+ content = content.replace(/\r?\n|\r/g, ' ');
328
+
329
+ var extraSpace = /^`|^ .*?[^ ].* $|`$/.test(content) ? ' ' : '';
330
+ var delimiter = '`';
331
+ var matches = content.match(/`+/gm) || [];
332
+ while (matches.indexOf(delimiter) !== -1) delimiter = delimiter + '`';
333
+
334
+ return delimiter + extraSpace + content + extraSpace + delimiter
335
+ }
336
+ };
337
+
338
+ rules.image = {
339
+ filter: 'img',
340
+
341
+ replacement: function (content, node) {
342
+ var alt = cleanAttribute(node.getAttribute('alt'));
343
+ var src = node.getAttribute('src') || '';
344
+ var title = cleanAttribute(node.getAttribute('title'));
345
+ var titlePart = title ? ' "' + title + '"' : '';
346
+ return src ? '![' + alt + ']' + '(' + src + titlePart + ')' : ''
347
+ }
348
+ };
349
+
350
+ function cleanAttribute (attribute) {
351
+ return attribute ? attribute.replace(/(\n+\s*)+/g, '\n') : ''
352
+ }
353
+
354
+ /**
355
+ * Manages a collection of rules used to convert HTML to Markdown
356
+ */
357
+
358
+ function Rules (options) {
359
+ this.options = options;
360
+ this._keep = [];
361
+ this._remove = [];
362
+
363
+ this.blankRule = {
364
+ replacement: options.blankReplacement
365
+ };
366
+
367
+ this.keepReplacement = options.keepReplacement;
368
+
369
+ this.defaultRule = {
370
+ replacement: options.defaultReplacement
371
+ };
372
+
373
+ this.array = [];
374
+ for (var key in options.rules) this.array.push(options.rules[key]);
375
+ }
376
+
377
+ Rules.prototype = {
378
+ add: function (key, rule) {
379
+ this.array.unshift(rule);
380
+ },
381
+
382
+ keep: function (filter) {
383
+ this._keep.unshift({
384
+ filter: filter,
385
+ replacement: this.keepReplacement
386
+ });
387
+ },
388
+
389
+ remove: function (filter) {
390
+ this._remove.unshift({
391
+ filter: filter,
392
+ replacement: function () {
393
+ return ''
394
+ }
395
+ });
396
+ },
397
+
398
+ forNode: function (node) {
399
+ if (node.isBlank) return this.blankRule
400
+ var rule;
401
+
402
+ if ((rule = findRule(this.array, node, this.options))) return rule
403
+ if ((rule = findRule(this._keep, node, this.options))) return rule
404
+ if ((rule = findRule(this._remove, node, this.options))) return rule
405
+
406
+ return this.defaultRule
407
+ },
408
+
409
+ forEach: function (fn) {
410
+ for (var i = 0; i < this.array.length; i++) fn(this.array[i], i);
411
+ }
412
+ };
413
+
414
+ function findRule (rules, node, options) {
415
+ for (var i = 0; i < rules.length; i++) {
416
+ var rule = rules[i];
417
+ if (filterValue(rule, node, options)) return rule
418
+ }
419
+ return void 0
420
+ }
421
+
422
+ function filterValue (rule, node, options) {
423
+ var filter = rule.filter;
424
+ if (typeof filter === 'string') {
425
+ if (filter === node.nodeName.toLowerCase()) return true
426
+ } else if (Array.isArray(filter)) {
427
+ if (filter.indexOf(node.nodeName.toLowerCase()) > -1) return true
428
+ } else if (typeof filter === 'function') {
429
+ if (filter.call(rule, node, options)) return true
430
+ } else {
431
+ throw new TypeError('`filter` needs to be a string, array, or function')
432
+ }
433
+ }
434
+
435
+ /**
436
+ * The collapseWhitespace function is adapted from collapse-whitespace
437
+ * by Luc Thevenard.
438
+ *
439
+ * The MIT License (MIT)
440
+ *
441
+ * Copyright (c) 2014 Luc Thevenard <lucthevenard@gmail.com>
442
+ *
443
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
444
+ * of this software and associated documentation files (the "Software"), to deal
445
+ * in the Software without restriction, including without limitation the rights
446
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
447
+ * copies of the Software, and to permit persons to whom the Software is
448
+ * furnished to do so, subject to the following conditions:
449
+ *
450
+ * The above copyright notice and this permission notice shall be included in
451
+ * all copies or substantial portions of the Software.
452
+ *
453
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
454
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
455
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
456
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
457
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
458
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
459
+ * THE SOFTWARE.
460
+ */
461
+
462
+ /**
463
+ * collapseWhitespace(options) removes extraneous whitespace from an the given element.
464
+ *
465
+ * @param {Object} options
466
+ */
467
+ function collapseWhitespace (options) {
468
+ var element = options.element;
469
+ var isBlock = options.isBlock;
470
+ var isVoid = options.isVoid;
471
+ var isPre = options.isPre || function (node) {
472
+ return node.nodeName === 'PRE'
473
+ };
474
+
475
+ if (!element.firstChild || isPre(element)) return
476
+
477
+ var prevText = null;
478
+ var keepLeadingWs = false;
479
+
480
+ var prev = null;
481
+ var node = next(prev, element, isPre);
482
+
483
+ while (node !== element) {
484
+ if (node.nodeType === 3 || node.nodeType === 4) { // Node.TEXT_NODE or Node.CDATA_SECTION_NODE
485
+ var text = node.data.replace(/[ \r\n\t]+/g, ' ');
486
+
487
+ if ((!prevText || / $/.test(prevText.data)) &&
488
+ !keepLeadingWs && text[0] === ' ') {
489
+ text = text.substr(1);
490
+ }
491
+
492
+ // `text` might be empty at this point.
493
+ if (!text) {
494
+ node = remove(node);
495
+ continue
496
+ }
497
+
498
+ node.data = text;
499
+
500
+ prevText = node;
501
+ } else if (node.nodeType === 1) { // Node.ELEMENT_NODE
502
+ if (isBlock(node) || node.nodeName === 'BR') {
503
+ if (prevText) {
504
+ prevText.data = prevText.data.replace(/ $/, '');
505
+ }
506
+
507
+ prevText = null;
508
+ keepLeadingWs = false;
509
+ } else if (isVoid(node) || isPre(node)) {
510
+ // Avoid trimming space around non-block, non-BR void elements and inline PRE.
511
+ prevText = null;
512
+ keepLeadingWs = true;
513
+ } else if (prevText) {
514
+ // Drop protection if set previously.
515
+ keepLeadingWs = false;
516
+ }
517
+ } else {
518
+ node = remove(node);
519
+ continue
520
+ }
521
+
522
+ var nextNode = next(prev, node, isPre);
523
+ prev = node;
524
+ node = nextNode;
525
+ }
526
+
527
+ if (prevText) {
528
+ prevText.data = prevText.data.replace(/ $/, '');
529
+ if (!prevText.data) {
530
+ remove(prevText);
531
+ }
532
+ }
533
+ }
534
+
535
+ /**
536
+ * remove(node) removes the given node from the DOM and returns the
537
+ * next node in the sequence.
538
+ *
539
+ * @param {Node} node
540
+ * @return {Node} node
541
+ */
542
+ function remove (node) {
543
+ var next = node.nextSibling || node.parentNode;
544
+
545
+ node.parentNode.removeChild(node);
546
+
547
+ return next
548
+ }
549
+
550
+ /**
551
+ * next(prev, current, isPre) returns the next node in the sequence, given the
552
+ * current and previous nodes.
553
+ *
554
+ * @param {Node} prev
555
+ * @param {Node} current
556
+ * @param {Function} isPre
557
+ * @return {Node}
558
+ */
559
+ function next (prev, current, isPre) {
560
+ if ((prev && prev.parentNode === current) || isPre(current)) {
561
+ return current.nextSibling || current.parentNode
562
+ }
563
+
564
+ return current.firstChild || current.nextSibling || current.parentNode
565
+ }
566
+
567
+ /*
568
+ * Set up window for Node.js
569
+ */
570
+
571
+ var root = (typeof window !== 'undefined' ? window : {});
572
+
573
+ /*
574
+ * Parsing HTML strings
575
+ */
576
+
577
+ function canParseHTMLNatively () {
578
+ var Parser = root.DOMParser;
579
+ var canParse = false;
580
+
581
+ // Adapted from https://gist.github.com/1129031
582
+ // Firefox/Opera/IE throw errors on unsupported types
583
+ try {
584
+ // WebKit returns null on unsupported types
585
+ if (new Parser().parseFromString('', 'text/html')) {
586
+ canParse = true;
587
+ }
588
+ } catch (e) {}
589
+
590
+ return canParse
591
+ }
592
+
593
+ function createHTMLParser () {
594
+ var Parser = function () {};
595
+
596
+ {
597
+ if (shouldUseActiveX()) {
598
+ Parser.prototype.parseFromString = function (string) {
599
+ var doc = new window.ActiveXObject('htmlfile');
600
+ doc.designMode = 'on'; // disable on-page scripts
601
+ doc.open();
602
+ doc.write(string);
603
+ doc.close();
604
+ return doc
605
+ };
606
+ } else {
607
+ Parser.prototype.parseFromString = function (string) {
608
+ var doc = document.implementation.createHTMLDocument('');
609
+ doc.open();
610
+ doc.write(string);
611
+ doc.close();
612
+ return doc
613
+ };
614
+ }
615
+ }
616
+ return Parser
617
+ }
618
+
619
+ function shouldUseActiveX () {
620
+ var useActiveX = false;
621
+ try {
622
+ document.implementation.createHTMLDocument('').open();
623
+ } catch (e) {
624
+ if (root.ActiveXObject) useActiveX = true;
625
+ }
626
+ return useActiveX
627
+ }
628
+
629
+ var HTMLParser = canParseHTMLNatively() ? root.DOMParser : createHTMLParser();
630
+
631
+ function RootNode (input, options) {
632
+ var root;
633
+ if (typeof input === 'string') {
634
+ var doc = htmlParser().parseFromString(
635
+ // DOM parsers arrange elements in the <head> and <body>.
636
+ // Wrapping in a custom element ensures elements are reliably arranged in
637
+ // a single element.
638
+ '<x-turndown id="turndown-root">' + input + '</x-turndown>',
639
+ 'text/html'
640
+ );
641
+ root = doc.getElementById('turndown-root');
642
+ } else {
643
+ root = input.cloneNode(true);
644
+ }
645
+ collapseWhitespace({
646
+ element: root,
647
+ isBlock: isBlock,
648
+ isVoid: isVoid,
649
+ isPre: options.preformattedCode ? isPreOrCode : null
650
+ });
651
+
652
+ return root
653
+ }
654
+
655
+ var _htmlParser;
656
+ function htmlParser () {
657
+ _htmlParser = _htmlParser || new HTMLParser();
658
+ return _htmlParser
659
+ }
660
+
661
+ function isPreOrCode (node) {
662
+ return node.nodeName === 'PRE' || node.nodeName === 'CODE'
663
+ }
664
+
665
+ function Node (node, options) {
666
+ node.isBlock = isBlock(node);
667
+ node.isCode = node.nodeName === 'CODE' || node.parentNode.isCode;
668
+ node.isBlank = isBlank(node);
669
+ node.flankingWhitespace = flankingWhitespace(node, options);
670
+ return node
671
+ }
672
+
673
+ function isBlank (node) {
674
+ return (
675
+ !isVoid(node) &&
676
+ !isMeaningfulWhenBlank(node) &&
677
+ /^\s*$/i.test(node.textContent) &&
678
+ !hasVoid(node) &&
679
+ !hasMeaningfulWhenBlank(node)
680
+ )
681
+ }
682
+
683
+ function flankingWhitespace (node, options) {
684
+ if (node.isBlock || (options.preformattedCode && node.isCode)) {
685
+ return { leading: '', trailing: '' }
686
+ }
687
+
688
+ var edges = edgeWhitespace(node.textContent);
689
+
690
+ // abandon leading ASCII WS if left-flanked by ASCII WS
691
+ if (edges.leadingAscii && isFlankedByWhitespace('left', node, options)) {
692
+ edges.leading = edges.leadingNonAscii;
693
+ }
694
+
695
+ // abandon trailing ASCII WS if right-flanked by ASCII WS
696
+ if (edges.trailingAscii && isFlankedByWhitespace('right', node, options)) {
697
+ edges.trailing = edges.trailingNonAscii;
698
+ }
699
+
700
+ return { leading: edges.leading, trailing: edges.trailing }
701
+ }
702
+
703
+ function edgeWhitespace (string) {
704
+ var m = string.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
705
+ return {
706
+ leading: m[1], // whole string for whitespace-only strings
707
+ leadingAscii: m[2],
708
+ leadingNonAscii: m[3],
709
+ trailing: m[4], // empty for whitespace-only strings
710
+ trailingNonAscii: m[5],
711
+ trailingAscii: m[6]
712
+ }
713
+ }
714
+
715
+ function isFlankedByWhitespace (side, node, options) {
716
+ var sibling;
717
+ var regExp;
718
+ var isFlanked;
719
+
720
+ if (side === 'left') {
721
+ sibling = node.previousSibling;
722
+ regExp = / $/;
723
+ } else {
724
+ sibling = node.nextSibling;
725
+ regExp = /^ /;
726
+ }
727
+
728
+ if (sibling) {
729
+ if (sibling.nodeType === 3) {
730
+ isFlanked = regExp.test(sibling.nodeValue);
731
+ } else if (options.preformattedCode && sibling.nodeName === 'CODE') {
732
+ isFlanked = false;
733
+ } else if (sibling.nodeType === 1 && !isBlock(sibling)) {
734
+ isFlanked = regExp.test(sibling.textContent);
735
+ }
736
+ }
737
+ return isFlanked
738
+ }
739
+
740
+ var reduce = Array.prototype.reduce;
741
+ var escapes = [
742
+ [/\\/g, '\\\\'],
743
+ [/\*/g, '\\*'],
744
+ [/^-/g, '\\-'],
745
+ [/^\+ /g, '\\+ '],
746
+ [/^(=+)/g, '\\$1'],
747
+ [/^(#{1,6}) /g, '\\$1 '],
748
+ [/`/g, '\\`'],
749
+ [/^~~~/g, '\\~~~'],
750
+ [/\[/g, '\\['],
751
+ [/\]/g, '\\]'],
752
+ [/^>/g, '\\>'],
753
+ [/_/g, '\\_'],
754
+ [/^(\d+)\. /g, '$1\\. ']
755
+ ];
756
+
757
+ function TurndownService (options) {
758
+ if (!(this instanceof TurndownService)) return new TurndownService(options)
759
+
760
+ var defaults = {
761
+ rules: rules,
762
+ headingStyle: 'setext',
763
+ hr: '* * *',
764
+ bulletListMarker: '*',
765
+ codeBlockStyle: 'indented',
766
+ fence: '```',
767
+ emDelimiter: '_',
768
+ strongDelimiter: '**',
769
+ linkStyle: 'inlined',
770
+ linkReferenceStyle: 'full',
771
+ br: ' ',
772
+ preformattedCode: false,
773
+ blankReplacement: function (content, node) {
774
+ return node.isBlock ? '\n\n' : ''
775
+ },
776
+ keepReplacement: function (content, node) {
777
+ return node.isBlock ? '\n\n' + node.outerHTML + '\n\n' : node.outerHTML
778
+ },
779
+ defaultReplacement: function (content, node) {
780
+ return node.isBlock ? '\n\n' + content + '\n\n' : content
781
+ }
782
+ };
783
+ this.options = extend({}, defaults, options);
784
+ this.rules = new Rules(this.options);
785
+ }
786
+
787
+ TurndownService.prototype = {
788
+ /**
789
+ * The entry point for converting a string or DOM node to Markdown
790
+ * @public
791
+ * @param {String|HTMLElement} input The string or DOM node to convert
792
+ * @returns A Markdown representation of the input
793
+ * @type String
794
+ */
795
+
796
+ turndown: function (input) {
797
+ if (!canConvert(input)) {
798
+ throw new TypeError(
799
+ input + ' is not a string, or an element/document/fragment node.'
800
+ )
801
+ }
802
+
803
+ if (input === '') return ''
804
+
805
+ var output = process.call(this, new RootNode(input, this.options));
806
+ return postProcess.call(this, output)
807
+ },
808
+
809
+ /**
810
+ * Add one or more plugins
811
+ * @public
812
+ * @param {Function|Array} plugin The plugin or array of plugins to add
813
+ * @returns The Turndown instance for chaining
814
+ * @type Object
815
+ */
816
+
817
+ use: function (plugin) {
818
+ if (Array.isArray(plugin)) {
819
+ for (var i = 0; i < plugin.length; i++) this.use(plugin[i]);
820
+ } else if (typeof plugin === 'function') {
821
+ plugin(this);
822
+ } else {
823
+ throw new TypeError('plugin must be a Function or an Array of Functions')
824
+ }
825
+ return this
826
+ },
827
+
828
+ /**
829
+ * Adds a rule
830
+ * @public
831
+ * @param {String} key The unique key of the rule
832
+ * @param {Object} rule The rule
833
+ * @returns The Turndown instance for chaining
834
+ * @type Object
835
+ */
836
+
837
+ addRule: function (key, rule) {
838
+ this.rules.add(key, rule);
839
+ return this
840
+ },
841
+
842
+ /**
843
+ * Keep a node (as HTML) that matches the filter
844
+ * @public
845
+ * @param {String|Array|Function} filter The unique key of the rule
846
+ * @returns The Turndown instance for chaining
847
+ * @type Object
848
+ */
849
+
850
+ keep: function (filter) {
851
+ this.rules.keep(filter);
852
+ return this
853
+ },
854
+
855
+ /**
856
+ * Remove a node that matches the filter
857
+ * @public
858
+ * @param {String|Array|Function} filter The unique key of the rule
859
+ * @returns The Turndown instance for chaining
860
+ * @type Object
861
+ */
862
+
863
+ remove: function (filter) {
864
+ this.rules.remove(filter);
865
+ return this
866
+ },
867
+
868
+ /**
869
+ * Escapes Markdown syntax
870
+ * @public
871
+ * @param {String} string The string to escape
872
+ * @returns A string with Markdown syntax escaped
873
+ * @type String
874
+ */
875
+
876
+ escape: function (string) {
877
+ return escapes.reduce(function (accumulator, escape) {
878
+ return accumulator.replace(escape[0], escape[1])
879
+ }, string)
880
+ }
881
+ };
882
+
883
+ /**
884
+ * Reduces a DOM node down to its Markdown string equivalent
885
+ * @private
886
+ * @param {HTMLElement} parentNode The node to convert
887
+ * @returns A Markdown representation of the node
888
+ * @type String
889
+ */
890
+
891
+ function process (parentNode) {
892
+ var self = this;
893
+ return reduce.call(parentNode.childNodes, function (output, node) {
894
+ node = new Node(node, self.options);
895
+
896
+ var replacement = '';
897
+ if (node.nodeType === 3) {
898
+ replacement = node.isCode ? node.nodeValue : self.escape(node.nodeValue);
899
+ } else if (node.nodeType === 1) {
900
+ replacement = replacementForNode.call(self, node);
901
+ }
902
+
903
+ return join(output, replacement)
904
+ }, '')
905
+ }
906
+
907
+ /**
908
+ * Appends strings as each rule requires and trims the output
909
+ * @private
910
+ * @param {String} output The conversion output
911
+ * @returns A trimmed version of the ouput
912
+ * @type String
913
+ */
914
+
915
+ function postProcess (output) {
916
+ var self = this;
917
+ this.rules.forEach(function (rule) {
918
+ if (typeof rule.append === 'function') {
919
+ output = join(output, rule.append(self.options));
920
+ }
921
+ });
922
+
923
+ return output.replace(/^[\t\r\n]+/, '').replace(/[\t\r\n\s]+$/, '')
924
+ }
925
+
926
+ /**
927
+ * Converts an element node to its Markdown equivalent
928
+ * @private
929
+ * @param {HTMLElement} node The node to convert
930
+ * @returns A Markdown representation of the node
931
+ * @type String
932
+ */
933
+
934
+ function replacementForNode (node) {
935
+ var rule = this.rules.forNode(node);
936
+ var content = process.call(this, node);
937
+ var whitespace = node.flankingWhitespace;
938
+ if (whitespace.leading || whitespace.trailing) content = content.trim();
939
+ return (
940
+ whitespace.leading +
941
+ rule.replacement(content, node, this.options) +
942
+ whitespace.trailing
943
+ )
944
+ }
945
+
946
+ /**
947
+ * Joins replacement to the current output with appropriate number of new lines
948
+ * @private
949
+ * @param {String} output The current conversion output
950
+ * @param {String} replacement The string to append to the output
951
+ * @returns Joined output
952
+ * @type String
953
+ */
954
+
955
+ function join (output, replacement) {
956
+ var s1 = trimTrailingNewlines(output);
957
+ var s2 = trimLeadingNewlines(replacement);
958
+ var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
959
+ var separator = '\n\n'.substring(0, nls);
960
+
961
+ return s1 + separator + s2
962
+ }
963
+
964
+ /**
965
+ * Determines whether an input can be converted
966
+ * @private
967
+ * @param {String|HTMLElement} input Describe this parameter
968
+ * @returns Describe what it returns
969
+ * @type String|Object|Array|Boolean|Number
970
+ */
971
+
972
+ function canConvert (input) {
973
+ return (
974
+ input != null && (
975
+ typeof input === 'string' ||
976
+ (input.nodeType && (
977
+ input.nodeType === 1 || input.nodeType === 9 || input.nodeType === 11
978
+ ))
979
+ )
980
+ )
981
+ }
982
+
983
+ const turndownService = new TurndownService();
984
+ /**
985
+ * Converts an HTML string to Markdown format, strips unnecessary Markdown tags,
986
+ * and returns an array of cleaned Markdown text blocks..
987
+ *
988
+ * This utility function is useful for transforming HTML into Markdown and cleaning
989
+ * it by removing extra or unwanted Markdown elements, resulting in an array of
990
+ * plain Markdown text segments.
991
+ *
992
+ * @param {string} htmlString - The input HTML string to be converted and cleaned.
993
+ *
994
+ * @example
995
+ * const htmlInput = "<h1>Hello World</h1><p>This is a paragraph.</p>";
996
+ * const result = cleanHtmlMarkdown(htmlInput);
997
+ * console.log(result); // Outputs cleaned HTML after conversion and processing
998
+ */
999
+ const cleanHtmlMarkdown = (htmlString) => {
1000
+ const mdString = turndownService.turndown(htmlString);
1001
+ const sanitizedMdString =
1002
+ // remove header tags
1003
+ mdString.replace(/^\#+\s+/gm, '').trim();
1004
+ if (!sanitizedMdString) {
1005
+ return [];
1006
+ }
1007
+ const mdBlocks = sanitizedMdString.split(/[\n\r]+/gm);
1008
+ return mdBlocks;
1009
+ };
1010
+
15
1011
  const zonosCartItemsCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--cart-table{width:100%;border:none;border-collapse:collapse;overflow:auto;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column{padding:8px;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column:last-child{text-align:right}:host .zonos--cart-table .zonos--column:first-child{width:60px}:host .zonos--cart-table td{vertical-align:top}:host .zonos--cart-item-name{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:12px}:host .zonos--cart-item-name .zonos--cart-item-quantity>*{display:inline-block}:host .zonos--cart-item-price zonos-text{white-space:nowrap}:host img{min-width:40px;margin-top:6px}";
16
1012
  const ZonosCartItemsStyle0 = zonosCartItemsCss;
17
1013
 
@@ -25,15 +1021,14 @@ const ZonosCartItems = class {
25
1021
  const emptyItemImg = getAssetPath('./assets/empty-item.jpeg');
26
1022
  const rate = ((_a = cartStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.rate) || 1;
27
1023
  const nonRestrictedItems = cartStore.items.filter(item => !item.isRestricted);
28
- return (h(Host, { key: '7bdf8d1972edb2d11669441b3d8ec6643fca1f4b', class: "zonos--cart-items zonos--elements" }, h("table", { key: '1c2fe6d444ea93e40b981a8935d16192bf61928c', class: "zonos--cart-table" }, h("tbody", { key: '84279bea6821077bf117a7a13ca497155276c622' }, nonRestrictedItems.map(item => {
1024
+ return (h(Host, { key: '5bb1ea08c13ffd9521ed1ef3934a0e02bdce3317', class: "zonos--cart-items zonos--elements" }, h("table", { key: '54c1dcf71a22e9fa1108350c272ee5267832f2e3', class: "zonos--cart-table" }, h("tbody", { key: 'f1c426a5cf7db0b4198a25bfb9cb99a2d67908ab' }, nonRestrictedItems.map(item => {
29
1025
  const itemImg = item.imageUrl;
30
- // Split the name by <br> tag
31
- const namesWithNewLine = item.name.split(/<br\s*\/*>/);
1026
+ const cleanedItemNames = cleanHtmlMarkdown(item.name);
32
1027
  return (h("tr", { class: "zonos--cart-item" }, h("td", { class: "zonos--column zonos--cart-item-image" }, itemImg && !this.errorImages.includes(itemImg) ? (h("img", { alt: item.name, onError: () => {
33
1028
  this.errorImages = [...this.errorImages, itemImg];
34
1029
  }, src: item.imageUrl, style: {
35
1030
  'min-width': '40px',
36
- }, width: 40 })) : (h("img", { alt: item.name, src: emptyItemImg, width: 40 }))), h("td", { class: "zonos--column zonos--cart-item-name" }, h("div", null, namesWithNewLine.map(name => (h("zonos-text", { type: "label" }, name)))), h("zonos-text", { textColor: "gray-600", type: "caption" }, translate('Quantity'), ": ", item.quantity)), h("td", { class: "zonos--column zonos--cart-item-price" }, h("zonos-text", { type: "semiBoldLabel", weight: 600 }, currencyFormat({
1031
+ }, width: 40 })) : (h("img", { alt: item.name, src: emptyItemImg, width: 40 }))), h("td", { class: "zonos--column zonos--cart-item-name" }, h("div", null, cleanedItemNames.map(name => (h("zonos-text", { type: "label" }, name)))), h("zonos-text", { textColor: "gray-600", type: "caption" }, translate('Quantity'), ": ", item.quantity)), h("td", { class: "zonos--column zonos--cart-item-price" }, h("zonos-text", { type: "semiBoldLabel", weight: 600 }, currencyFormat({
37
1032
  amount: item.amount * rate * item.quantity,
38
1033
  currency: cartStore.currency,
39
1034
  })))));
@@ -289,13 +1284,29 @@ const ZonosCheckoutFinish = class {
289
1284
  };
290
1285
  // TODO: This method of pulling orders is temporary. Once we have a working event registry system, we will rely on that to tell us when the order is ready to trigger onOrderSuccess
291
1286
  this.getPullOrder = async (attempts = 0) => {
1287
+ var _a, _b, _c;
292
1288
  const { baseUrl, order } = await this.pullOrder();
293
- if (order) {
1289
+ const legacyOrderNumberExist = !!((_c = (_b = (_a = this.order) === null || _a === void 0 ? void 0 : _a.references) === null || _b === void 0 ? void 0 : _b.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _c === void 0 ? void 0 : _c.value);
1290
+ // legacy customers are still using the old order number so we need to wait for legacy order number to attach to dgs order before redirecting
1291
+ if ((order && attempts >= 5) || legacyOrderNumberExist) {
1292
+ if (!legacyOrderNumberExist) {
1293
+ const checkoutSessionId = cartStore.checkoutSessionId;
1294
+ void sendErrorLog({
1295
+ endpoint: `${baseUrl}/api/zonos-elements/get-order?checkoutSessionId=${checkoutSessionId}&orderId=${order === null || order === void 0 ? void 0 : order.id}`,
1296
+ errors: [`Order found but legacy order number doesn’t exist`],
1297
+ metadata: {
1298
+ checkoutSessionId: cartStore.checkoutSessionId || '',
1299
+ domain: window.location.hostname,
1300
+ orderId: (order === null || order === void 0 ? void 0 : order.id) || '',
1301
+ storeId: zonosStore.storeId,
1302
+ },
1303
+ });
1304
+ }
294
1305
  void trackConversionEvent('checkout_orderCompleted');
295
1306
  this.order = order;
296
1307
  this.handleSuccessBehavior();
297
1308
  }
298
- else if (!order && attempts < 5) {
1309
+ else if ((!order || !legacyOrderNumberExist) && attempts < 5) {
299
1310
  // Wait for 1 second before the next attempt
300
1311
  await new Promise(resolve => setTimeout(resolve, 1000));
301
1312
  await this.getPullOrder(attempts + 1);
@@ -431,11 +1442,11 @@ const ZonosCheckoutFinish = class {
431
1442
  var _a, _b;
432
1443
  const orderId = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.accountOrderNumber) || getGraphQlShortId((_b = this.order) === null || _b === void 0 ? void 0 : _b.id);
433
1444
  const isTestMode = getIsTestMode();
434
- return (h(Host, { key: '9939772d4ce4213978ae6b02b4cd5345d15dbdfd', class: "zonos--checkout-finish zonos--elements", style: {
1445
+ return (h(Host, { key: '3c6c69c59622b7b2731f9bc6eb1cc8a7f3491572', class: "zonos--checkout-finish zonos--elements", style: {
435
1446
  '--border-radius': getBorderRadius({
436
1447
  overrideBorderStyle: this.borderRadius,
437
1448
  }),
438
- } }, this.isLoading && (h("div", { key: '491d4d0ba3dc487d448606009a30a5ce8d3bb86e', class: "loading-wrapper" }, h("zonos-spinner", { key: '3179aeb472d3e70628d3f1e3e2b76ed3d622145d' }))), !this.isLoading && (h("div", { key: '6044c9d1ac7599d9168f944dcf82028669fd1f37', class: "zonos--finish-details" }, h("div", { key: 'd22ec981a73db08e4871c8babe29f9a09a5bc29d', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: 'bfef33fd319456253e07c3ef3f81da1b85414df9', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (h("div", { key: 'f056c93644d1f9defa263f59111874f154293b51', class: "zonos--order-number" }, "Order #", orderId)), h("zonos-text", { key: '69d38c4640943a5cfdcef5ea6951ddec9c7b8a84', textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), h("zonos-button", { key: 'fbb2d1cc0baab99a3312f2077c28cb9d51b4eb44', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cartStore.step === 'finish' && (h("div", { key: '7b63fd838f850ce6a5acf4970fa66657ca05e235', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '85035826e36d52ccf8c77aa6ba6e27173fccdaa6', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: 'd3848fdbdf1380dce49fcbc2b2903d99ce65247d', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
1449
+ } }, this.isLoading && (h("div", { key: '45ce0e608dca725237abc09295656c8b6471d26c', class: "loading-wrapper" }, h("zonos-spinner", { key: 'fd1a193d34ecf41af9bb6eff082c192c6a8d46db' }))), !this.isLoading && (h("div", { key: '64f652a419330967f13b9d01a172fcc52f6dfd5b', class: "zonos--finish-details" }, h("div", { key: '945cb9e55b418de79921c1995604572e6e009459', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: '241bd7034c5ab5e83e4cedd526a181120a743ad0', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (h("div", { key: '959595c1be3f65aa6cd2e00e4398c5bb4df702b6', class: "zonos--order-number" }, "Order #", orderId)), h("zonos-text", { key: 'a23dce69391c3abf49eb512e715af454c971977e', textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), h("zonos-button", { key: 'ce87734e2d46e8a044bc0ded7a6ed6a4a705685d', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cartStore.step === 'finish' && (h("div", { key: 'a46cee8819c83fb76a54dbe049ee2452b7fc150a', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '514fdff77f5aff9f4b9657a0579ab843833af7b0', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: '59630cf7504c1ef9d24854d041b063bbfdc3a1a4', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
439
1450
  }
440
1451
  static get assetsDirs() { return ["assets"]; }
441
1452
  };