@beamimpact/web-sdk 1.37.0 → 1.38.0
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 +21 -1
- package/dist/chunks/_share-dialog-dependencies-jvfU8iYk.esm.js +2 -0
- package/dist/chunks/_share-dialog-dependencies-jvfU8iYk.esm.js.map +1 -0
- package/dist/chunks/_share-dialog-dependencies-nBHy1n7P.esm.js +2 -0
- package/dist/chunks/_share-dialog-dependencies-nBHy1n7P.esm.js.map +1 -0
- package/dist/chunks/{cart-contents-Cdq4ob0J.esm.d.ts → cart-contents-dKdDg09p.esm.d.ts} +1 -1
- package/dist/chunks/{css-card-grid-3b56QBzq.esm.js → css-card-grid-inRnKSWs.esm.js} +2 -2
- package/dist/chunks/{css-card-grid-3b56QBzq.esm.js.map → css-card-grid-inRnKSWs.esm.js.map} +1 -1
- package/dist/chunks/{enforce-config-qna7hEL6.esm.js → enforce-config-7R9KCF_i.esm.js} +2 -2
- package/dist/chunks/{enforce-config-qna7hEL6.esm.js.map → enforce-config-7R9KCF_i.esm.js.map} +1 -1
- package/dist/chunks/{enforce-config-fo8kIfoY.esm.js → enforce-config-iFdf1QkH.esm.js} +2 -2
- package/dist/chunks/{enforce-config-fo8kIfoY.esm.js.map → enforce-config-iFdf1QkH.esm.js.map} +1 -1
- package/dist/chunks/events-Y8fYvSqM.esm.js +2 -0
- package/dist/chunks/{events-5IECSF-x.esm.js.map → events-Y8fYvSqM.esm.js.map} +1 -1
- package/dist/chunks/{events-3-Mzl-dS.esm.d.ts → events-zF9NDtBD.esm.d.ts} +18 -3
- package/dist/chunks/{index-9YcaEQju.esm.js → index-6iInzwnG.esm.js} +2 -2
- package/dist/chunks/{index-9YcaEQju.esm.js.map → index-6iInzwnG.esm.js.map} +1 -1
- package/dist/chunks/{index-9gijHGwh.esm.js → index-8yrr7ZZv.esm.js} +2 -2
- package/dist/chunks/index-8yrr7ZZv.esm.js.map +1 -0
- package/dist/chunks/{index-jYAdXbGg.esm.js → index-ARSbllRj.esm.js} +2 -2
- package/dist/chunks/{index-jYAdXbGg.esm.js.map → index-ARSbllRj.esm.js.map} +1 -1
- package/dist/chunks/{index-SZxnIRAX.esm.d.ts → index-EjqeU7Mu.esm.d.ts} +1 -1
- package/dist/chunks/index-K0KGNP8F.esm.js +2 -0
- package/dist/chunks/index-K0KGNP8F.esm.js.map +1 -0
- package/dist/chunks/{index-OnjTwvAw.esm.js → index-Lw32NXij.esm.js} +2 -2
- package/dist/chunks/index-Lw32NXij.esm.js.map +1 -0
- package/dist/chunks/index-QEOW1H_N.esm.js +2 -0
- package/dist/chunks/index-QEOW1H_N.esm.js.map +1 -0
- package/dist/chunks/{index-xRjeUrl2.esm.d.ts → index-Tnwxn22c.esm.d.ts} +4 -4
- package/dist/chunks/index-WBPyA_Km.esm.js +2 -0
- package/dist/chunks/index-WBPyA_Km.esm.js.map +1 -0
- package/dist/chunks/{index-KErjmUlF.esm.js → index-XCQ48s5g.esm.js} +2 -2
- package/dist/chunks/{index-KErjmUlF.esm.js.map → index-XCQ48s5g.esm.js.map} +1 -1
- package/dist/chunks/index-bhC9kqpF.esm.js +2 -0
- package/dist/chunks/index-bhC9kqpF.esm.js.map +1 -0
- package/dist/chunks/{index-AhT9jBIr.esm.d.ts → index-cRyQ6D5G.esm.d.ts} +1 -1
- package/dist/chunks/{index-7-XLaXA4.esm.d.ts → index-dDBsHD_s.esm.d.ts} +1 -1
- package/dist/chunks/{index-b3DeBLwb.esm.d.ts → index-iYxrQMxt.esm.d.ts} +1 -1
- package/dist/chunks/{index-Z1UUeVXR.esm.js → index-l7Ao8g5B.esm.js} +2 -2
- package/dist/chunks/{index-Z1UUeVXR.esm.js.map → index-l7Ao8g5B.esm.js.map} +1 -1
- package/dist/chunks/index-nOkYjc29.esm.js +2 -0
- package/dist/chunks/index-nOkYjc29.esm.js.map +1 -0
- package/dist/chunks/{index-U8Oy2aur.esm.js → index-phDmC-TS.esm.js} +2 -2
- package/dist/chunks/index-phDmC-TS.esm.js.map +1 -0
- package/dist/chunks/{index-9Cs92uGK.esm.d.ts → index-tqTROh5B.esm.d.ts} +1 -1
- package/dist/chunks/{index-wsdeaTHd.esm.js → index-uF-Qtewb.esm.js} +2 -2
- package/dist/chunks/index-uF-Qtewb.esm.js.map +1 -0
- package/dist/chunks/index-ygp7mxoE.esm.js +2 -0
- package/dist/chunks/index-ygp7mxoE.esm.js.map +1 -0
- package/dist/chunks/{lit-yVXn5Cbs.esm.js → lit-HCWbxxT7.esm.js} +4 -4
- package/dist/chunks/{lit-yVXn5Cbs.esm.js.map → lit-HCWbxxT7.esm.js.map} +1 -1
- package/dist/chunks/{localize-pzAAkBvG.esm.js → localize-ZHtlNltZ.esm.js} +2 -2
- package/dist/chunks/{localize-pzAAkBvG.esm.js.map → localize-ZHtlNltZ.esm.js.map} +1 -1
- package/dist/chunks/{localize-GCkVUD8S.esm.js → localize-jRg7W6Ul.esm.js} +2 -2
- package/dist/chunks/{localize-GCkVUD8S.esm.js.map → localize-jRg7W6Ul.esm.js.map} +1 -1
- package/dist/chunks/{openapi-spec-WpREPNjl.esm.d.ts → openapi-spec-fxMWpEwU.esm.d.ts} +266 -21
- package/dist/chunks/{order-page-eOCpZ8vN.esm.d.ts → order-page-AezeN9KY.esm.d.ts} +3 -4
- package/dist/chunks/order-page-QUOh_9GG.esm.js +2 -0
- package/dist/chunks/order-page-QUOh_9GG.esm.js.map +1 -0
- package/dist/chunks/order-page-vbiHdNMi.esm.js +2 -0
- package/dist/chunks/order-page-vbiHdNMi.esm.js.map +1 -0
- package/dist/chunks/{progress-bar-7gWYaGlq.esm.js → progress-bar-9vfd2JYm.esm.js} +2 -2
- package/dist/chunks/{progress-bar-7gWYaGlq.esm.js.map → progress-bar-9vfd2JYm.esm.js.map} +1 -1
- package/dist/chunks/promo-pill-label-3bA1z-la.esm.d.ts +19 -0
- package/dist/chunks/promo-pill-label-vCWNyiaj.esm.js +13 -0
- package/dist/chunks/promo-pill-label-vCWNyiaj.esm.js.map +1 -0
- package/dist/chunks/{responsive-LYEag6TI.esm.js → responsive-Bzkkpj11.esm.js} +2 -2
- package/dist/chunks/{responsive-LYEag6TI.esm.js.map → responsive-Bzkkpj11.esm.js.map} +1 -1
- package/dist/chunks/routes--kzWvkeF.esm.js +2 -0
- package/dist/chunks/routes--kzWvkeF.esm.js.map +1 -0
- package/dist/chunks/routes-ga8DTuUO.esm.js +2 -0
- package/dist/chunks/routes-ga8DTuUO.esm.js.map +1 -0
- package/dist/chunks/{update-cart-D4jDrYC0.esm.d.ts → update-cart-43LEXveI.esm.d.ts} +1 -1
- package/dist/chunks/{update-cart-_cCsAqH9.esm.js → update-cart-5I7FDxvc.esm.js} +2 -2
- package/dist/chunks/{update-cart-_cCsAqH9.esm.js.map → update-cart-5I7FDxvc.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-8nDxTnnQ.esm.js → update-cart-Z287MVqH.esm.js} +2 -2
- package/dist/chunks/{update-cart-8nDxTnnQ.esm.js.map → update-cart-Z287MVqH.esm.js.map} +1 -1
- package/dist/chunks/{vendor-eeJfrOkP.esm.js → vendor-h5FNKy-G.esm.js} +124 -25
- package/dist/chunks/vendor-h5FNKy-G.esm.js.map +1 -0
- package/dist/components/beam-partner-logos.esm.js +1 -1
- package/dist/components/beam-partner-logos.js +1 -1
- package/dist/components/community-impact.esm.js +1 -1
- package/dist/components/community-impact.js +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 +12 -0
- 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 +3 -2
- package/dist/components/post-purchase.esm.js +2 -1
- package/dist/components/post-purchase.esm.js.map +1 -1
- package/dist/components/post-purchase.js +2 -1
- package/dist/components/post-purchase.js.map +1 -1
- package/dist/components/redeem-transaction.d.ts +4 -2
- package/dist/components/redeem-transaction.esm.js +60 -38
- package/dist/components/redeem-transaction.esm.js.map +1 -1
- package/dist/components/redeem-transaction.js +60 -38
- package/dist/components/redeem-transaction.js.map +1 -1
- package/dist/components/select-nonprofit.d.ts +13 -2
- package/dist/components/select-nonprofit.esm.js +73 -30
- package/dist/components/select-nonprofit.esm.js.map +1 -1
- package/dist/components/select-nonprofit.js +73 -30
- 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/components/subscription-management.d.ts +13 -2
- package/dist/components/subscription-management.esm.js +1 -1
- package/dist/components/subscription-management.js +1 -1
- package/dist/index.d.ts +12 -11
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/beam.esm.js +1 -1
- package/dist/integrations/beam.js +1 -1
- package/dist/integrations/cart.d.ts +3 -3
- package/dist/integrations/cart.esm.js +1 -1
- package/dist/integrations/cart.js +1 -1
- package/dist/integrations/index.d.ts +10 -9
- package/dist/integrations/index.esm.js +1 -1
- package/dist/integrations/index.js +1 -1
- package/dist/integrations/logs.d.ts +2 -2
- package/dist/integrations/logs.esm.js +1 -1
- package/dist/integrations/logs.js +1 -1
- package/dist/integrations/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.esm.js +1 -1
- package/dist/integrations/statsig.js +1 -1
- package/dist/integrations/utils.d.ts +3 -3
- package/dist/integrations/utils.esm.js +1 -1
- package/dist/integrations/utils.js +1 -1
- package/dist/react/beam-partner-logos.esm.js +1 -1
- package/dist/react/beam-partner-logos.js +1 -1
- package/dist/react/community-impact.esm.js +1 -1
- package/dist/react/community-impact.js +1 -1
- package/dist/react/cumulative-impact.esm.js +1 -1
- package/dist/react/cumulative-impact.js +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 +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/dist/react/subscription-management.d.ts +2 -2
- package/dist/react/subscription-management.esm.js +1 -1
- package/dist/react/subscription-management.js +1 -1
- package/dist/utils/events.d.ts +3 -3
- package/dist/utils/events.esm.js +1 -1
- package/dist/utils/events.js +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/network-listeners.esm.js +1 -1
- package/dist/utils/network-listeners.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/_share-dialog-dependencies-Ex1exJdU.esm.js +0 -2
- package/dist/chunks/_share-dialog-dependencies-Ex1exJdU.esm.js.map +0 -1
- package/dist/chunks/_share-dialog-dependencies-GOqKRBIc.esm.js +0 -2
- package/dist/chunks/_share-dialog-dependencies-GOqKRBIc.esm.js.map +0 -1
- package/dist/chunks/events-5IECSF-x.esm.js +0 -2
- package/dist/chunks/index-5AkzIYu3.esm.js +0 -2
- package/dist/chunks/index-5AkzIYu3.esm.js.map +0 -1
- package/dist/chunks/index-8VxiCO_y.esm.js +0 -2
- package/dist/chunks/index-8VxiCO_y.esm.js.map +0 -1
- package/dist/chunks/index-9gijHGwh.esm.js.map +0 -1
- package/dist/chunks/index-OnjTwvAw.esm.js.map +0 -1
- package/dist/chunks/index-U8Oy2aur.esm.js.map +0 -1
- package/dist/chunks/index-a9SRo_pt.esm.js +0 -2
- package/dist/chunks/index-a9SRo_pt.esm.js.map +0 -1
- package/dist/chunks/index-fdm0Zxu6.esm.js +0 -2
- package/dist/chunks/index-fdm0Zxu6.esm.js.map +0 -1
- package/dist/chunks/index-gfShfkGQ.esm.js +0 -2
- package/dist/chunks/index-gfShfkGQ.esm.js.map +0 -1
- package/dist/chunks/index-wsdeaTHd.esm.js.map +0 -1
- package/dist/chunks/index-yEHTVDWu.esm.js +0 -2
- package/dist/chunks/index-yEHTVDWu.esm.js.map +0 -1
- package/dist/chunks/order-page-ZyVxKalS.esm.js +0 -2
- package/dist/chunks/order-page-ZyVxKalS.esm.js.map +0 -1
- package/dist/chunks/order-page-nKOujF0G.esm.js +0 -2
- package/dist/chunks/order-page-nKOujF0G.esm.js.map +0 -1
- package/dist/chunks/routes-S3ZS-od_.esm.js +0 -2
- package/dist/chunks/routes-S3ZS-od_.esm.js.map +0 -1
- package/dist/chunks/routes-jQjZhNH9.esm.js +0 -2
- package/dist/chunks/routes-jQjZhNH9.esm.js.map +0 -1
- package/dist/chunks/vendor-eeJfrOkP.esm.js.map +0 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Beam takes care of all the nonprofit management and compliance, impact tracking,
|
|
|
42
42
|
|
|
43
43
|
<br />
|
|
44
44
|
|
|
45
|
-
<img src="https://production-beam-widgets.beamimpact.com/assets/img/screenshots/beam-select-nonprofit.png"
|
|
45
|
+
<img src="https://production-beam-widgets.beamimpact.com/assets/img/screenshots/beam-select-nonprofit.png"
|
|
46
46
|
alt="Screenshot of Beam widget" />
|
|
47
47
|
|
|
48
48
|
The Beam Web SDK provides a set of web components and framework-specific wrappers for
|
|
@@ -218,6 +218,26 @@ document.addEventListener("beamnonprofitselect", (evt) => {
|
|
|
218
218
|
});
|
|
219
219
|
```
|
|
220
220
|
|
|
221
|
+
#### **Event Types**
|
|
222
|
+
|
|
223
|
+
**Select Nonprofit Widget & Post Purchase Widget**
|
|
224
|
+
|
|
225
|
+
- **Event:** `beamnonprofitselect`
|
|
226
|
+
- **Description:** Emitted when the end user selects a nonprofit in the Beam widget, and when the previous selection was restored automatically
|
|
227
|
+
|
|
228
|
+
**Select Nonprofit Widget**
|
|
229
|
+
|
|
230
|
+
- **Event:** `beamcartchange`
|
|
231
|
+
- **Description:** Emitted when Beam detects that cart contents have changed, and when items are added to the cart for the first time
|
|
232
|
+
|
|
233
|
+
- **Event:** `beamnonprofitselectionremoved`
|
|
234
|
+
- **Description:** Emitted when the nonprofit selection is removed from deselection or due to nonprofit cohort change
|
|
235
|
+
|
|
236
|
+
**Post Purchase Widget**
|
|
237
|
+
|
|
238
|
+
- **Event:** `beamordercreated`
|
|
239
|
+
- **Description:** Emitted when an order is registered with Beam for the first time, but NOT on repeat visits, page refreshes, etc.
|
|
240
|
+
|
|
221
241
|
### beam-post-purchase
|
|
222
242
|
|
|
223
243
|
A wrapper component that registers transactions and renders either the `beam-impact-overview` or
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./vendor-h5FNKy-G.esm.js";import"../components/impact-overview.esm.js";import"./lit-HCWbxxT7.esm.js";import"./lodash-P8OIs-at.esm.js";import"./routes-ga8DTuUO.esm.js";import"./beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"./progress-bar-9vfd2JYm.esm.js";import"./enforce-config-7R9KCF_i.esm.js";import"./localize-jRg7W6Ul.esm.js";import"./is-all-html-elements-SdSkxirh.esm.js";import"../components/beam-partner-logos.esm.js";import"./responsive-Bzkkpj11.esm.js";
|
|
2
|
+
//# sourceMappingURL=_share-dialog-dependencies-jvfU8iYk.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_share-dialog-dependencies-jvfU8iYk.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./vendor-h5FNKy-G.esm.js";import"../components/impact-overview.js";import"./lit-HCWbxxT7.esm.js";import"./lodash-P8OIs-at.esm.js";import"./routes--kzWvkeF.esm.js";import"./beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"./progress-bar-9vfd2JYm.esm.js";import"./enforce-config-iFdf1QkH.esm.js";import"./localize-ZHtlNltZ.esm.js";import"./is-all-html-elements-SdSkxirh.esm.js";import"../components/beam-partner-logos.js";import"./responsive-Bzkkpj11.esm.js";
|
|
2
|
+
//# sourceMappingURL=_share-dialog-dependencies-nBHy1n7P.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_share-dialog-dependencies-nBHy1n7P.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as paths } from './openapi-spec-
|
|
1
|
+
import { p as paths } from './openapi-spec-fxMWpEwU.esm.js';
|
|
2
2
|
|
|
3
3
|
type TCartApi = paths["/chain/findEligibleNonprofitsForCart"]["post"]["requestBody"]["content"]["application/json"]["cart"];
|
|
4
4
|
type TCart = TCartApi & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as g,j as a}from"./lit-
|
|
1
|
+
import{f as g,j as a}from"./lit-HCWbxxT7.esm.js";const o=({className:i="cardGrid",gap:t="30px",columnCount:r=2,itemMinWidth:d="300px"}={})=>g`
|
|
2
2
|
.${a(i)} {
|
|
3
3
|
--grid-layout-gap: ${a(t)};
|
|
4
4
|
--grid-column-count: ${a(r)};
|
|
@@ -17,4 +17,4 @@ import{f as g,j as a}from"./lit-yVXn5Cbs.esm.js";const o=({className:i="cardGrid
|
|
|
17
17
|
grid-auto-rows: 1fr; /* make all the rows the same height */
|
|
18
18
|
}
|
|
19
19
|
`;export{o as c};
|
|
20
|
-
//# sourceMappingURL=css-card-grid-
|
|
20
|
+
//# sourceMappingURL=css-card-grid-inRnKSWs.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-card-grid-
|
|
1
|
+
{"version":3,"file":"css-card-grid-inRnKSWs.esm.js","sources":["../../src/shared/fragments/css-card-grid.ts"],"sourcesContent":["import { css, unsafeCSS } from \"lit\";\n\nexport const cssCardGrid = ({\n className = \"cardGrid\",\n gap = \"30px\",\n columnCount = 2,\n itemMinWidth = \"300px\",\n}: { className?: string; gap?: string; columnCount?: number | string; itemMinWidth?: string } = {}) => css`\n .${unsafeCSS(className)} {\n --grid-layout-gap: ${unsafeCSS(gap)};\n --grid-column-count: ${unsafeCSS(columnCount)};\n --grid-item--min-width: ${unsafeCSS(itemMinWidth)};\n\n --gap-count: calc(var(--grid-column-count) - 1);\n --total-gap-width: calc(var(--gap-count) * var(--grid-layout-gap));\n --grid-item--max-width: calc((100% - var(--total-gap-width)) / var(--grid-column-count));\n\n display: grid;\n grid-template-columns: repeat(\n auto-fill,\n minmax(max(var(--grid-item--min-width), var(--grid-item--max-width)), 1fr)\n );\n grid-gap: var(--grid-layout-gap);\n grid-auto-rows: 1fr; /* make all the rows the same height */\n }\n`;\n"],"names":["cssCardGrid","className","gap","columnCount","itemMinWidth","css","unsafeCSS"],"mappings":"iDAEa,MAAAA,EAAc,CAAC,CAC1B,UAAAC,EAAY,WACZ,IAAAC,EAAM,OACN,YAAAC,EAAc,EACd,aAAAC,EAAe,OACjB,EAAgG,CAAOC,IAAAA;AAAAA,KAClGC,EAAUL,CAAS,CAAC;AAAA,yBACAK,EAAUJ,CAAG,CAAC;AAAA,2BACZI,EAAUH,CAAW,CAAC;AAAA,8BACnBG,EAAUF,CAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as l,y as r}from"./lit-
|
|
1
|
+
import{f as l,y as r}from"./lit-HCWbxxT7.esm.js";import{N as c,M as o,I as h}from"./beam-errors-P-Lu07Ce.esm.js";import{logger as d}from"../utils/logger.esm.js";const p=l`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 u(t,e=t.tagName){customElements.get(e)||customElements.define(e,t)}const m=t=>Object.entries(t).map(([e,s])=>`${e}: ${s};`).join(`
|
|
2
2
|
`);class f{constructor(e,s){this.data=null,this.loading=!1,this.error=null,(this.host=e).addController(this),this.asyncFn=s}async exec(...e){this.lastArgs=e,this.loading=!0,this.host.requestUpdate();try{this.data=await this.asyncFn(...e),this.error=null}catch(s){s instanceof Error&&(this.error=s,this.data=null)}return this.loading=!1,this.host.requestUpdate(),this.data}async retry(){return this.exec(...this.lastArgs||[])}hostDisconnected(){}}const a={errorTitle:"Beam encountered an error. Please try again.",retry:"Retry"},g=({error:t,retry:e})=>{let s=r``;if(t instanceof c){const i=JSON.stringify({status:t.response.status,statusText:t.response.statusText,url:t.response.url,body:t.body},null,4);s=r`
|
|
3
3
|
<p><b>Network Response:</b></p>
|
|
4
4
|
<p>${i}</p>
|
|
@@ -19,4 +19,4 @@ import{f as l,y as r}from"./lit-yVXn5Cbs.esm.js";import{N as c,M as o,I as h}fro
|
|
|
19
19
|
<p>Help: <a href="https://www.beamimpact.com">www.beamimpact.com</a></p>
|
|
20
20
|
</div>`};function b(t,e){const s=[],i=e;for(const n of t)i[n]==null&&s.push(n);if(s.length>0)throw d.error(`Beam Impact - Missing Required Config Values:
|
|
21
21
|
`,s.join(", "),e),new o(s);return!0}function y(t,e){return t.every(s=>s in e&&e[s]!=null)}function w(t,e){if(t.every(s=>e[s]!==null&&e[s]!==void 0))throw new h}export{f as A,g as _,m as a,w as b,p as c,u as d,b as e,y as f};
|
|
22
|
-
//# sourceMappingURL=enforce-config-
|
|
22
|
+
//# sourceMappingURL=enforce-config-7R9KCF_i.esm.js.map
|
package/dist/chunks/{enforce-config-qna7hEL6.esm.js.map → enforce-config-7R9KCF_i.esm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enforce-config-
|
|
1
|
+
{"version":3,"file":"enforce-config-7R9KCF_i.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/enforce-config.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 \"../../utils/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 { InvalidAttributeCombinationError, MissingConfig } from \"../utils/beam-errors\";\nimport { logger } from \"../utils/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\nexport function areRequiredKeysDefined<T extends object>(requiredKeys: (keyof T)[], config: T): boolean {\n return requiredKeys.every((key) => key in config && config[key] != null);\n}\n\nexport function checkForInvalidAttributeCombinations<T>(keys: (keyof T)[], config: T): void {\n const InvalidAttributeCombinationsPresent = keys.every((key) => config[key] !== null && config[key] !== undefined);\n if (InvalidAttributeCombinationsPresent) {\n throw new InvalidAttributeCombinationError();\n }\n}\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","enforceConfig","keys","input","missingKeys","check","key","logger","areRequiredKeysDefined","requiredKeys","config","checkForInvalidAttributeCombinations","InvalidAttributeCombinationError"],"mappings":"iKAIO,MAAMA,EAAWC,gaCDjB,SAASC,EACdC,EACAC,EAAUD,EAAmB,QAC7B,CACA,eAAe,IAAIC,CAAO,GAAK,eAAe,OAAOA,EAASD,CAAkB,CAClF,CCRO,MAAME,EAAmBC,GACvB,OAAO,QAAQA,CAAS,EAC5B,IAAI,CAAC,CAACC,EAAGC,CAAC,IAAM,GAAGD,CAAC,KAAKC,CAAC,GAAG,EAC7B,KAAK;AAAA,CAAI,ECwBP,MAAMC,CAAyE,CASpF,YAAYC,EAA8BC,EAAc,CARxD,KAAO,KAAwC,KAC/C,KAAO,QAAU,GACjB,KAAO,MAAsB,MAO1B,KAAK,KAAOD,GAAM,cAAc,IAAI,EACrC,KAAK,QAAUC,CACjB,CAEA,MAAa,QAAQC,EAAwD,CAC3E,KAAK,SAAWA,EAChB,KAAK,QAAU,GACf,KAAK,KAAK,gBACV,GAAI,CAEF,KAAK,KAAO,MAAM,KAAK,QAAQ,GAAGA,CAAI,EACtC,KAAK,MAAQ,IACf,OAASC,EAAK,CACRA,aAAe,QACjB,KAAK,MAAQA,EACb,KAAK,KAAO,KAEhB,CACA,YAAK,QAAU,GACf,KAAK,KAAK,gBACH,KAAK,IACd,CAEA,MAAa,OAAQ,CACnB,OAAO,KAAK,KAAK,GAAK,KAAK,UAAY,CAAuB,CAAA,CAChE,CAEA,kBAAmB,CAGrB,CAAA,CChEA,MAAMC,EAAU,CACd,WAAY,+CACZ,MAAO,OACT,EAEaC,EAAgB,CAAC,CAAE,MAAAC,EAAO,MAAAC,CAAM,IAA0D,CACrG,IAAIC,EAAUC,IACd,GAAIH,aAAiBI,EAAc,CACjC,MAAMC,EAAW,KAAK,UACpB,CACE,OAAQL,EAAM,SAAS,OACvB,WAAYA,EAAM,SAAS,WAC3B,IAAKA,EAAM,SAAS,IACpB,KAAMA,EAAM,IACd,EACA,KACA,CACF,EACAE,EAAUC;AAAAA;AAAAA,WAEHE,CAAQ;AAAA,KAEjB,CACA,OAAIL,aAAiBM,IACnBJ,EAAUC;AAAAA;AAAAA,WAEHH,EAAM,sBAAsB,KAAK,IAAI,CAAC;AAAA,OAGxCG;AAAAA,SACAL,EAAQ,UAAU,IAAIG,EAAQE,kCAAqCF,CAAK,KAAKH,EAAQ,KAAK,YAAc,EAAE;AAAA;AAAA;AAAA;AAAA,UAIzGI,CAAO;AAAA,6BACYF,EAAM,SAAWG,cAAiB;AAAA,2BACpCH,EAAM,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,SAMtC,EC1CO,SAASO,EAAiBC,EAAmBC,EAAsC,CACxF,MAAMC,EAAwB,CAAA,EACxBC,EAAQF,EACd,UAAWG,KAAOJ,EACZG,EAAMC,CAAG,GAAK,MAChBF,EAAY,KAAKE,CAAa,EAGlC,GAAIF,EAAY,OAAS,EACvB,MAAAG,EAAO,MAAM;AAAA,EAAmDH,EAAY,KAAK,IAAI,EAAGD,CAAK,EACvF,IAAIH,EAAcI,CAAW,EAErC,MAAO,EACT,CAEO,SAASI,EAAyCC,EAA2BC,EAAoB,CACtG,OAAOD,EAAa,MAAOH,GAAQA,KAAOI,GAAUA,EAAOJ,CAAG,GAAK,IAAI,CACzE,CAEO,SAASK,EAAwCT,EAAmBQ,EAAiB,CAE1F,GAD4CR,EAAK,MAAOI,GAAQI,EAAOJ,CAAG,IAAM,MAAQI,EAAOJ,CAAG,IAAM,MAAS,EAE/G,MAAM,IAAIM,CAEd"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as l,y as r}from"./lit-
|
|
1
|
+
import{f as l,y as r}from"./lit-HCWbxxT7.esm.js";import{N as c,M as o,I as h}from"./beam-errors-P-Lu07Ce.esm.js";import{logger as d}from"../utils/logger.js";const p=l`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 u(t,e=t.tagName){customElements.get(e)||customElements.define(e,t)}const m=t=>Object.entries(t).map(([e,s])=>`${e}: ${s};`).join(`
|
|
2
2
|
`);class f{constructor(e,s){this.data=null,this.loading=!1,this.error=null,(this.host=e).addController(this),this.asyncFn=s}async exec(...e){this.lastArgs=e,this.loading=!0,this.host.requestUpdate();try{this.data=await this.asyncFn(...e),this.error=null}catch(s){s instanceof Error&&(this.error=s,this.data=null)}return this.loading=!1,this.host.requestUpdate(),this.data}async retry(){return this.exec(...this.lastArgs||[])}hostDisconnected(){}}const a={errorTitle:"Beam encountered an error. Please try again.",retry:"Retry"},g=({error:t,retry:e})=>{let s=r``;if(t instanceof c){const i=JSON.stringify({status:t.response.status,statusText:t.response.statusText,url:t.response.url,body:t.body},null,4);s=r`
|
|
3
3
|
<p><b>Network Response:</b></p>
|
|
4
4
|
<p>${i}</p>
|
|
@@ -19,4 +19,4 @@ import{f as l,y as r}from"./lit-yVXn5Cbs.esm.js";import{N as c,M as o,I as h}fro
|
|
|
19
19
|
<p>Help: <a href="https://www.beamimpact.com">www.beamimpact.com</a></p>
|
|
20
20
|
</div>`};function b(t,e){const s=[],i=e;for(const n of t)i[n]==null&&s.push(n);if(s.length>0)throw d.error(`Beam Impact - Missing Required Config Values:
|
|
21
21
|
`,s.join(", "),e),new o(s);return!0}function y(t,e){return t.every(s=>s in e&&e[s]!=null)}function w(t,e){if(t.every(s=>e[s]!==null&&e[s]!==void 0))throw new h}export{f as A,g as _,m as a,w as b,p as c,u as d,b as e,y as f};
|
|
22
|
-
//# sourceMappingURL=enforce-config-
|
|
22
|
+
//# sourceMappingURL=enforce-config-iFdf1QkH.esm.js.map
|
package/dist/chunks/{enforce-config-fo8kIfoY.esm.js.map → enforce-config-iFdf1QkH.esm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enforce-config-
|
|
1
|
+
{"version":3,"file":"enforce-config-iFdf1QkH.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/enforce-config.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 \"../../utils/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 { InvalidAttributeCombinationError, MissingConfig } from \"../utils/beam-errors\";\nimport { logger } from \"../utils/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\nexport function areRequiredKeysDefined<T extends object>(requiredKeys: (keyof T)[], config: T): boolean {\n return requiredKeys.every((key) => key in config && config[key] != null);\n}\n\nexport function checkForInvalidAttributeCombinations<T>(keys: (keyof T)[], config: T): void {\n const InvalidAttributeCombinationsPresent = keys.every((key) => config[key] !== null && config[key] !== undefined);\n if (InvalidAttributeCombinationsPresent) {\n throw new InvalidAttributeCombinationError();\n }\n}\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","enforceConfig","keys","input","missingKeys","check","key","logger","areRequiredKeysDefined","requiredKeys","config","checkForInvalidAttributeCombinations","InvalidAttributeCombinationError"],"mappings":"6JAIO,MAAMA,EAAWC,gaCDjB,SAASC,EACdC,EACAC,EAAUD,EAAmB,QAC7B,CACA,eAAe,IAAIC,CAAO,GAAK,eAAe,OAAOA,EAASD,CAAkB,CAClF,CCRO,MAAME,EAAmBC,GACvB,OAAO,QAAQA,CAAS,EAC5B,IAAI,CAAC,CAACC,EAAGC,CAAC,IAAM,GAAGD,CAAC,KAAKC,CAAC,GAAG,EAC7B,KAAK;AAAA,CAAI,ECwBP,MAAMC,CAAyE,CASpF,YAAYC,EAA8BC,EAAc,CARxD,KAAO,KAAwC,KAC/C,KAAO,QAAU,GACjB,KAAO,MAAsB,MAO1B,KAAK,KAAOD,GAAM,cAAc,IAAI,EACrC,KAAK,QAAUC,CACjB,CAEA,MAAa,QAAQC,EAAwD,CAC3E,KAAK,SAAWA,EAChB,KAAK,QAAU,GACf,KAAK,KAAK,gBACV,GAAI,CAEF,KAAK,KAAO,MAAM,KAAK,QAAQ,GAAGA,CAAI,EACtC,KAAK,MAAQ,IACf,OAASC,EAAK,CACRA,aAAe,QACjB,KAAK,MAAQA,EACb,KAAK,KAAO,KAEhB,CACA,YAAK,QAAU,GACf,KAAK,KAAK,gBACH,KAAK,IACd,CAEA,MAAa,OAAQ,CACnB,OAAO,KAAK,KAAK,GAAK,KAAK,UAAY,CAAuB,CAAA,CAChE,CAEA,kBAAmB,CAGrB,CAAA,CChEA,MAAMC,EAAU,CACd,WAAY,+CACZ,MAAO,OACT,EAEaC,EAAgB,CAAC,CAAE,MAAAC,EAAO,MAAAC,CAAM,IAA0D,CACrG,IAAIC,EAAUC,IACd,GAAIH,aAAiBI,EAAc,CACjC,MAAMC,EAAW,KAAK,UACpB,CACE,OAAQL,EAAM,SAAS,OACvB,WAAYA,EAAM,SAAS,WAC3B,IAAKA,EAAM,SAAS,IACpB,KAAMA,EAAM,IACd,EACA,KACA,CACF,EACAE,EAAUC;AAAAA;AAAAA,WAEHE,CAAQ;AAAA,KAEjB,CACA,OAAIL,aAAiBM,IACnBJ,EAAUC;AAAAA;AAAAA,WAEHH,EAAM,sBAAsB,KAAK,IAAI,CAAC;AAAA,OAGxCG;AAAAA,SACAL,EAAQ,UAAU,IAAIG,EAAQE,kCAAqCF,CAAK,KAAKH,EAAQ,KAAK,YAAc,EAAE;AAAA;AAAA;AAAA;AAAA,UAIzGI,CAAO;AAAA,6BACYF,EAAM,SAAWG,cAAiB;AAAA,2BACpCH,EAAM,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,SAMtC,EC1CO,SAASO,EAAiBC,EAAmBC,EAAsC,CACxF,MAAMC,EAAwB,CAAA,EACxBC,EAAQF,EACd,UAAWG,KAAOJ,EACZG,EAAMC,CAAG,GAAK,MAChBF,EAAY,KAAKE,CAAa,EAGlC,GAAIF,EAAY,OAAS,EACvB,MAAAG,EAAO,MAAM;AAAA,EAAmDH,EAAY,KAAK,IAAI,EAAGD,CAAK,EACvF,IAAIH,EAAcI,CAAW,EAErC,MAAO,EACT,CAEO,SAASI,EAAyCC,EAA2BC,EAAoB,CACtG,OAAOD,EAAa,MAAOH,GAAQA,KAAOI,GAAUA,EAAOJ,CAAG,GAAK,IAAI,CACzE,CAEO,SAASK,EAAwCT,EAAmBQ,EAAiB,CAE1F,GAD4CR,EAAK,MAAOI,GAAQI,EAAOJ,CAAG,IAAM,MAAQI,EAAOJ,CAAG,IAAM,MAAS,EAE/G,MAAM,IAAIM,CAEd"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const t=class C extends CustomEvent{constructor(e){super(C.eventName,{detail:e,bubbles:!0,composed:!0})}};t.eventName="beamnetworkcall";let a=t;const s=class E extends CustomEvent{constructor(e){super(E.eventName,{detail:e,bubbles:!0,composed:!0})}};s.eventName="beamnonprofitselect";let n=s;const o=class N extends CustomEvent{constructor(e){super(N.eventName,{detail:e,bubbles:!0,composed:!0})}};o.eventName="beamcartchange";let r=o;const m=class i extends CustomEvent{constructor(e){super(i.eventName,{detail:e,bubbles:!0,composed:!0})}};m.eventName="beamcartcreated";let c=m;const l=class B extends CustomEvent{constructor(e){super(B.eventName,{detail:e,bubbles:!0,composed:!0})}};l.eventName="beamordercreated";let v=l;const d=class f extends CustomEvent{constructor(e){super(f.eventName,{detail:e,bubbles:!0,composed:!0})}};d.eventName="beamstatuschange";let u=d;const b=class x extends CustomEvent{constructor(e){super(x.eventName,{detail:e,bubbles:!0,composed:!0})}};b.eventName="beamnonprofitselectionremoved";let p=b;var g=Object.freeze({__proto__:null,BeamCartChangeEvent:r,BeamCartCreatedEvent:c,BeamNetworkCallEvent:a,BeamNonprofitSelectEvent:n,BeamNonprofitSelectionRemovedEvent:p,BeamOrderCreatedEvent:v,BeamStatusChangeEvent:u});export{u as B,c as a,v as b,n as c,a as d,g as e,r as f,p as g};
|
|
2
|
+
//# sourceMappingURL=events-Y8fYvSqM.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events-
|
|
1
|
+
{"version":3,"file":"events-Y8fYvSqM.esm.js","sources":["../../src/utils/events.ts"],"sourcesContent":["import { TCartApi } from \"../shared/cart-contents\";\nimport { TId } from \"../shared/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\n/* ------------------------------------------------------------------------------------------------------------------ */\ntype NonprofitSelectionRemovedDetail = {\n previousNonprofitId?: number | null;\n newNonprofitId?: number | null;\n selectionId?: string;\n};\n\n/**\n * beamnonprofitselectionremoved\n * Emitted when the nonprofit selection is removed from deselection or due to nonprofit cohort change\n */\nexport class BeamNonprofitSelectionRemovedEvent extends CustomEvent<NonprofitSelectionRemovedDetail> {\n static eventName = \"beamnonprofitselectionremoved\" as const;\n constructor(detail: NonprofitSelectionRemovedDetail) {\n super(BeamNonprofitSelectionRemovedEvent.eventName, { detail, bubbles: true, composed: true });\n }\n}\n"],"names":["_BeamNetworkCallEvent","detail","BeamNetworkCallEvent","_BeamNonprofitSelectEvent","BeamNonprofitSelectEvent","_BeamCartChangeEvent","BeamCartChangeEvent","_BeamCartCreatedEvent","BeamCartCreatedEvent","_BeamOrderCreatedEvent","BeamOrderCreatedEvent","_BeamStatusChangeEvent","BeamStatusChangeEvent","_BeamNonprofitSelectionRemovedEvent","BeamNonprofitSelectionRemovedEvent"],"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,kBADd,IAAME,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,sBADd,IAAMC,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,uBADRC,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,mBADR,IAAAC,EAAND,EAmBA,MAAME,EAAN,MAAMA,UAA2C,WAA6C,CAEnG,YAAYZ,EAAyC,CACnD,MAAMY,EAAmC,UAAW,CAAE,OAAAZ,EAAQ,QAAS,GAAM,SAAU,EAAK,CAAC,CAC/F,CACF,EALaY,EACJ,UAAY,gCADd,IAAMC,EAAND"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as TCartApi } from './cart-contents-
|
|
1
|
+
import { a as TCartApi } from './cart-contents-dKdDg09p.esm.js';
|
|
2
2
|
import { c as TId } from './types-7kSi85Gv.esm.js';
|
|
3
3
|
|
|
4
4
|
type NetworkEventDetail = {
|
|
@@ -88,6 +88,19 @@ declare class BeamStatusChangeEvent extends CustomEvent<BeamStatusChangeEventDet
|
|
|
88
88
|
static eventName: "beamstatuschange";
|
|
89
89
|
constructor(detail: BeamStatusChangeEventDetail);
|
|
90
90
|
}
|
|
91
|
+
type NonprofitSelectionRemovedDetail = {
|
|
92
|
+
previousNonprofitId?: number | null;
|
|
93
|
+
newNonprofitId?: number | null;
|
|
94
|
+
selectionId?: string;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* beamnonprofitselectionremoved
|
|
98
|
+
* Emitted when the nonprofit selection is removed from deselection or due to nonprofit cohort change
|
|
99
|
+
*/
|
|
100
|
+
declare class BeamNonprofitSelectionRemovedEvent extends CustomEvent<NonprofitSelectionRemovedDetail> {
|
|
101
|
+
static eventName: "beamnonprofitselectionremoved";
|
|
102
|
+
constructor(detail: NonprofitSelectionRemovedDetail);
|
|
103
|
+
}
|
|
91
104
|
|
|
92
105
|
type events_BeamCartChangeEvent = BeamCartChangeEvent;
|
|
93
106
|
declare const events_BeamCartChangeEvent: typeof BeamCartChangeEvent;
|
|
@@ -97,12 +110,14 @@ type events_BeamNetworkCallEvent = BeamNetworkCallEvent;
|
|
|
97
110
|
declare const events_BeamNetworkCallEvent: typeof BeamNetworkCallEvent;
|
|
98
111
|
type events_BeamNonprofitSelectEvent = BeamNonprofitSelectEvent;
|
|
99
112
|
declare const events_BeamNonprofitSelectEvent: typeof BeamNonprofitSelectEvent;
|
|
113
|
+
type events_BeamNonprofitSelectionRemovedEvent = BeamNonprofitSelectionRemovedEvent;
|
|
114
|
+
declare const events_BeamNonprofitSelectionRemovedEvent: typeof BeamNonprofitSelectionRemovedEvent;
|
|
100
115
|
type events_BeamOrderCreatedEvent = BeamOrderCreatedEvent;
|
|
101
116
|
declare const events_BeamOrderCreatedEvent: typeof BeamOrderCreatedEvent;
|
|
102
117
|
type events_BeamStatusChangeEvent = BeamStatusChangeEvent;
|
|
103
118
|
declare const events_BeamStatusChangeEvent: typeof BeamStatusChangeEvent;
|
|
104
119
|
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 };
|
|
120
|
+
export { events_BeamCartChangeEvent as BeamCartChangeEvent, events_BeamCartCreatedEvent as BeamCartCreatedEvent, events_BeamNetworkCallEvent as BeamNetworkCallEvent, events_BeamNonprofitSelectEvent as BeamNonprofitSelectEvent, events_BeamNonprofitSelectionRemovedEvent as BeamNonprofitSelectionRemovedEvent, events_BeamOrderCreatedEvent as BeamOrderCreatedEvent, events_BeamStatusChangeEvent as BeamStatusChangeEvent };
|
|
106
121
|
}
|
|
107
122
|
|
|
108
|
-
export { BeamNonprofitSelectEvent as B, BeamNetworkCallEvent as a, BeamCartChangeEvent as b, BeamCartCreatedEvent as c, BeamOrderCreatedEvent as d, events as e, BeamStatusChangeEvent as f };
|
|
123
|
+
export { BeamNonprofitSelectEvent as B, BeamNetworkCallEvent as a, BeamCartChangeEvent as b, BeamCartCreatedEvent as c, BeamOrderCreatedEvent as d, events as e, BeamStatusChangeEvent as f, BeamNonprofitSelectionRemovedEvent as g };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{v as d}from"./vendor-
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{v as d}from"./vendor-h5FNKy-G.esm.js";import{getCookieValue as i,setCookieValue as p,deleteCookieValue as l}from"../utils/cookies.esm.js";import{createScopedLocalStorage as n}from"../utils/local-storage.esm.js";const s="beam_session";async function r({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 c({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:r,endSession:c});export{r as c,c as e,u as i};
|
|
2
|
+
//# sourceMappingURL=index-6iInzwnG.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-6iInzwnG.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\";\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":"0NAuBA,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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as e}from"./beam-errors-P-Lu07Ce.esm.js";import{e as o}from"./events-
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{b as e}from"./beam-errors-P-Lu07Ce.esm.js";import{e as o}from"./events-Y8fYvSqM.esm.js";import{logger as r}from"../utils/logger.esm.js";import{fetchProxy as t,initNetworkListeners as i,xhrProxy as m}from"../utils/network-listeners.esm.js";import{createScopedLocalStorage as a}from"../utils/local-storage.esm.js";import{waitForElement as s}from"../utils/wait-for-element.esm.js";import{deleteCookieValue as l,getCookieMap as n,getCookieValue as p,setCookieValue as f}from"../utils/cookies.esm.js";import{getRemoteSession as g,saveRemoteSession as c}from"../utils/remote-session.esm.js";import{memoizeLast as u}from"../utils/memoize-last.esm.js";import{d as k,i as d}from"./lodash-P8OIs-at.esm.js";var x=Object.freeze({__proto__:null,createScopedLocalStorage:a,debounce:k,deleteCookieValue:l,errors:e,events:o,fetchProxy:t,getCookieMap:n,getCookieValue:p,getRemoteSession:g,initNetworkListeners:i,isEqual:d,logger:r,memoizeLast:u,saveRemoteSession:c,setCookieValue:f,waitForElement:s,xhrProxy:m});export{x as i};
|
|
2
|
+
//# sourceMappingURL=index-8yrr7ZZv.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-8yrr7ZZv.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i,d as n}from"./routes
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{a as i,d as n}from"./routes--kzWvkeF.esm.js";import{logger as d}from"../utils/logger.js";async function e(o,r){const{apiKey:a,baseUrl:s}=o;try{await n({baseUrl:s||i,headers:{authorization:`Api-Key ${a}`},requestBody:{...r}})}catch(t){d.error("Failed to send log",t)}}var l=Object.freeze({__proto__:null,sendLog:e});export{l as i,e as s};
|
|
2
|
+
//# sourceMappingURL=index-ARSbllRj.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-ARSbllRj.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 \"../../utils/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":"gGAYA,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"}
|
|
@@ -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-AezeN9KY.esm.js';
|
|
2
2
|
|
|
3
3
|
declare const index_TBeamOrderPageParams: typeof TBeamOrderPageParams;
|
|
4
4
|
declare const index_addBeamAttributesToCart: typeof addBeamAttributesToCart;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-K0KGNP8F.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as e}from"./beam-errors-P-Lu07Ce.esm.js";import{e as o}from"./events-
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{b as e}from"./beam-errors-P-Lu07Ce.esm.js";import{e as o}from"./events-Y8fYvSqM.esm.js";import{logger as r}from"../utils/logger.esm.js";import{fetchProxy as t,initNetworkListeners as i,xhrProxy as m}from"../utils/network-listeners.esm.js";import{createScopedLocalStorage as a}from"../utils/local-storage.esm.js";import{waitForElement as s}from"../utils/wait-for-element.esm.js";import{deleteCookieValue as l,getCookieMap as n,getCookieValue as p,setCookieValue as f}from"../utils/cookies.esm.js";import{getRemoteSession as g,saveRemoteSession as c}from"../utils/remote-session.esm.js";import{memoizeLast as u}from"../utils/memoize-last.esm.js";import{d as k,i as d}from"./lodash-P8OIs-at.esm.js";var x=Object.freeze({__proto__:null,createScopedLocalStorage:a,debounce:k,deleteCookieValue:l,errors:e,events:o,fetchProxy:t,getCookieMap:n,getCookieValue:p,getRemoteSession:g,initNetworkListeners:i,isEqual:d,logger:r,memoizeLast:u,saveRemoteSession:c,setCookieValue:f,waitForElement:s,xhrProxy:m});export{x as i};
|
|
2
|
+
//# sourceMappingURL=index-Lw32NXij.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Lw32NXij.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i}from"./index-8yrr7ZZv.esm.js";import{i as o}from"./index-bhC9kqpF.esm.js";import{i as r}from"./index-6iInzwnG.esm.js";import{i as e}from"./index-K0KGNP8F.esm.js";import{i as m}from"./index-XCQ48s5g.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-QEOW1H_N.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-QEOW1H_N.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as index$5 } from './index-
|
|
2
|
-
import { i as index$4 } from './index-
|
|
1
|
+
import { i as index$5 } from './index-dDBsHD_s.esm.js';
|
|
2
|
+
import { i as index$4 } from './index-EjqeU7Mu.esm.js';
|
|
3
3
|
import { i as index$3 } from './index-EGiUuWe-.esm.js';
|
|
4
|
-
import { i as index$1 } from './index-
|
|
5
|
-
import { i as index$2 } from './index-
|
|
4
|
+
import { i as index$1 } from './index-tqTROh5B.esm.js';
|
|
5
|
+
import { i as index$2 } from './index-cRyQ6D5G.esm.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* This file is used to provide type definitions
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{f as e,p as r,P as t,s as a,R as o}from"./order-page-vbiHdNMi.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-WBPyA_Km.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-WBPyA_Km.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i,d as n}from"./routes-
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{a as i,d as n}from"./routes-ga8DTuUO.esm.js";import{logger as d}from"../utils/logger.esm.js";async function e(o,r){const{apiKey:a,baseUrl:s}=o;try{await n({baseUrl:s||i,headers:{authorization:`Api-Key ${a}`},requestBody:{...r}})}catch(t){d.error("Failed to send log",t)}}var l=Object.freeze({__proto__:null,sendLog:e});export{l as i,e as s};
|
|
2
|
+
//# sourceMappingURL=index-XCQ48s5g.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-XCQ48s5g.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 \"../../utils/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":"oGAYA,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{f as e,p as r,P as t,s as a,R as o}from"./order-page-QUOh_9GG.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-bhC9kqpF.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-bhC9kqpF.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { b as beamErrors } from './beam-errors-fXDkG1zo.esm.js';
|
|
2
|
-
import { e as events } from './events-
|
|
2
|
+
import { e as events } from './events-zF9NDtBD.esm.js';
|
|
3
3
|
import { logger } from '../utils/logger.js';
|
|
4
4
|
import { fetchProxy, initNetworkListeners, xhrProxy } from '../utils/network-listeners.js';
|
|
5
5
|
import { createScopedLocalStorage } from '../utils/local-storage.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { b as beamErrors } from './beam-errors-fXDkG1zo.esm.js';
|
|
2
|
-
import { e as events } from './events-
|
|
2
|
+
import { e as events } from './events-zF9NDtBD.esm.js';
|
|
3
3
|
import { logger } from '../utils/logger.js';
|
|
4
4
|
import { fetchProxy, initNetworkListeners, xhrProxy } from '../utils/network-listeners.js';
|
|
5
5
|
import { createScopedLocalStorage } from '../utils/local-storage.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{v as d}from"./vendor-
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{v as d}from"./vendor-h5FNKy-G.esm.js";import{getCookieValue as i,setCookieValue as p,deleteCookieValue as l}from"../utils/cookies.js";import{createScopedLocalStorage as n}from"../utils/local-storage.js";const s="beam_session";async function r({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 c({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:r,endSession:c});export{r as c,c as e,u as i};
|
|
2
|
+
//# sourceMappingURL=index-l7Ao8g5B.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-l7Ao8g5B.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\";\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":"kNAuBA,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,2 @@
|
|
|
1
|
+
import{i}from"./index-phDmC-TS.esm.js";import{i as o}from"./index-WBPyA_Km.esm.js";import{i as r}from"./index-l7Ao8g5B.esm.js";import{i as e}from"./index-ygp7mxoE.esm.js";import{i as m}from"./index-ARSbllRj.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-nOkYjc29.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-nOkYjc29.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as e}from"./beam-errors-P-Lu07Ce.esm.js";import{e as o}from"./events-
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{b as e}from"./beam-errors-P-Lu07Ce.esm.js";import{e as o}from"./events-Y8fYvSqM.esm.js";import{logger as r}from"../utils/logger.js";import{fetchProxy as t,initNetworkListeners as i,xhrProxy as m}from"../utils/network-listeners.js";import{createScopedLocalStorage as a}from"../utils/local-storage.js";import{waitForElement as s}from"../utils/wait-for-element.js";import{deleteCookieValue as l,getCookieMap as n,getCookieValue as p,setCookieValue as f}from"../utils/cookies.js";import{getRemoteSession as g,saveRemoteSession as c}from"../utils/remote-session.js";import{memoizeLast as u}from"../utils/memoize-last.js";import{d as k,i as d}from"./lodash-P8OIs-at.esm.js";var x=Object.freeze({__proto__:null,createScopedLocalStorage:a,debounce:k,deleteCookieValue:l,errors:e,events:o,fetchProxy:t,getCookieMap:n,getCookieValue:p,getRemoteSession:g,initNetworkListeners:i,isEqual:d,logger:r,memoizeLast:u,saveRemoteSession:c,setCookieValue:f,waitForElement:s,xhrProxy:m});export{x as i};
|
|
2
|
+
//# sourceMappingURL=index-phDmC-TS.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-phDmC-TS.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-43LEXveI.esm.js';
|
|
2
2
|
|
|
3
3
|
declare const index_BeamCartAPIConfig: typeof BeamCartAPIConfig;
|
|
4
4
|
declare const index_BeamCartValues: typeof BeamCartValues;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as e}from"./beam-errors-P-Lu07Ce.esm.js";import{e as o}from"./events-
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{b as e}from"./beam-errors-P-Lu07Ce.esm.js";import{e as o}from"./events-Y8fYvSqM.esm.js";import{logger as r}from"../utils/logger.js";import{fetchProxy as t,initNetworkListeners as i,xhrProxy as m}from"../utils/network-listeners.js";import{createScopedLocalStorage as a}from"../utils/local-storage.js";import{waitForElement as s}from"../utils/wait-for-element.js";import{deleteCookieValue as l,getCookieMap as n,getCookieValue as p,setCookieValue as f}from"../utils/cookies.js";import{getRemoteSession as g,saveRemoteSession as c}from"../utils/remote-session.js";import{memoizeLast as u}from"../utils/memoize-last.js";import{d as k,i as d}from"./lodash-P8OIs-at.esm.js";var x=Object.freeze({__proto__:null,createScopedLocalStorage:a,debounce:k,deleteCookieValue:l,errors:e,events:o,fetchProxy:t,getCookieMap:n,getCookieValue:p,getRemoteSession:g,initNetworkListeners:i,isEqual:d,logger:r,memoizeLast:u,saveRemoteSession:c,setCookieValue:f,waitForElement:s,xhrProxy:m});export{x as i};
|
|
2
|
+
//# sourceMappingURL=index-uF-Qtewb.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-uF-Qtewb.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-ygp7mxoE.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|