@zonos/elements 1.3.136 → 1.3.138
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/{cart-0f32f556.js → cart-efd80d55.js} +81 -3
- package/dist/cjs/index.cjs.js +13 -10
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-fd50c7d5.js → paypal-50e03778.js} +1 -1
- package/dist/cjs/zonos-address_7.cjs.entry.js +1 -1
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +25 -10
- package/dist/cjs/zonos-checkout.cjs.entry.js +76 -9
- package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-notification_3.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +19 -6
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +76 -8
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +4 -2
- package/dist/collection/components/store/checkout/cart.js +1 -0
- package/dist/collection/components/store/checkout/stripe.js +20 -3
- package/dist/collection/components/store/translationStore/strings.arabic.js +3 -0
- package/dist/collection/components/store/translationStore/strings.base.js +3 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
- package/dist/collection/components/store/translationStore/strings.french.js +3 -0
- package/dist/collection/components/store/translationStore/strings.german.js +3 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
- package/dist/collection/scripts/_zonosBase.js +6 -3
- package/dist/collection/types/generated/graphql.frontend.types.js +2 -3
- package/dist/collection/types/generated/graphql.internal.types.js +1 -0
- package/dist/esm/{cart-3e0e4d5c.js → cart-f0bf7202.js} +82 -4
- package/dist/esm/index.js +13 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-b4af6cc0.js → paypal-65d40ba3.js} +1 -1
- package/dist/esm/zonos-address_7.entry.js +1 -1
- package/dist/esm/zonos-cart-items_13.entry.js +25 -10
- package/dist/esm/zonos-checkout.entry.js +77 -10
- package/dist/esm/zonos-controller.entry.js +1 -1
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +1 -1
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm/zonos-notification_3.entry.js +2 -2
- package/dist/esm-es5/cart-f0bf7202.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-b4af6cc0.js → paypal-65d40ba3.js} +1 -1
- package/dist/esm-es5/zonos-address_7.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
- package/dist/scripts/index.d.ts +15 -3
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +5 -0
- package/dist/types/components/store/checkout/cart.d.ts +1 -0
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
- package/dist/types/components/store/translationStore.d.ts +1 -1
- package/dist/types/components/utils/api/calculateLandedCost.d.ts +2 -2
- package/dist/types/components/utils/api/calculateLandedCostNormalized.d.ts +2 -2
- package/dist/types/components/utils/api/cartCalculateLandedCost.d.ts +2 -2
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/components/utils/api/triggerBuildLandedCost.d.ts +3 -7
- package/dist/types/types/checkout/api/CalculateLandedCost.d.ts +21 -1
- package/dist/types/types/generated/graphql.frontend.types.d.ts +3 -23
- package/dist/types/types/generated/graphql.frontend.types.ts +3 -36
- package/dist/types/types/generated/graphql.internal.types.d.ts +1 -0
- package/dist/types/types/generated/graphql.internal.types.ts +1 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-09636917.js +1 -0
- package/dist/zonos-elements/p-128b1b70.system.entry.js +1 -0
- package/dist/zonos-elements/{p-05826697.system.entry.js → p-1af0a800.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3f2ea446.entry.js → p-37a127fc.entry.js} +1 -1
- package/dist/zonos-elements/p-4628832d.system.js +1 -0
- package/dist/zonos-elements/{p-c52a8369.system.entry.js → p-47efac28.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e9db73d9.entry.js → p-4ab4ba81.entry.js} +1 -1
- package/dist/zonos-elements/{p-4b680c1e.system.entry.js → p-52a5bd4c.system.entry.js} +1 -1
- package/dist/zonos-elements/p-58983c97.entry.js +1 -0
- package/dist/zonos-elements/{p-3a5fb01a.system.entry.js → p-59d0f69b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-18cb1aee.system.js → p-6e24b0cf.system.js} +1 -1
- package/dist/zonos-elements/{p-887b05eb.system.entry.js → p-7b34be6e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e1ac8cd8.js → p-845ad2b8.js} +1 -1
- package/dist/zonos-elements/{p-b6fea87a.entry.js → p-8880d648.entry.js} +1 -1
- package/dist/zonos-elements/p-8e25910c.entry.js +1 -0
- package/dist/zonos-elements/{p-37991f24.entry.js → p-b088f65a.entry.js} +1 -1
- package/dist/zonos-elements/p-b6005449.system.entry.js +1 -0
- package/dist/zonos-elements/{p-49cecdf9.system.entry.js → p-ba26fc96.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6b8db2d3.entry.js → p-bad5200e.entry.js} +1 -1
- package/dist/zonos-elements/{p-16e5df29.system.entry.js → p-c48e735d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-897c809a.entry.js → p-c5bff157.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-85fbb5f0.entry.js → p-c9c4e557.entry.js} +1 -1
- package/dist/zonos-elements/{p-a28f3298.system.entry.js → p-d2a77699.system.entry.js} +1 -1
- package/dist/zonos-elements/p-e309e4a3.system.js +1 -0
- package/dist/zonos-elements/{p-bec4d2c7.entry.js → p-f0ce4d90.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-3e0e4d5c.js +0 -1
- package/dist/zonos-elements/p-69045ca3.js +0 -1
- package/dist/zonos-elements/p-af3ecd9d.system.entry.js +0 -1
- package/dist/zonos-elements/p-b776e39e.system.js +0 -1
- package/dist/zonos-elements/p-c8927b27.system.entry.js +0 -1
- package/dist/zonos-elements/p-caddd067.entry.js +0 -1
- package/dist/zonos-elements/p-e9862f66.entry.js +0 -1
- package/dist/zonos-elements/p-fa790aaf.system.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CartItem } from "../../../components/store/checkout/cart";
|
|
2
|
-
import type { CountryCode, CurrencyCode, LandedCostAdjustmentType } from "../../generated/graphql.internal.types";
|
|
2
|
+
import type { CalculateLandedCostMutation, CartCalculateLandedCostMutation, CountryCode, CurrencyCode, LandedCostAdjustmentType } from "../../generated/graphql.internal.types";
|
|
3
3
|
export type CalculateLandedCostAdjustmentInput = {
|
|
4
4
|
amount: number;
|
|
5
5
|
name?: string | null;
|
|
@@ -8,6 +8,23 @@ export type CalculateLandedCostAdjustmentInput = {
|
|
|
8
8
|
sku: string | null;
|
|
9
9
|
type: LandedCostAdjustmentType;
|
|
10
10
|
};
|
|
11
|
+
export type Extensions = {
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
} & {
|
|
14
|
+
rule?: {
|
|
15
|
+
description: string;
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
19
|
+
ruleMessageType?: 'CUSTOM' | 'DEFAULT';
|
|
20
|
+
};
|
|
21
|
+
export type ApiError = {
|
|
22
|
+
extensions?: Extensions | null;
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
25
|
+
export type CalculateLandedCostResponse = CalculateLandedCostMutation & {
|
|
26
|
+
errors: ApiError[];
|
|
27
|
+
};
|
|
11
28
|
export type CalculateLandedCostRequest = {
|
|
12
29
|
billingAddress: {
|
|
13
30
|
addressLine1: string;
|
|
@@ -48,6 +65,9 @@ export type CalculateLandedCostRequest = {
|
|
|
48
65
|
state: string;
|
|
49
66
|
};
|
|
50
67
|
};
|
|
68
|
+
export type CartCalculateLandedCostResponse = CartCalculateLandedCostMutation & {
|
|
69
|
+
errors: ApiError[];
|
|
70
|
+
};
|
|
51
71
|
export type CartCalculateLandedCostRequest = {
|
|
52
72
|
billingAddress: {
|
|
53
73
|
addressLine1: string;
|
|
@@ -100,6 +100,7 @@ export declare const featureAspectKeyEnum: {
|
|
|
100
100
|
readonly NewPayoutReport: "new_payout_report";
|
|
101
101
|
readonly PageAuditor: "page_auditor";
|
|
102
102
|
readonly PromptExplorer: "prompt_explorer";
|
|
103
|
+
readonly RulesUiCreate: "rules_ui_create";
|
|
103
104
|
readonly SupportTicketSystem: "support_ticket_system";
|
|
104
105
|
readonly TeamAuditor: "team_auditor";
|
|
105
106
|
};
|
|
@@ -127,6 +128,7 @@ export declare const featureAudienceNameEnum: {
|
|
|
127
128
|
readonly PrincipalEngineer: "principal_engineer";
|
|
128
129
|
readonly ProServeHead: "pro_serve_head";
|
|
129
130
|
readonly ProductManager: "product_manager";
|
|
131
|
+
readonly RulesUiCreateMerchant: "rules_ui_create_merchant";
|
|
130
132
|
readonly SupportTicketMerchants: "support_ticket_merchants";
|
|
131
133
|
readonly TechLead: "tech_lead";
|
|
132
134
|
};
|
|
@@ -553,28 +555,9 @@ export type FailToGetQuoteErrorsQuery = {
|
|
|
553
555
|
}>;
|
|
554
556
|
};
|
|
555
557
|
};
|
|
556
|
-
export type FailedToGetOrderQuery = {
|
|
557
|
-
error_event_aggregate: {
|
|
558
|
-
aggregate: {
|
|
559
|
-
count: number;
|
|
560
|
-
} | null;
|
|
561
|
-
nodes: Array<{
|
|
562
|
-
allLogs: Record<string, unknown> | Record<string, unknown>[] | null;
|
|
563
|
-
createdAt: string;
|
|
564
|
-
endpoint: string;
|
|
565
|
-
errors: Record<string, unknown> | Record<string, unknown>[];
|
|
566
|
-
id: number;
|
|
567
|
-
metadata: Record<string, unknown> | Record<string, unknown>[] | null;
|
|
568
|
-
publicCredential: Record<string, unknown> | Record<string, unknown>[] | null;
|
|
569
|
-
requestPayload: Record<string, unknown> | Record<string, unknown>[];
|
|
570
|
-
responseBody: Record<string, unknown> | Record<string, unknown>[] | null;
|
|
571
|
-
status: number;
|
|
572
|
-
}>;
|
|
573
|
-
};
|
|
574
|
-
};
|
|
575
558
|
export type LocaleCountryMessagesQuery = {
|
|
576
559
|
locale_countryCodesPage: Array<{
|
|
577
|
-
countryCodes: Array<string
|
|
560
|
+
countryCodes: Array<string> | null;
|
|
578
561
|
countryCodesPageMessageLinks: Array<{
|
|
579
562
|
id: number;
|
|
580
563
|
message: {
|
|
@@ -831,9 +814,6 @@ export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionW
|
|
|
831
814
|
failToGetQuoteErrors(variables?: {
|
|
832
815
|
[x: string]: never;
|
|
833
816
|
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<FailToGetQuoteErrorsQuery>;
|
|
834
|
-
failedToGetOrder(variables?: {
|
|
835
|
-
[x: string]: never;
|
|
836
|
-
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<FailedToGetOrderQuery>;
|
|
837
817
|
getAudienceByAspectKey(variables?: {
|
|
838
818
|
[x: string]: never;
|
|
839
819
|
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<GetAudienceByAspectKeyQuery>;
|
|
@@ -79,6 +79,7 @@ export const featureAspectKeyEnum = {
|
|
|
79
79
|
NewPayoutReport: 'new_payout_report',
|
|
80
80
|
PageAuditor: 'page_auditor',
|
|
81
81
|
PromptExplorer: 'prompt_explorer',
|
|
82
|
+
RulesUiCreate: 'rules_ui_create',
|
|
82
83
|
SupportTicketSystem: 'support_ticket_system',
|
|
83
84
|
TeamAuditor: 'team_auditor',
|
|
84
85
|
} as const;
|
|
@@ -110,6 +111,7 @@ export const featureAudienceNameEnum = {
|
|
|
110
111
|
PrincipalEngineer: 'principal_engineer',
|
|
111
112
|
ProServeHead: 'pro_serve_head',
|
|
112
113
|
ProductManager: 'product_manager',
|
|
114
|
+
RulesUiCreateMerchant: 'rules_ui_create_merchant',
|
|
113
115
|
SupportTicketMerchants: 'support_ticket_merchants',
|
|
114
116
|
TechLead: 'tech_lead',
|
|
115
117
|
} as const;
|
|
@@ -561,30 +563,9 @@ export type FailToGetQuoteErrorsQuery = {
|
|
|
561
563
|
};
|
|
562
564
|
};
|
|
563
565
|
|
|
564
|
-
export type FailedToGetOrderQuery = {
|
|
565
|
-
error_event_aggregate: {
|
|
566
|
-
aggregate: { count: number } | null;
|
|
567
|
-
nodes: Array<{
|
|
568
|
-
allLogs: Record<string, unknown> | Record<string, unknown>[] | null;
|
|
569
|
-
createdAt: string;
|
|
570
|
-
endpoint: string;
|
|
571
|
-
errors: Record<string, unknown> | Record<string, unknown>[];
|
|
572
|
-
id: number;
|
|
573
|
-
metadata: Record<string, unknown> | Record<string, unknown>[] | null;
|
|
574
|
-
publicCredential:
|
|
575
|
-
| Record<string, unknown>
|
|
576
|
-
| Record<string, unknown>[]
|
|
577
|
-
| null;
|
|
578
|
-
requestPayload: Record<string, unknown> | Record<string, unknown>[];
|
|
579
|
-
responseBody: Record<string, unknown> | Record<string, unknown>[] | null;
|
|
580
|
-
status: number;
|
|
581
|
-
}>;
|
|
582
|
-
};
|
|
583
|
-
};
|
|
584
|
-
|
|
585
566
|
export type LocaleCountryMessagesQuery = {
|
|
586
567
|
locale_countryCodesPage: Array<{
|
|
587
|
-
countryCodes: Array<string
|
|
568
|
+
countryCodes: Array<string> | null;
|
|
588
569
|
countryCodesPageMessageLinks: Array<{
|
|
589
570
|
id: number;
|
|
590
571
|
message: {
|
|
@@ -968,20 +949,6 @@ export function getSdk(
|
|
|
968
949
|
'query',
|
|
969
950
|
);
|
|
970
951
|
},
|
|
971
|
-
failedToGetOrder(
|
|
972
|
-
variables?: { [x: string]: never },
|
|
973
|
-
requestHeaders?: GraphQLClientRequestHeaders,
|
|
974
|
-
): Promise<FailedToGetOrderQuery> {
|
|
975
|
-
return withWrapper(
|
|
976
|
-
wrappedRequestHeaders =>
|
|
977
|
-
client.request<FailedToGetOrderQuery>('', variables, {
|
|
978
|
-
...requestHeaders,
|
|
979
|
-
...wrappedRequestHeaders,
|
|
980
|
-
}),
|
|
981
|
-
'failedToGetOrder',
|
|
982
|
-
'query',
|
|
983
|
-
);
|
|
984
|
-
},
|
|
985
952
|
getAudienceByAspectKey(
|
|
986
953
|
variables?: { [x: string]: never },
|
|
987
954
|
requestHeaders?: GraphQLClientRequestHeaders,
|
|
@@ -1385,6 +1385,7 @@ export declare const emailTemplateStatus: {
|
|
|
1385
1385
|
export type EmailTemplateStatus = (typeof emailTemplateStatus)[keyof typeof emailTemplateStatus];
|
|
1386
1386
|
export declare const emailTemplateType: {
|
|
1387
1387
|
readonly AbandonedCart: "ABANDONED_CART";
|
|
1388
|
+
readonly AccountOrderReceipt: "ACCOUNT_ORDER_RECEIPT";
|
|
1388
1389
|
readonly CatalogExport: "CATALOG_EXPORT";
|
|
1389
1390
|
readonly ClassificationExport: "CLASSIFICATION_EXPORT";
|
|
1390
1391
|
readonly Custom: "CUSTOM";
|
|
@@ -1610,6 +1610,7 @@ export type EmailTemplateStatus =
|
|
|
1610
1610
|
(typeof emailTemplateStatus)[keyof typeof emailTemplateStatus];
|
|
1611
1611
|
export const emailTemplateType = {
|
|
1612
1612
|
AbandonedCart: 'ABANDONED_CART',
|
|
1613
|
+
AccountOrderReceipt: 'ACCOUNT_ORDER_RECEIPT',
|
|
1613
1614
|
CatalogExport: 'CATALOG_EXPORT',
|
|
1614
1615
|
ClassificationExport: 'CLASSIFICATION_EXPORT',
|
|
1615
1616
|
Custom: 'CUSTOM',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e,h as n,a as o}from"./p-860e46ab.js";import{s as t,c as s}from"./p-b7307c61.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-b7307c61.js";const r=["jsdelivr","cdnjs","unpkg","vercel"],i="jsdelivr",l=e=>{const n=r.indexOf(e);return r[n+1]||null},a=()=>{const n=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||n)return null;const o=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),t="https://v1.3.136.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const s=`https://${o}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${s}' for loading elements script`,"warn"),fetch(s).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${s}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),s},u="https://js.stripe.com/v3",m=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,w="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let p=null;const f=Promise.resolve().then((()=>{return e=null,null!==p||(p=new Promise(((n,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(w),window.Stripe)n(window.Stripe);else try{let s=(()=>{const e=document.querySelectorAll(`script[src^="${u}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&m.test(o.src))return o}return null})();s&&e?console.warn(w):s||(s=(e=>{const n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",t=document.createElement("script");t.src=`${u}${n}`;const s=document.head||document.body;return s?(s.appendChild(t),t):(o("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==s||s.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):t(new Error("Stripe.js not available"))})),null==s||s.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else n(null)}))),p;var e}));let h=!1;var v;f.catch((e=>{h||console.warn(e)}));const y=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),t=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:t,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?n:null})(),z="https://v1.3.136.js.zonos.com",j=y||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.136",S="https://rsms.me",g="https://fonts.googleapis.com",O=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class b{}v=b,b.doneInit=!1,b.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),b.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),b._paypalMockResponse=null,b.isBigCommerce=!1,b.releaseDate="1733241504089",b.isLegacyCheckout=!1,b.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",b.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),b.isNpm=!0,b.zonosQaUrl=null,b.zonosQaUrlApi=null,b.version="v1.3.136",b.modeAlerted=!1,b.cartData=null,b.paypal=null,b.getCurrentTimestamp=()=>(new Date).getTime(),b.zonosController=null,b.init=async r=>{const{appearance:i,checkoutSettings:c,currencyConverter:l,helloSettings:d,onCountryChange:u,overrideCurrencyFormat:m,storeId:w,zonosApiKey:p}=r;if(v.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!v.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${v.version}) ======`),v.zonosApiKey=p,v.storeId=w,v.isNpm){e("====== ZONOS LOADING FROM NPM ======");const s=a();if(s&&!window.isZonosPreview){e(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${s} ======`,"info");const n=document.createElement("script");return n.src=`${s}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=v.isNpm,window.Zonos.isBigCommerce=v.isBigCommerce,window.Zonos.isLegacyCheckout=v.isLegacyCheckout,window.Zonos.init(r)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${s}`)})),void(window.isZonosPreview=!0)}if(!p&&!v.cartId)return void o("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!v.cartData&&v.cartId){e("Initialize cart data");const n=await t(v.cartId);if(!n)return void o("Failed to get cart data");v.cartData=n.cartData,v.zonosApiKey=n.zonosApiKey}const i=await(async()=>{if(!window.location.search.includes("zonosTestMode=1")||!window.Zonos.zonosApiKey)return null;if(e("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return e("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:s}=await n("/api/get-test-public-credential");if(t.length||!s)return o("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const r=s.publicCredential;return r?(e(`[ZONOS - loadZonos] Retrieve new test public token ${r}`,"info"),r):(o("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();i&&(v.zonosApiKey=i)}if(v.cartId&&v.cartData){e("Cart data is available, inject hidden button and trigger checkout");const n=document.createElement("button");n.style.display="none",n.id=`${s}`,document.body.appendChild(n)}e("init zonos"),v.injectZonosCdn(),v.injectZonosCss(),v.injectFonts(),v.injectController({config:{appearance:i,checkoutSettings:c,currencyConverter:l,helloSettings:d,onCountryChange:u,overrideCurrencyFormat:m}}),v.doneInit=!0}},b.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},b.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},b.showNotification=e=>{var n;null===(n=v.zonosController)||void 0===n||n.showNotification(e)},b.updateOrganizationName=e=>{var n;null===(n=v.zonosController)||void 0===n||n.updateOrganizationName(e)},b.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:o,placeOrderButtonSelector:t})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&t){const n=document.querySelectorAll(t),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&o&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},b.injectController=({config:n})=>{var t;if(document.querySelector("zonos-controller"))return;if(null===(t=n.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const e=n.checkoutSettings.placeOrderButtonSelector;v.disablePlaceOrderButtons({config:n,disable:!0,placeOrderButtonSelector:e}),new MutationObserver((()=>{v.disablePlaceOrderButtons({config:n,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=n,s.zonosApiKey=v.zonosApiKey||"",s.addEventListener("stripeInitEvent",(async n=>{const{detail:t}=n;e("loading Stripe");const r=await(async(...e)=>{h=!0;const n=Date.now();return f.then((o=>((e,n,o)=>{if(null===e)return null;const t=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(t,o),t})(o,e,n)))})(t.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):o("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),v.zonosController=s,e("Zonos controller injected!")},b.injectScript=({cdnType:n,isModule:t,theRestUrl:s})=>{const r=`${v.getZonosUrl(n)}/${s}`;if(document.querySelector(`script[src="${r}"]`))return void e(`Zonos script "${r}" already exists in the document`,"warn");const i=document.head||document.body,c=document.createElement("script");t?c.type="module":c.noModule=!0,c.src=r,c.crossOrigin="anonymous",c.onerror=()=>{o(`Failed to load ${c.src}`);const e=l(n);e&&v.injectScript({cdnType:e,isModule:t,theRestUrl:s})},i.appendChild(c)},b.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return j;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.136";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.136";case"vercel":return z}};return v.isNpm&&a()||n()},b.injectZonosCdn=()=>{v.injectScript({cdnType:i,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),v.injectScript({cdnType:i,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},b.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const t=v.getZonosUrl(e),s=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${z}/`,s.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${n}`,i.onerror=()=>{o(`Failed to load ${i.href}`);const t=l(e);t&&v.injectStylesheet({cdnType:t,theRestUrl:n})},s.appendChild(i)},b.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(v.injectStylesheet({cdnType:i,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},b.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${S}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&!O.test(o.href))return o}return null})())return void e("Inter font already injected","warn");const n=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=S,n.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${S}/inter/inter.css`,n.appendChild(t),e("Zonos font injected!")},b.setupGoogleFont=e=>{var n;null===(n=v.zonosController)||void 0===n||n.setupGoogleFont(e)},b.injectSupportGoogleFont=n=>{var o;e(`[FONT] injecting ${n}`);const t=null===(o=n.match(/family=(.*?):/))||void 0===o?void 0:o[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${g}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=g,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${n}"]`))return void e(`[FONT] ${t} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=n,s.appendChild(r),e(`[FONT] ${t} font injected!`)};export{b as Zonos}
|
|
1
|
+
import{l as e,h as n,a as t}from"./p-860e46ab.js";import{s as o,c as s}from"./p-b7307c61.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-b7307c61.js";const r=["jsdelivr","cdnjs","unpkg","vercel"],i="jsdelivr",l=e=>{const n=r.indexOf(e);return r[n+1]||null},a=()=>{const n=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||n)return null;const t=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.138.js.zonos.com";if(!t&&(o.includes("test.")||o.includes("test-")))return o;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const s=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${s}' for loading elements script`,"warn"),fetch(s).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${s}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,t=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),s},u="https://js.stripe.com/v3",m=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,w="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let p=null;const f=Promise.resolve().then((()=>{return e=null,null!==p||(p=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(w),window.Stripe)n(window.Stripe);else try{let s=(()=>{const e=document.querySelectorAll(`script[src^="${u}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&m.test(t.src))return t}return null})();s&&e?console.warn(w):s||(s=(e=>{const n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${u}${n}`;const s=document.head||document.body;return s?(s.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==s||s.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==s||s.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),p;var e}));let h=!1;var v;f.catch((e=>{h||console.warn(e)}));const y=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),o=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:o,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?n:null})(),z="https://v1.3.138.js.zonos.com",j=y||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.138",S="https://rsms.me",g="https://fonts.googleapis.com",O=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class b{}v=b,b.doneInit=!1,b.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),b.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),b._paypalMockResponse=null,b.isBigCommerce=!1,b.releaseDate="1733759888389",b.isLegacyCheckout=!1,b.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",b.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),b.isNpm=!0,b.zonosQaUrl=null,b.zonosQaUrlApi=null,b.version="v1.3.138",b.modeAlerted=!1,b.cartData=null,b.paypal=null,b.getCurrentTimestamp=()=>(new Date).getTime(),b.zonosController=null,b.init=async r=>{const{appearance:i,checkoutSettings:c,currencyConverter:l,helloSettings:d,onCountryChange:u,overrideCurrencyFormat:m,storeId:w,zonosApiKey:p}=r;if(v.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),v.doneInit)return;if(e(`====== ZONOS DEBUG MODE: on (${v.version}) ======`),v.zonosApiKey=p,v.storeId=w,v.isNpm){e("====== ZONOS LOADING FROM NPM ======");const s=a();if(s&&!window.isZonosPreview){e(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${s} ======`,"info");const n=document.createElement("script");return n.src=`${s}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=v.isNpm,window.Zonos.isBigCommerce=v.isBigCommerce,window.Zonos.isLegacyCheckout=v.isLegacyCheckout,window.Zonos.init(r)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${s}`)})),void(window.isZonosPreview=!0)}if(!p&&!v.cartId)return void t("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!v.cartData&&v.cartId){e("Initialize cart data");const n=await o(v.cartId);if(!n)return void t("Failed to get cart data");v.cartData=n.cartData,v.zonosApiKey=n.zonosApiKey}const i=await(async()=>{if(!window.location.search.includes("zonosTestMode=1")||!window.Zonos.zonosApiKey)return null;if(e("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return e("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:o,json:s}=await n("/api/get-test-public-credential");if(o.length||!s)return t("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o),null;const r=s.publicCredential;return r?(e(`[ZONOS - loadZonos] Retrieve new test public token ${r}`,"info"),r):(t("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();i&&(v.zonosApiKey=i)}const f=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(v.cartId&&v.cartData||f){e("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const n=document.createElement("button");n.style.display="none",n.id=`${s}`,document.body.appendChild(n)}e("init zonos"),v.injectZonosCdn(),v.injectZonosCss(),v.injectFonts(),v.injectController({config:{appearance:i,checkoutSettings:c,currencyConverter:l,helloSettings:d,onCountryChange:u,overrideCurrencyFormat:m}}),v.doneInit=!0},b.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},b.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},b.showNotification=e=>{var n;null===(n=v.zonosController)||void 0===n||n.showNotification(e)},b.updateOrganizationName=e=>{var n;null===(n=v.zonosController)||void 0===n||n.updateOrganizationName(e)},b.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:t,placeOrderButtonSelector:o})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&o){const n=document.querySelectorAll(o),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&t&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},b.injectController=({config:n})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=n.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const e=n.checkoutSettings.placeOrderButtonSelector;v.disablePlaceOrderButtons({config:n,disable:!0,placeOrderButtonSelector:e}),new MutationObserver((()=>{v.disablePlaceOrderButtons({config:n,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=n,s.zonosApiKey=v.zonosApiKey||"",s.addEventListener("stripeInitEvent",(async n=>{const{detail:o}=n;e("loading Stripe");const r=await(async(...e)=>{h=!0;const n=Date.now();return f.then((t=>((e,n,t)=>{if(null===e)return null;const o=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(o,t),o})(t,e,n)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),v.zonosController=s,e("Zonos controller injected!")},b.injectScript=({cdnType:n,isModule:o,theRestUrl:s})=>{const r=`${v.getZonosUrl(n)}/${s}`;if(document.querySelector(`script[src="${r}"]`))return void e(`Zonos script "${r}" already exists in the document`,"warn");const i=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=r,c.crossOrigin="anonymous",c.onerror=()=>{t(`Failed to load ${c.src}`);const e=l(n);e&&v.injectScript({cdnType:e,isModule:o,theRestUrl:s})},i.appendChild(c)},b.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return j;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.138";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.138";case"vercel":return z}};return v.isNpm&&a()||n()},b.injectZonosCdn=()=>{v.injectScript({cdnType:i,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),v.injectScript({cdnType:i,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},b.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const o=v.getZonosUrl(e),s=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${z}/`,s.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${o}/${n}`,i.onerror=()=>{t(`Failed to load ${i.href}`);const o=l(e);o&&v.injectStylesheet({cdnType:o,theRestUrl:n})},s.appendChild(i)},b.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(v.injectStylesheet({cdnType:i,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},b.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${S}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!O.test(t.href))return t}return null})())return void e("Inter font already injected","warn");const n=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=S,n.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${S}/inter/inter.css`,n.appendChild(o),e("Zonos font injected!")},b.setupGoogleFont=e=>{var n;null===(n=v.zonosController)||void 0===n||n.setupGoogleFont(e)},b.injectSupportGoogleFont=n=>{var t;e(`[FONT] injecting ${n}`);const o=null===(t=n.match(/family=(.*?):/))||void 0===t?void 0:t[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${g}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=g,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${n}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=n,s.appendChild(r),e(`[FONT] ${o} font injected!`)};export{b as Zonos}
|