@zonos/elements 1.3.292 → 1.4.0
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.
- package/dist/cjs/{collect-Oeo5tjN5.js → collect-DnrvaXUI.js} +24 -4
- package/dist/cjs/index.cjs.js +30 -8
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +1 -1
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +1 -1
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +1 -1
- package/dist/cjs/zonos-collect.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +9 -0
- package/dist/collection/components/utils/checkout/injectDomesticElementHideStyle.js +9 -0
- package/dist/collection/environment.js +7 -2
- package/dist/collection/scripts/_stripe.js +23 -1
- package/dist/collection/utils/formattedCloudflareApiUrl.js +32 -14
- package/dist/collection/utils/generateCloudflareDeployUrl.js +2 -3
- package/dist/collection/utils/generateCloudflareWorkerPreviewUrl.js +51 -0
- package/dist/collection/utils/resolveCloudflareRuntime.js +15 -0
- package/dist/esm/{collect-CdrR5OBy.js → collect-Eo4gtyql.js} +24 -4
- package/dist/esm/index.js +30 -8
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +1 -1
- package/dist/esm/zonos-airwallex-payment.entry.js +1 -1
- package/dist/esm/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm/zonos-collect.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +9 -0
- package/dist/esm-es5/{collect-CdrR5OBy.js → collect-Eo4gtyql.js} +4 -2
- package/dist/esm-es5/index.js +6 -6
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +1 -1
- package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +6 -0
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/utils/formattedCloudflareApiUrl.d.ts +17 -11
- package/dist/types/utils/generateCloudflareDeployUrl.d.ts +2 -3
- package/dist/types/utils/generateCloudflareWorkerPreviewUrl.d.ts +17 -0
- package/dist/types/utils/resolveCloudflareRuntime.d.ts +11 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-e0e9cff5.system.entry.js → p-06030d3b.system.entry.js} +6 -0
- package/dist/zonos-elements/{p-DzLNk-Pf.js → p-0mGRBGcf.js} +1 -1
- package/dist/zonos-elements/{p-552fbde1.system.entry.js → p-155ed3d3.system.entry.js} +6 -6
- package/dist/zonos-elements/{p-04bded81.system.entry.js → p-31043c2e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-938fc1e4.entry.js → p-3a2da031.entry.js} +1 -1
- package/dist/zonos-elements/{p-b2dd7f02.system.entry.js → p-5967a1c1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c5bab786.entry.js → p-725e29bb.entry.js} +1 -1
- package/dist/zonos-elements/{p-c3646ae6.system.entry.js → p-7bd99479.system.entry.js} +3 -3
- package/dist/zonos-elements/{p-y7PFdTUN.system.js → p-BiR2fYOJ.system.js} +52 -52
- package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
- package/dist/zonos-elements/{p-DNc279vN.system.js → p-CZD8WvyY.system.js} +33 -31
- package/dist/zonos-elements/{p-6e296228.entry.js → p-ad9ff14c.entry.js} +1 -1
- package/dist/zonos-elements/p-c9d5d8f1.entry.js +1 -0
- package/dist/zonos-elements/{p-550d4eea.entry.js → p-d8b312e5.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +6 -4
- package/dist/zonos-elements/p-82595838.entry.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DAAr465v.js');
|
|
4
|
-
var collect = require('./collect-
|
|
4
|
+
var collect = require('./collect-DnrvaXUI.js');
|
|
5
5
|
var cart = require('./cart-B6Aty-21.js');
|
|
6
6
|
var localization = require('./localization-BzNeXeDe.js');
|
|
7
7
|
var zonosStore = require('./zonosStore-Bx9jK82G.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DAAr465v.js');
|
|
4
|
-
var collect = require('./collect-
|
|
4
|
+
var collect = require('./collect-DnrvaXUI.js');
|
|
5
5
|
var cart = require('./cart-B6Aty-21.js');
|
|
6
6
|
var paypal = require('./paypal-CuKshRmZ.js');
|
|
7
7
|
var localization = require('./localization-BzNeXeDe.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DAAr465v.js');
|
|
4
|
-
var collect = require('./collect-
|
|
4
|
+
var collect = require('./collect-DnrvaXUI.js');
|
|
5
5
|
var cart = require('./cart-B6Aty-21.js');
|
|
6
6
|
var paypal = require('./paypal-CuKshRmZ.js');
|
|
7
7
|
var localization = require('./localization-BzNeXeDe.js');
|
|
@@ -194,6 +194,15 @@ const injectDomesticElementHideStyle = (domesticElementSelector) => {
|
|
|
194
194
|
merchantSelector: domesticElementSelector,
|
|
195
195
|
supportsIs: supportsIsSelector,
|
|
196
196
|
});
|
|
197
|
+
// A raw `<` is never a valid CSS selector character, and it is the
|
|
198
|
+
// character that would close a `<style>` tag if this string were ever
|
|
199
|
+
// assigned as HTML. Some parsers (current jsdom) do not throw on it, so
|
|
200
|
+
// reject it before `querySelector`. `>` stays allowed: it is the child
|
|
201
|
+
// combinator.
|
|
202
|
+
if (fullSelector.includes('<')) {
|
|
203
|
+
VarianceTest.log(`Skip domesticElementSelector injection: "${domesticElementSelector}" contains "<"`, 'warn');
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
197
206
|
// The browser's own parser is the source of truth — `document.querySelector`
|
|
198
207
|
// throws `DOMException(SyntaxError)` for syntactically invalid selectors.
|
|
199
208
|
// Validating the exact string we're about to emit catches both malformed
|
|
@@ -93,6 +93,15 @@ export const injectDomesticElementHideStyle = (domesticElementSelector) => {
|
|
|
93
93
|
merchantSelector: domesticElementSelector,
|
|
94
94
|
supportsIs: supportsIsSelector,
|
|
95
95
|
});
|
|
96
|
+
// A raw `<` is never a valid CSS selector character, and it is the
|
|
97
|
+
// character that would close a `<style>` tag if this string were ever
|
|
98
|
+
// assigned as HTML. Some parsers (current jsdom) do not throw on it, so
|
|
99
|
+
// reject it before `querySelector`. `>` stays allowed: it is the child
|
|
100
|
+
// combinator.
|
|
101
|
+
if (fullSelector.includes('<')) {
|
|
102
|
+
log(`Skip domesticElementSelector injection: "${domesticElementSelector}" contains "<"`, 'warn');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
96
105
|
// The browser's own parser is the source of truth — `document.querySelector`
|
|
97
106
|
// throws `DOMException(SyntaxError)` for syntactically invalid selectors.
|
|
98
107
|
// Validating the exact string we're about to emit catches both malformed
|
|
@@ -5,7 +5,7 @@ import { config } from "dotenv";
|
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
// rollup and ts somehow can't compile this with absolute path
|
|
7
7
|
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
8
|
-
import { formattedCloudflareApiUrl } from "./utils/formattedCloudflareApiUrl";
|
|
8
|
+
import { formattedCloudflareApiUrl, resolveCloudflareDeployTarget, } from "./utils/formattedCloudflareApiUrl";
|
|
9
9
|
// rollup and ts somehow can't compile this with absolute path
|
|
10
10
|
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
11
11
|
import { formattedUrl } from "./utils/formattedUrl";
|
|
@@ -32,7 +32,8 @@ const UNPKG_ZONOS_URL = `https://unpkg.com/@zonos/elements@${packageVersion}`;
|
|
|
32
32
|
const CDNJS_ZONOS_URL = `https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/${packageVersion}`;
|
|
33
33
|
const currentBranch = process.env.VERCEL_GIT_COMMIT_REF ||
|
|
34
34
|
process.env.BRANCH_NAME ||
|
|
35
|
-
process.env.CF_PAGES_BRANCH
|
|
35
|
+
process.env.CF_PAGES_BRANCH ||
|
|
36
|
+
process.env.WORKERS_CI_BRANCH;
|
|
36
37
|
if (typeof window === 'undefined') {
|
|
37
38
|
// storybook can't access to any "node" modules
|
|
38
39
|
config();
|
|
@@ -98,6 +99,10 @@ export const env = createEnv({
|
|
|
98
99
|
}),
|
|
99
100
|
NEXT_PUBLIC_ZONOS_CLOUDFLARE_URL: formattedCloudflareApiUrl({
|
|
100
101
|
branchName: currentBranch,
|
|
102
|
+
cloudflareTarget: resolveCloudflareDeployTarget({
|
|
103
|
+
buildEnv: process.env.BUILD_ENV,
|
|
104
|
+
cfPages: process.env.CF_PAGES,
|
|
105
|
+
}),
|
|
101
106
|
inCI,
|
|
102
107
|
inGithubAction: inGithubActions,
|
|
103
108
|
inVercel,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
/** Loading stripe script extracted from stripe.js repository */
|
|
3
3
|
import { logError } from "../components/utils/logging/logError";
|
|
4
|
+
const STRIPE_API_VERSION = '2025-02-24.acacia';
|
|
4
5
|
const V3_URL = 'https://js.stripe.com/v3';
|
|
5
6
|
const V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
7
|
+
const V3_VERSION = 3;
|
|
6
8
|
const EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
|
|
7
9
|
export const zonosStripeFindScript = () => {
|
|
8
10
|
const scripts = document.querySelectorAll(`script[src^="${V3_URL}"]`);
|
|
@@ -83,11 +85,31 @@ const registerWrapper = (stripe, startTime) => {
|
|
|
83
85
|
}
|
|
84
86
|
stripe._registerWrapper({ name: 'stripe-js', startTime });
|
|
85
87
|
};
|
|
88
|
+
const getStripeVersion = (stripeConstructor) => {
|
|
89
|
+
if (!('version' in stripeConstructor)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const { version } = stripeConstructor;
|
|
93
|
+
return typeof version === 'number' || typeof version === 'string'
|
|
94
|
+
? version
|
|
95
|
+
: undefined;
|
|
96
|
+
};
|
|
86
97
|
export const initStripe = (maybeStripe, args, startTime) => {
|
|
87
98
|
if (maybeStripe === null) {
|
|
88
99
|
return null;
|
|
89
100
|
}
|
|
90
|
-
const
|
|
101
|
+
const [publishableKey, callerOptions] = args;
|
|
102
|
+
const options = Object.assign({}, callerOptions);
|
|
103
|
+
const stripeVersion = getStripeVersion(maybeStripe);
|
|
104
|
+
const isNamedRelease = typeof stripeVersion === 'string' &&
|
|
105
|
+
stripeVersion !== V3_VERSION.toString();
|
|
106
|
+
if (isNamedRelease) {
|
|
107
|
+
delete options.apiVersion;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
options.apiVersion = STRIPE_API_VERSION;
|
|
111
|
+
}
|
|
112
|
+
const stripe = maybeStripe(publishableKey, options);
|
|
91
113
|
registerWrapper(stripe, startTime);
|
|
92
114
|
return stripe;
|
|
93
115
|
};
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
// rollup and ts somehow can't compile this with absolute path
|
|
2
2
|
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
3
3
|
import { generateCloudflareDeployUrl } from "./generateCloudflareDeployUrl";
|
|
4
|
+
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
5
|
+
import { cloudflareWorkerHost, cloudflareWorkerName, generateCloudflareWorkerPreviewUrl, } from "./generateCloudflareWorkerPreviewUrl";
|
|
6
|
+
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
7
|
+
import { resolveCloudflareRuntime } from "./resolveCloudflareRuntime";
|
|
8
|
+
/**
|
|
9
|
+
* Pages when Cloudflare Pages sets `CF_PAGES=1`.
|
|
10
|
+
* Otherwise a Cloudflare build is the worker. Every other build stays on the Pages preview path.
|
|
11
|
+
* `USE_OPENNEXT` is not an input.
|
|
12
|
+
*/
|
|
13
|
+
export const resolveCloudflareDeployTarget = ({ buildEnv, cfPages, }) => {
|
|
14
|
+
if (resolveCloudflareRuntime({ buildEnv, cfPages }) === 'worker') {
|
|
15
|
+
return 'worker';
|
|
16
|
+
}
|
|
17
|
+
return 'pages';
|
|
18
|
+
};
|
|
4
19
|
/**
|
|
5
|
-
*
|
|
6
|
-
* - Get the cloudflare alias to build if the environment is Preview
|
|
7
|
-
* - Get the cloudflare production url (not preview alias) if it's production
|
|
8
|
-
* @note
|
|
9
|
-
* This is mainly used for get correct Cloudflare API to be used in scripts
|
|
10
|
-
* @note
|
|
11
|
-
* "url" is the API url in Cloudflare
|
|
20
|
+
* Cloudflare API address inlined into the storefront script.
|
|
12
21
|
* @returns
|
|
13
|
-
* - `https://<
|
|
14
|
-
*
|
|
15
|
-
* - `https
|
|
22
|
+
* - `https://<label>.robert-152.workers.dev` for a non-production Worker preview
|
|
23
|
+
* - `https://zonos-elements-serverless-test.robert-152.workers.dev` for the test Worker production host
|
|
24
|
+
* - `https://<branch_name>.<project_name>.pages.dev` for a non-production Pages preview
|
|
25
|
+
* - the configured host for production, local, and GitHub Actions
|
|
16
26
|
*/
|
|
17
|
-
export const formattedCloudflareApiUrl = ({ branchName, inCI: _inCI, inGithubAction, inVercel: _inVercel, isVercelPreview: _isVercelPreview, url, }) => {
|
|
27
|
+
export const formattedCloudflareApiUrl = ({ branchName, cloudflareTarget, inCI: _inCI, inGithubAction, inVercel: _inVercel, isVercelPreview: _isVercelPreview, url, }) => {
|
|
18
28
|
if (!url) {
|
|
19
29
|
// return origin value so t3 can throw error when it's empty
|
|
20
30
|
return url;
|
|
@@ -32,19 +42,27 @@ export const formattedCloudflareApiUrl = ({ branchName, inCI: _inCI, inGithubAct
|
|
|
32
42
|
const isProdBranch = branchName && ['main'].includes(branchName);
|
|
33
43
|
const isTest = domainOnlyUrl.includes('test.') || domainOnlyUrl.includes('test-git');
|
|
34
44
|
const projectName = isTest ? 'zonos-elements-test' : 'zonos-elements';
|
|
35
|
-
//
|
|
45
|
+
// Preview hosts are only for non-production branches after the early returns above.
|
|
36
46
|
if (!isProdBranch) {
|
|
37
|
-
// use Cloudflare branch_url instead of the production url
|
|
38
47
|
if (!branchName) {
|
|
39
48
|
throw new Error('Failed to get Cloudflare commit ref or branch name');
|
|
40
49
|
}
|
|
41
|
-
|
|
50
|
+
if (cloudflareTarget === 'worker') {
|
|
51
|
+
const workerHost = generateCloudflareWorkerPreviewUrl({
|
|
52
|
+
branchName,
|
|
53
|
+
workerName: cloudflareWorkerName(isTest),
|
|
54
|
+
});
|
|
55
|
+
return `https://${workerHost}`;
|
|
56
|
+
}
|
|
42
57
|
const cloudflareUrl = generateCloudflareDeployUrl({
|
|
43
58
|
branchName,
|
|
44
59
|
projectName,
|
|
45
60
|
});
|
|
46
61
|
return `https://${cloudflareUrl}`;
|
|
47
62
|
}
|
|
63
|
+
if (cloudflareTarget === 'worker' && isTest) {
|
|
64
|
+
return `https://${cloudflareWorkerHost(cloudflareWorkerName(true))}`;
|
|
65
|
+
}
|
|
48
66
|
// use cloudflare production url
|
|
49
67
|
return `https://${domainOnlyUrl}`;
|
|
50
68
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generate a Cloudflare Pages-style deploy URL based on the branch name and project name.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* until a matching Workers alias exists.
|
|
3
|
+
* Worker preview hosts are built separately by `generateCloudflareWorkerPreviewUrl`.
|
|
4
|
+
* This helper only builds Cloudflare Pages aliases (`<branch>.<project>.pages.dev`).
|
|
6
5
|
* @note not including https://
|
|
7
6
|
* @return {url} string
|
|
8
7
|
* @urlExample build-cloudflare-2.zonos-elements.pages.dev
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const WORKER_ACCOUNT_HOST = 'robert-152.workers.dev';
|
|
2
|
+
const WORKER_LABEL_MAX_LENGTH = 63;
|
|
3
|
+
const WORKER_NAME = 'zonos-elements-serverless';
|
|
4
|
+
const WORKER_NAME_TEST = 'zonos-elements-serverless-test';
|
|
5
|
+
const PREVIEW_HASH_LENGTH = 8;
|
|
6
|
+
/**
|
|
7
|
+
* Lowercase, collapse non-alphanumeric runs to one hyphen, and trim hyphens.
|
|
8
|
+
*/
|
|
9
|
+
const normalizeWorkerBranch = (branchName) => branchName
|
|
10
|
+
.toLowerCase()
|
|
11
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
12
|
+
.replace(/^-+|-+$/g, '');
|
|
13
|
+
/** Stable 8-character suffix so two long branches cannot share one label. */
|
|
14
|
+
const previewHash = (value) => {
|
|
15
|
+
let hash = 5381;
|
|
16
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
17
|
+
const code = value.charCodeAt(index);
|
|
18
|
+
hash = Math.imul(hash, 33) ^ code;
|
|
19
|
+
}
|
|
20
|
+
return (hash >>> 0).toString(16).padStart(PREVIEW_HASH_LENGTH, '0');
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Worker host without a scheme.
|
|
24
|
+
* Production is `{workerName}.robert-152.workers.dev`.
|
|
25
|
+
* Preview is `{prefix}-{workerName}.robert-152.workers.dev`.
|
|
26
|
+
* A branch longer than the prefix budget becomes `{prefix}-{hash}-{workerName}`.
|
|
27
|
+
* `{workerName}` is `zonos-elements-serverless`, or `zonos-elements-serverless-test` for the test project.
|
|
28
|
+
* The label is at most 63 characters.
|
|
29
|
+
* @example feat-checkout-zonos-elements-serverless.robert-152.workers.dev
|
|
30
|
+
* @example zonos-elements-serverless-test.robert-152.workers.dev
|
|
31
|
+
*/
|
|
32
|
+
export const generateCloudflareWorkerPreviewUrl = ({ branchName, workerName = WORKER_NAME, }) => {
|
|
33
|
+
const normalized = normalizeWorkerBranch(branchName);
|
|
34
|
+
if (normalized.length === 0) {
|
|
35
|
+
throw new Error('Failed to build a Cloudflare worker preview name from the branch');
|
|
36
|
+
}
|
|
37
|
+
const plainBudget = WORKER_LABEL_MAX_LENGTH - workerName.length - 1;
|
|
38
|
+
if (normalized.length <= plainBudget) {
|
|
39
|
+
return `${normalized}-${workerName}.${WORKER_ACCOUNT_HOST}`;
|
|
40
|
+
}
|
|
41
|
+
const hash = previewHash(normalized);
|
|
42
|
+
const hashedBudget = plainBudget - PREVIEW_HASH_LENGTH - 1;
|
|
43
|
+
const prefix = normalized.slice(0, hashedBudget).replace(/-+$/g, '');
|
|
44
|
+
const label = prefix.length > 0
|
|
45
|
+
? `${prefix}-${hash}-${workerName}`
|
|
46
|
+
: `${hash}-${workerName}`;
|
|
47
|
+
return `${label}.${WORKER_ACCOUNT_HOST}`;
|
|
48
|
+
};
|
|
49
|
+
export const cloudflareWorkerName = (isTest) => isTest ? WORKER_NAME_TEST : WORKER_NAME;
|
|
50
|
+
/** `{workerName}.robert-152.workers.dev` with no branch prefix. */
|
|
51
|
+
export const cloudflareWorkerHost = (workerName) => `${workerName}.${WORKER_ACCOUNT_HOST}`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pages when Cloudflare Pages sets `CF_PAGES=1`.
|
|
3
|
+
* A Cloudflare build that is not Pages is the worker.
|
|
4
|
+
* Every other build is neither.
|
|
5
|
+
* `USE_OPENNEXT` is not an input.
|
|
6
|
+
*/
|
|
7
|
+
export const resolveCloudflareRuntime = ({ buildEnv, cfPages, }) => {
|
|
8
|
+
if (cfPages === '1') {
|
|
9
|
+
return 'pages';
|
|
10
|
+
}
|
|
11
|
+
if (buildEnv === 'cloudflare') {
|
|
12
|
+
return 'worker';
|
|
13
|
+
}
|
|
14
|
+
return 'other';
|
|
15
|
+
};
|
|
@@ -2045,7 +2045,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
2045
2045
|
var e = new Error(message);
|
|
2046
2046
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2047
2047
|
};
|
|
2048
|
-
var version = "1.35.
|
|
2048
|
+
var version = "1.35.1";
|
|
2049
2049
|
var packageJson = {
|
|
2050
2050
|
version: version};
|
|
2051
2051
|
|
|
@@ -2144,7 +2144,8 @@ var SDK_URL_MAPPING = {
|
|
|
2144
2144
|
payments: '/assets/elements.bundle.min.js',
|
|
2145
2145
|
sca: '/hosted-sca/sdk/v1/index.js',
|
|
2146
2146
|
taxForm: '/widgets/taxForm/sdk/v1/index.js',
|
|
2147
|
-
billing: '/widgets/checkout/sdk/v1/index.js'
|
|
2147
|
+
billing: '/widgets/checkout/sdk/v1/index.js',
|
|
2148
|
+
balance: '/widgets/embedded-balance/sdk/v1/index.js'
|
|
2148
2149
|
};
|
|
2149
2150
|
var ELEMENT_TO_SDK = {
|
|
2150
2151
|
// legacy
|
|
@@ -2178,7 +2179,16 @@ var ELEMENT_TO_SDK = {
|
|
|
2178
2179
|
scaManagement: 'sca',
|
|
2179
2180
|
taxForm: 'taxForm',
|
|
2180
2181
|
// billing elements
|
|
2181
|
-
embeddedCheckout: 'billing'
|
|
2182
|
+
embeddedCheckout: 'billing',
|
|
2183
|
+
// balance elements
|
|
2184
|
+
balanceOverview: 'balance',
|
|
2185
|
+
balanceDetail: 'balance',
|
|
2186
|
+
balanceActivities: 'balance',
|
|
2187
|
+
balanceActivityDetails: 'balance',
|
|
2188
|
+
balanceHistoryChart: 'balance',
|
|
2189
|
+
balanceInfo: 'balance',
|
|
2190
|
+
balanceScheduledTransactions: 'balance',
|
|
2191
|
+
balanceList: 'balance'
|
|
2182
2192
|
};
|
|
2183
2193
|
var ELEMENT_GROUP_TO_ELEMENT = {
|
|
2184
2194
|
payments: [
|
|
@@ -2207,7 +2217,17 @@ var ELEMENT_GROUP_TO_ELEMENT = {
|
|
|
2207
2217
|
'lendingRfi',
|
|
2208
2218
|
'mrmRfi',
|
|
2209
2219
|
],
|
|
2210
|
-
billing: ['embeddedCheckout']
|
|
2220
|
+
billing: ['embeddedCheckout'],
|
|
2221
|
+
balance: [
|
|
2222
|
+
'balanceOverview',
|
|
2223
|
+
'balanceDetail',
|
|
2224
|
+
'balanceActivities',
|
|
2225
|
+
'balanceHistoryChart',
|
|
2226
|
+
'balanceInfo',
|
|
2227
|
+
'balanceScheduledTransactions',
|
|
2228
|
+
'balanceList',
|
|
2229
|
+
'balanceActivityDetails',
|
|
2230
|
+
]
|
|
2211
2231
|
};
|
|
2212
2232
|
var SDK_DEPENDENCIES = {
|
|
2213
2233
|
billing: ['payments']
|
package/dist/esm/index.js
CHANGED
|
@@ -131,7 +131,7 @@ const getZonosQaUrl = () => {
|
|
|
131
131
|
return null;
|
|
132
132
|
}
|
|
133
133
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
134
|
-
const cdnUrl = "https://v1.
|
|
134
|
+
const cdnUrl = "https://v1.4.0.js.zonos.com";
|
|
135
135
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
136
136
|
if (!qaUrl &&
|
|
137
137
|
(cdnUrl.includes('test.') ||
|
|
@@ -185,8 +185,10 @@ const getZonosQaUrl = () => {
|
|
|
185
185
|
|
|
186
186
|
/* eslint-disable no-console */
|
|
187
187
|
/** Loading stripe script extracted from stripe.js repository */
|
|
188
|
+
const STRIPE_API_VERSION = '2025-02-24.acacia';
|
|
188
189
|
const V3_URL = 'https://js.stripe.com/v3';
|
|
189
190
|
const V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
191
|
+
const V3_VERSION = 3;
|
|
190
192
|
const EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
|
|
191
193
|
const zonosStripeFindScript = () => {
|
|
192
194
|
const scripts = document.querySelectorAll(`script[src^="${V3_URL}"]`);
|
|
@@ -264,11 +266,31 @@ const registerWrapper = (stripe, startTime) => {
|
|
|
264
266
|
}
|
|
265
267
|
stripe._registerWrapper({ name: 'stripe-js', startTime });
|
|
266
268
|
};
|
|
269
|
+
const getStripeVersion = (stripeConstructor) => {
|
|
270
|
+
if (!('version' in stripeConstructor)) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const { version } = stripeConstructor;
|
|
274
|
+
return typeof version === 'number' || typeof version === 'string'
|
|
275
|
+
? version
|
|
276
|
+
: undefined;
|
|
277
|
+
};
|
|
267
278
|
const initStripe = (maybeStripe, args, startTime) => {
|
|
268
279
|
if (maybeStripe === null) {
|
|
269
280
|
return null;
|
|
270
281
|
}
|
|
271
|
-
const
|
|
282
|
+
const [publishableKey, callerOptions] = args;
|
|
283
|
+
const options = Object.assign({}, callerOptions);
|
|
284
|
+
const stripeVersion = getStripeVersion(maybeStripe);
|
|
285
|
+
const isNamedRelease = typeof stripeVersion === 'string' &&
|
|
286
|
+
stripeVersion !== V3_VERSION.toString();
|
|
287
|
+
if (isNamedRelease) {
|
|
288
|
+
delete options.apiVersion;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
options.apiVersion = STRIPE_API_VERSION;
|
|
292
|
+
}
|
|
293
|
+
const stripe = maybeStripe(publishableKey, options);
|
|
272
294
|
registerWrapper(stripe, startTime);
|
|
273
295
|
return stripe;
|
|
274
296
|
};
|
|
@@ -394,10 +416,10 @@ const zonosLoadUrl = (() => {
|
|
|
394
416
|
return null;
|
|
395
417
|
})();
|
|
396
418
|
const startLoadTime = Date.now();
|
|
397
|
-
const ZONOS_URL = "https://v1.
|
|
398
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.
|
|
399
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.
|
|
400
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.
|
|
419
|
+
const ZONOS_URL = "https://v1.4.0.js.zonos.com";
|
|
420
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.4.0";
|
|
421
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.4.0";
|
|
422
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.4.0";
|
|
401
423
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
402
424
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
403
425
|
class Zonos {
|
|
@@ -415,7 +437,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
|
|
|
415
437
|
? new URLSearchParams(window.location.search).get('iframeLogType')
|
|
416
438
|
: null;
|
|
417
439
|
Zonos.isBigCommerce = false;
|
|
418
|
-
Zonos.releaseDate = "
|
|
440
|
+
Zonos.releaseDate = "1792186375498";
|
|
419
441
|
Zonos.isLegacyCheckout = false;
|
|
420
442
|
Zonos.googleAnalyticId = null;
|
|
421
443
|
Zonos.googleAnalyticReady = false;
|
|
@@ -440,7 +462,7 @@ Zonos.isNpm = true;
|
|
|
440
462
|
Zonos.zonosQaUrl = null;
|
|
441
463
|
Zonos.zonosQaUrlApi = null;
|
|
442
464
|
Zonos.trackEventLogs = [];
|
|
443
|
-
Zonos.version = `v${"1.
|
|
465
|
+
Zonos.version = `v${"1.4.0"}`;
|
|
444
466
|
Zonos.modeAlerted = false;
|
|
445
467
|
Zonos.cartData = null;
|
|
446
468
|
Zonos.paypal = null;
|