@beamimpact/web-sdk 1.58.0 → 1.58.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-Caoc1gRc.esm.js → _share-dialog-dependencies-C3oAeUgm.esm.js} +2 -2
- package/dist/chunks/{_share-dialog-dependencies-Caoc1gRc.esm.js.map → _share-dialog-dependencies-C3oAeUgm.esm.js.map} +1 -1
- package/dist/chunks/{cart-DKQHSz5X.esm.d.ts → cart-Cm16_NVB.esm.d.ts} +3 -4
- package/dist/chunks/index-B2GUlwwp.esm.js +2 -0
- package/dist/chunks/index-B2GUlwwp.esm.js.map +1 -0
- package/dist/chunks/{index-DGOC8m2r.esm.d.ts → index-BG63SUjk.esm.d.ts} +1 -1
- package/dist/chunks/{index-BxivRkBL.esm.js → index-BhlTVL8_.esm.js} +2 -2
- package/dist/chunks/{index-BxivRkBL.esm.js.map → index-BhlTVL8_.esm.js.map} +1 -1
- package/dist/chunks/{index-M8hQ6GXf.esm.js → index-BlaOItQr.esm.js} +2 -2
- package/dist/chunks/{index-M8hQ6GXf.esm.js.map → index-BlaOItQr.esm.js.map} +1 -1
- package/dist/chunks/{index-Bi9LFICg.esm.d.ts → index-Bn65er6F.esm.d.ts} +1 -1
- package/dist/chunks/{index-BF0X_60j.esm.js → index-BtG64tE0.esm.js} +2 -2
- package/dist/chunks/{index-BF0X_60j.esm.js.map → index-BtG64tE0.esm.js.map} +1 -1
- package/dist/chunks/{index-Yt9xXa7z.esm.js → index-C6QfHWnX.esm.js} +2 -2
- package/dist/chunks/{index-Yt9xXa7z.esm.js.map → index-C6QfHWnX.esm.js.map} +1 -1
- package/dist/chunks/{index-h_-rDiMR.esm.d.ts → index-CSQv0_2I.esm.d.ts} +1 -1
- package/dist/chunks/{index-DtAcPGd4.esm.js → index-DC8IegOb.esm.js} +2 -2
- package/dist/chunks/{index-DtAcPGd4.esm.js.map → index-DC8IegOb.esm.js.map} +1 -1
- package/dist/chunks/index-PWwahCdj.esm.js +2 -0
- package/dist/chunks/index-PWwahCdj.esm.js.map +1 -0
- package/dist/chunks/{index-DQ89VjpD.esm.d.ts → index-_M2mg4n1.esm.d.ts} +1 -1
- package/dist/chunks/{index-E6IoMPQu.esm.js → index-hCVICwBS.esm.js} +2 -2
- package/dist/chunks/{index-E6IoMPQu.esm.js.map → index-hCVICwBS.esm.js.map} +1 -1
- package/dist/chunks/{promo-pill-label-DCBXltdj.esm.js → promo-pill-label-rA01UjBk.esm.js} +2 -2
- package/dist/chunks/{promo-pill-label-DCBXltdj.esm.js.map → promo-pill-label-rA01UjBk.esm.js.map} +1 -1
- package/dist/chunks/{share-button-C1PRjoPw.esm.js → share-button-BxrZs18u.esm.js} +2 -2
- package/dist/chunks/{share-button-C1PRjoPw.esm.js.map → share-button-BxrZs18u.esm.js.map} +1 -1
- package/dist/chunks/{share-button-CNq5lDre.esm.js → share-button-DQT2zQ7w.esm.js} +3 -2
- package/dist/chunks/{share-button-CNq5lDre.esm.js.map → share-button-DQT2zQ7w.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-B5Tr9N3V.esm.d.ts → update-cart-uoS0BDZq.esm.d.ts} +1 -1
- package/dist/chunks/{utils-BPcZ5h8J.esm.d.ts → utils-DfsVjUY-.esm.d.ts} +1 -0
- package/dist/chunks/utils-ly9wMwUO.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 +1 -1
- package/dist/components/community-impact.js +1 -1
- package/dist/components/cumulative-impact.d.ts +1 -1
- package/dist/components/cumulative-impact.esm.js +1 -1
- package/dist/components/cumulative-impact.js +1 -1
- package/dist/components/impact-overview.d.ts +1 -1
- package/dist/components/impact-overview.esm.js +1 -1
- package/dist/components/impact-overview.js +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.esm.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/post-purchase.d.ts +1 -1
- 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 +1 -1
- package/dist/components/product-details-page.esm.js +1 -1
- package/dist/components/product-details-page.js +1 -1
- package/dist/components/redeem-transaction.d.ts +1 -1
- package/dist/components/redeem-transaction.esm.js +1 -1
- package/dist/components/redeem-transaction.js +1 -1
- package/dist/components/select-nonprofit.d.ts +1 -1
- package/dist/components/select-nonprofit.esm.js +6 -6
- package/dist/components/select-nonprofit.esm.js.map +1 -1
- package/dist/components/select-nonprofit.js +6 -6
- package/dist/components/select-nonprofit.js.map +1 -1
- package/dist/components/select-subscription-nonprofit.d.ts +1 -1
- package/dist/components/select-subscription-nonprofit.esm.js +1 -1
- package/dist/components/select-subscription-nonprofit.js +1 -1
- package/dist/components/shopify.d.ts +4 -4
- package/dist/components/shopify.esm.js +1 -1
- package/dist/components/shopify.esm.js.map +1 -1
- package/dist/components/shopify.js +1 -1
- package/dist/components/shopify.js.map +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/subscriber-select-nonprofit.d.ts +1 -1
- package/dist/components/subscriber-select-nonprofit.esm.js +1 -1
- package/dist/components/subscriber-select-nonprofit.js +1 -1
- package/dist/components/subscription-impact.d.ts +2 -1
- package/dist/components/subscription-impact.esm.js +18 -17
- package/dist/components/subscription-impact.esm.js.map +1 -1
- package/dist/components/subscription-impact.js +18 -17
- package/dist/components/subscription-impact.js.map +1 -1
- package/dist/components/subscription-management.d.ts +3 -1
- package/dist/components/subscription-management.esm.js +19 -17
- package/dist/components/subscription-management.esm.js.map +1 -1
- package/dist/components/subscription-management.js +19 -17
- package/dist/components/subscription-management.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/beam.d.ts +1 -1
- package/dist/integrations/beam.esm.js +1 -1
- package/dist/integrations/beam.js +1 -1
- package/dist/integrations/cart.d.ts +2 -2
- package/dist/integrations/cart.esm.js +1 -1
- package/dist/integrations/cart.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/promoManager.d.ts +1 -1
- package/dist/integrations/shopify-order.d.ts +1 -1
- package/dist/integrations/shopify-order.esm.js +1 -1
- package/dist/integrations/shopify-order.js +1 -1
- package/dist/integrations/shopify.d.ts +3 -3
- package/dist/integrations/shopify.esm.js +1 -1
- package/dist/integrations/shopify.js +1 -1
- package/dist/integrations/statsig.d.ts +1 -1
- package/dist/integrations/statsig.esm.js +14 -14
- package/dist/integrations/statsig.esm.js.map +1 -1
- package/dist/integrations/statsig.js +14 -14
- package/dist/integrations/statsig.js.map +1 -1
- package/dist/integrations/utils.d.ts +1 -1
- 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 +1 -1
- package/dist/react/impact-overview.esm.js +1 -1
- package/dist/react/impact-overview.js +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.esm.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/post-purchase.d.ts +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/react/redeem-transaction.esm.js +1 -1
- package/dist/react/redeem-transaction.js +1 -1
- package/dist/react/select-nonprofit.d.ts +1 -1
- 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 +1 -1
- package/dist/react/select-subscription-nonprofit.esm.js +1 -1
- package/dist/react/select-subscription-nonprofit.js +1 -1
- package/dist/react/shopify.esm.js +1 -1
- package/dist/react/shopify.esm.js.map +1 -1
- package/dist/react/shopify.js +1 -1
- package/dist/react/shopify.js.map +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/subscriber-select-nonprofit.d.ts +1 -1
- package/dist/react/subscriber-select-nonprofit.esm.js +1 -1
- package/dist/react/subscriber-select-nonprofit.js +1 -1
- package/dist/react/subscription-impact.d.ts +1 -1
- package/dist/react/subscription-impact.esm.js +1 -1
- package/dist/react/subscription-impact.js +1 -1
- package/dist/react/subscription-management.d.ts +1 -1
- package/dist/react/subscription-management.esm.js +1 -1
- package/dist/react/subscription-management.js +1 -1
- package/dist/utils/beam-errors.d.ts +1 -1
- package/dist/utils/cart.d.ts +1 -1
- package/dist/utils/clear-beam-storage.d.ts +1 -1
- package/dist/utils/cookies.d.ts +1 -1
- package/dist/utils/events.d.ts +1 -1
- package/dist/utils/local-storage.d.ts +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/makeApiKeyHeader.d.ts +1 -1
- package/dist/utils/memoize-last.d.ts +1 -1
- package/dist/utils/network-listeners.d.ts +1 -1
- package/dist/utils/promoManager.d.ts +1 -1
- package/dist/utils/remote-session.d.ts +1 -1
- package/dist/utils/wait-for-element.d.ts +1 -1
- package/package.json +3 -3
- package/dist/chunks/index-ADw_ucEx.esm.js +0 -2
- package/dist/chunks/index-ADw_ucEx.esm.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{f as m}from"../chunks/lit-BEag9MFp.esm.js";import{B as r}from"../chunks/utils-ly9wMwUO.esm.js";import{B as t}from"../chunks/index-
|
|
1
|
+
import o from"react";import{f as m}from"../chunks/lit-BEag9MFp.esm.js";import{B as r}from"../chunks/utils-ly9wMwUO.esm.js";import{B as t}from"../chunks/index-C6QfHWnX.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../components/beam-partner-logos.js";import"../chunks/promo-pill-label-rA01UjBk.esm.js";import"../chunks/_share-dialog-dependencies-C3oAeUgm.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";const e=m({tagName:t.tagName,elementClass:t,react:o,events:{onNonprofitSelect:r.eventName}});export{e as BeamRedeemTransaction,e as default};
|
|
2
2
|
//# sourceMappingURL=redeem-transaction.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _lit_react from '@lit/react';
|
|
2
2
|
import { EventName } from '@lit/react';
|
|
3
|
-
import { B as BeamNonprofitSelectEvent } from '../chunks/utils-
|
|
3
|
+
import { B as BeamNonprofitSelectEvent } from '../chunks/utils-DfsVjUY-.esm.js';
|
|
4
4
|
import { BeamSelectNonprofit as BeamSelectNonprofit$1 } from '../components/select-nonprofit.js';
|
|
5
5
|
import 'lodash-es/debounce';
|
|
6
6
|
import 'lodash-es/isEqual';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{f as e}from"../chunks/lit-BEag9MFp.esm.js";import{B as m}from"../chunks/utils-ly9wMwUO.esm.js";import{BeamSelectNonprofit as r}from"../components/select-nonprofit.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-
|
|
1
|
+
import o from"react";import{f as e}from"../chunks/lit-BEag9MFp.esm.js";import{B as m}from"../chunks/utils-ly9wMwUO.esm.js";import{BeamSelectNonprofit as r}from"../components/select-nonprofit.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";import"../chunks/promo-pill-label-rA01UjBk.esm.js";import"../chunks/_share-dialog-dependencies-C3oAeUgm.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";const t=e({tagName:"beam-select-nonprofit",elementClass:r,react:o,events:{onNonprofitSelect:m.eventName}});export{t as BeamSelectNonprofit,t as default};
|
|
2
2
|
//# sourceMappingURL=select-nonprofit.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{f as e}from"../chunks/lit-BEag9MFp.esm.js";import{B as m}from"../chunks/utils-ly9wMwUO.esm.js";import{BeamSelectNonprofit as r}from"../components/select-nonprofit.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-
|
|
1
|
+
import o from"react";import{f as e}from"../chunks/lit-BEag9MFp.esm.js";import{B as m}from"../chunks/utils-ly9wMwUO.esm.js";import{BeamSelectNonprofit as r}from"../components/select-nonprofit.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";import"../chunks/promo-pill-label-rA01UjBk.esm.js";import"../chunks/_share-dialog-dependencies-C3oAeUgm.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";const t=e({tagName:"beam-select-nonprofit",elementClass:r,react:o,events:{onNonprofitSelect:m.eventName}});export{t as BeamSelectNonprofit,t as default};
|
|
2
2
|
//# sourceMappingURL=select-nonprofit.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _lit_react from '@lit/react';
|
|
2
2
|
import { EventName } from '@lit/react';
|
|
3
|
-
import { B as BeamNonprofitSelectEvent } from '../chunks/utils-
|
|
3
|
+
import { B as BeamNonprofitSelectEvent } from '../chunks/utils-DfsVjUY-.esm.js';
|
|
4
4
|
import { BeamSelectSubscriptionNonprofit as BeamSelectSubscriptionNonprofit$1 } from '../components/select-subscription-nonprofit.js';
|
|
5
5
|
import 'lodash-es/debounce';
|
|
6
6
|
import 'lodash-es/isEqual';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{B as m}from"../chunks/utils-ly9wMwUO.esm.js";import{BeamSelectSubscriptionNonprofit as t}from"../components/select-subscription-nonprofit.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-
|
|
1
|
+
import e from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{B as m}from"../chunks/utils-ly9wMwUO.esm.js";import{BeamSelectSubscriptionNonprofit as t}from"../components/select-subscription-nonprofit.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../components/beam-partner-logos.esm.js";const o=r({tagName:t.tagName,elementClass:t,react:e,events:{onNonprofitSelect:m.eventName}});export{o as BeamSelectSubscriptionNonprofit,o as default};
|
|
2
2
|
//# sourceMappingURL=select-subscription-nonprofit.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{B as m}from"../chunks/utils-ly9wMwUO.esm.js";import{BeamSelectSubscriptionNonprofit as t}from"../components/select-subscription-nonprofit.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-
|
|
1
|
+
import e from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{B as m}from"../chunks/utils-ly9wMwUO.esm.js";import{BeamSelectSubscriptionNonprofit as t}from"../components/select-subscription-nonprofit.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../components/beam-partner-logos.js";const o=r({tagName:t.tagName,elementClass:t,react:e,events:{onNonprofitSelect:m.eventName}});export{o as BeamSelectSubscriptionNonprofit,o as default};
|
|
2
2
|
//# sourceMappingURL=select-subscription-nonprofit.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{V as
|
|
1
|
+
import{V as C,A as s,Y as i,Z as S,e as c,h as p,_ as u,a as w,g as r,k,H as P,f,v as E,j as A,b as v,E as y,l as L,$ as I,R as _,a0 as F,G as R,p as b,s as x,o as n,J as N,I as V,X as h,w as z,q}from"../chunks/utils-ly9wMwUO.esm.js";import{d as B,i as J}from"../chunks/lodash-CrMU6wKg.esm.js";import{v as K}from"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/lit-BEag9MFp.esm.js";function O(e){window.beamStatsigContext=e}function M(){return window.beamStatsigContext}var U=Object.freeze({__proto__:null,clearBeamStorage:C,createScopedLocalStorage:s,debounce:B,deleteCookieValue:i,errors:S,events:c,formatStoreAndReturnPromoCodes:p,getAllPromoCodesFromCookie:u,getCookieMap:w,getCookieValue:r,getPromoCodeFromShopifyCookie:k,getPromoCodesFromCart:P,getPromoCodesLocalStorage:f,getRemoteSession:E,getSanitizedUrlForStorage:A,initNetworkListeners:v,isEmptyPromoData:y,isEqual:J,logger:L,mapToUnvalidatedPromoCodes:I,memoizeLast:_,mergeStoreAndReturnPromos:F,parseJsonStringArray:R,promoCodesAreEqual:b,saveRemoteSession:x,setCookieValue:n,setPromoCodeInCookie:N,setPromoCodesInLocalStorage:V,teardownNetworkListeners:h,waitForElement:z});const m=q.SESSION;async function d({cookieName:e=m,domain:a=window.location.hostname,apiKey:t=""}={}){if(await r(e))return;const o=K(),l=Date.now()+720*60*60*1e3;await n({name:e,value:o,domain:a,path:"/",expires:l}),s({apiKey:t}).setItemJson("cart",{cartId:o})}async function g({cookieName:e=m,domain:a=window.location.hostname,apiKey:t=""}={}){const o=await r(e);o&&(s({apiKey:t}).setItemJson("cart",{cartId:o}),await i({name:e,domain:a}))}var j=Object.freeze({__proto__:null,createSession:d,endSession:g});export{U as a,d as c,g as e,M as g,j as i,O as s};
|
|
2
2
|
//# sourceMappingURL=shopify.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shopify.esm.js","sources":["../../src/integrations/session/index.ts"],"sourcesContent":["/**\n If checkout and order page are on different subdomains, we can't access localStorage for nonprofitId/selectionId\n We can make post-transaction work by copying a \"cartID\"-style cookie to the expected localStorage key on the current\n domain, which will allow the post-transaction widgets to send that to the backend which can restore the selection\n from the cart.\n\n This will also work if we don't have a cart cookie for some other reason, although it is not directly integrated\n with the host site's concept of a cart (e.g., line items and expiration dates).\n\n Note: Use a module import rather than a self-executing script so that we can set cookies on the host domain\n rather than our 3rd party CDN domain, and customize the options via arguments.\n\n Usage:\n <script type=\"module\">\n import { createSession } from 'https://...';\n createSession({domain: 'mystore.com'})\n </script>\n */\n\nimport { v4 as uuid } from \"@lukeed/uuid/secure\";\nimport { deleteCookieValue, getCookieValue, setCookieValue } from \"../../utils/cookies\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { BEAM_COOKIE_NAMES } from \"../../api-sdk/constants\";\n\nconst DEFAULT_COOKIE_NAME = BEAM_COOKIE_NAMES.SESSION;\n\nexport async function createSession({\n cookieName = DEFAULT_COOKIE_NAME,\n domain = window.location.hostname, // domain or subdomain to set cookie on\n apiKey = \"\", // optional unless scoping localStorage to api key\n} = {}) {\n const existingValue = await getCookieValue(cookieName);\n\n if (existingValue) {\n return; // do nothing\n }\n\n const cookieValue = uuid();\n\n const expires = Date.now() + 30 * 24 * 60 * 60 * 1000; // 30 days\n\n await setCookieValue({ name: cookieName, value: cookieValue, domain, path: \"/\", expires });\n\n const beamLocalStorage = createScopedLocalStorage({ apiKey });\n beamLocalStorage.setItemJson(\"cart\", { cartId: cookieValue });\n}\n\nexport async function endSession({\n cookieName = DEFAULT_COOKIE_NAME,\n domain = window.location.hostname, // domain to remove cookie from\n apiKey = \"\", // optional unless scoping localStorage to api key\n} = {}) {\n const cookieValue = await getCookieValue(cookieName);\n\n if (!cookieValue) {\n return; // do nothing\n }\n\n // copy cookie value into localStorage for widgets to use\n const beamLocalStorage = createScopedLocalStorage({ apiKey });\n beamLocalStorage.setItemJson(\"cart\", { cartId: cookieValue });\n\n // delete cookie to end session (will generate new one on next visit)\n await deleteCookieValue({ name: cookieName, domain });\n}\n"],"names":["DEFAULT_COOKIE_NAME","BEAM_COOKIE_NAMES","createSession","cookieName","domain","apiKey","getCookieValue","cookieValue","uuid","expires","setCookieValue","createScopedLocalStorage","endSession","deleteCookieValue"],"mappings":"
|
|
1
|
+
{"version":3,"file":"shopify.esm.js","sources":["../../src/shared/beam-statsig-context.ts","../../src/integrations/session/index.ts"],"sourcesContent":["/**\n * Beam-owned handoff between the Statsig plugin and the cart integration.\n * The plugin sets it once the shopper is assigned. Kept on window, not module state,\n * so it works whether or not the two chunks share a webpack runtime.\n */\nexport type BeamStatsigContext = {\n showBeam: boolean;\n stableId?: string;\n};\n\ndeclare global {\n interface Window {\n beamStatsigContext?: BeamStatsigContext;\n }\n}\n\nexport function setBeamStatsigContext(context: BeamStatsigContext) {\n window.beamStatsigContext = context;\n}\n\nexport function getBeamStatsigContext(): BeamStatsigContext | undefined {\n return window.beamStatsigContext;\n}\n","/**\n If checkout and order page are on different subdomains, we can't access localStorage for nonprofitId/selectionId\n We can make post-transaction work by copying a \"cartID\"-style cookie to the expected localStorage key on the current\n domain, which will allow the post-transaction widgets to send that to the backend which can restore the selection\n from the cart.\n\n This will also work if we don't have a cart cookie for some other reason, although it is not directly integrated\n with the host site's concept of a cart (e.g., line items and expiration dates).\n\n Note: Use a module import rather than a self-executing script so that we can set cookies on the host domain\n rather than our 3rd party CDN domain, and customize the options via arguments.\n\n Usage:\n <script type=\"module\">\n import { createSession } from 'https://...';\n createSession({domain: 'mystore.com'})\n </script>\n */\n\nimport { v4 as uuid } from \"@lukeed/uuid/secure\";\nimport { deleteCookieValue, getCookieValue, setCookieValue } from \"../../utils/cookies\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { BEAM_COOKIE_NAMES } from \"../../api-sdk/constants\";\n\nconst DEFAULT_COOKIE_NAME = BEAM_COOKIE_NAMES.SESSION;\n\nexport async function createSession({\n cookieName = DEFAULT_COOKIE_NAME,\n domain = window.location.hostname, // domain or subdomain to set cookie on\n apiKey = \"\", // optional unless scoping localStorage to api key\n} = {}) {\n const existingValue = await getCookieValue(cookieName);\n\n if (existingValue) {\n return; // do nothing\n }\n\n const cookieValue = uuid();\n\n const expires = Date.now() + 30 * 24 * 60 * 60 * 1000; // 30 days\n\n await setCookieValue({ name: cookieName, value: cookieValue, domain, path: \"/\", expires });\n\n const beamLocalStorage = createScopedLocalStorage({ apiKey });\n beamLocalStorage.setItemJson(\"cart\", { cartId: cookieValue });\n}\n\nexport async function endSession({\n cookieName = DEFAULT_COOKIE_NAME,\n domain = window.location.hostname, // domain to remove cookie from\n apiKey = \"\", // optional unless scoping localStorage to api key\n} = {}) {\n const cookieValue = await getCookieValue(cookieName);\n\n if (!cookieValue) {\n return; // do nothing\n }\n\n // copy cookie value into localStorage for widgets to use\n const beamLocalStorage = createScopedLocalStorage({ apiKey });\n beamLocalStorage.setItemJson(\"cart\", { cartId: cookieValue });\n\n // delete cookie to end session (will generate new one on next visit)\n await deleteCookieValue({ name: cookieName, domain });\n}\n"],"names":["setBeamStatsigContext","context","getBeamStatsigContext","DEFAULT_COOKIE_NAME","BEAM_COOKIE_NAMES","createSession","cookieName","domain","apiKey","getCookieValue","cookieValue","uuid","expires","setCookieValue","createScopedLocalStorage","endSession","deleteCookieValue"],"mappings":"iYAgBO,SAASA,EAAsBC,EAA6B,CACjE,OAAO,mBAAqBA,CAC9B,CAEO,SAASC,GAAwD,CACtE,OAAO,OAAO,kBAChB,6pBCEA,MAAMC,EAAsBC,EAAkB,QAE9C,eAAsBC,EAAc,CAClC,WAAAC,EAAaH,EACb,OAAAI,EAAS,OAAO,SAAS,SACzB,OAAAC,EAAS,EACX,EAAI,GAAI,CAGN,GAFsB,MAAMC,EAAeH,CAAU,EAGnD,OAGF,MAAMI,EAAcC,IAEdC,EAAU,KAAK,IAAA,EAAQ,IAAU,GAAK,GAAK,IAEjD,MAAMC,EAAe,CAAE,KAAMP,EAAY,MAAOI,EAAa,OAAAH,EAAQ,KAAM,IAAK,QAAAK,CAAQ,CAAC,EAEhEE,EAAyB,CAAE,OAAAN,CAAO,CAAC,EAC3C,YAAY,OAAQ,CAAE,OAAQE,CAAY,CAAC,CAC9D,CAEA,eAAsBK,EAAW,CAC/B,WAAAT,EAAaH,EACb,OAAAI,EAAS,OAAO,SAAS,SACzB,OAAAC,EAAS,EACX,EAAI,GAAI,CACN,MAAME,EAAc,MAAMD,EAAeH,CAAU,EAE9CI,IAKoBI,EAAyB,CAAE,OAAAN,CAAO,CAAC,EAC3C,YAAY,OAAQ,CAAE,OAAQE,CAAY,CAAC,EAG5D,MAAMM,EAAkB,CAAE,KAAMV,EAAY,OAAAC,CAAO,CAAC,EACtD"}
|
package/dist/react/shopify.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{V as
|
|
1
|
+
import{V as C,A as s,Y as i,Z as S,e as c,h as p,_ as u,a as w,g as r,k,H as P,f,v as E,j as A,b as v,E as y,l as L,$ as I,R as _,a0 as F,G as R,p as b,s as x,o as n,J as N,I as V,X as h,w as z,q}from"../chunks/utils-ly9wMwUO.esm.js";import{d as B,i as J}from"../chunks/lodash-CrMU6wKg.esm.js";import{v as K}from"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/lit-BEag9MFp.esm.js";function O(e){window.beamStatsigContext=e}function M(){return window.beamStatsigContext}var U=Object.freeze({__proto__:null,clearBeamStorage:C,createScopedLocalStorage:s,debounce:B,deleteCookieValue:i,errors:S,events:c,formatStoreAndReturnPromoCodes:p,getAllPromoCodesFromCookie:u,getCookieMap:w,getCookieValue:r,getPromoCodeFromShopifyCookie:k,getPromoCodesFromCart:P,getPromoCodesLocalStorage:f,getRemoteSession:E,getSanitizedUrlForStorage:A,initNetworkListeners:v,isEmptyPromoData:y,isEqual:J,logger:L,mapToUnvalidatedPromoCodes:I,memoizeLast:_,mergeStoreAndReturnPromos:F,parseJsonStringArray:R,promoCodesAreEqual:b,saveRemoteSession:x,setCookieValue:n,setPromoCodeInCookie:N,setPromoCodesInLocalStorage:V,teardownNetworkListeners:h,waitForElement:z});const m=q.SESSION;async function d({cookieName:e=m,domain:a=window.location.hostname,apiKey:t=""}={}){if(await r(e))return;const o=K(),l=Date.now()+720*60*60*1e3;await n({name:e,value:o,domain:a,path:"/",expires:l}),s({apiKey:t}).setItemJson("cart",{cartId:o})}async function g({cookieName:e=m,domain:a=window.location.hostname,apiKey:t=""}={}){const o=await r(e);o&&(s({apiKey:t}).setItemJson("cart",{cartId:o}),await i({name:e,domain:a}))}var j=Object.freeze({__proto__:null,createSession:d,endSession:g});export{U as a,d as c,g as e,M as g,j as i,O as s};
|
|
2
2
|
//# sourceMappingURL=shopify.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shopify.js","sources":["../../src/integrations/session/index.ts"],"sourcesContent":["/**\n If checkout and order page are on different subdomains, we can't access localStorage for nonprofitId/selectionId\n We can make post-transaction work by copying a \"cartID\"-style cookie to the expected localStorage key on the current\n domain, which will allow the post-transaction widgets to send that to the backend which can restore the selection\n from the cart.\n\n This will also work if we don't have a cart cookie for some other reason, although it is not directly integrated\n with the host site's concept of a cart (e.g., line items and expiration dates).\n\n Note: Use a module import rather than a self-executing script so that we can set cookies on the host domain\n rather than our 3rd party CDN domain, and customize the options via arguments.\n\n Usage:\n <script type=\"module\">\n import { createSession } from 'https://...';\n createSession({domain: 'mystore.com'})\n </script>\n */\n\nimport { v4 as uuid } from \"@lukeed/uuid/secure\";\nimport { deleteCookieValue, getCookieValue, setCookieValue } from \"../../utils/cookies\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { BEAM_COOKIE_NAMES } from \"../../api-sdk/constants\";\n\nconst DEFAULT_COOKIE_NAME = BEAM_COOKIE_NAMES.SESSION;\n\nexport async function createSession({\n cookieName = DEFAULT_COOKIE_NAME,\n domain = window.location.hostname, // domain or subdomain to set cookie on\n apiKey = \"\", // optional unless scoping localStorage to api key\n} = {}) {\n const existingValue = await getCookieValue(cookieName);\n\n if (existingValue) {\n return; // do nothing\n }\n\n const cookieValue = uuid();\n\n const expires = Date.now() + 30 * 24 * 60 * 60 * 1000; // 30 days\n\n await setCookieValue({ name: cookieName, value: cookieValue, domain, path: \"/\", expires });\n\n const beamLocalStorage = createScopedLocalStorage({ apiKey });\n beamLocalStorage.setItemJson(\"cart\", { cartId: cookieValue });\n}\n\nexport async function endSession({\n cookieName = DEFAULT_COOKIE_NAME,\n domain = window.location.hostname, // domain to remove cookie from\n apiKey = \"\", // optional unless scoping localStorage to api key\n} = {}) {\n const cookieValue = await getCookieValue(cookieName);\n\n if (!cookieValue) {\n return; // do nothing\n }\n\n // copy cookie value into localStorage for widgets to use\n const beamLocalStorage = createScopedLocalStorage({ apiKey });\n beamLocalStorage.setItemJson(\"cart\", { cartId: cookieValue });\n\n // delete cookie to end session (will generate new one on next visit)\n await deleteCookieValue({ name: cookieName, domain });\n}\n"],"names":["DEFAULT_COOKIE_NAME","BEAM_COOKIE_NAMES","createSession","cookieName","domain","apiKey","getCookieValue","cookieValue","uuid","expires","setCookieValue","createScopedLocalStorage","endSession","deleteCookieValue"],"mappings":"
|
|
1
|
+
{"version":3,"file":"shopify.js","sources":["../../src/shared/beam-statsig-context.ts","../../src/integrations/session/index.ts"],"sourcesContent":["/**\n * Beam-owned handoff between the Statsig plugin and the cart integration.\n * The plugin sets it once the shopper is assigned. Kept on window, not module state,\n * so it works whether or not the two chunks share a webpack runtime.\n */\nexport type BeamStatsigContext = {\n showBeam: boolean;\n stableId?: string;\n};\n\ndeclare global {\n interface Window {\n beamStatsigContext?: BeamStatsigContext;\n }\n}\n\nexport function setBeamStatsigContext(context: BeamStatsigContext) {\n window.beamStatsigContext = context;\n}\n\nexport function getBeamStatsigContext(): BeamStatsigContext | undefined {\n return window.beamStatsigContext;\n}\n","/**\n If checkout and order page are on different subdomains, we can't access localStorage for nonprofitId/selectionId\n We can make post-transaction work by copying a \"cartID\"-style cookie to the expected localStorage key on the current\n domain, which will allow the post-transaction widgets to send that to the backend which can restore the selection\n from the cart.\n\n This will also work if we don't have a cart cookie for some other reason, although it is not directly integrated\n with the host site's concept of a cart (e.g., line items and expiration dates).\n\n Note: Use a module import rather than a self-executing script so that we can set cookies on the host domain\n rather than our 3rd party CDN domain, and customize the options via arguments.\n\n Usage:\n <script type=\"module\">\n import { createSession } from 'https://...';\n createSession({domain: 'mystore.com'})\n </script>\n */\n\nimport { v4 as uuid } from \"@lukeed/uuid/secure\";\nimport { deleteCookieValue, getCookieValue, setCookieValue } from \"../../utils/cookies\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { BEAM_COOKIE_NAMES } from \"../../api-sdk/constants\";\n\nconst DEFAULT_COOKIE_NAME = BEAM_COOKIE_NAMES.SESSION;\n\nexport async function createSession({\n cookieName = DEFAULT_COOKIE_NAME,\n domain = window.location.hostname, // domain or subdomain to set cookie on\n apiKey = \"\", // optional unless scoping localStorage to api key\n} = {}) {\n const existingValue = await getCookieValue(cookieName);\n\n if (existingValue) {\n return; // do nothing\n }\n\n const cookieValue = uuid();\n\n const expires = Date.now() + 30 * 24 * 60 * 60 * 1000; // 30 days\n\n await setCookieValue({ name: cookieName, value: cookieValue, domain, path: \"/\", expires });\n\n const beamLocalStorage = createScopedLocalStorage({ apiKey });\n beamLocalStorage.setItemJson(\"cart\", { cartId: cookieValue });\n}\n\nexport async function endSession({\n cookieName = DEFAULT_COOKIE_NAME,\n domain = window.location.hostname, // domain to remove cookie from\n apiKey = \"\", // optional unless scoping localStorage to api key\n} = {}) {\n const cookieValue = await getCookieValue(cookieName);\n\n if (!cookieValue) {\n return; // do nothing\n }\n\n // copy cookie value into localStorage for widgets to use\n const beamLocalStorage = createScopedLocalStorage({ apiKey });\n beamLocalStorage.setItemJson(\"cart\", { cartId: cookieValue });\n\n // delete cookie to end session (will generate new one on next visit)\n await deleteCookieValue({ name: cookieName, domain });\n}\n"],"names":["setBeamStatsigContext","context","getBeamStatsigContext","DEFAULT_COOKIE_NAME","BEAM_COOKIE_NAMES","createSession","cookieName","domain","apiKey","getCookieValue","cookieValue","uuid","expires","setCookieValue","createScopedLocalStorage","endSession","deleteCookieValue"],"mappings":"iYAgBO,SAASA,EAAsBC,EAA6B,CACjE,OAAO,mBAAqBA,CAC9B,CAEO,SAASC,GAAwD,CACtE,OAAO,OAAO,kBAChB,6pBCEA,MAAMC,EAAsBC,EAAkB,QAE9C,eAAsBC,EAAc,CAClC,WAAAC,EAAaH,EACb,OAAAI,EAAS,OAAO,SAAS,SACzB,OAAAC,EAAS,EACX,EAAI,GAAI,CAGN,GAFsB,MAAMC,EAAeH,CAAU,EAGnD,OAGF,MAAMI,EAAcC,IAEdC,EAAU,KAAK,IAAA,EAAQ,IAAU,GAAK,GAAK,IAEjD,MAAMC,EAAe,CAAE,KAAMP,EAAY,MAAOI,EAAa,OAAAH,EAAQ,KAAM,IAAK,QAAAK,CAAQ,CAAC,EAEhEE,EAAyB,CAAE,OAAAN,CAAO,CAAC,EAC3C,YAAY,OAAQ,CAAE,OAAQE,CAAY,CAAC,CAC9D,CAEA,eAAsBK,EAAW,CAC/B,WAAAT,EAAaH,EACb,OAAAI,EAAS,OAAO,SAAS,SACzB,OAAAC,EAAS,EACX,EAAI,GAAI,CACN,MAAME,EAAc,MAAMD,EAAeH,CAAU,EAE9CI,IAKoBI,EAAyB,CAAE,OAAAN,CAAO,CAAC,EAC3C,YAAY,OAAQ,CAAE,OAAQE,CAAY,CAAC,EAG5D,MAAMM,EAAkB,CAAE,KAAMV,EAAY,OAAAC,CAAO,CAAC,EACtD"}
|
|
@@ -3,7 +3,7 @@ import { BeamSocialShare as BeamSocialShare$1 } from '../components/social-share
|
|
|
3
3
|
import 'lit';
|
|
4
4
|
import 'lit-html';
|
|
5
5
|
import '../components/beam-partner-logos.js';
|
|
6
|
-
import '../chunks/utils-
|
|
6
|
+
import '../chunks/utils-DfsVjUY-.esm.js';
|
|
7
7
|
import 'lodash-es/debounce';
|
|
8
8
|
import 'lodash-es/isEqual';
|
|
9
9
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import a from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{BeamSocialShare as m}from"../components/social-share.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-
|
|
1
|
+
import a from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{BeamSocialShare as m}from"../components/social-share.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-C3oAeUgm.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/utils-ly9wMwUO.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";const o=r({tagName:m.tagName,elementClass:m,react:a});export{o as BeamSocialShare,o as default};
|
|
2
2
|
//# sourceMappingURL=social-share.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import a from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{BeamSocialShare as m}from"../components/social-share.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-
|
|
1
|
+
import a from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{BeamSocialShare as m}from"../components/social-share.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-C3oAeUgm.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/utils-ly9wMwUO.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../components/beam-partner-logos.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";const o=r({tagName:m.tagName,elementClass:m,react:a});export{o as BeamSocialShare,o as default};
|
|
2
2
|
//# sourceMappingURL=social-share.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _lit_react from '@lit/react';
|
|
2
2
|
import { EventName } from '@lit/react';
|
|
3
|
-
import { B as BeamNonprofitSelectEvent } from '../chunks/utils-
|
|
3
|
+
import { B as BeamNonprofitSelectEvent } from '../chunks/utils-DfsVjUY-.esm.js';
|
|
4
4
|
import { BeamSubscriberSelectNonprofit as BeamSubscriberSelectNonprofit$1 } from '../components/subscriber-select-nonprofit.js';
|
|
5
5
|
import 'lodash-es/debounce';
|
|
6
6
|
import 'lodash-es/isEqual';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{B as m}from"../chunks/utils-ly9wMwUO.esm.js";import{BeamSubscriberSelectNonprofit as e}from"../components/subscriber-select-nonprofit.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-
|
|
1
|
+
import o from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{B as m}from"../chunks/utils-ly9wMwUO.esm.js";import{BeamSubscriberSelectNonprofit as e}from"../components/subscriber-select-nonprofit.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";import"../chunks/handlebars-3tRO54kz.esm.js";const t=r({tagName:e.tagName,elementClass:e,react:o,events:{onNonprofitSelect:m.eventName}});export{t as BeamSubscriberSelectNonprofit,t as default};
|
|
2
2
|
//# sourceMappingURL=subscriber-select-nonprofit.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{B as m}from"../chunks/utils-ly9wMwUO.esm.js";import{BeamSubscriberSelectNonprofit as e}from"../components/subscriber-select-nonprofit.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-
|
|
1
|
+
import o from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{B as m}from"../chunks/utils-ly9wMwUO.esm.js";import{BeamSubscriberSelectNonprofit as e}from"../components/subscriber-select-nonprofit.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";import"../chunks/handlebars-3tRO54kz.esm.js";const t=r({tagName:e.tagName,elementClass:e,react:o,events:{onNonprofitSelect:m.eventName}});export{t as BeamSubscriberSelectNonprofit,t as default};
|
|
2
2
|
//# sourceMappingURL=subscriber-select-nonprofit.js.map
|
|
@@ -3,7 +3,7 @@ import { BeamSubscriptionImpact as BeamSubscriptionImpact$1 } from '../component
|
|
|
3
3
|
import 'lit';
|
|
4
4
|
import 'lit-html';
|
|
5
5
|
import 'lodash';
|
|
6
|
-
import '../chunks/utils-
|
|
6
|
+
import '../chunks/utils-DfsVjUY-.esm.js';
|
|
7
7
|
import 'lodash-es/debounce';
|
|
8
8
|
import 'lodash-es/isEqual';
|
|
9
9
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{BeamSubscriptionImpact as t}from"../components/subscription-impact.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-
|
|
1
|
+
import o from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{BeamSubscriptionImpact as t}from"../components/subscription-impact.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/utils-ly9wMwUO.esm.js";import"../chunks/share-button-DQT2zQ7w.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-C3oAeUgm.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";const m=r({tagName:t.tagName,elementClass:t,react:o,events:{}});export{m as BeamSubscriptionImpact,m as default};
|
|
2
2
|
//# sourceMappingURL=subscription-impact.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{BeamSubscriptionImpact as t}from"../components/subscription-impact.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-
|
|
1
|
+
import o from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{BeamSubscriptionImpact as t}from"../components/subscription-impact.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/utils-ly9wMwUO.esm.js";import"../chunks/share-button-DQT2zQ7w.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-C3oAeUgm.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";const m=r({tagName:t.tagName,elementClass:t,react:o,events:{}});export{m as BeamSubscriptionImpact,m as default};
|
|
2
2
|
//# sourceMappingURL=subscription-impact.js.map
|
|
@@ -3,7 +3,7 @@ import { BeamSubscriptionManagement as BeamSubscriptionManagement$1 } from '../c
|
|
|
3
3
|
import 'lit-html';
|
|
4
4
|
import 'lit';
|
|
5
5
|
import '../chunks/routes-BW8Dd3C1.esm.js';
|
|
6
|
-
import '../chunks/utils-
|
|
6
|
+
import '../chunks/utils-DfsVjUY-.esm.js';
|
|
7
7
|
import 'lodash-es/debounce';
|
|
8
8
|
import 'lodash-es/isEqual';
|
|
9
9
|
import '../components/select-subscription-nonprofit.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{BeamSubscriptionManagement as t}from"../components/subscription-management.esm.js";import"../chunks/utils-ly9wMwUO.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-
|
|
1
|
+
import o from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{BeamSubscriptionManagement as t}from"../components/subscription-management.esm.js";import"../chunks/utils-ly9wMwUO.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../components/select-subscription-nonprofit.esm.js";import"../components/beam-partner-logos.esm.js";import"../components/subscription-impact.esm.js";import"../chunks/share-button-DQT2zQ7w.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-C3oAeUgm.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";const m=r({tagName:t.tagName,elementClass:t,react:o,events:{}});export{m as BeamSubscriptionManagement,m as default};
|
|
2
2
|
//# sourceMappingURL=subscription-management.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{BeamSubscriptionManagement as t}from"../components/subscription-management.js";import"../chunks/utils-ly9wMwUO.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-
|
|
1
|
+
import o from"react";import{f as r}from"../chunks/lit-BEag9MFp.esm.js";import{BeamSubscriptionManagement as t}from"../components/subscription-management.js";import"../chunks/utils-ly9wMwUO.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-BxrZs18u.esm.js";import"../chunks/index-BlaOItQr.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../components/select-subscription-nonprofit.js";import"../components/beam-partner-logos.js";import"../components/subscription-impact.js";import"../chunks/share-button-DQT2zQ7w.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-C3oAeUgm.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";const m=r({tagName:t.tagName,elementClass:t,react:o,events:{}});export{m as BeamSubscriptionManagement,m as default};
|
|
2
2
|
//# sourceMappingURL=subscription-management.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { O as BeamError, P as LocalStorageError, Q as MissingConfig, R as NetworkError, S as SetupError } from '../chunks/utils-
|
|
1
|
+
export { O as BeamError, P as LocalStorageError, Q as MissingConfig, R as NetworkError, S as SetupError } from '../chunks/utils-DfsVjUY-.esm.js';
|
|
2
2
|
import 'lodash-es/debounce';
|
|
3
3
|
import 'lodash-es/isEqual';
|
package/dist/utils/cart.d.ts
CHANGED
package/dist/utils/cookies.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { l as deleteCookieValue, p as getCookieMap, q as getCookieValue, G as setCookieValue } from '../chunks/utils-
|
|
1
|
+
export { l as deleteCookieValue, p as getCookieMap, q as getCookieValue, G as setCookieValue } from '../chunks/utils-DfsVjUY-.esm.js';
|
|
2
2
|
import 'lodash-es/debounce';
|
|
3
3
|
import 'lodash-es/isEqual';
|
package/dist/utils/events.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { U as BeamCartChangeEvent, V as BeamCartCreatedEvent, W as BeamNetworkCallEvent, B as BeamNonprofitSelectEvent, X as BeamNonprofitSelectionRemovedEvent, Y as BeamOrderCreatedEvent, Z as BeamPromoCodesStoredEvent, _ as BeamStatsigInitializedEvent, $ as BeamStatusChangeEvent, a0 as BeamWidgetInitialNonprofitSyncCancelEvent, a1 as BeamWidgetInitialNonprofitSyncEvent, a2 as BeamWidgetStoredPromoCodesEvent } from '../chunks/utils-
|
|
1
|
+
export { U as BeamCartChangeEvent, V as BeamCartCreatedEvent, W as BeamNetworkCallEvent, B as BeamNonprofitSelectEvent, X as BeamNonprofitSelectionRemovedEvent, Y as BeamOrderCreatedEvent, Z as BeamPromoCodesStoredEvent, _ as BeamStatsigInitializedEvent, $ as BeamStatusChangeEvent, a0 as BeamWidgetInitialNonprofitSyncCancelEvent, a1 as BeamWidgetInitialNonprofitSyncEvent, a2 as BeamWidgetStoredPromoCodesEvent } from '../chunks/utils-DfsVjUY-.esm.js';
|
|
2
2
|
import 'lodash-es/debounce';
|
|
3
3
|
import 'lodash-es/isEqual';
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { i as initNetworkListeners, J as teardownNetworkListeners } from '../chunks/utils-
|
|
1
|
+
export { i as initNetworkListeners, J as teardownNetworkListeners } from '../chunks/utils-DfsVjUY-.esm.js';
|
|
2
2
|
import 'lodash-es/debounce';
|
|
3
3
|
import 'lodash-es/isEqual';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { n as formatStoreAndReturnPromoCodes, o as getAllPromoCodesFromCookie, r as getPromoCodeFromShopifyCookie, s as getPromoCodesFromCart, t as getPromoCodesLocalStorage, v as getSanitizedUrlForStorage, x as isEmptyPromoData, z as mapToUnvalidatedPromoCodes, C as mergeStoreAndReturnPromos, D as parseJsonStringArray, E as promoCodesAreEqual, H as setPromoCodeInCookie, I as setPromoCodesInLocalStorage } from '../chunks/utils-
|
|
1
|
+
export { n as formatStoreAndReturnPromoCodes, o as getAllPromoCodesFromCookie, r as getPromoCodeFromShopifyCookie, s as getPromoCodesFromCart, t as getPromoCodesLocalStorage, v as getSanitizedUrlForStorage, x as isEmptyPromoData, z as mapToUnvalidatedPromoCodes, C as mergeStoreAndReturnPromos, D as parseJsonStringArray, E as promoCodesAreEqual, H as setPromoCodeInCookie, I as setPromoCodesInLocalStorage } from '../chunks/utils-DfsVjUY-.esm.js';
|
|
2
2
|
import 'lodash-es/debounce';
|
|
3
3
|
import 'lodash-es/isEqual';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beamimpact/web-sdk",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.58.
|
|
4
|
+
"version": "1.58.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@cypress/vite-dev-server": "7.3.4",
|
|
68
68
|
"@devcontainers/cli": "0.86.0",
|
|
69
69
|
"@eslint/eslintrc": "3.3.5",
|
|
70
|
-
"@eslint/js": "9.39.
|
|
70
|
+
"@eslint/js": "9.39.5",
|
|
71
71
|
"@fastify/compress": "8.3.1",
|
|
72
72
|
"@fastify/cors": "11.2.0",
|
|
73
73
|
"@fastify/static": "10.1.2",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"esbuild": "0.28.1",
|
|
86
86
|
"eslint": "9.39.4",
|
|
87
87
|
"eslint-config-google": "0.14.0",
|
|
88
|
-
"eslint-config-prettier": "10.1.
|
|
88
|
+
"eslint-config-prettier": "10.1.8",
|
|
89
89
|
"eslint-plugin-import": "2.32.0",
|
|
90
90
|
"eslint-plugin-lit": "2.3.1",
|
|
91
91
|
"eslint-plugin-lodash": "7.4.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{o as J,i as k,b as x}from"./lodash-CrMU6wKg.esm.js";import{R,l as u,K,C as D,N as q,b as V,O as X,U as H,B as Q,W as Y,M as Z,t as $,P as tt,n as et,V as at,A as nt,X as ot}from"./utils-ly9wMwUO.esm.js";import{B as M}from"./index-M8hQ6GXf.esm.js";import{O as B}from"./index-BxivRkBL.esm.js";const L=window.Shopify?.routes?.root||"/";let h=null,O=!0,A=!1;const it="cart";async function P(t,c=!0){if(h)return!1;const r=new AbortController;h=r;const{signal:a}=r;V(),window.addEventListener(X.eventName,async()=>{A=!0},{signal:a}),window.addEventListener(H.eventName,async o=>{const n=o,i=/cart\/(add|change|update|clear)/,s=n.detail.type==="xhr"?n.detail.xhr.responseURL:n.detail.response.url,e=new URL(s);if(!i.test(e.pathname))return;const p=await S(t,a);a.aborted||!p.changed||B(t,p.cart)},{signal:a});let d,l;window.addEventListener(Q.eventName,async o=>{const n=o;u.debug("[cart-page][BeamNonprofitSelectEvent]",n.detail);const{source:i,selectedNonprofitId:s,selectionId:e}=n.detail;if(i===Y.select_nonprofit){if(d===s&&l===e)return;const p=await w(t);await f({...p,selectedNonprofitId:s,selectionId:e}),l=e,d=s}},{signal:a}),window.addEventListener(Z.eventName,async o=>{const n=o;u.debug("[cart-page][BeamNonprofitSelectionRemovedEvent]",n.detail);const{newNonprofitId:i,selectionId:s}=n.detail;if(d===i&&l===s)return;const e=await w(t);await f({...e,selectedNonprofitId:null,selectionId:s}),l=s,d=i},{signal:a}),window.addEventListener($.eventName,async o=>{const n=o;if(u.debug("[cart-page][BeamCartCreatedEvent]",n.detail),window.statsig||c){const i=await w(t);await f(i)}},{signal:a}),window.addEventListener(tt.eventName,async o=>{const n=o;if(u.debug("[cart-page][BeamCartChangeEvent]",n.detail),window.statsig||c){const i=await w(t);await f(i)}},{signal:a});try{if(a.aborted)return!1;const o=await S(t,a);return!(a.aborted||(await B(t,o.cart,!0),a.aborted))}catch(o){return u.error(new et("Failed to sync initial cart during registerCartIntegration",{cause:o})),!1}}async function U(t,{clearStorage:c=!1}={}){const r=!!h;return r&&(h?.abort(),h=null,ot(),f.reset(),j.reset(),O=!0,A=!1),c&&at(t),r}async function T(t,c,r){const a={...await w(t),...c!==void 0&&{selectedNonprofitId:c},...r!==void 0&&{selectionId:r}};await f(a)}async function w(t){let c,r;if(window.statsig)try{const n=window.statsig;typeof n?.getLayer("beam_trial_layer")?.get("show_beam")=="boolean"&&(c=n.getLayer("beam_trial_layer").get("show_beam",!1),r=n.getStableID())}catch{}const a=K(it,t),d=D(M,t),{chainId:l,storeId:o}=t;return{showBeam:c??void 0,remoteSessionId:r??void 0,beamCartId:d&&d!=="null"?d:void 0,cartId:a&&a!=="null"?a:void 0,chainId:l,storeId:o}}const W=T;async function S(t,c){const{token:r,total_price:a,item_count:d,currency:l,items:o,cart_level_discount_applications:n,attributes:i}=await v();let s=!1;const e=nt(t),p=e.getItemJson("cart"),I=D(M,t),C={cartId:r,beamCartId:I,subtotal:a/100,itemCount:d,currencyCode:l,schema:{source:"generic"},content:{items:o.map(({sku:m,final_line_price:_,product_id:N,line_level_discount_allocations:E})=>{const b=m||String(N),y=_/100,z=E?.map(({discount_application:G})=>({code:G?.title,applicable:!0}));return{remoteProductIdentifier:b,localAmount:y,discounts:z}}),discounts:n.map(({title:m})=>({code:m,applicable:!0}))}};let g=null;try{i?.beam&&(g=JSON.parse(i.beam))}catch(m){u.error(m)}if(g&&O&&!A&&!c?.aborted){O=!1;const{nonprofit_id:m,selection_id:_}=g,N=e.getItem("nonprofit"),E=e.getItem("transaction"),b=m!==void 0&&String(m)!==N,y=_!=null&&String(_)!==E;(b||y)&&(b&&(e.setItem("nonprofit",String(m)),e.setItem("nonprofit_selected_at",new Date().toISOString())),y&&(e.setItem("transaction",String(_)),e.setItem("nonprofit_selected_at",new Date().toISOString())),window.dispatchEvent(new q({nonprofitId:m,nonprofitIdChanged:b,selectionId:_,selectionIdChanged:y})))}return k(C,{...p,beamCartId:p?.beamCartId})||(s=!0),{changed:s,cart:C}}const F=B,v=async function(){return await window.fetch(L+"cart.js",{method:"GET",headers:{"Content-Type":"application/json"}}).then(t=>t.json())},f=R(async function({selectedNonprofitId:t,selectionId:c,beamCartId:r,cartId:a,chainId:d,storeId:l,showBeam:o,remoteSessionId:n}){const{attributes:i}=await v(),s=i?.beam;let e={};try{s&&(e=JSON.parse(s))}catch(g){u.error(g)}const p=J({nonprofit_id:t,selection_id:c,beam_cart_id:r,shopify_cart_id:a,chain_id:d,store_id:l,show_beam:o,remote_session_id:n},x),I={...e,...p};t===null&&(I.nonprofit_id=void 0);const C={beam:JSON.stringify(I)};if(!k(I,e))try{await window.fetch(L+"cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:C})})}catch(g){u.error(g)}}),j=R(async function({selectedNonprofitId:t,selectionId:c,beamCartId:r,cartId:a,chainId:d,storeId:l}){let o,n;if(window.statsig)try{const e=window.statsig;typeof e?.getLayer("beam_trial_layer")?.get("show_beam")=="boolean"&&(o=e.getLayer("beam_trial_layer").get("show_beam",!1),n=e.getStableID())}catch{}const i=J({nonprofit_id:t,selection_id:c,beam_cart_id:r,shopify_cart_id:a,chain_id:d,store_id:l,show_beam:o,remote_session_id:n},x);t===null&&(i.nonprofit_id=void 0);const s={beam:JSON.stringify(i)};try{await window.fetch(L+"cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:s})})}catch(e){u.error(e)}});var rt=Object.freeze({__proto__:null,addBeamAttributesToCart:j,appendBeamAttributesToCart:f,appendStatsigToShopifyCartAttributes:W,appendToShopifyCartBeamAttribute:T,getBeamAttributesForCart:w,getCurrentCart:S,getShopifyCart:v,registerCartIntegration:P,trackCart:F,unregisterCartIntegration:U});export{w as C,j as J,S as L,v as T,P as a,rt as i,U as n,F as o,f as p,W as r,T as x};
|
|
2
|
-
//# sourceMappingURL=index-ADw_ucEx.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-ADw_ucEx.esm.js","sources":["../../src/integrations/shopify/cart.ts"],"sourcesContent":["/* eslint-disable camelcase */\nimport isEqual from \"lodash-es/isEqual\";\nimport isUndefined from \"lodash-es/isUndefined\";\nimport omitBy from \"lodash-es/omitBy\";\nimport { clearBeamStorage, logger, memoizeLast } from \"../../utils\";\nimport { BeamError } from \"../../utils/beam-errors\";\nimport { initNetworkListeners, teardownNetworkListeners } 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 cartIntegrationAbortController: AbortController | null = null; // Set when registration starts; aborting removes its listeners\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 (cartIntegrationAbortController) {\n return false; // Do nothing if already registered, or a registration attempt is already in progress\n }\n\n // All listeners below are registered with this signal so that\n // unregisterCartIntegration can remove them all with a single abort()\n const abortController = new AbortController();\n cartIntegrationAbortController = abortController;\n const { signal } = abortController;\n\n // logger.debug(\"[cart-page][registerCartIntegration] initializing network listeners\");\n // Set up event listeners for AJAX events (idempotent; re-enables dispatching if previously torn down)\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(\n BeamWidgetInitialNonprofitSyncCancelEvent.eventName,\n async () => {\n // logger.debug(\"[cart-page][BeamWidgetInitialNonprofitSyncCancelEvent]\");\n skipEmitInitialNonprofitSync = true;\n },\n { signal },\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(\n BeamNetworkCallEvent.eventName,\n 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, signal);\n // Recheck: unregister can't cancel an invocation already in flight\n if (signal.aborted || !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 { signal },\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(\n BeamNonprofitSelectEvent.eventName,\n 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 { signal },\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(\n BeamNonprofitSelectionRemovedEvent.eventName,\n 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 { signal },\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(\n BeamCartCreatedEvent.eventName,\n 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 { signal },\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(\n BeamCartChangeEvent.eventName,\n 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 { signal },\n );\n\n try {\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 if (signal.aborted) {\n return false; // unregistered before we even started\n }\n const currentCart = await getCurrentCart(config, signal);\n if (signal.aborted) {\n return false; // unregistered while the GET was in flight\n }\n // logger.debug(\"[cart-page][registerCartIntegration] initial cart fetch result\", currentCart);\n await updateCart(config, currentCart.cart, true);\n if (signal.aborted) {\n return false; // unregistered while updateCart was in flight\n }\n\n return true;\n } catch (err) {\n // A transient failure here (e.g. a flaky mobile network) is only about the initial\n // cart snapshot — don't tear down the listeners registered above, or the integration\n // goes dark for the rest of the page session over what's often a one-off blip.\n logger.error(new BeamError(\"Failed to sync initial cart during registerCartIntegration\", { cause: err }));\n return false;\n }\n}\n\n/**\n * @main unregisterCartIntegration - tear down listeners set up by registerCartIntegration.\n * Pass { clearStorage: true } to also wipe Beam's localStorage/cookies in the same call\n * (clearBeamStorage from src/utils, which is also callable on its own — for cases that want\n * storage cleared without touching listeners, or independently of this integration entirely).\n * @return {boolean} true if this page load's listeners were torn down, false if\n * registerCartIntegration never ran this session (storage still clears if requested, either way)\n */\nasync function unregisterCartIntegration(\n config: BeamShopifyCartIntegrationConfig,\n { clearStorage = false }: { clearStorage?: boolean } = {},\n) {\n // Also covers an unregister call that arrives mid-registration, before this is set true\n const wasRegisteredThisSession = Boolean(cartIntegrationAbortController);\n\n if (wasRegisteredThisSession) {\n // 1. Remove ALL event listeners registered with this controller's signal\n cartIntegrationAbortController?.abort();\n cartIntegrationAbortController = null;\n\n // 2. Stop fetch/XHR hooks from dispatching (patches stay installed, just inert)\n teardownNetworkListeners();\n\n // 3. Drop memoized state so nothing stale survives a re-register\n appendBeamAttributesToCart.reset();\n addBeamAttributesToCart.reset();\n\n // 4. Reset module flags so a future opt-in can re-register cleanly\n allowEmitInitialNonprofitSync = true;\n skipEmitInitialNonprofitSync = false;\n }\n\n // 5. Optionally clear storage too. Runs regardless of wasRegisteredThisSession — that state\n // is persisted browser-side, not tied to whether a registration happened this page load.\n if (clearStorage) {\n clearBeamStorage(config);\n }\n\n return wasRegisteredThisSession;\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(\n config: BeamShopifyCartIntegrationConfig,\n selectedNonprofitId?: number | null,\n selectionId?: string,\n) {\n const beamCartData = await getBeamAttributesForCart(config);\n const beamCartAttr = {\n ...beamCartData,\n ...(selectedNonprofitId !== undefined && { selectedNonprofitId }),\n ...(selectionId !== undefined && { selectionId }),\n };\n await appendBeamAttributesToCart(beamCartAttr);\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(\n config: BeamShopifyCartIntegrationConfig,\n signal?: AbortSignal,\n): 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 * signal is checked too, so a call from a since-torn-down registration doesn't consume\n * the one-shot flag on its behalf.\n */\n if (beamAttr && allowEmitInitialNonprofitSync && !skipEmitInitialNonprofitSync && !signal?.aborted) {\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 statsig?: any; // attached by Statsig CDN script\n Shopify?: any;\n }\n}\n\nexport {\n trackCart,\n getCurrentCart,\n addBeamAttributesToCart,\n unregisterCartIntegration,\n appendStatsigToShopifyCartAttributes,\n appendToShopifyCartBeamAttribute,\n registerCartIntegration,\n appendBeamAttributesToCart,\n getShopifyCart,\n getBeamAttributesForCart,\n};\n"],"names":["SHOPIFY_BASE_URL","cartIntegrationAbortController","allowEmitInitialNonprofitSync","skipEmitInitialNonprofitSync","SHOPIFY_CART_COOKIE_NAME","registerCartIntegration","config","autoUpdateShopifyCartAttributes","abortController","signal","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","err","BeamError","unregisterCartIntegration","clearStorage","wasRegisteredThisSession","teardownNetworkListeners","addBeamAttributesToCart","clearBeamStorage","appendToShopifyCartBeamAttribute","beamCartAttr","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","nonprofit_id","selection_id","storedNonprofit","storedSelection","nonprofitChanged","selectionChanged","BeamWidgetInitialNonprofitSyncEvent","isEqual","trackCart","res","memoizeLast","existingBeamCartAttrString","existingBeamCartAttr","newBeamAttrs","omitBy","isUndefined","appendedBeamAttributes","beamCartAttrs","allBeamAttributes"],"mappings":"0SAgDA,MAAMA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