@zonos/elements 1.3.172 → 1.3.173
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-d91d9507.js → cart-d9052930.js} +8 -0
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-82841277.js → paypal-31477331.js} +5 -1
- package/dist/cjs/zonos-address_7.cjs.entry.js +12 -3
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +12 -8
- package/dist/cjs/zonos-checkout.cjs.entry.js +4 -4
- 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-empty-state-payment_4.cjs.entry.js +19 -3
- 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/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +10 -6
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +2 -2
- package/dist/collection/components/store/checkout/paypal.js +5 -0
- package/dist/collection/components/store/checkout/stripe.js +7 -0
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +12 -2
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +22 -2
- package/dist/collection/components/utils/api/trackConversionEvent.js +1 -0
- package/dist/collection/types/generated/graphql.frontend.types.js +9 -0
- package/dist/collection/types/generated/graphql.internal.types.js +9 -0
- package/dist/esm/{cart-52e208cc.js → cart-fff4f4a4.js} +8 -0
- package/dist/esm/index.js +7 -7
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-2e1c560e.js → paypal-087fbd16.js} +5 -1
- package/dist/esm/zonos-address_7.entry.js +12 -3
- package/dist/esm/zonos-cart-items_13.entry.js +12 -8
- package/dist/esm/zonos-checkout.entry.js +4 -4
- 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-empty-state-payment_4.entry.js +19 -3
- 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-es5/{cart-52e208cc.js → cart-fff4f4a4.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-2e1c560e.js → paypal-087fbd16.js} +2 -2
- 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-empty-state-payment_4.entry.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/scripts/index.d.ts +1 -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/components/stripe/zonos-address/zonos-address.d.ts +4 -0
- package/dist/types/components/stripe/zonos-payment/zonos-payment.d.ts +3 -0
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/types/ConversionEvent.d.ts +2 -1
- package/dist/types/types/generated/graphql.frontend.types.d.ts +93 -1
- package/dist/types/types/generated/graphql.frontend.types.ts +107 -1
- package/dist/types/types/generated/graphql.internal.types.d.ts +32 -0
- package/dist/types/types/generated/graphql.internal.types.ts +49 -0
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-9a10a63b.system.entry.js → p-0078362c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-221d4f15.system.entry.js → p-033817e3.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1e3e4e22.entry.js → p-0db19b02.entry.js} +1 -1
- package/dist/zonos-elements/p-1b5a2714.system.entry.js +1 -0
- package/dist/zonos-elements/{p-eb716dcc.system.entry.js → p-1be7b435.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-91a7ca64.system.entry.js → p-31ce9143.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-36c35a07.system.js → p-38f6f6fd.system.js} +1 -1
- package/dist/zonos-elements/{p-68304407.entry.js → p-407a96d2.entry.js} +1 -1
- package/dist/zonos-elements/{p-ba604bc4.entry.js → p-427c2766.entry.js} +1 -1
- package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
- package/dist/zonos-elements/{p-aa754137.system.entry.js → p-514431e9.system.entry.js} +1 -1
- package/dist/zonos-elements/p-5275b7ca.system.entry.js +1 -0
- package/dist/zonos-elements/p-5edc11be.system.entry.js +1 -0
- package/dist/zonos-elements/{p-c719434a.entry.js → p-67ca7373.entry.js} +1 -1
- package/dist/zonos-elements/{p-14bd4766.entry.js → p-73a7b89b.entry.js} +1 -1
- package/dist/zonos-elements/{p-7de48475.system.js → p-759a654a.system.js} +1 -1
- package/dist/zonos-elements/{p-a61ef92f.entry.js → p-7862da71.entry.js} +1 -1
- package/dist/zonos-elements/p-78b81404.system.js +17 -0
- package/dist/zonos-elements/p-8b33c3b7.entry.js +1 -0
- package/dist/zonos-elements/{p-048e4b38.system.entry.js → p-a83370c6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-10a9edf6.entry.js → p-a9d7746a.entry.js} +1 -1
- package/dist/zonos-elements/{p-aea22783.system.entry.js → p-ada6e691.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2d2c70a3.js → p-bfd6e156.js} +1 -1
- package/dist/zonos-elements/p-cbd2bd33.js +17 -0
- package/dist/zonos-elements/p-ef9fdf45.entry.js +1 -0
- package/dist/zonos-elements/p-f6c0da8b.entry.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-0ee42be2.system.js +0 -17
- package/dist/zonos-elements/p-246c3b28.entry.js +0 -1
- package/dist/zonos-elements/p-2b8c5669.system.entry.js +0 -1
- package/dist/zonos-elements/p-588ac238.entry.js +0 -1
- package/dist/zonos-elements/p-85d2da79.system.entry.js +0 -1
- package/dist/zonos-elements/p-a08fad84.entry.js +0 -1
- package/dist/zonos-elements/p-bbf9dbe4.js +0 -17
- package/dist/zonos-elements/p-e34c0f83.system.entry.js +0 -1
|
@@ -535,6 +535,89 @@ export declare const promptBulkJobStatusEnum: {
|
|
|
535
535
|
readonly Queued: "queued";
|
|
536
536
|
};
|
|
537
537
|
export type Prompt_BulkJobStatus_Enum = (typeof promptBulkJobStatusEnum)[keyof typeof promptBulkJobStatusEnum];
|
|
538
|
+
export type AnalyticConversionEventQuery = {
|
|
539
|
+
cartCreate: {
|
|
540
|
+
aggregate: {
|
|
541
|
+
avg: {
|
|
542
|
+
stepSeconds: number | null;
|
|
543
|
+
} | null;
|
|
544
|
+
count: number;
|
|
545
|
+
} | null;
|
|
546
|
+
nodes: Array<{
|
|
547
|
+
organizationId: string;
|
|
548
|
+
}>;
|
|
549
|
+
};
|
|
550
|
+
customerInfoCompleted: {
|
|
551
|
+
aggregate: {
|
|
552
|
+
avg: {
|
|
553
|
+
stepSeconds: number | null;
|
|
554
|
+
} | null;
|
|
555
|
+
count: number;
|
|
556
|
+
} | null;
|
|
557
|
+
nodes: Array<{
|
|
558
|
+
organizationId: string;
|
|
559
|
+
}>;
|
|
560
|
+
};
|
|
561
|
+
orderCompleted: {
|
|
562
|
+
aggregate: {
|
|
563
|
+
avg: {
|
|
564
|
+
stepSeconds: number | null;
|
|
565
|
+
} | null;
|
|
566
|
+
count: number;
|
|
567
|
+
} | null;
|
|
568
|
+
nodes: Array<{
|
|
569
|
+
organizationId: string;
|
|
570
|
+
}>;
|
|
571
|
+
};
|
|
572
|
+
paymentInfoCompleted: {
|
|
573
|
+
aggregate: {
|
|
574
|
+
avg: {
|
|
575
|
+
stepSeconds: number | null;
|
|
576
|
+
} | null;
|
|
577
|
+
count: number;
|
|
578
|
+
} | null;
|
|
579
|
+
nodes: Array<{
|
|
580
|
+
organizationId: string;
|
|
581
|
+
}>;
|
|
582
|
+
};
|
|
583
|
+
shippingInfoCompleted: {
|
|
584
|
+
aggregate: {
|
|
585
|
+
avg: {
|
|
586
|
+
stepSeconds: number | null;
|
|
587
|
+
} | null;
|
|
588
|
+
count: number;
|
|
589
|
+
} | null;
|
|
590
|
+
nodes: Array<{
|
|
591
|
+
organizationId: string;
|
|
592
|
+
}>;
|
|
593
|
+
};
|
|
594
|
+
};
|
|
595
|
+
export type MetricAllApiPathsQuery = {
|
|
596
|
+
usage_scriptLoadEvent: Array<{
|
|
597
|
+
href: string;
|
|
598
|
+
}>;
|
|
599
|
+
};
|
|
600
|
+
export type MetricApiPathSpeedQuery = {
|
|
601
|
+
usage_scriptLoadEvent_aggregate: {
|
|
602
|
+
aggregate: {
|
|
603
|
+
avg: {
|
|
604
|
+
loadTimeClientMiddleware: number | null;
|
|
605
|
+
loadTimeInternal: number | null;
|
|
606
|
+
} | null;
|
|
607
|
+
count: number;
|
|
608
|
+
max: {
|
|
609
|
+
createdAt: string | null;
|
|
610
|
+
loadTimeClientMiddleware: number | null;
|
|
611
|
+
loadTimeInternal: number | null;
|
|
612
|
+
} | null;
|
|
613
|
+
min: {
|
|
614
|
+
createdAt: string | null;
|
|
615
|
+
loadTimeClientMiddleware: number | null;
|
|
616
|
+
loadTimeInternal: number | null;
|
|
617
|
+
} | null;
|
|
618
|
+
} | null;
|
|
619
|
+
};
|
|
620
|
+
};
|
|
538
621
|
export type FailToGetQuoteErrorsQuery = {
|
|
539
622
|
error_event_aggregate: {
|
|
540
623
|
aggregate: {
|
|
@@ -559,7 +642,7 @@ export type FailToGetQuoteErrorsQuery = {
|
|
|
559
642
|
};
|
|
560
643
|
export type LocaleCountryMessagesQuery = {
|
|
561
644
|
locale_countryCodesPage: Array<{
|
|
562
|
-
countryCodes: Array<string
|
|
645
|
+
countryCodes: Array<string> | null;
|
|
563
646
|
countryCodesPageMessageLinks: Array<{
|
|
564
647
|
id: number;
|
|
565
648
|
message: {
|
|
@@ -794,6 +877,9 @@ export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionW
|
|
|
794
877
|
allSettings(variables?: {
|
|
795
878
|
[x: string]: never;
|
|
796
879
|
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<AllSettingsQuery>;
|
|
880
|
+
analyticConversionEvent(variables?: {
|
|
881
|
+
[x: string]: never;
|
|
882
|
+
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<AnalyticConversionEventQuery>;
|
|
797
883
|
cleanupTestErrors(variables?: {
|
|
798
884
|
[x: string]: never;
|
|
799
885
|
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<CleanupTestErrorsMutation>;
|
|
@@ -863,6 +949,12 @@ export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionW
|
|
|
863
949
|
localeCountryMessages(variables?: {
|
|
864
950
|
[x: string]: never;
|
|
865
951
|
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<LocaleCountryMessagesQuery>;
|
|
952
|
+
metricAllApiPaths(variables?: {
|
|
953
|
+
[x: string]: never;
|
|
954
|
+
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<MetricAllApiPathsQuery>;
|
|
955
|
+
metricApiPathSpeed(variables?: {
|
|
956
|
+
[x: string]: never;
|
|
957
|
+
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<MetricApiPathSpeedQuery>;
|
|
866
958
|
storeVersionSetting(variables?: {
|
|
867
959
|
[x: string]: never;
|
|
868
960
|
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<StoreVersionSettingQuery>;
|
|
@@ -541,6 +541,70 @@ export const promptBulkJobStatusEnum = {
|
|
|
541
541
|
export type Prompt_BulkJobStatus_Enum =
|
|
542
542
|
(typeof promptBulkJobStatusEnum)[keyof typeof promptBulkJobStatusEnum];
|
|
543
543
|
|
|
544
|
+
export type AnalyticConversionEventQuery = {
|
|
545
|
+
cartCreate: {
|
|
546
|
+
aggregate: {
|
|
547
|
+
avg: { stepSeconds: number | null } | null;
|
|
548
|
+
count: number;
|
|
549
|
+
} | null;
|
|
550
|
+
nodes: Array<{ organizationId: string }>;
|
|
551
|
+
};
|
|
552
|
+
customerInfoCompleted: {
|
|
553
|
+
aggregate: {
|
|
554
|
+
avg: { stepSeconds: number | null } | null;
|
|
555
|
+
count: number;
|
|
556
|
+
} | null;
|
|
557
|
+
nodes: Array<{ organizationId: string }>;
|
|
558
|
+
};
|
|
559
|
+
orderCompleted: {
|
|
560
|
+
aggregate: {
|
|
561
|
+
avg: { stepSeconds: number | null } | null;
|
|
562
|
+
count: number;
|
|
563
|
+
} | null;
|
|
564
|
+
nodes: Array<{ organizationId: string }>;
|
|
565
|
+
};
|
|
566
|
+
paymentInfoCompleted: {
|
|
567
|
+
aggregate: {
|
|
568
|
+
avg: { stepSeconds: number | null } | null;
|
|
569
|
+
count: number;
|
|
570
|
+
} | null;
|
|
571
|
+
nodes: Array<{ organizationId: string }>;
|
|
572
|
+
};
|
|
573
|
+
shippingInfoCompleted: {
|
|
574
|
+
aggregate: {
|
|
575
|
+
avg: { stepSeconds: number | null } | null;
|
|
576
|
+
count: number;
|
|
577
|
+
} | null;
|
|
578
|
+
nodes: Array<{ organizationId: string }>;
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
export type MetricAllApiPathsQuery = {
|
|
583
|
+
usage_scriptLoadEvent: Array<{ href: string }>;
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
export type MetricApiPathSpeedQuery = {
|
|
587
|
+
usage_scriptLoadEvent_aggregate: {
|
|
588
|
+
aggregate: {
|
|
589
|
+
avg: {
|
|
590
|
+
loadTimeClientMiddleware: number | null;
|
|
591
|
+
loadTimeInternal: number | null;
|
|
592
|
+
} | null;
|
|
593
|
+
count: number;
|
|
594
|
+
max: {
|
|
595
|
+
createdAt: string | null;
|
|
596
|
+
loadTimeClientMiddleware: number | null;
|
|
597
|
+
loadTimeInternal: number | null;
|
|
598
|
+
} | null;
|
|
599
|
+
min: {
|
|
600
|
+
createdAt: string | null;
|
|
601
|
+
loadTimeClientMiddleware: number | null;
|
|
602
|
+
loadTimeInternal: number | null;
|
|
603
|
+
} | null;
|
|
604
|
+
} | null;
|
|
605
|
+
};
|
|
606
|
+
};
|
|
607
|
+
|
|
544
608
|
export type FailToGetQuoteErrorsQuery = {
|
|
545
609
|
error_event_aggregate: {
|
|
546
610
|
aggregate: { count: number } | null;
|
|
@@ -567,7 +631,7 @@ export type FailToGetQuoteErrorsQuery = {
|
|
|
567
631
|
|
|
568
632
|
export type LocaleCountryMessagesQuery = {
|
|
569
633
|
locale_countryCodesPage: Array<{
|
|
570
|
-
countryCodes: Array<string
|
|
634
|
+
countryCodes: Array<string> | null;
|
|
571
635
|
countryCodesPageMessageLinks: Array<{
|
|
572
636
|
id: number;
|
|
573
637
|
message: {
|
|
@@ -817,6 +881,20 @@ export function getSdk(
|
|
|
817
881
|
'query',
|
|
818
882
|
);
|
|
819
883
|
},
|
|
884
|
+
analyticConversionEvent(
|
|
885
|
+
variables?: { [x: string]: never },
|
|
886
|
+
requestHeaders?: GraphQLClientRequestHeaders,
|
|
887
|
+
): Promise<AnalyticConversionEventQuery> {
|
|
888
|
+
return withWrapper(
|
|
889
|
+
wrappedRequestHeaders =>
|
|
890
|
+
client.request<AnalyticConversionEventQuery>('', variables, {
|
|
891
|
+
...requestHeaders,
|
|
892
|
+
...wrappedRequestHeaders,
|
|
893
|
+
}),
|
|
894
|
+
'analyticConversionEvent',
|
|
895
|
+
'query',
|
|
896
|
+
);
|
|
897
|
+
},
|
|
820
898
|
cleanupTestErrors(
|
|
821
899
|
variables?: { [x: string]: never },
|
|
822
900
|
requestHeaders?: GraphQLClientRequestHeaders,
|
|
@@ -1142,6 +1220,34 @@ export function getSdk(
|
|
|
1142
1220
|
'query',
|
|
1143
1221
|
);
|
|
1144
1222
|
},
|
|
1223
|
+
metricAllApiPaths(
|
|
1224
|
+
variables?: { [x: string]: never },
|
|
1225
|
+
requestHeaders?: GraphQLClientRequestHeaders,
|
|
1226
|
+
): Promise<MetricAllApiPathsQuery> {
|
|
1227
|
+
return withWrapper(
|
|
1228
|
+
wrappedRequestHeaders =>
|
|
1229
|
+
client.request<MetricAllApiPathsQuery>('', variables, {
|
|
1230
|
+
...requestHeaders,
|
|
1231
|
+
...wrappedRequestHeaders,
|
|
1232
|
+
}),
|
|
1233
|
+
'metricAllApiPaths',
|
|
1234
|
+
'query',
|
|
1235
|
+
);
|
|
1236
|
+
},
|
|
1237
|
+
metricApiPathSpeed(
|
|
1238
|
+
variables?: { [x: string]: never },
|
|
1239
|
+
requestHeaders?: GraphQLClientRequestHeaders,
|
|
1240
|
+
): Promise<MetricApiPathSpeedQuery> {
|
|
1241
|
+
return withWrapper(
|
|
1242
|
+
wrappedRequestHeaders =>
|
|
1243
|
+
client.request<MetricApiPathSpeedQuery>('', variables, {
|
|
1244
|
+
...requestHeaders,
|
|
1245
|
+
...wrappedRequestHeaders,
|
|
1246
|
+
}),
|
|
1247
|
+
'metricApiPathSpeed',
|
|
1248
|
+
'query',
|
|
1249
|
+
);
|
|
1250
|
+
},
|
|
1145
1251
|
storeVersionSetting(
|
|
1146
1252
|
variables?: { [x: string]: never },
|
|
1147
1253
|
requestHeaders?: GraphQLClientRequestHeaders,
|
|
@@ -1808,6 +1808,7 @@ export type InvoiceStatus = (typeof invoiceStatus)[keyof typeof invoiceStatus];
|
|
|
1808
1808
|
export declare const itemAmountTargetType: {
|
|
1809
1809
|
readonly MerchantBase: "MERCHANT_BASE";
|
|
1810
1810
|
readonly MerchantProvided: "MERCHANT_PROVIDED";
|
|
1811
|
+
readonly ShopperPresented: "SHOPPER_PRESENTED";
|
|
1811
1812
|
readonly ZonosBase: "ZONOS_BASE";
|
|
1812
1813
|
};
|
|
1813
1814
|
export type ItemAmountTargetType = (typeof itemAmountTargetType)[keyof typeof itemAmountTargetType];
|
|
@@ -1981,6 +1982,7 @@ export type LabelTermType = (typeof labelTermType)[keyof typeof labelTermType];
|
|
|
1981
1982
|
export declare const landedCostAdjustmentType: {
|
|
1982
1983
|
readonly CartTotal: "CART_TOTAL";
|
|
1983
1984
|
readonly Item: "ITEM";
|
|
1985
|
+
readonly OrderTotal: "ORDER_TOTAL";
|
|
1984
1986
|
readonly PromoCode: "PROMO_CODE";
|
|
1985
1987
|
readonly Shipping: "SHIPPING";
|
|
1986
1988
|
};
|
|
@@ -2655,6 +2657,7 @@ export type ShipmentConsolidationStatus = (typeof shipmentConsolidationStatus)[k
|
|
|
2655
2657
|
export declare const shipmentRatingAmountTargetType: {
|
|
2656
2658
|
readonly MerchantBase: "MERCHANT_BASE";
|
|
2657
2659
|
readonly MerchantProvided: "MERCHANT_PROVIDED";
|
|
2660
|
+
readonly ShopperPresented: "SHOPPER_PRESENTED";
|
|
2658
2661
|
readonly ZonosBase: "ZONOS_BASE";
|
|
2659
2662
|
};
|
|
2660
2663
|
export type ShipmentRatingAmountTargetType = (typeof shipmentRatingAmountTargetType)[keyof typeof shipmentRatingAmountTargetType];
|
|
@@ -3071,6 +3074,29 @@ export type CheckoutCustomerProfileAuthenticateMutation = {
|
|
|
3071
3074
|
phone: string | null;
|
|
3072
3075
|
};
|
|
3073
3076
|
};
|
|
3077
|
+
export type OrganizationByStoreIdQuery = {
|
|
3078
|
+
organizations: {
|
|
3079
|
+
edges: Array<{
|
|
3080
|
+
node: {
|
|
3081
|
+
id: string;
|
|
3082
|
+
name: string;
|
|
3083
|
+
} | null;
|
|
3084
|
+
}>;
|
|
3085
|
+
} | null;
|
|
3086
|
+
};
|
|
3087
|
+
export type OrganizationsQuery = {
|
|
3088
|
+
organizations: {
|
|
3089
|
+
edges: Array<{
|
|
3090
|
+
node: {
|
|
3091
|
+
id: string;
|
|
3092
|
+
name: string;
|
|
3093
|
+
references: {
|
|
3094
|
+
storeId: number | null;
|
|
3095
|
+
} | null;
|
|
3096
|
+
} | null;
|
|
3097
|
+
}>;
|
|
3098
|
+
} | null;
|
|
3099
|
+
};
|
|
3074
3100
|
export type CartCalculateLandedCostMutation = {
|
|
3075
3101
|
cartWorkflow: {
|
|
3076
3102
|
id: string;
|
|
@@ -4423,6 +4449,12 @@ export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionW
|
|
|
4423
4449
|
organization(variables?: {
|
|
4424
4450
|
[x: string]: never;
|
|
4425
4451
|
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<OrganizationQuery>;
|
|
4452
|
+
organizationByStoreId(variables?: {
|
|
4453
|
+
[x: string]: never;
|
|
4454
|
+
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<OrganizationByStoreIdQuery>;
|
|
4455
|
+
organizations(variables?: {
|
|
4456
|
+
[x: string]: never;
|
|
4457
|
+
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<OrganizationsQuery>;
|
|
4426
4458
|
partyInfo(variables?: {
|
|
4427
4459
|
[x: string]: never;
|
|
4428
4460
|
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<PartyInfoQuery>;
|
|
@@ -2153,6 +2153,7 @@ export type InvoiceStatus = (typeof invoiceStatus)[keyof typeof invoiceStatus];
|
|
|
2153
2153
|
export const itemAmountTargetType = {
|
|
2154
2154
|
MerchantBase: 'MERCHANT_BASE',
|
|
2155
2155
|
MerchantProvided: 'MERCHANT_PROVIDED',
|
|
2156
|
+
ShopperPresented: 'SHOPPER_PRESENTED',
|
|
2156
2157
|
ZonosBase: 'ZONOS_BASE',
|
|
2157
2158
|
} as const;
|
|
2158
2159
|
|
|
@@ -2380,6 +2381,7 @@ export type LabelTermType = (typeof labelTermType)[keyof typeof labelTermType];
|
|
|
2380
2381
|
export const landedCostAdjustmentType = {
|
|
2381
2382
|
CartTotal: 'CART_TOTAL',
|
|
2382
2383
|
Item: 'ITEM',
|
|
2384
|
+
OrderTotal: 'ORDER_TOTAL',
|
|
2383
2385
|
PromoCode: 'PROMO_CODE',
|
|
2384
2386
|
Shipping: 'SHIPPING',
|
|
2385
2387
|
} as const;
|
|
@@ -3244,6 +3246,7 @@ export type ShipmentConsolidationStatus =
|
|
|
3244
3246
|
export const shipmentRatingAmountTargetType = {
|
|
3245
3247
|
MerchantBase: 'MERCHANT_BASE',
|
|
3246
3248
|
MerchantProvided: 'MERCHANT_PROVIDED',
|
|
3249
|
+
ShopperPresented: 'SHOPPER_PRESENTED',
|
|
3247
3250
|
ZonosBase: 'ZONOS_BASE',
|
|
3248
3251
|
} as const;
|
|
3249
3252
|
|
|
@@ -3768,6 +3771,24 @@ export type CheckoutCustomerProfileAuthenticateMutation = {
|
|
|
3768
3771
|
};
|
|
3769
3772
|
};
|
|
3770
3773
|
|
|
3774
|
+
export type OrganizationByStoreIdQuery = {
|
|
3775
|
+
organizations: {
|
|
3776
|
+
edges: Array<{ node: { id: string; name: string } | null }>;
|
|
3777
|
+
} | null;
|
|
3778
|
+
};
|
|
3779
|
+
|
|
3780
|
+
export type OrganizationsQuery = {
|
|
3781
|
+
organizations: {
|
|
3782
|
+
edges: Array<{
|
|
3783
|
+
node: {
|
|
3784
|
+
id: string;
|
|
3785
|
+
name: string;
|
|
3786
|
+
references: { storeId: number | null } | null;
|
|
3787
|
+
} | null;
|
|
3788
|
+
}>;
|
|
3789
|
+
} | null;
|
|
3790
|
+
};
|
|
3791
|
+
|
|
3771
3792
|
export type CartCalculateLandedCostMutation = {
|
|
3772
3793
|
cartWorkflow: {
|
|
3773
3794
|
id: string;
|
|
@@ -5342,6 +5363,34 @@ export function getSdk(
|
|
|
5342
5363
|
'query',
|
|
5343
5364
|
);
|
|
5344
5365
|
},
|
|
5366
|
+
organizationByStoreId(
|
|
5367
|
+
variables?: { [x: string]: never },
|
|
5368
|
+
requestHeaders?: GraphQLClientRequestHeaders,
|
|
5369
|
+
): Promise<OrganizationByStoreIdQuery> {
|
|
5370
|
+
return withWrapper(
|
|
5371
|
+
wrappedRequestHeaders =>
|
|
5372
|
+
client.request<OrganizationByStoreIdQuery>('', variables, {
|
|
5373
|
+
...requestHeaders,
|
|
5374
|
+
...wrappedRequestHeaders,
|
|
5375
|
+
}),
|
|
5376
|
+
'organizationByStoreId',
|
|
5377
|
+
'query',
|
|
5378
|
+
);
|
|
5379
|
+
},
|
|
5380
|
+
organizations(
|
|
5381
|
+
variables?: { [x: string]: never },
|
|
5382
|
+
requestHeaders?: GraphQLClientRequestHeaders,
|
|
5383
|
+
): Promise<OrganizationsQuery> {
|
|
5384
|
+
return withWrapper(
|
|
5385
|
+
wrappedRequestHeaders =>
|
|
5386
|
+
client.request<OrganizationsQuery>('', variables, {
|
|
5387
|
+
...requestHeaders,
|
|
5388
|
+
...wrappedRequestHeaders,
|
|
5389
|
+
}),
|
|
5390
|
+
'organizations',
|
|
5391
|
+
'query',
|
|
5392
|
+
);
|
|
5393
|
+
},
|
|
5345
5394
|
partyInfo(
|
|
5346
5395
|
variables?: { [x: string]: never },
|
|
5347
5396
|
requestHeaders?: GraphQLClientRequestHeaders,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg color="var(--zonos-elements-
|
|
1
|
+
<svg color="var(--zonos-elements-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--zonos-elements-gray-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,a as n,l as o,h as t,b as r}from"./p-839448c3.js";import{s as i,c as l}from"./p-1c488ecf.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-1c488ecf.js";export{c as countryRequireTaxId,s as shipToTaxIdLabels}from"./p-5bd927f2.js";const a=["jsdelivr","cdnjs","unpkg","vercel"],u="jsdelivr",m=e=>{const n=a.indexOf(e);return a[n+1]||null},p=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const n=(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.172.js.zonos.com";if(!n&&(t.includes("test.")||t.includes("test-")))return t;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const s=`https://${n}.preview.js.zonos.com`;return o(`[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},w="https://js.stripe.com/v3",f=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,h="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let v=null;const y=Promise.resolve().then((()=>{return e=null,null!==v||(v=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(h),window.Stripe)n(window.Stripe);else try{let t=(()=>{const e=document.querySelectorAll(`script[src^="${w}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&f.test(o.src))return o}return null})();t&&e?console.warn(h):t||(t=(e=>{const n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${w}${n}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(r("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==t||t.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==t||t.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),v;var e}));let z=!1;var g;y.catch((e=>{z||console.warn(e)}));const j=(()=>{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})(),S="https://v1.3.172.js.zonos.com",O=j||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.172",b="https://fonts.googleapis.com",k=/^https:\/\/fonts\.googleapis\.com/;class ${}g=$,$.doneInit=!1,$.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),$.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),$._paypalMockResponse=null,$.isBigCommerce=!1,$.releaseDate="1742308902831",$.isLegacyCheckout=!1,$.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",$.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),$.isNpm=!0,$.zonosQaUrl=null,$.zonosQaUrlApi=null,$.version="v1.3.172",$.modeAlerted=!1,$.cartData=null,$.paypal=null,$.getCurrentTimestamp=()=>(new Date).getTime(),$.zonosController=null,$.loadTimeApiInfoList=[],$.logIntervalId=null,$.init=async s=>{const{appearance:c,checkoutSettings:d,currencyConverter:a,helloSettings:u,onCountryChange:m,overrideCurrencyFormat:w,storeId:f,zonosApiKey:h}=s;if(g.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),g.doneInit)return;if(o(`====== ZONOS DEBUG MODE: on (${g.version}) ======`),g.zonosApiKey=h,g.storeId=f,g.isNpm){o("====== ZONOS LOADING FROM NPM ======");const c=p();if(c&&!window.isZonosPreview){o(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${c} ======`,"info");const e=document.createElement("script");return e.src=`${c}/dist/scripts/zonos.js`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=g.isNpm,window.Zonos.isBigCommerce=g.isBigCommerce,window.Zonos.isLegacyCheckout=g.isLegacyCheckout,window.Zonos.init(s)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${c}`)})),void(window.isZonosPreview=!0)}if(!h&&!g.cartId)return void r("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!g.cartData&&g.cartId){o("Initialize cart data");const e=await i(g.cartId);if(!e)return void r("Failed to get cart data");g.cartData=e.cartData,g.zonosApiKey=e.zonosApiKey}const d=await(async()=>{const s=e(),i=n();if(!s&&!i||!window.Zonos.zonosApiKey)return null;if(o("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return o("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:c,json:d}=await t("/api/get-test-public-credential");if(c.length||!d)return r("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",c),null;const l=d.publicCredential;return l?(o(`[ZONOS - loadZonos] Retrieve new test public token ${l}`,"info"),l):(r("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();d&&(g.zonosApiKey=d)}const v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(g.cartId&&g.cartData||v){o("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id=`${l}`,document.body.appendChild(e)}o("init zonos"),g.restoreNativeBrowserFunctions(),g.injectCustomScriptForHostedCheckout(),g.injectZonosCdn(),g.injectZonosCss(),g.injectFonts(),g.injectController({config:{appearance:c,checkoutSettings:d,currencyConverter:a,helloSettings:u,onCountryChange:m,overrideCurrencyFormat:w}}),g.doneInit=!0},$.injectCustomScriptForHostedCheckout=()=>{const e=g.cartData,n=(null==e?void 0:e.metadata)||[],t=n.find((e=>"customHeaderScript"===e.key)),s=n.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(t||s)){if(t){o("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(s){o("Injecting custom footer script");const e=document.createElement("script");e.textContent=s.value,document.body.appendChild(e)}}else o("Skip injecting custom script for hosted checkout","info",{footerScript:s,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},$.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},$.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},$.showNotification=e=>{var n;null===(n=g.zonosController)||void 0===n||n.showNotification(e)},$.updateOrganizationName=e=>{var n;null===(n=g.zonosController)||void 0===n||n.updateOrganizationName(e)},$.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)}},$.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const n="zonos---native-browser";let o=document.querySelector(`iframe#${n}`);o||(o=document.createElement("iframe"),o.id=n,o.style.display="none",o.style.opacity="0",o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",o.style.width="1px",o.style.height="1px",o.style.border="none",o.style.overflow="hidden",o.style.visibility="hidden",document.body.appendChild(o));const t=(null===(e=o.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=t,document.body.removeChild(o)},$.injectController=({config:e})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=e.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const n=e.checkoutSettings.placeOrderButtonSelector;g.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{g.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}const t=document.createElement("zonos-controller");t.config=e,t.zonosApiKey=g.zonosApiKey||"",t.addEventListener("stripeInitEvent",(async e=>{const{detail:n}=e;o("loading Stripe");const s=await(async(...e)=>{z=!0;const n=Date.now();return y.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)))})(n.publishableKey);s?(window.Zonos.stripe=s,t.initCheckoutElement(s)):r("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(t),g.zonosController=t,o("Zonos controller injected!")},$.injectScript=({cdnType:e,isModule:n,theRestUrl:t})=>{const s=`${g.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const i=document.head||document.body,c=document.createElement("script");n?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{r(`Failed to load ${c.src}`);const o=m(e);o&&g.injectScript({cdnType:o,isModule:n,theRestUrl:t})},i.appendChild(c)},$.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return O;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.172";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.172";case"vercel":return S}};return g.isNpm&&p()||n()},$.injectZonosCdn=()=>{g.injectScript({cdnType:u,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),g.injectScript({cdnType:u,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},$.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const o=g.getZonosUrl(e),t=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${S}/`,t.appendChild(s);const i=document.createElement("link");i.rel="stylesheet",i.href=`${o}/${n}`,i.onerror=()=>{r(`Failed to load ${i.href}`);const o=m(e);o&&g.injectStylesheet({cdnType:o,theRestUrl:n})},t.appendChild(i)},$.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(g.injectStylesheet({cdnType:u,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},$.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void o("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${b}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&!k.test(o.href))return o}return null})())return void o("Inter font already injected","warn");const e=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=b,e.appendChild(n);const t=document.createElement("link");t.rel="stylesheet",t.href=`${b}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),o("Zonos font injected!")},$.setupGoogleFont=e=>{var n;null===(n=g.zonosController)||void 0===n||n.setupGoogleFont(e)},$.injectSupportGoogleFont=e=>{var n;o(`[FONT] injecting ${e}`);const t=null===(n=e.match(/family=(.*?):/))||void 0===n?void 0:n[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${b}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=b,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void o(`[FONT] ${t} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=e,s.appendChild(r),o(`[FONT] ${t} font injected!`)};export{$ as Zonos}
|
|
1
|
+
import{g as e,a as n,l as o,h as t,b as r}from"./p-839448c3.js";import{s as i,c as l}from"./p-1c488ecf.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-1c488ecf.js";export{c as countryRequireTaxId,s as shipToTaxIdLabels}from"./p-5bd927f2.js";const a=["jsdelivr","cdnjs","unpkg","vercel"],u="jsdelivr",m=e=>{const n=a.indexOf(e);return a[n+1]||null},p=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const n=(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.173.js.zonos.com";if(!n&&(t.includes("test.")||t.includes("test-")))return t;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const s=`https://${n}.preview.js.zonos.com`;return o(`[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},w="https://js.stripe.com/v3",f=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,h="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let v=null;const y=Promise.resolve().then((()=>{return e=null,null!==v||(v=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(h),window.Stripe)n(window.Stripe);else try{let t=(()=>{const e=document.querySelectorAll(`script[src^="${w}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&f.test(o.src))return o}return null})();t&&e?console.warn(h):t||(t=(e=>{const n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${w}${n}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(r("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==t||t.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==t||t.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),v;var e}));let z=!1;var g;y.catch((e=>{z||console.warn(e)}));const j=(()=>{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})(),S="https://v1.3.173.js.zonos.com",O=j||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.173",b="https://fonts.googleapis.com",k=/^https:\/\/fonts\.googleapis\.com/;class ${}g=$,$.doneInit=!1,$.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),$.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),$._paypalMockResponse=null,$.isBigCommerce=!1,$.releaseDate="1742573632605",$.isLegacyCheckout=!1,$.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",$.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),$.isNpm=!0,$.zonosQaUrl=null,$.zonosQaUrlApi=null,$.version="v1.3.173",$.modeAlerted=!1,$.cartData=null,$.paypal=null,$.getCurrentTimestamp=()=>(new Date).getTime(),$.zonosController=null,$.loadTimeApiInfoList=[],$.logIntervalId=null,$.init=async s=>{const{appearance:c,checkoutSettings:d,currencyConverter:a,helloSettings:u,onCountryChange:m,overrideCurrencyFormat:w,storeId:f,zonosApiKey:h}=s;if(g.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),g.doneInit)return;if(o(`====== ZONOS DEBUG MODE: on (${g.version}) ======`),g.zonosApiKey=h,g.storeId=f,g.isNpm){o("====== ZONOS LOADING FROM NPM ======");const c=p();if(c&&!window.isZonosPreview){o(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${c} ======`,"info");const e=document.createElement("script");return e.src=`${c}/dist/scripts/zonos.js`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=g.isNpm,window.Zonos.isBigCommerce=g.isBigCommerce,window.Zonos.isLegacyCheckout=g.isLegacyCheckout,window.Zonos.init(s)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${c}`)})),void(window.isZonosPreview=!0)}if(!h&&!g.cartId)return void r("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!g.cartData&&g.cartId){o("Initialize cart data");const e=await i(g.cartId);if(!e)return void r("Failed to get cart data");g.cartData=e.cartData,g.zonosApiKey=e.zonosApiKey}const d=await(async()=>{const s=e(),i=n();if(!s&&!i||!window.Zonos.zonosApiKey)return null;if(o("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return o("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:c,json:d}=await t("/api/get-test-public-credential");if(c.length||!d)return r("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",c),null;const l=d.publicCredential;return l?(o(`[ZONOS - loadZonos] Retrieve new test public token ${l}`,"info"),l):(r("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();d&&(g.zonosApiKey=d)}const v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(g.cartId&&g.cartData||v){o("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id=`${l}`,document.body.appendChild(e)}o("init zonos"),g.restoreNativeBrowserFunctions(),g.injectCustomScriptForHostedCheckout(),g.injectZonosCdn(),g.injectZonosCss(),g.injectFonts(),g.injectController({config:{appearance:c,checkoutSettings:d,currencyConverter:a,helloSettings:u,onCountryChange:m,overrideCurrencyFormat:w}}),g.doneInit=!0},$.injectCustomScriptForHostedCheckout=()=>{const e=g.cartData,n=(null==e?void 0:e.metadata)||[],t=n.find((e=>"customHeaderScript"===e.key)),s=n.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(t||s)){if(t){o("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(s){o("Injecting custom footer script");const e=document.createElement("script");e.textContent=s.value,document.body.appendChild(e)}}else o("Skip injecting custom script for hosted checkout","info",{footerScript:s,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},$.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},$.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},$.showNotification=e=>{var n;null===(n=g.zonosController)||void 0===n||n.showNotification(e)},$.updateOrganizationName=e=>{var n;null===(n=g.zonosController)||void 0===n||n.updateOrganizationName(e)},$.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)}},$.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const n="zonos---native-browser";let o=document.querySelector(`iframe#${n}`);o||(o=document.createElement("iframe"),o.id=n,o.style.display="none",o.style.opacity="0",o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",o.style.width="1px",o.style.height="1px",o.style.border="none",o.style.overflow="hidden",o.style.visibility="hidden",document.body.appendChild(o));const t=(null===(e=o.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=t,document.body.removeChild(o)},$.injectController=({config:e})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=e.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const n=e.checkoutSettings.placeOrderButtonSelector;g.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{g.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}const t=document.createElement("zonos-controller");t.config=e,t.zonosApiKey=g.zonosApiKey||"",t.addEventListener("stripeInitEvent",(async e=>{const{detail:n}=e;o("loading Stripe");const s=await(async(...e)=>{z=!0;const n=Date.now();return y.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)))})(n.publishableKey);s?(window.Zonos.stripe=s,t.initCheckoutElement(s)):r("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(t),g.zonosController=t,o("Zonos controller injected!")},$.injectScript=({cdnType:e,isModule:n,theRestUrl:t})=>{const s=`${g.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const i=document.head||document.body,c=document.createElement("script");n?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{r(`Failed to load ${c.src}`);const o=m(e);o&&g.injectScript({cdnType:o,isModule:n,theRestUrl:t})},i.appendChild(c)},$.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return O;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.173";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.173";case"vercel":return S}};return g.isNpm&&p()||n()},$.injectZonosCdn=()=>{g.injectScript({cdnType:u,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),g.injectScript({cdnType:u,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},$.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const o=g.getZonosUrl(e),t=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${S}/`,t.appendChild(s);const i=document.createElement("link");i.rel="stylesheet",i.href=`${o}/${n}`,i.onerror=()=>{r(`Failed to load ${i.href}`);const o=m(e);o&&g.injectStylesheet({cdnType:o,theRestUrl:n})},t.appendChild(i)},$.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(g.injectStylesheet({cdnType:u,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},$.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void o("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${b}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&!k.test(o.href))return o}return null})())return void o("Inter font already injected","warn");const e=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=b,e.appendChild(n);const t=document.createElement("link");t.rel="stylesheet",t.href=`${b}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),o("Zonos font injected!")},$.setupGoogleFont=e=>{var n;null===(n=g.zonosController)||void 0===n||n.setupGoogleFont(e)},$.injectSupportGoogleFont=e=>{var n;o(`[FONT] injecting ${e}`);const t=null===(n=e.match(/family=(.*?):/))||void 0===n?void 0:n[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${b}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=b,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void o(`[FONT] ${t} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=e,s.appendChild(r),o(`[FONT] ${t} font injected!`)};export{$ as Zonos}
|