@beamimpact/web-sdk 1.36.9 → 1.36.10

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.
Files changed (151) hide show
  1. package/dist/chunks/{_share-dialog-dependencies-MLhW3eyp.esm.js → _share-dialog-dependencies-3jvcgxc-.esm.js} +2 -2
  2. package/dist/chunks/_share-dialog-dependencies-3jvcgxc-.esm.js.map +1 -0
  3. package/dist/chunks/{_share-dialog-dependencies-KMjpyJhT.esm.js → _share-dialog-dependencies-3mmhET8U.esm.js} +2 -2
  4. package/dist/chunks/_share-dialog-dependencies-3mmhET8U.esm.js.map +1 -0
  5. package/dist/chunks/{cart-contents-Z-r5GpWA.esm.d.ts → cart-contents-v6_9tRb6.esm.d.ts} +1 -1
  6. package/dist/chunks/{events-q1pdogmn.esm.d.ts → events-OcebkuWu.esm.d.ts} +1 -1
  7. package/dist/chunks/index-2d2pxFdE.esm.js +2 -0
  8. package/dist/chunks/index-2d2pxFdE.esm.js.map +1 -0
  9. package/dist/chunks/{index-DU9Zy88b.esm.d.ts → index-5daMf0rK.esm.d.ts} +1 -1
  10. package/dist/chunks/{index-vziJysPD.esm.d.ts → index-FnuGcS7e.esm.d.ts} +4 -4
  11. package/dist/chunks/index-Gz47LtoA.esm.js +2 -0
  12. package/dist/chunks/index-Gz47LtoA.esm.js.map +1 -0
  13. package/dist/chunks/{index-58VYn82f.esm.js → index-HSr3vG8C.esm.js} +2 -2
  14. package/dist/chunks/{index-58VYn82f.esm.js.map → index-HSr3vG8C.esm.js.map} +1 -1
  15. package/dist/chunks/index-HmjLoc_p.esm.js +2 -0
  16. package/dist/chunks/index-HmjLoc_p.esm.js.map +1 -0
  17. package/dist/chunks/{index-mrZj61ji.esm.d.ts → index-JwkkxR5U.esm.d.ts} +1 -1
  18. package/dist/chunks/{index-_XbXZetF.esm.d.ts → index-KVvZMZmn.esm.d.ts} +1 -1
  19. package/dist/chunks/{index-KbG1GoVy.esm.js → index-ZiApqExt.esm.js} +2 -2
  20. package/dist/chunks/{index-KbG1GoVy.esm.js.map → index-ZiApqExt.esm.js.map} +1 -1
  21. package/dist/chunks/{index-1yMQlmZQ.esm.d.ts → index-g9-z_JOJ.esm.d.ts} +1 -1
  22. package/dist/chunks/index-kLkFc8M_.esm.js +2 -0
  23. package/dist/chunks/index-kLkFc8M_.esm.js.map +1 -0
  24. package/dist/chunks/{index-xRdmiNwx.esm.d.ts → index-wlzifF_l.esm.d.ts} +1 -1
  25. package/dist/chunks/index-yWjLS42R.esm.js +2 -0
  26. package/dist/chunks/index-yWjLS42R.esm.js.map +1 -0
  27. package/dist/chunks/index-yxnSM7PZ.esm.js +2 -0
  28. package/dist/chunks/index-yxnSM7PZ.esm.js.map +1 -0
  29. package/dist/chunks/{openapi-spec-S9cYW1SA.esm.d.ts → openapi-spec-bq7eoELU.esm.d.ts} +55 -61
  30. package/dist/chunks/{order-page-lfbHIKul.esm.d.ts → order-page-2mptGhAC.esm.d.ts} +3 -3
  31. package/dist/chunks/order-page-NwFyJU-V.esm.js +2 -0
  32. package/dist/chunks/order-page-NwFyJU-V.esm.js.map +1 -0
  33. package/dist/chunks/order-page-XNVqjTGF.esm.js +2 -0
  34. package/dist/chunks/order-page-XNVqjTGF.esm.js.map +1 -0
  35. package/dist/chunks/routes-a8lsE6eZ.esm.js +2 -0
  36. package/dist/chunks/{routes-1-1FXngS.esm.js.map → routes-a8lsE6eZ.esm.js.map} +1 -1
  37. package/dist/chunks/routes-d2vC4TDa.esm.js +2 -0
  38. package/dist/chunks/{routes-RgILh2Qy.esm.js.map → routes-d2vC4TDa.esm.js.map} +1 -1
  39. package/dist/chunks/{update-cart-EVuB41Qg.esm.js → update-cart-gv6ortZ5.esm.js} +2 -2
  40. package/dist/chunks/{update-cart-EVuB41Qg.esm.js.map → update-cart-gv6ortZ5.esm.js.map} +1 -1
  41. package/dist/chunks/{update-cart-9-QjPC1E.esm.d.ts → update-cart-kuufrFCv.esm.d.ts} +1 -1
  42. package/dist/chunks/{update-cart-V2ysW2LO.esm.js → update-cart-p84B0Ga6.esm.js} +2 -2
  43. package/dist/chunks/{update-cart-V2ysW2LO.esm.js.map → update-cart-p84B0Ga6.esm.js.map} +1 -1
  44. package/dist/components/community-impact.esm.js +1 -1
  45. package/dist/components/community-impact.js +1 -1
  46. package/dist/components/cumulative-impact.esm.js +1 -1
  47. package/dist/components/cumulative-impact.js +1 -1
  48. package/dist/components/impact-overview.esm.js +3 -3
  49. package/dist/components/impact-overview.esm.js.map +1 -1
  50. package/dist/components/impact-overview.js +3 -3
  51. package/dist/components/impact-overview.js.map +1 -1
  52. package/dist/components/index.d.ts +2 -2
  53. package/dist/components/index.esm.js +1 -1
  54. package/dist/components/index.js +1 -1
  55. package/dist/components/post-purchase.d.ts +12 -4
  56. package/dist/components/post-purchase.esm.js +3 -3
  57. package/dist/components/post-purchase.esm.js.map +1 -1
  58. package/dist/components/post-purchase.js +3 -3
  59. package/dist/components/post-purchase.js.map +1 -1
  60. package/dist/components/redeem-transaction.d.ts +4 -3
  61. package/dist/components/redeem-transaction.esm.js +3 -3
  62. package/dist/components/redeem-transaction.esm.js.map +1 -1
  63. package/dist/components/redeem-transaction.js +3 -3
  64. package/dist/components/redeem-transaction.js.map +1 -1
  65. package/dist/components/select-nonprofit.d.ts +3 -3
  66. package/dist/components/select-nonprofit.esm.js +12 -12
  67. package/dist/components/select-nonprofit.esm.js.map +1 -1
  68. package/dist/components/select-nonprofit.js +12 -12
  69. package/dist/components/select-nonprofit.js.map +1 -1
  70. package/dist/components/shopify.d.ts +5 -5
  71. package/dist/components/shopify.esm.js +1 -1
  72. package/dist/components/shopify.js +1 -1
  73. package/dist/components/subscription-management.d.ts +6 -3
  74. package/dist/components/subscription-management.esm.js +8 -6
  75. package/dist/components/subscription-management.esm.js.map +1 -1
  76. package/dist/components/subscription-management.js +8 -6
  77. package/dist/components/subscription-management.js.map +1 -1
  78. package/dist/index.d.ts +11 -11
  79. package/dist/index.esm.js +1 -1
  80. package/dist/index.js +1 -1
  81. package/dist/integrations/beam.esm.js +1 -1
  82. package/dist/integrations/beam.js +1 -1
  83. package/dist/integrations/cart.d.ts +3 -3
  84. package/dist/integrations/cart.esm.js +1 -1
  85. package/dist/integrations/cart.js +1 -1
  86. package/dist/integrations/index.d.ts +9 -9
  87. package/dist/integrations/index.esm.js +1 -1
  88. package/dist/integrations/index.js +1 -1
  89. package/dist/integrations/logs.d.ts +2 -2
  90. package/dist/integrations/logs.esm.js +1 -1
  91. package/dist/integrations/logs.js +1 -1
  92. package/dist/integrations/session.esm.js +1 -1
  93. package/dist/integrations/session.js +1 -1
  94. package/dist/integrations/shopify.d.ts +4 -4
  95. package/dist/integrations/shopify.esm.js +1 -1
  96. package/dist/integrations/shopify.js +1 -1
  97. package/dist/integrations/statsig.esm.js +1 -1
  98. package/dist/integrations/statsig.js +1 -1
  99. package/dist/integrations/utils.d.ts +3 -3
  100. package/dist/react/community-impact.esm.js +1 -1
  101. package/dist/react/community-impact.js +1 -1
  102. package/dist/react/cumulative-impact.esm.js +1 -1
  103. package/dist/react/cumulative-impact.js +1 -1
  104. package/dist/react/impact-overview.esm.js +1 -1
  105. package/dist/react/impact-overview.js +1 -1
  106. package/dist/react/index.d.ts +3 -3
  107. package/dist/react/index.esm.js +1 -1
  108. package/dist/react/index.js +1 -1
  109. package/dist/react/post-purchase.d.ts +2 -2
  110. package/dist/react/post-purchase.esm.js +1 -1
  111. package/dist/react/post-purchase.js +1 -1
  112. package/dist/react/redeem-transaction.d.ts +3 -3
  113. package/dist/react/redeem-transaction.esm.js +1 -1
  114. package/dist/react/redeem-transaction.js +1 -1
  115. package/dist/react/select-nonprofit.d.ts +3 -3
  116. package/dist/react/select-nonprofit.esm.js +1 -1
  117. package/dist/react/select-nonprofit.js +1 -1
  118. package/dist/react/subscription-management.d.ts +2 -2
  119. package/dist/react/subscription-management.esm.js +1 -1
  120. package/dist/react/subscription-management.js +1 -1
  121. package/dist/utils/events.d.ts +3 -3
  122. package/dist/utils/index.d.ts +3 -3
  123. package/dist/utils/local-storage.esm.js +1 -1
  124. package/dist/utils/local-storage.esm.js.map +1 -1
  125. package/dist/utils/local-storage.js +1 -1
  126. package/dist/utils/local-storage.js.map +1 -1
  127. package/dist/utils/remote-session.esm.js +1 -1
  128. package/dist/utils/remote-session.esm.js.map +1 -1
  129. package/dist/utils/remote-session.js +1 -1
  130. package/dist/utils/remote-session.js.map +1 -1
  131. package/package.json +1 -1
  132. package/dist/chunks/_share-dialog-dependencies-KMjpyJhT.esm.js.map +0 -1
  133. package/dist/chunks/_share-dialog-dependencies-MLhW3eyp.esm.js.map +0 -1
  134. package/dist/chunks/index-0XoQisEb.esm.js +0 -2
  135. package/dist/chunks/index-0XoQisEb.esm.js.map +0 -1
  136. package/dist/chunks/index-44M_qqUx.esm.js +0 -2
  137. package/dist/chunks/index-44M_qqUx.esm.js.map +0 -1
  138. package/dist/chunks/index-8Rkw987L.esm.js +0 -2
  139. package/dist/chunks/index-8Rkw987L.esm.js.map +0 -1
  140. package/dist/chunks/index-YN68B9ro.esm.js +0 -2
  141. package/dist/chunks/index-YN68B9ro.esm.js.map +0 -1
  142. package/dist/chunks/index-nb5G3fNW.esm.js +0 -2
  143. package/dist/chunks/index-nb5G3fNW.esm.js.map +0 -1
  144. package/dist/chunks/index-oCRI089I.esm.js +0 -2
  145. package/dist/chunks/index-oCRI089I.esm.js.map +0 -1
  146. package/dist/chunks/order-page-OFWAlLqS.esm.js +0 -2
  147. package/dist/chunks/order-page-OFWAlLqS.esm.js.map +0 -1
  148. package/dist/chunks/order-page-zZ0JffzK.esm.js +0 -2
  149. package/dist/chunks/order-page-zZ0JffzK.esm.js.map +0 -1
  150. package/dist/chunks/routes-1-1FXngS.esm.js +0 -2
  151. package/dist/chunks/routes-RgILh2Qy.esm.js +0 -2
