@beamimpact/web-sdk 1.45.3 → 1.46.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/dist/chunks/_share-dialog-dependencies--DwhY4w7.esm.js +2 -0
- package/dist/chunks/_share-dialog-dependencies--DwhY4w7.esm.js.map +1 -0
- package/dist/chunks/_share-dialog-dependencies-XEpMl5XM.esm.js +2 -0
- package/dist/chunks/_share-dialog-dependencies-XEpMl5XM.esm.js.map +1 -0
- package/dist/chunks/{cart-contents-HAPzwbeL.esm.d.ts → cart-contents-MrYQNVDx.esm.d.ts} +1 -1
- package/dist/chunks/{events-fqRWfo7p.esm.d.ts → events--Qgk7Mel.esm.d.ts} +1 -1
- package/dist/chunks/{index-IujuLxUV.esm.js → index-2sMT9J8K.esm.js} +2 -2
- package/dist/chunks/{index-IujuLxUV.esm.js.map → index-2sMT9J8K.esm.js.map} +1 -1
- package/dist/chunks/index-4kINfIHU.esm.js +2 -0
- package/dist/chunks/index-4kINfIHU.esm.js.map +1 -0
- package/dist/chunks/{index-MSoONvC5.esm.d.ts → index-8gDNc2to.esm.d.ts} +1 -1
- package/dist/chunks/index-COmf0U0P.esm.js +2 -0
- package/dist/chunks/index-COmf0U0P.esm.js.map +1 -0
- package/dist/chunks/{index-XN6JUoCQ.esm.js → index-Fmt8u1QB.esm.js} +2 -2
- package/dist/chunks/{index-XN6JUoCQ.esm.js.map → index-Fmt8u1QB.esm.js.map} +1 -1
- package/dist/chunks/index-H8fABpZF.esm.js +2 -0
- package/dist/chunks/index-H8fABpZF.esm.js.map +1 -0
- package/dist/chunks/index-HzqAV0Ls.esm.js +2 -0
- package/dist/chunks/index-HzqAV0Ls.esm.js.map +1 -0
- package/dist/chunks/{index-qt5iD9Ok.esm.d.ts → index-Ie9en2n6.esm.d.ts} +1 -1
- package/dist/chunks/{index-SExnliMs.esm.d.ts → index-S_lCvtkH.esm.d.ts} +1 -1
- package/dist/chunks/{index-JG4nmG9U.esm.d.ts → index-gQHtJWVP.esm.d.ts} +1 -1
- package/dist/chunks/{index-tdUx2WLc.esm.d.ts → index-ikzViFqS.esm.d.ts} +4 -4
- package/dist/chunks/{index-7mukhxz_.esm.d.ts → index-wqLh9Pnq.esm.d.ts} +1 -1
- package/dist/chunks/index-y4dGW0m2.esm.js +2 -0
- package/dist/chunks/index-y4dGW0m2.esm.js.map +1 -0
- package/dist/chunks/index-yhi0tTdC.esm.js +2 -0
- package/dist/chunks/index-yhi0tTdC.esm.js.map +1 -0
- package/dist/chunks/localize-m-_ESmpk.esm.js.map +1 -1
- package/dist/chunks/localize-o-cYvHQf.esm.js.map +1 -1
- package/dist/chunks/{openapi-spec-RlP2IT1i.esm.d.ts → openapi-spec--os_utEo.esm.d.ts} +55 -1
- package/dist/chunks/{order-page-Qptp0Cgw.esm.js → order-page--Xn2Rb6J.esm.js} +2 -2
- package/dist/chunks/{order-page-Qptp0Cgw.esm.js.map → order-page--Xn2Rb6J.esm.js.map} +1 -1
- package/dist/chunks/{order-page-FLhpaZg2.esm.d.ts → order-page-GwRa273v.esm.d.ts} +3 -3
- package/dist/chunks/{order-page-fVZWjxXw.esm.js → order-page-uEOo5EPy.esm.js} +2 -2
- package/dist/chunks/{order-page-fVZWjxXw.esm.js.map → order-page-uEOo5EPy.esm.js.map} +1 -1
- package/dist/chunks/{promo-pill-label-58PJRvSl.esm.js → promo-pill-label-P1X4xeAx.esm.js} +4 -3
- package/dist/chunks/promo-pill-label-P1X4xeAx.esm.js.map +1 -0
- package/dist/chunks/{routes-kK10CmJz.esm.js → routes-F1ZIumMP.esm.js} +2 -2
- package/dist/chunks/{routes-kK10CmJz.esm.js.map → routes-F1ZIumMP.esm.js.map} +1 -1
- package/dist/chunks/{routes-NIuAzAOC.esm.d.ts → routes-iurI6dvR.esm.d.ts} +71 -1
- package/dist/chunks/{routes-4z90Ks28.esm.js → routes-sQWfbAoi.esm.js} +2 -2
- package/dist/chunks/{routes-4z90Ks28.esm.js.map → routes-sQWfbAoi.esm.js.map} +1 -1
- package/dist/chunks/{share-button-RG2BkqMA.esm.js → share-button-2RaDSzSs.esm.js} +3 -4
- package/dist/chunks/{share-button-RG2BkqMA.esm.js.map → share-button-2RaDSzSs.esm.js.map} +1 -1
- package/dist/chunks/{share-button-K_FE0-s2.esm.js → share-button-_QWVlCcB.esm.js} +3 -4
- package/dist/chunks/{share-button-K_FE0-s2.esm.js.map → share-button-_QWVlCcB.esm.js.map} +1 -1
- package/dist/chunks/{shoelace-components-522x2Yt1.esm.js → shoelace-components-9s7uTeO6.esm.js} +2 -2
- package/dist/chunks/{shoelace-components-522x2Yt1.esm.js.map → shoelace-components-9s7uTeO6.esm.js.map} +1 -1
- package/dist/chunks/{shoelace-components-59LxBr67.esm.js → shoelace-components-tjFhbEiI.esm.js} +2 -2
- package/dist/chunks/{shoelace-components-59LxBr67.esm.js.map → shoelace-components-tjFhbEiI.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-Hebtxhto.esm.d.ts → update-cart-KjKc8Cls.esm.d.ts} +1 -1
- package/dist/chunks/{update-cart-BcLkAJSc.esm.js → update-cart-T7h4g2nt.esm.js} +2 -2
- package/dist/chunks/{update-cart-BcLkAJSc.esm.js.map → update-cart-T7h4g2nt.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-eodNhDjI.esm.js → update-cart-WyIeEybK.esm.js} +2 -2
- package/dist/chunks/{update-cart-eodNhDjI.esm.js.map → update-cart-WyIeEybK.esm.js.map} +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.esm.js.map +1 -1
- package/dist/components/cumulative-impact.js +1 -1
- package/dist/components/cumulative-impact.js.map +1 -1
- package/dist/components/impact-overview.d.ts +5 -1
- package/dist/components/impact-overview.esm.js +31 -25
- package/dist/components/impact-overview.esm.js.map +1 -1
- package/dist/components/impact-overview.js +31 -25
- package/dist/components/impact-overview.js.map +1 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.esm.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/post-purchase.d.ts +5 -3
- package/dist/components/post-purchase.esm.js +1 -1
- package/dist/components/post-purchase.js +1 -1
- package/dist/components/product-details-page.d.ts +7 -2
- package/dist/components/product-details-page.esm.js +106 -33
- package/dist/components/product-details-page.esm.js.map +1 -1
- package/dist/components/product-details-page.js +106 -33
- package/dist/components/product-details-page.js.map +1 -1
- package/dist/components/redeem-transaction.d.ts +3 -3
- package/dist/components/redeem-transaction.esm.js +2 -2
- package/dist/components/redeem-transaction.esm.js.map +1 -1
- package/dist/components/redeem-transaction.js +2 -2
- package/dist/components/redeem-transaction.js.map +1 -1
- package/dist/components/select-nonprofit.d.ts +3 -3
- package/dist/components/select-nonprofit.esm.js +4 -4
- package/dist/components/select-nonprofit.esm.js.map +1 -1
- package/dist/components/select-nonprofit.js +4 -4
- package/dist/components/select-nonprofit.js.map +1 -1
- package/dist/components/select-subscription-nonprofit.d.ts +1 -1
- package/dist/components/select-subscription-nonprofit.esm.js +6 -4
- package/dist/components/select-subscription-nonprofit.esm.js.map +1 -1
- package/dist/components/select-subscription-nonprofit.js +6 -4
- package/dist/components/select-subscription-nonprofit.js.map +1 -1
- package/dist/components/shopify.d.ts +6 -6
- package/dist/components/shopify.esm.js +1 -1
- package/dist/components/shopify.js +1 -1
- package/dist/components/social-share.esm.js +1 -1
- package/dist/components/social-share.js +1 -1
- package/dist/components/subscription-impact.d.ts +3 -1
- package/dist/components/subscription-impact.esm.js +1 -1
- package/dist/components/subscription-impact.js +1 -1
- package/dist/components/subscription-management.d.ts +7 -4
- package/dist/components/subscription-management.esm.js +10 -10
- package/dist/components/subscription-management.esm.js.map +1 -1
- package/dist/components/subscription-management.js +10 -10
- package/dist/components/subscription-management.js.map +1 -1
- package/dist/index.d.ts +12 -12
- 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 -10
- package/dist/integrations/index.esm.js +1 -1
- package/dist/integrations/index.js +1 -1
- package/dist/integrations/logs.d.ts +2 -2
- package/dist/integrations/logs.esm.js +1 -1
- package/dist/integrations/logs.js +1 -1
- package/dist/integrations/shopify.d.ts +5 -5
- package/dist/integrations/shopify.esm.js +1 -1
- package/dist/integrations/shopify.js +1 -1
- package/dist/integrations/statsig.d.ts +3 -0
- package/dist/integrations/statsig.esm.js +3 -3
- package/dist/integrations/statsig.esm.js.map +1 -1
- package/dist/integrations/statsig.js +3 -3
- package/dist/integrations/statsig.js.map +1 -1
- package/dist/integrations/utils.d.ts +3 -3
- 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 -4
- package/dist/react/index.esm.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/post-purchase.d.ts +2 -2
- package/dist/react/post-purchase.esm.js +1 -1
- package/dist/react/post-purchase.js +1 -1
- package/dist/react/product-details-page.d.ts +2 -0
- package/dist/react/product-details-page.esm.js +1 -1
- package/dist/react/product-details-page.esm.js.map +1 -1
- package/dist/react/product-details-page.js +1 -1
- package/dist/react/product-details-page.js.map +1 -1
- package/dist/react/redeem-transaction.d.ts +3 -3
- package/dist/react/redeem-transaction.esm.js +1 -1
- package/dist/react/redeem-transaction.js +1 -1
- package/dist/react/select-nonprofit.d.ts +3 -3
- package/dist/react/select-nonprofit.esm.js +1 -1
- package/dist/react/select-nonprofit.js +1 -1
- package/dist/react/select-subscription-nonprofit.d.ts +3 -3
- package/dist/react/select-subscription-nonprofit.esm.js +1 -1
- package/dist/react/select-subscription-nonprofit.js +1 -1
- package/dist/react/social-share.esm.js +1 -1
- package/dist/react/social-share.js +1 -1
- package/dist/react/subscription-impact.esm.js +1 -1
- package/dist/react/subscription-impact.js +1 -1
- package/dist/react/subscription-management.d.ts +3 -3
- 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/dist/utils/local-storage.esm.js.map +1 -1
- package/dist/utils/local-storage.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/_share-dialog-dependencies-FXJR0ESq.esm.js +0 -2
- package/dist/chunks/_share-dialog-dependencies-FXJR0ESq.esm.js.map +0 -1
- package/dist/chunks/_share-dialog-dependencies-VM-oSkel.esm.js +0 -2
- package/dist/chunks/_share-dialog-dependencies-VM-oSkel.esm.js.map +0 -1
- package/dist/chunks/index-4Fvcu3-v.esm.js +0 -2
- package/dist/chunks/index-4Fvcu3-v.esm.js.map +0 -1
- package/dist/chunks/index-KQ5XYf5e.esm.js +0 -2
- package/dist/chunks/index-KQ5XYf5e.esm.js.map +0 -1
- package/dist/chunks/index-Uos3T3K9.esm.js +0 -2
- package/dist/chunks/index-Uos3T3K9.esm.js.map +0 -1
- package/dist/chunks/index-WibiKAEy.esm.js +0 -2
- package/dist/chunks/index-WibiKAEy.esm.js.map +0 -1
- package/dist/chunks/index-qOqcMZym.esm.js +0 -2
- package/dist/chunks/index-qOqcMZym.esm.js.map +0 -1
- package/dist/chunks/index-xJ0ZfjZW.esm.js +0 -2
- package/dist/chunks/index-xJ0ZfjZW.esm.js.map +0 -1
- package/dist/chunks/promo-pill-label-58PJRvSl.esm.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_share-dialog-dependencies--DwhY4w7.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./vendor-GKiOHg2N.esm.js";import"./shoelace-components-9s7uTeO6.esm.js";import"./lit-iNN5L_Qk.esm.js";import"./routes-sQWfbAoi.esm.js";import"./beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";
|
|
2
|
+
//# sourceMappingURL=_share-dialog-dependencies-XEpMl5XM.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_share-dialog-dependencies-XEpMl5XM.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--os_utEo.esm.js';
|
|
2
2
|
|
|
3
3
|
type TCartApi = paths["/chain/findEligibleNonprofitsForCart"]["post"]["requestBody"]["content"]["application/json"]["cart"];
|
|
4
4
|
type TCart = TCartApi & {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i,c as n}from"./routes-
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{a as i,c as n}from"./routes-F1ZIumMP.esm.js";import{logger as c}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){c.error("Failed to send log",t)}}var d=Object.freeze({__proto__:null,sendLog:e});export{d as i,e as s};
|
|
2
|
+
//# sourceMappingURL=index-2sMT9J8K.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-2sMT9J8K.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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-4kINfIHU.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--Qgk7Mel.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';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i}from"./index-n6QNFLXV.esm.js";import{i as o}from"./index-y4dGW0m2.esm.js";import{i as r}from"./index-eXilYHHK.esm.js";import{i as e}from"./index-4kINfIHU.esm.js";import{i as m}from"./index-Fmt8u1QB.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-COmf0U0P.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-COmf0U0P.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i,c as n}from"./routes-
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{a as i,c as n}from"./routes-sQWfbAoi.esm.js";import{logger as c}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){c.error("Failed to send log",t)}}var d=Object.freeze({__proto__:null,sendLog:e});export{d as i,e as s};
|
|
2
|
+
//# sourceMappingURL=index-Fmt8u1QB.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-Fmt8u1QB.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{i}from"./index-x2kxA_Xo.esm.js";import{i as o}from"./index-HzqAV0Ls.esm.js";import{i as r}from"./index-JDZQClkA.esm.js";import{i as e}from"./index-yhi0tTdC.esm.js";import{i as m}from"./index-2sMT9J8K.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-H8fABpZF.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-H8fABpZF.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{p as e,w as r,J as t,s as a,q as o}from"./order-page-uEOo5EPy.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-HzqAV0Ls.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-HzqAV0Ls.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BeamShopifyCartIntegrationConfig, T as TBeamOrderPageParams, a as addBeamAttributesToCart, g as getCurrentCart, r as registerCartIntegration, s as showBeamOrderPageWidgets, t as trackCart } from './order-page-
|
|
1
|
+
import { B as BeamShopifyCartIntegrationConfig, T as TBeamOrderPageParams, a as addBeamAttributesToCart, g as getCurrentCart, r as registerCartIntegration, s as showBeamOrderPageWidgets, t as trackCart } from './order-page-GwRa273v.esm.js';
|
|
2
2
|
|
|
3
3
|
declare const index_BeamShopifyCartIntegrationConfig: typeof BeamShopifyCartIntegrationConfig;
|
|
4
4
|
declare const index_TBeamOrderPageParams: typeof TBeamOrderPageParams;
|
|
@@ -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--Qgk7Mel.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,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-8gDNc2to.esm.js';
|
|
2
|
+
import { i as index$4 } from './index-Ie9en2n6.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-wqLh9Pnq.esm.js';
|
|
5
|
+
import { i as index$2 } from './index-gQHtJWVP.esm.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* This file is used to provide type definitions
|
|
@@ -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-KjKc8Cls.esm.js';
|
|
2
2
|
|
|
3
3
|
declare const index_BeamCartAPIConfig: typeof BeamCartAPIConfig;
|
|
4
4
|
declare const index_BeamCartValues: typeof BeamCartValues;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{p as e,w as r,J as t,s as a,q as o}from"./order-page--Xn2Rb6J.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-y4dGW0m2.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-y4dGW0m2.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-yhi0tTdC.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localize-m-_ESmpk.esm.js","sources":["../../src/shared/fragments/css-variable-map.ts","../../src/shared/controllers/async-controller.ts","../../src/shared/fragments/error-message-template.ts","../../src/shared/fragments/custom-text.ts","../../src/shared/localize.ts"],"sourcesContent":["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 { CSSResult, unsafeCSS } from \"lit\";\n\n/**\n * Create an object that can be passed to cssVariableMap\n * to define CSS variables in a style tag. The default properties\n * are the ones exposed for customization in the remote config interface.\n * @example\n * const variables = {\n * ...customizableTextJs(\"widget-header\",\n * \"widget-border-color\": \"red\"\n * };\n *\n * html`<style>:host { ${_cssVariableMap(variables)} }</style>`;\n * @returns {{[p: string]: string}}\n */\nexport const defineCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n textDecoration = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n letterSpacing = \"normal\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n [`${prefix}-fontFamily`]: fontFamily,\n [`${prefix}-fontStyle`]: fontStyle,\n [`${prefix}-fontSize`]: fontSize,\n [`${prefix}-fontWeight`]: fontWeight,\n [`${prefix}-textTransform`]: textTransform,\n [`${prefix}-marginTop`]: marginTop,\n [`${prefix}-lineHeight`]: lineHeight,\n [`${prefix}-color`]: color,\n [`${prefix}-letterSpacing`]: letterSpacing,\n [`${prefix}-textDecoration`]: textDecoration,\n };\n};\n\n/**\n * Returns a string that defines css properties based on variables,\n * which can be used in a css`` template. The default properties are the\n * ones exposed for customization in the remote config interface.\n * @example\n * css`.widget-header { ${customizableTextCss(\"widget-header\")} border: none; }`\n * @returns {CSSResult}\n */\nexport const useCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n textDecoration = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n letterSpacing = \"normal\",\n } = {}\n): CSSResult => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return unsafeCSS(`\\\n font-family: var(${prefix}-fontFamily, ${fontFamily});\n font-style: var(${prefix}-fontStyle, ${fontStyle});\n font-size: var(${prefix}-fontSize, ${fontSize});\n font-weight: var(${prefix}-fontWeight, ${fontWeight});\n text-transform: var(${prefix}-textTransform, ${textTransform});\n margin-top: var(${prefix}-marginTop, ${marginTop});\n line-height: var(${prefix}-lineHeight, ${lineHeight});\n text-decoration: var(${prefix}-textDecoration, ${textDecoration});\n color: var(${prefix}-color, ${color});\n letter-spacing: var(${prefix}-letterSpacing, ${letterSpacing});\n `);\n};\n\n/**\n * Same as useCustomText except returns an object that can be passed to styleMap\n */\nexport const useCustomTextMap = (\n namespace = \"\",\n {\n fontSize = \"inherit\",\n fontStyle = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n textDecoration = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n letterSpacing = \"normal\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n fontSize: `var(${prefix}-fontSize, ${fontSize})`,\n fontStyle: `var(${prefix}-fontStyle, ${fontStyle})`,\n fontWeight: `var(${prefix}-fontWeight, ${fontWeight})`,\n textTransform: `var(${prefix}-textTransform, ${textTransform})`,\n textDecoration: `var(${prefix}-textDecoration, ${textDecoration})`,\n marginTop: `var(${prefix}-marginTop, ${marginTop})`,\n lineHeight: `var(${prefix}-lineHeight, ${lineHeight})`,\n letterSpacing: `var(${prefix}-letterSpacing, ${letterSpacing})`,\n };\n};\n","import { LANGUAGES } from \"../api-sdk/types\";\nimport { logger } from \"../utils/logger\";\nimport { BeamError } from \"../utils/beam-errors\";\n\n/**\n * User-provided strings may include embedded translations in JSON form\n * This function extracts the string for the provided language\n * If it fails to parse, or the string is not json-like, it returns the whole string\n * TODO: consider returning unsafeHtml() or adding an option for it\n */\nconst localizeUserString = (lang: LANGUAGES, str: string): string => {\n const isJson = str.startsWith(\"{\");\n if (isJson) {\n try {\n const json = JSON.parse(str);\n return json[lang] ?? json[\"en\"] ?? str;\n } catch (err) {\n logger.error(new BeamError(\"Failed to extract JSON translation from string\"), str);\n return str;\n }\n }\n return str;\n};\n\nexport { localizeUserString };\n"],"names":["_cssVariableMap","variables","k","v","AsyncController","host","asyncFn","args","err","strings","_errorMessage","error","retry","details","html","NetworkError","response","MissingConfig","defineCustomText","namespace","fontFamily","fontStyle","fontSize","fontWeight","textTransform","textDecoration","marginTop","lineHeight","color","letterSpacing","prefix","useCustomText","unsafeCSS","localizeUserString","lang","str","json","logger","BeamError"],"mappings":"6JAAO,MAAMA,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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AC,EAAW,UACX,WAAAC,EAAa,UACb,cAAAC,EAAgB,OAChB,eAAAC,EAAiB,OACjB,UAAAC,EAAY,IACZ,WAAAC,EAAa,UACb,MAAAC,EAAQ,UACR,cAAAC,EAAgB,QAClB,EAAI,CAAA,IACU,CACd,MAAMC,EAASX,EAAU,WAAW,SAAS,EAAIA,EAAY,UAAUA,CAAS,GAChF,OAAOa,EAAU,4BACQF,CAAM,gBAAgBV,CAAU;AAAA,0BACjCU,CAAM,eAAeT,CAAS;AAAA,yBAC/BS,CAAM,cAAcR,CAAQ;AAAA,2BAC1BQ,CAAM,gBAAgBP,CAAU;AAAA,8BAC7BO,CAAM,mBAAmBN,CAAa;AAAA,0BAC1CM,CAAM,eAAeJ,CAAS;AAAA,2BAC7BI,CAAM,gBAAgBH,CAAU;AAAA,+BAC5BG,CAAM,oBAAoBL,CAAc;AAAA,qBAClDK,CAAM,WAAWF,CAAK;AAAA,8BACbE,CAAM,mBAAmBD,CAAa;AAAA,KAC/D,CACL,ECvEMI,EAAqB,CAACC,EAAiBC,IAAwB,CAEnE,GADeA,EAAI,WAAW,GAAG,EAE/B,GAAI,CACF,MAAMC,EAAO,KAAK,MAAMD,CAAG,EAC3B,OAAOC,EAAKF,CAAI,GAAKE,EAAK,IAASD,CACrC,MAAc,CACZ,OAAAE,EAAO,MAAM,IAAIC,EAAU,gDAAgD,EAAGH,CAAG,EAC1EA,CACT,CAEF,OAAOA,CACT"}
|
|
1
|
+
{"version":3,"file":"localize-m-_ESmpk.esm.js","sources":["../../src/shared/fragments/css-variable-map.ts","../../src/shared/controllers/async-controller.ts","../../src/shared/fragments/error-message-template.ts","../../src/shared/fragments/custom-text.ts","../../src/shared/localize.ts"],"sourcesContent":["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 { CSSResult, unsafeCSS } from \"lit\";\n\n/**\n * Create an object that can be passed to cssVariableMap\n * to define CSS variables in a style tag. The default properties\n * are the ones exposed for customization in the remote config interface.\n * @example\n * const variables = {\n * ...customizableTextJs(\"widget-header\",\n * \"widget-border-color\": \"red\"\n * };\n *\n * html`<style>:host { ${_cssVariableMap(variables)} }</style>`;\n * @returns {{[p: string]: string}}\n */\nexport const defineCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n textDecoration = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n letterSpacing = \"normal\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n [`${prefix}-fontFamily`]: fontFamily,\n [`${prefix}-fontStyle`]: fontStyle,\n [`${prefix}-fontSize`]: fontSize,\n [`${prefix}-fontWeight`]: fontWeight,\n [`${prefix}-textTransform`]: textTransform,\n [`${prefix}-marginTop`]: marginTop,\n [`${prefix}-lineHeight`]: lineHeight,\n [`${prefix}-color`]: color,\n [`${prefix}-letterSpacing`]: letterSpacing,\n [`${prefix}-textDecoration`]: textDecoration,\n };\n};\n\n/**\n * Returns a string that defines css properties based on variables,\n * which can be used in a css`` template. The default properties are the\n * ones exposed for customization in the remote config interface.\n * @example\n * css`.widget-header { ${customizableTextCss(\"widget-header\")} border: none; }`\n * @returns {CSSResult}\n */\nexport const useCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n textDecoration = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n letterSpacing = \"normal\",\n } = {}\n): CSSResult => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return unsafeCSS(`\\\n font-family: var(${prefix}-fontFamily, ${fontFamily});\n font-style: var(${prefix}-fontStyle, ${fontStyle});\n font-size: var(${prefix}-fontSize, ${fontSize});\n font-weight: var(${prefix}-fontWeight, ${fontWeight});\n text-transform: var(${prefix}-textTransform, ${textTransform});\n margin-top: var(${prefix}-marginTop, ${marginTop});\n line-height: var(${prefix}-lineHeight, ${lineHeight});\n text-decoration: var(${prefix}-textDecoration, ${textDecoration});\n color: var(${prefix}-color, ${color});\n letter-spacing: var(${prefix}-letterSpacing, ${letterSpacing});\n `);\n};\n\n/**\n * Same as useCustomText except returns an object that can be passed to styleMap\n */\nexport const useCustomTextMap = (\n namespace = \"\",\n {\n fontSize = \"inherit\",\n fontStyle = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n textDecoration = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n letterSpacing = \"normal\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n fontSize: `var(${prefix}-fontSize, ${fontSize})`,\n fontStyle: `var(${prefix}-fontStyle, ${fontStyle})`,\n fontWeight: `var(${prefix}-fontWeight, ${fontWeight})`,\n textTransform: `var(${prefix}-textTransform, ${textTransform})`,\n textDecoration: `var(${prefix}-textDecoration, ${textDecoration})`,\n marginTop: `var(${prefix}-marginTop, ${marginTop})`,\n lineHeight: `var(${prefix}-lineHeight, ${lineHeight})`,\n letterSpacing: `var(${prefix}-letterSpacing, ${letterSpacing})`,\n };\n};\n","import { LANGUAGES } from \"../api-sdk/types\";\nimport { logger } from \"../utils/logger\";\nimport { BeamError } from \"../utils/beam-errors\";\n\n/**\n * User-provided strings may include embedded translations in JSON form\n * This function extracts the string for the provided language\n * If it fails to parse, or the string is not json-like, it returns the whole string\n */\nconst localizeUserString = (lang: LANGUAGES, str: string): string => {\n const isJson = str.startsWith(\"{\");\n if (isJson) {\n try {\n const json = JSON.parse(str);\n return json[lang] ?? json[\"en\"] ?? str;\n } catch (err) {\n logger.error(new BeamError(\"Failed to extract JSON translation from string\"), str);\n return str;\n }\n }\n return str;\n};\n\nexport { localizeUserString };\n"],"names":["_cssVariableMap","variables","k","v","AsyncController","host","asyncFn","args","err","strings","_errorMessage","error","retry","details","html","NetworkError","response","MissingConfig","defineCustomText","namespace","fontFamily","fontStyle","fontSize","fontWeight","textTransform","textDecoration","marginTop","lineHeight","color","letterSpacing","prefix","useCustomText","unsafeCSS","localizeUserString","lang","str","json","logger","BeamError"],"mappings":"6JAAO,MAAMA,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,IAC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AMD,CAAG,EAC3B,OAAOC,EAAKF,CAAI,GAAKE,EAAK,IAASD,CACrC,MAAc,CACZ,OAAAE,EAAO,MAAM,IAAIC,EAAU,gDAAgD,EAAGH,CAAG,EAC1EA,CACT,CAEF,OAAOA,CACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localize-o-cYvHQf.esm.js","sources":["../../src/shared/fragments/css-variable-map.ts","../../src/shared/controllers/async-controller.ts","../../src/shared/fragments/error-message-template.ts","../../src/shared/fragments/custom-text.ts","../../src/shared/localize.ts"],"sourcesContent":["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 { CSSResult, unsafeCSS } from \"lit\";\n\n/**\n * Create an object that can be passed to cssVariableMap\n * to define CSS variables in a style tag. The default properties\n * are the ones exposed for customization in the remote config interface.\n * @example\n * const variables = {\n * ...customizableTextJs(\"widget-header\",\n * \"widget-border-color\": \"red\"\n * };\n *\n * html`<style>:host { ${_cssVariableMap(variables)} }</style>`;\n * @returns {{[p: string]: string}}\n */\nexport const defineCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n textDecoration = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n letterSpacing = \"normal\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n [`${prefix}-fontFamily`]: fontFamily,\n [`${prefix}-fontStyle`]: fontStyle,\n [`${prefix}-fontSize`]: fontSize,\n [`${prefix}-fontWeight`]: fontWeight,\n [`${prefix}-textTransform`]: textTransform,\n [`${prefix}-marginTop`]: marginTop,\n [`${prefix}-lineHeight`]: lineHeight,\n [`${prefix}-color`]: color,\n [`${prefix}-letterSpacing`]: letterSpacing,\n [`${prefix}-textDecoration`]: textDecoration,\n };\n};\n\n/**\n * Returns a string that defines css properties based on variables,\n * which can be used in a css`` template. The default properties are the\n * ones exposed for customization in the remote config interface.\n * @example\n * css`.widget-header { ${customizableTextCss(\"widget-header\")} border: none; }`\n * @returns {CSSResult}\n */\nexport const useCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n textDecoration = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n letterSpacing = \"normal\",\n } = {}\n): CSSResult => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return unsafeCSS(`\\\n font-family: var(${prefix}-fontFamily, ${fontFamily});\n font-style: var(${prefix}-fontStyle, ${fontStyle});\n font-size: var(${prefix}-fontSize, ${fontSize});\n font-weight: var(${prefix}-fontWeight, ${fontWeight});\n text-transform: var(${prefix}-textTransform, ${textTransform});\n margin-top: var(${prefix}-marginTop, ${marginTop});\n line-height: var(${prefix}-lineHeight, ${lineHeight});\n text-decoration: var(${prefix}-textDecoration, ${textDecoration});\n color: var(${prefix}-color, ${color});\n letter-spacing: var(${prefix}-letterSpacing, ${letterSpacing});\n `);\n};\n\n/**\n * Same as useCustomText except returns an object that can be passed to styleMap\n */\nexport const useCustomTextMap = (\n namespace = \"\",\n {\n fontSize = \"inherit\",\n fontStyle = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n textDecoration = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n letterSpacing = \"normal\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n fontSize: `var(${prefix}-fontSize, ${fontSize})`,\n fontStyle: `var(${prefix}-fontStyle, ${fontStyle})`,\n fontWeight: `var(${prefix}-fontWeight, ${fontWeight})`,\n textTransform: `var(${prefix}-textTransform, ${textTransform})`,\n textDecoration: `var(${prefix}-textDecoration, ${textDecoration})`,\n marginTop: `var(${prefix}-marginTop, ${marginTop})`,\n lineHeight: `var(${prefix}-lineHeight, ${lineHeight})`,\n letterSpacing: `var(${prefix}-letterSpacing, ${letterSpacing})`,\n };\n};\n","import { LANGUAGES } from \"../api-sdk/types\";\nimport { logger } from \"../utils/logger\";\nimport { BeamError } from \"../utils/beam-errors\";\n\n/**\n * User-provided strings may include embedded translations in JSON form\n * This function extracts the string for the provided language\n * If it fails to parse, or the string is not json-like, it returns the whole string\n * TODO: consider returning unsafeHtml() or adding an option for it\n */\nconst localizeUserString = (lang: LANGUAGES, str: string): string => {\n const isJson = str.startsWith(\"{\");\n if (isJson) {\n try {\n const json = JSON.parse(str);\n return json[lang] ?? json[\"en\"] ?? str;\n } catch (err) {\n logger.error(new BeamError(\"Failed to extract JSON translation from string\"), str);\n return str;\n }\n }\n return str;\n};\n\nexport { localizeUserString };\n"],"names":["_cssVariableMap","variables","k","v","AsyncController","host","asyncFn","args","err","strings","_errorMessage","error","retry","details","html","NetworkError","response","MissingConfig","defineCustomText","namespace","fontFamily","fontStyle","fontSize","fontWeight","textTransform","textDecoration","marginTop","lineHeight","color","letterSpacing","prefix","useCustomText","unsafeCSS","localizeUserString","lang","str","json","logger","BeamError"],"mappings":"iKAAO,MAAMA,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;A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AAMC,EAASX,EAAU,WAAW,SAAS,EAAIA,EAAY,UAAUA,CAAS,GAChF,OAAOa,EAAU,4BACQF,CAAM,gBAAgBV,CAAU;AAAA,0BACjCU,CAAM,eAAeT,CAAS;AAAA,yBAC/BS,CAAM,cAAcR,CAAQ;AAAA,2BAC1BQ,CAAM,gBAAgBP,CAAU;AAAA,8BAC7BO,CAAM,mBAAmBN,CAAa;AAAA,0BAC1CM,CAAM,eAAeJ,CAAS;AAAA,2BAC7BI,CAAM,gBAAgBH,CAAU;AAAA,+BAC5BG,CAAM,oBAAoBL,CAAc;AAAA,qBAClDK,CAAM,WAAWF,CAAK;AAAA,8BACbE,CAAM,mBAAmBD,CAAa;AAAA,KAC/D,CACL,ECvEMI,EAAqB,CAACC,EAAiBC,IAAwB,CAEnE,GADeA,EAAI,WAAW,GAAG,EAE/B,GAAI,CACF,MAAMC,EAAO,KAAK,MAAMD,CAAG,EAC3B,OAAOC,EAAKF,CAAI,GAAKE,EAAK,IAASD,CACrC,MAAc,CACZ,OAAAE,EAAO,MAAM,IAAIC,EAAU,gDAAgD,EAAGH,CAAG,EAC1EA,CACT,CAEF,OAAOA,CACT"}
|
|
1
|
+
{"version":3,"file":"localize-o-cYvHQf.esm.js","sources":["../../src/shared/fragments/css-variable-map.ts","../../src/shared/controllers/async-controller.ts","../../src/shared/fragments/error-message-template.ts","../../src/shared/fragments/custom-text.ts","../../src/shared/localize.ts"],"sourcesContent":["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 { CSSResult, unsafeCSS } from \"lit\";\n\n/**\n * Create an object that can be passed to cssVariableMap\n * to define CSS variables in a style tag. The default properties\n * are the ones exposed for customization in the remote config interface.\n * @example\n * const variables = {\n * ...customizableTextJs(\"widget-header\",\n * \"widget-border-color\": \"red\"\n * };\n *\n * html`<style>:host { ${_cssVariableMap(variables)} }</style>`;\n * @returns {{[p: string]: string}}\n */\nexport const defineCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n textDecoration = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n letterSpacing = \"normal\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n [`${prefix}-fontFamily`]: fontFamily,\n [`${prefix}-fontStyle`]: fontStyle,\n [`${prefix}-fontSize`]: fontSize,\n [`${prefix}-fontWeight`]: fontWeight,\n [`${prefix}-textTransform`]: textTransform,\n [`${prefix}-marginTop`]: marginTop,\n [`${prefix}-lineHeight`]: lineHeight,\n [`${prefix}-color`]: color,\n [`${prefix}-letterSpacing`]: letterSpacing,\n [`${prefix}-textDecoration`]: textDecoration,\n };\n};\n\n/**\n * Returns a string that defines css properties based on variables,\n * which can be used in a css`` template. The default properties are the\n * ones exposed for customization in the remote config interface.\n * @example\n * css`.widget-header { ${customizableTextCss(\"widget-header\")} border: none; }`\n * @returns {CSSResult}\n */\nexport const useCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n textDecoration = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n letterSpacing = \"normal\",\n } = {}\n): CSSResult => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return unsafeCSS(`\\\n font-family: var(${prefix}-fontFamily, ${fontFamily});\n font-style: var(${prefix}-fontStyle, ${fontStyle});\n font-size: var(${prefix}-fontSize, ${fontSize});\n font-weight: var(${prefix}-fontWeight, ${fontWeight});\n text-transform: var(${prefix}-textTransform, ${textTransform});\n margin-top: var(${prefix}-marginTop, ${marginTop});\n line-height: var(${prefix}-lineHeight, ${lineHeight});\n text-decoration: var(${prefix}-textDecoration, ${textDecoration});\n color: var(${prefix}-color, ${color});\n letter-spacing: var(${prefix}-letterSpacing, ${letterSpacing});\n `);\n};\n\n/**\n * Same as useCustomText except returns an object that can be passed to styleMap\n */\nexport const useCustomTextMap = (\n namespace = \"\",\n {\n fontSize = \"inherit\",\n fontStyle = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n textDecoration = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n letterSpacing = \"normal\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n fontSize: `var(${prefix}-fontSize, ${fontSize})`,\n fontStyle: `var(${prefix}-fontStyle, ${fontStyle})`,\n fontWeight: `var(${prefix}-fontWeight, ${fontWeight})`,\n textTransform: `var(${prefix}-textTransform, ${textTransform})`,\n textDecoration: `var(${prefix}-textDecoration, ${textDecoration})`,\n marginTop: `var(${prefix}-marginTop, ${marginTop})`,\n lineHeight: `var(${prefix}-lineHeight, ${lineHeight})`,\n letterSpacing: `var(${prefix}-letterSpacing, ${letterSpacing})`,\n };\n};\n","import { LANGUAGES } from \"../api-sdk/types\";\nimport { logger } from \"../utils/logger\";\nimport { BeamError } from \"../utils/beam-errors\";\n\n/**\n * User-provided strings may include embedded translations in JSON form\n * This function extracts the string for the provided language\n * If it fails to parse, or the string is not json-like, it returns the whole string\n */\nconst localizeUserString = (lang: LANGUAGES, str: string): string => {\n const isJson = str.startsWith(\"{\");\n if (isJson) {\n try {\n const json = JSON.parse(str);\n return json[lang] ?? json[\"en\"] ?? str;\n } catch (err) {\n logger.error(new BeamError(\"Failed to extract JSON translation from string\"), str);\n return str;\n }\n }\n return str;\n};\n\nexport { localizeUserString };\n"],"names":["_cssVariableMap","variables","k","v","AsyncController","host","asyncFn","args","err","strings","_errorMessage","error","retry","details","html","NetworkError","response","MissingConfig","defineCustomText","namespace","fontFamily","fontStyle","fontSize","fontWeight","textTransform","textDecoration","marginTop","lineHeight","color","letterSpacing","prefix","useCustomText","unsafeCSS","localizeUserString","lang","str","json","logger","BeamError"],"mappings":"iKAAO,MAAMA,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,KAA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220,6 +220,8 @@ interface paths {
|
|
|
220
220
|
causeIconUrl?: string | null;
|
|
221
221
|
/** @description The cause selected icon for the extensibility widgets due to color scheme limitations */
|
|
222
222
|
causeIconSelectedUrl?: string | null;
|
|
223
|
+
/** @description The cause selected icon with a background the post purchase extensibility widget due to color scheme limitations */
|
|
224
|
+
causeIconAndBackgroundUrl?: string | null;
|
|
223
225
|
};
|
|
224
226
|
/**
|
|
225
227
|
* @description A URL string
|
|
@@ -754,6 +756,8 @@ interface paths {
|
|
|
754
756
|
causeIconUrl?: string | null;
|
|
755
757
|
/** @description The cause selected icon for the extensibility widgets due to color scheme limitations */
|
|
756
758
|
causeIconSelectedUrl?: string | null;
|
|
759
|
+
/** @description The cause selected icon with a background the post purchase extensibility widget due to color scheme limitations */
|
|
760
|
+
causeIconAndBackgroundUrl?: string | null;
|
|
757
761
|
};
|
|
758
762
|
/**
|
|
759
763
|
* @description A URL string
|
|
@@ -1189,6 +1193,8 @@ interface paths {
|
|
|
1189
1193
|
causeIconUrl?: string | null;
|
|
1190
1194
|
/** @description The cause selected icon for the extensibility widgets due to color scheme limitations */
|
|
1191
1195
|
causeIconSelectedUrl?: string | null;
|
|
1196
|
+
/** @description The cause selected icon with a background the post purchase extensibility widget due to color scheme limitations */
|
|
1197
|
+
causeIconAndBackgroundUrl?: string | null;
|
|
1192
1198
|
};
|
|
1193
1199
|
/**
|
|
1194
1200
|
* @description A URL string
|
|
@@ -1278,6 +1284,8 @@ interface paths {
|
|
|
1278
1284
|
causeIconUrl?: string | null;
|
|
1279
1285
|
/** @description The cause selected icon for the extensibility widgets due to color scheme limitations */
|
|
1280
1286
|
causeIconSelectedUrl?: string | null;
|
|
1287
|
+
/** @description The cause selected icon with a background the post purchase extensibility widget due to color scheme limitations */
|
|
1288
|
+
causeIconAndBackgroundUrl?: string | null;
|
|
1281
1289
|
};
|
|
1282
1290
|
/**
|
|
1283
1291
|
* @description A URL string
|
|
@@ -1564,6 +1572,8 @@ interface paths {
|
|
|
1564
1572
|
causeIconUrl?: string | null;
|
|
1565
1573
|
/** @description The cause selected icon for the extensibility widgets due to color scheme limitations */
|
|
1566
1574
|
causeIconSelectedUrl?: string | null;
|
|
1575
|
+
/** @description The cause selected icon with a background the post purchase extensibility widget due to color scheme limitations */
|
|
1576
|
+
causeIconAndBackgroundUrl?: string | null;
|
|
1567
1577
|
};
|
|
1568
1578
|
/**
|
|
1569
1579
|
* @description A URL string
|
|
@@ -1653,6 +1663,8 @@ interface paths {
|
|
|
1653
1663
|
causeIconUrl?: string | null;
|
|
1654
1664
|
/** @description The cause selected icon for the extensibility widgets due to color scheme limitations */
|
|
1655
1665
|
causeIconSelectedUrl?: string | null;
|
|
1666
|
+
/** @description The cause selected icon with a background the post purchase extensibility widget due to color scheme limitations */
|
|
1667
|
+
causeIconAndBackgroundUrl?: string | null;
|
|
1656
1668
|
};
|
|
1657
1669
|
/**
|
|
1658
1670
|
* @description A URL string
|
|
@@ -2055,6 +2067,8 @@ interface paths {
|
|
|
2055
2067
|
causeIconUrl?: string | null;
|
|
2056
2068
|
/** @description The cause selected icon for the extensibility widgets due to color scheme limitations */
|
|
2057
2069
|
causeIconSelectedUrl?: string | null;
|
|
2070
|
+
/** @description The cause selected icon with a background the post purchase extensibility widget due to color scheme limitations */
|
|
2071
|
+
causeIconAndBackgroundUrl?: string | null;
|
|
2058
2072
|
};
|
|
2059
2073
|
/**
|
|
2060
2074
|
* @description A URL string
|
|
@@ -2144,6 +2158,8 @@ interface paths {
|
|
|
2144
2158
|
causeIconUrl?: string | null;
|
|
2145
2159
|
/** @description The cause selected icon for the extensibility widgets due to color scheme limitations */
|
|
2146
2160
|
causeIconSelectedUrl?: string | null;
|
|
2161
|
+
/** @description The cause selected icon with a background the post purchase extensibility widget due to color scheme limitations */
|
|
2162
|
+
causeIconAndBackgroundUrl?: string | null;
|
|
2147
2163
|
};
|
|
2148
2164
|
/**
|
|
2149
2165
|
* @description A URL string
|
|
@@ -2310,6 +2326,8 @@ interface paths {
|
|
|
2310
2326
|
causeIconUrl?: string | null;
|
|
2311
2327
|
/** @description The cause selected icon for the extensibility widgets due to color scheme limitations */
|
|
2312
2328
|
causeIconSelectedUrl?: string | null;
|
|
2329
|
+
/** @description The cause selected icon with a background the post purchase extensibility widget due to color scheme limitations */
|
|
2330
|
+
causeIconAndBackgroundUrl?: string | null;
|
|
2313
2331
|
};
|
|
2314
2332
|
/**
|
|
2315
2333
|
* @description A URL string
|
|
@@ -2399,6 +2417,8 @@ interface paths {
|
|
|
2399
2417
|
causeIconUrl?: string | null;
|
|
2400
2418
|
/** @description The cause selected icon for the extensibility widgets due to color scheme limitations */
|
|
2401
2419
|
causeIconSelectedUrl?: string | null;
|
|
2420
|
+
/** @description The cause selected icon with a background the post purchase extensibility widget due to color scheme limitations */
|
|
2421
|
+
causeIconAndBackgroundUrl?: string | null;
|
|
2402
2422
|
};
|
|
2403
2423
|
/**
|
|
2404
2424
|
* @description A URL string
|
|
@@ -2697,6 +2717,7 @@ interface paths {
|
|
|
2697
2717
|
}[];
|
|
2698
2718
|
};
|
|
2699
2719
|
};
|
|
2720
|
+
remoteSessionId?: string;
|
|
2700
2721
|
options?: {
|
|
2701
2722
|
response?: {
|
|
2702
2723
|
/** @description Returns the user's overall impact toward the given nonprofit. */
|
|
@@ -2999,6 +3020,8 @@ interface paths {
|
|
|
2999
3020
|
causeIconUrl?: string | null;
|
|
3000
3021
|
/** @description The cause selected icon for the extensibility widgets due to color scheme limitations */
|
|
3001
3022
|
causeIconSelectedUrl?: string | null;
|
|
3023
|
+
/** @description The cause selected icon with a background the post purchase extensibility widget due to color scheme limitations */
|
|
3024
|
+
causeIconAndBackgroundUrl?: string | null;
|
|
3002
3025
|
};
|
|
3003
3026
|
/**
|
|
3004
3027
|
* @description A URL string
|
|
@@ -3088,6 +3111,8 @@ interface paths {
|
|
|
3088
3111
|
causeIconUrl?: string | null;
|
|
3089
3112
|
/** @description The cause selected icon for the extensibility widgets due to color scheme limitations */
|
|
3090
3113
|
causeIconSelectedUrl?: string | null;
|
|
3114
|
+
/** @description The cause selected icon with a background the post purchase extensibility widget due to color scheme limitations */
|
|
3115
|
+
causeIconAndBackgroundUrl?: string | null;
|
|
3091
3116
|
};
|
|
3092
3117
|
/**
|
|
3093
3118
|
* @description A URL string
|
|
@@ -3379,7 +3404,7 @@ interface paths {
|
|
|
3379
3404
|
remoteSubscriptionId: string;
|
|
3380
3405
|
nonprofitId: number | null;
|
|
3381
3406
|
/** @enum {string|null} */
|
|
3382
|
-
selectionMethod?: ("
|
|
3407
|
+
selectionMethod?: ("dashboard" | "remote_order" | "checkout" | "subscription_management_widget") | null;
|
|
3383
3408
|
};
|
|
3384
3409
|
};
|
|
3385
3410
|
};
|
|
@@ -3450,6 +3475,9 @@ interface paths {
|
|
|
3450
3475
|
content: {
|
|
3451
3476
|
"application/json": ({
|
|
3452
3477
|
remoteSubscriptionId: string;
|
|
3478
|
+
options?: {
|
|
3479
|
+
disableDefaultToUniversalSubscriptionIfNotFound?: boolean;
|
|
3480
|
+
};
|
|
3453
3481
|
} & {
|
|
3454
3482
|
[key: string]: unknown;
|
|
3455
3483
|
}) & (Partial<{
|
|
@@ -6695,6 +6723,8 @@ interface paths {
|
|
|
6695
6723
|
/** When set to true, draft themes are returned */
|
|
6696
6724
|
draftConfig?: boolean;
|
|
6697
6725
|
widgetName?: "community-impact" | "impact-overview" | "select-nonprofit" | "redeem-transaction" | "cumulative-impact" | "mobile-full-screen-nonprofit-selection" | "mobile-impact-list" | "mobile-minimal-nonprofit-selection" | "mobile-personal-impact" | "mobile-selected-nonprofit" | "mobile-progress-bar" | "select-nonprofit-cta" | "mobile-share-button" | "subscription-management" | "product-details-page" | "select-subscription-nonprofit" | "subscription-impact";
|
|
6726
|
+
/** The identifier for the product */
|
|
6727
|
+
remoteProductIdentifier?: string;
|
|
6698
6728
|
};
|
|
6699
6729
|
};
|
|
6700
6730
|
responses: {
|
|
@@ -7018,6 +7048,30 @@ interface paths {
|
|
|
7018
7048
|
};
|
|
7019
7049
|
};
|
|
7020
7050
|
};
|
|
7051
|
+
"/compliance/redactCustomer": {
|
|
7052
|
+
delete: {
|
|
7053
|
+
responses: {
|
|
7054
|
+
/** Returns status of the event */
|
|
7055
|
+
200: {
|
|
7056
|
+
content: {
|
|
7057
|
+
"application/json": {
|
|
7058
|
+
/** @enum {string} */
|
|
7059
|
+
status?: "ok" | "error";
|
|
7060
|
+
};
|
|
7061
|
+
};
|
|
7062
|
+
};
|
|
7063
|
+
};
|
|
7064
|
+
requestBody: {
|
|
7065
|
+
content: {
|
|
7066
|
+
"application/json": {
|
|
7067
|
+
email: string;
|
|
7068
|
+
} | {
|
|
7069
|
+
partnerUserId: string;
|
|
7070
|
+
};
|
|
7071
|
+
};
|
|
7072
|
+
};
|
|
7073
|
+
};
|
|
7074
|
+
};
|
|
7021
7075
|
}
|
|
7022
7076
|
|
|
7023
7077
|
export type { paths as p };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as J}from"./lodash-P8OIs-at.esm.js";import{b as O,d as j,c as k,g as D}from"./events-_4nImo3u.esm.js";import{logger as N}from"../utils/logger.esm.js";import{initNetworkListeners as K}from"../utils/network-listeners.esm.js";import{createScopedLocalStorage as S}from"../utils/local-storage.esm.js";import{getCookieValue as B}from"../utils/cookies.esm.js";import{memoizeLast as R}from"../utils/memoize-last.esm.js";import{B as y}from"./cart-contents-h60geKWa.esm.js";import{K as C}from"./update-cart-
|
|
2
|
-
//# sourceMappingURL=order-page
|
|
1
|
+
import{i as J}from"./lodash-P8OIs-at.esm.js";import{b as O,d as j,c as k,g as D}from"./events-_4nImo3u.esm.js";import{logger as N}from"../utils/logger.esm.js";import{initNetworkListeners as K}from"../utils/network-listeners.esm.js";import{createScopedLocalStorage as S}from"../utils/local-storage.esm.js";import{getCookieValue as B}from"../utils/cookies.esm.js";import{memoizeLast as R}from"../utils/memoize-last.esm.js";import{B as y}from"./cart-contents-h60geKWa.esm.js";import{K as C}from"./update-cart-T7h4g2nt.esm.js";import{W as x,D as q}from"./routes-sQWfbAoi.esm.js";import{getExternalCartId as L,getBeamCartId as b}from"../utils/cart.esm.js";import"../components/post-purchase.esm.js";import{waitForElement as M}from"../utils/wait-for-element.esm.js";import{B as P}from"./beam-errors-P-Lu07Ce.esm.js";const T=window.Shopify?.routes?.root||"/";let A=!1;const E="cart";async function W(t){if(A)return!1;const l=await v(t),p=B(E);l.cart.cartId!==p&&await C(t,l.cart),await _({}),K(),window.addEventListener(O.eventName,async s=>{const n=s,r=/cart\/(add|change|update|clear)/,a=n.detail.type==="xhr"?n.detail.xhr.responseURL:n.detail.response.url,e=new URL(a);if(!r.test(e.pathname))return;const i=await v(t);if(!i.changed)return;const c={schema:i.cart.schema,content:{items:i.cart.content.items,discounts:i.cart.content.discounts}};window.dispatchEvent(new j(c)),await C(t,i.cart)});let d,m;return window.addEventListener(k.eventName,async s=>{const n=s,{source:r,selectedNonprofitId:a,selectionId:e}=n.detail;if(r===x.select_nonprofit){const i=L(E,t),c=b(y,t),{chainId:u,storeId:I}=t;if(d===a&&m===e)return;await _({selectedNonprofitId:a,selectionId:e,beamCartId:c||void 0,cartId:i||void 0,chainId:u,storeId:I}),m=e,d=a}}),window.addEventListener(D.eventName,async s=>{const n=s,{newNonprofitId:r,selectionId:a}=n.detail,e=L(E,t),i=b(y,t),{chainId:c,storeId:u}=t;d===r&&m===a||(await _({selectedNonprofitId:r,beamCartId:i||void 0,selectionId:a,cartId:e||void 0,chainId:c,storeId:u}),m=a,d=r)}),A=!0,!0}async function v(t){const{token:l,total_price:p,item_count:d,currency:m,items:s,cart_level_discount_applications:n}=await window.fetch(T+"cart.js",{method:"GET",headers:{"Content-Type":"application/json"}}).then(c=>c.json());let r=!1;const a=S(t).getItemJson("cart"),e=b(y,t),i={cartId:l,beamCartId:e,subtotal:p/100,itemCount:d,currencyCode:m,schema:{source:"generic"},content:{items:s.map(({sku:c,final_line_price:u,product_id:I,line_level_discount_allocations:g})=>{const f=c||String(I),w=u/100,o=g?.map(({discount_application:h})=>({code:h?.title,applicable:!0}));return{remoteProductIdentifier:f,localAmount:w,discounts:o}}),discounts:n.map(({title:c})=>({code:c,applicable:!0}))}};return J(i,{...a,beamCartId:a?.beamCartId})||(r=!0),{changed:r,cart:i}}const F=C,_=R(async function({selectedNonprofitId:t,selectionId:l,beamCartId:p,cartId:d,chainId:m,storeId:s}){let n,r;try{if(window.statsig){const e=window.statsig;n=e.getLayer("beam_trial_layer").get("show_beam",!1),r=e.getStableID()}}catch(e){N.error(e)}const a={beam:JSON.stringify({nonprofit_id:t,selection_id:l,beam_cart_id:p,shopify_cart_id:d,chain_id:m,store_id:s,show_beam:n,remote_session_id:r})};try{await window.fetch(T+"cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:a})})}catch(e){N.error(e)}});async function G({parentSelector:t=".step__sections",apiKey:l,baseUrl:p=q,storeId:d,postalCode:m,countryCode:s,orderId:n,email:r,cartTotal:a,cart:e,discountCodes:i,currencyCode:c="USD",domain:u,lang:I="en",debug:g=!1}){const f=document.querySelector(t)||await M(t);if(!f)throw new P(`Timed out waiting for selector '${t}'. Could not render Beam post-purchase widget.`);const w=await B("cart");if(w){const h=S({apiKey:l}),U=h.getItemJson("cart")||{};h.setItemJson("cart",{...U,cartId:w})}const o=document.createElement("beam-post-purchase");o.apiKey=l,o.baseUrl=p,o.storeId=d,o.postalCode=m,o.countryCode=s,o.orderId=String(n),o.email=r,o.cartTotal=a,o.cart=e,o.discountCodes=i,o.currencyCode=c,o.domain=u,o.lang=I,o.debug=g,f.appendChild(o)}export{W as J,_ as p,F as q,G as s,v as w};
|
|
2
|
+
//# sourceMappingURL=order-page--Xn2Rb6J.esm.js.map
|