@beamimpact/web-sdk 1.55.0 → 1.55.2
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/chunks/{_share-dialog-dependencies-C7C3l4mO.esm.js → _share-dialog-dependencies-CrXoTXJn.esm.js} +2 -2
- package/dist/chunks/{_share-dialog-dependencies-C7C3l4mO.esm.js.map → _share-dialog-dependencies-CrXoTXJn.esm.js.map} +1 -1
- package/dist/chunks/{_share-dialog-dependencies-0P6dCcDb.esm.js → _share-dialog-dependencies-oPfou2yz.esm.js} +2 -2
- package/dist/chunks/{_share-dialog-dependencies-0P6dCcDb.esm.js.map → _share-dialog-dependencies-oPfou2yz.esm.js.map} +1 -1
- package/dist/chunks/{cart-contents-oArgpFbi.esm.d.ts → cart-contents-CLT7p7Gd.esm.d.ts} +1 -1
- package/dist/chunks/{events-C55rozsO.esm.d.ts → events-D-3N9lQA.esm.d.ts} +2 -2
- package/dist/chunks/{index-bdavMFUu.esm.js → index-BRwtueB0.esm.js} +2 -2
- package/dist/chunks/{index-bdavMFUu.esm.js.map → index-BRwtueB0.esm.js.map} +1 -1
- package/dist/chunks/{index-Cs71sJuT.esm.js → index-BfJw1nDH.esm.js} +2 -2
- package/dist/chunks/index-BfJw1nDH.esm.js.map +1 -0
- package/dist/chunks/{index-wysdk3gp.esm.js → index-C0iBcnhO.esm.js} +2 -2
- package/dist/chunks/index-C0iBcnhO.esm.js.map +1 -0
- package/dist/chunks/index-CB2FlO76.esm.js +2 -0
- package/dist/chunks/index-CB2FlO76.esm.js.map +1 -0
- package/dist/chunks/{index-CPVMm4wx.esm.d.ts → index-CBS5Fqry.esm.d.ts} +1 -1
- package/dist/chunks/index-CFuuHEma.esm.js +2 -0
- package/dist/chunks/index-CFuuHEma.esm.js.map +1 -0
- package/dist/chunks/{index-Cjyno0g7.esm.js → index-CJLX6Cat.esm.js} +27 -27
- package/dist/chunks/index-CJLX6Cat.esm.js.map +1 -0
- package/dist/chunks/{index-D0EQhKxM.esm.js → index-CXu50lhe.esm.js} +2 -2
- package/dist/chunks/index-CXu50lhe.esm.js.map +1 -0
- package/dist/chunks/{index-C_8jccDq.esm.js → index-Cb7UHLgc.esm.js} +27 -27
- package/dist/chunks/index-Cb7UHLgc.esm.js.map +1 -0
- package/dist/chunks/{index-DjSzY8-j.esm.d.ts → index-CoYyg3fw.esm.d.ts} +1 -1
- package/dist/chunks/index-DQU56kcv.esm.js +2 -0
- package/dist/chunks/index-DQU56kcv.esm.js.map +1 -0
- package/dist/chunks/{index-1Mhh255_.esm.d.ts → index-DTPlqZRf.esm.d.ts} +1 -1
- package/dist/chunks/{index-D5ktU0Ru.esm.js → index-DTnVjvy8.esm.js} +2 -2
- package/dist/chunks/index-DTnVjvy8.esm.js.map +1 -0
- package/dist/chunks/{index-B6EWjlNI.esm.d.ts → index-DbT2CExl.esm.d.ts} +4 -4
- package/dist/chunks/index-O-hdOxQR.esm.js +2 -0
- package/dist/chunks/index-O-hdOxQR.esm.js.map +1 -0
- package/dist/chunks/{index-OTDSwrqr.esm.d.ts → index-cxEi49sX.esm.d.ts} +1 -1
- package/dist/chunks/{index-DvMWGoiY.esm.js → index-ddFvDm5F.esm.js} +2 -2
- package/dist/chunks/{index-DvMWGoiY.esm.js.map → index-ddFvDm5F.esm.js.map} +1 -1
- package/dist/chunks/{index-CkuCObi0.esm.d.ts → index-rxgS4BLp.esm.d.ts} +1 -1
- package/dist/chunks/{openapi-spec-x9NbL7bU.esm.d.ts → openapi-spec-Bk7E2QQP.esm.d.ts} +50 -48
- package/dist/chunks/{order-page-UWwYjvD1.esm.js → order-page-BL4PDyMz.esm.js} +2 -2
- package/dist/chunks/{order-page-UWwYjvD1.esm.js.map → order-page-BL4PDyMz.esm.js.map} +1 -1
- package/dist/chunks/{order-page-D_p01zgd.esm.d.ts → order-page-M7a2TINy.esm.d.ts} +4 -4
- package/dist/chunks/{order-page-DyrfYf-7.esm.js → order-page-qV21CdRx.esm.js} +2 -2
- package/dist/chunks/{order-page-DyrfYf-7.esm.js.map → order-page-qV21CdRx.esm.js.map} +1 -1
- package/dist/chunks/{promo-types-Cz_Zkjy1.esm.d.ts → promo-types-BPmDZ5dF.esm.d.ts} +1 -1
- package/dist/chunks/routes-BAqFeD8S.esm.js +2 -0
- package/dist/chunks/routes-BAqFeD8S.esm.js.map +1 -0
- package/dist/chunks/{routes-BwRUVGsk.esm.d.ts → routes-BoeGe1RQ.esm.d.ts} +3 -3
- package/dist/chunks/routes-C75nl1NS.esm.js +2 -0
- package/dist/chunks/routes-C75nl1NS.esm.js.map +1 -0
- package/dist/chunks/{share-button-C9agPz9W.esm.js → share-button-BNp67BPn.esm.js} +2 -2
- package/dist/chunks/{share-button-CfTlW-kJ.esm.js.map → share-button-BNp67BPn.esm.js.map} +1 -1
- package/dist/chunks/{share-button-CfTlW-kJ.esm.js → share-button-BSHKEfJo.esm.js} +2 -2
- package/dist/chunks/{share-button-C9agPz9W.esm.js.map → share-button-BSHKEfJo.esm.js.map} +1 -1
- package/dist/chunks/{share-button-DC1SffJs.esm.js → share-button-BxWziSBl.esm.js} +2 -2
- package/dist/chunks/{share-button-BShZOtDs.esm.js.map → share-button-BxWziSBl.esm.js.map} +1 -1
- package/dist/chunks/{share-button-B9hpxBVr.esm.d.ts → share-button-CDVVaxEc.esm.d.ts} +1 -1
- package/dist/chunks/{share-button-BShZOtDs.esm.js → share-button-DCMaVhyw.esm.js} +2 -2
- package/dist/chunks/{share-button-DC1SffJs.esm.js.map → share-button-DCMaVhyw.esm.js.map} +1 -1
- package/dist/chunks/{types-C7gqAyyH.esm.d.ts → types-DfRc36jU.esm.d.ts} +1 -1
- package/dist/chunks/{update-cart-Dp0v0m4d.esm.d.ts → update-cart-CauFT0AF.esm.d.ts} +2 -2
- package/dist/chunks/{update-cart-Ca6SS1Qb.esm.js → update-cart-DPxyDjY9.esm.js} +2 -2
- package/dist/chunks/{update-cart-Ca6SS1Qb.esm.js.map → update-cart-DPxyDjY9.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-CJ8pUNgh.esm.js → update-cart-FKTMMTl5.esm.js} +2 -2
- package/dist/chunks/{update-cart-CJ8pUNgh.esm.js.map → update-cart-FKTMMTl5.esm.js.map} +1 -1
- package/dist/components/beam-partner-logos.d.ts +1 -1
- package/dist/components/community-impact.d.ts +1 -1
- package/dist/components/community-impact.esm.js +10 -10
- package/dist/components/community-impact.esm.js.map +1 -1
- package/dist/components/community-impact.js +10 -10
- package/dist/components/community-impact.js.map +1 -1
- package/dist/components/cumulative-impact.d.ts +1 -1
- package/dist/components/cumulative-impact.esm.js +3 -3
- package/dist/components/cumulative-impact.esm.js.map +1 -1
- package/dist/components/cumulative-impact.js +3 -3
- package/dist/components/cumulative-impact.js.map +1 -1
- package/dist/components/impact-overview.d.ts +2 -2
- package/dist/components/impact-overview.esm.js +2 -2
- package/dist/components/impact-overview.esm.js.map +1 -1
- package/dist/components/impact-overview.js +2 -2
- package/dist/components/impact-overview.js.map +1 -1
- package/dist/components/index.d.ts +5 -5
- package/dist/components/index.esm.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/post-purchase.d.ts +7 -6
- package/dist/components/post-purchase.esm.js +1 -1
- package/dist/components/post-purchase.js +1 -1
- package/dist/components/product-details-page.d.ts +3 -3
- package/dist/components/product-details-page.esm.js +4 -4
- package/dist/components/product-details-page.esm.js.map +1 -1
- package/dist/components/product-details-page.js +4 -4
- package/dist/components/product-details-page.js.map +1 -1
- package/dist/components/redeem-transaction.d.ts +4 -4
- package/dist/components/redeem-transaction.esm.js +1 -1
- package/dist/components/redeem-transaction.js +1 -1
- package/dist/components/select-nonprofit.d.ts +4 -4
- package/dist/components/select-nonprofit.esm.js +12 -12
- package/dist/components/select-nonprofit.esm.js.map +1 -1
- package/dist/components/select-nonprofit.js +12 -12
- package/dist/components/select-nonprofit.js.map +1 -1
- package/dist/components/select-subscription-nonprofit.d.ts +2 -2
- package/dist/components/select-subscription-nonprofit.esm.js +8 -8
- package/dist/components/select-subscription-nonprofit.esm.js.map +1 -1
- package/dist/components/select-subscription-nonprofit.js +8 -8
- package/dist/components/select-subscription-nonprofit.js.map +1 -1
- package/dist/components/shopify.d.ts +9 -9
- package/dist/components/shopify.esm.js +1 -1
- package/dist/components/shopify.js +1 -1
- package/dist/components/social-share.d.ts +1 -1
- package/dist/components/social-share.esm.js +1 -1
- package/dist/components/social-share.js +1 -1
- package/dist/components/subscription-impact.d.ts +3 -3
- package/dist/components/subscription-impact.esm.js +4 -4
- package/dist/components/subscription-impact.esm.js.map +1 -1
- package/dist/components/subscription-impact.js +4 -4
- package/dist/components/subscription-impact.js.map +1 -1
- package/dist/components/subscription-management.d.ts +6 -6
- package/dist/components/subscription-management.esm.js +5 -5
- package/dist/components/subscription-management.esm.js.map +1 -1
- package/dist/components/subscription-management.js +5 -5
- package/dist/components/subscription-management.js.map +1 -1
- package/dist/index.d.ts +15 -15
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/beam.esm.js +1 -1
- package/dist/integrations/beam.js +1 -1
- package/dist/integrations/cart.d.ts +4 -4
- package/dist/integrations/cart.esm.js +1 -1
- package/dist/integrations/cart.js +1 -1
- package/dist/integrations/index.d.ts +13 -13
- package/dist/integrations/index.esm.js +1 -1
- package/dist/integrations/index.js +1 -1
- package/dist/integrations/logs.d.ts +2 -2
- package/dist/integrations/logs.esm.js +1 -1
- package/dist/integrations/logs.js +1 -1
- package/dist/integrations/shopify.d.ts +7 -7
- package/dist/integrations/shopify.esm.js +1 -1
- package/dist/integrations/shopify.js +1 -1
- package/dist/integrations/statsig.esm.js +1 -1
- package/dist/integrations/statsig.js +1 -1
- package/dist/integrations/utils.d.ts +4 -4
- package/dist/react/beam-partner-logos.d.ts +1 -1
- package/dist/react/community-impact.d.ts +1 -1
- package/dist/react/community-impact.esm.js +1 -1
- package/dist/react/community-impact.js +1 -1
- package/dist/react/cumulative-impact.d.ts +1 -1
- package/dist/react/cumulative-impact.esm.js +1 -1
- package/dist/react/cumulative-impact.js +1 -1
- package/dist/react/impact-overview.d.ts +2 -2
- package/dist/react/impact-overview.esm.js +1 -1
- package/dist/react/impact-overview.js +1 -1
- package/dist/react/index.d.ts +7 -7
- package/dist/react/index.esm.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/post-purchase.d.ts +4 -4
- package/dist/react/post-purchase.esm.js +1 -1
- package/dist/react/post-purchase.js +1 -1
- package/dist/react/product-details-page.d.ts +2 -2
- package/dist/react/product-details-page.esm.js +1 -1
- package/dist/react/product-details-page.js +1 -1
- package/dist/react/redeem-transaction.d.ts +5 -5
- package/dist/react/redeem-transaction.esm.js +1 -1
- package/dist/react/redeem-transaction.js +1 -1
- package/dist/react/select-nonprofit.d.ts +5 -5
- package/dist/react/select-nonprofit.esm.js +1 -1
- package/dist/react/select-nonprofit.js +1 -1
- package/dist/react/select-subscription-nonprofit.d.ts +5 -5
- package/dist/react/select-subscription-nonprofit.esm.js +1 -1
- package/dist/react/select-subscription-nonprofit.js +1 -1
- package/dist/react/social-share.d.ts +1 -1
- package/dist/react/social-share.esm.js +1 -1
- package/dist/react/social-share.js +1 -1
- package/dist/react/subscription-impact.d.ts +2 -2
- package/dist/react/subscription-impact.esm.js +1 -1
- package/dist/react/subscription-impact.js +1 -1
- package/dist/react/subscription-management.d.ts +5 -5
- package/dist/react/subscription-management.esm.js +1 -1
- package/dist/react/subscription-management.js +1 -1
- package/dist/utils/events.d.ts +4 -4
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/promoManager.d.ts +3 -3
- package/dist/utils/uuid.d.ts +8 -0
- package/dist/utils/uuid.esm.js +2 -0
- package/dist/utils/uuid.esm.js.map +1 -0
- package/dist/utils/uuid.js +2 -0
- package/dist/utils/uuid.js.map +1 -0
- package/package.json +2 -2
- package/dist/chunks/index-BO47lnaD.esm.js +0 -2
- package/dist/chunks/index-BO47lnaD.esm.js.map +0 -1
- package/dist/chunks/index-C_8jccDq.esm.js.map +0 -1
- package/dist/chunks/index-Cjyno0g7.esm.js.map +0 -1
- package/dist/chunks/index-Cs71sJuT.esm.js.map +0 -1
- package/dist/chunks/index-D0EQhKxM.esm.js.map +0 -1
- package/dist/chunks/index-D5ktU0Ru.esm.js.map +0 -1
- package/dist/chunks/index-DB_Mk3QG.esm.js +0 -2
- package/dist/chunks/index-DB_Mk3QG.esm.js.map +0 -1
- package/dist/chunks/index-DOQdFfJh.esm.js +0 -2
- package/dist/chunks/index-DOQdFfJh.esm.js.map +0 -1
- package/dist/chunks/index-DtCNVLB_.esm.js +0 -2
- package/dist/chunks/index-DtCNVLB_.esm.js.map +0 -1
- package/dist/chunks/index-wysdk3gp.esm.js.map +0 -1
- package/dist/chunks/routes-CkX5IVAM.esm.js +0 -2
- package/dist/chunks/routes-CkX5IVAM.esm.js.map +0 -1
- package/dist/chunks/routes-D0PG2uwR.esm.js +0 -2
- package/dist/chunks/routes-D0PG2uwR.esm.js.map +0 -1
|
@@ -21,7 +21,7 @@ interface paths {
|
|
|
21
21
|
*/
|
|
22
22
|
storeId?: number;
|
|
23
23
|
/** Language code. */
|
|
24
|
-
lang?: "en" | "fr" | "de" | "es" | "it" | "pl";
|
|
24
|
+
lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja";
|
|
25
25
|
/** The type of view to fetch the config for */
|
|
26
26
|
widgetName: "select-nonprofit" | "redeem-transaction";
|
|
27
27
|
/** The version of the config */
|
|
@@ -69,7 +69,7 @@ interface paths {
|
|
|
69
69
|
promoDescriptionPrefix?: string;
|
|
70
70
|
/**
|
|
71
71
|
* @description The promo description for the widget for web
|
|
72
|
-
* @example
|
|
72
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
73
73
|
*/
|
|
74
74
|
promoDescription?: string;
|
|
75
75
|
/**
|
|
@@ -132,7 +132,7 @@ interface paths {
|
|
|
132
132
|
title: string;
|
|
133
133
|
/**
|
|
134
134
|
* @description Subtitle/description for the widget
|
|
135
|
-
* @example
|
|
135
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
136
136
|
*/
|
|
137
137
|
description: string;
|
|
138
138
|
/**
|
|
@@ -154,7 +154,7 @@ interface paths {
|
|
|
154
154
|
title: string;
|
|
155
155
|
/**
|
|
156
156
|
* @description Subtitle/description for the widget
|
|
157
|
-
* @example
|
|
157
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
158
158
|
*/
|
|
159
159
|
description: string;
|
|
160
160
|
/**
|
|
@@ -343,7 +343,7 @@ interface paths {
|
|
|
343
343
|
};
|
|
344
344
|
query: {
|
|
345
345
|
/** Language code. */
|
|
346
|
-
lang?: "en" | "fr" | "de" | "es" | "it" | "pl";
|
|
346
|
+
lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja";
|
|
347
347
|
version: string;
|
|
348
348
|
/** When set to true, draft themes are returned */
|
|
349
349
|
draftConfig?: boolean;
|
|
@@ -395,7 +395,7 @@ interface paths {
|
|
|
395
395
|
promoDescriptionPrefix?: string;
|
|
396
396
|
/**
|
|
397
397
|
* @description The promo description for the widget for web
|
|
398
|
-
* @example
|
|
398
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
399
399
|
*/
|
|
400
400
|
promoDescription?: string;
|
|
401
401
|
/**
|
|
@@ -458,7 +458,7 @@ interface paths {
|
|
|
458
458
|
title: string;
|
|
459
459
|
/**
|
|
460
460
|
* @description Subtitle/description for the widget
|
|
461
|
-
* @example
|
|
461
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
462
462
|
*/
|
|
463
463
|
description: string;
|
|
464
464
|
/**
|
|
@@ -480,7 +480,7 @@ interface paths {
|
|
|
480
480
|
title: string;
|
|
481
481
|
/**
|
|
482
482
|
* @description Subtitle/description for the widget
|
|
483
|
-
* @example
|
|
483
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
484
484
|
*/
|
|
485
485
|
description: string;
|
|
486
486
|
/**
|
|
@@ -632,7 +632,7 @@ interface paths {
|
|
|
632
632
|
promoDescriptionPrefix?: string;
|
|
633
633
|
/**
|
|
634
634
|
* @description The promo description for the widget for web
|
|
635
|
-
* @example
|
|
635
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
636
636
|
*/
|
|
637
637
|
promoDescription?: string;
|
|
638
638
|
/**
|
|
@@ -695,7 +695,7 @@ interface paths {
|
|
|
695
695
|
title: string;
|
|
696
696
|
/**
|
|
697
697
|
* @description Subtitle/description for the widget
|
|
698
|
-
* @example
|
|
698
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
699
699
|
*/
|
|
700
700
|
description: string;
|
|
701
701
|
/**
|
|
@@ -717,7 +717,7 @@ interface paths {
|
|
|
717
717
|
title: string;
|
|
718
718
|
/**
|
|
719
719
|
* @description Subtitle/description for the widget
|
|
720
|
-
* @example
|
|
720
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
721
721
|
*/
|
|
722
722
|
description: string;
|
|
723
723
|
/**
|
|
@@ -887,7 +887,7 @@ interface paths {
|
|
|
887
887
|
* @default en
|
|
888
888
|
* @enum {string}
|
|
889
889
|
*/
|
|
890
|
-
lang?: "en" | "fr" | "de" | "es" | "it" | "pl";
|
|
890
|
+
lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja";
|
|
891
891
|
/** @enum {string} */
|
|
892
892
|
widgetName: "select-nonprofit" | "redeem-transaction" | "post-purchase" | "subscription-management" | "select-subscription-nonprofit";
|
|
893
893
|
/** @example 1.0 */
|
|
@@ -1090,7 +1090,7 @@ interface paths {
|
|
|
1090
1090
|
/** The version of the config */
|
|
1091
1091
|
version: string;
|
|
1092
1092
|
/** Language code. */
|
|
1093
|
-
lang?: "en" | "fr" | "de" | "es" | "it" | "pl";
|
|
1093
|
+
lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja";
|
|
1094
1094
|
/** When set to true, themes are removed from widget config objects */
|
|
1095
1095
|
omitThemes?: boolean;
|
|
1096
1096
|
/** When set to true, draft themes are returned */
|
|
@@ -1153,7 +1153,7 @@ interface paths {
|
|
|
1153
1153
|
promoDescriptionPrefix?: string;
|
|
1154
1154
|
/**
|
|
1155
1155
|
* @description The promo description for the widget for web
|
|
1156
|
-
* @example
|
|
1156
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
1157
1157
|
*/
|
|
1158
1158
|
promoDescription?: string;
|
|
1159
1159
|
/**
|
|
@@ -1216,7 +1216,7 @@ interface paths {
|
|
|
1216
1216
|
title: string;
|
|
1217
1217
|
/**
|
|
1218
1218
|
* @description Subtitle/description for the widget
|
|
1219
|
-
* @example
|
|
1219
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
1220
1220
|
*/
|
|
1221
1221
|
description: string;
|
|
1222
1222
|
/**
|
|
@@ -1238,7 +1238,7 @@ interface paths {
|
|
|
1238
1238
|
title: string;
|
|
1239
1239
|
/**
|
|
1240
1240
|
* @description Subtitle/description for the widget
|
|
1241
|
-
* @example
|
|
1241
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
1242
1242
|
*/
|
|
1243
1243
|
description: string;
|
|
1244
1244
|
/**
|
|
@@ -1536,7 +1536,7 @@ interface paths {
|
|
|
1536
1536
|
promoDescriptionPrefix?: string;
|
|
1537
1537
|
/**
|
|
1538
1538
|
* @description The promo description for the widget for web
|
|
1539
|
-
* @example
|
|
1539
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
1540
1540
|
*/
|
|
1541
1541
|
promoDescription?: string;
|
|
1542
1542
|
/**
|
|
@@ -1599,7 +1599,7 @@ interface paths {
|
|
|
1599
1599
|
title: string;
|
|
1600
1600
|
/**
|
|
1601
1601
|
* @description Subtitle/description for the widget
|
|
1602
|
-
* @example
|
|
1602
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
1603
1603
|
*/
|
|
1604
1604
|
description: string;
|
|
1605
1605
|
/**
|
|
@@ -1621,7 +1621,7 @@ interface paths {
|
|
|
1621
1621
|
title: string;
|
|
1622
1622
|
/**
|
|
1623
1623
|
* @description Subtitle/description for the widget
|
|
1624
|
-
* @example
|
|
1624
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
1625
1625
|
*/
|
|
1626
1626
|
description: string;
|
|
1627
1627
|
/**
|
|
@@ -3063,7 +3063,7 @@ interface paths {
|
|
|
3063
3063
|
promoDescriptionPrefix?: string;
|
|
3064
3064
|
/**
|
|
3065
3065
|
* @description The promo description for the widget for web
|
|
3066
|
-
* @example
|
|
3066
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
3067
3067
|
*/
|
|
3068
3068
|
promoDescription?: string;
|
|
3069
3069
|
/**
|
|
@@ -3126,7 +3126,7 @@ interface paths {
|
|
|
3126
3126
|
title: string;
|
|
3127
3127
|
/**
|
|
3128
3128
|
* @description Subtitle/description for the widget
|
|
3129
|
-
* @example
|
|
3129
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
3130
3130
|
*/
|
|
3131
3131
|
description: string;
|
|
3132
3132
|
/**
|
|
@@ -3148,7 +3148,7 @@ interface paths {
|
|
|
3148
3148
|
title: string;
|
|
3149
3149
|
/**
|
|
3150
3150
|
* @description Subtitle/description for the widget
|
|
3151
|
-
* @example
|
|
3151
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
3152
3152
|
*/
|
|
3153
3153
|
description: string;
|
|
3154
3154
|
/**
|
|
@@ -3604,8 +3604,8 @@ interface paths {
|
|
|
3604
3604
|
*/
|
|
3605
3605
|
excludeB2BOrders?: boolean;
|
|
3606
3606
|
};
|
|
3607
|
-
|
|
3608
|
-
|
|
3607
|
+
creationMethod: string | null;
|
|
3608
|
+
timestamp: string;
|
|
3609
3609
|
};
|
|
3610
3610
|
};
|
|
3611
3611
|
};
|
|
@@ -3827,6 +3827,8 @@ interface paths {
|
|
|
3827
3827
|
apply: boolean;
|
|
3828
3828
|
}[];
|
|
3829
3829
|
};
|
|
3830
|
+
/** @description Timestamp e.g. 2025-10-14 or 2025-09-23 00:19:41.199000 +00:00 */
|
|
3831
|
+
orderProcessedAt?: string;
|
|
3830
3832
|
};
|
|
3831
3833
|
};
|
|
3832
3834
|
};
|
|
@@ -3895,7 +3897,7 @@ interface paths {
|
|
|
3895
3897
|
widgetName: string;
|
|
3896
3898
|
version: string;
|
|
3897
3899
|
/** Language code. */
|
|
3898
|
-
lang?: "en" | "fr" | "de" | "es" | "it" | "pl";
|
|
3900
|
+
lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja";
|
|
3899
3901
|
/** When set to true, draft themes are returned */
|
|
3900
3902
|
draftConfig?: boolean;
|
|
3901
3903
|
};
|
|
@@ -3988,7 +3990,7 @@ interface paths {
|
|
|
3988
3990
|
promoDescriptionPrefix: string | null;
|
|
3989
3991
|
/**
|
|
3990
3992
|
* @description The promo description for the widget for web
|
|
3991
|
-
* @example
|
|
3993
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
3992
3994
|
*/
|
|
3993
3995
|
promoDescription: string | null;
|
|
3994
3996
|
/**
|
|
@@ -4471,7 +4473,7 @@ interface paths {
|
|
|
4471
4473
|
promoDescriptionPrefix?: string;
|
|
4472
4474
|
/**
|
|
4473
4475
|
* @description The promo description for the widget for web
|
|
4474
|
-
* @example
|
|
4476
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
4475
4477
|
*/
|
|
4476
4478
|
promoDescription?: string;
|
|
4477
4479
|
/**
|
|
@@ -4534,7 +4536,7 @@ interface paths {
|
|
|
4534
4536
|
title: string;
|
|
4535
4537
|
/**
|
|
4536
4538
|
* @description Subtitle/description for the widget
|
|
4537
|
-
* @example
|
|
4539
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
4538
4540
|
*/
|
|
4539
4541
|
description: string;
|
|
4540
4542
|
/**
|
|
@@ -4556,7 +4558,7 @@ interface paths {
|
|
|
4556
4558
|
title: string;
|
|
4557
4559
|
/**
|
|
4558
4560
|
* @description Subtitle/description for the widget
|
|
4559
|
-
* @example
|
|
4561
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
4560
4562
|
*/
|
|
4561
4563
|
description: string;
|
|
4562
4564
|
/**
|
|
@@ -4592,7 +4594,7 @@ interface paths {
|
|
|
4592
4594
|
promoDescriptionPrefix?: string;
|
|
4593
4595
|
/**
|
|
4594
4596
|
* @description The promo description for the widget for web
|
|
4595
|
-
* @example
|
|
4597
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
4596
4598
|
*/
|
|
4597
4599
|
promoDescription?: string;
|
|
4598
4600
|
/**
|
|
@@ -4655,7 +4657,7 @@ interface paths {
|
|
|
4655
4657
|
title: string;
|
|
4656
4658
|
/**
|
|
4657
4659
|
* @description Subtitle/description for the widget
|
|
4658
|
-
* @example
|
|
4660
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
4659
4661
|
*/
|
|
4660
4662
|
description: string;
|
|
4661
4663
|
/**
|
|
@@ -4677,7 +4679,7 @@ interface paths {
|
|
|
4677
4679
|
title: string;
|
|
4678
4680
|
/**
|
|
4679
4681
|
* @description Subtitle/description for the widget
|
|
4680
|
-
* @example
|
|
4682
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
4681
4683
|
*/
|
|
4682
4684
|
description: string;
|
|
4683
4685
|
/**
|
|
@@ -4725,7 +4727,7 @@ interface paths {
|
|
|
4725
4727
|
title: string;
|
|
4726
4728
|
/**
|
|
4727
4729
|
* @description Subtitle/description for the widget
|
|
4728
|
-
* @example
|
|
4730
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
4729
4731
|
*/
|
|
4730
4732
|
description: string;
|
|
4731
4733
|
/**
|
|
@@ -4747,7 +4749,7 @@ interface paths {
|
|
|
4747
4749
|
title: string;
|
|
4748
4750
|
/**
|
|
4749
4751
|
* @description Subtitle/description for the widget
|
|
4750
|
-
* @example
|
|
4752
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
4751
4753
|
*/
|
|
4752
4754
|
description: string;
|
|
4753
4755
|
/**
|
|
@@ -4769,7 +4771,7 @@ interface paths {
|
|
|
4769
4771
|
title: string;
|
|
4770
4772
|
/**
|
|
4771
4773
|
* @description Subtitle/description for the widget
|
|
4772
|
-
* @example
|
|
4774
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
4773
4775
|
*/
|
|
4774
4776
|
description: string;
|
|
4775
4777
|
/**
|
|
@@ -4791,7 +4793,7 @@ interface paths {
|
|
|
4791
4793
|
title: string;
|
|
4792
4794
|
/**
|
|
4793
4795
|
* @description Subtitle/description for the widget
|
|
4794
|
-
* @example
|
|
4796
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
4795
4797
|
*/
|
|
4796
4798
|
description: string;
|
|
4797
4799
|
/**
|
|
@@ -4813,7 +4815,7 @@ interface paths {
|
|
|
4813
4815
|
title: string;
|
|
4814
4816
|
/**
|
|
4815
4817
|
* @description Subtitle/description for the widget
|
|
4816
|
-
* @example
|
|
4818
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
4817
4819
|
*/
|
|
4818
4820
|
description: string;
|
|
4819
4821
|
/**
|
|
@@ -5382,7 +5384,7 @@ interface paths {
|
|
|
5382
5384
|
chainId: number;
|
|
5383
5385
|
};
|
|
5384
5386
|
query: {
|
|
5385
|
-
lang?: "en" | "fr" | "de" | "es" | "it" | "pl";
|
|
5387
|
+
lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja";
|
|
5386
5388
|
};
|
|
5387
5389
|
};
|
|
5388
5390
|
responses: {
|
|
@@ -5533,7 +5535,7 @@ interface paths {
|
|
|
5533
5535
|
get: {
|
|
5534
5536
|
parameters: {
|
|
5535
5537
|
query: {
|
|
5536
|
-
lang?: "en" | "fr" | "de" | "es" | "it" | "pl";
|
|
5538
|
+
lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja";
|
|
5537
5539
|
};
|
|
5538
5540
|
};
|
|
5539
5541
|
responses: {
|
|
@@ -5903,7 +5905,7 @@ interface paths {
|
|
|
5903
5905
|
nonprofitId: number;
|
|
5904
5906
|
};
|
|
5905
5907
|
query: {
|
|
5906
|
-
lang?: "en" | "fr" | "de" | "es" | "it" | "pl";
|
|
5908
|
+
lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja";
|
|
5907
5909
|
};
|
|
5908
5910
|
};
|
|
5909
5911
|
responses: {
|
|
@@ -7498,7 +7500,7 @@ interface paths {
|
|
|
7498
7500
|
get: {
|
|
7499
7501
|
parameters: {
|
|
7500
7502
|
query: {
|
|
7501
|
-
lang?: "en" | "fr" | "de" | "es" | "it" | "pl";
|
|
7503
|
+
lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja";
|
|
7502
7504
|
/** The version of the config */
|
|
7503
7505
|
version: string;
|
|
7504
7506
|
storeId: number;
|
|
@@ -7531,7 +7533,7 @@ interface paths {
|
|
|
7531
7533
|
promoDescriptionPrefix?: string;
|
|
7532
7534
|
/**
|
|
7533
7535
|
* @description The promo description for the widget for web
|
|
7534
|
-
* @example
|
|
7536
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
7535
7537
|
*/
|
|
7536
7538
|
promoDescription?: string;
|
|
7537
7539
|
/**
|
|
@@ -7594,7 +7596,7 @@ interface paths {
|
|
|
7594
7596
|
title: string;
|
|
7595
7597
|
/**
|
|
7596
7598
|
* @description Subtitle/description for the widget
|
|
7597
|
-
* @example
|
|
7599
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
7598
7600
|
*/
|
|
7599
7601
|
description: string;
|
|
7600
7602
|
/**
|
|
@@ -7616,7 +7618,7 @@ interface paths {
|
|
|
7616
7618
|
title: string;
|
|
7617
7619
|
/**
|
|
7618
7620
|
* @description Subtitle/description for the widget
|
|
7619
|
-
* @example
|
|
7621
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
7620
7622
|
*/
|
|
7621
7623
|
description: string;
|
|
7622
7624
|
/**
|
|
@@ -7652,7 +7654,7 @@ interface paths {
|
|
|
7652
7654
|
post: {
|
|
7653
7655
|
parameters: {
|
|
7654
7656
|
query: {
|
|
7655
|
-
lang?: "en" | "fr" | "de" | "es" | "it" | "pl";
|
|
7657
|
+
lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja";
|
|
7656
7658
|
/** The version of the config */
|
|
7657
7659
|
version: string;
|
|
7658
7660
|
storeId: number;
|
|
@@ -7685,7 +7687,7 @@ interface paths {
|
|
|
7685
7687
|
promoDescriptionPrefix?: string;
|
|
7686
7688
|
/**
|
|
7687
7689
|
* @description The promo description for the widget for web
|
|
7688
|
-
* @example
|
|
7690
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
7689
7691
|
*/
|
|
7690
7692
|
promoDescription?: string;
|
|
7691
7693
|
/**
|
|
@@ -7748,7 +7750,7 @@ interface paths {
|
|
|
7748
7750
|
title: string;
|
|
7749
7751
|
/**
|
|
7750
7752
|
* @description Subtitle/description for the widget
|
|
7751
|
-
* @example
|
|
7753
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
7752
7754
|
*/
|
|
7753
7755
|
description: string;
|
|
7754
7756
|
/**
|
|
@@ -7770,7 +7772,7 @@ interface paths {
|
|
|
7770
7772
|
title: string;
|
|
7771
7773
|
/**
|
|
7772
7774
|
* @description Subtitle/description for the widget
|
|
7773
|
-
* @example
|
|
7775
|
+
* @example choose your impact and 1% of your purchase will be donated.
|
|
7774
7776
|
*/
|
|
7775
7777
|
description: string;
|
|
7776
7778
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as O,i as T,a as J}from"./lodash-D3TLHRR_.esm.js";import{i as W,j as K,d as M,c as q,k as F,h as G,g as V}from"./events-Dki0ka4F.esm.js";import{logger as g}from"../utils/logger.esm.js";import{initNetworkListeners as $}from"../utils/network-listeners.esm.js";import{createScopedLocalStorage as j}from"../utils/local-storage.esm.js";import{memoizeLast as U}from"../utils/memoize-last.esm.js";import"./promo-types-DKAOFHJr.esm.js";import{B as D}from"./cart-contents-DkoytiZh.esm.js";import{O as E}from"./update-cart-
|
|
2
|
-
//# sourceMappingURL=order-page-
|
|
1
|
+
import{o as O,i as T,a as J}from"./lodash-D3TLHRR_.esm.js";import{i as W,j as K,d as M,c as q,k as F,h as G,g as V}from"./events-Dki0ka4F.esm.js";import{logger as g}from"../utils/logger.esm.js";import{initNetworkListeners as $}from"../utils/network-listeners.esm.js";import{createScopedLocalStorage as j}from"../utils/local-storage.esm.js";import{memoizeLast as U}from"../utils/memoize-last.esm.js";import"./promo-types-DKAOFHJr.esm.js";import{B as D}from"./cart-contents-DkoytiZh.esm.js";import{O as E}from"./update-cart-DPxyDjY9.esm.js";import{W as z,D as X}from"./routes-C75nl1NS.esm.js";import{getBeamCartId as A,getExternalCartId as Z}from"../utils/cart.esm.js";import"../components/post-purchase.esm.js";import{waitForElement as H}from"../utils/wait-for-element.esm.js";import{B as Q}from"./beam-errors-Ci0d3926.esm.js";import{getCookieValue as Y}from"../utils/cookies.esm.js";const N=window.Shopify?.routes?.root||"/";let P=!1,R=!0,k=!1;const tt="cart";async function et(t,c=!0){if(P)return!1;$(),window.addEventListener(K.eventName,async()=>{k=!0}),window.addEventListener(M.eventName,async i=>{const e=i,o=/cart\/(add|change|update|clear)/,r=e.detail.type==="xhr"?e.detail.xhr.responseURL:e.detail.response.url,n=new URL(r);if(!o.test(n.pathname))return;const s=await B(t);s.changed&&E(t,s.cart)});let m,d;window.addEventListener(q.eventName,async i=>{const e=i;g.debug("[cart-page][BeamNonprofitSelectEvent]",e.detail);const{source:o,selectedNonprofitId:r,selectionId:n}=e.detail;if(o===z.select_nonprofit){if(m===r&&d===n)return;const s=await y(t);await h({...s,selectedNonprofitId:r,selectionId:n}),d=n,m=r}}),window.addEventListener(F.eventName,async i=>{const e=i;g.debug("[cart-page][BeamNonprofitSelectionRemovedEvent]",e.detail);const{newNonprofitId:o,selectionId:r}=e.detail;if(m===o&&d===r)return;const n=await y(t);await h({...n,selectedNonprofitId:null,selectionId:r}),d=r,m=o}),window.addEventListener(G.eventName,async i=>{const e=i;if(g.debug("[cart-page][BeamCartCreatedEvent]",e.detail),window.statsig||c){const o=await y(t);await h(o)}}),window.addEventListener(V.eventName,async i=>{const e=i;if(g.debug("[cart-page][BeamCartChangeEvent]",e.detail),window.statsig||c){const o=await y(t);await h(o)}});const p=await B(t);return await E(t,p.cart,!0),P=!0,!0}async function x(t){const c=await y(t);await h(c)}async function y(t){let c,m;if(window.statsig)try{const o=window.statsig;typeof o?.getLayer("beam_trial_layer")?.get("show_beam")=="boolean"&&(c=o.getLayer("beam_trial_layer").get("show_beam",!1),m=o.getStableID())}catch{}const d=Z(tt,t),p=A(D,t),{chainId:i,storeId:e}=t;return{showBeam:c??void 0,remoteSessionId:m??void 0,beamCartId:p&&p!=="null"?p:void 0,cartId:d&&d!=="null"?d:void 0,chainId:i,storeId:e}}const ot=x;async function B(t){const{token:c,total_price:m,item_count:d,currency:p,items:i,cart_level_discount_applications:e,attributes:o}=await L();let r=!1;const n=j(t),s=n.getItemJson("cart"),b=A(D,t),u={cartId:c,beamCartId:b,subtotal:m/100,itemCount:d,currencyCode:p,schema:{source:"generic"},content:{items:i.map(({sku:l,final_line_price:f,product_id:C,line_level_discount_allocations:I})=>{const w=l||String(C),a=f/100,v=I?.map(({discount_application:S})=>({code:S?.title,applicable:!0}));return{remoteProductIdentifier:w,localAmount:a,discounts:v}}),discounts:e.map(({title:l})=>({code:l,applicable:!0}))}};let _=null;try{o?.beam&&(_=JSON.parse(o.beam))}catch(l){g.error(l)}if(_&&R&&!k){R=!1;const{nonprofit_id:l,selection_id:f}=_,C=n.getItem("nonprofit"),I=n.getItem("transaction"),w=l!==void 0&&String(l)!==C,a=f!=null&&String(f)!==I;(w||a)&&(w&&(n.setItem("nonprofit",String(l)),n.setItem("nonprofit_selected_at",new Date().toISOString())),a&&(n.setItem("transaction",String(f)),n.setItem("nonprofit_selected_at",new Date().toISOString())),window.dispatchEvent(new W({nonprofitId:l,nonprofitIdChanged:w,selectionId:f,selectionIdChanged:a})))}return T(u,{...s,beamCartId:s?.beamCartId})||(r=!0),{changed:r,cart:u}}const at=E,L=async function(){return await window.fetch(N+"cart.js",{method:"GET",headers:{"Content-Type":"application/json"}}).then(t=>t.json())},h=U(async function({selectedNonprofitId:t,selectionId:c,beamCartId:m,cartId:d,chainId:p,storeId:i,showBeam:e,remoteSessionId:o}){const{attributes:r}=await L(),n=r?.beam;let s={};try{n&&(s=JSON.parse(n))}catch(l){g.error(l)}const b=O({nonprofit_id:t,selection_id:c,beam_cart_id:m,shopify_cart_id:d,chain_id:p,store_id:i,show_beam:e,remote_session_id:o},J),u={...s,...b};t===null&&(u.nonprofit_id=void 0);const _={beam:JSON.stringify(u)};if(!T(u,s))try{await window.fetch(N+"cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:_})})}catch(l){g.error(l)}}),nt=U(async function({selectedNonprofitId:t,selectionId:c,beamCartId:m,cartId:d,chainId:p,storeId:i}){let e,o;if(window.statsig)try{const s=window.statsig;typeof s?.getLayer("beam_trial_layer")?.get("show_beam")=="boolean"&&(e=s.getLayer("beam_trial_layer").get("show_beam",!1),o=s.getStableID())}catch{}const r=O({nonprofit_id:t,selection_id:c,beam_cart_id:m,shopify_cart_id:d,chain_id:p,store_id:i,show_beam:e,remote_session_id:o},J);t===null&&(r.nonprofit_id=void 0);const n={beam:JSON.stringify(r)};try{await window.fetch(N+"cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})}catch(s){g.error(s)}});async function it({parentSelector:t=".step__sections",apiKey:c,baseUrl:m=X,storeId:d,postalCode:p,discountCodes:i,countryCode:e,orderId:o,email:r,cartTotal:n,cart:s,promoCodes:b,htmlPromoCodes:u,currencyCode:_="USD",domain:l,lang:f="en",debug:C=!1}){const I=document.querySelector(t)||await H(t);if(!I)throw new Q(`Timed out waiting for selector '${t}'. Could not render Beam post-purchase widget.`);const w=await Y("cart");if(w){const v=j({apiKey:c}),S=v.getItemJson("cart")||{};v.setItemJson("cart",{...S,cartId:w})}const a=document.createElement("beam-post-purchase");a.apiKey=c,a.baseUrl=m,a.storeId=d,a.postalCode=p,a.countryCode=e,a.orderId=String(o),a.email=r,a.cartTotal=n,a.cart=s,a.promoCodes=b,a.htmlPromoCodes=u,a.discountCodes=i,a.currencyCode=_,a.domain=l,a.lang=f,a.debug=C,I.appendChild(a)}export{at as $,y as C,L as E,et as X,ot as Z,h as b,it as s,nt as t,B as v,x};
|
|
2
|
+
//# sourceMappingURL=order-page-BL4PDyMz.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-page-UWwYjvD1.esm.js","sources":["../../src/integrations/shopify/cart-page.ts","../../src/integrations/shopify/order-page.ts"],"sourcesContent":["/* eslint-disable camelcase */\nimport isEqual from \"lodash-es/isEqual\";\nimport isUndefined from \"lodash-es/isUndefined\";\nimport omitBy from \"lodash-es/omitBy\";\nimport { logger, memoizeLast } from \"../../utils\";\nimport { initNetworkListeners } from \"../../utils/network-listeners\";\nimport {\n BeamCartChangeEvent,\n BeamCartCreatedEvent,\n BeamNetworkCallEvent,\n BeamNonprofitSelectEvent,\n BeamNonprofitSelectionRemovedEvent,\n BeamWidgetInitialNonprofitSyncCancelEvent,\n BeamWidgetInitialNonprofitSyncEvent,\n} from \"../../utils/events\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { BEAM_CART_COOKIE_NAME, TBeamCartLocalStorage, TCart, TCartItems } from \"../../shared/cart-contents\";\nimport { BeamCartAPIConfig, updateCart } from \"../cart\";\nimport { WIDGET_NAMES } from \"../../api-sdk/constants\";\nimport { getBeamCartId, getExternalCartId } from \"../../utils/cart\";\n\nexport type BeamShopifyCartIntegrationConfig = BeamCartAPIConfig & {\n storeId: number; // will be added to cart custom_attributes, and used in cart API call\n chainId?: number; // will be added to cart custom_attributes\n};\n\ntype ShopifyDiscountApplication = {\n title: string;\n value: string;\n};\n\ntype ShopifyLineLevelDiscountAllocations = {\n amount?: string;\n discount_application: ShopifyDiscountApplication;\n};\n\ntype ShopifyCartBeamAttribute = {\n nonprofit_id?: number | null;\n selection_id?: string;\n beam_cart_id?: string;\n shopify_cart_id?: string;\n chain_id?: number;\n store_id?: number;\n show_beam?: boolean;\n remote_session_id?: string;\n};\n\nconst SHOPIFY_BASE_URL = window.Shopify?.routes?.root || \"/\"; // see window.d.ts\n\nlet isBeamCartIntegrationRegistered = false; // Skip registering event listeners if already set up\n\nlet allowEmitInitialNonprofitSync = true; // Skip updating local storage if already run initially\nlet skipEmitInitialNonprofitSync = false; // Allow other processes to skip the nonprofit sync from cart attributes\n\nconst SHOPIFY_CART_COOKIE_NAME = \"cart\";\n\n/**\n * @main registerCartIntegration - set up event listeners to integrate Beam with Shopify cart\n * @return {boolean} returns true if NEW listeners were created, false if setup was already done\n */\nasync function registerCartIntegration(\n config: BeamShopifyCartIntegrationConfig,\n autoUpdateShopifyCartAttributes = true\n) {\n if (isBeamCartIntegrationRegistered) {\n return false; // Do nothing if listeners are already attached\n }\n\n // logger.debug(\"[cart-page][registerCartIntegration] initializing network listeners\");\n // Set up event listeners for AJAX events\n initNetworkListeners();\n\n /**\n * Allow another component to cancel the loading & setting\n * of the Shopify cart selection (like if a selection is made before we've gotten the previous values)\n */\n window.addEventListener(BeamWidgetInitialNonprofitSyncCancelEvent.eventName, async () => {\n // logger.debug(\"[cart-page][BeamWidgetInitialNonprofitSyncCancelEvent]\");\n skipEmitInitialNonprofitSync = true;\n });\n\n // When any network call happens, check if it's for the Shopify /cart AJAX Api.\n // If so, and the cart is updated, send the cart to Beam\n window.addEventListener(BeamNetworkCallEvent.eventName, async (_event: Event) => {\n const event = _event as BeamNetworkCallEvent;\n const cartChangePaths = /cart\\/(add|change|update|clear)/;\n // note: response urls below follow redirects\n const requestUrlStr = event.detail.type === \"xhr\" ? event.detail.xhr.responseURL : event.detail.response.url;\n const url = new URL(requestUrlStr);\n if (!cartChangePaths.test(url.pathname)) {\n return;\n }\n // logger.debug(\"[cart-page][BeamNetworkCallEvent] getting current cart\");\n const currentCart = await getCurrentCart(config);\n if (!currentCart.changed) {\n // logger.debug(`[cart-page][BeamNetworkCallEvent] cart has not changed from URL ${requestUrlStr}`, currentCart.cart);\n return;\n }\n // Send cart to Beam to update timestamp, which is used for cart abandonment / ROI calc\n // logger.debug(`[cart-page][BeamNetworkCallEvent] cart has changed from URL ${requestUrlStr}`, currentCart.cart);\n updateCart(config, currentCart.cart);\n });\n\n // Listen to Beam's own events to integrate Beam data into Shopify order\n let lastNonprofitId: number | null | undefined;\n let lastSelectionId: string | null | undefined;\n window.addEventListener(BeamNonprofitSelectEvent.eventName, async (_event) => {\n const event = _event as BeamNonprofitSelectEvent;\n logger.debug(\"[cart-page][BeamNonprofitSelectEvent]\", event.detail);\n const { source, selectedNonprofitId, selectionId } = event.detail;\n\n // On nonprofit selection, we always write Beam's attributes\n // to the Shopify cart attributes\n if (source === WIDGET_NAMES.select_nonprofit) {\n // Skip update if nothing changed (can happen if widget is re-initialized and\n // emits event after cache restoration, i.e., on cart re-render).\n if (lastNonprofitId === selectedNonprofitId && lastSelectionId === selectionId) {\n return;\n }\n\n const beamCartData = await getBeamAttributesForCart(config);\n await appendBeamAttributesToCart({\n ...beamCartData,\n selectedNonprofitId,\n selectionId,\n });\n lastSelectionId = selectionId;\n lastNonprofitId = selectedNonprofitId;\n }\n });\n\n /**\n * Upon removal of the selected nonprofit from the widget and local storage,\n * an event is emitted and that event is then used to update the cart attributes accordingly\n * This event listener updates the cart attributes based on the emitted event\n */\n window.addEventListener(BeamNonprofitSelectionRemovedEvent.eventName, async (_event) => {\n const event = _event as BeamNonprofitSelectionRemovedEvent;\n logger.debug(\"[cart-page][BeamNonprofitSelectionRemovedEvent]\", event.detail);\n const { newNonprofitId, selectionId } = event.detail;\n\n if (lastNonprofitId === newNonprofitId && lastSelectionId === selectionId) {\n return;\n }\n\n // On nonprofit deselection, we always write Beam's attributes\n // to the Shopify cart attributes\n const beamCartData = await getBeamAttributesForCart(config);\n await appendBeamAttributesToCart({\n ...beamCartData,\n selectedNonprofitId: null,\n selectionId,\n });\n lastSelectionId = selectionId;\n lastNonprofitId = newNonprofitId;\n });\n\n /**\n * When a BeamCart is created, write beam metadata to the Shopify cart if\n * we need to capture it for Statsig or Extensibility\n */\n window.addEventListener(BeamCartCreatedEvent.eventName, async (_event: Event) => {\n const event = _event as BeamCartCreatedEvent;\n logger.debug(\"[cart-page][BeamCartCreatedEvent]\", event.detail);\n if (window.statsig || autoUpdateShopifyCartAttributes) {\n const beamCartData = await getBeamAttributesForCart(config);\n await appendBeamAttributesToCart(beamCartData);\n }\n });\n\n /**\n * On any cart changes, write beam metadata to the Shopify cart if\n * we need to capture it for Statsig or Extensibility\n */\n window.addEventListener(BeamCartChangeEvent.eventName, async (_event: Event) => {\n const event = _event as BeamCartChangeEvent;\n logger.debug(\"[cart-page][BeamCartChangeEvent]\", event.detail);\n if (window.statsig || autoUpdateShopifyCartAttributes) {\n const beamCartData = await getBeamAttributesForCart(config);\n await appendBeamAttributesToCart(beamCartData);\n }\n });\n\n // Handle full-page load, ie, first-time page load and reloads from form submit events\n // This creates a GET to /cart.js\n const currentCart = await getCurrentCart(config);\n // logger.debug(\"[cart-page][registerCartIntegration] initial cart fetch result\", currentCart);\n await updateCart(config, currentCart.cart, true);\n\n isBeamCartIntegrationRegistered = true;\n\n return true;\n}\n\n/* ***************************************** HELPER FUNCTIONS *****************************************\n These may be used individually to integrate with carts if the registerCartIntegration\n script doesn't work for some reason.\n ****************************************************************************************************/\n\nasync function appendToShopifyCartBeamAttribute(config: BeamShopifyCartIntegrationConfig) {\n const beamCartData = await getBeamAttributesForCart(config);\n await appendBeamAttributesToCart(beamCartData);\n}\n\n/**\n * Gathers the base Beam data needed for updating a Shopify cart's metadata\n */\nasync function getBeamAttributesForCart(config: BeamShopifyCartIntegrationConfig) {\n let showBeam;\n let remoteSessionId;\n\n if (window.statsig) {\n // If the site is using Statsig, but not for Beam, we need to ignore it\n try {\n const statsig = window.statsig as any;\n const statsigLayerProperty = statsig?.getLayer(\"beam_trial_layer\")?.get(\"show_beam\");\n if (typeof statsigLayerProperty === \"boolean\") {\n showBeam = statsig.getLayer(\"beam_trial_layer\").get(\"show_beam\", false /* default to hide */) as boolean;\n remoteSessionId = statsig.getStableID();\n }\n } catch (err) {\n // logger.error(err)\n }\n }\n\n const cartId = getExternalCartId(SHOPIFY_CART_COOKIE_NAME, config);\n const beamCartId = getBeamCartId(BEAM_CART_COOKIE_NAME, config);\n const { chainId, storeId } = config;\n\n return {\n showBeam: showBeam ?? undefined,\n remoteSessionId: remoteSessionId ?? undefined,\n beamCartId: beamCartId && beamCartId !== \"null\" ? beamCartId : undefined,\n cartId: cartId && cartId !== \"null\" ? cartId : undefined,\n chainId,\n storeId,\n };\n}\n\n/**\n * Adds Statsig data to a Shopify cart\n */\nconst appendStatsigToShopifyCartAttributes = appendToShopifyCartBeamAttribute;\n\n/**\n * Detects change in cart since last page load,\n * by calling GET /cart.js, and returns cart values.\n * Used for:\n * - Form-based carts where the page refreshes to modify cart instead of using AJAX calls\n * - Hydrogen/GraphQL based carts (needs to be integrated manually)\n */\nasync function getCurrentCart(config: BeamShopifyCartIntegrationConfig): Promise<{\n changed: boolean;\n cart: {\n cartId: string;\n subtotal: number;\n itemCount: number;\n currencyCode: string;\n } & TCart;\n}> {\n const {\n token, // equal to \"cart\" cookie\n total_price, // this is the pretax value, after discounts, and multiplied by 100 (integer from decimal)\n item_count,\n currency,\n items,\n cart_level_discount_applications,\n attributes,\n } = await getShopifyCart();\n\n let changed = false;\n\n const localStorage = createScopedLocalStorage(config);\n\n // The cart cache is used to detect changes after page refreshes / across tabs\n const cachedCart: TBeamCartLocalStorage | null = localStorage.getItemJson(\"cart\");\n // The Beam cart cookie is used to identify the cart across subdomains\n // Use explicit null if empty because API requires it\n const beamCartId: string | null = getBeamCartId(BEAM_CART_COOKIE_NAME, config);\n\n const cart = {\n cartId: token,\n beamCartId,\n subtotal: total_price / 100,\n itemCount: item_count,\n currencyCode: currency,\n schema: { source: \"generic\" } as const,\n content: {\n // pull out minimal fields from full line items\n items: (items as TCartItems).map(({ sku, final_line_price, product_id, line_level_discount_allocations }) => {\n const remoteProductIdentifier = sku || String(product_id);\n const localAmount = final_line_price / 100;\n const discounts = (line_level_discount_allocations as ShopifyLineLevelDiscountAllocations[])?.map(\n ({ discount_application }) => {\n return { code: discount_application?.title, applicable: true };\n }\n );\n return { remoteProductIdentifier, localAmount, discounts };\n }),\n discounts: (cart_level_discount_applications as ShopifyDiscountApplication[]).map(({ title }) => {\n return { code: title, applicable: true };\n }),\n },\n };\n\n let beamAttr: ShopifyCartBeamAttribute | null = null;\n\n try {\n if (attributes?.beam) {\n beamAttr = JSON.parse(attributes.beam);\n }\n } catch (err) {\n logger.error(err);\n }\n\n /**\n * Only attempt to emit BeamWidgetInitialNonprofitSyncEvent once\n * as soon as we see a \"beam\" attribute for the first time.\n * allowEmitInitialNonprofitSync is local to this file to keep this\n * from running more than once.\n * skipEmitInitialNonprofitSync is settable by an event listener\n * so other processes can stop this sync from happening\n */\n if (beamAttr && allowEmitInitialNonprofitSync && !skipEmitInitialNonprofitSync) {\n allowEmitInitialNonprofitSync = false;\n\n const { nonprofit_id, selection_id } = beamAttr;\n\n const storedNonprofit = localStorage.getItem(\"nonprofit\");\n const storedSelection = localStorage.getItem(\"transaction\");\n\n const nonprofitChanged = nonprofit_id !== undefined && String(nonprofit_id) !== storedNonprofit;\n const selectionChanged = selection_id != null && String(selection_id) !== storedSelection;\n\n // Only dispatch if something changed, and if it's not skipped\n if (nonprofitChanged || selectionChanged) {\n if (nonprofitChanged) {\n localStorage.setItem(\"nonprofit\", String(nonprofit_id));\n localStorage.setItem(\"nonprofit_selected_at\", new Date().toISOString());\n }\n\n if (selectionChanged) {\n localStorage.setItem(\"transaction\", String(selection_id));\n localStorage.setItem(\"nonprofit_selected_at\", new Date().toISOString());\n }\n\n window.dispatchEvent(\n new BeamWidgetInitialNonprofitSyncEvent({\n nonprofitId: nonprofit_id,\n nonprofitIdChanged: nonprofitChanged,\n selectionId: selection_id,\n selectionIdChanged: selectionChanged,\n })\n );\n }\n }\n\n if (\n !isEqual(cart, {\n ...cachedCart,\n beamCartId: cachedCart?.beamCartId,\n })\n ) {\n changed = true;\n }\n\n // logger.debug(\"[cart-page][getCurrentCart] has cart changed?\", changed, cart);\n\n return { changed, cart };\n}\n\n/**\n * trackCart - Backwards-compatible alias for updateCart\n */\nconst trackCart = updateCart;\n\n/**\n * Helper function to get the Shopify cart attributes\n */\nconst getShopifyCart = async function () {\n const cart = await window\n .fetch(SHOPIFY_BASE_URL + \"cart.js\", {\n method: \"GET\",\n headers: { \"Content-Type\": \"application/json\" },\n })\n .then((res) => res.json());\n return cart;\n};\n\n/**\n * Sends Beam data to Shopify to integrate with order as custom attributes.\n * Memoized so that calls with the same data as the previous don't create additional API calls to Shopify.\n * This will do an append, not a full overwrite of the attributes in the beam property\n */\nconst appendBeamAttributesToCart = memoizeLast(async function appendBeamAttributesToCart({\n selectedNonprofitId,\n selectionId,\n beamCartId,\n cartId,\n chainId,\n storeId,\n showBeam,\n remoteSessionId,\n}: {\n selectedNonprofitId?: number | null;\n selectionId?: string;\n beamCartId?: string;\n cartId?: string;\n chainId?: number;\n storeId?: number;\n showBeam?: boolean;\n remoteSessionId?: string;\n}) {\n // logger.debug(\"[cart-page][appendBeamAttributesToCart] fetching existing cart\");\n const { attributes } = await getShopifyCart();\n\n // Get only the Beam attribute, if it exists\n const existingBeamCartAttrString = attributes?.beam;\n let existingBeamCartAttr = {};\n try {\n if (existingBeamCartAttrString) {\n existingBeamCartAttr = JSON.parse(existingBeamCartAttrString);\n }\n } catch (err) {\n logger.error(err);\n }\n\n const newBeamAttrs = omitBy(\n {\n nonprofit_id: selectedNonprofitId,\n selection_id: selectionId,\n beam_cart_id: beamCartId,\n shopify_cart_id: cartId,\n chain_id: chainId,\n store_id: storeId,\n show_beam: showBeam,\n remote_session_id: remoteSessionId,\n },\n isUndefined\n );\n\n const appendedBeamAttributes = {\n ...existingBeamCartAttr,\n ...newBeamAttrs,\n } as ShopifyCartBeamAttribute;\n\n // For the nonprofitId, if we specifically get a null value here,\n // we want to remove it from the cart attributes, not just write \"null\"\n if (selectedNonprofitId === null) {\n appendedBeamAttributes.nonprofit_id = undefined;\n }\n\n const beamCartAttrs = {\n beam: JSON.stringify(appendedBeamAttributes),\n };\n\n // If the attributes match, no reason to update the cart\n if (isEqual(appendedBeamAttributes, existingBeamCartAttr)) {\n // logger.debug(\"[cart-page][appendBeamAttributesToCart] cart attributes match, skipping update\");\n return;\n }\n\n try {\n // logger.debug(\"[cart-page][appendBeamAttributesToCart] updating Shopify cart\");\n await window.fetch(SHOPIFY_BASE_URL + \"cart/update.js\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ attributes: beamCartAttrs }),\n });\n } catch (err) {\n logger.error(err); // don't throw, allow later calls to continue\n }\n});\n\n/**\n * Sends Beam data to Shopify to integrate with order as custom attributes.\n * Memoized so that calls with the same data as the previous don't create additional API calls to Shopify.\n * This method force-updates the \"beam\" attribute with the values passed in\n */\nconst addBeamAttributesToCart = memoizeLast(async function addBeamAttributesToCart({\n selectedNonprofitId,\n selectionId,\n beamCartId,\n cartId,\n chainId,\n storeId,\n}: {\n selectedNonprofitId?: number | null;\n selectionId?: string;\n beamCartId?: string;\n cartId?: string;\n chainId?: number;\n storeId?: number;\n}) {\n let showBeam;\n let remoteSessionId;\n\n if (window.statsig) {\n // If the site is using Statsig, but not for Beam, we need to ignore it\n try {\n const statsig = window.statsig as any;\n const statsigLayerProperty = statsig?.getLayer(\"beam_trial_layer\")?.get(\"show_beam\");\n if (typeof statsigLayerProperty === \"boolean\") {\n showBeam = statsig.getLayer(\"beam_trial_layer\").get(\"show_beam\", false /* default to hide */) as boolean;\n remoteSessionId = statsig.getStableID();\n }\n } catch (err) {\n // logger.error(err)\n }\n }\n\n const allBeamAttributes = omitBy(\n {\n nonprofit_id: selectedNonprofitId,\n selection_id: selectionId,\n beam_cart_id: beamCartId,\n shopify_cart_id: cartId,\n chain_id: chainId,\n store_id: storeId,\n show_beam: showBeam,\n remote_session_id: remoteSessionId,\n },\n isUndefined\n ) as ShopifyCartBeamAttribute;\n\n // For the nonprofitId, if we specifically get a null value here,\n // we want to remove it from the cart attributes, not just write \"null\"\n if (selectedNonprofitId === null) {\n allBeamAttributes.nonprofit_id = undefined;\n }\n\n const beamCartAttrs = {\n beam: JSON.stringify(allBeamAttributes),\n };\n\n try {\n await window.fetch(SHOPIFY_BASE_URL + \"cart/update.js\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ attributes: beamCartAttrs }),\n });\n } catch (err) {\n logger.error(err); // don't throw, allow later calls to continue\n }\n});\n\ndeclare global {\n interface Window {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n statsig?: any; // attached by Statsig CDN script\n }\n}\nexport {\n trackCart,\n getCurrentCart,\n addBeamAttributesToCart,\n appendStatsigToShopifyCartAttributes,\n appendToShopifyCartBeamAttribute,\n registerCartIntegration,\n appendBeamAttributesToCart,\n getShopifyCart,\n getBeamAttributesForCart,\n};\n","import \"../../components/post-purchase\";\nimport { postTransaction } from \"../../api-sdk/v3/routes\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES, TUrl } from \"../../api-sdk/types\";\nimport { waitForElement } from \"../../utils/wait-for-element\";\nimport { BeamError } from \"../../utils/beam-errors\";\nimport { getCookieValue } from \"../../utils/cookies\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { TCart } from \"../../shared/cart-contents\";\n\n// Shopify admin page: admin/settings/checkout\n\nexport type TBeamOrderPageParams = Parameters<typeof postTransaction>[0][\"requestBody\"] & {\n // Either storeId or postalCode + countryCode must be provided\n storeId?: number;\n postalCode?: string;\n countryCode?: string;\n orderId: string;\n email: string;\n cartTotal: number;\n cart: TCart;\n discountCodes: string[];\n promoCodes: string[];\n htmlPromoCodes: string;\n currencyCode: string;\n parentSelector: string; // CSS Selector for parent of widget to be inserted into DOM\n apiKey: string;\n baseUrl: TUrl;\n domain?: string; // Base domain for setting cookies\n lang: LANGUAGES;\n debug: boolean;\n};\n\nexport async function showBeamOrderPageWidgets({\n parentSelector = \".step__sections\",\n apiKey,\n baseUrl = DEFAULT_BASE_URL,\n storeId,\n postalCode,\n discountCodes,\n countryCode,\n orderId,\n email,\n cartTotal,\n cart,\n promoCodes,\n htmlPromoCodes,\n currencyCode = \"USD\",\n domain,\n lang = \"en\",\n debug = false,\n}: TBeamOrderPageParams) {\n const parentElement = document.querySelector(parentSelector) || (await waitForElement(parentSelector));\n if (!parentElement) {\n throw new BeamError(\n `Timed out waiting for selector '${parentSelector}'. Could not render Beam post-purchase widget.`\n );\n }\n\n // If checkout and order page are on different subdomains, we can't access localStorage\n // We can make postTransaction work by copying the cart cookie to the expected localStorage key on the current domain\n const cartId = await getCookieValue(\"cart\"); // Shopify-only cart identifier\n if (cartId) {\n const beamLocalStorage = createScopedLocalStorage({ apiKey });\n const existingValue = beamLocalStorage.getItemJson(\"cart\") || {};\n beamLocalStorage.setItemJson(\"cart\", { ...existingValue, cartId });\n }\n\n // Note: assign properties one by one instead of bulk Object.assign to type check assignments\n const widget = document.createElement(\"beam-post-purchase\");\n widget.apiKey = apiKey;\n widget.baseUrl = baseUrl;\n widget.storeId = storeId;\n widget.postalCode = postalCode;\n widget.countryCode = countryCode;\n widget.orderId = String(orderId);\n widget.email = email;\n widget.cartTotal = cartTotal;\n widget.cart = cart;\n widget.promoCodes = promoCodes;\n widget.htmlPromoCodes = htmlPromoCodes;\n widget.discountCodes = discountCodes;\n widget.currencyCode = currencyCode;\n widget.domain = domain;\n widget.lang = lang;\n widget.debug = debug;\n\n // Insert widget into DOM\n parentElement.appendChild(widget);\n}\n"],"names":["SHOPIFY_BASE_URL","isBeamCartIntegrationRegistered","allowEmitInitialNonprofitSync","skipEmitInitialNonprofitSync","SHOPIFY_CART_COOKIE_NAME","registerCartIntegration","config","autoUpdateShopifyCartAttributes","initNetworkListeners","BeamWidgetInitialNonprofitSyncCancelEvent","BeamNetworkCallEvent","_event","event","cartChangePaths","requestUrlStr","url","currentCart","getCurrentCart","updateCart","lastNonprofitId","lastSelectionId","BeamNonprofitSelectEvent","logger","source","selectedNonprofitId","selectionId","WIDGET_NAMES","beamCartData","getBeamAttributesForCart","appendBeamAttributesToCart","BeamNonprofitSelectionRemovedEvent","newNonprofitId","BeamCartCreatedEvent","BeamCartChangeEvent","appendToShopifyCartBeamAttribute","showBeam","remoteSessionId","statsig","cartId","getExternalCartId","beamCartId","getBeamCartId","BEAM_CART_COOKIE_NAME","chainId","storeId","appendStatsigToShopifyCartAttributes","token","total_price","item_count","currency","items","cart_level_discount_applications","attributes","getShopifyCart","changed","localStorage","createScopedLocalStorage","cachedCart","cart","sku","final_line_price","product_id","line_level_discount_allocations","remoteProductIdentifier","localAmount","discounts","discount_application","title","beamAttr","err","nonprofit_id","selection_id","storedNonprofit","storedSelection","nonprofitChanged","selectionChanged","BeamWidgetInitialNonprofitSyncEvent","isEqual","trackCart","res","memoizeLast","existingBeamCartAttrString","existingBeamCartAttr","newBeamAttrs","omitBy","isUndefined","appendedBeamAttributes","beamCartAttrs","addBeamAttributesToCart","allBeamAttributes","showBeamOrderPageWidgets","parentSelector","apiKey","baseUrl","DEFAULT_BASE_URL","postalCode","discountCodes","countryCode","orderId","email","cartTotal","promoCodes","htmlPromoCodes","currencyCode","domain","lang","debug","parentElement","waitForElement","BeamError","getCookieValue","beamLocalStorage","existingValue","widget"],"mappings":"m3BA+CA,MAAMA,EAAmB,OAAO,SAAS,QAAQ,MAAQ,IAEzD,IAAIC,EAAkC,GAElCC,EAAgC,GAChCC,EAA+B,GAEnC,MAAMC,GAA2B,OAMjC,eAAeC,GACbC,EACAC,EAAkC,GAClC,CACA,GAAIN,EACF,MAAO,GAKTO,IAMA,OAAO,iBAAiBC,EAA0C,UAAW,SAAY,CAEvFN,EAA+B,EACjC,CAAC,EAID,OAAO,iBAAiBO,EAAqB,UAAW,MAAOC,GAAkB,CAC/E,MAAMC,EAAQD,EACRE,EAAkB,kCAElBC,EAAgBF,EAAM,OAAO,OAAS,MAAQA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AAmD,EACA,cAAAC,EACA,YAAAC,EACA,QAAAC,EACA,MAAAC,EACA,UAAAC,EACA,KAAA1C,EACA,WAAA2C,EACA,eAAAC,EACA,aAAAC,EAAe,MACf,OAAAC,EACA,KAAAC,EAAO,KACP,MAAAC,EAAQ,EACV,EAAyB,CACvB,MAAMC,EAAgB,SAAS,cAAchB,CAAc,GAAM,MAAMiB,EAAejB,CAAc,EACpG,GAAI,CAACgB,EACH,MAAM,IAAIE,EACR,mCAAmClB,CAAc,gDACnD,EAKF,MAAMrD,EAAS,MAAMwE,EAAe,MAAM,EAC1C,GAAIxE,EAAQ,CACV,MAAMyE,EAAmBvD,EAAyB,CAAE,OAAAoC,CAAO,CAAC,EACtDoB,EAAgBD,EAAiB,YAAY,MAAM,GAAK,CAAA,EAC9DA,EAAiB,YAAY,OAAQ,CAAE,GAAGC,EAAe,OAAA1E,CAAO,CAAC,CACnE,CAGA,MAAM2E,EAAS,SAAS,cAAc,oBAAoB,EAC1DA,EAAO,OAASrB,EAChBqB,EAAO,QAAUpB,EACjBoB,EAAO,QAAUrE,EACjBqE,EAAO,WAAalB,EACpBkB,EAAO,YAAchB,EACrBgB,EAAO,QAAU,OAAOf,CAAO,EAC/Be,EAAO,MAAQd,EACfc,EAAO,UAAYb,EACnBa,EAAO,KAAOvD,EACduD,EAAO,WAAaZ,EACpBY,EAAO,eAAiBX,EACxBW,EAAO,cAAgBjB,EACvBiB,EAAO,aAAeV,EACtBU,EAAO,OAAST,EAChBS,EAAO,KAAOR,EACdQ,EAAO,MAAQP,EAGfC,EAAc,YAAYM,CAAM,CAClC"}
|
|
1
|
+
{"version":3,"file":"order-page-BL4PDyMz.esm.js","sources":["../../src/integrations/shopify/cart-page.ts","../../src/integrations/shopify/order-page.ts"],"sourcesContent":["/* eslint-disable camelcase */\nimport isEqual from \"lodash-es/isEqual\";\nimport isUndefined from \"lodash-es/isUndefined\";\nimport omitBy from \"lodash-es/omitBy\";\nimport { logger, memoizeLast } from \"../../utils\";\nimport { initNetworkListeners } from \"../../utils/network-listeners\";\nimport {\n BeamCartChangeEvent,\n BeamCartCreatedEvent,\n BeamNetworkCallEvent,\n BeamNonprofitSelectEvent,\n BeamNonprofitSelectionRemovedEvent,\n BeamWidgetInitialNonprofitSyncCancelEvent,\n BeamWidgetInitialNonprofitSyncEvent,\n} from \"../../utils/events\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { BEAM_CART_COOKIE_NAME, TBeamCartLocalStorage, TCart, TCartItems } from \"../../shared/cart-contents\";\nimport { BeamCartAPIConfig, updateCart } from \"../cart\";\nimport { WIDGET_NAMES } from \"../../api-sdk/constants\";\nimport { getBeamCartId, getExternalCartId } from \"../../utils/cart\";\n\nexport type BeamShopifyCartIntegrationConfig = BeamCartAPIConfig & {\n storeId: number; // will be added to cart custom_attributes, and used in cart API call\n chainId?: number; // will be added to cart custom_attributes\n};\n\ntype ShopifyDiscountApplication = {\n title: string;\n value: string;\n};\n\ntype ShopifyLineLevelDiscountAllocations = {\n amount?: string;\n discount_application: ShopifyDiscountApplication;\n};\n\ntype ShopifyCartBeamAttribute = {\n nonprofit_id?: number | null;\n selection_id?: string;\n beam_cart_id?: string;\n shopify_cart_id?: string;\n chain_id?: number;\n store_id?: number;\n show_beam?: boolean;\n remote_session_id?: string;\n};\n\nconst SHOPIFY_BASE_URL = window.Shopify?.routes?.root || \"/\"; // see window.d.ts\n\nlet isBeamCartIntegrationRegistered = false; // Skip registering event listeners if already set up\n\nlet allowEmitInitialNonprofitSync = true; // Skip updating local storage if already run initially\nlet skipEmitInitialNonprofitSync = false; // Allow other processes to skip the nonprofit sync from cart attributes\n\nconst SHOPIFY_CART_COOKIE_NAME = \"cart\";\n\n/**\n * @main registerCartIntegration - set up event listeners to integrate Beam with Shopify cart\n * @return {boolean} returns true if NEW listeners were created, false if setup was already done\n */\nasync function registerCartIntegration(\n config: BeamShopifyCartIntegrationConfig,\n autoUpdateShopifyCartAttributes = true\n) {\n if (isBeamCartIntegrationRegistered) {\n return false; // Do nothing if listeners are already attached\n }\n\n // logger.debug(\"[cart-page][registerCartIntegration] initializing network listeners\");\n // Set up event listeners for AJAX events\n initNetworkListeners();\n\n /**\n * Allow another component to cancel the loading & setting\n * of the Shopify cart selection (like if a selection is made before we've gotten the previous values)\n */\n window.addEventListener(BeamWidgetInitialNonprofitSyncCancelEvent.eventName, async () => {\n // logger.debug(\"[cart-page][BeamWidgetInitialNonprofitSyncCancelEvent]\");\n skipEmitInitialNonprofitSync = true;\n });\n\n // When any network call happens, check if it's for the Shopify /cart AJAX Api.\n // If so, and the cart is updated, send the cart to Beam\n window.addEventListener(BeamNetworkCallEvent.eventName, async (_event: Event) => {\n const event = _event as BeamNetworkCallEvent;\n const cartChangePaths = /cart\\/(add|change|update|clear)/;\n // note: response urls below follow redirects\n const requestUrlStr = event.detail.type === \"xhr\" ? event.detail.xhr.responseURL : event.detail.response.url;\n const url = new URL(requestUrlStr);\n if (!cartChangePaths.test(url.pathname)) {\n return;\n }\n // logger.debug(\"[cart-page][BeamNetworkCallEvent] getting current cart\");\n const currentCart = await getCurrentCart(config);\n if (!currentCart.changed) {\n // logger.debug(`[cart-page][BeamNetworkCallEvent] cart has not changed from URL ${requestUrlStr}`, currentCart.cart);\n return;\n }\n // Send cart to Beam to update timestamp, which is used for cart abandonment / ROI calc\n // logger.debug(`[cart-page][BeamNetworkCallEvent] cart has changed from URL ${requestUrlStr}`, currentCart.cart);\n updateCart(config, currentCart.cart);\n });\n\n // Listen to Beam's own events to integrate Beam data into Shopify order\n let lastNonprofitId: number | null | undefined;\n let lastSelectionId: string | null | undefined;\n window.addEventListener(BeamNonprofitSelectEvent.eventName, async (_event) => {\n const event = _event as BeamNonprofitSelectEvent;\n logger.debug(\"[cart-page][BeamNonprofitSelectEvent]\", event.detail);\n const { source, selectedNonprofitId, selectionId } = event.detail;\n\n // On nonprofit selection, we always write Beam's attributes\n // to the Shopify cart attributes\n if (source === WIDGET_NAMES.select_nonprofit) {\n // Skip update if nothing changed (can happen if widget is re-initialized and\n // emits event after cache restoration, i.e., on cart re-render).\n if (lastNonprofitId === selectedNonprofitId && lastSelectionId === selectionId) {\n return;\n }\n\n const beamCartData = await getBeamAttributesForCart(config);\n await appendBeamAttributesToCart({\n ...beamCartData,\n selectedNonprofitId,\n selectionId,\n });\n lastSelectionId = selectionId;\n lastNonprofitId = selectedNonprofitId;\n }\n });\n\n /**\n * Upon removal of the selected nonprofit from the widget and local storage,\n * an event is emitted and that event is then used to update the cart attributes accordingly\n * This event listener updates the cart attributes based on the emitted event\n */\n window.addEventListener(BeamNonprofitSelectionRemovedEvent.eventName, async (_event) => {\n const event = _event as BeamNonprofitSelectionRemovedEvent;\n logger.debug(\"[cart-page][BeamNonprofitSelectionRemovedEvent]\", event.detail);\n const { newNonprofitId, selectionId } = event.detail;\n\n if (lastNonprofitId === newNonprofitId && lastSelectionId === selectionId) {\n return;\n }\n\n // On nonprofit deselection, we always write Beam's attributes\n // to the Shopify cart attributes\n const beamCartData = await getBeamAttributesForCart(config);\n await appendBeamAttributesToCart({\n ...beamCartData,\n selectedNonprofitId: null,\n selectionId,\n });\n lastSelectionId = selectionId;\n lastNonprofitId = newNonprofitId;\n });\n\n /**\n * When a BeamCart is created, write beam metadata to the Shopify cart if\n * we need to capture it for Statsig or Extensibility\n */\n window.addEventListener(BeamCartCreatedEvent.eventName, async (_event: Event) => {\n const event = _event as BeamCartCreatedEvent;\n logger.debug(\"[cart-page][BeamCartCreatedEvent]\", event.detail);\n if (window.statsig || autoUpdateShopifyCartAttributes) {\n const beamCartData = await getBeamAttributesForCart(config);\n await appendBeamAttributesToCart(beamCartData);\n }\n });\n\n /**\n * On any cart changes, write beam metadata to the Shopify cart if\n * we need to capture it for Statsig or Extensibility\n */\n window.addEventListener(BeamCartChangeEvent.eventName, async (_event: Event) => {\n const event = _event as BeamCartChangeEvent;\n logger.debug(\"[cart-page][BeamCartChangeEvent]\", event.detail);\n if (window.statsig || autoUpdateShopifyCartAttributes) {\n const beamCartData = await getBeamAttributesForCart(config);\n await appendBeamAttributesToCart(beamCartData);\n }\n });\n\n // Handle full-page load, ie, first-time page load and reloads from form submit events\n // This creates a GET to /cart.js\n const currentCart = await getCurrentCart(config);\n // logger.debug(\"[cart-page][registerCartIntegration] initial cart fetch result\", currentCart);\n await updateCart(config, currentCart.cart, true);\n\n isBeamCartIntegrationRegistered = true;\n\n return true;\n}\n\n/* ***************************************** HELPER FUNCTIONS *****************************************\n These may be used individually to integrate with carts if the registerCartIntegration\n script doesn't work for some reason.\n ****************************************************************************************************/\n\nasync function appendToShopifyCartBeamAttribute(config: BeamShopifyCartIntegrationConfig) {\n const beamCartData = await getBeamAttributesForCart(config);\n await appendBeamAttributesToCart(beamCartData);\n}\n\n/**\n * Gathers the base Beam data needed for updating a Shopify cart's metadata\n */\nasync function getBeamAttributesForCart(config: BeamShopifyCartIntegrationConfig) {\n let showBeam;\n let remoteSessionId;\n\n if (window.statsig) {\n // If the site is using Statsig, but not for Beam, we need to ignore it\n try {\n const statsig = window.statsig as any;\n const statsigLayerProperty = statsig?.getLayer(\"beam_trial_layer\")?.get(\"show_beam\");\n if (typeof statsigLayerProperty === \"boolean\") {\n showBeam = statsig.getLayer(\"beam_trial_layer\").get(\"show_beam\", false /* default to hide */) as boolean;\n remoteSessionId = statsig.getStableID();\n }\n } catch (err) {\n // logger.error(err)\n }\n }\n\n const cartId = getExternalCartId(SHOPIFY_CART_COOKIE_NAME, config);\n const beamCartId = getBeamCartId(BEAM_CART_COOKIE_NAME, config);\n const { chainId, storeId } = config;\n\n return {\n showBeam: showBeam ?? undefined,\n remoteSessionId: remoteSessionId ?? undefined,\n beamCartId: beamCartId && beamCartId !== \"null\" ? beamCartId : undefined,\n cartId: cartId && cartId !== \"null\" ? cartId : undefined,\n chainId,\n storeId,\n };\n}\n\n/**\n * Adds Statsig data to a Shopify cart\n */\nconst appendStatsigToShopifyCartAttributes = appendToShopifyCartBeamAttribute;\n\n/**\n * Detects change in cart since last page load,\n * by calling GET /cart.js, and returns cart values.\n * Used for:\n * - Form-based carts where the page refreshes to modify cart instead of using AJAX calls\n * - Hydrogen/GraphQL based carts (needs to be integrated manually)\n */\nasync function getCurrentCart(config: BeamShopifyCartIntegrationConfig): Promise<{\n changed: boolean;\n cart: {\n cartId: string;\n subtotal: number;\n itemCount: number;\n currencyCode: string;\n } & TCart;\n}> {\n const {\n token, // equal to \"cart\" cookie\n total_price, // this is the pretax value, after discounts, and multiplied by 100 (integer from decimal)\n item_count,\n currency,\n items,\n cart_level_discount_applications,\n attributes,\n } = await getShopifyCart();\n\n let changed = false;\n\n const localStorage = createScopedLocalStorage(config);\n\n // The cart cache is used to detect changes after page refreshes / across tabs\n const cachedCart: TBeamCartLocalStorage | null = localStorage.getItemJson(\"cart\");\n // The Beam cart cookie is used to identify the cart across subdomains\n // Use explicit null if empty because API requires it\n const beamCartId: string | null = getBeamCartId(BEAM_CART_COOKIE_NAME, config);\n\n const cart = {\n cartId: token,\n beamCartId,\n subtotal: total_price / 100,\n itemCount: item_count,\n currencyCode: currency,\n schema: { source: \"generic\" } as const,\n content: {\n // pull out minimal fields from full line items\n items: (items as TCartItems).map(({ sku, final_line_price, product_id, line_level_discount_allocations }) => {\n const remoteProductIdentifier = sku || String(product_id);\n const localAmount = final_line_price / 100;\n const discounts = (line_level_discount_allocations as ShopifyLineLevelDiscountAllocations[])?.map(\n ({ discount_application }) => {\n return { code: discount_application?.title, applicable: true };\n }\n );\n return { remoteProductIdentifier, localAmount, discounts };\n }),\n discounts: (cart_level_discount_applications as ShopifyDiscountApplication[]).map(({ title }) => {\n return { code: title, applicable: true };\n }),\n },\n };\n\n let beamAttr: ShopifyCartBeamAttribute | null = null;\n\n try {\n if (attributes?.beam) {\n beamAttr = JSON.parse(attributes.beam);\n }\n } catch (err) {\n logger.error(err);\n }\n\n /**\n * Only attempt to emit BeamWidgetInitialNonprofitSyncEvent once\n * as soon as we see a \"beam\" attribute for the first time.\n * allowEmitInitialNonprofitSync is local to this file to keep this\n * from running more than once.\n * skipEmitInitialNonprofitSync is settable by an event listener\n * so other processes can stop this sync from happening\n */\n if (beamAttr && allowEmitInitialNonprofitSync && !skipEmitInitialNonprofitSync) {\n allowEmitInitialNonprofitSync = false;\n\n const { nonprofit_id, selection_id } = beamAttr;\n\n const storedNonprofit = localStorage.getItem(\"nonprofit\");\n const storedSelection = localStorage.getItem(\"transaction\");\n\n const nonprofitChanged = nonprofit_id !== undefined && String(nonprofit_id) !== storedNonprofit;\n const selectionChanged = selection_id != null && String(selection_id) !== storedSelection;\n\n // Only dispatch if something changed, and if it's not skipped\n if (nonprofitChanged || selectionChanged) {\n if (nonprofitChanged) {\n localStorage.setItem(\"nonprofit\", String(nonprofit_id));\n localStorage.setItem(\"nonprofit_selected_at\", new Date().toISOString());\n }\n\n if (selectionChanged) {\n localStorage.setItem(\"transaction\", String(selection_id));\n localStorage.setItem(\"nonprofit_selected_at\", new Date().toISOString());\n }\n\n window.dispatchEvent(\n new BeamWidgetInitialNonprofitSyncEvent({\n nonprofitId: nonprofit_id,\n nonprofitIdChanged: nonprofitChanged,\n selectionId: selection_id,\n selectionIdChanged: selectionChanged,\n })\n );\n }\n }\n\n if (\n !isEqual(cart, {\n ...cachedCart,\n beamCartId: cachedCart?.beamCartId,\n })\n ) {\n changed = true;\n }\n\n // logger.debug(\"[cart-page][getCurrentCart] has cart changed?\", changed, cart);\n\n return { changed, cart };\n}\n\n/**\n * trackCart - Backwards-compatible alias for updateCart\n */\nconst trackCart = updateCart;\n\n/**\n * Helper function to get the Shopify cart attributes\n */\nconst getShopifyCart = async function () {\n const cart = await window\n .fetch(SHOPIFY_BASE_URL + \"cart.js\", {\n method: \"GET\",\n headers: { \"Content-Type\": \"application/json\" },\n })\n .then((res) => res.json());\n return cart;\n};\n\n/**\n * Sends Beam data to Shopify to integrate with order as custom attributes.\n * Memoized so that calls with the same data as the previous don't create additional API calls to Shopify.\n * This will do an append, not a full overwrite of the attributes in the beam property\n */\nconst appendBeamAttributesToCart = memoizeLast(async function appendBeamAttributesToCart({\n selectedNonprofitId,\n selectionId,\n beamCartId,\n cartId,\n chainId,\n storeId,\n showBeam,\n remoteSessionId,\n}: {\n selectedNonprofitId?: number | null;\n selectionId?: string;\n beamCartId?: string;\n cartId?: string;\n chainId?: number;\n storeId?: number;\n showBeam?: boolean;\n remoteSessionId?: string;\n}) {\n // logger.debug(\"[cart-page][appendBeamAttributesToCart] fetching existing cart\");\n const { attributes } = await getShopifyCart();\n\n // Get only the Beam attribute, if it exists\n const existingBeamCartAttrString = attributes?.beam;\n let existingBeamCartAttr = {};\n try {\n if (existingBeamCartAttrString) {\n existingBeamCartAttr = JSON.parse(existingBeamCartAttrString);\n }\n } catch (err) {\n logger.error(err);\n }\n\n const newBeamAttrs = omitBy(\n {\n nonprofit_id: selectedNonprofitId,\n selection_id: selectionId,\n beam_cart_id: beamCartId,\n shopify_cart_id: cartId,\n chain_id: chainId,\n store_id: storeId,\n show_beam: showBeam,\n remote_session_id: remoteSessionId,\n },\n isUndefined\n );\n\n const appendedBeamAttributes = {\n ...existingBeamCartAttr,\n ...newBeamAttrs,\n } as ShopifyCartBeamAttribute;\n\n // For the nonprofitId, if we specifically get a null value here,\n // we want to remove it from the cart attributes, not just write \"null\"\n if (selectedNonprofitId === null) {\n appendedBeamAttributes.nonprofit_id = undefined;\n }\n\n const beamCartAttrs = {\n beam: JSON.stringify(appendedBeamAttributes),\n };\n\n // If the attributes match, no reason to update the cart\n if (isEqual(appendedBeamAttributes, existingBeamCartAttr)) {\n // logger.debug(\"[cart-page][appendBeamAttributesToCart] cart attributes match, skipping update\");\n return;\n }\n\n try {\n // logger.debug(\"[cart-page][appendBeamAttributesToCart] updating Shopify cart\");\n await window.fetch(SHOPIFY_BASE_URL + \"cart/update.js\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ attributes: beamCartAttrs }),\n });\n } catch (err) {\n logger.error(err); // don't throw, allow later calls to continue\n }\n});\n\n/**\n * Sends Beam data to Shopify to integrate with order as custom attributes.\n * Memoized so that calls with the same data as the previous don't create additional API calls to Shopify.\n * This method force-updates the \"beam\" attribute with the values passed in\n */\nconst addBeamAttributesToCart = memoizeLast(async function addBeamAttributesToCart({\n selectedNonprofitId,\n selectionId,\n beamCartId,\n cartId,\n chainId,\n storeId,\n}: {\n selectedNonprofitId?: number | null;\n selectionId?: string;\n beamCartId?: string;\n cartId?: string;\n chainId?: number;\n storeId?: number;\n}) {\n let showBeam;\n let remoteSessionId;\n\n if (window.statsig) {\n // If the site is using Statsig, but not for Beam, we need to ignore it\n try {\n const statsig = window.statsig as any;\n const statsigLayerProperty = statsig?.getLayer(\"beam_trial_layer\")?.get(\"show_beam\");\n if (typeof statsigLayerProperty === \"boolean\") {\n showBeam = statsig.getLayer(\"beam_trial_layer\").get(\"show_beam\", false /* default to hide */) as boolean;\n remoteSessionId = statsig.getStableID();\n }\n } catch (err) {\n // logger.error(err)\n }\n }\n\n const allBeamAttributes = omitBy(\n {\n nonprofit_id: selectedNonprofitId,\n selection_id: selectionId,\n beam_cart_id: beamCartId,\n shopify_cart_id: cartId,\n chain_id: chainId,\n store_id: storeId,\n show_beam: showBeam,\n remote_session_id: remoteSessionId,\n },\n isUndefined\n ) as ShopifyCartBeamAttribute;\n\n // For the nonprofitId, if we specifically get a null value here,\n // we want to remove it from the cart attributes, not just write \"null\"\n if (selectedNonprofitId === null) {\n allBeamAttributes.nonprofit_id = undefined;\n }\n\n const beamCartAttrs = {\n beam: JSON.stringify(allBeamAttributes),\n };\n\n try {\n await window.fetch(SHOPIFY_BASE_URL + \"cart/update.js\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ attributes: beamCartAttrs }),\n });\n } catch (err) {\n logger.error(err); // don't throw, allow later calls to continue\n }\n});\n\ndeclare global {\n interface Window {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n statsig?: any; // attached by Statsig CDN script\n }\n}\nexport {\n trackCart,\n getCurrentCart,\n addBeamAttributesToCart,\n appendStatsigToShopifyCartAttributes,\n appendToShopifyCartBeamAttribute,\n registerCartIntegration,\n appendBeamAttributesToCart,\n getShopifyCart,\n getBeamAttributesForCart,\n};\n","import \"../../components/post-purchase\";\nimport { postTransaction } from \"../../api-sdk/v3/routes\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES, TUrl } from \"../../api-sdk/types\";\nimport { waitForElement } from \"../../utils/wait-for-element\";\nimport { BeamError } from \"../../utils/beam-errors\";\nimport { getCookieValue } from \"../../utils/cookies\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { TCart } from \"../../shared/cart-contents\";\n\n// Shopify admin page: admin/settings/checkout\n\nexport type TBeamOrderPageParams = Parameters<typeof postTransaction>[0][\"requestBody\"] & {\n // Either storeId or postalCode + countryCode must be provided\n storeId?: number;\n postalCode?: string;\n countryCode?: string;\n orderId: string;\n email: string;\n cartTotal: number;\n cart: TCart;\n discountCodes: string[];\n promoCodes: string[];\n htmlPromoCodes: string;\n currencyCode: string;\n parentSelector: string; // CSS Selector for parent of widget to be inserted into DOM\n apiKey: string;\n baseUrl: TUrl;\n domain?: string; // Base domain for setting cookies\n lang: LANGUAGES;\n debug: boolean;\n};\n\nexport async function showBeamOrderPageWidgets({\n parentSelector = \".step__sections\",\n apiKey,\n baseUrl = DEFAULT_BASE_URL,\n storeId,\n postalCode,\n discountCodes,\n countryCode,\n orderId,\n email,\n cartTotal,\n cart,\n promoCodes,\n htmlPromoCodes,\n currencyCode = \"USD\",\n domain,\n lang = \"en\",\n debug = false,\n}: TBeamOrderPageParams) {\n const parentElement = document.querySelector(parentSelector) || (await waitForElement(parentSelector));\n if (!parentElement) {\n throw new BeamError(\n `Timed out waiting for selector '${parentSelector}'. Could not render Beam post-purchase widget.`\n );\n }\n\n // If checkout and order page are on different subdomains, we can't access localStorage\n // We can make postTransaction work by copying the cart cookie to the expected localStorage key on the current domain\n const cartId = await getCookieValue(\"cart\"); // Shopify-only cart identifier\n if (cartId) {\n const beamLocalStorage = createScopedLocalStorage({ apiKey });\n const existingValue = beamLocalStorage.getItemJson(\"cart\") || {};\n beamLocalStorage.setItemJson(\"cart\", { ...existingValue, cartId });\n }\n\n // Note: assign properties one by one instead of bulk Object.assign to type check assignments\n const widget = document.createElement(\"beam-post-purchase\");\n widget.apiKey = apiKey;\n widget.baseUrl = baseUrl;\n widget.storeId = storeId;\n widget.postalCode = postalCode;\n widget.countryCode = countryCode;\n widget.orderId = String(orderId);\n widget.email = email;\n widget.cartTotal = cartTotal;\n widget.cart = cart;\n widget.promoCodes = promoCodes;\n widget.htmlPromoCodes = htmlPromoCodes;\n widget.discountCodes = discountCodes;\n widget.currencyCode = currencyCode;\n widget.domain = domain;\n widget.lang = lang;\n widget.debug = debug;\n\n // Insert widget into DOM\n parentElement.appendChild(widget);\n}\n"],"names":["SHOPIFY_BASE_URL","isBeamCartIntegrationRegistered","allowEmitInitialNonprofitSync","skipEmitInitialNonprofitSync","SHOPIFY_CART_COOKIE_NAME","registerCartIntegration","config","autoUpdateShopifyCartAttributes","initNetworkListeners","BeamWidgetInitialNonprofitSyncCancelEvent","BeamNetworkCallEvent","_event","event","cartChangePaths","requestUrlStr","url","currentCart","getCurrentCart","updateCart","lastNonprofitId","lastSelectionId","BeamNonprofitSelectEvent","logger","source","selectedNonprofitId","selectionId","WIDGET_NAMES","beamCartData","getBeamAttributesForCart","appendBeamAttributesToCart","BeamNonprofitSelectionRemovedEvent","newNonprofitId","BeamCartCreatedEvent","BeamCartChangeEvent","appendToShopifyCartBeamAttribute","showBeam","remoteSessionId","statsig","cartId","getExternalCartId","beamCartId","getBeamCartId","BEAM_CART_COOKIE_NAME","chainId","storeId","appendStatsigToShopifyCartAttributes","token","total_price","item_count","currency","items","cart_level_discount_applications","attributes","getShopifyCart","changed","localStorage","createScopedLocalStorage","cachedCart","cart","sku","final_line_price","product_id","line_level_discount_allocations","remoteProductIdentifier","localAmount","discounts","discount_application","title","beamAttr","err","nonprofit_id","selection_id","storedNonprofit","storedSelection","nonprofitChanged","selectionChanged","BeamWidgetInitialNonprofitSyncEvent","isEqual","trackCart","res","memoizeLast","existingBeamCartAttrString","existingBeamCartAttr","newBeamAttrs","omitBy","isUndefined","appendedBeamAttributes","beamCartAttrs","addBeamAttributesToCart","allBeamAttributes","showBeamOrderPageWidgets","parentSelector","apiKey","baseUrl","DEFAULT_BASE_URL","postalCode","discountCodes","countryCode","orderId","email","cartTotal","promoCodes","htmlPromoCodes","currencyCode","domain","lang","debug","parentElement","waitForElement","BeamError","getCookieValue","beamLocalStorage","existingValue","widget"],"mappings":"m3BA+CA,MAAMA,EAAmB,OAAO,SAAS,QAAQ,MAAQ,IAEzD,IAAIC,EAAkC,GAElCC,EAAgC,GAChCC,EAA+B,GAEnC,MAAMC,GAA2B,OAMjC,eAAeC,GACbC,EACAC,EAAkC,GAClC,CACA,GAAIN,EACF,MAAO,GAKTO,IAMA,OAAO,iBAAiBC,EAA0C,UAAW,SAAY,CAEvFN,EAA+B,EACjC,CAAC,EAID,OAAO,iBAAiBO,EAAqB,UAAW,MAAOC,GAAkB,CAC/E,MAAMC,EAAQD,EACRE,EAAkB,kCAElBC,EAAgBF,EAAM,OAAO,OAAS,MAAQA,EAAM,OAAO,IAAI,YAAcA,EAAM,OAAO,SAAS,IACnGG,EAAM,IAAI,IAAID,CAAa,EACjC,GAAI,CAACD,EAAgB,KAAKE,EAAI,QAAQ,EACpC,OAGF,MAAMC,EAAc,MAAMC,EAAeX,CAAM,EAC1CU,EAAY,SAMjBE,EAAWZ,EAAQU,EAAY,IAAI,CACrC,CAAC,EAGD,IAAIG,EACAC,EACJ,OAAO,iBAAiBC,EAAyB,UAAW,MAAOV,GAAW,CAC5E,MAAMC,EAAQD,EACdW,EAAO,MAAM,wCAAyCV,EAAM,MAAM,EAClE,KAAM,CAAE,OAAAW,EAAQ,oBAAAC,EAAqB,YAAAC,CAAY,EAAIb,EAAM,OAI3D,GAAIW,IAAWG,EAAa,iBAAkB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