@beamimpact/web-sdk 1.37.1 → 1.38.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/dist/chunks/_share-dialog-dependencies-0yVtRIRR.esm.js +2 -0
- package/dist/chunks/_share-dialog-dependencies-0yVtRIRR.esm.js.map +1 -0
- package/dist/chunks/_share-dialog-dependencies-HWissVga.esm.js +2 -0
- package/dist/chunks/_share-dialog-dependencies-HWissVga.esm.js.map +1 -0
- package/dist/chunks/{cart-contents-IOhdr24g.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.map +1 -1
- package/dist/chunks/{events-j-SJ9Cot.esm.d.ts → events-zF9NDtBD.esm.d.ts} +2 -1
- 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-3F_Wjm5v.esm.d.ts → index-EjqeU7Mu.esm.d.ts} +1 -1
- package/dist/chunks/index-FsVWk2WD.esm.js +2 -0
- package/dist/chunks/index-FsVWk2WD.esm.js.map +1 -0
- package/dist/chunks/index-IKTofhFw.esm.js +2 -0
- package/dist/chunks/index-IKTofhFw.esm.js.map +1 -0
- package/dist/chunks/index-IWF7IfQk.esm.js +2 -0
- package/dist/chunks/index-IWF7IfQk.esm.js.map +1 -0
- package/dist/chunks/index-MG0WE1Fz.esm.js +2 -0
- package/dist/chunks/index-MG0WE1Fz.esm.js.map +1 -0
- package/dist/chunks/index-NU6RpwSa.esm.js +2 -0
- package/dist/chunks/index-NU6RpwSa.esm.js.map +1 -0
- package/dist/chunks/index-QrlkSlnv.esm.js +2 -0
- package/dist/chunks/index-QrlkSlnv.esm.js.map +1 -0
- package/dist/chunks/{index-s8uQH63W.esm.d.ts → index-Tnwxn22c.esm.d.ts} +4 -4
- package/dist/chunks/{index-vpkWmZo_.esm.js → index-UCh8HjVN.esm.js} +2 -2
- package/dist/chunks/{index-vpkWmZo_.esm.js.map → index-UCh8HjVN.esm.js.map} +1 -1
- package/dist/chunks/{index-Gz7Q9nUW.esm.js → index-_WQFoMIz.esm.js} +2 -2
- package/dist/chunks/{index-Gz7Q9nUW.esm.js.map → index-_WQFoMIz.esm.js.map} +1 -1
- package/dist/chunks/{index-yXqJ9Znv.esm.d.ts → index-cRyQ6D5G.esm.d.ts} +1 -1
- package/dist/chunks/{index-mWnpDGl1.esm.d.ts → index-dDBsHD_s.esm.d.ts} +1 -1
- package/dist/chunks/{index-slrOT8Gd.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-WX8Yyx2u.esm.d.ts → index-tqTROh5B.esm.d.ts} +1 -1
- 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-b529HHW3.esm.d.ts → openapi-spec-fxMWpEwU.esm.d.ts} +259 -14
- package/dist/chunks/order-page-5VQO1Sil.esm.js +2 -0
- package/dist/chunks/order-page-5VQO1Sil.esm.js.map +1 -0
- package/dist/chunks/{order-page-jkuLE25f.esm.d.ts → order-page-AezeN9KY.esm.d.ts} +2 -2
- package/dist/chunks/order-page-E7Kyu1JP.esm.js +2 -0
- package/dist/chunks/order-page-E7Kyu1JP.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-LFjgVNGB.esm.js → routes-UBDDazXd.esm.js} +2 -2
- package/dist/chunks/{routes-LFjgVNGB.esm.js.map → routes-UBDDazXd.esm.js.map} +1 -1
- package/dist/chunks/{routes-ad0I3Ayc.esm.js → routes-t5eRHMRc.esm.js} +2 -2
- package/dist/chunks/{routes-ad0I3Ayc.esm.js.map → routes-t5eRHMRc.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-EKZbvT8c.esm.d.ts → update-cart-43LEXveI.esm.d.ts} +1 -1
- package/dist/chunks/{update-cart-A2hs4tF8.esm.js → update-cart-6fMyZd34.esm.js} +2 -2
- package/dist/chunks/{update-cart-A2hs4tF8.esm.js.map → update-cart-6fMyZd34.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-vcujKNky.esm.js → update-cart-WfOplzik.esm.js} +2 -2
- package/dist/chunks/{update-cart-vcujKNky.esm.js.map → update-cart-WfOplzik.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/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/index.d.ts +3 -3
- package/package.json +1 -1
- package/dist/chunks/_share-dialog-dependencies-FheD3_vQ.esm.js +0 -2
- package/dist/chunks/_share-dialog-dependencies-FheD3_vQ.esm.js.map +0 -1
- package/dist/chunks/_share-dialog-dependencies-l35ECwOP.esm.js +0 -2
- package/dist/chunks/_share-dialog-dependencies-l35ECwOP.esm.js.map +0 -1
- package/dist/chunks/index-B2oj1JKu.esm.js +0 -2
- package/dist/chunks/index-B2oj1JKu.esm.js.map +0 -1
- package/dist/chunks/index-E_HMWZ2A.esm.js +0 -2
- package/dist/chunks/index-E_HMWZ2A.esm.js.map +0 -1
- package/dist/chunks/index-JsXH5Lnc.esm.js +0 -2
- package/dist/chunks/index-JsXH5Lnc.esm.js.map +0 -1
- package/dist/chunks/index-RDKeoKqc.esm.js +0 -2
- package/dist/chunks/index-RDKeoKqc.esm.js.map +0 -1
- package/dist/chunks/index-VGoZaoVm.esm.js +0 -2
- package/dist/chunks/index-VGoZaoVm.esm.js.map +0 -1
- package/dist/chunks/index-xYLcuL6Z.esm.js +0 -2
- package/dist/chunks/index-xYLcuL6Z.esm.js.map +0 -1
- package/dist/chunks/order-page-9B0nZVh1.esm.js +0 -2
- package/dist/chunks/order-page-9B0nZVh1.esm.js.map +0 -1
- package/dist/chunks/order-page-yM2h67MI.esm.js +0 -2
- package/dist/chunks/order-page-yM2h67MI.esm.js.map +0 -1
- package/dist/chunks/vendor-eeJfrOkP.esm.js.map +0 -1
|
@@ -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-t5eRHMRc.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-0yVtRIRR.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_share-dialog-dependencies-0yVtRIRR.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -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-UBDDazXd.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-HWissVga.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_share-dialog-dependencies-HWissVga.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"}
|
|
@@ -1 +1 @@
|
|
|
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};\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,
|
|
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 = {
|
|
@@ -91,6 +91,7 @@ declare class BeamStatusChangeEvent extends CustomEvent<BeamStatusChangeEventDet
|
|
|
91
91
|
type NonprofitSelectionRemovedDetail = {
|
|
92
92
|
previousNonprofitId?: number | null;
|
|
93
93
|
newNonprofitId?: number | null;
|
|
94
|
+
selectionId?: string;
|
|
94
95
|
};
|
|
95
96
|
/**
|
|
96
97
|
* beamnonprofitselectionremoved
|
|
@@ -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,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,2 @@
|
|
|
1
|
+
import{f as e,p as r,P as t,s as a,R as o}from"./order-page-E7Kyu1JP.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-FsVWk2WD.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-FsVWk2WD.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-IKTofhFw.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i}from"./index-Lw32NXij.esm.js";import{i as o}from"./index-FsVWk2WD.esm.js";import{i as r}from"./index-6iInzwnG.esm.js";import{i as e}from"./index-IKTofhFw.esm.js";import{i as m}from"./index-UCh8HjVN.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-IWF7IfQk.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-IWF7IfQk.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-MG0WE1Fz.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i}from"./index-uF-Qtewb.esm.js";import{i as o}from"./index-QrlkSlnv.esm.js";import{i as r}from"./index-l7Ao8g5B.esm.js";import{i as e}from"./index-MG0WE1Fz.esm.js";import{i as m}from"./index-_WQFoMIz.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-NU6RpwSa.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-NU6RpwSa.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{f as e,p as r,P as t,s as a,R as o}from"./order-page-5VQO1Sil.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-QrlkSlnv.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-QrlkSlnv.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
|
|
@@ -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-UBDDazXd.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-UCh8HjVN.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-UCh8HjVN.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"}
|
|
@@ -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-t5eRHMRc.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-_WQFoMIz.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-_WQFoMIz.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,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"}
|
|
@@ -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;
|