@beamimpact/web-sdk 1.36.6 → 1.36.8
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-FglfQ7YP.esm.js +2 -0
- package/dist/chunks/_share-dialog-dependencies-FglfQ7YP.esm.js.map +1 -0
- package/dist/chunks/_share-dialog-dependencies-YbNiVx56.esm.js +2 -0
- package/dist/chunks/_share-dialog-dependencies-YbNiVx56.esm.js.map +1 -0
- package/dist/chunks/beam-errors-P-Lu07Ce.esm.js +2 -0
- package/dist/chunks/beam-errors-P-Lu07Ce.esm.js.map +1 -0
- package/dist/chunks/{beam-errors-bKCZlkvr.esm.d.ts → beam-errors-fXDkG1zo.esm.d.ts} +7 -2
- package/dist/chunks/{cart-contents-tEvcY9ip.esm.d.ts → cart-contents-Shc27L1J.esm.d.ts} +1 -1
- package/dist/chunks/enforce-config-fo8kIfoY.esm.js +22 -0
- package/dist/chunks/enforce-config-fo8kIfoY.esm.js.map +1 -0
- package/dist/chunks/enforce-config-qna7hEL6.esm.js +22 -0
- package/dist/chunks/enforce-config-qna7hEL6.esm.js.map +1 -0
- package/dist/chunks/{events-PZnG_xac.esm.d.ts → events-qTu4iIOo.esm.d.ts} +1 -1
- package/dist/chunks/index-1qXot92e.esm.js +2 -0
- package/dist/chunks/index-1qXot92e.esm.js.map +1 -0
- package/dist/chunks/{index-hbzssC4x.esm.d.ts → index-3Xf6QzNV.esm.d.ts} +1 -1
- package/dist/chunks/{index-aGYbEHXq.esm.js → index-5yFqo0yl.esm.js} +2 -2
- package/dist/chunks/index-5yFqo0yl.esm.js.map +1 -0
- package/dist/chunks/{index-G6h0AEAz.esm.d.ts → index-6t9MtjyS.esm.d.ts} +3 -1
- package/dist/chunks/{index-FAF7tYU6.esm.js → index-9gijHGwh.esm.js} +2 -2
- package/dist/chunks/index-9gijHGwh.esm.js.map +1 -0
- package/dist/chunks/{index-JL12lEnO.esm.js → index-EHubF2KN.esm.js} +2 -2
- package/dist/chunks/index-EHubF2KN.esm.js.map +1 -0
- package/dist/chunks/{index-rOz-i1aX.esm.d.ts → index-EZ_Bg1n7.esm.d.ts} +4 -4
- package/dist/chunks/index-EpanGShY.esm.js +2 -0
- package/dist/chunks/index-EpanGShY.esm.js.map +1 -0
- package/dist/chunks/{index-U2dW3lkm.esm.d.ts → index-GkPHba-I.esm.d.ts} +2 -2
- package/dist/chunks/{index-5-EnaNnJ.esm.d.ts → index-I8DBdgx0.esm.d.ts} +1 -1
- package/dist/chunks/index-IzAvjker.esm.js +2 -0
- package/dist/chunks/index-IzAvjker.esm.js.map +1 -0
- package/dist/chunks/{index-uqEAgdEf.esm.js → index-OnjTwvAw.esm.js} +2 -2
- package/dist/chunks/index-OnjTwvAw.esm.js.map +1 -0
- package/dist/chunks/{index-rrdYIcOi.esm.js → index-U8Oy2aur.esm.js} +2 -2
- package/dist/chunks/index-U8Oy2aur.esm.js.map +1 -0
- package/dist/chunks/index-XMD0b6ql.esm.js +2 -0
- package/dist/chunks/index-XMD0b6ql.esm.js.map +1 -0
- package/dist/chunks/{index-e6o8bmIt.esm.js → index-fqDBrscF.esm.js} +2 -2
- package/dist/chunks/{index-e6o8bmIt.esm.js.map → index-fqDBrscF.esm.js.map} +1 -1
- package/dist/chunks/{index-JfA-djTR.esm.js → index-gULINFkH.esm.js} +2 -2
- package/dist/chunks/{index-JfA-djTR.esm.js.map → index-gULINFkH.esm.js.map} +1 -1
- package/dist/chunks/index-ll8zLjbu.esm.js +2 -0
- package/dist/chunks/index-ll8zLjbu.esm.js.map +1 -0
- package/dist/chunks/index-o7YiP4gC.esm.js +2 -0
- package/dist/chunks/index-o7YiP4gC.esm.js.map +1 -0
- package/dist/chunks/{index--eKbxy32.esm.d.ts → index-oLz4lmx2.esm.d.ts} +3 -1
- package/dist/chunks/{index-PL4iasT1.esm.d.ts → index-pDraUd1x.esm.d.ts} +2 -2
- package/dist/chunks/index-r9Yb1UY4.esm.js +2 -0
- package/dist/chunks/index-r9Yb1UY4.esm.js.map +1 -0
- package/dist/chunks/index-t4uX5Dg1.esm.js +2 -0
- package/dist/chunks/index-t4uX5Dg1.esm.js.map +1 -0
- package/dist/chunks/{index-nJEBkWPL.esm.d.ts → index-wbrSi6cp.esm.d.ts} +1 -1
- package/dist/chunks/{index-w9_XpjIg.esm.js → index-wsdeaTHd.esm.js} +2 -2
- package/dist/chunks/index-wsdeaTHd.esm.js.map +1 -0
- package/dist/chunks/localize-GCkVUD8S.esm.js +10 -0
- package/dist/chunks/localize-GCkVUD8S.esm.js.map +1 -0
- package/dist/chunks/localize-pzAAkBvG.esm.js +10 -0
- package/dist/chunks/localize-pzAAkBvG.esm.js.map +1 -0
- package/dist/chunks/{openapi-spec-tJkr2i9K.esm.d.ts → openapi-spec-D_Zzbl2J.esm.d.ts} +215 -5
- package/dist/chunks/{order-page-LMEdbSdq.esm.js → order-page-JdaAppB7.esm.js} +2 -2
- package/dist/chunks/{order-page-LMEdbSdq.esm.js.map → order-page-JdaAppB7.esm.js.map} +1 -1
- package/dist/chunks/{order-page-sDLRWj-E.esm.js → order-page-W1jR35W9.esm.js} +2 -2
- package/dist/chunks/{order-page-sDLRWj-E.esm.js.map → order-page-W1jR35W9.esm.js.map} +1 -1
- package/dist/chunks/{order-page-cFAaDNWE.esm.d.ts → order-page-ydw5uXTI.esm.d.ts} +21 -2
- package/dist/chunks/routes-CqjzL4oL.esm.js +2 -0
- package/dist/chunks/{routes-bWWE2fXp.esm.js.map → routes-CqjzL4oL.esm.js.map} +1 -1
- package/dist/chunks/routes-lsOWIDmE.esm.js +2 -0
- package/dist/chunks/{routes-h6eWTToy.esm.js.map → routes-lsOWIDmE.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-k_Y-sCyt.esm.js → update-cart-T32-282v.esm.js} +2 -2
- package/dist/chunks/{update-cart-k_Y-sCyt.esm.js.map → update-cart-T32-282v.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-m3NdnSx2.esm.d.ts → update-cart-yCIzgmve.esm.d.ts} +1 -1
- package/dist/chunks/{update-cart-PflL_pK3.esm.js → update-cart-yneR8zk1.esm.js} +2 -2
- package/dist/chunks/{update-cart-PflL_pK3.esm.js.map → update-cart-yneR8zk1.esm.js.map} +1 -1
- package/dist/components/community-impact.esm.js +5 -4
- package/dist/components/community-impact.esm.js.map +1 -1
- package/dist/components/community-impact.js +5 -4
- package/dist/components/community-impact.js.map +1 -1
- package/dist/components/cumulative-impact.esm.js +3 -2
- package/dist/components/cumulative-impact.esm.js.map +1 -1
- package/dist/components/cumulative-impact.js +3 -2
- package/dist/components/cumulative-impact.js.map +1 -1
- package/dist/components/impact-overview.d.ts +0 -2
- package/dist/components/impact-overview.esm.js +6 -5
- package/dist/components/impact-overview.esm.js.map +1 -1
- package/dist/components/impact-overview.js +6 -5
- 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 -4
- package/dist/components/post-purchase.esm.js +4 -5
- package/dist/components/post-purchase.esm.js.map +1 -1
- package/dist/components/post-purchase.js +4 -5
- package/dist/components/post-purchase.js.map +1 -1
- package/dist/components/redeem-transaction.d.ts +16 -6
- package/dist/components/redeem-transaction.esm.js +12 -11
- package/dist/components/redeem-transaction.esm.js.map +1 -1
- package/dist/components/redeem-transaction.js +12 -11
- 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 +2 -1
- package/dist/components/select-nonprofit.esm.js.map +1 -1
- package/dist/components/select-nonprofit.js +2 -1
- package/dist/components/select-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.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 +114 -0
- package/dist/components/subscription-management.esm.js +62 -0
- package/dist/components/subscription-management.esm.js.map +1 -0
- package/dist/components/subscription-management.js +62 -0
- package/dist/components/subscription-management.js.map +1 -0
- package/dist/index.d.ts +16 -14
- 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/session.esm.js +1 -1
- package/dist/integrations/session.js +1 -1
- package/dist/integrations/shopify.d.ts +4 -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 +4 -4
- package/dist/integrations/utils.esm.js +1 -1
- package/dist/integrations/utils.js +1 -1
- package/dist/react/community-impact.esm.js +1 -1
- package/dist/react/community-impact.esm.js.map +1 -1
- package/dist/react/community-impact.js +1 -1
- package/dist/react/community-impact.js.map +1 -1
- package/dist/react/cumulative-impact.esm.js +1 -1
- package/dist/react/cumulative-impact.esm.js.map +1 -1
- package/dist/react/cumulative-impact.js +1 -1
- package/dist/react/cumulative-impact.js.map +1 -1
- package/dist/react/impact-overview.esm.js +1 -1
- package/dist/react/impact-overview.esm.js.map +1 -1
- package/dist/react/impact-overview.js +1 -1
- package/dist/react/impact-overview.js.map +1 -1
- package/dist/react/index.d.ts +5 -3
- 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.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 +3 -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 +3 -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 +11 -0
- package/dist/react/subscription-management.esm.js +2 -0
- package/dist/react/subscription-management.esm.js.map +1 -0
- package/dist/react/subscription-management.js +2 -0
- package/dist/react/subscription-management.js.map +1 -0
- package/dist/utils/beam-errors.d.ts +1 -1
- package/dist/utils/beam-errors.esm.js +1 -1
- package/dist/utils/beam-errors.js +1 -1
- package/dist/utils/cookies.d.ts +1 -1
- package/dist/utils/cookies.esm.js +1 -1
- package/dist/utils/cookies.esm.js.map +1 -1
- package/dist/utils/cookies.js +1 -1
- package/dist/utils/cookies.js.map +1 -1
- package/dist/utils/events.d.ts +3 -3
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/local-storage.esm.js +1 -1
- package/dist/utils/local-storage.js +1 -1
- package/dist/utils/remote-session.esm.js +1 -1
- package/dist/utils/remote-session.js +1 -1
- package/dist/utils/wait-for-element.esm.js +1 -1
- package/dist/utils/wait-for-element.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/_share-dialog-dependencies-7OysCcbl.esm.js +0 -2
- package/dist/chunks/_share-dialog-dependencies-7OysCcbl.esm.js.map +0 -1
- package/dist/chunks/_share-dialog-dependencies-IH8H0M7S.esm.js +0 -2
- package/dist/chunks/_share-dialog-dependencies-IH8H0M7S.esm.js.map +0 -1
- package/dist/chunks/beam-errors-AMvTvR1C.esm.js +0 -2
- package/dist/chunks/beam-errors-AMvTvR1C.esm.js.map +0 -1
- package/dist/chunks/index-D7cyvlBG.esm.js +0 -2
- package/dist/chunks/index-D7cyvlBG.esm.js.map +0 -1
- package/dist/chunks/index-FAF7tYU6.esm.js.map +0 -1
- package/dist/chunks/index-Fvk8qalO.esm.js +0 -2
- package/dist/chunks/index-Fvk8qalO.esm.js.map +0 -1
- package/dist/chunks/index-JL12lEnO.esm.js.map +0 -1
- package/dist/chunks/index-K9rDxqim.esm.js +0 -2
- package/dist/chunks/index-K9rDxqim.esm.js.map +0 -1
- package/dist/chunks/index-LY8cCwxB.esm.js +0 -2
- package/dist/chunks/index-LY8cCwxB.esm.js.map +0 -1
- package/dist/chunks/index-Li9RyHWl.esm.js +0 -2
- package/dist/chunks/index-Li9RyHWl.esm.js.map +0 -1
- package/dist/chunks/index-YfVtHaFO.esm.js +0 -2
- package/dist/chunks/index-YfVtHaFO.esm.js.map +0 -1
- package/dist/chunks/index-YoXRWj_4.esm.js +0 -2
- package/dist/chunks/index-YoXRWj_4.esm.js.map +0 -1
- package/dist/chunks/index-aGYbEHXq.esm.js.map +0 -1
- package/dist/chunks/index-bo9Yq4jd.esm.js +0 -2
- package/dist/chunks/index-bo9Yq4jd.esm.js.map +0 -1
- package/dist/chunks/index-rrdYIcOi.esm.js.map +0 -1
- package/dist/chunks/index-uqEAgdEf.esm.js.map +0 -1
- package/dist/chunks/index-w9_XpjIg.esm.js.map +0 -1
- package/dist/chunks/localize-BGPniqcI.esm.js +0 -30
- package/dist/chunks/localize-BGPniqcI.esm.js.map +0 -1
- package/dist/chunks/localize-dXHrlK8g.esm.js +0 -30
- package/dist/chunks/localize-dXHrlK8g.esm.js.map +0 -1
- package/dist/chunks/routes-bWWE2fXp.esm.js +0 -2
- package/dist/chunks/routes-h6eWTToy.esm.js +0 -2
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as lit from 'lit';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import * as lit_html from 'lit-html';
|
|
4
|
+
import { L as LANGUAGES } from '../chunks/types-aju0qrRe.esm.js';
|
|
5
|
+
import { T as TCart } from '../chunks/cart-contents-Shc27L1J.esm.js';
|
|
6
|
+
import '../chunks/openapi-spec-D_Zzbl2J.esm.js';
|
|
7
|
+
|
|
8
|
+
declare class BeamSubscriptionManagement extends LitElement {
|
|
9
|
+
static tagName: string;
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
apiKey: string;
|
|
12
|
+
subscriptionId: string;
|
|
13
|
+
storeId?: number;
|
|
14
|
+
email: string;
|
|
15
|
+
postalCode?: string;
|
|
16
|
+
countryCode?: string;
|
|
17
|
+
lang: LANGUAGES;
|
|
18
|
+
cart?: TCart;
|
|
19
|
+
debug: boolean;
|
|
20
|
+
private activeWidget;
|
|
21
|
+
private nonprofitId;
|
|
22
|
+
private userId;
|
|
23
|
+
private chainName;
|
|
24
|
+
private subscriptionDataController;
|
|
25
|
+
private eligibleNonprofitsDataController;
|
|
26
|
+
firstUpdated(): Promise<void>;
|
|
27
|
+
loadWidget(): Promise<void>;
|
|
28
|
+
fetchEligibleNonprofits(): Promise<{
|
|
29
|
+
chain: {
|
|
30
|
+
name: string;
|
|
31
|
+
logoUrl: string | null;
|
|
32
|
+
communityImpactUrl: string | null;
|
|
33
|
+
donationTypeName: string | null;
|
|
34
|
+
matchDonationTypeName: string | null;
|
|
35
|
+
};
|
|
36
|
+
config: {
|
|
37
|
+
web: {
|
|
38
|
+
title: string;
|
|
39
|
+
description: string;
|
|
40
|
+
theme?: {
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
} | null | undefined;
|
|
43
|
+
nonprofitSelectedHeader?: string | undefined;
|
|
44
|
+
nonprofitUnselectedHeader?: string | undefined;
|
|
45
|
+
disableAnimation?: boolean | undefined;
|
|
46
|
+
};
|
|
47
|
+
mobileWeb?: {
|
|
48
|
+
title: string;
|
|
49
|
+
description: string;
|
|
50
|
+
nonprofitSelectedHeader?: string | undefined;
|
|
51
|
+
nonprofitUnselectedHeader?: string | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
mobile: {
|
|
54
|
+
title: string;
|
|
55
|
+
description: string;
|
|
56
|
+
nonprofitSelectedHeader?: string | undefined;
|
|
57
|
+
nonprofitUnselectedHeader?: string | undefined;
|
|
58
|
+
};
|
|
59
|
+
enableNonprofitDeselection?: boolean | undefined;
|
|
60
|
+
} & {
|
|
61
|
+
web?: {
|
|
62
|
+
redeemButtonText?: string | undefined;
|
|
63
|
+
} | undefined;
|
|
64
|
+
mobileWeb?: {
|
|
65
|
+
redeemButtonText?: string | undefined;
|
|
66
|
+
} | undefined;
|
|
67
|
+
mobile?: {
|
|
68
|
+
redeemButtonText?: string | undefined;
|
|
69
|
+
} | undefined;
|
|
70
|
+
};
|
|
71
|
+
nonprofits: {
|
|
72
|
+
imageUrl: Partial<string | null>;
|
|
73
|
+
nonprofit: {
|
|
74
|
+
id: number;
|
|
75
|
+
name: string;
|
|
76
|
+
cause: string | null;
|
|
77
|
+
causeIconUrl: string | null;
|
|
78
|
+
causeIconSelectedUrl: string | null;
|
|
79
|
+
causeColor: string | null;
|
|
80
|
+
website: string | null;
|
|
81
|
+
websiteLinkText: string;
|
|
82
|
+
badge?: string | undefined;
|
|
83
|
+
};
|
|
84
|
+
impact: {
|
|
85
|
+
description: string | null;
|
|
86
|
+
goalCompletionText: string;
|
|
87
|
+
goalProgressText: string;
|
|
88
|
+
goalProgressPercentage: number;
|
|
89
|
+
};
|
|
90
|
+
}[];
|
|
91
|
+
store: {
|
|
92
|
+
id: number;
|
|
93
|
+
};
|
|
94
|
+
}>;
|
|
95
|
+
fetchSubscription(): Promise<{
|
|
96
|
+
beamUserId: string;
|
|
97
|
+
remoteSubscriptionId: string;
|
|
98
|
+
nonprofit: {
|
|
99
|
+
id: number;
|
|
100
|
+
} | null;
|
|
101
|
+
}>;
|
|
102
|
+
handleSwapNonprofitButtonClick(): void;
|
|
103
|
+
renderSwapNonprofitButton(): "" | lit_html.TemplateResult<1>;
|
|
104
|
+
get cssVariables(): any;
|
|
105
|
+
static styles: lit.CSSResult[];
|
|
106
|
+
render(): lit_html.TemplateResult<1>;
|
|
107
|
+
}
|
|
108
|
+
declare global {
|
|
109
|
+
interface HTMLElementTagNameMap {
|
|
110
|
+
"beam-subscription-management": BeamSubscriptionManagement;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export { BeamSubscriptionManagement };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import{f as g,g as o,t as p,h as f,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as y,b as S,h as w}from"../chunks/routes-lsOWIDmE.esm.js";import{c as v,d as x,A as m,e as b,a as C,_ as h}from"../chunks/enforce-config-qna7hEL6.esm.js";import{c as N}from"../chunks/events-5IECSF-x.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";const M={en:{nonprofitSwapText:({brandName:i=""})=>`Support a new nonprofit with your next ${i} recurring order`},fr:{nonprofitSwapText:({brandName:i=""})=>`Soutenez une nouvelle organisation \xE0 but non lucratif avec votre prochaine commande r\xE9currente ${i}`},de:{nonprofitSwapText:({brandName:i=""})=>`Unterst\xFCtzen Sie eine neue gemeinn\xFCtzige Organisation mit Ihrer n\xE4chsten wiederkehrenden Bestellung bei ${i}`},es:{nonprofitSwapText:({brandName:i=""})=>`Apoye a una nueva organizaci\xF3n sin fines de lucro con su pr\xF3ximo pedido recurrente ${i}`},it:{nonprofitSwapText:({brandName:i=""})=>`Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${i}`},pl:{nonprofitSwapText:({brandName:i=""})=>`Wesprzyj now\u0105 organizacj\u0119 non-profit przy kolejnym zam\xF3wieniu cyklicznym ${i}`}};var B=Object.defineProperty,$=Object.getOwnPropertyDescriptor,n=(i,t,r,a)=>{for(var s=a>1?void 0:a?$(t,r):t,c=i.length-1,d;c>=0;c--)(d=i[c])&&(s=(a?d(t,r,s):d(s))||s);return a&&s&&B(t,r,s),s};const u=["baseUrl","apiKey","subscriptionId","email","lang"];class e extends f{constructor(){super(...arguments),this.baseUrl=y,this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.userId=null,this.chainName=null,this.subscriptionDataController=new m(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new m(this,this.fetchEligibleNonprofits)}async firstUpdated(){b(u,this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){b(u,this);const t=await S({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{postalCode:this.postalCode?this.postalCode:void 0,countryCode:this.countryCode?this.countryCode:void 0,widgetName:"subscription-management",version:"1.0.0"}});return this.chainName=t.chain.name,this.storeId=t.store.id,t}async fetchSubscription(){b(u,this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email}});return this.userId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}handleSwapNonprofitButtonClick(){this.activeWidget="redeem-transaction"}renderSwapNonprofitButton(){return this.activeWidget==="impact-overview"?l`<button class="swap-nonprofit-button" @click="${this.handleSwapNonprofitButtonClick}">
|
|
2
|
+
${M[this.lang].nonprofitSwapText({brandName:this.chainName||""})}
|
|
3
|
+
</button>`:""}get cssVariables(){const t={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-borderColor":"#d5d5d5","--beam-SubscriptionManagement-widgetContainer-borderRadius":"4px","--beam-SubscriptionManagement-widgetContainer-padding":"15px","--beam-SubscriptionManagement-widgetContainer-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-maxWidth":"800px","--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration":"underline","--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop":"10px","--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-color":"inherit"},r=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},a={...t,...r};return Object.assign(Object.create({toCSS(){return C(this)}}),a)}render(){let t;if((this.subscriptionDataController.loading||this.eligibleNonprofitsDataController.loading)&&(t=""),(this.subscriptionDataController.error||this.eligibleNonprofitsDataController.error)&&this.debug){if(this.subscriptionDataController.error!==null)return h({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return h({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=l` <beam-redeem-transaction
|
|
4
|
+
part="redeem-transaction"
|
|
5
|
+
subscriptionId="${this.subscriptionId}"
|
|
6
|
+
nonprofitId=${this.nonprofitId}
|
|
7
|
+
baseUrl="${this.baseUrl}"
|
|
8
|
+
apiKey="${this.apiKey}"
|
|
9
|
+
lang="${this.lang}"
|
|
10
|
+
?debug="${this.debug}"
|
|
11
|
+
@beamnonprofitselect="${r=>{if(!(r instanceof N))return;const{selectedNonprofitId:a}=r.detail;this.nonprofitId=a??null,this.activeWidget="impact-overview"}}"
|
|
12
|
+
></beam-redeem-transaction>`:this.activeWidget==="impact-overview"&&(t=l`
|
|
13
|
+
<beam-impact-overview
|
|
14
|
+
part="impact-overview"
|
|
15
|
+
baseUrl="${this.baseUrl}"
|
|
16
|
+
apiKey="${this.apiKey}"
|
|
17
|
+
userId="${this.userId}"
|
|
18
|
+
nonprofitId="${this.nonprofitId}"
|
|
19
|
+
lang="${this.lang}"
|
|
20
|
+
?debug="${this.debug}"
|
|
21
|
+
></beam-impact-overview>
|
|
22
|
+
`),l`
|
|
23
|
+
<style>
|
|
24
|
+
:host {
|
|
25
|
+
${this.cssVariables.toCSS()}
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
28
|
+
<div class="sub-widget-container">${t}</div>
|
|
29
|
+
${this.renderSwapNonprofitButton()}
|
|
30
|
+
`}}e.tagName="beam-subscription-management",e.styles=[v,g`
|
|
31
|
+
:host {
|
|
32
|
+
display: block;
|
|
33
|
+
font-family: var(--beam-fontFamily);
|
|
34
|
+
font-style: var(--beam-fontStyle);
|
|
35
|
+
font-size: var(--beam-fontSize);
|
|
36
|
+
background-color: var(--beam-backgroundColor);
|
|
37
|
+
color: var(--beam-textColor);
|
|
38
|
+
word-break: normal;
|
|
39
|
+
}
|
|
40
|
+
.swap-nonprofit-button {
|
|
41
|
+
margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);
|
|
42
|
+
color: var(--beam-SubscriptionManagement-swapNonprofitButtonText-color, inherit);
|
|
43
|
+
font-size: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize, inherit);
|
|
44
|
+
text-decoration: var(--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration, underline);
|
|
45
|
+
font-family: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily, inherit);
|
|
46
|
+
font-style: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle, inherit);
|
|
47
|
+
font-weight: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight, inherit);
|
|
48
|
+
line-height: var(--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight, inherit);
|
|
49
|
+
background: none;
|
|
50
|
+
border: none;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
}
|
|
53
|
+
.sub-widget-container {
|
|
54
|
+
background-color: var(--beam-SubscriptionManagement-widgetContainer-backgroundColor, inherit);
|
|
55
|
+
border: 1px solid var(--beam-SubscriptionManagement-widgetContainer-borderColor, #d5d5d5);
|
|
56
|
+
border-radius: var(--beam-SubscriptionManagement-widgetContainer-borderRadius, 4px);
|
|
57
|
+
overflow: hidden; /* maintain clean border-radius */
|
|
58
|
+
padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);
|
|
59
|
+
max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);
|
|
60
|
+
}
|
|
61
|
+
}`],n([o({type:String})],e.prototype,"baseUrl",2),n([o({type:String})],e.prototype,"apiKey",2),n([o({type:String})],e.prototype,"subscriptionId",2),n([o({type:Number,reflect:!0})],e.prototype,"storeId",2),n([o({type:String})],e.prototype,"email",2),n([o({type:String})],e.prototype,"postalCode",2),n([o({type:String})],e.prototype,"countryCode",2),n([o({type:String})],e.prototype,"lang",2),n([o({type:Object})],e.prototype,"cart",2),n([o({type:Boolean})],e.prototype,"debug",2),n([p()],e.prototype,"activeWidget",2),n([p()],e.prototype,"nonprofitId",2),n([p()],e.prototype,"userId",2),n([p()],e.prototype,"chainName",2),x(e);export{e as BeamSubscriptionManagement};
|
|
62
|
+
//# sourceMappingURL=subscription-management.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-management.esm.js","sources":["../../src/components/subscription-management/strings.ts","../../src/components/subscription-management/index.ts"],"sourcesContent":["export const strings = {\n en: {\n nonprofitSwapText: ({ brandName = \"\" }) => `Support a new nonprofit with your next ${brandName} recurring order`,\n },\n fr: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Soutenez une nouvelle organisation à but non lucratif avec votre prochaine commande récurrente ${brandName}`,\n },\n de: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Unterstützen Sie eine neue gemeinnützige Organisation mit Ihrer nächsten wiederkehrenden Bestellung bei ${brandName}`,\n },\n es: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Apoye a una nueva organización sin fines de lucro con su próximo pedido recurrente ${brandName}`,\n },\n it: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${brandName}`,\n },\n pl: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Wesprzyj nową organizację non-profit przy kolejnym zamówieniu cyklicznym ${brandName}`,\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { TCart } from \"../../shared/cart-contents\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { postFindSubscription, postChainEligibleNonprofitsForCart } from \"../../api-sdk/v3/routes\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { BeamNonprofitSelectEvent } from \"../../utils/events\";\nimport { strings } from \"./strings\";\n\nconst REQUIRED_DATA_PROPS = [\"baseUrl\", \"apiKey\", \"subscriptionId\", \"email\", \"lang\"];\n\nexport class BeamSubscriptionManagement extends LitElement {\n static tagName = \"beam-subscription-management\";\n\n @property({ type: String })\n public baseUrl: string = DEFAULT_BASE_URL;\n\n @property({ type: String })\n public apiKey!: string;\n\n @property({ type: String })\n public subscriptionId!: string;\n\n @property({ type: Number, reflect: true })\n public storeId?: number; // Either storeId or postalCode, countryCode must be provided\n\n @property({ type: String })\n public email!: string;\n\n @property({ type: String })\n public postalCode?: string;\n\n @property({ type: String })\n public countryCode?: string;\n\n @property({ type: String })\n public lang: LANGUAGES = \"en\";\n\n @property({ type: Object })\n public cart?: TCart;\n\n @property({ type: Boolean })\n public debug = false;\n\n @state() private activeWidget: \"redeem-transaction\" | \"impact-overview\" | null = null; // Based on /findSubscriptionByRemoteId\n @state() private nonprofitId: number | null = null; // From /findSubscriptionByRemoteId response\n @state() private userId: string | null = null; // From findSubscriptionByRemoteId\n @state() private chainName: string | null = null; // From findEligibleNonprofitsForCart\n\n private subscriptionDataController = new AsyncController<typeof this.fetchSubscription>(this, this.fetchSubscription);\n private eligibleNonprofitsDataController = new AsyncController<typeof this.fetchEligibleNonprofits>(\n this,\n this.fetchEligibleNonprofits\n );\n\n async firstUpdated() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n await this.loadWidget();\n }\n\n async loadWidget() {\n // In parallel:\n // (1). Fetch eligible nonprofits [storeId and chainName]\n // (2). Fetch subscription [userId and nonprofitId]\n await Promise.all([this.fetchEligibleNonprofits(), this.fetchSubscription()]);\n this.activeWidget = this.nonprofitId ? \"impact-overview\" : \"redeem-transaction\";\n }\n\n async fetchEligibleNonprofits() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n postalCode: this.postalCode ? this.postalCode : undefined,\n countryCode: this.countryCode ? this.countryCode : undefined,\n widgetName: \"subscription-management\",\n version: \"1.0.0\",\n },\n });\n this.chainName = res.chain.name;\n this.storeId = res.store.id;\n return res;\n }\n\n async fetchSubscription() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n const result = await postFindSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n },\n });\n\n this.userId = result.beamUserId; // Returned in response regardless of subscription redemption\n this.nonprofitId = result.nonprofit?.id || null;\n return result;\n }\n\n handleSwapNonprofitButtonClick() {\n this.activeWidget = \"redeem-transaction\";\n }\n\n renderSwapNonprofitButton() {\n if (this.activeWidget === \"impact-overview\") {\n return html`<button class=\"swap-nonprofit-button\" @click=\"${this.handleSwapNonprofitButtonClick}\">\n ${strings[this.lang].nonprofitSwapText({ brandName: this.chainName || \"\" })}\n </button>`;\n } else {\n return \"\";\n }\n }\n\n public get cssVariables() {\n const defaults = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-borderColor\": \"#d5d5d5\",\n \"--beam-SubscriptionManagement-widgetContainer-borderRadius\": \"4px\",\n \"--beam-SubscriptionManagement-widgetContainer-padding\": \"15px\",\n \"--beam-SubscriptionManagement-widgetContainer-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-maxWidth\": \"800px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration\": \"underline\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop\": \"10px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-color\": \"inherit\",\n };\n\n const remoteConfig = this.eligibleNonprofitsDataController?.data?.config?.web?.theme || {};\n\n const config = { ...defaults, ...remoteConfig };\n\n const serializable = Object.create({\n toCSS() {\n return _cssVariableMap(this as Record<string, string>);\n },\n });\n return Object.assign(serializable, config);\n }\n\n static styles = [\n cssReset,\n css`\n :host {\n display: block;\n font-family: var(--beam-fontFamily);\n font-style: var(--beam-fontStyle);\n font-size: var(--beam-fontSize);\n background-color: var(--beam-backgroundColor);\n color: var(--beam-textColor);\n word-break: normal;\n }\n .swap-nonprofit-button {\n margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);\n color: var(--beam-SubscriptionManagement-swapNonprofitButtonText-color, inherit);\n font-size: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize, inherit);\n text-decoration: var(--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration, underline);\n font-family: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily, inherit);\n font-style: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle, inherit);\n font-weight: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight, inherit);\n line-height: var(--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight, inherit);\n background: none;\n border: none;\n cursor: pointer;\n }\n .sub-widget-container {\n background-color: var(--beam-SubscriptionManagement-widgetContainer-backgroundColor, inherit);\n border: 1px solid var(--beam-SubscriptionManagement-widgetContainer-borderColor, #d5d5d5);\n border-radius: var(--beam-SubscriptionManagement-widgetContainer-borderRadius, 4px);\n overflow: hidden; /* maintain clean border-radius */\n padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);\n max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);\n }\n }`,\n ];\n\n render() {\n let content;\n\n if (this.subscriptionDataController.loading || this.eligibleNonprofitsDataController.loading) {\n content = \"\";\n }\n\n if ((this.subscriptionDataController.error || this.eligibleNonprofitsDataController.error) && this.debug) {\n if (this.subscriptionDataController.error !== null) {\n return _errorMessage({ error: this.subscriptionDataController.error });\n } else if (this.eligibleNonprofitsDataController.error !== null) {\n return _errorMessage({ error: this.eligibleNonprofitsDataController.error });\n }\n } else {\n content = \"\";\n }\n\n if (this.activeWidget === \"redeem-transaction\") {\n content = html` <beam-redeem-transaction\n part=\"redeem-transaction\"\n subscriptionId=\"${this.subscriptionId}\"\n nonprofitId=${this.nonprofitId}\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n @beamnonprofitselect=\"${(event: Event) => {\n if (!(event instanceof BeamNonprofitSelectEvent)) return; // TS guard\n const { selectedNonprofitId } = event.detail;\n this.nonprofitId = selectedNonprofitId ?? null;\n this.activeWidget = \"impact-overview\";\n }}\"\n ></beam-redeem-transaction>`;\n } else if (this.activeWidget === \"impact-overview\") {\n content = html`\n <beam-impact-overview\n part=\"impact-overview\"\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n userId=\"${this.userId}\"\n nonprofitId=\"${this.nonprofitId}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n ></beam-impact-overview>\n `;\n }\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div class=\"sub-widget-container\">${content}</div>\n ${this.renderSwapNonprofitButton()}\n `;\n }\n}\n\ndefineCustomElement(BeamSubscriptionManagement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-subscription-management\": BeamSubscriptionManagement;\n }\n}\n"],"names":["strings","brandName","f","h","i","l","n","t","o","e","a","b","REQUIRED_DATA_PROPS","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","event","BeamNonprofitSelectEvent","selectedNonprofitId","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"mXAAO,MAAMA,EAAU,CACrB,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAC,EAAY,EAAG,IAAM,0CAA0CA,CAAS,kBAChG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,wGAAkGA,CAAS,EAC/G,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,oHAA2GA,CAAS,EACxH,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,4FAAsFA,CAAS,EACnG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,sFAAsF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AAhBE,EAAM,CAAA,EAnCIvB,EAmCM,UAAA,SAAA,CAAA,EACAqB,EAAA,CAAhBE,EAAM,CAAA,EApCIvB,EAoCM,UAAA,YAAA,CAAA,EAwMnBwB,EAAoBxB,CAA0B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import{f as g,g as o,t as p,h as f,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as y,b as S,h as w}from"../chunks/routes-CqjzL4oL.esm.js";import{c as v,d as x,A as m,e as b,a as C,_ as h}from"../chunks/enforce-config-fo8kIfoY.esm.js";import{c as N}from"../chunks/events-5IECSF-x.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";const M={en:{nonprofitSwapText:({brandName:i=""})=>`Support a new nonprofit with your next ${i} recurring order`},fr:{nonprofitSwapText:({brandName:i=""})=>`Soutenez une nouvelle organisation \xE0 but non lucratif avec votre prochaine commande r\xE9currente ${i}`},de:{nonprofitSwapText:({brandName:i=""})=>`Unterst\xFCtzen Sie eine neue gemeinn\xFCtzige Organisation mit Ihrer n\xE4chsten wiederkehrenden Bestellung bei ${i}`},es:{nonprofitSwapText:({brandName:i=""})=>`Apoye a una nueva organizaci\xF3n sin fines de lucro con su pr\xF3ximo pedido recurrente ${i}`},it:{nonprofitSwapText:({brandName:i=""})=>`Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${i}`},pl:{nonprofitSwapText:({brandName:i=""})=>`Wesprzyj now\u0105 organizacj\u0119 non-profit przy kolejnym zam\xF3wieniu cyklicznym ${i}`}};var B=Object.defineProperty,$=Object.getOwnPropertyDescriptor,n=(i,t,r,a)=>{for(var s=a>1?void 0:a?$(t,r):t,c=i.length-1,d;c>=0;c--)(d=i[c])&&(s=(a?d(t,r,s):d(s))||s);return a&&s&&B(t,r,s),s};const u=["baseUrl","apiKey","subscriptionId","email","lang"];class e extends f{constructor(){super(...arguments),this.baseUrl=y,this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.userId=null,this.chainName=null,this.subscriptionDataController=new m(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new m(this,this.fetchEligibleNonprofits)}async firstUpdated(){b(u,this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){b(u,this);const t=await S({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{postalCode:this.postalCode?this.postalCode:void 0,countryCode:this.countryCode?this.countryCode:void 0,widgetName:"subscription-management",version:"1.0.0"}});return this.chainName=t.chain.name,this.storeId=t.store.id,t}async fetchSubscription(){b(u,this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email}});return this.userId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}handleSwapNonprofitButtonClick(){this.activeWidget="redeem-transaction"}renderSwapNonprofitButton(){return this.activeWidget==="impact-overview"?l`<button class="swap-nonprofit-button" @click="${this.handleSwapNonprofitButtonClick}">
|
|
2
|
+
${M[this.lang].nonprofitSwapText({brandName:this.chainName||""})}
|
|
3
|
+
</button>`:""}get cssVariables(){const t={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-borderColor":"#d5d5d5","--beam-SubscriptionManagement-widgetContainer-borderRadius":"4px","--beam-SubscriptionManagement-widgetContainer-padding":"15px","--beam-SubscriptionManagement-widgetContainer-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-maxWidth":"800px","--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration":"underline","--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop":"10px","--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-color":"inherit"},r=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},a={...t,...r};return Object.assign(Object.create({toCSS(){return C(this)}}),a)}render(){let t;if((this.subscriptionDataController.loading||this.eligibleNonprofitsDataController.loading)&&(t=""),(this.subscriptionDataController.error||this.eligibleNonprofitsDataController.error)&&this.debug){if(this.subscriptionDataController.error!==null)return h({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return h({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=l` <beam-redeem-transaction
|
|
4
|
+
part="redeem-transaction"
|
|
5
|
+
subscriptionId="${this.subscriptionId}"
|
|
6
|
+
nonprofitId=${this.nonprofitId}
|
|
7
|
+
baseUrl="${this.baseUrl}"
|
|
8
|
+
apiKey="${this.apiKey}"
|
|
9
|
+
lang="${this.lang}"
|
|
10
|
+
?debug="${this.debug}"
|
|
11
|
+
@beamnonprofitselect="${r=>{if(!(r instanceof N))return;const{selectedNonprofitId:a}=r.detail;this.nonprofitId=a??null,this.activeWidget="impact-overview"}}"
|
|
12
|
+
></beam-redeem-transaction>`:this.activeWidget==="impact-overview"&&(t=l`
|
|
13
|
+
<beam-impact-overview
|
|
14
|
+
part="impact-overview"
|
|
15
|
+
baseUrl="${this.baseUrl}"
|
|
16
|
+
apiKey="${this.apiKey}"
|
|
17
|
+
userId="${this.userId}"
|
|
18
|
+
nonprofitId="${this.nonprofitId}"
|
|
19
|
+
lang="${this.lang}"
|
|
20
|
+
?debug="${this.debug}"
|
|
21
|
+
></beam-impact-overview>
|
|
22
|
+
`),l`
|
|
23
|
+
<style>
|
|
24
|
+
:host {
|
|
25
|
+
${this.cssVariables.toCSS()}
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
28
|
+
<div class="sub-widget-container">${t}</div>
|
|
29
|
+
${this.renderSwapNonprofitButton()}
|
|
30
|
+
`}}e.tagName="beam-subscription-management",e.styles=[v,g`
|
|
31
|
+
:host {
|
|
32
|
+
display: block;
|
|
33
|
+
font-family: var(--beam-fontFamily);
|
|
34
|
+
font-style: var(--beam-fontStyle);
|
|
35
|
+
font-size: var(--beam-fontSize);
|
|
36
|
+
background-color: var(--beam-backgroundColor);
|
|
37
|
+
color: var(--beam-textColor);
|
|
38
|
+
word-break: normal;
|
|
39
|
+
}
|
|
40
|
+
.swap-nonprofit-button {
|
|
41
|
+
margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);
|
|
42
|
+
color: var(--beam-SubscriptionManagement-swapNonprofitButtonText-color, inherit);
|
|
43
|
+
font-size: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize, inherit);
|
|
44
|
+
text-decoration: var(--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration, underline);
|
|
45
|
+
font-family: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily, inherit);
|
|
46
|
+
font-style: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle, inherit);
|
|
47
|
+
font-weight: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight, inherit);
|
|
48
|
+
line-height: var(--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight, inherit);
|
|
49
|
+
background: none;
|
|
50
|
+
border: none;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
}
|
|
53
|
+
.sub-widget-container {
|
|
54
|
+
background-color: var(--beam-SubscriptionManagement-widgetContainer-backgroundColor, inherit);
|
|
55
|
+
border: 1px solid var(--beam-SubscriptionManagement-widgetContainer-borderColor, #d5d5d5);
|
|
56
|
+
border-radius: var(--beam-SubscriptionManagement-widgetContainer-borderRadius, 4px);
|
|
57
|
+
overflow: hidden; /* maintain clean border-radius */
|
|
58
|
+
padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);
|
|
59
|
+
max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);
|
|
60
|
+
}
|
|
61
|
+
}`],n([o({type:String})],e.prototype,"baseUrl",2),n([o({type:String})],e.prototype,"apiKey",2),n([o({type:String})],e.prototype,"subscriptionId",2),n([o({type:Number,reflect:!0})],e.prototype,"storeId",2),n([o({type:String})],e.prototype,"email",2),n([o({type:String})],e.prototype,"postalCode",2),n([o({type:String})],e.prototype,"countryCode",2),n([o({type:String})],e.prototype,"lang",2),n([o({type:Object})],e.prototype,"cart",2),n([o({type:Boolean})],e.prototype,"debug",2),n([p()],e.prototype,"activeWidget",2),n([p()],e.prototype,"nonprofitId",2),n([p()],e.prototype,"userId",2),n([p()],e.prototype,"chainName",2),x(e);export{e as BeamSubscriptionManagement};
|
|
62
|
+
//# sourceMappingURL=subscription-management.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-management.js","sources":["../../src/components/subscription-management/strings.ts","../../src/components/subscription-management/index.ts"],"sourcesContent":["export const strings = {\n en: {\n nonprofitSwapText: ({ brandName = \"\" }) => `Support a new nonprofit with your next ${brandName} recurring order`,\n },\n fr: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Soutenez une nouvelle organisation à but non lucratif avec votre prochaine commande récurrente ${brandName}`,\n },\n de: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Unterstützen Sie eine neue gemeinnützige Organisation mit Ihrer nächsten wiederkehrenden Bestellung bei ${brandName}`,\n },\n es: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Apoye a una nueva organización sin fines de lucro con su próximo pedido recurrente ${brandName}`,\n },\n it: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${brandName}`,\n },\n pl: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Wesprzyj nową organizację non-profit przy kolejnym zamówieniu cyklicznym ${brandName}`,\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { TCart } from \"../../shared/cart-contents\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { postFindSubscription, postChainEligibleNonprofitsForCart } from \"../../api-sdk/v3/routes\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { BeamNonprofitSelectEvent } from \"../../utils/events\";\nimport { strings } from \"./strings\";\n\nconst REQUIRED_DATA_PROPS = [\"baseUrl\", \"apiKey\", \"subscriptionId\", \"email\", \"lang\"];\n\nexport class BeamSubscriptionManagement extends LitElement {\n static tagName = \"beam-subscription-management\";\n\n @property({ type: String })\n public baseUrl: string = DEFAULT_BASE_URL;\n\n @property({ type: String })\n public apiKey!: string;\n\n @property({ type: String })\n public subscriptionId!: string;\n\n @property({ type: Number, reflect: true })\n public storeId?: number; // Either storeId or postalCode, countryCode must be provided\n\n @property({ type: String })\n public email!: string;\n\n @property({ type: String })\n public postalCode?: string;\n\n @property({ type: String })\n public countryCode?: string;\n\n @property({ type: String })\n public lang: LANGUAGES = \"en\";\n\n @property({ type: Object })\n public cart?: TCart;\n\n @property({ type: Boolean })\n public debug = false;\n\n @state() private activeWidget: \"redeem-transaction\" | \"impact-overview\" | null = null; // Based on /findSubscriptionByRemoteId\n @state() private nonprofitId: number | null = null; // From /findSubscriptionByRemoteId response\n @state() private userId: string | null = null; // From findSubscriptionByRemoteId\n @state() private chainName: string | null = null; // From findEligibleNonprofitsForCart\n\n private subscriptionDataController = new AsyncController<typeof this.fetchSubscription>(this, this.fetchSubscription);\n private eligibleNonprofitsDataController = new AsyncController<typeof this.fetchEligibleNonprofits>(\n this,\n this.fetchEligibleNonprofits\n );\n\n async firstUpdated() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n await this.loadWidget();\n }\n\n async loadWidget() {\n // In parallel:\n // (1). Fetch eligible nonprofits [storeId and chainName]\n // (2). Fetch subscription [userId and nonprofitId]\n await Promise.all([this.fetchEligibleNonprofits(), this.fetchSubscription()]);\n this.activeWidget = this.nonprofitId ? \"impact-overview\" : \"redeem-transaction\";\n }\n\n async fetchEligibleNonprofits() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n postalCode: this.postalCode ? this.postalCode : undefined,\n countryCode: this.countryCode ? this.countryCode : undefined,\n widgetName: \"subscription-management\",\n version: \"1.0.0\",\n },\n });\n this.chainName = res.chain.name;\n this.storeId = res.store.id;\n return res;\n }\n\n async fetchSubscription() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n const result = await postFindSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n },\n });\n\n this.userId = result.beamUserId; // Returned in response regardless of subscription redemption\n this.nonprofitId = result.nonprofit?.id || null;\n return result;\n }\n\n handleSwapNonprofitButtonClick() {\n this.activeWidget = \"redeem-transaction\";\n }\n\n renderSwapNonprofitButton() {\n if (this.activeWidget === \"impact-overview\") {\n return html`<button class=\"swap-nonprofit-button\" @click=\"${this.handleSwapNonprofitButtonClick}\">\n ${strings[this.lang].nonprofitSwapText({ brandName: this.chainName || \"\" })}\n </button>`;\n } else {\n return \"\";\n }\n }\n\n public get cssVariables() {\n const defaults = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-borderColor\": \"#d5d5d5\",\n \"--beam-SubscriptionManagement-widgetContainer-borderRadius\": \"4px\",\n \"--beam-SubscriptionManagement-widgetContainer-padding\": \"15px\",\n \"--beam-SubscriptionManagement-widgetContainer-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-maxWidth\": \"800px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration\": \"underline\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop\": \"10px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-color\": \"inherit\",\n };\n\n const remoteConfig = this.eligibleNonprofitsDataController?.data?.config?.web?.theme || {};\n\n const config = { ...defaults, ...remoteConfig };\n\n const serializable = Object.create({\n toCSS() {\n return _cssVariableMap(this as Record<string, string>);\n },\n });\n return Object.assign(serializable, config);\n }\n\n static styles = [\n cssReset,\n css`\n :host {\n display: block;\n font-family: var(--beam-fontFamily);\n font-style: var(--beam-fontStyle);\n font-size: var(--beam-fontSize);\n background-color: var(--beam-backgroundColor);\n color: var(--beam-textColor);\n word-break: normal;\n }\n .swap-nonprofit-button {\n margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);\n color: var(--beam-SubscriptionManagement-swapNonprofitButtonText-color, inherit);\n font-size: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize, inherit);\n text-decoration: var(--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration, underline);\n font-family: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily, inherit);\n font-style: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle, inherit);\n font-weight: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight, inherit);\n line-height: var(--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight, inherit);\n background: none;\n border: none;\n cursor: pointer;\n }\n .sub-widget-container {\n background-color: var(--beam-SubscriptionManagement-widgetContainer-backgroundColor, inherit);\n border: 1px solid var(--beam-SubscriptionManagement-widgetContainer-borderColor, #d5d5d5);\n border-radius: var(--beam-SubscriptionManagement-widgetContainer-borderRadius, 4px);\n overflow: hidden; /* maintain clean border-radius */\n padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);\n max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);\n }\n }`,\n ];\n\n render() {\n let content;\n\n if (this.subscriptionDataController.loading || this.eligibleNonprofitsDataController.loading) {\n content = \"\";\n }\n\n if ((this.subscriptionDataController.error || this.eligibleNonprofitsDataController.error) && this.debug) {\n if (this.subscriptionDataController.error !== null) {\n return _errorMessage({ error: this.subscriptionDataController.error });\n } else if (this.eligibleNonprofitsDataController.error !== null) {\n return _errorMessage({ error: this.eligibleNonprofitsDataController.error });\n }\n } else {\n content = \"\";\n }\n\n if (this.activeWidget === \"redeem-transaction\") {\n content = html` <beam-redeem-transaction\n part=\"redeem-transaction\"\n subscriptionId=\"${this.subscriptionId}\"\n nonprofitId=${this.nonprofitId}\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n @beamnonprofitselect=\"${(event: Event) => {\n if (!(event instanceof BeamNonprofitSelectEvent)) return; // TS guard\n const { selectedNonprofitId } = event.detail;\n this.nonprofitId = selectedNonprofitId ?? null;\n this.activeWidget = \"impact-overview\";\n }}\"\n ></beam-redeem-transaction>`;\n } else if (this.activeWidget === \"impact-overview\") {\n content = html`\n <beam-impact-overview\n part=\"impact-overview\"\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n userId=\"${this.userId}\"\n nonprofitId=\"${this.nonprofitId}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n ></beam-impact-overview>\n `;\n }\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div class=\"sub-widget-container\">${content}</div>\n ${this.renderSwapNonprofitButton()}\n `;\n }\n}\n\ndefineCustomElement(BeamSubscriptionManagement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-subscription-management\": BeamSubscriptionManagement;\n }\n}\n"],"names":["strings","brandName","f","h","i","l","n","t","o","e","a","b","REQUIRED_DATA_PROPS","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","event","BeamNonprofitSelectEvent","selectedNonprofitId","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"+WAAO,MAAMA,EAAU,CACrB,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAC,EAAY,EAAG,IAAM,0CAA0CA,CAAS,kBAChG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,wGAAkGA,CAAS,EAC/G,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,oHAA2GA,CAAS,EACxH,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,4FAAsFA,CAAS,EACnG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,sFAAsFA,CAAS,EACnG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,yFAA4EA,CAAS,EACzF,CACF,ECxBA,IAAAC,EAAA,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AwMnBwB,EAAoBxB,CAA0B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { i as WebComponents } from './chunks/index
|
|
2
|
-
export { i as Integrations } from './chunks/index-
|
|
3
|
-
export { i as ReactComponents } from './chunks/index-
|
|
4
|
-
export { i as Utils } from './chunks/index-
|
|
1
|
+
export { i as WebComponents } from './chunks/index-oLz4lmx2.esm.js';
|
|
2
|
+
export { i as Integrations } from './chunks/index-EZ_Bg1n7.esm.js';
|
|
3
|
+
export { i as ReactComponents } from './chunks/index-6t9MtjyS.esm.js';
|
|
4
|
+
export { i as Utils } from './chunks/index-GkPHba-I.esm.js';
|
|
5
5
|
import './components/community-impact.js';
|
|
6
6
|
import 'lit';
|
|
7
7
|
import 'lit-html';
|
|
@@ -13,13 +13,14 @@ import './components/cumulative-impact.js';
|
|
|
13
13
|
import 'lodash';
|
|
14
14
|
import './components/impact-overview.js';
|
|
15
15
|
import './components/select-nonprofit.js';
|
|
16
|
-
import './chunks/cart-contents-
|
|
17
|
-
import './chunks/openapi-spec-
|
|
16
|
+
import './chunks/cart-contents-Shc27L1J.esm.js';
|
|
17
|
+
import './chunks/openapi-spec-D_Zzbl2J.esm.js';
|
|
18
18
|
import './components/redeem-transaction.js';
|
|
19
19
|
import './components/post-purchase.js';
|
|
20
|
-
import './
|
|
21
|
-
import './chunks/
|
|
22
|
-
import './chunks/
|
|
20
|
+
import './components/subscription-management.js';
|
|
21
|
+
import './chunks/index-pDraUd1x.esm.js';
|
|
22
|
+
import './chunks/beam-errors-fXDkG1zo.esm.js';
|
|
23
|
+
import './chunks/events-qTu4iIOo.esm.js';
|
|
23
24
|
import './utils/logger.js';
|
|
24
25
|
import './utils/network-listeners.js';
|
|
25
26
|
import './utils/local-storage.js';
|
|
@@ -29,12 +30,12 @@ import './utils/remote-session.js';
|
|
|
29
30
|
import './utils/memoize-last.js';
|
|
30
31
|
import 'lodash-es/debounce';
|
|
31
32
|
import 'lodash-es/isEqual';
|
|
32
|
-
import './chunks/index-
|
|
33
|
-
import './chunks/order-page-
|
|
34
|
-
import './chunks/update-cart-
|
|
33
|
+
import './chunks/index-I8DBdgx0.esm.js';
|
|
34
|
+
import './chunks/order-page-ydw5uXTI.esm.js';
|
|
35
|
+
import './chunks/update-cart-yCIzgmve.esm.js';
|
|
35
36
|
import './chunks/index-EGiUuWe-.esm.js';
|
|
36
|
-
import './chunks/index-
|
|
37
|
-
import './chunks/index-
|
|
37
|
+
import './chunks/index-3Xf6QzNV.esm.js';
|
|
38
|
+
import './chunks/index-wbrSi6cp.esm.js';
|
|
38
39
|
import './react/community-impact.js';
|
|
39
40
|
import '@lit/react';
|
|
40
41
|
import './react/cumulative-impact.js';
|
|
@@ -42,3 +43,4 @@ import './react/impact-overview.js';
|
|
|
42
43
|
import './react/select-nonprofit.js';
|
|
43
44
|
import './react/redeem-transaction.js';
|
|
44
45
|
import './react/post-purchase.js';
|
|
46
|
+
import './react/subscription-management.js';
|
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as
|
|
1
|
+
import{i as Q}from"./chunks/index-5yFqo0yl.esm.js";import{i as T}from"./chunks/index-XMD0b6ql.esm.js";import{i as X}from"./chunks/index-o7YiP4gC.esm.js";import{i as Z}from"./chunks/index-OnjTwvAw.esm.js";import"./components/community-impact.esm.js";import"./chunks/lit-yVXn5Cbs.esm.js";import"./chunks/progress-bar-7gWYaGlq.esm.js";import"./components/beam-partner-logos.esm.js";import"./chunks/enforce-config-qna7hEL6.esm.js";import"./chunks/beam-errors-P-Lu07Ce.esm.js";import"./utils/logger.esm.js";import"./chunks/routes-lsOWIDmE.esm.js";import"./chunks/localize-GCkVUD8S.esm.js";import"./chunks/css-card-grid-3b56QBzq.esm.js";import"./components/cumulative-impact.esm.js";import"./chunks/lodash-P8OIs-at.esm.js";import"./chunks/is-all-html-elements-SdSkxirh.esm.js";import"./components/impact-overview.esm.js";import"./chunks/vendor-eeJfrOkP.esm.js";import"./chunks/responsive-LYEag6TI.esm.js";import"./components/select-nonprofit.esm.js";import"./chunks/events-5IECSF-x.esm.js";import"./utils/network-listeners.esm.js";import"./utils/local-storage.esm.js";import"./utils/cookies.esm.js";import"./chunks/cart-contents-h60geKWa.esm.js";import"./components/redeem-transaction.esm.js";import"./components/post-purchase.esm.js";import"./components/subscription-management.esm.js";import"./chunks/index-9gijHGwh.esm.js";import"./utils/wait-for-element.esm.js";import"./utils/remote-session.esm.js";import"./utils/memoize-last.esm.js";import"./chunks/index-t4uX5Dg1.esm.js";import"./chunks/order-page-JdaAppB7.esm.js";import"./chunks/update-cart-yneR8zk1.esm.js";import"./chunks/index-9YcaEQju.esm.js";import"./chunks/index-ll8zLjbu.esm.js";import"./chunks/index-gULINFkH.esm.js";import"./react/community-impact.esm.js";import"react";import"./react/cumulative-impact.esm.js";import"./react/impact-overview.esm.js";import"./react/select-nonprofit.esm.js";import"./react/redeem-transaction.esm.js";import"./react/post-purchase.esm.js";import"./react/subscription-management.esm.js";export{T as Integrations,X as ReactComponents,Z as Utils,Q as WebComponents};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as
|
|
1
|
+
import{i as Q}from"./chunks/index-IzAvjker.esm.js";import{i as T}from"./chunks/index-r9Yb1UY4.esm.js";import{i as X}from"./chunks/index-EHubF2KN.esm.js";import{i as Z}from"./chunks/index-wsdeaTHd.esm.js";import"./components/community-impact.js";import"./chunks/lit-yVXn5Cbs.esm.js";import"./chunks/progress-bar-7gWYaGlq.esm.js";import"./components/beam-partner-logos.js";import"./chunks/enforce-config-fo8kIfoY.esm.js";import"./chunks/beam-errors-P-Lu07Ce.esm.js";import"./utils/logger.js";import"./chunks/routes-CqjzL4oL.esm.js";import"./chunks/localize-pzAAkBvG.esm.js";import"./chunks/css-card-grid-3b56QBzq.esm.js";import"./components/cumulative-impact.js";import"./chunks/lodash-P8OIs-at.esm.js";import"./chunks/is-all-html-elements-SdSkxirh.esm.js";import"./components/impact-overview.js";import"./chunks/vendor-eeJfrOkP.esm.js";import"./chunks/responsive-LYEag6TI.esm.js";import"./components/select-nonprofit.js";import"./chunks/events-5IECSF-x.esm.js";import"./utils/network-listeners.js";import"./utils/local-storage.js";import"./utils/cookies.js";import"./chunks/cart-contents-h60geKWa.esm.js";import"./components/redeem-transaction.js";import"./components/post-purchase.js";import"./components/subscription-management.js";import"./chunks/index-U8Oy2aur.esm.js";import"./utils/wait-for-element.js";import"./utils/remote-session.js";import"./utils/memoize-last.js";import"./chunks/index-1qXot92e.esm.js";import"./chunks/order-page-W1jR35W9.esm.js";import"./chunks/update-cart-T32-282v.esm.js";import"./chunks/index-Z1UUeVXR.esm.js";import"./chunks/index-EpanGShY.esm.js";import"./chunks/index-fqDBrscF.esm.js";import"./react/community-impact.js";import"react";import"./react/cumulative-impact.js";import"./react/impact-overview.js";import"./react/select-nonprofit.js";import"./react/redeem-transaction.js";import"./react/post-purchase.js";import"./react/subscription-management.js";export{T as Integrations,X as ReactComponents,Z as Utils,Q as WebComponents};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as u,a as g}from"../chunks/routes-
|
|
1
|
+
import{D as u,a as g}from"../chunks/routes-lsOWIDmE.esm.js";import{S as y}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{B as h}from"../chunks/events-5IECSF-x.esm.js";import{logger as w}from"../utils/logger.esm.js";import{s as f}from"../chunks/index-gULINFkH.esm.js";var v=(t,s,a)=>{if(!s.has(t))throw TypeError("Cannot "+a)},c=(t,s,a)=>{if(s.has(t))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(t):s.set(t,a)},i=(t,s,a)=>(v(t,s,"access private method"),a),r,n,o,m;let p,l;const E=new Promise((t,s)=>{p=t,l=s});class U extends EventTarget{constructor(s){super(),c(this,r),c(this,o),this.readyPromise=E,this.plugins={},this.status="pending",i(this,r,n).call(this,s)}async init(s){i(this,r,n).call(this,s);try{await i(this,o,m).call(this,s)}catch(a){const e=new y;throw e.cause=a,this.status="error",this.dispatchEvent(new h({status:"error",error:e})),l(e),w.error(e),this.apiKey&&await f({apiKey:this.apiKey,baseUrl:this.logUrl},{type:"error",code:e.name,metadata:{message:e.message,cause:a?.message}}),a}return this.status="ready",this.dispatchEvent(new h({status:"ready"})),p(!0),this}}r=new WeakSet,n=function(t){this.apiKey=t.apiKey,this.chainId=t.chainId,this.storeId=t.storeId,this.domain=t.domain,this.baseUrl=t.baseUrl||u,this.logUrl=t.logUrl||g},o=new WeakSet,m=async function(t){const s=(t.plugins||[]).map(async a=>(await a.init(t),this.plugins[a.name]=a,a));return Promise.all(s)};const d=new U({}),S=t=>d.init(t),L=()=>d;export{L as getConfig,S as init};
|
|
2
2
|
//# sourceMappingURL=beam.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as u,a as g}from"../chunks/routes-
|
|
1
|
+
import{D as u,a as g}from"../chunks/routes-CqjzL4oL.esm.js";import{S as y}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{B as h}from"../chunks/events-5IECSF-x.esm.js";import{logger as w}from"../utils/logger.js";import{s as f}from"../chunks/index-fqDBrscF.esm.js";var v=(t,s,a)=>{if(!s.has(t))throw TypeError("Cannot "+a)},c=(t,s,a)=>{if(s.has(t))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(t):s.set(t,a)},i=(t,s,a)=>(v(t,s,"access private method"),a),r,n,o,m;let p,l;const E=new Promise((t,s)=>{p=t,l=s});class U extends EventTarget{constructor(s){super(),c(this,r),c(this,o),this.readyPromise=E,this.plugins={},this.status="pending",i(this,r,n).call(this,s)}async init(s){i(this,r,n).call(this,s);try{await i(this,o,m).call(this,s)}catch(a){const e=new y;throw e.cause=a,this.status="error",this.dispatchEvent(new h({status:"error",error:e})),l(e),w.error(e),this.apiKey&&await f({apiKey:this.apiKey,baseUrl:this.logUrl},{type:"error",code:e.name,metadata:{message:e.message,cause:a?.message}}),a}return this.status="ready",this.dispatchEvent(new h({status:"ready"})),p(!0),this}}r=new WeakSet,n=function(t){this.apiKey=t.apiKey,this.chainId=t.chainId,this.storeId=t.storeId,this.domain=t.domain,this.baseUrl=t.baseUrl||u,this.logUrl=t.logUrl||g},o=new WeakSet,m=async function(t){const s=(t.plugins||[]).map(async a=>(await a.init(t),this.plugins[a.name]=a,a));return Promise.all(s)};const d=new U({}),S=t=>d.init(t),L=()=>d;export{L as getConfig,S as init};
|
|
2
2
|
//# sourceMappingURL=beam.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { B as BeamCartAPIConfig, a as BeamCartValues, u as updateCart } from '../chunks/update-cart-
|
|
1
|
+
export { B as BeamCartAPIConfig, a as BeamCartValues, u as updateCart } from '../chunks/update-cart-yCIzgmve.esm.js';
|
|
2
2
|
import 'lodash';
|
|
3
3
|
import '../chunks/types-aju0qrRe.esm.js';
|
|
4
|
-
import '../chunks/cart-contents-
|
|
5
|
-
import '../chunks/openapi-spec-
|
|
4
|
+
import '../chunks/cart-contents-Shc27L1J.esm.js';
|
|
5
|
+
import '../chunks/openapi-spec-D_Zzbl2J.esm.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{x as C}from"../chunks/update-cart-
|
|
1
|
+
import{x as C}from"../chunks/update-cart-yneR8zk1.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-lsOWIDmE.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/events-5IECSF-x.esm.js";import"../utils/network-listeners.esm.js";import"../utils/local-storage.esm.js";import"../utils/cookies.esm.js";import"../utils/remote-session.esm.js";import"../utils/memoize-last.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";export{C as updateCart};
|
|
2
2
|
//# sourceMappingURL=cart.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{x as C}from"../chunks/update-cart-
|
|
1
|
+
import{x as C}from"../chunks/update-cart-T32-282v.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-CqjzL4oL.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/events-5IECSF-x.esm.js";import"../utils/network-listeners.js";import"../utils/local-storage.js";import"../utils/cookies.js";import"../utils/remote-session.js";import"../utils/memoize-last.js";import"../chunks/cart-contents-h60geKWa.esm.js";export{C as updateCart};
|
|
2
2
|
//# sourceMappingURL=cart.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { i as Utils } from '../chunks/index-
|
|
2
|
-
export { i as Shopify } from '../chunks/index-
|
|
1
|
+
export { i as Utils } from '../chunks/index-pDraUd1x.esm.js';
|
|
2
|
+
export { i as Shopify } from '../chunks/index-I8DBdgx0.esm.js';
|
|
3
3
|
export { i as Session } from '../chunks/index-EGiUuWe-.esm.js';
|
|
4
|
-
export { i as Cart } from '../chunks/index-
|
|
5
|
-
export { i as Logs } from '../chunks/index-
|
|
6
|
-
import '../chunks/beam-errors-
|
|
7
|
-
import '../chunks/events-
|
|
8
|
-
import '../chunks/cart-contents-
|
|
9
|
-
import '../chunks/openapi-spec-
|
|
4
|
+
export { i as Cart } from '../chunks/index-3Xf6QzNV.esm.js';
|
|
5
|
+
export { i as Logs } from '../chunks/index-wbrSi6cp.esm.js';
|
|
6
|
+
import '../chunks/beam-errors-fXDkG1zo.esm.js';
|
|
7
|
+
import '../chunks/events-qTu4iIOo.esm.js';
|
|
8
|
+
import '../chunks/cart-contents-Shc27L1J.esm.js';
|
|
9
|
+
import '../chunks/openapi-spec-D_Zzbl2J.esm.js';
|
|
10
10
|
import '../chunks/types-7kSi85Gv.esm.js';
|
|
11
11
|
import '../utils/logger.js';
|
|
12
12
|
import '../utils/network-listeners.js';
|
|
@@ -17,9 +17,9 @@ import '../utils/remote-session.js';
|
|
|
17
17
|
import '../utils/memoize-last.js';
|
|
18
18
|
import 'lodash-es/debounce';
|
|
19
19
|
import 'lodash-es/isEqual';
|
|
20
|
-
import '../chunks/order-page-
|
|
20
|
+
import '../chunks/order-page-ydw5uXTI.esm.js';
|
|
21
21
|
import 'lodash';
|
|
22
|
-
import '../chunks/update-cart-
|
|
22
|
+
import '../chunks/update-cart-yCIzgmve.esm.js';
|
|
23
23
|
import '../chunks/types-aju0qrRe.esm.js';
|
|
24
24
|
import '../components/post-purchase.js';
|
|
25
25
|
import 'lit';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as
|
|
1
|
+
import{i as w}from"../chunks/index-9gijHGwh.esm.js";import{i as A}from"../chunks/index-t4uX5Dg1.esm.js";import{i as D}from"../chunks/index-9YcaEQju.esm.js";import{i as F}from"../chunks/index-ll8zLjbu.esm.js";import{i as H}from"../chunks/index-gULINFkH.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/events-5IECSF-x.esm.js";import"../utils/logger.esm.js";import"../utils/network-listeners.esm.js";import"../utils/local-storage.esm.js";import"../utils/wait-for-element.esm.js";import"../utils/cookies.esm.js";import"../utils/remote-session.esm.js";import"../utils/memoize-last.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/order-page-JdaAppB7.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-yneR8zk1.esm.js";import"../chunks/routes-lsOWIDmE.esm.js";import"../components/post-purchase.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../components/redeem-transaction.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../components/impact-overview.esm.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";export{F as Cart,H as Logs,D as Session,A as Shopify,w as Utils};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as
|
|
1
|
+
import{i as w}from"../chunks/index-U8Oy2aur.esm.js";import{i as A}from"../chunks/index-1qXot92e.esm.js";import{i as D}from"../chunks/index-Z1UUeVXR.esm.js";import{i as F}from"../chunks/index-EpanGShY.esm.js";import{i as H}from"../chunks/index-fqDBrscF.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/events-5IECSF-x.esm.js";import"../utils/logger.js";import"../utils/network-listeners.js";import"../utils/local-storage.js";import"../utils/wait-for-element.js";import"../utils/cookies.js";import"../utils/remote-session.js";import"../utils/memoize-last.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/order-page-W1jR35W9.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-T32-282v.esm.js";import"../chunks/routes-CqjzL4oL.esm.js";import"../components/post-purchase.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../components/redeem-transaction.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../components/impact-overview.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";export{F as Cart,H as Logs,D as Session,A as Shopify,w as Utils};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../chunks/openapi-spec-
|
|
2
|
-
export { s as sendLog } from '../chunks/index-
|
|
1
|
+
import '../chunks/openapi-spec-D_Zzbl2J.esm.js';
|
|
2
|
+
export { s as sendLog } from '../chunks/index-wbrSi6cp.esm.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/routes-
|
|
1
|
+
import"../chunks/routes-lsOWIDmE.esm.js";import"../utils/logger.esm.js";import{s as i}from"../chunks/index-gULINFkH.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";export{i as sendLog};
|
|
2
2
|
//# sourceMappingURL=logs.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/routes-
|
|
1
|
+
import"../chunks/routes-CqjzL4oL.esm.js";import"../utils/logger.js";import{s as i}from"../chunks/index-fqDBrscF.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";export{i as sendLog};
|
|
2
2
|
//# sourceMappingURL=logs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/vendor-eeJfrOkP.esm.js";import"../utils/cookies.esm.js";import"../utils/local-storage.esm.js";import{c as s,e as a}from"../chunks/index-9YcaEQju.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/beam-errors-
|
|
1
|
+
import"../chunks/vendor-eeJfrOkP.esm.js";import"../utils/cookies.esm.js";import"../utils/local-storage.esm.js";import{c as s,e as a}from"../chunks/index-9YcaEQju.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";export{s as createSession,a as endSession};
|
|
2
2
|
//# sourceMappingURL=session.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/vendor-eeJfrOkP.esm.js";import"../utils/cookies.js";import"../utils/local-storage.js";import{c as s,e as a}from"../chunks/index-Z1UUeVXR.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/beam-errors-
|
|
1
|
+
import"../chunks/vendor-eeJfrOkP.esm.js";import"../utils/cookies.js";import"../utils/local-storage.js";import{c as s,e as a}from"../chunks/index-Z1UUeVXR.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";export{s as createSession,a as endSession};
|
|
2
2
|
//# sourceMappingURL=session.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { T as TBeamOrderPageParams, a as addBeamAttributesToCart, g as getCurrentCart, r as registerCartIntegration, s as showBeamOrderPageWidgets, t as trackCart } from '../chunks/order-page-
|
|
1
|
+
export { T as TBeamOrderPageParams, a as addBeamAttributesToCart, g as getCurrentCart, r as registerCartIntegration, s as showBeamOrderPageWidgets, t as trackCart } from '../chunks/order-page-ydw5uXTI.esm.js';
|
|
2
2
|
import 'lodash';
|
|
3
|
-
import '../chunks/update-cart-
|
|
3
|
+
import '../chunks/update-cart-yCIzgmve.esm.js';
|
|
4
4
|
import '../chunks/types-aju0qrRe.esm.js';
|
|
5
|
-
import '../chunks/cart-contents-
|
|
6
|
-
import '../chunks/openapi-spec-
|
|
5
|
+
import '../chunks/cart-contents-Shc27L1J.esm.js';
|
|
6
|
+
import '../chunks/openapi-spec-D_Zzbl2J.esm.js';
|
|
7
7
|
import '../components/post-purchase.js';
|
|
8
8
|
import 'lit';
|
|
9
9
|
import 'lit-html';
|