@zonos/elements 1.3.166 → 1.3.168

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 (57) hide show
  1. package/dist/cjs/index.cjs.js +7 -7
  2. package/dist/cjs/{paypal-38ab2263.js → paypal-ea1693b0.js} +10 -2
  3. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +25 -3
  4. package/dist/cjs/zonos-checkout.cjs.entry.js +1 -1
  5. package/dist/cjs/zonos-controller.cjs.entry.js +3 -1
  6. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +1 -1
  7. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.js +1 -1
  8. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +24 -2
  9. package/dist/collection/components/common/zonos-banner/zonos-banner.js +1 -1
  10. package/dist/collection/components/common/zonos-notification/zonos-notification.js +1 -1
  11. package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +3 -3
  12. package/dist/collection/components/common/zonos-spinner/zonos-spinner.js +1 -1
  13. package/dist/collection/components/main/zonos-controller.js +3 -1
  14. package/dist/collection/components/store/checkout/paypal.js +8 -0
  15. package/dist/collection/components/utils/api/paypalCreateOrder.js +2 -2
  16. package/dist/collection/types/generated/graphql.internal.types.js +35 -0
  17. package/dist/esm/index.js +7 -7
  18. package/dist/esm/{paypal-7d253663.js → paypal-a4f2a79c.js} +10 -2
  19. package/dist/esm/zonos-cart-items_13.entry.js +25 -3
  20. package/dist/esm/zonos-checkout.entry.js +1 -1
  21. package/dist/esm/zonos-controller.entry.js +3 -1
  22. package/dist/esm/zonos-empty-state-payment_4.entry.js +1 -1
  23. package/dist/esm-es5/index.js +1 -1
  24. package/dist/esm-es5/paypal-a4f2a79c.js +17 -0
  25. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  26. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  27. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  28. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  29. package/dist/scripts/index.d.ts +4 -0
  30. package/dist/scripts/index.js +1 -1
  31. package/dist/scripts/loadZonos.js +1 -1
  32. package/dist/scripts/zonos.js +1 -1
  33. package/dist/types/components/store/checkout/paypal.d.ts +2 -0
  34. package/dist/types/components/utils/api/paypalCreateOrder.d.ts +1 -1
  35. package/dist/types/types/checkout/CheckoutConfig.d.ts +4 -0
  36. package/dist/types/types/checkout/api/Paypal.d.ts +3 -1
  37. package/dist/types/types/generated/graphql.internal.types.d.ts +51 -5
  38. package/dist/types/types/generated/graphql.internal.types.ts +68 -5
  39. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  40. package/dist/zonos-elements/index.esm.js +1 -1
  41. package/dist/zonos-elements/{p-0150bb1e.entry.js → p-0e524fae.entry.js} +1 -1
  42. package/dist/zonos-elements/{p-82a0fcb7.system.entry.js → p-18af4af9.system.entry.js} +1 -1
  43. package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
  44. package/dist/zonos-elements/{p-ff2e5330.system.js → p-5af56bda.system.js} +1 -1
  45. package/dist/zonos-elements/{p-c3ec1618.system.entry.js → p-75b8db34.system.entry.js} +1 -1
  46. package/dist/zonos-elements/p-7f69ad17.system.js +17 -0
  47. package/dist/zonos-elements/{p-20802055.entry.js → p-a7246199.entry.js} +1 -1
  48. package/dist/zonos-elements/{p-d0adc1b5.system.entry.js → p-a9425cb3.system.entry.js} +1 -1
  49. package/dist/zonos-elements/{p-68fd23f8.entry.js → p-af107510.entry.js} +1 -1
  50. package/dist/zonos-elements/p-b21c0d7f.js +17 -0
  51. package/dist/zonos-elements/{p-4508c22b.entry.js → p-bcfb4e10.entry.js} +1 -1
  52. package/dist/zonos-elements/{p-669a7b5d.system.entry.js → p-e427c0d6.system.entry.js} +1 -1
  53. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  54. package/package.json +1 -1
  55. package/dist/esm-es5/paypal-7d253663.js +0 -17
  56. package/dist/zonos-elements/p-4a0d1e3c.system.js +0 -17
  57. package/dist/zonos-elements/p-e97f9606.js +0 -17
@@ -129,7 +129,7 @@ const getZonosQaUrl = () => {
129
129
  return null;
130
130
  }
131
131
  const qaUrl = extractZonosQaUrl(window.location.href);