@@ -2,8 +2,8 @@ import * as lit from 'lit';
2
2
  import { LitElement } from 'lit';
3
3
  import * as lit_html from 'lit-html';
4
4
  import { L as LANGUAGES } from '../chunks/types-aju0qrRe.esm.js';
5
- import { T as TCart } from '../chunks/cart-contents-Z-r5GpWA.esm.js';
6
- import '../chunks/openapi-spec-S9cYW1SA.esm.js';
5
+ import { T as TCart } from '../chunks/cart-contents-v6_9tRb6.esm.js';
6
+ import '../chunks/openapi-spec-bq7eoELU.esm.js';
7
7
 
8
8
  interface RequiredDataPropsWithEmail {
9
9
  email: string;
@@ -103,6 +103,9 @@ declare class BeamSubscriptionManagement extends LitElement {
103
103
  store: {
104
104
  id: number;
105
105
  };
106
+ region?: {
107
+ id?: string | null | undefined;
108
+ } | undefined;
106
109
  }>;
107
110
  fetchSubscription(): Promise<{
108
111
  beamUserId: string;
@@ -113,7 +116,7 @@ declare class BeamSubscriptionManagement extends LitElement {
113
116
  } | null;
114
117
  }>;
115
118
  handleSwapNonprofitButtonClick(): void;
116
- renderSwapNonprofitButton(): lit_html.TemplateResult<1> | "";
119
+ renderSwapNonprofitButton(): "" | lit_html.TemplateResult<1>;
117
120
  get cssVariables(): any;
118
121
  static styles: lit.CSSResult[];
119
122
  render(): lit_html.TemplateResult<1>;
@@ -1,15 +1,17 @@
1
- import{f as h,g as r,t as p,h as g,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as f,b as y,h as w}from"../chunks/routes-RgILh2Qy.esm.js";import{c as S,d as v,A as m,e as c,a as x,_ as u}from"../chunks/enforce-config-qna7hEL6.esm.js";import{c as C}from"../chunks/events-5IECSF-x.esm.js";import{M as N}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";const I={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 M=Object.defineProperty,B=Object.getOwnPropertyDescriptor,n=(i,t,o,a)=>{for(var s=a>1?void 0:a?B(t,o):t,d=i.length-1,b;d>=0;d--)(b=i[d])&&(s=(a?b(t,o,s):b(s))||s);return a&&s&&M(t,o,s),s};class e extends g{constructor(){super(...arguments),this.baseUrl=f,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(){if(!this.email&&!this.partnerUserId)throw new N(["email","partnerUserId"],"One of the following properties needs to be specified: email, partnerUserId ");c(["apiKey","subscriptionId"],this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){c(["apiKey","subscriptionId"],this);const t=await y({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(){c(["apiKey","subscriptionId"],this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});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}">
1
+ import{f as h,g as o,t as p,h as g,y as d}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as f,b as y,h as w}from"../chunks/routes-d2vC4TDa.esm.js";import{c as S,d as v,A as u,e as b,a as C,_ as m}from"../chunks/enforce-config-qna7hEL6.esm.js";import{c as x}from"../chunks/events-5IECSF-x.esm.js";import{M as N}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";const I={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 M=Object.defineProperty,$=Object.getOwnPropertyDescriptor,n=(i,t,r,a)=>{for(var s=a>1?void 0:a?$(t,r):t,l=i.length-1,c;l>=0;l--)(c=i[l])&&(s=(a?c(t,r,s):c(s))||s);return a&&s&&M(t,r,s),s};class e extends g{constructor(){super(...arguments),this.baseUrl=f,this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.userId=null,this.chainName=null,this.subscriptionDataController=new u(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new u(this,this.fetchEligibleNonprofits)}async firstUpdated(){if(!this.email&&!this.partnerUserId)throw new N(["email","partnerUserId"],"One of the following properties needs to be specified: email, partnerUserId ");b(["apiKey","subscriptionId"],this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){b(["apiKey","subscriptionId"],this);const t=await y({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(["apiKey","subscriptionId"],this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return this.userId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}handleSwapNonprofitButtonClick(){this.activeWidget="redeem-transaction"}renderSwapNonprofitButton(){return this.activeWidget==="impact-overview"?d`<button class="swap-nonprofit-button" @click="${this.handleSwapNonprofitButtonClick}">
2
2
  ${I[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"},o=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},a={...t,...o};return Object.assign(Object.create({toCSS(){return x(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 u({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return u({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=l` <beam-redeem-transaction
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 m({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return m({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=d` <beam-redeem-transaction
4
4
  part="redeem-transaction"
5
5
  subscriptionId="${this.subscriptionId}"
6
6
  nonprofitId=${this.nonprofitId}
7
7
  baseUrl="${this.baseUrl}"
8
8
  apiKey="${this.apiKey}"
9
+ postalCode="${this.postalCode}"
10
+ countryCode="${this.countryCode}"
9
11
  lang="${this.lang}"
10
12
  ?debug="${this.debug}"
11
- @beamnonprofitselect="${o=>{if(!(o instanceof C))return;const{selectedNonprofitId:a}=o.detail;this.nonprofitId=a??null,this.activeWidget="impact-overview"}}"
12
- ></beam-redeem-transaction>`:this.activeWidget==="impact-overview"&&(t=l`
13
+ @beamnonprofitselect="${r=>{if(!(r instanceof x))return;const{selectedNonprofitId:a}=r.detail;this.nonprofitId=a??null,this.activeWidget="impact-overview"}}"
14
+ ></beam-redeem-transaction>`:this.activeWidget==="impact-overview"&&(t=d`
13
15
  <beam-impact-overview
14
16
  part="impact-overview"
15
17
  baseUrl="${this.baseUrl}"
@@ -19,7 +21,7 @@ import{f as h,g as r,t as p,h as g,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";im
19
21
  lang="${this.lang}"
20
22
  ?debug="${this.debug}"
21
23
  ></beam-impact-overview>
22
- `),l`
24
+ `),d`
23
25
  <style>
24
26
  :host {
25
27
  ${this.cssVariables.toCSS()}
@@ -58,5 +60,5 @@ import{f as h,g as r,t as p,h as g,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";im
58
60
  padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);
59
61
  max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);
60
62
  }
61
- }`],n([r({type:String})],e.prototype,"baseUrl",2),n([r({type:String})],e.prototype,"apiKey",2),n([r({type:String})],e.prototype,"subscriptionId",2),n([r({type:Number,reflect:!0})],e.prototype,"storeId",2),n([r({type:String})],e.prototype,"email",2),n([r({type:String})],e.prototype,"partnerUserId",2),n([r({type:String})],e.prototype,"postalCode",2),n([r({type:String})],e.prototype,"countryCode",2),n([r({type:String})],e.prototype,"lang",2),n([r({type:Object})],e.prototype,"cart",2),n([r({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),v(e);export{e as BeamSubscriptionManagement};
63
+ }`],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,"partnerUserId",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),v(e);export{e as BeamSubscriptionManagement};
62
64
  //# sourceMappingURL=subscription-management.esm.js.map
@@ -1 +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 { postFindOrCreateSubscription, 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 { MissingConfig } from \"../../utils/beam-errors\";\nimport { strings } from \"./strings\";\n\ninterface RequiredDataPropsWithEmail {\n email: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ninterface RequiredDataPropsWithPartnerUserId {\n partnerUserId: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ntype TRequiredDataProps = RequiredDataPropsWithEmail | RequiredDataPropsWithPartnerUserId;\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!: TRequiredDataProps[\"apiKey\"];\n\n @property({ type: String })\n public subscriptionId!: TRequiredDataProps[\"subscriptionId\"];\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?: RequiredDataPropsWithEmail[\"email\"]; // Either email or partnerUserId must be provided\n\n @property({ type: String })\n public partnerUserId?: RequiredDataPropsWithPartnerUserId[\"partnerUserId\"]; // Either email or partnerUserId must be provided\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 if (!this.email && !this.partnerUserId) {\n throw new MissingConfig(\n [\"email\", \"partnerUserId\"],\n \"One of the following properties needs to be specified: email, partnerUserId \"\n );\n }\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], 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<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], 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<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n const result = await postFindOrCreateSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n partnerUserId: this.partnerUserId,\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","m","h","e","l","n","t","o","i","a","d","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","MissingConfig","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindOrCreateSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","event","BeamNonprofitSelectEvent","selectedNonprofitId","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"+XAAO,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,OAAA,eAAAC,EAAA,OAAA,yBAAAC,EAAA,CAAAC,EAAAC,EAAAC,EAAAC,IAAA,CAAA,QAAAC,EAAAD,EAAA,EAAA,OAAAA,EAAAL,EAAAG,EAAAC,CAAA,EAAAD,EAAAI,EAAAL,EAAA,OAAA,EAAAM,EAAAD,GAAA,EAAAA,KAAAC,EAAAN,EAAAK,CAAA,KAAAD,GAAAD,EAAAG,EAAAL,EAAAC,EAAAE,CAAA,EAAAE,EAAAF,CAAA,IAAAA,GAAA,OAAAD,GAAAC,GAAAP,EAAAI,EAAAC,EAAAE,CAAA,EAAAA,CAAA,EA8BO,MAAM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AsB,EAAA,CADNC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,CAZ9B,EAAAvB,EAaJ,UAGAsB,UAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAffvB,EAgBJ,UAAA,QAAA,CAAA,EAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAlBf,EAAAvB,EAmBJ,UAGAsB,gBAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EArBfvB,EAsBJ,UAAA,aAAA,CAAA,EAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAxBfvB,EAyBJ,UAAA,cAAA,CAAA,EAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CA3Bf,EAAAvB,EA4BJ,oBAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EA9BfvB,EA+BJ,UAGAsB,OAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,OAAQ,CAAC,GAjChBvB,EAkCJ,UAAA,QAAA,CAAA,EAEUsB,EAAA,CAAhBE,EAAM,CAAA,EApCIxB,EAoCM,UAAA,eAAA,CAAA,EACAsB,EAAA,CAAhBE,GArCU,EAAAxB,EAqCM,UACAsB,cAAAA,CAAAA,EAAAA,EAAA,CAAhBE,KAtCUxB,EAsCM,UAAA,SAAA,CAAA,EACAsB,EAAA,CAAhBE,EAAM,CAAA,EAvCIxB,EAuCM,UAAA,YAAA,CAAA,EA+MnByB,EAAoBzB,CAA0B"}
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 { postFindOrCreateSubscription, 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 { MissingConfig } from \"../../utils/beam-errors\";\nimport { strings } from \"./strings\";\n\ninterface RequiredDataPropsWithEmail {\n email: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ninterface RequiredDataPropsWithPartnerUserId {\n partnerUserId: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ntype TRequiredDataProps = RequiredDataPropsWithEmail | RequiredDataPropsWithPartnerUserId;\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!: TRequiredDataProps[\"apiKey\"];\n\n @property({ type: String })\n public subscriptionId!: TRequiredDataProps[\"subscriptionId\"];\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?: RequiredDataPropsWithEmail[\"email\"]; // Either email or partnerUserId must be provided\n\n @property({ type: String })\n public partnerUserId?: RequiredDataPropsWithPartnerUserId[\"partnerUserId\"]; // Either email or partnerUserId must be provided\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 if (!this.email && !this.partnerUserId) {\n throw new MissingConfig(\n [\"email\", \"partnerUserId\"],\n \"One of the following properties needs to be specified: email, partnerUserId \"\n );\n }\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], 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<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], 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<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n const result = await postFindOrCreateSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n partnerUserId: this.partnerUserId,\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 postalCode=\"${this.postalCode}\"\n countryCode=\"${this.countryCode}\"\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","m","h","e","l","n","t","o","i","a","d","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","MissingConfig","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindOrCreateSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","event","BeamNonprofitSelectEvent","selectedNonprofitId","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"+XAAO,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,OAAA,eAAAC,EAAA,OAAA,yBAAAC,EAAA,CAAAC,EAAAC,EAAAC,EAAAC,IAAA,CAAA,QAAAC,EAAAD,EAAA,EAAA,OAAAA,EAAAL,EAAAG,EAAAC,CAAA,EAAAD,EAAAI,EAAAL,EAAA,OAAA,EAAAM,EAAAD,GAAA,EAAAA,KAAAC,EAAAN,EAAAK,CAAA,KAAAD,GAAAD,EAAAG,EAAAL,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as h,g as r,t as p,h as g,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as f,b as y,h as w}from"../chunks/routes-1-1FXngS.esm.js";import{c as S,d as v,A as m,e as c,a as x,_ as u}from"../chunks/enforce-config-fo8kIfoY.esm.js";import{c as C}from"../chunks/events-5IECSF-x.esm.js";import{M as N}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";const I={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 M=Object.defineProperty,B=Object.getOwnPropertyDescriptor,n=(i,t,o,a)=>{for(var s=a>1?void 0:a?B(t,o):t,d=i.length-1,b;d>=0;d--)(b=i[d])&&(s=(a?b(t,o,s):b(s))||s);return a&&s&&M(t,o,s),s};class e extends g{constructor(){super(...arguments),this.baseUrl=f,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(){if(!this.email&&!this.partnerUserId)throw new N(["email","partnerUserId"],"One of the following properties needs to be specified: email, partnerUserId ");c(["apiKey","subscriptionId"],this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){c(["apiKey","subscriptionId"],this);const t=await y({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(){c(["apiKey","subscriptionId"],this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});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}">
1
+ import{f as h,g as o,t as p,h as g,y as d}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as f,b as y,h as w}from"../chunks/routes-a8lsE6eZ.esm.js";import{c as S,d as v,A as u,e as b,a as C,_ as m}from"../chunks/enforce-config-fo8kIfoY.esm.js";import{c as x}from"../chunks/events-5IECSF-x.esm.js";import{M as N}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";const I={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 M=Object.defineProperty,$=Object.getOwnPropertyDescriptor,n=(i,t,r,a)=>{for(var s=a>1?void 0:a?$(t,r):t,l=i.length-1,c;l>=0;l--)(c=i[l])&&(s=(a?c(t,r,s):c(s))||s);return a&&s&&M(t,r,s),s};class e extends g{constructor(){super(...arguments),this.baseUrl=f,this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.userId=null,this.chainName=null,this.subscriptionDataController=new u(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new u(this,this.fetchEligibleNonprofits)}async firstUpdated(){if(!this.email&&!this.partnerUserId)throw new N(["email","partnerUserId"],"One of the following properties needs to be specified: email, partnerUserId ");b(["apiKey","subscriptionId"],this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){b(["apiKey","subscriptionId"],this);const t=await y({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(["apiKey","subscriptionId"],this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return this.userId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}handleSwapNonprofitButtonClick(){this.activeWidget="redeem-transaction"}renderSwapNonprofitButton(){return this.activeWidget==="impact-overview"?d`<button class="swap-nonprofit-button" @click="${this.handleSwapNonprofitButtonClick}">
2
2
  ${I[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"},o=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},a={...t,...o};return Object.assign(Object.create({toCSS(){return x(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 u({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return u({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=l` <beam-redeem-transaction
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 m({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return m({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=d` <beam-redeem-transaction
4
4
  part="redeem-transaction"
5
5
  subscriptionId="${this.subscriptionId}"
6
6
  nonprofitId=${this.nonprofitId}
7
7
  baseUrl="${this.baseUrl}"
8
8
  apiKey="${this.apiKey}"
9
+ postalCode="${this.postalCode}"
10
+ countryCode="${this.countryCode}"
9
11
  lang="${this.lang}"
10
12
  ?debug="${this.debug}"
11
- @beamnonprofitselect="${o=>{if(!(o instanceof C))return;const{selectedNonprofitId:a}=o.detail;this.nonprofitId=a??null,this.activeWidget="impact-overview"}}"
12
- ></beam-redeem-transaction>`:this.activeWidget==="impact-overview"&&(t=l`
13
+ @beamnonprofitselect="${r=>{if(!(r instanceof x))return;const{selectedNonprofitId:a}=r.detail;this.nonprofitId=a??null,this.activeWidget="impact-overview"}}"
14
+ ></beam-redeem-transaction>`:this.activeWidget==="impact-overview"&&(t=d`
13
15
  <beam-impact-overview
14
16
  part="impact-overview"
15
17
  baseUrl="${this.baseUrl}"
@@ -19,7 +21,7 @@ import{f as h,g as r,t as p,h as g,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";im
19
21
  lang="${this.lang}"
20
22
  ?debug="${this.debug}"
21
23
  ></beam-impact-overview>
22
- `),l`
24
+ `),d`
23
25
  <style>
24
26
  :host {
25
27
  ${this.cssVariables.toCSS()}
@@ -58,5 +60,5 @@ import{f as h,g as r,t as p,h as g,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";im
58
60
  padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);
59
61
  max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);
60
62
  }
61
- }`],n([r({type:String})],e.prototype,"baseUrl",2),n([r({type:String})],e.prototype,"apiKey",2),n([r({type:String})],e.prototype,"subscriptionId",2),n([r({type:Number,reflect:!0})],e.prototype,"storeId",2),n([r({type:String})],e.prototype,"email",2),n([r({type:String})],e.prototype,"partnerUserId",2),n([r({type:String})],e.prototype,"postalCode",2),n([r({type:String})],e.prototype,"countryCode",2),n([r({type:String})],e.prototype,"lang",2),n([r({type:Object})],e.prototype,"cart",2),n([r({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),v(e);export{e as BeamSubscriptionManagement};
63
+ }`],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,"partnerUserId",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),v(e);export{e as BeamSubscriptionManagement};
62
64
  //# sourceMappingURL=subscription-management.js.map
@@ -1 +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 { postFindOrCreateSubscription, 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 { MissingConfig } from \"../../utils/beam-errors\";\nimport { strings } from \"./strings\";\n\ninterface RequiredDataPropsWithEmail {\n email: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ninterface RequiredDataPropsWithPartnerUserId {\n partnerUserId: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ntype TRequiredDataProps = RequiredDataPropsWithEmail | RequiredDataPropsWithPartnerUserId;\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!: TRequiredDataProps[\"apiKey\"];\n\n @property({ type: String })\n public subscriptionId!: TRequiredDataProps[\"subscriptionId\"];\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?: RequiredDataPropsWithEmail[\"email\"]; // Either email or partnerUserId must be provided\n\n @property({ type: String })\n public partnerUserId?: RequiredDataPropsWithPartnerUserId[\"partnerUserId\"]; // Either email or partnerUserId must be provided\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 if (!this.email && !this.partnerUserId) {\n throw new MissingConfig(\n [\"email\", \"partnerUserId\"],\n \"One of the following properties needs to be specified: email, partnerUserId \"\n );\n }\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], 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<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], 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<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n const result = await postFindOrCreateSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n partnerUserId: this.partnerUserId,\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","m","h","e","l","n","t","o","i","a","d","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","MissingConfig","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindOrCreateSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","event","BeamNonprofitSelectEvent","selectedNonprofitId","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"2XAAO,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,E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GAjChBvB,EAkCJ,UAAA,QAAA,CAAA,EAEUsB,EAAA,CAAhBE,EAAM,CAAA,EApCIxB,EAoCM,UAAA,eAAA,CAAA,EACAsB,EAAA,CAAhBE,GArCU,EAAAxB,EAqCM,UACAsB,cAAAA,CAAAA,EAAAA,EAAA,CAAhBE,KAtCUxB,EAsCM,UAAA,SAAA,CAAA,EACAsB,EAAA,CAAhBE,EAAM,CAAA,EAvCIxB,EAuCM,UAAA,YAAA,CAAA,EA+MnByB,EAAoBzB,CAA0B"}
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 { postFindOrCreateSubscription, 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 { MissingConfig } from \"../../utils/beam-errors\";\nimport { strings } from \"./strings\";\n\ninterface RequiredDataPropsWithEmail {\n email: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ninterface RequiredDataPropsWithPartnerUserId {\n partnerUserId: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ntype TRequiredDataProps = RequiredDataPropsWithEmail | RequiredDataPropsWithPartnerUserId;\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!: TRequiredDataProps[\"apiKey\"];\n\n @property({ type: String })\n public subscriptionId!: TRequiredDataProps[\"subscriptionId\"];\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?: RequiredDataPropsWithEmail[\"email\"]; // Either email or partnerUserId must be provided\n\n @property({ type: String })\n public partnerUserId?: RequiredDataPropsWithPartnerUserId[\"partnerUserId\"]; // Either email or partnerUserId must be provided\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 if (!this.email && !this.partnerUserId) {\n throw new MissingConfig(\n [\"email\", \"partnerUserId\"],\n \"One of the following properties needs to be specified: email, partnerUserId \"\n );\n }\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], 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<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], 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<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n const result = await postFindOrCreateSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n partnerUserId: this.partnerUserId,\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 postalCode=\"${this.postalCode}\"\n countryCode=\"${this.countryCode}\"\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","m","h","e","l","n","t","o","i","a","d","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","MissingConfig","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindOrCreateSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","event","BeamNonprofitSelectEvent","selectedNonprofitId","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"2XAAO,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,GAA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,CA3Bf,EAAAvB,EA4BJ,oBAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EA9BfvB,EA+BJ,UAGAsB,OAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,OAAQ,CAAC,GAjChBvB,EAkCJ,UAAA,QAAA,CAAA,EAEUsB,EAAA,CAAhBE,EAAM,CAAA,EApCIxB,EAoCM,UAAA,eAAA,CAAA,EACAsB,EAAA,CAAhBE,GArCU,EAAAxB,EAqCM,UACAsB,cAAAA,CAAAA,EAAAA,EAAA,CAAhBE,KAtCUxB,EAsCM,UAAA,SAAA,CAAA,EACAsB,EAAA,CAAhBE,EAAM,CAAA,EAvCIxB,EAuCM,UAAA,YAAA,CAAA,EAiNnByB,EAAoBzB,CAA0B"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { i as WebComponents } from './chunks/index-oLz4lmx2.esm.js';
2
- export { i as Integrations } from './chunks/index-vziJysPD.esm.js';
2
+ export { i as Integrations } from './chunks/index-FnuGcS7e.esm.js';
3
3
  export { i as ReactComponents } from './chunks/index-6t9MtjyS.esm.js';
4
- export { i as Utils } from './chunks/index-_XbXZetF.esm.js';
4
+ export { i as Utils } from './chunks/index-KVvZMZmn.esm.js';
5
5
  import './components/community-impact.js';
6
6
  import 'lit';
7
7
  import 'lit-html';
@@ -13,14 +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-Z-r5GpWA.esm.js';
17
- import './chunks/openapi-spec-S9cYW1SA.esm.js';
16
+ import './chunks/cart-contents-v6_9tRb6.esm.js';
17
+ import './chunks/openapi-spec-bq7eoELU.esm.js';
18
18
  import './components/redeem-transaction.js';
19
19
  import './components/post-purchase.js';
20
20
  import './components/subscription-management.js';
21
- import './chunks/index-DU9Zy88b.esm.js';
21
+ import './chunks/index-5daMf0rK.esm.js';
22
22
  import './chunks/beam-errors-fXDkG1zo.esm.js';
23
- import './chunks/events-q1pdogmn.esm.js';
23
+ import './chunks/events-OcebkuWu.esm.js';
24
24
  import './utils/logger.js';
25
25
  import './utils/network-listeners.js';
26
26
  import './utils/local-storage.js';
@@ -30,12 +30,12 @@ import './utils/remote-session.js';
30
30
  import './utils/memoize-last.js';
31
31
  import 'lodash-es/debounce';
32
32
  import 'lodash-es/isEqual';
33
- import './chunks/index-1yMQlmZQ.esm.js';
34
- import './chunks/order-page-lfbHIKul.esm.js';
35
- import './chunks/update-cart-9-QjPC1E.esm.js';
33
+ import './chunks/index-g9-z_JOJ.esm.js';
34
+ import './chunks/order-page-2mptGhAC.esm.js';
35
+ import './chunks/update-cart-kuufrFCv.esm.js';
36
36
  import './chunks/index-EGiUuWe-.esm.js';
37
- import './chunks/index-mrZj61ji.esm.js';
38
- import './chunks/index-xRdmiNwx.esm.js';
37
+ import './chunks/index-JwkkxR5U.esm.js';
38
+ import './chunks/index-wlzifF_l.esm.js';
39
39
  import './react/community-impact.js';
40
40
  import '@lit/react';
41
41
  import './react/cumulative-impact.js';
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import{i as Q}from"./chunks/index-5yFqo0yl.esm.js";import{i as T}from"./chunks/index-0XoQisEb.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-RgILh2Qy.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-8Rkw987L.esm.js";import"./chunks/order-page-zZ0JffzK.esm.js";import"./chunks/update-cart-V2ysW2LO.esm.js";import"./chunks/index-9YcaEQju.esm.js";import"./chunks/index-oCRI089I.esm.js";import"./chunks/index-KbG1GoVy.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};
1
+ import{i as Q}from"./chunks/index-5yFqo0yl.esm.js";import{i as T}from"./chunks/index-HmjLoc_p.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-d2vC4TDa.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-yWjLS42R.esm.js";import"./chunks/order-page-XNVqjTGF.esm.js";import"./chunks/update-cart-p84B0Ga6.esm.js";import"./chunks/index-9YcaEQju.esm.js";import"./chunks/index-Gz47LtoA.esm.js";import"./chunks/index-ZiApqExt.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 Q}from"./chunks/index-IzAvjker.esm.js";import{i as T}from"./chunks/index-YN68B9ro.esm.js";import{i as X}from"./chunks/index-EHubF2KN.esm.js";import{i as Z}from"./chunks/index-U8Oy2aur.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-1-1FXngS.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-wsdeaTHd.esm.js";import"./utils/wait-for-element.js";import"./utils/remote-session.js";import"./utils/memoize-last.js";import"./chunks/index-nb5G3fNW.esm.js";import"./chunks/order-page-OFWAlLqS.esm.js";import"./chunks/update-cart-EVuB41Qg.esm.js";import"./chunks/index-Z1UUeVXR.esm.js";import"./chunks/index-44M_qqUx.esm.js";import"./chunks/index-58VYn82f.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};
1
+ import{i as Q}from"./chunks/index-IzAvjker.esm.js";import{i as T}from"./chunks/index-2d2pxFdE.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-a8lsE6eZ.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-kLkFc8M_.esm.js";import"./chunks/order-page-NwFyJU-V.esm.js";import"./chunks/update-cart-gv6ortZ5.esm.js";import"./chunks/index-Z1UUeVXR.esm.js";import"./chunks/index-yxnSM7PZ.esm.js";import"./chunks/index-HSr3vG8C.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-RgILh2Qy.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-KbG1GoVy.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};
1
+ import{D as u,a as g}from"../chunks/routes-d2vC4TDa.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-ZiApqExt.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-1FXngS.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-58VYn82f.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};
1
+ import{D as u,a as g}from"../chunks/routes-a8lsE6eZ.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-HSr3vG8C.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-9-QjPC1E.esm.js';
1
+ export { B as BeamCartAPIConfig, a as BeamCartValues, u as updateCart } from '../chunks/update-cart-kuufrFCv.esm.js';
2
2
  import 'lodash';
3
3
  import '../chunks/types-aju0qrRe.esm.js';
4
- import '../chunks/cart-contents-Z-r5GpWA.esm.js';
5
- import '../chunks/openapi-spec-S9cYW1SA.esm.js';
4
+ import '../chunks/cart-contents-v6_9tRb6.esm.js';
5
+ import '../chunks/openapi-spec-bq7eoELU.esm.js';
@@ -1,2 +1,2 @@
1
- import{x as C}from"../chunks/update-cart-V2ysW2LO.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-RgILh2Qy.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};
1
+ import{x as C}from"../chunks/update-cart-p84B0Ga6.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-d2vC4TDa.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-EVuB41Qg.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-1-1FXngS.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};
1
+ import{x as C}from"../chunks/update-cart-gv6ortZ5.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-a8lsE6eZ.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-DU9Zy88b.esm.js';
2
- export { i as Shopify } from '../chunks/index-1yMQlmZQ.esm.js';
1
+ export { i as Utils } from '../chunks/index-5daMf0rK.esm.js';
2
+ export { i as Shopify } from '../chunks/index-g9-z_JOJ.esm.js';
3
3
  export { i as Session } from '../chunks/index-EGiUuWe-.esm.js';
4
- export { i as Cart } from '../chunks/index-mrZj61ji.esm.js';
5
- export { i as Logs } from '../chunks/index-xRdmiNwx.esm.js';
4
+ export { i as Cart } from '../chunks/index-JwkkxR5U.esm.js';
5
+ export { i as Logs } from '../chunks/index-wlzifF_l.esm.js';
6
6
  import '../chunks/beam-errors-fXDkG1zo.esm.js';
7
- import '../chunks/events-q1pdogmn.esm.js';
8
- import '../chunks/cart-contents-Z-r5GpWA.esm.js';
9
- import '../chunks/openapi-spec-S9cYW1SA.esm.js';
7
+ import '../chunks/events-OcebkuWu.esm.js';
8
+ import '../chunks/cart-contents-v6_9tRb6.esm.js';
9
+ import '../chunks/openapi-spec-bq7eoELU.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-lfbHIKul.esm.js';
20
+ import '../chunks/order-page-2mptGhAC.esm.js';
21
21
  import 'lodash';
22
- import '../chunks/update-cart-9-QjPC1E.esm.js';
22
+ import '../chunks/update-cart-kuufrFCv.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 w}from"../chunks/index-9gijHGwh.esm.js";import{i as A}from"../chunks/index-8Rkw987L.esm.js";import{i as D}from"../chunks/index-9YcaEQju.esm.js";import{i as F}from"../chunks/index-oCRI089I.esm.js";import{i as H}from"../chunks/index-KbG1GoVy.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-zZ0JffzK.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-V2ysW2LO.esm.js";import"../chunks/routes-RgILh2Qy.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};
1
+ import{i as w}from"../chunks/index-9gijHGwh.esm.js";import{i as A}from"../chunks/index-yWjLS42R.esm.js";import{i as D}from"../chunks/index-9YcaEQju.esm.js";import{i as F}from"../chunks/index-Gz47LtoA.esm.js";import{i as H}from"../chunks/index-ZiApqExt.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-XNVqjTGF.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-p84B0Ga6.esm.js";import"../chunks/routes-d2vC4TDa.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 w}from"../chunks/index-wsdeaTHd.esm.js";import{i as A}from"../chunks/index-nb5G3fNW.esm.js";import{i as D}from"../chunks/index-Z1UUeVXR.esm.js";import{i as F}from"../chunks/index-44M_qqUx.esm.js";import{i as H}from"../chunks/index-58VYn82f.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-OFWAlLqS.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-EVuB41Qg.esm.js";import"../chunks/routes-1-1FXngS.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};
1
+ import{i as w}from"../chunks/index-U8Oy2aur.esm.js";import{i as A}from"../chunks/index-kLkFc8M_.esm.js";import{i as D}from"../chunks/index-Z1UUeVXR.esm.js";import{i as F}from"../chunks/index-yxnSM7PZ.esm.js";import{i as H}from"../chunks/index-HSr3vG8C.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-NwFyJU-V.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-gv6ortZ5.esm.js";import"../chunks/routes-a8lsE6eZ.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-S9cYW1SA.esm.js';
2
- export { s as sendLog } from '../chunks/index-xRdmiNwx.esm.js';
1
+ import '../chunks/openapi-spec-bq7eoELU.esm.js';
2
+ export { s as sendLog } from '../chunks/index-wlzifF_l.esm.js';
@@ -1,2 +1,2 @@
1
- import"../chunks/routes-RgILh2Qy.esm.js";import"../utils/logger.esm.js";import{s as i}from"../chunks/index-KbG1GoVy.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";export{i as sendLog};
1
+ import"../chunks/routes-d2vC4TDa.esm.js";import"../utils/logger.esm.js";import{s as i}from"../chunks/index-ZiApqExt.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-1FXngS.esm.js";import"../utils/logger.js";import{s as i}from"../chunks/index-58VYn82f.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";export{i as sendLog};
1
+ import"../chunks/routes-a8lsE6eZ.esm.js";import"../utils/logger.js";import{s as i}from"../chunks/index-HSr3vG8C.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-P-Lu07Ce.esm.js";export{s as createSession,a as endSession};
1
+ import"../chunks/vendor-eeJfrOkP.esm.js";import"../utils/cookies.esm.js";import"../utils/local-storage.esm.js";import{c as a,e as n}from"../chunks/index-9YcaEQju.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";export{a as createSession,n 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-P-Lu07Ce.esm.js";export{s as createSession,a as endSession};
1
+ import"../chunks/vendor-eeJfrOkP.esm.js";import"../utils/cookies.js";import"../utils/local-storage.js";import{c as a,e as n}from"../chunks/index-Z1UUeVXR.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";export{a as createSession,n as endSession};
2
2
  //# sourceMappingURL=session.js.map