@beamimpact/web-sdk 1.30.1 → 1.31.1
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/README.md +61 -0
- package/dist/chunks/_share-dialog-dependencies-Qc0imrGB.esm.js +2 -0
- package/dist/chunks/_share-dialog-dependencies-Qc0imrGB.esm.js.map +1 -0
- package/dist/chunks/_share-dialog-dependencies-rEYm7Xgo.esm.js +2 -0
- package/dist/chunks/_share-dialog-dependencies-rEYm7Xgo.esm.js.map +1 -0
- package/dist/chunks/beam-errors-AMvTvR1C.esm.js +2 -0
- package/dist/chunks/{beam-errors-l02WBee5.esm.js.map → beam-errors-AMvTvR1C.esm.js.map} +1 -1
- package/dist/chunks/cart-contents-P2GzTrNn.esm.d.ts +10 -0
- package/dist/chunks/events-60jQoHQi.esm.d.ts +108 -0
- package/dist/chunks/events-wNy5BoJV.esm.js +2 -0
- package/dist/chunks/events-wNy5BoJV.esm.js.map +1 -0
- package/dist/chunks/index--N2RR1Fn.esm.js +2 -0
- package/dist/chunks/index--N2RR1Fn.esm.js.map +1 -0
- package/dist/chunks/{index-Iupghntz.esm.d.ts → index-CItwC8WO.esm.d.ts} +1 -1
- package/dist/chunks/index-FDDoUJQk.esm.js +2 -0
- package/dist/chunks/index-FDDoUJQk.esm.js.map +1 -0
- package/dist/chunks/index-JrZwQjr2.esm.js +2 -0
- package/dist/chunks/index-JrZwQjr2.esm.js.map +1 -0
- package/dist/chunks/{index-h39_A7fk.esm.d.ts → index-L59voCOg.esm.d.ts} +1 -1
- package/dist/chunks/index-L8CVKt4D.esm.js +2 -0
- package/dist/chunks/index-L8CVKt4D.esm.js.map +1 -0
- package/dist/chunks/index-YPrpyEl9.esm.js +2 -0
- package/dist/chunks/index-YPrpyEl9.esm.js.map +1 -0
- package/dist/chunks/{index-4o5tH5RA.esm.d.ts → index-Zzs4grqC.esm.d.ts} +17 -7
- package/dist/chunks/index-czOZQ1Sz.esm.js +2 -0
- package/dist/chunks/index-czOZQ1Sz.esm.js.map +1 -0
- package/dist/chunks/index-g5lw5BB-.esm.js +2 -0
- package/dist/chunks/index-g5lw5BB-.esm.js.map +1 -0
- package/dist/chunks/index-iTqsULiK.esm.d.ts +15 -0
- package/dist/chunks/{index-IXwIgGSV.esm.js → index-jFZJm9-Y.esm.js} +2 -2
- package/dist/chunks/{index-IXwIgGSV.esm.js.map → index-jFZJm9-Y.esm.js.map} +1 -1
- package/dist/chunks/index-l_MORcbP.esm.d.ts +15 -0
- package/dist/chunks/index-np6s8UdD.esm.js +2 -0
- package/dist/chunks/index-np6s8UdD.esm.js.map +1 -0
- package/dist/chunks/{local-storage-Rrnk_Dg-.esm.js → local-storage-GYvYzZ_j.esm.js} +2 -2
- package/dist/chunks/{local-storage-Rrnk_Dg-.esm.js.map → local-storage-GYvYzZ_j.esm.js.map} +1 -1
- package/dist/chunks/{localize-nH-zlK_j.esm.js → localize-kPkHxPNe.esm.js} +2 -2
- package/dist/chunks/{localize-nH-zlK_j.esm.js.map → localize-kPkHxPNe.esm.js.map} +1 -1
- package/dist/chunks/{network-listeners-CEOxhlYW.esm.js → network-listeners-O5LKv8Yy.esm.js} +2 -2
- package/dist/chunks/{network-listeners-CEOxhlYW.esm.js.map → network-listeners-O5LKv8Yy.esm.js.map} +1 -1
- package/dist/chunks/{cart-contents-iOS70Cw8.esm.d.ts → openapi-spec-scRfHArN.esm.d.ts} +51 -23
- package/dist/chunks/{order-page-R2OPVBti.esm.js → order-page-1-A-Yhbv.esm.js} +2 -2
- package/dist/chunks/{order-page-R2OPVBti.esm.js.map → order-page-1-A-Yhbv.esm.js.map} +1 -1
- package/dist/chunks/{order-page-gj5qxIFJ.esm.d.ts → order-page-40SzBc--.esm.d.ts} +3 -2
- package/dist/chunks/{order-page-zS1d11nZ.esm.js → order-page-l0phiTZ7.esm.js} +2 -2
- package/dist/chunks/{order-page-zS1d11nZ.esm.js.map → order-page-l0phiTZ7.esm.js.map} +1 -1
- package/dist/chunks/{remote-session-mmQFfNd6.esm.js → remote-session-V4YG-mcS.esm.js} +2 -2
- package/dist/chunks/{remote-session-mmQFfNd6.esm.js.map → remote-session-V4YG-mcS.esm.js.map} +1 -1
- package/dist/chunks/routes-N9ZmkAD6.esm.js +2 -0
- package/dist/chunks/routes-N9ZmkAD6.esm.js.map +1 -0
- package/dist/chunks/types-7kSi85Gv.esm.d.ts +10 -0
- package/dist/chunks/{update-cart-SgZzL7m7.esm.d.ts → update-cart-3nc7XKMm.esm.d.ts} +1 -1
- package/dist/chunks/update-cart-TJ7G8Xfl.esm.js +2 -0
- package/dist/chunks/update-cart-TJ7G8Xfl.esm.js.map +1 -0
- package/dist/components/community-impact.d.ts +1 -1
- package/dist/components/community-impact.esm.js +1 -1
- package/dist/components/community-impact.esm.js.map +1 -1
- package/dist/components/community-impact.js +1 -1
- 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 +1 -1
- package/dist/components/cumulative-impact.esm.js.map +1 -1
- package/dist/components/cumulative-impact.js +1 -1
- package/dist/components/cumulative-impact.js.map +1 -1
- package/dist/components/impact-overview.d.ts +1 -1
- 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 +3 -2
- package/dist/components/index.esm.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/post-purchase.d.ts +5 -3
- package/dist/components/post-purchase.esm.js +3 -3
- package/dist/components/post-purchase.esm.js.map +1 -1
- package/dist/components/post-purchase.js +3 -3
- package/dist/components/post-purchase.js.map +1 -1
- package/dist/components/redeem-transaction.d.ts +4 -3
- package/dist/components/redeem-transaction.esm.js +1 -1
- package/dist/components/redeem-transaction.esm.js.map +1 -1
- package/dist/components/redeem-transaction.js +1 -1
- package/dist/components/redeem-transaction.js.map +1 -1
- package/dist/components/select-nonprofit.d.ts +4 -3
- package/dist/components/select-nonprofit.esm.js +1 -1
- package/dist/components/select-nonprofit.esm.js.map +1 -1
- package/dist/components/select-nonprofit.js +1 -1
- package/dist/components/select-nonprofit.js.map +1 -1
- package/dist/components/shopify.d.ts +6 -5
- 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/index.d.ts +12 -9
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/beam.d.ts +90 -0
- package/dist/integrations/beam.esm.js +2 -0
- package/dist/integrations/beam.esm.js.map +1 -0
- package/dist/integrations/beam.js +2 -0
- package/dist/integrations/beam.js.map +1 -0
- package/dist/integrations/cart.d.ts +3 -2
- package/dist/integrations/cart.esm.js +1 -1
- package/dist/integrations/cart.js +1 -1
- package/dist/integrations/index.d.ts +11 -8
- package/dist/integrations/index.esm.js +1 -1
- package/dist/integrations/index.js +1 -1
- package/dist/integrations/logs.d.ts +2 -0
- package/dist/integrations/logs.esm.js +2 -0
- package/dist/integrations/logs.esm.js.map +1 -0
- package/dist/integrations/logs.js +2 -0
- package/dist/integrations/logs.js.map +1 -0
- package/dist/integrations/session.esm.js +1 -1
- package/dist/integrations/session.js +1 -1
- package/dist/integrations/shopify.d.ts +5 -4
- package/dist/integrations/shopify.esm.js +1 -1
- package/dist/integrations/shopify.js +1 -1
- package/dist/integrations/statsig.d.ts +53 -0
- package/dist/integrations/statsig.esm.js +12 -0
- package/dist/integrations/statsig.esm.js.map +1 -0
- package/dist/integrations/statsig.js +12 -0
- package/dist/integrations/statsig.js.map +1 -0
- package/dist/integrations/utils.d.ts +6 -3
- package/dist/integrations/utils.esm.js +1 -1
- package/dist/integrations/utils.js +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.esm.js.map +1 -1
- package/dist/react/community-impact.js +1 -1
- package/dist/react/community-impact.js.map +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.esm.js.map +1 -1
- package/dist/react/cumulative-impact.js +1 -1
- package/dist/react/cumulative-impact.js.map +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.esm.js.map +1 -1
- package/dist/react/impact-overview.js +1 -1
- package/dist/react/impact-overview.js.map +1 -1
- package/dist/react/index.d.ts +4 -3
- package/dist/react/index.esm.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/post-purchase.d.ts +3 -2
- package/dist/react/post-purchase.esm.js +1 -1
- package/dist/react/post-purchase.esm.js.map +1 -1
- package/dist/react/post-purchase.js +1 -1
- package/dist/react/post-purchase.js.map +1 -1
- package/dist/react/redeem-transaction.d.ts +4 -3
- package/dist/react/redeem-transaction.esm.js +1 -1
- package/dist/react/redeem-transaction.esm.js.map +1 -1
- package/dist/react/redeem-transaction.js +1 -1
- package/dist/react/redeem-transaction.js.map +1 -1
- package/dist/react/select-nonprofit.d.ts +4 -3
- package/dist/react/select-nonprofit.esm.js +1 -1
- package/dist/react/select-nonprofit.esm.js.map +1 -1
- package/dist/react/select-nonprofit.js +1 -1
- package/dist/react/select-nonprofit.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunks/_share-dialog-dependencies--e9Yfdxt.esm.js +0 -2
- package/dist/chunks/_share-dialog-dependencies--e9Yfdxt.esm.js.map +0 -1
- package/dist/chunks/_share-dialog-dependencies-UDSD9RFy.esm.js +0 -2
- package/dist/chunks/_share-dialog-dependencies-UDSD9RFy.esm.js.map +0 -1
- package/dist/chunks/beam-errors-l02WBee5.esm.js +0 -2
- package/dist/chunks/events-6sWBONuH.esm.d.ts +0 -43
- package/dist/chunks/events-rRSQYdP1.esm.js +0 -2
- package/dist/chunks/events-rRSQYdP1.esm.js.map +0 -1
- package/dist/chunks/index--XzN0d8d.esm.js +0 -2
- package/dist/chunks/index--XzN0d8d.esm.js.map +0 -1
- package/dist/chunks/index-FNXmLkmP.esm.js +0 -2
- package/dist/chunks/index-FNXmLkmP.esm.js.map +0 -1
- package/dist/chunks/index-FmuWTWCO.esm.js +0 -2
- package/dist/chunks/index-FmuWTWCO.esm.js.map +0 -1
- package/dist/chunks/index-MAzMDqhV.esm.js +0 -2
- package/dist/chunks/index-MAzMDqhV.esm.js.map +0 -1
- package/dist/chunks/index-NYK2Edpr.esm.js +0 -2
- package/dist/chunks/index-NYK2Edpr.esm.js.map +0 -1
- package/dist/chunks/index-qKG37btQ.esm.js +0 -2
- package/dist/chunks/index-qKG37btQ.esm.js.map +0 -1
- package/dist/chunks/index-wuUhCB0N.esm.d.ts +0 -14
- package/dist/chunks/logger-ad87ovol.esm.js +0 -2
- package/dist/chunks/logger-ad87ovol.esm.js.map +0 -1
- package/dist/chunks/routes-g2iqYrq1.esm.js +0 -2
- package/dist/chunks/routes-g2iqYrq1.esm.js.map +0 -1
- package/dist/chunks/types-4zLXwf8o.esm.d.ts +0 -4
- package/dist/chunks/update-cart--iw762bF.esm.js +0 -2
- package/dist/chunks/update-cart--iw762bF.esm.js.map +0 -1
package/README.md
CHANGED
|
@@ -33,6 +33,9 @@ Beam takes care of all the nonprofit management and compliance, impact tracking,
|
|
|
33
33
|
- [Integrations](#integrations)
|
|
34
34
|
- [Cart Integration](#cart-integration)
|
|
35
35
|
- [Utils](#utils)
|
|
36
|
+
- [Integrations](#integrations-1)
|
|
37
|
+
- [Statsig A/B Testing](#statsig-ab-testing)
|
|
38
|
+
- [Visibility](#visibility)
|
|
36
39
|
|
|
37
40
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
38
41
|
|
|
@@ -295,3 +298,61 @@ try {
|
|
|
295
298
|
|
|
296
299
|
window.addEventListener(BeamNonprofitSelectEvent.eventName, async (event) => {});
|
|
297
300
|
```
|
|
301
|
+
|
|
302
|
+
### Integrations
|
|
303
|
+
|
|
304
|
+
#### Statsig A/B Testing
|
|
305
|
+
|
|
306
|
+
Beam has a prebuilt integration for A/B testing with Statsig.
|
|
307
|
+
|
|
308
|
+
```ts
|
|
309
|
+
import { StatsigPlugin } from "@beamimpact/web-sdk/dist/integrations/statsig";
|
|
310
|
+
import { init, getConfig } from "@beamimpact/web-sdk/dist/integrations/beam";
|
|
311
|
+
|
|
312
|
+
const beam = await init({
|
|
313
|
+
apiKey: "",
|
|
314
|
+
chainId: 1,
|
|
315
|
+
storeId: 1,
|
|
316
|
+
domain: "my-store.com", // in case site uses subdomains for different pages
|
|
317
|
+
plugins: [new StatsigPlugin({ statsigApiKey: "" })],
|
|
318
|
+
});
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Initializing the Statsig plugin will automatically log `statsig_init`, `cart_created`, and `order_created` events.
|
|
322
|
+
|
|
323
|
+
To manually log additional events:
|
|
324
|
+
|
|
325
|
+
```ts
|
|
326
|
+
beam.plugins.statsig.logEvent(eventName, eventValue, metadataObject);
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Setup for A/B tests is async. Waiting for Beam A/B test setup to be ready in other scripts:
|
|
330
|
+
|
|
331
|
+
```ts
|
|
332
|
+
const beam = getConfig();
|
|
333
|
+
// Wait for promise to resolve
|
|
334
|
+
await beam.readyPromise; // resolves when plugins are all ready
|
|
335
|
+
// OR use event listeners
|
|
336
|
+
if (beam.status !== "ready") {
|
|
337
|
+
beam.addEventListener("beamstatuschange", (event) => {
|
|
338
|
+
const status = event.detail.status;
|
|
339
|
+
if (status === "ready") doSomething(beam);
|
|
340
|
+
else if (status === "error") handleError(event.detail.error);
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
##### Visibility
|
|
346
|
+
|
|
347
|
+
Once initialized, all Beam widgets have `display: none` unless user is assigned to A/B test group that shows Beam.
|
|
348
|
+
|
|
349
|
+
To hide additional elements, add the CSS className `beam-sync-visibility` to them. Elements with this class will
|
|
350
|
+
automatically have `display: none` if the user can't see Beam.
|
|
351
|
+
|
|
352
|
+
To access the experiment state in JavaScript:
|
|
353
|
+
|
|
354
|
+
```ts
|
|
355
|
+
import { getConfig } from "@beamimpact/web-sdk/dist/integrations/beam";
|
|
356
|
+
|
|
357
|
+
getConfig().plugins.statsig.experiments.shouldShowBeam; // boolean
|
|
358
|
+
```
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./vendor-IGhQoYCM.esm.js";import"../components/impact-overview.esm.js";import"./lit-h1W25hjN.esm.js";import"./lodash-ZxBiuGue.esm.js";import"./routes-N9ZmkAD6.esm.js";import"./beam-errors-AMvTvR1C.esm.js";import"./progress-bar-w3yfrrxD.esm.js";import"./localize-kPkHxPNe.esm.js";import"./is-all-html-elements-SdSkxirh.esm.js";import"../components/beam-partner-logos.esm.js";import"./responsive-Rehmv-eo.esm.js";
|
|
2
|
+
//# sourceMappingURL=_share-dialog-dependencies-Qc0imrGB.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_share-dialog-dependencies-Qc0imrGB.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./vendor-IGhQoYCM.esm.js";import"../components/impact-overview.js";import"./lit-h1W25hjN.esm.js";import"./lodash-ZxBiuGue.esm.js";import"./routes-N9ZmkAD6.esm.js";import"./beam-errors-AMvTvR1C.esm.js";import"./progress-bar-w3yfrrxD.esm.js";import"./localize-kPkHxPNe.esm.js";import"./is-all-html-elements-SdSkxirh.esm.js";import"../components/beam-partner-logos.js";import"./responsive-Rehmv-eo.esm.js";
|
|
2
|
+
//# sourceMappingURL=_share-dialog-dependencies-rEYm7Xgo.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_share-dialog-dependencies-rEYm7Xgo.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
class s extends Error{constructor(r,{cause:e,name:a="BeamError"}={}){super(r,{cause:e}),this.name=a,this.supportUrl="https://beamimpact.com"}}class t extends s{constructor(r,e,a){super(a,{name:"BeamNetworkError"}),this.response=r,this.body=e}}class n extends s{constructor(r=[],e){super(e,{name:"BeamMissingConfig"}),this.missingConfigKeyNames=r}}class c extends s{constructor(r){super(r,{name:"BeamLocalStorageError"})}}class m extends s{constructor(r){super(r,{name:"BeamSetupError"})}}var i=Object.freeze({__proto__:null,BeamError:s,LocalStorageError:c,MissingConfig:n,NetworkError:t,SetupError:m});export{s as B,c as L,n as M,t as N,m as S,i as b};
|
|
2
|
+
//# sourceMappingURL=beam-errors-AMvTvR1C.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beam-errors-
|
|
1
|
+
{"version":3,"file":"beam-errors-AMvTvR1C.esm.js","sources":["../../src/shared/beam-errors.ts"],"sourcesContent":["export class BeamError extends Error {\n supportUrl: string;\n constructor(msg?: string, { cause, name = \"BeamError\" }: { cause?: any; name?: string } = {}) {\n super(msg, { cause });\n this.name = name;\n this.supportUrl = \"https://beamimpact.com\";\n }\n}\n\nexport class NetworkError extends BeamError {\n /** Fetch Response object with .ok, .status, etc.*/\n response: Response;\n /** If network response included JSON payload, it is parsed and available here */\n body?: Record<string, string>;\n constructor(response: Response, body?: Record<string, string>, msg?: string) {\n super(msg, { name: \"BeamNetworkError\" });\n this.response = response;\n this.body = body;\n }\n}\n\nexport class MissingConfig extends BeamError {\n missingConfigKeyNames: string[];\n constructor(missingConfigKeyNames: string[] = [], msg?: string) {\n super(msg, { name: \"BeamMissingConfig\" });\n this.missingConfigKeyNames = missingConfigKeyNames;\n }\n}\n\nexport class LocalStorageError extends BeamError {\n constructor(msg?: string) {\n super(msg, { name: \"BeamLocalStorageError\" });\n }\n}\n\nexport class SetupError extends BeamError {\n constructor(msg?: string) {\n super(msg, { name: \"BeamSetupError\" });\n }\n}\n"],"names":["BeamError","msg","cause","name","NetworkError","response","body","MissingConfig","missingConfigKeyNames","LocalStorageError","SetupError"],"mappings":"AAAa,MAAAA,UAAkB,KAAM,CAEnC,YAAYC,EAAc,CAAE,MAAAC,EAAO,KAAAC,EAAO,WAAY,EAAoC,GAAI,CAC5F,MAAMF,EAAK,CAAE,MAAAC,CAAM,CAAC,EACpB,KAAK,KAAOC,EACZ,KAAK,WAAa,wBACpB,CACF,CAEa,MAAAC,UAAqBJ,CAAU,CAK1C,YAAYK,EAAoBC,EAA+BL,EAAc,CAC3E,MAAMA,EAAK,CAAE,KAAM,kBAAmB,CAAC,EACvC,KAAK,SAAWI,EAChB,KAAK,KAAOC,CACd,CACF,CAEa,MAAAC,UAAsBP,CAAU,CAE3C,YAAYQ,EAAkC,CAAC,EAAGP,EAAc,CAC9D,MAAMA,EAAK,CAAE,KAAM,mBAAoB,CAAC,EACxC,KAAK,sBAAwBO,CAC/B,CACF,CAEa,MAAAC,UAA0BT,CAAU,CAC/C,YAAYC,EAAc,CACxB,MAAMA,EAAK,CAAE,KAAM,uBAAwB,CAAC,CAC9C,CACF,CAEa,MAAAS,UAAmBV,CAAU,CACxC,YAAYC,EAAc,CACxB,MAAMA,EAAK,CAAE,KAAM,gBAAiB,CAAC,CACvC,CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { p as paths } from './openapi-spec-scRfHArN.esm.js';
|
|
2
|
+
|
|
3
|
+
type TCartApi = paths["/chain/findEligibleNonprofitsForCart"]["post"]["requestBody"]["content"]["application/json"]["cart"];
|
|
4
|
+
type TCart = TCartApi & {
|
|
5
|
+
content: {
|
|
6
|
+
items: Record<string, any>[];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type { TCartApi as T, TCart as a };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { T as TCartApi } from './cart-contents-P2GzTrNn.esm.js';
|
|
2
|
+
import { c as TId } from './types-7kSi85Gv.esm.js';
|
|
3
|
+
|
|
4
|
+
type NetworkEventDetail = {
|
|
5
|
+
url: string;
|
|
6
|
+
method: string;
|
|
7
|
+
type: "fetch";
|
|
8
|
+
response: Response;
|
|
9
|
+
} | {
|
|
10
|
+
url: string;
|
|
11
|
+
method: string;
|
|
12
|
+
type: "xhr";
|
|
13
|
+
xhr: XMLHttpRequest;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* beamnetworkcall
|
|
17
|
+
* Emitted by the Beam network listener whenever any API calls are made on the page
|
|
18
|
+
*/
|
|
19
|
+
declare class BeamNetworkCallEvent extends CustomEvent<NetworkEventDetail> {
|
|
20
|
+
static eventName: "beamnetworkcall";
|
|
21
|
+
constructor(detail: NetworkEventDetail);
|
|
22
|
+
}
|
|
23
|
+
type NonprofitSelectDetail = {
|
|
24
|
+
selectionId?: string;
|
|
25
|
+
selectedNonprofitId?: number | null;
|
|
26
|
+
nonprofitName?: string | null;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* beamnonprofitselect
|
|
30
|
+
* Emitted when the end user selects a nonprofit in the Beam widget, and when the previous selection was restored
|
|
31
|
+
* automatically
|
|
32
|
+
*/
|
|
33
|
+
declare class BeamNonprofitSelectEvent extends CustomEvent<NonprofitSelectDetail> {
|
|
34
|
+
static eventName: "beamnonprofitselect";
|
|
35
|
+
constructor(detail: NonprofitSelectDetail);
|
|
36
|
+
}
|
|
37
|
+
type CartChangeDetail = TCartApi & {
|
|
38
|
+
cartId?: string;
|
|
39
|
+
subtotal?: number;
|
|
40
|
+
itemCount?: number;
|
|
41
|
+
currencyCode?: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* beamcartchange
|
|
45
|
+
* Emitted when Beam detects that cart contents have changed, and when items are added to the cart for the first time
|
|
46
|
+
*/
|
|
47
|
+
declare class BeamCartChangeEvent extends CustomEvent<CartChangeDetail> {
|
|
48
|
+
static eventName: "beamcartchange";
|
|
49
|
+
constructor(detail: CartChangeDetail);
|
|
50
|
+
}
|
|
51
|
+
type CartCreatedDetail = CartChangeDetail;
|
|
52
|
+
/**
|
|
53
|
+
* beamcartcreated
|
|
54
|
+
* Emitted when a cart is created in Beam for the first time, but NOT when the cart is updated
|
|
55
|
+
* Beam's cart expiration rules are used to determine when a returning visit counts as the same cart
|
|
56
|
+
*/
|
|
57
|
+
declare class BeamCartCreatedEvent extends CustomEvent<CartCreatedDetail> {
|
|
58
|
+
static eventName: "beamcartcreated";
|
|
59
|
+
constructor(detail: CartCreatedDetail);
|
|
60
|
+
}
|
|
61
|
+
type OrderCreatedDetail = {
|
|
62
|
+
orderId: TId;
|
|
63
|
+
transactionId: TId;
|
|
64
|
+
cartTotal: number;
|
|
65
|
+
currencyCode: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* beamordercreated
|
|
69
|
+
* Emitted when an order is registered with Beam for the first time, but NOT on repeat visits, page refreshes, etc.
|
|
70
|
+
*/
|
|
71
|
+
declare class BeamOrderCreatedEvent extends CustomEvent<OrderCreatedDetail> {
|
|
72
|
+
static eventName: "beamordercreated";
|
|
73
|
+
constructor(detail: OrderCreatedDetail);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* beamstatuschange
|
|
77
|
+
* Emitted when the Beam config object has finished initializing along with all plugins
|
|
78
|
+
*/
|
|
79
|
+
type BeamStatusChangeEventDetail = {
|
|
80
|
+
status: "pending";
|
|
81
|
+
} | {
|
|
82
|
+
status: "error";
|
|
83
|
+
error: Error;
|
|
84
|
+
} | {
|
|
85
|
+
status: "ready";
|
|
86
|
+
};
|
|
87
|
+
declare class BeamStatusChangeEvent extends CustomEvent<BeamStatusChangeEventDetail> {
|
|
88
|
+
static eventName: "beamstatuschange";
|
|
89
|
+
constructor(detail: BeamStatusChangeEventDetail);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
type events_BeamCartChangeEvent = BeamCartChangeEvent;
|
|
93
|
+
declare const events_BeamCartChangeEvent: typeof BeamCartChangeEvent;
|
|
94
|
+
type events_BeamCartCreatedEvent = BeamCartCreatedEvent;
|
|
95
|
+
declare const events_BeamCartCreatedEvent: typeof BeamCartCreatedEvent;
|
|
96
|
+
type events_BeamNetworkCallEvent = BeamNetworkCallEvent;
|
|
97
|
+
declare const events_BeamNetworkCallEvent: typeof BeamNetworkCallEvent;
|
|
98
|
+
type events_BeamNonprofitSelectEvent = BeamNonprofitSelectEvent;
|
|
99
|
+
declare const events_BeamNonprofitSelectEvent: typeof BeamNonprofitSelectEvent;
|
|
100
|
+
type events_BeamOrderCreatedEvent = BeamOrderCreatedEvent;
|
|
101
|
+
declare const events_BeamOrderCreatedEvent: typeof BeamOrderCreatedEvent;
|
|
102
|
+
type events_BeamStatusChangeEvent = BeamStatusChangeEvent;
|
|
103
|
+
declare const events_BeamStatusChangeEvent: typeof BeamStatusChangeEvent;
|
|
104
|
+
declare namespace events {
|
|
105
|
+
export { events_BeamCartChangeEvent as BeamCartChangeEvent, events_BeamCartCreatedEvent as BeamCartCreatedEvent, events_BeamNetworkCallEvent as BeamNetworkCallEvent, events_BeamNonprofitSelectEvent as BeamNonprofitSelectEvent, events_BeamOrderCreatedEvent as BeamOrderCreatedEvent, events_BeamStatusChangeEvent as BeamStatusChangeEvent };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { BeamNonprofitSelectEvent as B, events as e };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const t=class b extends CustomEvent{constructor(e){super(b.eventName,{detail:e,bubbles:!0,composed:!0})}};t.eventName="beamnetworkcall";let a=t;const s=class C extends CustomEvent{constructor(e){super(C.eventName,{detail:e,bubbles:!0,composed:!0})}};s.eventName="beamnonprofitselect";let n=s;const o=class E extends CustomEvent{constructor(e){super(E.eventName,{detail:e,bubbles:!0,composed:!0})}};o.eventName="beamcartchange";let r=o;const c=class p extends CustomEvent{constructor(e){super(p.eventName,{detail:e,bubbles:!0,composed:!0})}};c.eventName="beamcartcreated";let m=c;const l=class N extends CustomEvent{constructor(e){super(N.eventName,{detail:e,bubbles:!0,composed:!0})}};l.eventName="beamordercreated";let v=l;const d=class B extends CustomEvent{constructor(e){super(B.eventName,{detail:e,bubbles:!0,composed:!0})}};d.eventName="beamstatuschange";let u=d;var i=Object.freeze({__proto__:null,BeamCartChangeEvent:r,BeamCartCreatedEvent:m,BeamNetworkCallEvent:a,BeamNonprofitSelectEvent:n,BeamOrderCreatedEvent:v,BeamStatusChangeEvent:u});export{m as B,v as a,n as b,r as c,u as d,i as e,a as f};
|
|
2
|
+
//# sourceMappingURL=events-wNy5BoJV.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events-wNy5BoJV.esm.js","sources":["../../src/shared/events.ts"],"sourcesContent":["import { TCartApi } from \"./cart-contents\";\nimport { TId } from \"./types\";\n\n/* ------------------------------------------------------------------------------------------------------------------ */\n\ntype NetworkEventDetail =\n | { url: string; method: string; type: \"fetch\"; response: Response }\n | { url: string; method: string; type: \"xhr\"; xhr: XMLHttpRequest };\n\n/**\n * beamnetworkcall\n * Emitted by the Beam network listener whenever any API calls are made on the page\n */\nexport class BeamNetworkCallEvent extends CustomEvent<NetworkEventDetail> {\n static eventName = \"beamnetworkcall\" as const;\n constructor(detail: NetworkEventDetail) {\n super(BeamNetworkCallEvent.eventName, { detail, bubbles: true, composed: true });\n }\n}\n\n/* ------------------------------------------------------------------------------------------------------------------ */\n\ntype NonprofitSelectDetail = {\n selectionId?: string;\n selectedNonprofitId?: number | null;\n nonprofitName?: string | null;\n};\n\n/**\n * beamnonprofitselect\n * Emitted when the end user selects a nonprofit in the Beam widget, and when the previous selection was restored\n * automatically\n */\nexport class BeamNonprofitSelectEvent extends CustomEvent<NonprofitSelectDetail> {\n static eventName = \"beamnonprofitselect\" as const;\n constructor(detail: NonprofitSelectDetail) {\n super(BeamNonprofitSelectEvent.eventName, { detail, bubbles: true, composed: true });\n }\n}\n\n/* ------------------------------------------------------------------------------------------------------------------ */\n\ntype CartChangeDetail = TCartApi & {\n cartId?: string;\n subtotal?: number;\n itemCount?: number;\n currencyCode?: string;\n};\n\n/**\n * beamcartchange\n * Emitted when Beam detects that cart contents have changed, and when items are added to the cart for the first time\n */\nexport class BeamCartChangeEvent extends CustomEvent<CartChangeDetail> {\n static eventName = \"beamcartchange\" as const;\n constructor(detail: CartChangeDetail) {\n super(BeamCartChangeEvent.eventName, { detail, bubbles: true, composed: true });\n }\n}\n\n/* ------------------------------------------------------------------------------------------------------------------ */\n\ntype CartCreatedDetail = CartChangeDetail;\n\n/**\n * beamcartcreated\n * Emitted when a cart is created in Beam for the first time, but NOT when the cart is updated\n * Beam's cart expiration rules are used to determine when a returning visit counts as the same cart\n */\nexport class BeamCartCreatedEvent extends CustomEvent<CartCreatedDetail> {\n static eventName = \"beamcartcreated\" as const;\n constructor(detail: CartCreatedDetail) {\n super(BeamCartCreatedEvent.eventName, { detail, bubbles: true, composed: true });\n }\n}\n\n/* ------------------------------------------------------------------------------------------------------------------ */\n\ntype OrderCreatedDetail = {\n orderId: TId;\n transactionId: TId;\n cartTotal: number;\n currencyCode: string;\n};\n\n/**\n * beamordercreated\n * Emitted when an order is registered with Beam for the first time, but NOT on repeat visits, page refreshes, etc.\n */\nexport class BeamOrderCreatedEvent extends CustomEvent<OrderCreatedDetail> {\n static eventName = \"beamordercreated\" as const;\n\n constructor(detail: OrderCreatedDetail) {\n super(BeamOrderCreatedEvent.eventName, { detail, bubbles: true, composed: true });\n }\n}\n\n/* ------------------------------------------------------------------------------------------------------------------ */\n\n/**\n * beamstatuschange\n * Emitted when the Beam config object has finished initializing along with all plugins\n */\ntype BeamStatusChangeEventDetail = { status: \"pending\" } | { status: \"error\"; error: Error } | { status: \"ready\" };\nexport class BeamStatusChangeEvent extends CustomEvent<BeamStatusChangeEventDetail> {\n static eventName = \"beamstatuschange\" as const;\n\n constructor(detail: BeamStatusChangeEventDetail) {\n super(BeamStatusChangeEvent.eventName, { detail, bubbles: true, composed: true });\n }\n}\n"],"names":["_BeamNetworkCallEvent","detail","BeamNetworkCallEvent","_BeamNonprofitSelectEvent","BeamNonprofitSelectEvent","_BeamCartChangeEvent","BeamCartChangeEvent","_BeamCartCreatedEvent","BeamCartCreatedEvent","_BeamOrderCreatedEvent","BeamOrderCreatedEvent","_BeamStatusChangeEvent","BeamStatusChangeEvent"],"mappings":"AAaO,MAAMA,EAAN,MAAMA,UAA6B,WAAgC,CAExE,YAAYC,EAA4B,CACtC,MAAMD,EAAqB,UAAW,CAAE,OAAAC,EAAQ,QAAS,GAAM,SAAU,EAAK,CAAC,CACjF,CACF,EALaD,EACJ,UAAY,kBADR,IAAAE,EAANF,EAoBA,MAAMG,EAAN,MAAMA,UAAiC,WAAmC,CAE/E,YAAYF,EAA+B,CACzC,MAAME,EAAyB,UAAW,CAAE,OAAAF,EAAQ,QAAS,GAAM,SAAU,EAAK,CAAC,CACrF,CACF,EALaE,EACJ,UAAY,0BADRC,EAAND,EAoBA,MAAME,EAAN,MAAMA,UAA4B,WAA8B,CAErE,YAAYJ,EAA0B,CACpC,MAAMI,EAAoB,UAAW,CAAE,OAAAJ,EAAQ,QAAS,GAAM,SAAU,EAAK,CAAC,CAChF,CACF,EALaI,EACJ,UAAY,iBADR,IAAAC,EAAND,EAgBA,MAAME,EAAN,MAAMA,UAA6B,WAA+B,CAEvE,YAAYN,EAA2B,CACrC,MAAMM,EAAqB,UAAW,CAAE,OAAAN,EAAQ,QAAS,GAAM,SAAU,EAAK,CAAC,CACjF,CACF,EALaM,EACJ,UAAY,sBADRC,EAAND,EAoBA,MAAME,EAAN,MAAMA,UAA8B,WAAgC,CAGzE,YAAYR,EAA4B,CACtC,MAAMQ,EAAsB,UAAW,CAAE,OAAAR,EAAQ,QAAS,GAAM,SAAU,EAAK,CAAC,CAClF,CACF,EANaQ,EACJ,UAAY,mBADd,IAAMC,EAAND,EAeA,MAAME,EAAN,MAAMA,UAA8B,WAAyC,CAGlF,YAAYV,EAAqC,CAC/C,MAAMU,EAAsB,UAAW,CAAE,OAAAV,EAAQ,QAAS,GAAM,SAAU,EAAK,CAAC,CAClF,CACF,EANaU,EACJ,UAAY,uBADRC,EAAND"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h as e,C as r,B as t,s as a,N as o}from"./order-page-1-A-Yhbv.esm.js";var s=Object.freeze({__proto__:null,addBeamAttributesToCart:e,getCurrentCart:r,registerCartIntegration:t,showBeamOrderPageWidgets:a,trackCart:o});export{s as i};
|
|
2
|
+
//# sourceMappingURL=index--N2RR1Fn.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index--N2RR1Fn.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BeamCartAPIConfig, a as BeamCartValues, u as updateCart } from './update-cart-
|
|
1
|
+
import { B as BeamCartAPIConfig, a as BeamCartValues, u as updateCart } from './update-cart-3nc7XKMm.esm.js';
|
|
2
2
|
|
|
3
3
|
declare const index_BeamCartAPIConfig: typeof BeamCartAPIConfig;
|
|
4
4
|
declare const index_BeamCartValues: typeof BeamCartValues;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{getConfig as e,init as o}from"../integrations/beam.js";import{b as t}from"./beam-errors-AMvTvR1C.esm.js";import{e as r}from"./events-wNy5BoJV.esm.js";import{l as i}from"./routes-N9ZmkAD6.esm.js";import{f as s,i as a,w as m,x as g}from"./network-listeners-O5LKv8Yy.esm.js";import{c as n}from"./local-storage-GYvYzZ_j.esm.js";import{d as l,g as f,a as p,s as c}from"./cookies-BnIoXWd0.esm.js";import{g as k,s as C}from"./remote-session-V4YG-mcS.esm.js";var x=Object.freeze({__proto__:null,createScopedLocalStorage:n,deleteCookieValue:l,errors:t,events:r,fetchProxy:s,getConfig:e,getCookieMap:f,getCookieValue:p,getRemoteSession:k,init:o,initNetworkListeners:a,logger:i,saveRemoteSession:C,setCookieValue:c,waitForElement:m,xhrProxy:g});export{x as i};
|
|
2
|
+
//# sourceMappingURL=index-FDDoUJQk.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-FDDoUJQk.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i}from"./index-np6s8UdD.esm.js";import{i as o}from"./index-czOZQ1Sz.esm.js";import{i as r}from"./index-jFZJm9-Y.esm.js";import{i as e}from"./index-g5lw5BB-.esm.js";import{i as m}from"./index-L8CVKt4D.esm.js";var s=Object.freeze({__proto__:null,Cart:e,Logs:m,Session:r,Shopify:o,Utils:i});export{s as i};
|
|
2
|
+
//# sourceMappingURL=index-JrZwQjr2.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-JrZwQjr2.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TBeamOrderPageParams, a as addBeamAttributesToCart, g as getCurrentCart, r as registerCartIntegration, s as showBeamOrderPageWidgets, t as trackCart } from './order-page-
|
|
1
|
+
import { T as TBeamOrderPageParams, a as addBeamAttributesToCart, g as getCurrentCart, r as registerCartIntegration, s as showBeamOrderPageWidgets, t as trackCart } from './order-page-40SzBc--.esm.js';
|
|
2
2
|
|
|
3
3
|
declare const index_TBeamOrderPageParams: typeof TBeamOrderPageParams;
|
|
4
4
|
declare const index_addBeamAttributesToCart: typeof addBeamAttributesToCart;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as i,c as n,l}from"./routes-N9ZmkAD6.esm.js";async function e(o,s){const{apiKey:a,baseUrl:r}=o;try{await n({baseUrl:r||i,headers:{authorization:`Api-Key ${a}`},requestBody:{...s}})}catch(t){l.error("Failed to send log",t)}}var c=Object.freeze({__proto__:null,sendLog:e});export{c as i,e as s};
|
|
2
|
+
//# sourceMappingURL=index-L8CVKt4D.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-L8CVKt4D.esm.js","sources":["../../src/integrations/logs/index.ts"],"sourcesContent":["import { postLogs } from \"../../api-sdk/v3/routes\";\nimport { paths } from \"../../api-sdk/v3/openapi-spec\";\nimport { logger } from \"../../shared/logger\";\nimport { DEFAULT_LOG_URL } from \"../../api-sdk/constants\";\n\ntype PostLogsReq = paths[\"/logs\"][\"post\"][\"requestBody\"][\"content\"][\"application/json\"];\n\ninterface SendLogConfig {\n apiKey: string;\n baseUrl?: string;\n}\n\nexport async function sendLog(config: SendLogConfig, payload: PostLogsReq): Promise<void> {\n const { apiKey, baseUrl } = config;\n try {\n await postLogs({\n baseUrl: baseUrl || DEFAULT_LOG_URL,\n headers: {\n authorization: `Api-Key ${apiKey}`,\n },\n requestBody: {\n ...payload,\n },\n });\n } catch (err) {\n logger.error(\"Failed to send log\", err);\n }\n}\n"],"names":["sendLog","config","payload","apiKey","baseUrl","postLogs","DEFAULT_LOG_URL","err","logger"],"mappings":"sDAYA,eAAsBA,EAAQC,EAAuBC,EAAqC,CACxF,KAAM,CAAE,OAAAC,EAAQ,QAAAC,CAAQ,EAAIH,EAC5B,GAAI,CACF,MAAMI,EAAS,CACb,QAASD,GAAWE,EACpB,QAAS,CACP,cAAe,WAAWH,CAAM,EAClC,EACA,YAAa,CACX,GAAGD,CACL,CACF,CAAC,CACH,OAASK,EAAK,CACZC,EAAO,MAAM,qBAAsBD,CAAG,CACxC,CACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i}from"./index-FDDoUJQk.esm.js";import{i as o}from"./index--N2RR1Fn.esm.js";import{i as r}from"./index-jFZJm9-Y.esm.js";import{i as e}from"./index-g5lw5BB-.esm.js";import{i as m}from"./index-L8CVKt4D.esm.js";var s=Object.freeze({__proto__:null,Cart:e,Logs:m,Session:r,Shopify:o,Utils:i});export{s as i};
|
|
2
|
+
//# sourceMappingURL=index-YPrpyEl9.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-YPrpyEl9.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BeamConfigOptions, BeamPlugin, getConfig, init } from '../integrations/beam.js';
|
|
2
|
+
import { e as events } from './events-60jQoHQi.esm.js';
|
|
2
3
|
import { f as fetchProxy, i as initNetworkListeners, w as waitForElement, x as xhrProxy } from './network-listeners-6tkaLA3D.esm.js';
|
|
3
4
|
|
|
4
5
|
declare class BeamError extends Error {
|
|
@@ -22,6 +23,9 @@ declare class MissingConfig extends BeamError {
|
|
|
22
23
|
declare class LocalStorageError extends BeamError {
|
|
23
24
|
constructor(msg?: string);
|
|
24
25
|
}
|
|
26
|
+
declare class SetupError extends BeamError {
|
|
27
|
+
constructor(msg?: string);
|
|
28
|
+
}
|
|
25
29
|
|
|
26
30
|
type beamErrors_BeamError = BeamError;
|
|
27
31
|
declare const beamErrors_BeamError: typeof BeamError;
|
|
@@ -31,15 +35,17 @@ type beamErrors_MissingConfig = MissingConfig;
|
|
|
31
35
|
declare const beamErrors_MissingConfig: typeof MissingConfig;
|
|
32
36
|
type beamErrors_NetworkError = NetworkError;
|
|
33
37
|
declare const beamErrors_NetworkError: typeof NetworkError;
|
|
38
|
+
type beamErrors_SetupError = SetupError;
|
|
39
|
+
declare const beamErrors_SetupError: typeof SetupError;
|
|
34
40
|
declare namespace beamErrors {
|
|
35
|
-
export { beamErrors_BeamError as BeamError, beamErrors_LocalStorageError as LocalStorageError, beamErrors_MissingConfig as MissingConfig, beamErrors_NetworkError as NetworkError };
|
|
41
|
+
export { beamErrors_BeamError as BeamError, beamErrors_LocalStorageError as LocalStorageError, beamErrors_MissingConfig as MissingConfig, beamErrors_NetworkError as NetworkError, beamErrors_SetupError as SetupError };
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
declare const logger: {
|
|
39
|
-
error: (...
|
|
40
|
-
log: (...
|
|
41
|
-
warn: (...
|
|
42
|
-
debug: (...
|
|
45
|
+
error: (...args: any[]) => void;
|
|
46
|
+
log: (...args: any[]) => void;
|
|
47
|
+
warn: (...args: any[]) => void;
|
|
48
|
+
debug: (...args: any[]) => void;
|
|
43
49
|
};
|
|
44
50
|
|
|
45
51
|
/**
|
|
@@ -125,14 +131,18 @@ declare function getRemoteSession({ apiKey }: {
|
|
|
125
131
|
apiKey?: string;
|
|
126
132
|
}): string | null;
|
|
127
133
|
|
|
134
|
+
declare const index_BeamConfigOptions: typeof BeamConfigOptions;
|
|
135
|
+
declare const index_BeamPlugin: typeof BeamPlugin;
|
|
128
136
|
type index_CookieChangeEvent = CookieChangeEvent;
|
|
129
137
|
declare const index_createScopedLocalStorage: typeof createScopedLocalStorage;
|
|
130
138
|
declare const index_deleteCookieValue: typeof deleteCookieValue;
|
|
131
139
|
declare const index_events: typeof events;
|
|
132
140
|
declare const index_fetchProxy: typeof fetchProxy;
|
|
141
|
+
declare const index_getConfig: typeof getConfig;
|
|
133
142
|
declare const index_getCookieMap: typeof getCookieMap;
|
|
134
143
|
declare const index_getCookieValue: typeof getCookieValue;
|
|
135
144
|
declare const index_getRemoteSession: typeof getRemoteSession;
|
|
145
|
+
declare const index_init: typeof init;
|
|
136
146
|
declare const index_initNetworkListeners: typeof initNetworkListeners;
|
|
137
147
|
declare const index_logger: typeof logger;
|
|
138
148
|
declare const index_saveRemoteSession: typeof saveRemoteSession;
|
|
@@ -140,7 +150,7 @@ declare const index_setCookieValue: typeof setCookieValue;
|
|
|
140
150
|
declare const index_waitForElement: typeof waitForElement;
|
|
141
151
|
declare const index_xhrProxy: typeof xhrProxy;
|
|
142
152
|
declare namespace index {
|
|
143
|
-
export { type index_CookieChangeEvent as CookieChangeEvent, index_createScopedLocalStorage as createScopedLocalStorage, index_deleteCookieValue as deleteCookieValue, beamErrors as errors, index_events as events, index_fetchProxy as fetchProxy, index_getCookieMap as getCookieMap, index_getCookieValue as getCookieValue, index_getRemoteSession as getRemoteSession, index_initNetworkListeners as initNetworkListeners, index_logger as logger, index_saveRemoteSession as saveRemoteSession, index_setCookieValue as setCookieValue, index_waitForElement as waitForElement, index_xhrProxy as xhrProxy };
|
|
153
|
+
export { index_BeamConfigOptions as BeamConfigOptions, index_BeamPlugin as BeamPlugin, type index_CookieChangeEvent as CookieChangeEvent, index_createScopedLocalStorage as createScopedLocalStorage, index_deleteCookieValue as deleteCookieValue, beamErrors as errors, index_events as events, index_fetchProxy as fetchProxy, index_getConfig as getConfig, index_getCookieMap as getCookieMap, index_getCookieValue as getCookieValue, index_getRemoteSession as getRemoteSession, index_init as init, index_initNetworkListeners as initNetworkListeners, index_logger as logger, index_saveRemoteSession as saveRemoteSession, index_setCookieValue as setCookieValue, index_waitForElement as waitForElement, index_xhrProxy as xhrProxy };
|
|
144
154
|
}
|
|
145
155
|
|
|
146
156
|
export { type CookieChangeEvent as C, getCookieValue as a, beamErrors as b, createScopedLocalStorage as c, deleteCookieValue as d, saveRemoteSession as e, getRemoteSession as f, getCookieMap as g, index as i, logger as l, setCookieValue as s };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h as e,C as r,B as t,s as a,N as o}from"./order-page-l0phiTZ7.esm.js";var s=Object.freeze({__proto__:null,addBeamAttributesToCart:e,getCurrentCart:r,registerCartIntegration:t,showBeamOrderPageWidgets:a,trackCart:o});export{s as i};
|
|
2
|
+
//# sourceMappingURL=index-czOZQ1Sz.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-czOZQ1Sz.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-g5lw5BB-.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { p as paths } from './openapi-spec-scRfHArN.esm.js';
|
|
2
|
+
|
|
3
|
+
type PostLogsReq = paths["/logs"]["post"]["requestBody"]["content"]["application/json"];
|
|
4
|
+
interface SendLogConfig {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function sendLog(config: SendLogConfig, payload: PostLogsReq): Promise<void>;
|
|
9
|
+
|
|
10
|
+
declare const index_sendLog: typeof sendLog;
|
|
11
|
+
declare namespace index {
|
|
12
|
+
export { index_sendLog as sendLog };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { index as i, sendLog as s };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{v as d}from"./vendor-IGhQoYCM.esm.js";import{a as i,s as p,d as l}from"./cookies-BnIoXWd0.esm.js";import{c as n}from"./local-storage-
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{v as d}from"./vendor-IGhQoYCM.esm.js";import{a as i,s as p,d as l}from"./cookies-BnIoXWd0.esm.js";import{c as n}from"./local-storage-GYvYzZ_j.esm.js";const s="beam_session";async function c({cookieName:e=s,domain:o=window.location.hostname,apiKey:t=""}={}){if(await i(e))return;const a=d(),m=Date.now()+30*24*60*60*1e3;await p({name:e,value:a,domain:o,path:"/",expires:m}),n({apiKey:t}).setItemJson("cart",{cartId:a})}async function r({cookieName:e=s,domain:o=window.location.hostname,apiKey:t=""}={}){const a=await i(e);a&&(n({apiKey:t}).setItemJson("cart",{cartId:a}),await l({name:e,domain:o}))}var u=Object.freeze({__proto__:null,createSession:c,endSession:r});export{c,r as e,u as i};
|
|
2
|
+
//# sourceMappingURL=index-jFZJm9-Y.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-jFZJm9-Y.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 \"../../shared/cookies\";\nimport { createScopedLocalStorage } from \"../../shared/local-storage\";\n\nconst DEFAULT_COOKIE_NAME = \"beam_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","createSession","cookieName","domain","apiKey","getCookieValue","cookieValue","uuid","expires","setCookieValue","createScopedLocalStorage","endSession","deleteCookieValue"],"mappings":"6JAuBA,MAAMA,EAAsB,eAE5B,eAAsBC,EAAc,CAClC,WAAAC,EAAaF,EACb,OAAAG,EAAS,OAAO,SAAS,SACzB,OAAAC,EAAS,EACX,EAAI,CAAI,EAAA,CAGN,GAFsB,MAAMC,EAAeH,CAAU,EAGnD,OAGF,MAAMI,EAAcC,EAAK,EAEnBC,EAAU,KAAK,IAAA,EAAQ,GAAK,GAAK,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,EAAaF,EACb,OAAAG,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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { i as index$5 } from './index-Zzs4grqC.esm.js';
|
|
2
|
+
import { i as index$4 } from './index-L59voCOg.esm.js';
|
|
3
|
+
import { i as index$3 } from './index-EGiUuWe-.esm.js';
|
|
4
|
+
import { i as index$1 } from './index-CItwC8WO.esm.js';
|
|
5
|
+
import { i as index$2 } from './index-iTqsULiK.esm.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This file is used to provide type definitions
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare namespace index {
|
|
12
|
+
export { index$1 as Cart, index$2 as Logs, index$3 as Session, index$4 as Shopify, index$5 as Utils };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { index as i };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{getConfig as e,init as o}from"../integrations/beam.esm.js";import{b as t}from"./beam-errors-AMvTvR1C.esm.js";import{e as r}from"./events-wNy5BoJV.esm.js";import{l as i}from"./routes-N9ZmkAD6.esm.js";import{f as s,i as a,w as m,x as g}from"./network-listeners-O5LKv8Yy.esm.js";import{c as n}from"./local-storage-GYvYzZ_j.esm.js";import{d as l,g as f,a as p,s as c}from"./cookies-BnIoXWd0.esm.js";import{g as k,s as C}from"./remote-session-V4YG-mcS.esm.js";var x=Object.freeze({__proto__:null,createScopedLocalStorage:n,deleteCookieValue:l,errors:t,events:r,fetchProxy:s,getConfig:e,getCookieMap:f,getCookieValue:p,getRemoteSession:k,init:o,initNetworkListeners:a,logger:i,saveRemoteSession:C,setCookieValue:c,waitForElement:m,xhrProxy:g});export{x as i};
|
|
2
|
+
//# sourceMappingURL=index-np6s8UdD.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-np6s8UdD.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{L as o}from"./beam-errors-
|
|
2
|
-
//# sourceMappingURL=local-storage-
|
|
1
|
+
import{L as o}from"./beam-errors-AMvTvR1C.esm.js";const s=r=>({get prefix(){return"beam_"},get postfix(){return`_key_${r.apiKey}`},getItem(e){return localStorage.getItem(this.prefix+e+this.postfix)},setItem(e,t){return localStorage.setItem(this.prefix+e+this.postfix,`${t}`)},removeItem(e){return localStorage.removeItem(this.prefix+e+this.postfix)},getItemJson(e){try{const t=this.getItem(e);if(t)return JSON.parse(t)}catch{console.error(new o(`Could not parse JSON: ${e}`))}return null},setItemJson(e,t){return this.setItem(e,JSON.stringify(t))}});export{s as c};
|
|
2
|
+
//# sourceMappingURL=local-storage-GYvYzZ_j.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-storage-
|
|
1
|
+
{"version":3,"file":"local-storage-GYvYzZ_j.esm.js","sources":["../../src/shared/local-storage.ts"],"sourcesContent":["import { LocalStorageError } from \"./beam-errors\";\n\n/**\n * Creates an object that has the same API as normal localStorage, but adds a beam_ prefix and apiKey postfix to keys\n * Also adds helper methods for JSON (de-)serialization\n */\nexport const createScopedLocalStorage = (config: { apiKey: string }) => {\n // TODO: this is where we can check the schema version and do cleanup/migrations of old data\n // TODO: consider using a single Beam key in localstorage and storing JSON string\n return {\n get prefix() {\n return `beam_`;\n },\n get postfix() {\n return `_key_${config.apiKey}`;\n },\n getItem(key: string): string | null {\n return localStorage.getItem(this.prefix + key + this.postfix);\n },\n setItem(key: string, value: unknown) {\n return localStorage.setItem(this.prefix + key + this.postfix, `${value}`);\n },\n removeItem(key: string) {\n return localStorage.removeItem(this.prefix + key + this.postfix);\n },\n /** Safely parses value as JSON and return JS object */\n getItemJson<T = Record<string, unknown>>(key: string) {\n try {\n const json = this.getItem(key);\n if (json) {\n return JSON.parse(json) as T;\n }\n } catch (err) {\n console.error(new LocalStorageError(`Could not parse JSON: ${key}`));\n }\n return null;\n },\n /** Safely stringifies value as JSON */\n setItemJson(key: string, value: object) {\n return this.setItem(key, JSON.stringify(value));\n },\n };\n};\n"],"names":["createScopedLocalStorage","config","key","value","json","LocalStorageError"],"mappings":"kDAMa,MAAAA,EAA4BC,IAGhC,CACL,IAAI,QAAS,CACX,MAAO,OACT,EACA,IAAI,SAAU,CACZ,MAAO,QAAQA,EAAO,MAAM,EAC9B,EACA,QAAQC,EAA4B,CAClC,OAAO,aAAa,QAAQ,KAAK,OAASA,EAAM,KAAK,OAAO,CAC9D,EACA,QAAQA,EAAaC,EAAgB,CACnC,OAAO,aAAa,QAAQ,KAAK,OAASD,EAAM,KAAK,QAAS,GAAGC,CAAK,EAAE,CAC1E,EACA,WAAWD,EAAa,CACtB,OAAO,aAAa,WAAW,KAAK,OAASA,EAAM,KAAK,OAAO,CACjE,EAEA,YAAyCA,EAAa,CACpD,GAAI,CACF,MAAME,EAAO,KAAK,QAAQF,CAAG,EAC7B,GAAIE,EACF,OAAO,KAAK,MAAMA,CAAI,CAE1B,MAAc,CACZ,QAAQ,MAAM,IAAIC,EAAkB,yBAAyBH,CAAG,EAAE,CAAC,CACrE,CACA,OAAO,IACT,EAEA,YAAYA,EAAaC,EAAe,CACtC,OAAO,KAAK,QAAQD,EAAK,KAAK,UAAUC,CAAK,CAAC,CAChD,CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as p,y as o,j as d}from"./lit-h1W25hjN.esm.js";import{N as u,M as f,B as $}from"./beam-errors-
|
|
1
|
+
import{h as p,y as o,j as d}from"./lit-h1W25hjN.esm.js";import{N as u,M as f,B as $}from"./beam-errors-AMvTvR1C.esm.js";import{l as m}from"./routes-N9ZmkAD6.esm.js";const b=p`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}ul{list-style:none}button,input,select{margin:0}html{box-sizing:border-box}*,*::before,*::after{box-sizing:inherit}img,video{/*height:auto;*/max-width:100%}iframe{border:0}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}`;function y(t,e=t.tagName){customElements.get(e)||customElements.define(e,t)}const x=t=>Object.entries(t).map(([e,r])=>`${e}: ${r};`).join(`
|
|
2
2
|
`);class w{constructor(e,r){this.data=null,this.loading=!1,this.error=null,(this.host=e).addController(this),this.asyncFn=r}async exec(...e){this.lastArgs=e,this.loading=!0,this.host.requestUpdate();try{this.data=await this.asyncFn(...e),this.error=null}catch(r){r instanceof Error&&(this.error=r,this.data=null)}return this.loading=!1,this.host.requestUpdate(),this.data}async retry(){return this.exec(...this.lastArgs||[])}hostDisconnected(){}}const g={errorTitle:"Beam encountered an error. Please try again.",retry:"Retry"},T=({error:t,retry:e})=>{let r=o``;if(t instanceof u){const i=JSON.stringify({status:t.response.status,statusText:t.response.statusText,url:t.response.url,body:t.body},null,4);r=o`
|
|
3
3
|
<p><b>Network Response:</b></p>
|
|
4
4
|
<p>${i}</p>
|
|
@@ -27,4 +27,4 @@ import{h as p,y as o,j as d}from"./lit-h1W25hjN.esm.js";import{N as u,M as f,B a
|
|
|
27
27
|
color: var(${n}-color, ${c});
|
|
28
28
|
`)};function z(t,e){const r=[],i=e;for(const s of t)i[s]==null&&r.push(s);if(r.length>0)throw m.error(`Beam Impact - Missing Required Config Values:
|
|
29
29
|
`,r.join(", "),e),new f(r);return!0}const F=(t,e)=>{if(e.startsWith("{"))try{const r=JSON.parse(e);return r[t]??r.en??e}catch{return m.error(new $("Failed to extract JSON translation from string"),e),e}return e};export{w as A,T as _,S as a,C as b,b as c,y as d,z as e,x as f,F as i,N as u};
|
|
30
|
-
//# sourceMappingURL=localize-
|
|
30
|
+
//# sourceMappingURL=localize-kPkHxPNe.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localize-nH-zlK_j.esm.js","sources":["../../src/shared/css-reset.ts","../../src/shared/defineCustomElement.ts","../../src/shared/fragments/css-variable-map.ts","../../src/shared/controllers/async-controller.ts","../../src/shared/fragments/error-message-template.ts","../../src/shared/fragments/loading-template.ts","../../src/shared/fragments/custom-text.ts","../../src/shared/enforce-config.ts","../../src/shared/localize.ts"],"sourcesContent":["import { css } from \"lit\";\n\n// minireset.css v0.0.7 | MIT License | github.com/jgthms/minireset.css\n// prettier-ignore\nexport const cssReset = css`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}ul{list-style:none}button,input,select{margin:0}html{box-sizing:border-box}*,*::before,*::after{box-sizing:inherit}img,video{/*height:auto;*/max-width:100%}iframe{border:0}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}`;\n","/**\n * Defines a custom element based on its static tagName property\n */\nexport function defineCustomElement(\n CustomElementClass: CustomElementConstructor & { tagName: string },\n tagName = CustomElementClass[\"tagName\"]\n) {\n customElements.get(tagName) || customElements.define(tagName, CustomElementClass);\n}\n","export const _cssVariableMap = (variables: Record<string, string>) => {\n return Object.entries(variables)\n .map(([k, v]) => `${k}: ${v};`)\n .join(\"\\n\");\n};\n","import { ReactiveController, ReactiveControllerHost } from \"lit\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncFunction = (...args: any[]) => Promise<any>;\n\n/**\n * Creates a declarative wrapper around async operations\n * @example\n * class MyElement extends LitElement {\n * private user = new AsyncController(\n * this,\n * async ({ id }) => get(url, { id }));\n *\n * async updated(changedProperties) {\n * if (changedProperties.has(\"userId\")) {\n * await this.user.exec({ id: this.userId })\n * }\n * }\n *\n * render() {\n * const { data, loading, error } = this.user;\n * if (loading) return html`Please wait...`\n * if (error) return html`Error! <button @click=${this.user.retry}>Reload</button>`;\n * return html`My name is: ${data.name}`\n * }\n * }\n */\nexport class AsyncController<TFn extends AsyncFunction> implements ReactiveController {\n public data: Awaited<ReturnType<TFn>> | null = null;\n public loading = false;\n public error: Error | null = null;\n\n private readonly host: ReactiveControllerHost;\n private readonly asyncFn: TFn;\n private lastArgs?: Parameters<TFn>;\n\n constructor(host: ReactiveControllerHost, asyncFn: TFn) {\n (this.host = host).addController(this);\n this.asyncFn = asyncFn;\n }\n\n public async exec(...args: Parameters<TFn>): Promise<ReturnType<TFn> | null> {\n this.lastArgs = args;\n this.loading = true;\n this.host.requestUpdate();\n try {\n // TODO: prevent race condition if later invocation returns before earlier\n this.data = await this.asyncFn(...args);\n this.error = null;\n } catch (err) {\n if (err instanceof Error) {\n this.error = err;\n this.data = null;\n }\n }\n this.loading = false;\n this.host.requestUpdate();\n return this.data;\n }\n\n public async retry() {\n return this.exec(...((this.lastArgs || []) as Parameters<TFn>));\n }\n\n hostDisconnected() {\n // TODO: cancel API calls\n }\n}\n","import { html } from \"lit\";\nimport { MissingConfig, NetworkError } from \"../beam-errors\";\n\nconst strings = {\n errorTitle: `Beam encountered an error. Please try again.`,\n retry: `Retry`,\n};\n\nexport const _errorMessage = ({ error, retry }: { error: Error; retry?: (...args: never) => void }) => {\n let details = html``;\n if (error instanceof NetworkError) {\n const response = JSON.stringify(\n {\n status: error.response.status,\n statusText: error.response.statusText,\n url: error.response.url,\n body: error.body,\n },\n null,\n 4\n );\n details = html`\n <p><b>Network Response:</b></p>\n <p>${response}</p>\n `;\n }\n if (error instanceof MissingConfig) {\n details = html`\n <p><b>Missing Required Config Options:</b></p>\n <p>${error.missingConfigKeyNames.join(\", \")}</p>\n `;\n }\n return html`<div class=\"beam-error\" style=\"text-align: left\">\n <p>${strings.errorTitle} ${retry ? html` <button type=\"reset\" @click=\"${retry}\">${strings.retry}</button>` : \"\"}</p>\n <br />\n <details>\n <div style=\"white-space: pre-wrap; font-family: monospace; line-height: 1;\">\n ${details}\n <p><b>Message:</b> ${error.message || html`<i>None</i>`}</p>\n <p><b>Stack:</b> ${error.stack}</p>\n </div>\n </details>\n <br />\n <p>Help: <a href=\"https://www.beamimpact.com\">www.beamimpact.com</a></p>\n </div>`;\n};\n","import { html } from \"lit\";\n\nconst strings = {\n loading: \"\", // Default is no loading content\n};\n\nexport const _loading = () => {\n return html`<p class=\"beam-loading\">${strings.loading}</p>`;\n};\n","import { CSSResult, unsafeCSS } from \"lit\";\n\n/**\n * Create an object that can be passed to cssVariableMap\n * to define CSS variables in a style tag. The default properties\n * are the ones exposed for customization in the remote config interface.\n * @example\n * const variables = {\n * ...customizableTextJs(\"widget-header\",\n * \"widget-border-color\": \"red\"\n * };\n *\n * html`<style>:host { ${_cssVariableMap(variables)} }</style>`;\n * @returns {{[p: string]: string}}\n */\nexport const defineCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n [`${prefix}-fontFamily`]: fontFamily,\n [`${prefix}-fontStyle`]: fontStyle,\n [`${prefix}-fontSize`]: fontSize,\n [`${prefix}-fontWeight`]: fontWeight,\n [`${prefix}-textTransform`]: textTransform,\n [`${prefix}-marginTop`]: marginTop,\n [`${prefix}-lineHeight`]: lineHeight,\n [`${prefix}-color`]: color,\n };\n};\n\n/**\n * Returns a string that defines css properties based on variables,\n * which can be used in a css`` template. The default properties are the\n * ones exposed for customization in the remote config interface.\n * @example\n * css`.widget-header { ${customizableTextCss(\"widget-header\")} border: none; }`\n * @returns {CSSResult}\n */\nexport const useCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n } = {}\n): CSSResult => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return unsafeCSS(`\\\n font-family: var(${prefix}-fontFamily, ${fontFamily});\n font-style: var(${prefix}-fontStyle, ${fontStyle});\n font-size: var(${prefix}-fontSize, ${fontSize});\n font-weight: var(${prefix}-fontWeight, ${fontWeight});\n text-transform: var(${prefix}-textTransform, ${textTransform});\n margin-top: var(${prefix}-marginTop, ${marginTop});\n line-height: var(${prefix}-lineHeight, ${lineHeight});\n color: var(${prefix}-color, ${color});\n `);\n};\n\n/**\n * Same as useCustomText except returns an object that can be passed to styleMap\n */\nexport const useCustomTextMap = (\n namespace = \"\",\n {\n fontSize = \"inherit\",\n fontStyle = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n fontSize: `var(${prefix}-fontSize, ${fontSize})`,\n fontStyle: `var(${prefix}-fontStyle, ${fontStyle})`,\n fontWeight: `var(${prefix}-fontWeight, ${fontWeight})`,\n textTransform: `var(${prefix}-textTransform, ${textTransform})`,\n marginTop: `var(${prefix}-marginTop, ${marginTop})`,\n lineHeight: `var(${prefix}-lineHeight, ${lineHeight})`,\n };\n};\n","import { MissingConfig } from \"./beam-errors\";\nimport { logger } from \"./logger\";\n\nexport function enforceConfig<T>(keys: (keyof T)[], input: unknown): input is Required<T> {\n const missingKeys: string[] = [];\n const check = input as Record<string | number | symbol, unknown>;\n for (const key of keys) {\n if (check[key] == null) {\n missingKeys.push(key as string);\n }\n }\n if (missingKeys.length > 0) {\n logger.error(\"Beam Impact - Missing Required Config Values:\\n\", missingKeys.join(\", \"), input);\n throw new MissingConfig(missingKeys);\n }\n return true;\n}\n","import { LANGUAGES } from \"../api-sdk/types\";\nimport { logger } from \"./logger\";\nimport { BeamError } from \"./beam-errors\";\n\n/**\n * User-provided strings may include embedded translations in JSON form\n * This function extracts the string for the provided language\n * If it fails to parse, or the string is not json-like, it returns the whole string\n * TODO: consider returning unsafeHtml() or adding an option for it\n */\nconst localizeUserString = (lang: LANGUAGES, str: string): string => {\n const isJson = str.startsWith(\"{\");\n if (isJson) {\n try {\n const json = JSON.parse(str);\n return json[lang] ?? json[\"en\"] ?? str;\n } catch (err) {\n logger.error(new BeamError(\"Failed to extract JSON translation from string\"), str);\n return str;\n }\n }\n return str;\n};\n\nexport { localizeUserString };\n"],"names":["cssReset","css","defineCustomElement","CustomElementClass","tagName","_cssVariableMap","variables","k","v","AsyncController","host","asyncFn","args","err","strings","_errorMessage","error","retry","details","html","NetworkError","response","MissingConfig","_loading","defineCustomText","namespace","fontFamily","fontStyle","fontSize","fontWeight","textTransform","marginTop","lineHeight","color","prefix","useCustomText","unsafeCSS","enforceConfig","keys","input","missingKeys","check","key","logger","localizeUserString","lang","str","json","BeamError"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"localize-kPkHxPNe.esm.js","sources":["../../src/shared/css-reset.ts","../../src/shared/defineCustomElement.ts","../../src/shared/fragments/css-variable-map.ts","../../src/shared/controllers/async-controller.ts","../../src/shared/fragments/error-message-template.ts","../../src/shared/fragments/loading-template.ts","../../src/shared/fragments/custom-text.ts","../../src/shared/enforce-config.ts","../../src/shared/localize.ts"],"sourcesContent":["import { css } from \"lit\";\n\n// minireset.css v0.0.7 | MIT License | github.com/jgthms/minireset.css\n// prettier-ignore\nexport const cssReset = css`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}ul{list-style:none}button,input,select{margin:0}html{box-sizing:border-box}*,*::before,*::after{box-sizing:inherit}img,video{/*height:auto;*/max-width:100%}iframe{border:0}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}`;\n","/**\n * Defines a custom element based on its static tagName property\n */\nexport function defineCustomElement(\n CustomElementClass: CustomElementConstructor & { tagName: string },\n tagName = CustomElementClass[\"tagName\"]\n) {\n customElements.get(tagName) || customElements.define(tagName, CustomElementClass);\n}\n","export const _cssVariableMap = (variables: Record<string, string>) => {\n return Object.entries(variables)\n .map(([k, v]) => `${k}: ${v};`)\n .join(\"\\n\");\n};\n","import { ReactiveController, ReactiveControllerHost } from \"lit\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncFunction = (...args: any[]) => Promise<any>;\n\n/**\n * Creates a declarative wrapper around async operations\n * @example\n * class MyElement extends LitElement {\n * private user = new AsyncController(\n * this,\n * async ({ id }) => get(url, { id }));\n *\n * async updated(changedProperties) {\n * if (changedProperties.has(\"userId\")) {\n * await this.user.exec({ id: this.userId })\n * }\n * }\n *\n * render() {\n * const { data, loading, error } = this.user;\n * if (loading) return html`Please wait...`\n * if (error) return html`Error! <button @click=${this.user.retry}>Reload</button>`;\n * return html`My name is: ${data.name}`\n * }\n * }\n */\nexport class AsyncController<TFn extends AsyncFunction> implements ReactiveController {\n public data: Awaited<ReturnType<TFn>> | null = null;\n public loading = false;\n public error: Error | null = null;\n\n private readonly host: ReactiveControllerHost;\n private readonly asyncFn: TFn;\n private lastArgs?: Parameters<TFn>;\n\n constructor(host: ReactiveControllerHost, asyncFn: TFn) {\n (this.host = host).addController(this);\n this.asyncFn = asyncFn;\n }\n\n public async exec(...args: Parameters<TFn>): Promise<ReturnType<TFn> | null> {\n this.lastArgs = args;\n this.loading = true;\n this.host.requestUpdate();\n try {\n // TODO: prevent race condition if later invocation returns before earlier\n this.data = await this.asyncFn(...args);\n this.error = null;\n } catch (err) {\n if (err instanceof Error) {\n this.error = err;\n this.data = null;\n }\n }\n this.loading = false;\n this.host.requestUpdate();\n return this.data;\n }\n\n public async retry() {\n return this.exec(...((this.lastArgs || []) as Parameters<TFn>));\n }\n\n hostDisconnected() {\n // TODO: cancel API calls\n }\n}\n","import { html } from \"lit\";\nimport { MissingConfig, NetworkError } from \"../beam-errors\";\n\nconst strings = {\n errorTitle: `Beam encountered an error. Please try again.`,\n retry: `Retry`,\n};\n\nexport const _errorMessage = ({ error, retry }: { error: Error; retry?: (...args: never) => void }) => {\n let details = html``;\n if (error instanceof NetworkError) {\n const response = JSON.stringify(\n {\n status: error.response.status,\n statusText: error.response.statusText,\n url: error.response.url,\n body: error.body,\n },\n null,\n 4\n );\n details = html`\n <p><b>Network Response:</b></p>\n <p>${response}</p>\n `;\n }\n if (error instanceof MissingConfig) {\n details = html`\n <p><b>Missing Required Config Options:</b></p>\n <p>${error.missingConfigKeyNames.join(\", \")}</p>\n `;\n }\n return html`<div class=\"beam-error\" style=\"text-align: left\">\n <p>${strings.errorTitle} ${retry ? html` <button type=\"reset\" @click=\"${retry}\">${strings.retry}</button>` : \"\"}</p>\n <br />\n <details>\n <div style=\"white-space: pre-wrap; font-family: monospace; line-height: 1;\">\n ${details}\n <p><b>Message:</b> ${error.message || html`<i>None</i>`}</p>\n <p><b>Stack:</b> ${error.stack}</p>\n </div>\n </details>\n <br />\n <p>Help: <a href=\"https://www.beamimpact.com\">www.beamimpact.com</a></p>\n </div>`;\n};\n","import { html } from \"lit\";\n\nconst strings = {\n loading: \"\", // Default is no loading content\n};\n\nexport const _loading = () => {\n return html`<p class=\"beam-loading\">${strings.loading}</p>`;\n};\n","import { CSSResult, unsafeCSS } from \"lit\";\n\n/**\n * Create an object that can be passed to cssVariableMap\n * to define CSS variables in a style tag. The default properties\n * are the ones exposed for customization in the remote config interface.\n * @example\n * const variables = {\n * ...customizableTextJs(\"widget-header\",\n * \"widget-border-color\": \"red\"\n * };\n *\n * html`<style>:host { ${_cssVariableMap(variables)} }</style>`;\n * @returns {{[p: string]: string}}\n */\nexport const defineCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n [`${prefix}-fontFamily`]: fontFamily,\n [`${prefix}-fontStyle`]: fontStyle,\n [`${prefix}-fontSize`]: fontSize,\n [`${prefix}-fontWeight`]: fontWeight,\n [`${prefix}-textTransform`]: textTransform,\n [`${prefix}-marginTop`]: marginTop,\n [`${prefix}-lineHeight`]: lineHeight,\n [`${prefix}-color`]: color,\n };\n};\n\n/**\n * Returns a string that defines css properties based on variables,\n * which can be used in a css`` template. The default properties are the\n * ones exposed for customization in the remote config interface.\n * @example\n * css`.widget-header { ${customizableTextCss(\"widget-header\")} border: none; }`\n * @returns {CSSResult}\n */\nexport const useCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n } = {}\n): CSSResult => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return unsafeCSS(`\\\n font-family: var(${prefix}-fontFamily, ${fontFamily});\n font-style: var(${prefix}-fontStyle, ${fontStyle});\n font-size: var(${prefix}-fontSize, ${fontSize});\n font-weight: var(${prefix}-fontWeight, ${fontWeight});\n text-transform: var(${prefix}-textTransform, ${textTransform});\n margin-top: var(${prefix}-marginTop, ${marginTop});\n line-height: var(${prefix}-lineHeight, ${lineHeight});\n color: var(${prefix}-color, ${color});\n `);\n};\n\n/**\n * Same as useCustomText except returns an object that can be passed to styleMap\n */\nexport const useCustomTextMap = (\n namespace = \"\",\n {\n fontSize = \"inherit\",\n fontStyle = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n fontSize: `var(${prefix}-fontSize, ${fontSize})`,\n fontStyle: `var(${prefix}-fontStyle, ${fontStyle})`,\n fontWeight: `var(${prefix}-fontWeight, ${fontWeight})`,\n textTransform: `var(${prefix}-textTransform, ${textTransform})`,\n marginTop: `var(${prefix}-marginTop, ${marginTop})`,\n lineHeight: `var(${prefix}-lineHeight, ${lineHeight})`,\n };\n};\n","import { MissingConfig } from \"./beam-errors\";\nimport { logger } from \"./logger\";\n\nexport function enforceConfig<T>(keys: (keyof T)[], input: unknown): input is Required<T> {\n const missingKeys: string[] = [];\n const check = input as Record<string | number | symbol, unknown>;\n for (const key of keys) {\n if (check[key] == null) {\n missingKeys.push(key as string);\n }\n }\n if (missingKeys.length > 0) {\n logger.error(\"Beam Impact - Missing Required Config Values:\\n\", missingKeys.join(\", \"), input);\n throw new MissingConfig(missingKeys);\n }\n return true;\n}\n","import { LANGUAGES } from \"../api-sdk/types\";\nimport { logger } from \"./logger\";\nimport { BeamError } from \"./beam-errors\";\n\n/**\n * User-provided strings may include embedded translations in JSON form\n * This function extracts the string for the provided language\n * If it fails to parse, or the string is not json-like, it returns the whole string\n * TODO: consider returning unsafeHtml() or adding an option for it\n */\nconst localizeUserString = (lang: LANGUAGES, str: string): string => {\n const isJson = str.startsWith(\"{\");\n if (isJson) {\n try {\n const json = JSON.parse(str);\n return json[lang] ?? json[\"en\"] ?? str;\n } catch (err) {\n logger.error(new BeamError(\"Failed to extract JSON translation from string\"), str);\n return str;\n }\n }\n return str;\n};\n\nexport { localizeUserString };\n"],"names":["cssReset","css","defineCustomElement","CustomElementClass","tagName","_cssVariableMap","variables","k","v","AsyncController","host","asyncFn","args","err","strings","_errorMessage","error","retry","details","html","NetworkError","response","MissingConfig","_loading","defineCustomText","namespace","fontFamily","fontStyle","fontSize","fontWeight","textTransform","marginTop","lineHeight","color","prefix","useCustomText","unsafeCSS","enforceConfig","keys","input","missingKeys","check","key","logger","localizeUserString","lang","str","json","BeamError"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{B as l}from"./beam-errors-
|
|
2
|
-
//# sourceMappingURL=network-listeners-
|
|
1
|
+
import{B as l}from"./beam-errors-AMvTvR1C.esm.js";import{f as u}from"./events-wNy5BoJV.esm.js";function h(t,{timeout:o=1e4}={}){return new Promise((e,r)=>{let n=document.querySelector(t);if(n){e(n);return}let s;const d=setTimeout(()=>{n||(s?.disconnect(),r(new l(`Timed out waiting for '${t}'`)))},o);new MutationObserver((L,c)=>{s=c,Array.from(document.querySelectorAll(t)).forEach(i=>{n=i,e(i),c.disconnect(),clearTimeout(d)})}).observe(document.documentElement,{childList:!0,subtree:!0})})}const f=window.fetch,p={apply:function(t,o,e){return t(...e).then(r=>{if(r.ok){const n=r.clone();window.dispatchEvent(new u({url:e[0].toString(),method:(e[1]?.method||"get").toLowerCase(),type:"fetch",response:n}))}return r})}},w=new Proxy(f,p),y=XMLHttpRequest,x={construct(t,o){const e=new t(...o);return e.addEventListener("load",()=>{window.dispatchEvent(new u({url:(o[1]||"").toString(),method:(o[0]||"get").toLowerCase(),type:"xhr",xhr:e}))}),e}},a=new Proxy(y,x);let m=!1;const E=()=>{m||(window.fetch=w,XMLHttpRequest=a,m=!0)};export{w as f,E as i,h as w,a as x};
|
|
2
|
+
//# sourceMappingURL=network-listeners-O5LKv8Yy.esm.js.map
|