132
- const cdnUrl = "https://v1.3.166.js.zonos.com";
132
+ const cdnUrl = "https://v1.3.168.js.zonos.com";
133
133
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
134
134
  if (!qaUrl &&
135
135
  (cdnUrl.includes('test.') ||
@@ -313,10 +313,10 @@ const zonosLoadUrl = (() => {
313
313
  }
314
314
  return null;
315
315
  })();
316
- const ZONOS_URL = "https://v1.3.166.js.zonos.com";
317
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.166";
318
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.166";
319
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.166";
316
+ const ZONOS_URL = "https://v1.3.168.js.zonos.com";
317
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.168";
318
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.168";
319
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.168";
320
320
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
321
321
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
322
322
  class Zonos {
@@ -330,7 +330,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
330
330
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
331
331
  Zonos._paypalMockResponse = null;
332
332
  Zonos.isBigCommerce = false;
333
- Zonos.releaseDate = "1741125121075";
333
+ Zonos.releaseDate = "1741638596050";
334
334
  Zonos.isLegacyCheckout = false;
335
335
  Zonos.domain = typeof window !== 'undefined'
336
336
  ? // domain that embeds the iframe
@@ -346,7 +346,7 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
346
346
  Zonos.isNpm = true;
347
347
  Zonos.zonosQaUrl = null;
348
348
  Zonos.zonosQaUrlApi = null;
349
- Zonos.version = `v${"1.3.166"}`;
349
+ Zonos.version = `v${"1.3.168"}`;
350
350
  Zonos.modeAlerted = false;
351
351
  Zonos.cartData = null;
352
352
  Zonos.paypal = null;
@@ -216,9 +216,9 @@ const paypalCaptureOrder = async ({ checkoutSessionId, paypalMockResponse, }) =>
216
216
  return { errors, json };
217
217
  };
218
218
 
219
- const paypalCreateOrder = async ({ checkoutSessionId, }) => {
219
+ const paypalCreateOrder = async ({ checkoutSessionId, intent, }) => {
220
220
  const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/create-paypal-order', {
221
- body: { checkoutSessionId },
221
+ body: { checkoutSessionId, intent },
222
222
  method: 'POST',
223
223
  });
224
224
  return { errors, json };
@@ -247,6 +247,7 @@ const submitGtag = (event) => {
247
247
  };
248
248
 
249
249
  const { reset: paypalStoreReset, state: paypalStore } = zonosStore.createStore(() => ({
250
+ intent: 'capture',
250
251
  orderIdCreated: null,
251
252
  paypalButtons: [],
252
253
  paypalClientId: '',
@@ -254,8 +255,10 @@ const { reset: paypalStoreReset, state: paypalStore } = zonosStore.createStore((
254
255
  }));
255
256
  const paypalStoreCreaterOrder = async ({ checkoutSessionId, }) => {
256
257
  var _a, _b;
258
+ const uppercaseIntent = paypalStore.intent.toUpperCase();
257
259
  const { errors, json } = await paypalCreateOrder({
258
260
  checkoutSessionId,
261
+ intent: uppercaseIntent,
259
262
  });
260
263
  const paypalOrderId = (_a = json === null || json === void 0 ? void 0 : json.paypalOrderCreate) === null || _a === void 0 ? void 0 : _a.paypalOrderId;
261
264
  if (errors.length || !paypalOrderId) {
@@ -415,11 +418,16 @@ const paypalInitScript = async ({ currency }) => {
415
418
  zonosStore.zonosStore.checkoutSettings.mode === 'LIVE'
416
419
  ? 'production'
417
420
  : 'sandbox';
421
+ const hasAuthorizeSettingSet = zonosStore.zonosStore.checkoutSettings.captureDelay &&
422
+ zonosStore.zonosStore.checkoutSettings.captureDelay > 0;
423
+ paypalStore.intent = hasAuthorizeSettingSet ? 'authorize' : 'capture';
424
+ handleFetch.log('==== Paypal order intent', 'info', paypalStore.intent);
418
425
  // send paypal publishable key out to load paypal
419
426
  window.Zonos.paypal = await loadScript({
420
427
  clientId: paypalClientId.token,
421
428
  currency,
422
429
  environment,
430
+ intent: paypalStore.intent,
423
431
  });
424
432
  handleFetch.log('==== Paypal script loaded');
425
433
  };
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-2f90486e.js');
6
6
  const cart = require('./cart-dbeee1e9.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
- const paypal = require('./paypal-38ab2263.js');
8
+ const paypal = require('./paypal-ea1693b0.js');
9
9
  const zonosStore = require('./zonosStore-7975e4b6.js');
10
10
  const handleFetch = require('./handleFetch-3673a0c2.js');
11
11
  const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
@@ -1774,8 +1774,11 @@ const ZonosCheckoutPayment = class {
1774
1774
  * handler for continue button click
1775
1775
  */
1776
1776
  this.continueClickHandler = async ({ currencyCode, }) => {
1777
+ var _a;
1777
1778
  if (!this.handleValidate()) {
1778
1779
  this.showErrorBanner = true;
1780
+ // Attempt to submit the form so the missing input error will be shown in Stripe
1781
+ void ((_a = cart.stripeStore.stripeElements) === null || _a === void 0 ? void 0 : _a.submit());
1779
1782
  setTimeout(() => {
1780
1783
  var _a;
1781
1784
  (_a = this.ele.querySelector('zonos-banner')) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
@@ -1789,8 +1792,27 @@ const ZonosCheckoutPayment = class {
1789
1792
  paypal.submitGtag('zonos-checkout-payment-info');
1790
1793
  this.continueClicked.emit();
1791
1794
  };
1792
- this.copyCardToClipboard = (cardNumber) => {
1793
- void navigator.clipboard.writeText(cardNumber);
1795
+ this.copyCardToClipboard = async (cardNumber) => {
1796
+ try {
1797
+ await navigator.clipboard.writeText(cardNumber);
1798
+ }
1799
+ catch (_a) {
1800
+ // Copy happens in the iframe and it's not allowed to copy to the clipboard
1801
+ const hiddenTextarea = document.createElement('textarea');
1802
+ hiddenTextarea.style.position = 'fixed';
1803
+ hiddenTextarea.style.left = '-1000px';
1804
+ hiddenTextarea.style.top = '-1000px';
1805
+ hiddenTextarea.style.width = '1px';
1806
+ hiddenTextarea.style.height = '1px';
1807
+ hiddenTextarea.value = cardNumber;
1808
+ hiddenTextarea.id = 'zonos-copy-card-number';
1809
+ document.body.appendChild(hiddenTextarea);
1810
+ hiddenTextarea.select();
1811
+ // Have to use deprecated method execCommand because it's the only way to copy to the clipboard in the iframe
1812
+ // eslint-disable-next-line deprecation/deprecation
1813
+ document.execCommand('copy');
1814
+ document.body.removeChild(hiddenTextarea);
1815
+ }
1794
1816
  window.Zonos.showNotification({
1795
1817
  message: cart.translate('Card number copied to clipboard'),
1796
1818
  timeout: 4000,
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
6
  const cart = require('./cart-dbeee1e9.js');
7
- const paypal = require('./paypal-38ab2263.js');
7
+ const paypal = require('./paypal-ea1693b0.js');
8
8
  const zonosStore = require('./zonosStore-7975e4b6.js');
9
9
  const handleFetch = require('./handleFetch-3673a0c2.js');
10
10
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
@@ -300,6 +300,8 @@ const ZonosController = class {
300
300
  ? Object.assign(Object.assign({}, this.config.checkoutSettings), {
301
301
  // Don't allow to override settlement currencies setting. This setting is only configured by Zonos
302
302
  allowedSettlementCurrencies: undefined,
303
+ // Don't allow to override capture delay setting. This setting is only configured by Zonos
304
+ captureDelay: undefined,
303
305
  // Don't allow to override subscription status
304
306
  subscriptionStatus: undefined,
305
307
  // Set success redirect url to store url if it's legacy checkout.
@@ -400,7 +402,7 @@ const ZonosController = class {
400
402
  zonosStore.zonosStore.organizationName = organizationName;
401
403
  }
402
404
  render() {
403
- return index.h(index.Host, { key: '14d142f73eae70c229b638ef298e20c9c7c5713d', class: "zonos--elements" });
405
+ return index.h(index.Host, { key: 'eed6d0d8b034a43bb4bccf5937b8eccc5d5744c9', class: "zonos--elements" });
404
406
  }
405
407
  };
406
408
  ZonosController.style = ZonosControllerStyle0;
@@ -8,7 +8,7 @@ const classes = require('./classes-b7918f56.js');
8
8
  const getBorderRadius = require('./getBorderRadius-d184b623.js');
9
9
  const cart = require('./cart-dbeee1e9.js');
10
10
  const handleFetch = require('./handleFetch-3673a0c2.js');
11
- const paypal = require('./paypal-38ab2263.js');
11
+ const paypal = require('./paypal-ea1693b0.js');
12
12
  require('./isDarkColor-08d92ed7.js');
13
13
 
14
14
  const PaymentEmptyStateDarkIcon = `<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -429,7 +429,7 @@ export class ZonosAddressUpdateDialog {
429
429
  "references": {
430
430
  "SubmitEventData": {
431
431
  "location": "local",
432
- "path": "/home/runner/work/zonos-elements/zonos-elements/src/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.tsx",
432
+ "path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.tsx",
433
433
  "id": "src/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.tsx::SubmitEventData"
434
434
  }
435
435
  }
@@ -25,8 +25,11 @@ export class ZonosCheckoutPayment {
25
25
  * handler for continue button click
26
26
  */
27
27
  this.continueClickHandler = async ({ currencyCode, }) => {
28
+ var _a;
28
29
  if (!this.handleValidate()) {
29
30
  this.showErrorBanner = true;
31
+ // Attempt to submit the form so the missing input error will be shown in Stripe
32
+ void ((_a = stripeStore.stripeElements) === null || _a === void 0 ? void 0 : _a.submit());
30
33
  setTimeout(() => {
31
34
  var _a;
32
35
  (_a = this.ele.querySelector('zonos-banner')) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
@@ -40,8 +43,27 @@ export class ZonosCheckoutPayment {
40
43
  submitGtag('zonos-checkout-payment-info');
41
44
  this.continueClicked.emit();
42
45
  };
43
- this.copyCardToClipboard = (cardNumber) => {
44
- void navigator.clipboard.writeText(cardNumber);
46
+ this.copyCardToClipboard = async (cardNumber) => {
47
+ try {
48
+ await navigator.clipboard.writeText(cardNumber);
49
+ }
50
+ catch (_a) {
51
+ // Copy happens in the iframe and it's not allowed to copy to the clipboard
52
+ const hiddenTextarea = document.createElement('textarea');
53
+ hiddenTextarea.style.position = 'fixed';
54
+ hiddenTextarea.style.left = '-1000px';
55
+ hiddenTextarea.style.top = '-1000px';
56
+ hiddenTextarea.style.width = '1px';
57
+ hiddenTextarea.style.height = '1px';
58
+ hiddenTextarea.value = cardNumber;
59
+ hiddenTextarea.id = 'zonos-copy-card-number';
60
+ document.body.appendChild(hiddenTextarea);
61
+ hiddenTextarea.select();
62
+ // Have to use deprecated method execCommand because it's the only way to copy to the clipboard in the iframe
63
+ // eslint-disable-next-line deprecation/deprecation
64
+ document.execCommand('copy');
65
+ document.body.removeChild(hiddenTextarea);
66
+ }
45
67
  window.Zonos.showNotification({
46
68
  message: translate('Card number copied to clipboard'),
47
69
  timeout: 4000,
@@ -101,7 +101,7 @@ export class ZonosBanner {
101
101
  "references": {
102
102
  "BannerIntent": {
103
103
  "location": "local",
104
- "path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-banner/zonos-banner.tsx",
104
+ "path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/common/zonos-banner/zonos-banner.tsx",
105
105
  "id": "src/components/common/zonos-banner/zonos-banner.tsx::BannerIntent"
106
106
  }
107
107
  }
@@ -93,7 +93,7 @@ export class ZonosNotification {
93
93
  },
94
94
  "NotificationInit": {
95
95
  "location": "local",
96
- "path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-notification/zonos-notification.tsx",
96
+ "path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/common/zonos-notification/zonos-notification.tsx",
97
97
  "id": "src/components/common/zonos-notification/zonos-notification.tsx::NotificationInit"
98
98
  },
99
99
  "NotificationItem": {
@@ -61,7 +61,7 @@ export class ZonosShippingRichRadio {
61
61
  "references": {
62
62
  "ShippingRichRadioItem": {
63
63
  "location": "local",
64
- "path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
64
+ "path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
65
65
  "id": "src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx::ShippingRichRadioItem"
66
66
  }
67
67
  }
@@ -159,7 +159,7 @@ export class ZonosShippingRichRadio {
159
159
  "references": {
160
160
  "ShippingRichRadioItem": {
161
161
  "location": "local",
162
- "path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
162
+ "path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
163
163
  "id": "src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx::ShippingRichRadioItem"
164
164
  }
165
165
  }
@@ -196,7 +196,7 @@ export class ZonosShippingRichRadio {
196
196
  "references": {
197
197
  "ShippingRichRadioItem": {
198
198
  "location": "local",
199
- "path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
199
+ "path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
200
200
  "id": "src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx::ShippingRichRadioItem"
201
201
  }
202
202
  }
@@ -59,7 +59,7 @@ export class ZonosSpinner {
59
59
  "references": {
60
60
  "SpinnerColor": {
61
61
  "location": "local",
62
- "path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-spinner/zonos-spinner.tsx",
62
+ "path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/common/zonos-spinner/zonos-spinner.tsx",
63
63
  "id": "src/components/common/zonos-spinner/zonos-spinner.tsx::SpinnerColor"
64
64
  }
65
65
  }
@@ -149,6 +149,8 @@ export class ZonosController {
149
149
  ? Object.assign(Object.assign({}, this.config.checkoutSettings), {
150
150
  // Don't allow to override settlement currencies setting. This setting is only configured by Zonos
151
151
  allowedSettlementCurrencies: undefined,
152
+ // Don't allow to override capture delay setting. This setting is only configured by Zonos
153
+ captureDelay: undefined,
152
154
  // Don't allow to override subscription status
153
155
  subscriptionStatus: undefined,
154
156
  // Set success redirect url to store url if it's legacy checkout.
@@ -249,7 +251,7 @@ export class ZonosController {
249
251
  zonosStore.organizationName = organizationName;
250
252
  }
251
253
  render() {
252
- return h(Host, { key: '14d142f73eae70c229b638ef298e20c9c7c5713d', class: "zonos--elements" });
254
+ return h(Host, { key: 'eed6d0d8b034a43bb4bccf5937b8eccc5d5744c9', class: "zonos--elements" });
253
255
  }
254
256
  static get is() { return "zonos-controller"; }
255
257
  static get encapsulation() { return "shadow"; }
@@ -13,6 +13,7 @@ import { logError } from "../../utils/logging/logError";
13
13
  import { submitGtag } from "../../utils/submitGtag";
14
14
  import { validateCheckoutSession } from "../../utils/validateCheckoutSession";
15
15
  const { reset: paypalStoreReset, state: paypalStore } = createStore(() => ({
16
+ intent: 'capture',
16
17
  orderIdCreated: null,
17
18
  paypalButtons: [],
18
19
  paypalClientId: '',
@@ -20,8 +21,10 @@ const { reset: paypalStoreReset, state: paypalStore } = createStore(() => ({
20
21
  }));
21
22
  const paypalStoreCreaterOrder = async ({ checkoutSessionId, }) => {
22
23
  var _a, _b;
24
+ const uppercaseIntent = paypalStore.intent.toUpperCase();
23
25
  const { errors, json } = await paypalCreateOrder({
24
26
  checkoutSessionId,
27
+ intent: uppercaseIntent,
25
28
  });
26
29
  const paypalOrderId = (_a = json === null || json === void 0 ? void 0 : json.paypalOrderCreate) === null || _a === void 0 ? void 0 : _a.paypalOrderId;
27
30
  if (errors.length || !paypalOrderId) {
@@ -181,11 +184,16 @@ const paypalInitScript = async ({ currency }) => {
181
184
  zonosStore.checkoutSettings.mode === 'LIVE'
182
185
  ? 'production'
183
186
  : 'sandbox';
187
+ const hasAuthorizeSettingSet = zonosStore.checkoutSettings.captureDelay &&
188
+ zonosStore.checkoutSettings.captureDelay > 0;
189
+ paypalStore.intent = hasAuthorizeSettingSet ? 'authorize' : 'capture';
190
+ log('==== Paypal order intent', 'info', paypalStore.intent);
184
191
  // send paypal publishable key out to load paypal
185
192
  window.Zonos.paypal = await loadScript({
186
193
  clientId: paypalClientId.token,
187
194
  currency,
188
195
  environment,
196
+ intent: paypalStore.intent,
189
197
  });
190
198
  log('==== Paypal script loaded');
191
199
  };
@@ -1,7 +1,7 @@
1
1
  import { handleFetch } from "../handleFetch";
2
- export const paypalCreateOrder = async ({ checkoutSessionId, }) => {
2
+ export const paypalCreateOrder = async ({ checkoutSessionId, intent, }) => {
3
3
  const { errors, json } = await handleFetch('/api/zonos-elements/create-paypal-order', {
4
- body: { checkoutSessionId },
4
+ body: { checkoutSessionId, intent },
5
5
  method: 'POST',
6
6
  });
7
7
  return { errors, json };
@@ -281,6 +281,12 @@ export const cartAdjustmentType = {
281
281
  PromoCode: 'PROMO_CODE',
282
282
  Shipping: 'SHIPPING',
283
283
  };
284
+ export const cashFlowTablesEnumInput = {
285
+ Bill: 'BILL',
286
+ Deposit: 'DEPOSIT',
287
+ Invoice: 'INVOICE',
288
+ Payout: 'PAYOUT',
289
+ };
284
290
  export const catalogItemExportJobAction = {
285
291
  Email: 'EMAIL',
286
292
  None: 'NONE',
@@ -313,6 +319,10 @@ export const checkoutMerchantOfRecordType = {
313
319
  Merchant: 'MERCHANT',
314
320
  Zonos: 'ZONOS',
315
321
  };
322
+ export const checkoutPaypalOrderIntent = {
323
+ Authorize: 'AUTHORIZE',
324
+ Capture: 'CAPTURE',
325
+ };
316
326
  export const checkoutSessionCreationModeType = {
317
327
  WithPaymentIntent: 'WITH_PAYMENT_INTENT',
318
328
  WithoutPaymentIntent: 'WITHOUT_PAYMENT_INTENT',
@@ -1275,16 +1285,30 @@ export const endOfDayBehavior = {
1275
1285
  };
1276
1286
  export const entityType = {
1277
1287
  AppearanceSetting: 'APPEARANCE_SETTING',
1288
+ Carrier: 'CARRIER',
1278
1289
  CarrierAccount: 'CARRIER_ACCOUNT',
1279
1290
  CheckoutSetting: 'CHECKOUT_SETTING',
1291
+ CountryStateTaxRate: 'COUNTRY_STATE_TAX_RATE',
1292
+ Deminimis: 'DEMINIMIS',
1280
1293
  ExternalFulfillmentSetting: 'EXTERNAL_FULFILLMENT_SETTING',
1294
+ Fee: 'FEE',
1295
+ FeeRule: 'FEE_RULE',
1281
1296
  FulfillmentCenter: 'FULFILLMENT_CENTER',
1297
+ HsCode: 'HS_CODE',
1282
1298
  ItemSetting: 'ITEM_SETTING',
1299
+ LandedCostCarrier: 'LANDED_COST_CARRIER',
1300
+ LandedCostServiceLevel: 'LANDED_COST_SERVICE_LEVEL',
1301
+ LandedCostServiceLevelCountry: 'LANDED_COST_SERVICE_LEVEL_COUNTRY',
1283
1302
  LandedCostSetting: 'LANDED_COST_SETTING',
1303
+ Levy: 'LEVY',
1284
1304
  RateChart: 'RATE_CHART',
1285
1305
  Rule: 'RULE',
1306
+ ServiceLevel: 'SERVICE_LEVEL',
1307
+ ServiceLevelCountry: 'SERVICE_LEVEL_COUNTRY',
1286
1308
  ShippingProfile: 'SHIPPING_PROFILE',
1287
1309
  ShippingZone: 'SHIPPING_ZONE',
1310
+ StateSalesTax: 'STATE_SALES_TAX',
1311
+ StoreFeeRule: 'STORE_FEE_RULE',
1288
1312
  Unknown: 'UNKNOWN',
1289
1313
  };
1290
1314
  export const errorDetail = {
@@ -1988,6 +2012,10 @@ export const orderCompleteBillingMethod = {
1988
2012
  BillingDgs: 'BILLING_DGS',
1989
2013
  Legacy: 'LEGACY',
1990
2014
  };
2015
+ export const orderMerchantOfRecordType = {
2016
+ Merchant: 'MERCHANT',
2017
+ Zonos: 'ZONOS',
2018
+ };
1991
2019
  export const orderNoteType = {
1992
2020
  Comment: 'COMMENT',
1993
2021
  NotificationSent: 'NOTIFICATION_SENT',
@@ -2114,6 +2142,10 @@ export const paypalMockResponse = {
2114
2142
  InternalServerError: 'INTERNAL_SERVER_ERROR',
2115
2143
  TransactionRefused: 'TRANSACTION_REFUSED',
2116
2144
  };
2145
+ export const paypalOrderIntent = {
2146
+ Authorize: 'AUTHORIZE',
2147
+ Capture: 'CAPTURE',
2148
+ };
2117
2149
  export const paypalOrderStatus = {
2118
2150
  Approved: 'APPROVED',
2119
2151
  Completed: 'COMPLETED',
@@ -2705,6 +2737,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
2705
2737
  partyInfo(variables, requestHeaders) {
2706
2738
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'partyInfo', 'query');
2707
2739
  },
2740
+ paypalOrder(variables, requestHeaders) {
2741
+ return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'paypalOrder', 'query');
2742
+ },
2708
2743
  paypalOrderCapture(variables, requestHeaders) {
2709
2744
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'paypalOrderCapture', 'mutation');
2710
2745
  },
package/dist/esm/index.js CHANGED
@@ -126,7 +126,7 @@ const getZonosQaUrl = () => {
126
126
  return null;
127
127
  }
128
128
  const qaUrl = extractZonosQaUrl(window.location.href);
129
- const cdnUrl = "https://v1.3.166.js.zonos.com";
129
+ const cdnUrl = "https://v1.3.168.js.zonos.com";
130
130
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
131
131
  if (!qaUrl &&
132
132
  (cdnUrl.includes('test.') ||
@@ -310,10 +310,10 @@ const zonosLoadUrl = (() => {
310
310
  }
311
311
  return null;
312
312
  })();
313
- const ZONOS_URL = "https://v1.3.166.js.zonos.com";
314
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.166";
315
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.166";
316
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.166";
313
+ const ZONOS_URL = "https://v1.3.168.js.zonos.com";
314
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.168";
315
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.168";
316
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.168";
317
317
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
318
318
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
319
319
  class Zonos {
@@ -327,7 +327,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
327
327
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
328
328
  Zonos._paypalMockResponse = null;
329
329
  Zonos.isBigCommerce = false;
330
- Zonos.releaseDate = "1741125121075";
330
+ Zonos.releaseDate = "1741638596050";
331
331
  Zonos.isLegacyCheckout = false;
332
332
  Zonos.domain = typeof window !== 'undefined'
333
333
  ? // domain that embeds the iframe
@@ -343,7 +343,7 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
343
343
  Zonos.isNpm = true;
344
344
  Zonos.zonosQaUrl = null;
345
345
  Zonos.zonosQaUrlApi = null;
346
- Zonos.version = `v${"1.3.166"}`;
346
+ Zonos.version = `v${"1.3.168"}`;
347
347
  Zonos.modeAlerted = false;
348
348
  Zonos.cartData = null;
349
349
  Zonos.paypal = null;
@@ -214,9 +214,9 @@ const paypalCaptureOrder = async ({ checkoutSessionId, paypalMockResponse, }) =>
214
214
  return { errors, json };
215
215
  };
216
216
 
217
- const paypalCreateOrder = async ({ checkoutSessionId, }) => {
217
+ const paypalCreateOrder = async ({ checkoutSessionId, intent, }) => {
218
218
  const { errors, json } = await handleFetch('/api/zonos-elements/create-paypal-order', {
219
- body: { checkoutSessionId },
219
+ body: { checkoutSessionId, intent },
220
220
  method: 'POST',
221
221
  });
222
222
  return { errors, json };
@@ -245,6 +245,7 @@ const submitGtag = (event) => {
245
245
  };
246
246
 
247
247
  const { reset: paypalStoreReset, state: paypalStore } = createStore(() => ({
248
+ intent: 'capture',
248
249
  orderIdCreated: null,
249
250
  paypalButtons: [],
250
251
  paypalClientId: '',
@@ -252,8 +253,10 @@ const { reset: paypalStoreReset, state: paypalStore } = createStore(() => ({
252
253
  }));
253
254
  const paypalStoreCreaterOrder = async ({ checkoutSessionId, }) => {
254
255
  var _a, _b;
256
+ const uppercaseIntent = paypalStore.intent.toUpperCase();
255
257
  const { errors, json } = await paypalCreateOrder({
256
258
  checkoutSessionId,
259
+ intent: uppercaseIntent,
257
260
  });
258
261
  const paypalOrderId = (_a = json === null || json === void 0 ? void 0 : json.paypalOrderCreate) === null || _a === void 0 ? void 0 : _a.paypalOrderId;
259
262
  if (errors.length || !paypalOrderId) {
@@ -413,11 +416,16 @@ const paypalInitScript = async ({ currency }) => {
413
416
  zonosStore.checkoutSettings.mode === 'LIVE'
414
417
  ? 'production'
415
418
  : 'sandbox';
419
+ const hasAuthorizeSettingSet = zonosStore.checkoutSettings.captureDelay &&
420
+ zonosStore.checkoutSettings.captureDelay > 0;
421
+ paypalStore.intent = hasAuthorizeSettingSet ? 'authorize' : 'capture';
422
+ log('==== Paypal order intent', 'info', paypalStore.intent);
416
423
  // send paypal publishable key out to load paypal
417
424
  window.Zonos.paypal = await loadScript({
418
425
  clientId: paypalClientId.token,
419
426
  currency,
420
427
  environment,
428
+ intent: paypalStore.intent,
421
429
  });
422
430
  log('==== Paypal script loaded');
423
431
  };
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, a as getAssetPath, h, H as Host, F as Fragment, c as createEvent, d as getElement } from './index-d82f06f2.js';
2
2
  import { e as cartStore, E as currencyFormat, r as translate, M as cartStoreHasOneEligibleItem, N as stripeStoreApplyPromoCode, O as stripeStoreRemovePromoCode, f as stripeStore, C as stripeStoreReset, d as stripeStoreRetrievePayment, t as trackConversionEvent, P as stripeStoreResetPromoCode, Q as stripeStoreMessageBasedOnStatus, l as localizationStore, x as cartStoreNextStep, R as stripeStoreTranslateAddressToLatin, S as cartStoreUpdateSelectedShippingOption, T as cartStoreGetShippingTransitInfo, U as sortServiceLevelOptionsByAmount } from './cart-f2f5f13f.js';
3
3
  import { c as classes } from './classes-0d95c529.js';
4
- import { s as submitGtag, c as paypalStoreReset, b as paypalStore, i as isContrastColor } from './paypal-7d253663.js';
4
+ import { s as submitGtag, c as paypalStoreReset, b as paypalStore, i as isContrastColor } from './paypal-a4f2a79c.js';
5
5
  import { z as zonosStore, g as getZonosStoreTheme, d as zonosStoreFontFamily } from './zonosStore-71d7e02f.js';
6
6
  import { h as handleFetch, l as log, s as sendErrorLog, j as jsonParse, g as getIsTestMode, d as allLogs, b as logError, a as getIsStagingMode } from './handleFetch-b4633675.js';
7
7
  import { c as createCustomEvent } from './createCustomEvent-58159025.js';
@@ -1770,8 +1770,11 @@ const ZonosCheckoutPayment = class {
1770
1770
  * handler for continue button click
1771
1771
  */
1772
1772
  this.continueClickHandler = async ({ currencyCode, }) => {
1773
+ var _a;
1773
1774
  if (!this.handleValidate()) {
1774
1775
  this.showErrorBanner = true;
1776
+ // Attempt to submit the form so the missing input error will be shown in Stripe
1777
+ void ((_a = stripeStore.stripeElements) === null || _a === void 0 ? void 0 : _a.submit());
1775
1778
  setTimeout(() => {
1776
1779
  var _a;
1777
1780
  (_a = this.ele.querySelector('zonos-banner')) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
@@ -1785,8 +1788,27 @@ const ZonosCheckoutPayment = class {
1785
1788
  submitGtag('zonos-checkout-payment-info');
1786
1789
  this.continueClicked.emit();
1787
1790
  };
1788
- this.copyCardToClipboard = (cardNumber) => {
1789
- void navigator.clipboard.writeText(cardNumber);
1791
+ this.copyCardToClipboard = async (cardNumber) => {
1792
+ try {
1793
+ await navigator.clipboard.writeText(cardNumber);
1794
+ }
1795
+ catch (_a) {
1796
+ // Copy happens in the iframe and it's not allowed to copy to the clipboard
1797
+ const hiddenTextarea = document.createElement('textarea');
1798
+ hiddenTextarea.style.position = 'fixed';
1799
+ hiddenTextarea.style.left = '-1000px';
1800
+ hiddenTextarea.style.top = '-1000px';
1801
+ hiddenTextarea.style.width = '1px';
1802
+ hiddenTextarea.style.height = '1px';
1803
+ hiddenTextarea.value = cardNumber;
1804
+ hiddenTextarea.id = 'zonos-copy-card-number';
1805
+ document.body.appendChild(hiddenTextarea);
1806
+ hiddenTextarea.select();
1807
+ // Have to use deprecated method execCommand because it's the only way to copy to the clipboard in the iframe
1808
+ // eslint-disable-next-line deprecation/deprecation
1809
+ document.execCommand('copy');
1810
+ document.body.removeChild(hiddenTextarea);
1811
+ }
1790
1812
  window.Zonos.showNotification({
1791
1813
  message: translate('Card number copied to clipboard'),
1792
1814
  timeout: 4000,
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, h, H as Host, F as Fragment } from './index-d82f06f2.js';
2
2
  import { l as localizationStore, s as stripeStoreGetDomesticShippingSession, a as localizationStoreUpdateSelectedCountryCode, b as stripeStoreCleanupDomesticShippingSession, c as stripeStoreSaveDomesticShippingSession, i as initStripeElements, d as stripeStoreRetrievePayment, e as cartStore, f as stripeStore, g as cartStoreUpdateItems, h as cartStoreReset, j as cartStoreResetTabItems, k as cartStoreClearCheckoutInterval, m as stripeStoreInitCheckoutSession, n as stripeStoreGetPaymentIntent, o as cartStoreStartCheckoutInterval, t as trackConversionEvent, p as getCheckoutSessionBody, q as cartStoreUpdateToErrorState, r as translate, u as getZCountryUrlParam, v as cartStoreSetCheckoutSession, w as stripeStorePrefetchLandedCost, x as cartStoreNextStep, y as stripeStoreUpdateCheckoutSessionBaseCurrency, z as stripeStoreHandleInventoryCheck, A as stripeStoreConfirmPayment, B as stripeStoreHandleInventoryRefund, C as stripeStoreReset, D as localizationStoreOnUpdate, E as currencyFormat } from './cart-f2f5f13f.js';
3
- import { p as paypalStoreHasPaypalEnabled, s as submitGtag, a as paypalInitScript, b as paypalStore } from './paypal-7d253663.js';
3
+ import { p as paypalStoreHasPaypalEnabled, s as submitGtag, a as paypalInitScript, b as paypalStore } from './paypal-a4f2a79c.js';
4
4
  import { z as zonosStore, g as getZonosStoreTheme, m as mergeConfig } from './zonosStore-71d7e02f.js';
5
5
  import { h as handleFetch, l as log, b as logError, s as sendErrorLog, c as getElapsedTime, d as allLogs, g as getIsTestMode, j as jsonParse, a as getIsStagingMode } from './handleFetch-b4633675.js';
6
6
  import { i as isCheckoutMobile } from './isCheckoutMobile-8846dccb.js';
@@ -296,6 +296,8 @@ const ZonosController = class {
296
296
  ? Object.assign(Object.assign({}, this.config.checkoutSettings), {
297
297
  // Don't allow to override settlement currencies setting. This setting is only configured by Zonos
298
298
  allowedSettlementCurrencies: undefined,
299
+ // Don't allow to override capture delay setting. This setting is only configured by Zonos
300
+ captureDelay: undefined,
299
301
  // Don't allow to override subscription status
300
302
  subscriptionStatus: undefined,
301
303
  // Set success redirect url to store url if it's legacy checkout.
@@ -396,7 +398,7 @@ const ZonosController = class {
396
398
  zonosStore.organizationName = organizationName;
397
399
  }
398
400
  render() {
399
- return h(Host, { key: '14d142f73eae70c229b638ef298e20c9c7c5713d', class: "zonos--elements" });
401
+ return h(Host, { key: 'eed6d0d8b034a43bb4bccf5937b8eccc5d5744c9', class: "zonos--elements" });
400
402
  }
401
403
  };
402
404
  ZonosController.style = ZonosControllerStyle0;
@@ -4,7 +4,7 @@ import { c as classes } from './classes-0d95c529.js';
4
4
  import { g as getBorderRadius } from './getBorderRadius-740610fb.js';
5
5
  import { f as stripeStore } from './cart-f2f5f13f.js';
6
6
  import { b as logError, l as log } from './handleFetch-b4633675.js';
7
- import { d as paypalStoreInitButtons } from './paypal-7d253663.js';
7
+ import { d as paypalStoreInitButtons } from './paypal-a4f2a79c.js';
8
8
  import './isDarkColor-2f59d721.js';
9
9
 
10
10
  const PaymentEmptyStateDarkIcon = `<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">