@lockerverse/react 0.2.198-dev.1 → 0.2.200

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/MIGRATIONS.md CHANGED
@@ -36,6 +36,13 @@ If it cannot be found, report that limit and use the baseline review below. Do n
36
36
  claim that every historical migration was applied. Read this file even if the
37
37
  version already matches: a previous upgrade may have missed host adoption steps.
38
38
 
39
+ ## 0.2.200 — shared page launcher loading state
40
+
41
+ React page launchers accept `loadingFallback` to replace the entire launcher
42
+ while catalog options initialize or refresh. Hosts can pass their existing page
43
+ skeleton to avoid a second SDK loading panel. Dialog launchers and fixed payment
44
+ components are unchanged. Adoption is optional; verify cold load and Continue.
45
+
39
46
  ## 0.2.197 — disable Stripe Link in React widget checkout
40
47
 
41
48
  New React widget checkout forms request card payments, plus US bank account
@@ -60,11 +67,12 @@ No host prop change is required.
60
67
  configuration; remount for another link. Filtering is not server authorization.
61
68
  - **Optional:** Use `showDescription={false}` and the public page root class,
62
69
  `className`, `style`, and existing theme tokens for minimal branded pages.
63
- - **Hosted URL:** `/checkout?community=<slug>&widget=<slug>` defaults to dark.
64
- Optional `include` lists purchasable product slugs; `q.<slug>` prefills quantities.
65
- Use `theme=light` for light mode. Dev branch uses the development backend;
66
- production uses production. Explicit `env=development` or `env=production`
67
- selects a backend. The fixed checkout remains separate.
70
+ - **Hosted URL:** `https://app.lockerverse.com/<community>/widgets/v2/<widget>/checkout`
71
+ defaults to dark. Optional `include` lists purchasable product slugs;
72
+ `q.<slug>` prefills quantities. Use `theme=light` for light mode. The app
73
+ deployment selects its backend. The fixed checkout remains separate.
74
+ Older SDK-domain `/checkout?community=<slug>&widget=<slug>` links redirect
75
+ to the app, preserving the product filter, quantities, and theme.
68
76
  - **Verification:** Check both themes, mobile width, excluded prefill, quantity
69
77
  limits, Continue, and Edit order without submitting a live payment.
70
78
 
@@ -108,7 +116,7 @@ No host prop change is required.
108
116
  - **Check:** inspect a wide and a tall photo on desktop and mobile. Confirm all
109
117
  edges remain visible in the item gallery, thumbnails, and full-screen viewer.
110
118
 
111
- ## 0.2.192-dev.1 — auction item additional charges
119
+ ## 0.2.191 — auction item additional charges
112
120
 
113
121
  - **Affected:** Core auction item data, purchase quotes, and React auction checkout.
114
122
  - **Automatic:** optional `additionalCharge` charges the first-item amount plus the
@@ -126,7 +134,7 @@ No host prop change is required.
126
134
  - **Check:** compare one, two, and maximum quantity totals with the server quote,
127
135
  verify the per-order limit, and inspect the named charge row before payment.
128
136
 
129
- ## 0.2.190-dev.1 — widget load recovery and Sentry releases
137
+ ## 0.2.189 — widget load recovery and Sentry releases
130
138
 
131
139
  - **Affected:** Core widget loading and SDK failure reporting.
132
140
  - **Automatic:** a widget GET retries once after a network failure or request
@@ -153,7 +161,6 @@ No host prop change is required.
153
161
  - **Check:** select one, two, and the maximum allowed trigger quantity. Confirm the
154
162
  local summary and server quote agree; removing all trigger items removes shipping.
155
163
 
156
-
157
164
  ## 0.2.184 — single focus boundary for form fields
158
165
 
159
166
  - **Affected:** React form controls and the shared phone field in payment and signup.
@@ -173,7 +180,7 @@ Widgets can now use a private contact list for email eligibility, a fixed amount
173
180
  Required shipping appears in `catalog.widget.requiredShipping`. Do not offer this product as a separate shopper choice. The SDK adds its quantity once when a trigger product is selected; the server also enforces this rule. Render authoritative quote line items and totals, including shipping. The built-in launcher and payment summary handle this automatically.
174
181
 
175
182
 
176
- ## 0.2.176-dev.1 — Secure checkout loading recovery
183
+ ## 0.2.177 — Secure checkout loading recovery
177
184
 
178
185
  - **Affected:** React payment widget Stripe fields.
179
186
  - **Automatic:** failed field or script loads show a reload action. Fields that
@@ -185,22 +192,8 @@ Required shipping appears in `catalog.widget.requiredShipping`. Do not offer thi
185
192
  - Reload is an explicit customer action and can clear unsaved form entries.
186
193
  Saved payment recovery remains in session storage.
187
194
 
188
- ## 0.2.175 — Match Stripe Elements payment method configuration
189
-
190
- - **Affected:** Core checkout submission and React payment widgets.
191
- - **Automatic:** React configures explicit card, Link, and community-enabled bank
192
- methods in Stripe Elements and marks the confirmation request with
193
- `paymentMethodConfiguration: "explicit"`. This matches the backend's Stripe
194
- PaymentIntent configuration.
195
- - **Required:** deploy the backend that supports this optional marker before
196
- upgrading React. Keep Core and React matched. Existing Core-only callers omit
197
- the marker and retain automatic payment methods. Custom Elements integrations
198
- must send the marker only when they use the explicit method list.
199
- - **Check:** submit card and bank payments through Stripe Elements in test mode,
200
- including recurring checkout. Confirm pending recovery and settlement.
201
-
202
195
 
203
- ## 0.2.174-dev.1 — Match Stripe Elements payment method configuration
196
+ ## 0.2.175 — Match Stripe Elements payment method configuration
204
197
 
205
198
  - **Affected:** Core checkout submission and React payment widgets.
206
199
  - **Automatic:** React configures explicit card, Link, and community-enabled bank
@@ -275,39 +268,7 @@ Required shipping appears in `catalog.widget.requiredShipping`. Do not offer thi
275
268
  verify a changed selection cannot discard it. Check both paid and free order
276
269
  confirmation panels. Do not submit a live transaction for this check.
277
270
 
278
- ## 0.2.172-dev.1 — Check pending payment status
279
-
280
- - **Affected:** React payment widgets with unresolved payments.
281
- - **Automatic behavior:** the existing pending-payment screen now offers Check
282
- payment status. It checks the saved payment reference and cannot submit a new
283
- payment. The control is disabled while the check runs.
284
- - **Required host changes:** none. Update Core and React together.
285
- - **Verification:** complete a test bank payment, return to its pending checkout,
286
- and check its status. Confirm completion clears recovery storage.
287
-
288
- ## 0.2.171-dev.1 — SDK payment recovery and completion UI
289
-
290
- - **Affected:** React payment widgets and custom hosts that persist payment recovery.
291
- - **Optional adoption:** pass `recoveryStorageKey` to `LockerversePayment` to let
292
- the SDK save and restore the pending payment in session storage. Use a stable
293
- key scoped to the API environment, community, and widget. Remove the host's
294
- storage code and recovery-driven component key. Do not combine automatic
295
- persistence with a second host persistence writer.
296
- - **Compatibility:** the SDK reads the hosted Next app's existing version 1
297
- records when the same key is used. It writes version 2 records with widget
298
- identity. It checks widget and selection identity before recovery and keeps
299
- an unresolved record if those details differ. Recovery uses the saved connected
300
- account even if current payment routing has changed. Storage is read after hydration,
301
- before the payable form mounts. No contact details or payment tokens are saved.
302
- - **Optional UI adoption:** use `completionView="summary"` for the SDK confirmation
303
- panel and remove the host's duplicate success panel. Completion callbacks still
304
- run. The default inline message and explicit `resumePayment` integrations remain
305
- supported. Auctions and legacy custom checkout forms are unchanged.
306
- - **Check:** reload a pending checkout and confirm the existing payment is checked;
307
- verify a changed selection cannot discard it. Check both paid and free order
308
- confirmation panels. Do not submit a live transaction for this check.
309
-
310
- ## 0.2.169-dev.1 — six-month payment widgets
271
+ ## 0.2.170 — six-month payment widgets
311
272
 
312
273
  Affected: @lockerverse/sdk checkout and @lockerverse/react payment widgets.
313
274
 
@@ -323,31 +284,6 @@ Affected: @lockerverse/sdk checkout and @lockerverse/react payment widgets.
323
284
  submission. Do not submit a live payment for an integration check.
324
285
 
325
286
 
326
- ## 0.2.168-dev.1 — bank authorization terms
327
-
328
- - **Affected:** React payment widgets with ACH enabled.
329
- - **Automatic:** Stripe displays its bank authorization terms before payment confirmation.
330
- - **Adoption:** update the matching SDK/React development pair. No prop changes are required.
331
- - **Check:** confirm that the bank authorization text is visible when a bank account is selected.
332
-
333
- ## 0.2.167-dev.1 — widget ACH and subscription payment recovery
334
-
335
- - **Affected:** Core checkout data and React payment widgets.
336
- - **Automatic:** bank payment availability follows the organization default and
337
- community override returned by the backend. Missing policy remains disabled.
338
- Pending payments keep their existing payment reference. A failed subscription
339
- invoice can return `action_required` with `requiresAction: false` and `retryUrl`;
340
- React shows a link to pay the same invoice instead of creating a second subscription.
341
- - **Required for custom payment UI:** preserve the reference for pending and
342
- action-required results. Handle `retryUrl` by opening that invoice, and recover
343
- status before permitting a new checkout. Do not treat submission as settlement.
344
- - **Adoption:** deploy the matching backend policy and recovery contract before
345
- enabling ACH. Existing React hosts need no component prop changes. Keep Core and
346
- React versions matched when upgrading. Auction payment methods are unchanged.
347
- - **Check:** verify disabled/inherited/enabled bank visibility and pending, bank
348
- verification, invoice retry, success, and terminal failure in Stripe test mode.
349
- Do not create a live transaction for this check.
350
-
351
287
  ## 0.2.166 — single dropdown arrow
352
288
 
353
289
  - **Affected:** native single-select custom fields in React signup and payment forms.
@@ -1,6 +1,7 @@
1
1
  import { n as LockerverseDonateLauncherProps } from "./types.js";
2
+ import { ReactNode } from "react";
2
3
  //#region src/lockerverse-donate-launcher.d.ts
3
- declare function LockerverseDonateLauncher({ buttonLabel, position, presentation, initialSelection, productIds, showDescription, widget, ...paymentProps }: LockerverseDonateLauncherProps): import("react").JSX.Element;
4
+ declare function LockerverseDonateLauncher({ buttonLabel, position, presentation, loadingFallback, initialSelection, productIds, showDescription, widget, ...paymentProps }: LockerverseDonateLauncherProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
4
5
  //#endregion
5
6
  export { LockerverseDonateLauncher as t };
6
7
  //# sourceMappingURL=lockerverse-donate-launcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lockerverse-donate-launcher.d.ts","names":[],"sources":["../src/lockerverse-donate-launcher.tsx"],"mappings":";;iBA6oBgB,4BACd,aACA,UACA,cACA,kBACA,YACA,iBACA,WACG,gBACF,iDAA8B,IAAA"}
1
+ {"version":3,"file":"lockerverse-donate-launcher.d.ts","names":[],"sources":["../src/lockerverse-donate-launcher.tsx"],"mappings":";;;iBAqpBgB,4BACd,aACA,UACA,cACA,iBACA,kBACA,YACA,iBACA,WACG,gBACF,sFAA8B,IAAA,UAAA,SAAA,aAAA,6DAAA,8BAAA,+CAAA,8BAAA,SAAA"}
@@ -1,2 +1,2 @@
1
- import{n as e,t}from"./accent-contrast.js";import{n,t as r}from"./lockerverse-payment.js";import{createElement as i,useEffect as a,useMemo as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{Dialog as d}from"@base-ui/react/dialog";import{getLockerverseMinimumCustomAmountCents as f}from"@lockerverse/sdk/checkout";function p(e,t){let n={},r={},i=null;for(let a of t){let t=e.products.find(e=>e.slug===a.productSlug);if(!(!t||t.id===e.widget.requiredShipping?.productId)){if(t.paymentOption!==`one-time`){if(!(`quantity`in a||`amountCents`in a)){i=t.id;break}continue}t.pricingMode===`fixed`&&`quantity`in a&&Number.isSafeInteger(a.quantity)&&a.quantity>0&&(n[t.id]=m(t,a.quantity)),t.pricingMode===`custom`&&`amountCents`in a&&Number.isSafeInteger(a.amountCents)&&a.amountCents>=f(t)&&(r[t.id]=(a.amountCents/100).toFixed(2))}}return i?{customAmounts:{},quantities:{},recurringProductId:i}:{customAmounts:r,quantities:n,recurringProductId:i}}function m(e,t){let n=e.minimumQuantity??1,r=Math.min(e.maximumQuantity??1/0,e.inventoryQuantity??1/0);return r<n?0:Math.min(r,Math.max(n,t))}function h(e,t){return!e||t===void 0?e:{...e,products:e.products.filter(n=>t.includes(n.id)||n.id===e.widget.requiredShipping?.productId)}}function g(e,t){return t||!e?e:{...e,widget:{...e.widget,description:null}}}const _=new Intl.NumberFormat(`en-US`,{currency:`USD`,style:`currency`}),v=/^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/,y=[1e3,2500,5e3,1e4];function b(e){if(!v.test(e))return null;let t=Math.round(Number(e)*100);return Number.isSafeInteger(t)&&t>0?t:null}function x(e,t){let n=``;return t===`monthly`&&(n=`/month`),t===`annually`&&(n=`/year`),t===`every-six-months`&&(n=` every 6 months`),`${_.format(e/100)}${n}`}function S({product:e,quantities:t,setQuantities:n,setRecurringProductId:r}){let i=(t[e.id]??0)>0;return l(`span`,{className:`lockerverse-launcher__optional-control`,children:l(`input`,{"aria-label":e.name,checked:i,className:`lockerverse-launcher__optional-switch`,disabled:!i&&e.inventoryQuantity===0,onChange:()=>{r(null),n(t=>({...t,[e.id]:(t[e.id]??0)>0?0:1}))},type:`checkbox`})})}function C({customAmounts:e,product:t,quantities:n,recurringProductId:r,setCustomAmounts:i,setQuantities:a,setRecurringProductId:o}){let s=n[t.id]??0;if(t.pricingMode===`fixed`&&t.paymentOption===`one-time`){let e=t.minimumQuantity??1,n=Math.min(t.maximumQuantity??1/0,t.inventoryQuantity??1/0);return u(`span`,{className:`lockerverse-launcher__quantity`,children:[l(`button`,{"aria-label":`Decrease ${t.name} quantity`,disabled:s===0,onClick:()=>{o(null),a(n=>{let r=n[t.id]??0;return{...n,[t.id]:r<=e?0:r-1}})},type:`button`,children:`−`}),l(`output`,{"aria-label":`${t.name} quantity`,children:s}),l(`button`,{"aria-label":`Increase ${t.name} quantity`,disabled:n<e||s>=n,onClick:()=>{o(null),a(n=>{let r=n[t.id]??0;return{...n,[t.id]:r===0?e:r+1}})},type:`button`,children:`+`})]})}return t.pricingMode===`custom`&&t.paymentOption===`one-time`?u(`span`,{className:`lockerverse-launcher__custom-amount`,children:[l(`span`,{"aria-hidden":`true`,children:`$`}),l(`input`,{"aria-label":`${t.name} amount`,min:f(t)/100,name:`amount-${t.slug}`,onChange:e=>{o(null),i(n=>({...n,[t.id]:e.target.value}))},placeholder:`0.00`,step:`0.01`,type:`number`,value:e[t.id]??``}),t.minimumAmountCents===null?null:u(`small`,{children:[`Minimum `,_.format(t.minimumAmountCents/100)]})]}):l(`button`,{"aria-label":`Select ${t.name}`,"aria-pressed":r===t.id,className:`lockerverse-launcher__select`,onClick:()=>{a({}),i({}),o(e=>e===t.id?null:t.id)},type:`button`,children:`Select`})}function w({variant:e=`default`,...t}){let{customAmounts:n,product:r,quantities:i,recurringProductId:a}=t,o=b(n[r.id]??``),s=a===r.id||r.paymentOption===`one-time`&&(r.pricingMode===`fixed`&&(i[r.id]??0)>0||r.pricingMode===`custom`&&o!==null&&o>=f(r));return u(`article`,{className:`lockerverse-launcher__product lockerverse-launcher__product--${e}`,"data-selected":s||void 0,children:[u(`span`,{className:`lockerverse-launcher__product-copy`,children:[l(`strong`,{className:`lockerverse-launcher__product-name`,children:r.name}),r.description?l(`small`,{children:r.description}):null,r.amountCents===null?null:l(`span`,{className:`lockerverse-launcher__product-price`,children:x(r.amountCents,r.paymentOption)})]}),r.pricingMode===`fixed`&&r.paymentOption===`one-time`&&r.maximumQuantity===1&&(r.minimumQuantity??1)<=1?l(S,{...t}):l(C,{...t})]})}function T({customAmounts:e,product:t,setCustomAmounts:n,setRecurringProductId:r}){let i=e[t.id]??``,a=b(i),o=y.filter(e=>e>=f(t)),s=o.includes(a??0),c=e=>{r(null),n(n=>({...n,[t.id]:e}))};return l(`div`,{className:`lockerverse-launcher__donation-option`,children:u(`fieldset`,{className:`lockerverse-launcher__donation-choices`,children:[u(`legend`,{className:`lockerverse-launcher__sr-only`,children:[t.name,` amount`]}),l(`button`,{"aria-pressed":i===``,onClick:()=>c(``),type:`button`,children:`No thanks`}),o.map(e=>l(`button`,{"aria-pressed":a===e,onClick:()=>c(String(e/100)),type:`button`,children:_.format(e/100).replace(`.00`,``)},e)),l(`label`,{className:`lockerverse-launcher__donation-other`,"data-selected":i!==``&&!s||void 0,children:l(`input`,{"aria-label":`${t.name} amount`,min:f(t)/100,name:`amount-${t.slug}`,onChange:e=>c(e.target.value),placeholder:`Other $`,step:`0.01`,type:`number`,value:s?``:i})})]})})}function E({products:e,variant:t=`default`,...n}){return l(`div`,{className:`lockerverse-launcher__product-list`,children:e.map(e=>t===`donation`?i(T,{...n,key:e.id,product:e}):i(w,{...n,key:e.id,product:e,variant:t}))})}function D(e,t){let n=0,r=0;for(let i of t){let t=e.products.find(e=>e.slug===i.productSlug);if(t){if(`quantity`in i){n+=i.quantity,r+=(t.amountCents??0)*i.quantity;continue}n+=1,r+=`amountCents`in i?i.amountCents:t.amountCents??0}}let i=e.widget.requiredShipping,a=i?t.reduce((t,n)=>{let r=e.products.find(e=>e.slug===n.productSlug);return r&&i.triggerProductIds.includes(r.id)?t+(`quantity`in n?n.quantity:1):t},0):0,o=a>0;return i&&o&&(r+=(e.products.find(e=>e.id===i.productId)?.amountCents??0)+Math.max(0,a-1)*(i.additionalUnitAmountCents??0)),{amountCents:r,itemCount:n,needsShipping:o}}function O(){return l(`div`,{"aria-label":`Loading donation options`,className:`lockerverse-launcher__loading`,role:`status`,children:[0,1,2].map(e=>l(`span`,{"aria-hidden":`true`,className:`lockerverse-launcher__loading-row`},e))})}function k(e,t,n,r){if(r){let t=e.products.find(e=>e.id===r&&e.paymentOption!==`one-time`);return t?[{productSlug:t.slug}]:[]}return e.products.flatMap(e=>{let r=t[e.id]??0;if(e.pricingMode===`fixed`&&e.paymentOption===`one-time`&&r>0)return[{productSlug:e.slug,quantity:r}];let i=b(n[e.id]??``);return e.pricingMode===`custom`&&e.paymentOption===`one-time`&&i!==null&&i>=f(e)?[{amountCents:i,productSlug:e.slug}]:[]})}function A({catalog:e,onContinue:t,...n}){let r=k(e,n.quantities,n.customAmounts,n.recurringProductId),i=D(e,r),a=e.products.filter(e=>e.paymentOption===`one-time`&&e.pricingMode===`custom`),o=e.products.filter(t=>!a.includes(t)&&t.id!==e.widget.requiredShipping?.productId);return u(`form`,{className:`lockerverse-launcher__products`,onSubmit:e=>{e.preventDefault(),r.length>0&&t(r)},children:[o.length>0?l(`section`,{className:`lockerverse-launcher__section`,children:l(E,{...n,products:o})}):null,a.length>0?u(`section`,{className:`lockerverse-launcher__donation`,children:[u(`header`,{className:`lockerverse-launcher__section-header`,children:[l(`h3`,{children:`Add a donation`}),l(`p`,{children:`Choose an amount to add to this order.`})]}),l(E,{...n,products:a,variant:`donation`})]}):null,o.length+a.length>0?u(`footer`,{className:`lockerverse-launcher__footer`,children:[u(`p`,{"aria-live":`polite`,className:`lockerverse-launcher__summary`,children:[l(`span`,{children:i.itemCount===0?`No items selected`:`${i.itemCount} ${i.itemCount===1?`item`:`items`} selected`}),i.itemCount===0?null:l(`strong`,{children:_.format(i.amountCents/100)})]}),i.needsShipping?l(`p`,{children:`Shipping is included once per order.`}):null,l(`button`,{className:`lockerverse-launcher__continue`,disabled:r.length===0,type:`submit`,children:`Continue`})]}):l(`p`,{children:`No products are available for this link.`})]})}function j({presentation:e,onEdit:t,paymentProps:n,selection:i,style:a,widget:o}){return u(`div`,{className:`lockerverse-launcher__checkout`,children:[l(`header`,{className:`lockerverse-launcher__checkout-toolbar`,children:l(`button`,{className:`lockerverse-launcher__back`,onClick:t,type:`button`,children:`Edit order`})}),l(r,{...n,className:e===`page`?void 0:n.className,selection:i,style:a,widget:o})]})}function M({catalog:e,checkout:t,presentation:n=`dialog`,showDescription:r=!0}){let i=n===`page`?`h1`:d.Title,a=n===`page`?`p`:d.Description;return t&&n===`page`?null:t?u(c,{children:[l(i,{className:`lockerverse-launcher__sr-only`,children:`Checkout`}),l(a,{className:`lockerverse-launcher__sr-only`,children:`Review the order and complete payment.`})]}):e?u(`header`,{className:`lockerverse-launcher__header`,children:[e.community?u(`div`,{className:`lockerverse-launcher__brand`,children:[e.community.imageUrl?l(`img`,{alt:`${e.community.name} logo`,height:`28`,src:e.community.imageUrl,width:`28`}):null,l(`span`,{children:e.community.name})]}):null,l(i,{className:`lockerverse-launcher__title`,children:e.widget.title??e.widget.name}),l(a,{className:`lockerverse-launcher__description`,hidden:!r,children:e.widget.description??`Choose your options, then continue to checkout.`})]}):u(`header`,{className:`lockerverse-launcher__header`,children:[l(i,{className:`lockerverse-launcher__title`,children:`Donate`}),l(a,{className:`lockerverse-launcher__description`,hidden:!r,children:`Choose your options, then continue to checkout.`})]})}function N({buttonLabel:r=`Donate`,position:i=`inline`,presentation:c=`dialog`,initialSelection:f=[],productIds:m,showDescription:_=!0,widget:v,...y}){let[b,x]=s(null),[S,C]=s({}),[w,T]=s({}),[E,D]=s(null),[k]=s(()=>({initialSelection:f.map(e=>({...e})),productIds:m?[...m]:void 0})),[N,P]=s(!1),{error:F,loading:I}=v,L=o(()=>g(v.catalog,_),[v.catalog,_]),R=h(v.catalog,k.productIds);a(()=>{if(N||!v.catalog)return;let e=h(v.catalog,k.productIds);if(!e)return;let t=p(e,k.initialSelection);T(t.quantities),C(t.customAmounts),D(t.recurringProductId),P(!0)},[N,v.catalog,k]);let z=e(y.style?.[`--lockerverse-accent`]??R?.community?.accentColor??`#38d77a`),B=t(z),V={...y.style};(y.style?.[`--lockerverse-accent`]!==void 0||R?.community?.accentColor)&&(V[`--lockerverse-accent`]=z),B&&y.style?.[`--lockerverse-accent-contrast`]===void 0&&(V[`--lockerverse-accent-contrast`]=B);let H;return H=I||!(N||F)?l(O,{}):F?u(`div`,{role:`alert`,children:[l(`p`,{children:`Unable to load donation options.`}),l(`button`,{onClick:v.refresh,type:`button`,children:`Retry`})]}):R?l(A,{catalog:R,customAmounts:S,onContinue:x,quantities:w,recurringProductId:E,setCustomAmounts:C,setQuantities:T,setRecurringProductId:D}):l(O,{}),!(I||F)&&b&&R&&(H=l(j,{onEdit:()=>x(null),paymentProps:y,presentation:c,selection:b,style:V,widget:{...v,catalog:L}})),c===`page`?u(`section`,{className:`lockerverse-launcher__dialog lockerverse-launcher__page ${y.className??``}`,"data-lockerverse-theme":y.theme??`dark`,style:V,children:[l(M,{catalog:R,checkout:b!==null,presentation:`page`,showDescription:_}),H]}):u(d.Root,{onOpenChange:e=>{e&&R&&y.stripeLoader===void 0&&requestAnimationFrame(()=>{n(R)})},children:[l(d.Trigger,{className:`lockerverse-launcher lockerverse-launcher--${i}`,"data-lockerverse-theme":y.theme??`dark`,style:V,children:r}),u(d.Portal,{children:[l(d.Backdrop,{className:`lockerverse-launcher__backdrop`}),l(d.Viewport,{className:`lockerverse-launcher__viewport`,children:u(d.Popup,{className:`lockerverse-launcher__dialog`,"data-lockerverse-theme":y.theme??`dark`,style:V,children:[l(M,{catalog:R,checkout:b!==null,showDescription:_}),l(d.Close,{"aria-label":`Close donation dialog`,className:`lockerverse-launcher__close`,children:l(`span`,{"aria-hidden":`true`,children:`×`})}),H]})})]})]})}export{N as t};
1
+ import{n as e,t}from"./accent-contrast.js";import{n,t as r}from"./lockerverse-payment.js";import{createElement as i,useEffect as a,useMemo as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{Dialog as d}from"@base-ui/react/dialog";import{getLockerverseMinimumCustomAmountCents as f}from"@lockerverse/sdk/checkout";function p(e,t){let n={},r={},i=null;for(let a of t){let t=e.products.find(e=>e.slug===a.productSlug);if(!(!t||t.id===e.widget.requiredShipping?.productId)){if(t.paymentOption!==`one-time`){if(!(`quantity`in a||`amountCents`in a)){i=t.id;break}continue}t.pricingMode===`fixed`&&`quantity`in a&&Number.isSafeInteger(a.quantity)&&a.quantity>0&&(n[t.id]=m(t,a.quantity)),t.pricingMode===`custom`&&`amountCents`in a&&Number.isSafeInteger(a.amountCents)&&a.amountCents>=f(t)&&(r[t.id]=(a.amountCents/100).toFixed(2))}}return i?{customAmounts:{},quantities:{},recurringProductId:i}:{customAmounts:r,quantities:n,recurringProductId:i}}function m(e,t){let n=e.minimumQuantity??1,r=Math.min(e.maximumQuantity??1/0,e.inventoryQuantity??1/0);return r<n?0:Math.min(r,Math.max(n,t))}function h(e,t){return!e||t===void 0?e:{...e,products:e.products.filter(n=>t.includes(n.id)||n.id===e.widget.requiredShipping?.productId)}}function g(e,t){return t||!e?e:{...e,widget:{...e.widget,description:null}}}const _=new Intl.NumberFormat(`en-US`,{currency:`USD`,style:`currency`}),v=/^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/,y=[1e3,2500,5e3,1e4];function b(e){if(!v.test(e))return null;let t=Math.round(Number(e)*100);return Number.isSafeInteger(t)&&t>0?t:null}function x(e,t){let n=``;return t===`monthly`&&(n=`/month`),t===`annually`&&(n=`/year`),t===`every-six-months`&&(n=` every 6 months`),`${_.format(e/100)}${n}`}function S({product:e,quantities:t,setQuantities:n,setRecurringProductId:r}){let i=(t[e.id]??0)>0;return l(`span`,{className:`lockerverse-launcher__optional-control`,children:l(`input`,{"aria-label":e.name,checked:i,className:`lockerverse-launcher__optional-switch`,disabled:!i&&e.inventoryQuantity===0,onChange:()=>{r(null),n(t=>({...t,[e.id]:(t[e.id]??0)>0?0:1}))},type:`checkbox`})})}function C({customAmounts:e,product:t,quantities:n,recurringProductId:r,setCustomAmounts:i,setQuantities:a,setRecurringProductId:o}){let s=n[t.id]??0;if(t.pricingMode===`fixed`&&t.paymentOption===`one-time`){let e=t.minimumQuantity??1,n=Math.min(t.maximumQuantity??1/0,t.inventoryQuantity??1/0);return u(`span`,{className:`lockerverse-launcher__quantity`,children:[l(`button`,{"aria-label":`Decrease ${t.name} quantity`,disabled:s===0,onClick:()=>{o(null),a(n=>{let r=n[t.id]??0;return{...n,[t.id]:r<=e?0:r-1}})},type:`button`,children:`−`}),l(`output`,{"aria-label":`${t.name} quantity`,children:s}),l(`button`,{"aria-label":`Increase ${t.name} quantity`,disabled:n<e||s>=n,onClick:()=>{o(null),a(n=>{let r=n[t.id]??0;return{...n,[t.id]:r===0?e:r+1}})},type:`button`,children:`+`})]})}return t.pricingMode===`custom`&&t.paymentOption===`one-time`?u(`span`,{className:`lockerverse-launcher__custom-amount`,children:[l(`span`,{"aria-hidden":`true`,children:`$`}),l(`input`,{"aria-label":`${t.name} amount`,min:f(t)/100,name:`amount-${t.slug}`,onChange:e=>{o(null),i(n=>({...n,[t.id]:e.target.value}))},placeholder:`0.00`,step:`0.01`,type:`number`,value:e[t.id]??``}),t.minimumAmountCents===null?null:u(`small`,{children:[`Minimum `,_.format(t.minimumAmountCents/100)]})]}):l(`button`,{"aria-label":`Select ${t.name}`,"aria-pressed":r===t.id,className:`lockerverse-launcher__select`,onClick:()=>{a({}),i({}),o(e=>e===t.id?null:t.id)},type:`button`,children:`Select`})}function w({variant:e=`default`,...t}){let{customAmounts:n,product:r,quantities:i,recurringProductId:a}=t,o=b(n[r.id]??``),s=a===r.id||r.paymentOption===`one-time`&&(r.pricingMode===`fixed`&&(i[r.id]??0)>0||r.pricingMode===`custom`&&o!==null&&o>=f(r));return u(`article`,{className:`lockerverse-launcher__product lockerverse-launcher__product--${e}`,"data-selected":s||void 0,children:[u(`span`,{className:`lockerverse-launcher__product-copy`,children:[l(`strong`,{className:`lockerverse-launcher__product-name`,children:r.name}),r.description?l(`small`,{children:r.description}):null,r.amountCents===null?null:l(`span`,{className:`lockerverse-launcher__product-price`,children:x(r.amountCents,r.paymentOption)})]}),r.pricingMode===`fixed`&&r.paymentOption===`one-time`&&r.maximumQuantity===1&&(r.minimumQuantity??1)<=1?l(S,{...t}):l(C,{...t})]})}function T({customAmounts:e,product:t,setCustomAmounts:n,setRecurringProductId:r}){let i=e[t.id]??``,a=b(i),o=y.filter(e=>e>=f(t)),s=o.includes(a??0),c=e=>{r(null),n(n=>({...n,[t.id]:e}))};return l(`div`,{className:`lockerverse-launcher__donation-option`,children:u(`fieldset`,{className:`lockerverse-launcher__donation-choices`,children:[u(`legend`,{className:`lockerverse-launcher__sr-only`,children:[t.name,` amount`]}),l(`button`,{"aria-pressed":i===``,onClick:()=>c(``),type:`button`,children:`No thanks`}),o.map(e=>l(`button`,{"aria-pressed":a===e,onClick:()=>c(String(e/100)),type:`button`,children:_.format(e/100).replace(`.00`,``)},e)),l(`label`,{className:`lockerverse-launcher__donation-other`,"data-selected":i!==``&&!s||void 0,children:l(`input`,{"aria-label":`${t.name} amount`,min:f(t)/100,name:`amount-${t.slug}`,onChange:e=>c(e.target.value),placeholder:`Other $`,step:`0.01`,type:`number`,value:s?``:i})})]})})}function E({products:e,variant:t=`default`,...n}){return l(`div`,{className:`lockerverse-launcher__product-list`,children:e.map(e=>t===`donation`?i(T,{...n,key:e.id,product:e}):i(w,{...n,key:e.id,product:e,variant:t}))})}function D(e,t){let n=0,r=0;for(let i of t){let t=e.products.find(e=>e.slug===i.productSlug);if(t){if(`quantity`in i){n+=i.quantity,r+=(t.amountCents??0)*i.quantity;continue}n+=1,r+=`amountCents`in i?i.amountCents:t.amountCents??0}}let i=e.widget.requiredShipping,a=i?t.reduce((t,n)=>{let r=e.products.find(e=>e.slug===n.productSlug);return r&&i.triggerProductIds.includes(r.id)?t+(`quantity`in n?n.quantity:1):t},0):0,o=a>0;return i&&o&&(r+=(e.products.find(e=>e.id===i.productId)?.amountCents??0)+Math.max(0,a-1)*(i.additionalUnitAmountCents??0)),{amountCents:r,itemCount:n,needsShipping:o}}function O(){return l(`div`,{"aria-label":`Loading donation options`,className:`lockerverse-launcher__loading`,role:`status`,children:[0,1,2].map(e=>l(`span`,{"aria-hidden":`true`,className:`lockerverse-launcher__loading-row`},e))})}function k(e,t,n,r){if(r){let t=e.products.find(e=>e.id===r&&e.paymentOption!==`one-time`);return t?[{productSlug:t.slug}]:[]}return e.products.flatMap(e=>{let r=t[e.id]??0;if(e.pricingMode===`fixed`&&e.paymentOption===`one-time`&&r>0)return[{productSlug:e.slug,quantity:r}];let i=b(n[e.id]??``);return e.pricingMode===`custom`&&e.paymentOption===`one-time`&&i!==null&&i>=f(e)?[{amountCents:i,productSlug:e.slug}]:[]})}function A({catalog:e,onContinue:t,...n}){let r=k(e,n.quantities,n.customAmounts,n.recurringProductId),i=D(e,r),a=e.products.filter(e=>e.paymentOption===`one-time`&&e.pricingMode===`custom`),o=e.products.filter(t=>!a.includes(t)&&t.id!==e.widget.requiredShipping?.productId);return u(`form`,{className:`lockerverse-launcher__products`,onSubmit:e=>{e.preventDefault(),r.length>0&&t(r)},children:[o.length>0?l(`section`,{className:`lockerverse-launcher__section`,children:l(E,{...n,products:o})}):null,a.length>0?u(`section`,{className:`lockerverse-launcher__donation`,children:[u(`header`,{className:`lockerverse-launcher__section-header`,children:[l(`h3`,{children:`Add a donation`}),l(`p`,{children:`Choose an amount to add to this order.`})]}),l(E,{...n,products:a,variant:`donation`})]}):null,o.length+a.length>0?u(`footer`,{className:`lockerverse-launcher__footer`,children:[u(`p`,{"aria-live":`polite`,className:`lockerverse-launcher__summary`,children:[l(`span`,{children:i.itemCount===0?`No items selected`:`${i.itemCount} ${i.itemCount===1?`item`:`items`} selected`}),i.itemCount===0?null:l(`strong`,{children:_.format(i.amountCents/100)})]}),i.needsShipping?l(`p`,{children:`Shipping is included once per order.`}):null,l(`button`,{className:`lockerverse-launcher__continue`,disabled:r.length===0,type:`submit`,children:`Continue`})]}):l(`p`,{children:`No products are available for this link.`})]})}function j({presentation:e,onEdit:t,paymentProps:n,selection:i,style:a,widget:o}){return u(`div`,{className:`lockerverse-launcher__checkout`,children:[l(`header`,{className:`lockerverse-launcher__checkout-toolbar`,children:l(`button`,{className:`lockerverse-launcher__back`,onClick:t,type:`button`,children:`Edit order`})}),l(r,{...n,className:e===`page`?void 0:n.className,selection:i,style:a,widget:o})]})}function M({catalog:e,checkout:t,presentation:n=`dialog`,showDescription:r=!0}){let i=n===`page`?`h1`:d.Title,a=n===`page`?`p`:d.Description;return t&&n===`page`?null:t?u(c,{children:[l(i,{className:`lockerverse-launcher__sr-only`,children:`Checkout`}),l(a,{className:`lockerverse-launcher__sr-only`,children:`Review the order and complete payment.`})]}):e?u(`header`,{className:`lockerverse-launcher__header`,children:[e.community?u(`div`,{className:`lockerverse-launcher__brand`,children:[e.community.imageUrl?l(`img`,{alt:`${e.community.name} logo`,height:`28`,src:e.community.imageUrl,width:`28`}):null,l(`span`,{children:e.community.name})]}):null,l(i,{className:`lockerverse-launcher__title`,children:e.widget.title??e.widget.name}),l(a,{className:`lockerverse-launcher__description`,hidden:!r,children:e.widget.description??`Choose your options, then continue to checkout.`})]}):u(`header`,{className:`lockerverse-launcher__header`,children:[l(i,{className:`lockerverse-launcher__title`,children:`Donate`}),l(a,{className:`lockerverse-launcher__description`,hidden:!r,children:`Choose your options, then continue to checkout.`})]})}function N(e,t,n){return e===`page`&&t&&n!==void 0}function P({buttonLabel:r=`Donate`,position:i=`inline`,presentation:c=`dialog`,loadingFallback:f,initialSelection:m=[],productIds:_,showDescription:v=!0,widget:y,...b}){let[x,S]=s(null),[C,w]=s({}),[T,E]=s({}),[D,k]=s(null),[P]=s(()=>({initialSelection:m.map(e=>({...e})),productIds:_?[..._]:void 0})),[F,I]=s(!1),{error:L,loading:R}=y,z=o(()=>g(y.catalog,v),[y.catalog,v]),B=h(y.catalog,P.productIds);a(()=>{if(F||!y.catalog)return;let e=h(y.catalog,P.productIds);if(!e)return;let t=p(e,P.initialSelection);E(t.quantities),w(t.customAmounts),k(t.recurringProductId),I(!0)},[F,y.catalog,P]);let V=e(b.style?.[`--lockerverse-accent`]??B?.community?.accentColor??`#38d77a`),H=t(V),U={...b.style};(b.style?.[`--lockerverse-accent`]!==void 0||B?.community?.accentColor)&&(U[`--lockerverse-accent`]=V),H&&b.style?.[`--lockerverse-accent-contrast`]===void 0&&(U[`--lockerverse-accent-contrast`]=H);let W=R||!(F||L),G;return G=W?l(O,{}):L?u(`div`,{role:`alert`,children:[l(`p`,{children:`Unable to load donation options.`}),l(`button`,{onClick:y.refresh,type:`button`,children:`Retry`})]}):B?l(A,{catalog:B,customAmounts:C,onContinue:S,quantities:T,recurringProductId:D,setCustomAmounts:w,setQuantities:E,setRecurringProductId:k}):l(O,{}),!(R||L)&&x&&B&&(G=l(j,{onEdit:()=>S(null),paymentProps:b,presentation:c,selection:x,style:U,widget:{...y,catalog:z}})),N(c,W,f)?f:c===`page`?u(`section`,{className:`lockerverse-launcher__dialog lockerverse-launcher__page ${b.className??``}`,"data-lockerverse-theme":b.theme??`dark`,style:U,children:[l(M,{catalog:B,checkout:x!==null,presentation:`page`,showDescription:v}),G]}):u(d.Root,{onOpenChange:e=>{e&&B&&b.stripeLoader===void 0&&requestAnimationFrame(()=>{n(B)})},children:[l(d.Trigger,{className:`lockerverse-launcher lockerverse-launcher--${i}`,"data-lockerverse-theme":b.theme??`dark`,style:U,children:r}),u(d.Portal,{children:[l(d.Backdrop,{className:`lockerverse-launcher__backdrop`}),l(d.Viewport,{className:`lockerverse-launcher__viewport`,children:u(d.Popup,{className:`lockerverse-launcher__dialog`,"data-lockerverse-theme":b.theme??`dark`,style:U,children:[l(M,{catalog:B,checkout:x!==null,showDescription:v}),l(d.Close,{"aria-label":`Close donation dialog`,className:`lockerverse-launcher__close`,children:l(`span`,{"aria-hidden":`true`,children:`×`})}),G]})})]})]})}export{P as t};
2
2
  //# sourceMappingURL=lockerverse-donate-launcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lockerverse-donate-launcher.js","names":[],"sources":["../src/launcher-configuration.ts","../src/lockerverse-donate-launcher.tsx"],"sourcesContent":["import {\n getLockerverseMinimumCustomAmountCents,\n type LockerverseCatalog,\n type LockerverseProduct,\n} from \"@lockerverse/sdk/checkout\";\nimport type { LockerversePaymentSelectionItem } from \"./types.ts\";\n\nexport function getInitialChoices(\n catalog: LockerverseCatalog,\n selection: LockerversePaymentSelectionItem[]\n) {\n const quantities: Record<string, number> = {};\n const customAmounts: Record<string, string> = {};\n let recurringProductId: string | null = null;\n for (const item of selection) {\n const product = catalog.products.find(\n (candidate) => candidate.slug === item.productSlug\n );\n if (!product || product.id === catalog.widget.requiredShipping?.productId) {\n continue;\n }\n if (product.paymentOption !== \"one-time\") {\n if (!(\"quantity\" in item || \"amountCents\" in item)) {\n recurringProductId = product.id;\n break;\n }\n continue;\n }\n if (\n product.pricingMode === \"fixed\" &&\n \"quantity\" in item &&\n Number.isSafeInteger(item.quantity) &&\n item.quantity > 0\n ) {\n quantities[product.id] = clampQuantity(product, item.quantity);\n }\n if (\n product.pricingMode === \"custom\" &&\n \"amountCents\" in item &&\n Number.isSafeInteger(item.amountCents) &&\n item.amountCents >= getLockerverseMinimumCustomAmountCents(product)\n ) {\n customAmounts[product.id] = (item.amountCents / 100).toFixed(2);\n }\n }\n return recurringProductId\n ? { customAmounts: {}, quantities: {}, recurringProductId }\n : { customAmounts, quantities, recurringProductId };\n}\n\nfunction clampQuantity(product: LockerverseProduct, quantity: number) {\n const minimum = product.minimumQuantity ?? 1;\n const maximum = Math.min(\n product.maximumQuantity ?? Number.POSITIVE_INFINITY,\n product.inventoryQuantity ?? Number.POSITIVE_INFINITY\n );\n return maximum < minimum ? 0 : Math.min(maximum, Math.max(minimum, quantity));\n}\n\nexport function filterLauncherCatalog(\n catalog: LockerverseCatalog | null,\n productIds: string[] | undefined\n) {\n if (!catalog || productIds === undefined) {\n return catalog;\n }\n return {\n ...catalog,\n products: catalog.products.filter(\n (product) =>\n productIds.includes(product.id) ||\n product.id === catalog.widget.requiredShipping?.productId\n ),\n };\n}\n\nexport function launcherPaymentCatalog(\n catalog: LockerverseCatalog | null,\n showDescription: boolean\n) {\n if (showDescription || !catalog) {\n return catalog;\n }\n return { ...catalog, widget: { ...catalog.widget, description: null } };\n}\n","import { Dialog } from \"@base-ui/react/dialog\";\nimport {\n getLockerverseMinimumCustomAmountCents,\n type LockerverseCatalog,\n type LockerverseProduct,\n} from \"@lockerverse/sdk/checkout\";\nimport {\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { getAccentContrast, normalizeAccentColor } from \"./accent-contrast.ts\";\nimport {\n filterLauncherCatalog,\n getInitialChoices,\n launcherPaymentCatalog,\n} from \"./launcher-configuration.ts\";\nimport { LockerversePayment } from \"./lockerverse-payment.tsx\";\nimport { preloadLockerversePayment } from \"./payment-form.tsx\";\nimport type {\n LockerverseDonateLauncherProps,\n LockerversePaymentProps,\n LockerversePaymentSelectionItem,\n LockerversePaymentStyle,\n} from \"./types.ts\";\nimport type { UseLockerverseWidgetResult } from \"./use-lockerverse-widget.ts\";\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n currency: \"USD\",\n style: \"currency\",\n});\nconst decimalAmountPattern = /^(?:0|[1-9]\\d*)(?:\\.\\d{1,2})?$/;\nconst suggestedDonationAmountsCents = [1000, 2500, 5000, 10_000];\n\nfunction parseAmountCents(value: string) {\n if (!decimalAmountPattern.test(value)) {\n return null;\n }\n const amountCents = Math.round(Number(value) * 100);\n return Number.isSafeInteger(amountCents) && amountCents > 0\n ? amountCents\n : null;\n}\n\nfunction formatProductPrice(\n amountCents: number,\n paymentOption: \"one-time\" | \"monthly\" | \"annually\" | \"every-six-months\"\n) {\n let cadence = \"\";\n if (paymentOption === \"monthly\") {\n cadence = \"/month\";\n }\n if (paymentOption === \"annually\") {\n cadence = \"/year\";\n }\n if (paymentOption === \"every-six-months\") {\n cadence = \" every 6 months\";\n }\n return `${usd.format(amountCents / 100)}${cadence}`;\n}\n\ntype LauncherProductControlProps = {\n customAmounts: Record<string, string>;\n product: LockerverseProduct;\n quantities: Record<string, number>;\n recurringProductId: string | null;\n setCustomAmounts: Dispatch<SetStateAction<Record<string, string>>>;\n setQuantities: Dispatch<SetStateAction<Record<string, number>>>;\n setRecurringProductId: Dispatch<SetStateAction<string | null>>;\n};\n\nfunction LauncherOptionalProduct({\n product,\n quantities,\n setQuantities,\n setRecurringProductId,\n}: LauncherProductControlProps) {\n const included = (quantities[product.id] ?? 0) > 0;\n return (\n <span className=\"lockerverse-launcher__optional-control\">\n <input\n aria-label={product.name}\n checked={included}\n className=\"lockerverse-launcher__optional-switch\"\n disabled={!included && product.inventoryQuantity === 0}\n onChange={() => {\n setRecurringProductId(null);\n setQuantities((current) => ({\n ...current,\n [product.id]: (current[product.id] ?? 0) > 0 ? 0 : 1,\n }));\n }}\n type=\"checkbox\"\n />\n </span>\n );\n}\n\nfunction LauncherProductControl({\n customAmounts,\n product,\n quantities,\n recurringProductId,\n setCustomAmounts,\n setQuantities,\n setRecurringProductId,\n}: LauncherProductControlProps) {\n const quantity = quantities[product.id] ?? 0;\n if (product.pricingMode === \"fixed\" && product.paymentOption === \"one-time\") {\n const minimum = product.minimumQuantity ?? 1;\n const maximum = Math.min(\n product.maximumQuantity ?? Number.POSITIVE_INFINITY,\n product.inventoryQuantity ?? Number.POSITIVE_INFINITY\n );\n return (\n <span className=\"lockerverse-launcher__quantity\">\n <button\n aria-label={`Decrease ${product.name} quantity`}\n disabled={quantity === 0}\n onClick={() => {\n setRecurringProductId(null);\n setQuantities((current) => {\n const currentQuantity = current[product.id] ?? 0;\n return {\n ...current,\n [product.id]:\n currentQuantity <= minimum ? 0 : currentQuantity - 1,\n };\n });\n }}\n type=\"button\"\n >\n −\n </button>\n <output aria-label={`${product.name} quantity`}>{quantity}</output>\n <button\n aria-label={`Increase ${product.name} quantity`}\n disabled={maximum < minimum || quantity >= maximum}\n onClick={() => {\n setRecurringProductId(null);\n setQuantities((current) => {\n const currentQuantity = current[product.id] ?? 0;\n return {\n ...current,\n [product.id]:\n currentQuantity === 0 ? minimum : currentQuantity + 1,\n };\n });\n }}\n type=\"button\"\n >\n +\n </button>\n </span>\n );\n }\n\n if (\n product.pricingMode === \"custom\" &&\n product.paymentOption === \"one-time\"\n ) {\n return (\n <span className=\"lockerverse-launcher__custom-amount\">\n <span aria-hidden=\"true\">$</span>\n <input\n aria-label={`${product.name} amount`}\n min={getLockerverseMinimumCustomAmountCents(product) / 100}\n name={`amount-${product.slug}`}\n onChange={(event) => {\n setRecurringProductId(null);\n setCustomAmounts((current) => ({\n ...current,\n [product.id]: event.target.value,\n }));\n }}\n placeholder=\"0.00\"\n step=\"0.01\"\n type=\"number\"\n value={customAmounts[product.id] ?? \"\"}\n />\n {product.minimumAmountCents === null ? null : (\n <small>Minimum {usd.format(product.minimumAmountCents / 100)}</small>\n )}\n </span>\n );\n }\n\n return (\n <button\n aria-label={`Select ${product.name}`}\n aria-pressed={recurringProductId === product.id}\n className=\"lockerverse-launcher__select\"\n onClick={() => {\n setQuantities({});\n setCustomAmounts({});\n setRecurringProductId((current) =>\n current === product.id ? null : product.id\n );\n }}\n type=\"button\"\n >\n Select\n </button>\n );\n}\n\ntype LauncherProductOptionProps = LauncherProductControlProps & {\n variant?: \"default\" | \"donation\";\n};\n\nfunction LauncherProductOption({\n variant = \"default\",\n ...props\n}: LauncherProductOptionProps) {\n const { customAmounts, product, quantities, recurringProductId } = props;\n const customAmount = parseAmountCents(customAmounts[product.id] ?? \"\");\n const isSelected =\n recurringProductId === product.id ||\n (product.paymentOption === \"one-time\" &&\n ((product.pricingMode === \"fixed\" && (quantities[product.id] ?? 0) > 0) ||\n (product.pricingMode === \"custom\" &&\n customAmount !== null &&\n customAmount >= getLockerverseMinimumCustomAmountCents(product))));\n return (\n <article\n className={`lockerverse-launcher__product lockerverse-launcher__product--${variant}`}\n data-selected={isSelected || undefined}\n >\n <span className=\"lockerverse-launcher__product-copy\">\n <strong className=\"lockerverse-launcher__product-name\">\n {product.name}\n </strong>\n {product.description ? <small>{product.description}</small> : null}\n {product.amountCents === null ? null : (\n <span className=\"lockerverse-launcher__product-price\">\n {formatProductPrice(product.amountCents, product.paymentOption)}\n </span>\n )}\n </span>\n {product.pricingMode === \"fixed\" &&\n product.paymentOption === \"one-time\" &&\n product.maximumQuantity === 1 &&\n (product.minimumQuantity ?? 1) <= 1 ? (\n <LauncherOptionalProduct {...props} />\n ) : (\n <LauncherProductControl {...props} />\n )}\n </article>\n );\n}\n\nfunction LauncherDonationOption({\n customAmounts,\n product,\n setCustomAmounts,\n setRecurringProductId,\n}: LauncherProductControlProps) {\n const amount = customAmounts[product.id] ?? \"\";\n const amountCents = parseAmountCents(amount);\n const suggestions = suggestedDonationAmountsCents.filter(\n (suggestion) =>\n suggestion >= getLockerverseMinimumCustomAmountCents(product)\n );\n const isSuggestedAmount = suggestions.includes(amountCents ?? 0);\n const setAmount = (value: string) => {\n setRecurringProductId(null);\n setCustomAmounts((current) => ({\n ...current,\n [product.id]: value,\n }));\n };\n\n return (\n <div className=\"lockerverse-launcher__donation-option\">\n <fieldset className=\"lockerverse-launcher__donation-choices\">\n <legend className=\"lockerverse-launcher__sr-only\">\n {product.name} amount\n </legend>\n <button\n aria-pressed={amount === \"\"}\n onClick={() => setAmount(\"\")}\n type=\"button\"\n >\n No thanks\n </button>\n {suggestions.map((suggestion) => (\n <button\n aria-pressed={amountCents === suggestion}\n key={suggestion}\n onClick={() => setAmount(String(suggestion / 100))}\n type=\"button\"\n >\n {usd.format(suggestion / 100).replace(\".00\", \"\")}\n </button>\n ))}\n <label\n className=\"lockerverse-launcher__donation-other\"\n data-selected={amount !== \"\" && !isSuggestedAmount ? true : undefined}\n >\n <input\n aria-label={`${product.name} amount`}\n min={getLockerverseMinimumCustomAmountCents(product) / 100}\n name={`amount-${product.slug}`}\n onChange={(event) => setAmount(event.target.value)}\n placeholder=\"Other $\"\n step=\"0.01\"\n type=\"number\"\n value={isSuggestedAmount ? \"\" : amount}\n />\n </label>\n </fieldset>\n </div>\n );\n}\n\ntype LauncherProductListProps = Omit<LauncherProductControlProps, \"product\"> & {\n products: LockerverseProduct[];\n variant?: LauncherProductOptionProps[\"variant\"];\n};\n\nfunction LauncherProductList({\n products,\n variant = \"default\",\n ...controlProps\n}: LauncherProductListProps) {\n return (\n <div className=\"lockerverse-launcher__product-list\">\n {products.map((product) =>\n variant === \"donation\" ? (\n <LauncherDonationOption\n {...controlProps}\n key={product.id}\n product={product}\n />\n ) : (\n <LauncherProductOption\n {...controlProps}\n key={product.id}\n product={product}\n variant={variant}\n />\n )\n )}\n </div>\n );\n}\n\nfunction getSelectionSummary(\n catalog: LockerverseCatalog,\n selection: LockerversePaymentSelectionItem[]\n) {\n let itemCount = 0;\n let amountCents = 0;\n for (const item of selection) {\n const product = catalog.products.find(\n (candidate) => candidate.slug === item.productSlug\n );\n if (!product) {\n continue;\n }\n if (\"quantity\" in item) {\n itemCount += item.quantity;\n amountCents += (product.amountCents ?? 0) * item.quantity;\n continue;\n }\n itemCount += 1;\n amountCents +=\n \"amountCents\" in item ? item.amountCents : (product.amountCents ?? 0);\n }\n const shipping = catalog.widget.requiredShipping;\n const triggerQuantity = shipping\n ? selection.reduce((total, item) => {\n const product = catalog.products.find(\n (candidate) => candidate.slug === item.productSlug\n );\n if (!(product && shipping.triggerProductIds.includes(product.id))) {\n return total;\n }\n return total + (\"quantity\" in item ? item.quantity : 1);\n }, 0)\n : 0;\n const needsShipping = triggerQuantity > 0;\n if (shipping && needsShipping) {\n amountCents +=\n (catalog.products.find((product) => product.id === shipping.productId)\n ?.amountCents ?? 0) +\n Math.max(0, triggerQuantity - 1) *\n (shipping.additionalUnitAmountCents ?? 0);\n }\n return { amountCents, itemCount, needsShipping };\n}\n\nfunction LauncherLoading() {\n return (\n <div\n aria-label=\"Loading donation options\"\n className=\"lockerverse-launcher__loading\"\n role=\"status\"\n >\n {[0, 1, 2].map((item) => (\n <span\n aria-hidden=\"true\"\n className=\"lockerverse-launcher__loading-row\"\n key={item}\n />\n ))}\n </div>\n );\n}\n\nfunction createLauncherSelection(\n catalog: LockerverseCatalog,\n quantities: Record<string, number>,\n customAmounts: Record<string, string>,\n recurringProductId: string | null\n): LockerversePaymentSelectionItem[] {\n if (recurringProductId) {\n const product = catalog.products.find(\n (candidate) =>\n candidate.id === recurringProductId &&\n candidate.paymentOption !== \"one-time\"\n );\n return product ? [{ productSlug: product.slug }] : [];\n }\n\n return catalog.products.flatMap(\n (product): LockerversePaymentSelectionItem[] => {\n const quantity = quantities[product.id] ?? 0;\n if (\n product.pricingMode === \"fixed\" &&\n product.paymentOption === \"one-time\" &&\n quantity > 0\n ) {\n return [{ productSlug: product.slug, quantity }];\n }\n const amountCents = parseAmountCents(customAmounts[product.id] ?? \"\");\n if (\n product.pricingMode === \"custom\" &&\n product.paymentOption === \"one-time\" &&\n amountCents !== null &&\n amountCents >= getLockerverseMinimumCustomAmountCents(product)\n ) {\n return [{ amountCents, productSlug: product.slug }];\n }\n return [];\n }\n );\n}\n\ntype LauncherSelectionStateProps = Omit<LauncherProductControlProps, \"product\">;\n\ntype LauncherCatalogProps = LauncherSelectionStateProps & {\n catalog: LockerverseCatalog;\n onContinue: (selection: LockerversePaymentSelectionItem[]) => void;\n};\n\nfunction LauncherCatalog({\n catalog,\n onContinue,\n ...selectionState\n}: LauncherCatalogProps) {\n const draftSelection = createLauncherSelection(\n catalog,\n selectionState.quantities,\n selectionState.customAmounts,\n selectionState.recurringProductId\n );\n const summary = getSelectionSummary(catalog, draftSelection);\n const donationProducts = catalog.products.filter(\n (product) =>\n product.paymentOption === \"one-time\" && product.pricingMode === \"custom\"\n );\n const orderProducts = catalog.products.filter(\n (product) =>\n !donationProducts.includes(product) &&\n product.id !== catalog.widget.requiredShipping?.productId\n );\n\n return (\n <form\n className=\"lockerverse-launcher__products\"\n onSubmit={(event) => {\n event.preventDefault();\n if (draftSelection.length > 0) {\n onContinue(draftSelection);\n }\n }}\n >\n {orderProducts.length > 0 ? (\n <section className=\"lockerverse-launcher__section\">\n <LauncherProductList {...selectionState} products={orderProducts} />\n </section>\n ) : null}\n {donationProducts.length > 0 ? (\n <section className=\"lockerverse-launcher__donation\">\n <header className=\"lockerverse-launcher__section-header\">\n <h3>Add a donation</h3>\n <p>Choose an amount to add to this order.</p>\n </header>\n <LauncherProductList\n {...selectionState}\n products={donationProducts}\n variant=\"donation\"\n />\n </section>\n ) : null}\n {orderProducts.length + donationProducts.length > 0 ? (\n <footer className=\"lockerverse-launcher__footer\">\n <p aria-live=\"polite\" className=\"lockerverse-launcher__summary\">\n <span>\n {summary.itemCount === 0\n ? \"No items selected\"\n : `${summary.itemCount} ${summary.itemCount === 1 ? \"item\" : \"items\"} selected`}\n </span>\n {summary.itemCount === 0 ? null : (\n <strong>{usd.format(summary.amountCents / 100)}</strong>\n )}\n </p>\n {summary.needsShipping ? (\n <p>Shipping is included once per order.</p>\n ) : null}\n <button\n className=\"lockerverse-launcher__continue\"\n disabled={draftSelection.length === 0}\n type=\"submit\"\n >\n Continue\n </button>\n </footer>\n ) : (\n <p>No products are available for this link.</p>\n )}\n </form>\n );\n}\n\ntype LauncherPaymentProps = Omit<\n LockerversePaymentProps,\n \"selection\" | \"widget\"\n>;\n\ntype LauncherCheckoutProps = {\n presentation: \"dialog\" | \"page\";\n onEdit: () => void;\n paymentProps: LauncherPaymentProps;\n selection: LockerversePaymentSelectionItem[];\n style: LockerversePaymentStyle;\n widget: UseLockerverseWidgetResult;\n};\n\nfunction LauncherCheckout({\n presentation,\n onEdit,\n paymentProps,\n selection,\n style,\n widget,\n}: LauncherCheckoutProps) {\n return (\n <div className=\"lockerverse-launcher__checkout\">\n <header className=\"lockerverse-launcher__checkout-toolbar\">\n <button\n className=\"lockerverse-launcher__back\"\n onClick={onEdit}\n type=\"button\"\n >\n Edit order\n </button>\n </header>\n <LockerversePayment\n {...paymentProps}\n className={presentation === \"page\" ? undefined : paymentProps.className}\n selection={selection}\n style={style}\n widget={widget}\n />\n </div>\n );\n}\n\nfunction LauncherDialogHeading({\n catalog,\n checkout,\n presentation = \"dialog\",\n showDescription = true,\n}: {\n presentation?: \"dialog\" | \"page\";\n showDescription?: boolean;\n catalog: LockerverseCatalog | null;\n checkout: boolean;\n}) {\n const Title = presentation === \"page\" ? \"h1\" : Dialog.Title;\n const Description = presentation === \"page\" ? \"p\" : Dialog.Description;\n if (checkout && presentation === \"page\") {\n return null;\n }\n if (checkout) {\n return (\n <>\n <Title className=\"lockerverse-launcher__sr-only\">Checkout</Title>\n <Description className=\"lockerverse-launcher__sr-only\">\n Review the order and complete payment.\n </Description>\n </>\n );\n }\n\n if (!catalog) {\n return (\n <header className=\"lockerverse-launcher__header\">\n <Title className=\"lockerverse-launcher__title\">Donate</Title>\n <Description\n className=\"lockerverse-launcher__description\"\n hidden={!showDescription}\n >\n Choose your options, then continue to checkout.\n </Description>\n </header>\n );\n }\n\n return (\n <header className=\"lockerverse-launcher__header\">\n {catalog.community ? (\n <div className=\"lockerverse-launcher__brand\">\n {catalog.community.imageUrl ? (\n <img\n alt={`${catalog.community.name} logo`}\n height=\"28\"\n src={catalog.community.imageUrl}\n width=\"28\"\n />\n ) : null}\n <span>{catalog.community.name}</span>\n </div>\n ) : null}\n <Title className=\"lockerverse-launcher__title\">\n {catalog.widget.title ?? catalog.widget.name}\n </Title>\n <Description\n className=\"lockerverse-launcher__description\"\n hidden={!showDescription}\n >\n {catalog.widget.description ??\n \"Choose your options, then continue to checkout.\"}\n </Description>\n </header>\n );\n}\n\nexport function LockerverseDonateLauncher({\n buttonLabel = \"Donate\",\n position = \"inline\",\n presentation = \"dialog\",\n initialSelection = [],\n productIds,\n showDescription = true,\n widget,\n ...paymentProps\n}: LockerverseDonateLauncherProps) {\n const [selection, setSelection] = useState<\n LockerversePaymentSelectionItem[] | null\n >(null);\n const [customAmounts, setCustomAmounts] = useState<Record<string, string>>(\n {}\n );\n const [quantities, setQuantities] = useState<Record<string, number>>({});\n const [recurringProductId, setRecurringProductId] = useState<string | null>(\n null\n );\n const [linkConfiguration] = useState(() => ({\n initialSelection: initialSelection.map((item) => ({ ...item })),\n productIds: productIds ? [...productIds] : undefined,\n }));\n const [initialized, setInitialized] = useState(false);\n const { error, loading } = widget;\n const paymentCatalog = useMemo(\n () => launcherPaymentCatalog(widget.catalog, showDescription),\n [widget.catalog, showDescription]\n );\n const catalog = filterLauncherCatalog(\n widget.catalog,\n linkConfiguration.productIds\n );\n useEffect(() => {\n if (initialized || !widget.catalog) {\n return;\n }\n const initialCatalog = filterLauncherCatalog(\n widget.catalog,\n linkConfiguration.productIds\n );\n if (!initialCatalog) {\n return;\n }\n const choices = getInitialChoices(\n initialCatalog,\n linkConfiguration.initialSelection\n );\n setQuantities(choices.quantities);\n setCustomAmounts(choices.customAmounts);\n setRecurringProductId(choices.recurringProductId);\n setInitialized(true);\n }, [initialized, widget.catalog, linkConfiguration]);\n const accent = normalizeAccentColor(\n paymentProps.style?.[\"--lockerverse-accent\"] ??\n catalog?.community?.accentColor ??\n \"#38d77a\"\n );\n const accentContrast = getAccentContrast(accent);\n const launcherStyle: LockerversePaymentStyle = { ...paymentProps.style };\n if (\n paymentProps.style?.[\"--lockerverse-accent\"] !== undefined ||\n catalog?.community?.accentColor\n ) {\n launcherStyle[\"--lockerverse-accent\"] = accent;\n }\n if (\n accentContrast &&\n paymentProps.style?.[\"--lockerverse-accent-contrast\"] === undefined\n ) {\n launcherStyle[\"--lockerverse-accent-contrast\"] = accentContrast;\n }\n\n let content: ReactNode;\n if (loading || !(initialized || error)) {\n content = <LauncherLoading />;\n } else if (error) {\n content = (\n <div role=\"alert\">\n <p>Unable to load donation options.</p>\n <button onClick={widget.refresh} type=\"button\">\n Retry\n </button>\n </div>\n );\n } else if (catalog) {\n content = (\n <LauncherCatalog\n catalog={catalog}\n customAmounts={customAmounts}\n onContinue={setSelection}\n quantities={quantities}\n recurringProductId={recurringProductId}\n setCustomAmounts={setCustomAmounts}\n setQuantities={setQuantities}\n setRecurringProductId={setRecurringProductId}\n />\n );\n } else {\n content = <LauncherLoading />;\n }\n if (!(loading || error) && selection && catalog) {\n content = (\n <LauncherCheckout\n onEdit={() => setSelection(null)}\n paymentProps={paymentProps}\n presentation={presentation}\n selection={selection}\n style={launcherStyle}\n widget={{ ...widget, catalog: paymentCatalog }}\n />\n );\n }\n\n if (presentation === \"page\") {\n return (\n <section\n className={`lockerverse-launcher__dialog lockerverse-launcher__page ${paymentProps.className ?? \"\"}`}\n data-lockerverse-theme={paymentProps.theme ?? \"dark\"}\n style={launcherStyle}\n >\n <LauncherDialogHeading\n catalog={catalog}\n checkout={selection !== null}\n presentation=\"page\"\n showDescription={showDescription}\n />\n {content}\n </section>\n );\n }\n\n return (\n <Dialog.Root\n onOpenChange={(open) => {\n if (open && catalog && paymentProps.stripeLoader === undefined) {\n requestAnimationFrame(() => {\n preloadLockerversePayment(catalog);\n });\n }\n }}\n >\n <Dialog.Trigger\n className={`lockerverse-launcher lockerverse-launcher--${position}`}\n data-lockerverse-theme={paymentProps.theme ?? \"dark\"}\n style={launcherStyle}\n >\n {buttonLabel}\n </Dialog.Trigger>\n <Dialog.Portal>\n <Dialog.Backdrop className=\"lockerverse-launcher__backdrop\" />\n <Dialog.Viewport className=\"lockerverse-launcher__viewport\">\n <Dialog.Popup\n className=\"lockerverse-launcher__dialog\"\n data-lockerverse-theme={paymentProps.theme ?? \"dark\"}\n style={launcherStyle}\n >\n <LauncherDialogHeading\n catalog={catalog}\n checkout={selection !== null}\n showDescription={showDescription}\n />\n <Dialog.Close\n aria-label=\"Close donation dialog\"\n className=\"lockerverse-launcher__close\"\n >\n <span aria-hidden=\"true\">×</span>\n </Dialog.Close>\n {content}\n </Dialog.Popup>\n </Dialog.Viewport>\n </Dialog.Portal>\n </Dialog.Root>\n );\n}\n"],"mappings":"4WAOA,SAAgB,EACd,EACA,EACA,CACA,IAAM,EAAqC,CAAC,EACtC,EAAwC,CAAC,EAC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WAAc,EAAa,IAAI,EACjB,eACA,eACH,YACX,MAAO,EACP,OAAQ,CAAE,GAAG,EAAQ,QAAS,CAAe,CAC9C,CAAA,GAID,IAAiB,OAEjB,EAAC,UAAD,CACE,UAAW,2DAA2D,EAAa,WAAa,KAChG,yBAAwB,EAAa,OAAS,OAC9C,MAAO,EAHT,SAAA,CAKE,EAAC,EAAD,CACW,UACT,SAAU,IAAc,KACxB,aAAa,OACI,iBAClB,CAAA,EACA,CACM,IAKX,EAAC,EAAO,KAAR,CACE,aAAe,GAAS,CAClB,GAAQ,GAAW,EAAa,eAAiB,IAAA,IACnD,0BAA4B,CAC1B,EAA0B,CAAO,CACnC,CAAC,CAEL,EAPF,SAAA,CASE,EAAC,EAAO,QAAR,CACE,UAAW,8CAA8C,IACzD,yBAAwB,EAAa,OAAS,OAC9C,MAAO,EAEN,SAAA,CACa,CAAA,EAChB,EAAC,EAAO,OAAR,CAAA,SAAA,CACE,EAAC,EAAO,SAAR,CAAiB,UAAU,gCAAkC,CAAA,EAC7D,EAAC,EAAO,SAAR,CAAiB,UAAU,iCACzB,SAAA,EAAC,EAAO,MAAR,CACE,UAAU,+BACV,yBAAwB,EAAa,OAAS,OAC9C,MAAO,EAHT,SAAA,CAKE,EAAC,EAAD,CACW,UACT,SAAU,IAAc,KACP,iBAClB,CAAA,EACD,EAAC,EAAO,MAAR,CACE,aAAW,wBACX,UAAU,8BAEV,SAAA,EAAC,OAAD,CAAM,cAAY,OAAO,SAAA,GAAO,CAAA,CACpB,CAAA,EACb,CACW,GACC,CAAA,CACJ,CAAA,CAAA,CACJ,GAEjB"}
1
+ {"version":3,"file":"lockerverse-donate-launcher.js","names":[],"sources":["../src/launcher-configuration.ts","../src/lockerverse-donate-launcher.tsx"],"sourcesContent":["import {\n getLockerverseMinimumCustomAmountCents,\n type LockerverseCatalog,\n type LockerverseProduct,\n} from \"@lockerverse/sdk/checkout\";\nimport type { LockerversePaymentSelectionItem } from \"./types.ts\";\n\nexport function getInitialChoices(\n catalog: LockerverseCatalog,\n selection: LockerversePaymentSelectionItem[]\n) {\n const quantities: Record<string, number> = {};\n const customAmounts: Record<string, string> = {};\n let recurringProductId: string | null = null;\n for (const item of selection) {\n const product = catalog.products.find(\n (candidate) => candidate.slug === item.productSlug\n );\n if (!product || product.id === catalog.widget.requiredShipping?.productId) {\n continue;\n }\n if (product.paymentOption !== \"one-time\") {\n if (!(\"quantity\" in item || \"amountCents\" in item)) {\n recurringProductId = product.id;\n break;\n }\n continue;\n }\n if (\n product.pricingMode === \"fixed\" &&\n \"quantity\" in item &&\n Number.isSafeInteger(item.quantity) &&\n item.quantity > 0\n ) {\n quantities[product.id] = clampQuantity(product, item.quantity);\n }\n if (\n product.pricingMode === \"custom\" &&\n \"amountCents\" in item &&\n Number.isSafeInteger(item.amountCents) &&\n item.amountCents >= getLockerverseMinimumCustomAmountCents(product)\n ) {\n customAmounts[product.id] = (item.amountCents / 100).toFixed(2);\n }\n }\n return recurringProductId\n ? { customAmounts: {}, quantities: {}, recurringProductId }\n : { customAmounts, quantities, recurringProductId };\n}\n\nfunction clampQuantity(product: LockerverseProduct, quantity: number) {\n const minimum = product.minimumQuantity ?? 1;\n const maximum = Math.min(\n product.maximumQuantity ?? Number.POSITIVE_INFINITY,\n product.inventoryQuantity ?? Number.POSITIVE_INFINITY\n );\n return maximum < minimum ? 0 : Math.min(maximum, Math.max(minimum, quantity));\n}\n\nexport function filterLauncherCatalog(\n catalog: LockerverseCatalog | null,\n productIds: string[] | undefined\n) {\n if (!catalog || productIds === undefined) {\n return catalog;\n }\n return {\n ...catalog,\n products: catalog.products.filter(\n (product) =>\n productIds.includes(product.id) ||\n product.id === catalog.widget.requiredShipping?.productId\n ),\n };\n}\n\nexport function launcherPaymentCatalog(\n catalog: LockerverseCatalog | null,\n showDescription: boolean\n) {\n if (showDescription || !catalog) {\n return catalog;\n }\n return { ...catalog, widget: { ...catalog.widget, description: null } };\n}\n","import { Dialog } from \"@base-ui/react/dialog\";\nimport {\n getLockerverseMinimumCustomAmountCents,\n type LockerverseCatalog,\n type LockerverseProduct,\n} from \"@lockerverse/sdk/checkout\";\nimport {\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { getAccentContrast, normalizeAccentColor } from \"./accent-contrast.ts\";\nimport {\n filterLauncherCatalog,\n getInitialChoices,\n launcherPaymentCatalog,\n} from \"./launcher-configuration.ts\";\nimport { LockerversePayment } from \"./lockerverse-payment.tsx\";\nimport { preloadLockerversePayment } from \"./payment-form.tsx\";\nimport type {\n LockerverseDonateLauncherProps,\n LockerversePaymentProps,\n LockerversePaymentSelectionItem,\n LockerversePaymentStyle,\n} from \"./types.ts\";\nimport type { UseLockerverseWidgetResult } from \"./use-lockerverse-widget.ts\";\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n currency: \"USD\",\n style: \"currency\",\n});\nconst decimalAmountPattern = /^(?:0|[1-9]\\d*)(?:\\.\\d{1,2})?$/;\nconst suggestedDonationAmountsCents = [1000, 2500, 5000, 10_000];\n\nfunction parseAmountCents(value: string) {\n if (!decimalAmountPattern.test(value)) {\n return null;\n }\n const amountCents = Math.round(Number(value) * 100);\n return Number.isSafeInteger(amountCents) && amountCents > 0\n ? amountCents\n : null;\n}\n\nfunction formatProductPrice(\n amountCents: number,\n paymentOption: \"one-time\" | \"monthly\" | \"annually\" | \"every-six-months\"\n) {\n let cadence = \"\";\n if (paymentOption === \"monthly\") {\n cadence = \"/month\";\n }\n if (paymentOption === \"annually\") {\n cadence = \"/year\";\n }\n if (paymentOption === \"every-six-months\") {\n cadence = \" every 6 months\";\n }\n return `${usd.format(amountCents / 100)}${cadence}`;\n}\n\ntype LauncherProductControlProps = {\n customAmounts: Record<string, string>;\n product: LockerverseProduct;\n quantities: Record<string, number>;\n recurringProductId: string | null;\n setCustomAmounts: Dispatch<SetStateAction<Record<string, string>>>;\n setQuantities: Dispatch<SetStateAction<Record<string, number>>>;\n setRecurringProductId: Dispatch<SetStateAction<string | null>>;\n};\n\nfunction LauncherOptionalProduct({\n product,\n quantities,\n setQuantities,\n setRecurringProductId,\n}: LauncherProductControlProps) {\n const included = (quantities[product.id] ?? 0) > 0;\n return (\n <span className=\"lockerverse-launcher__optional-control\">\n <input\n aria-label={product.name}\n checked={included}\n className=\"lockerverse-launcher__optional-switch\"\n disabled={!included && product.inventoryQuantity === 0}\n onChange={() => {\n setRecurringProductId(null);\n setQuantities((current) => ({\n ...current,\n [product.id]: (current[product.id] ?? 0) > 0 ? 0 : 1,\n }));\n }}\n type=\"checkbox\"\n />\n </span>\n );\n}\n\nfunction LauncherProductControl({\n customAmounts,\n product,\n quantities,\n recurringProductId,\n setCustomAmounts,\n setQuantities,\n setRecurringProductId,\n}: LauncherProductControlProps) {\n const quantity = quantities[product.id] ?? 0;\n if (product.pricingMode === \"fixed\" && product.paymentOption === \"one-time\") {\n const minimum = product.minimumQuantity ?? 1;\n const maximum = Math.min(\n product.maximumQuantity ?? Number.POSITIVE_INFINITY,\n product.inventoryQuantity ?? Number.POSITIVE_INFINITY\n );\n return (\n <span className=\"lockerverse-launcher__quantity\">\n <button\n aria-label={`Decrease ${product.name} quantity`}\n disabled={quantity === 0}\n onClick={() => {\n setRecurringProductId(null);\n setQuantities((current) => {\n const currentQuantity = current[product.id] ?? 0;\n return {\n ...current,\n [product.id]:\n currentQuantity <= minimum ? 0 : currentQuantity - 1,\n };\n });\n }}\n type=\"button\"\n >\n −\n </button>\n <output aria-label={`${product.name} quantity`}>{quantity}</output>\n <button\n aria-label={`Increase ${product.name} quantity`}\n disabled={maximum < minimum || quantity >= maximum}\n onClick={() => {\n setRecurringProductId(null);\n setQuantities((current) => {\n const currentQuantity = current[product.id] ?? 0;\n return {\n ...current,\n [product.id]:\n currentQuantity === 0 ? minimum : currentQuantity + 1,\n };\n });\n }}\n type=\"button\"\n >\n +\n </button>\n </span>\n );\n }\n\n if (\n product.pricingMode === \"custom\" &&\n product.paymentOption === \"one-time\"\n ) {\n return (\n <span className=\"lockerverse-launcher__custom-amount\">\n <span aria-hidden=\"true\">$</span>\n <input\n aria-label={`${product.name} amount`}\n min={getLockerverseMinimumCustomAmountCents(product) / 100}\n name={`amount-${product.slug}`}\n onChange={(event) => {\n setRecurringProductId(null);\n setCustomAmounts((current) => ({\n ...current,\n [product.id]: event.target.value,\n }));\n }}\n placeholder=\"0.00\"\n step=\"0.01\"\n type=\"number\"\n value={customAmounts[product.id] ?? \"\"}\n />\n {product.minimumAmountCents === null ? null : (\n <small>Minimum {usd.format(product.minimumAmountCents / 100)}</small>\n )}\n </span>\n );\n }\n\n return (\n <button\n aria-label={`Select ${product.name}`}\n aria-pressed={recurringProductId === product.id}\n className=\"lockerverse-launcher__select\"\n onClick={() => {\n setQuantities({});\n setCustomAmounts({});\n setRecurringProductId((current) =>\n current === product.id ? null : product.id\n );\n }}\n type=\"button\"\n >\n Select\n </button>\n );\n}\n\ntype LauncherProductOptionProps = LauncherProductControlProps & {\n variant?: \"default\" | \"donation\";\n};\n\nfunction LauncherProductOption({\n variant = \"default\",\n ...props\n}: LauncherProductOptionProps) {\n const { customAmounts, product, quantities, recurringProductId } = props;\n const customAmount = parseAmountCents(customAmounts[product.id] ?? \"\");\n const isSelected =\n recurringProductId === product.id ||\n (product.paymentOption === \"one-time\" &&\n ((product.pricingMode === \"fixed\" && (quantities[product.id] ?? 0) > 0) ||\n (product.pricingMode === \"custom\" &&\n customAmount !== null &&\n customAmount >= getLockerverseMinimumCustomAmountCents(product))));\n return (\n <article\n className={`lockerverse-launcher__product lockerverse-launcher__product--${variant}`}\n data-selected={isSelected || undefined}\n >\n <span className=\"lockerverse-launcher__product-copy\">\n <strong className=\"lockerverse-launcher__product-name\">\n {product.name}\n </strong>\n {product.description ? <small>{product.description}</small> : null}\n {product.amountCents === null ? null : (\n <span className=\"lockerverse-launcher__product-price\">\n {formatProductPrice(product.amountCents, product.paymentOption)}\n </span>\n )}\n </span>\n {product.pricingMode === \"fixed\" &&\n product.paymentOption === \"one-time\" &&\n product.maximumQuantity === 1 &&\n (product.minimumQuantity ?? 1) <= 1 ? (\n <LauncherOptionalProduct {...props} />\n ) : (\n <LauncherProductControl {...props} />\n )}\n </article>\n );\n}\n\nfunction LauncherDonationOption({\n customAmounts,\n product,\n setCustomAmounts,\n setRecurringProductId,\n}: LauncherProductControlProps) {\n const amount = customAmounts[product.id] ?? \"\";\n const amountCents = parseAmountCents(amount);\n const suggestions = suggestedDonationAmountsCents.filter(\n (suggestion) =>\n suggestion >= getLockerverseMinimumCustomAmountCents(product)\n );\n const isSuggestedAmount = suggestions.includes(amountCents ?? 0);\n const setAmount = (value: string) => {\n setRecurringProductId(null);\n setCustomAmounts((current) => ({\n ...current,\n [product.id]: value,\n }));\n };\n\n return (\n <div className=\"lockerverse-launcher__donation-option\">\n <fieldset className=\"lockerverse-launcher__donation-choices\">\n <legend className=\"lockerverse-launcher__sr-only\">\n {product.name} amount\n </legend>\n <button\n aria-pressed={amount === \"\"}\n onClick={() => setAmount(\"\")}\n type=\"button\"\n >\n No thanks\n </button>\n {suggestions.map((suggestion) => (\n <button\n aria-pressed={amountCents === suggestion}\n key={suggestion}\n onClick={() => setAmount(String(suggestion / 100))}\n type=\"button\"\n >\n {usd.format(suggestion / 100).replace(\".00\", \"\")}\n </button>\n ))}\n <label\n className=\"lockerverse-launcher__donation-other\"\n data-selected={amount !== \"\" && !isSuggestedAmount ? true : undefined}\n >\n <input\n aria-label={`${product.name} amount`}\n min={getLockerverseMinimumCustomAmountCents(product) / 100}\n name={`amount-${product.slug}`}\n onChange={(event) => setAmount(event.target.value)}\n placeholder=\"Other $\"\n step=\"0.01\"\n type=\"number\"\n value={isSuggestedAmount ? \"\" : amount}\n />\n </label>\n </fieldset>\n </div>\n );\n}\n\ntype LauncherProductListProps = Omit<LauncherProductControlProps, \"product\"> & {\n products: LockerverseProduct[];\n variant?: LauncherProductOptionProps[\"variant\"];\n};\n\nfunction LauncherProductList({\n products,\n variant = \"default\",\n ...controlProps\n}: LauncherProductListProps) {\n return (\n <div className=\"lockerverse-launcher__product-list\">\n {products.map((product) =>\n variant === \"donation\" ? (\n <LauncherDonationOption\n {...controlProps}\n key={product.id}\n product={product}\n />\n ) : (\n <LauncherProductOption\n {...controlProps}\n key={product.id}\n product={product}\n variant={variant}\n />\n )\n )}\n </div>\n );\n}\n\nfunction getSelectionSummary(\n catalog: LockerverseCatalog,\n selection: LockerversePaymentSelectionItem[]\n) {\n let itemCount = 0;\n let amountCents = 0;\n for (const item of selection) {\n const product = catalog.products.find(\n (candidate) => candidate.slug === item.productSlug\n );\n if (!product) {\n continue;\n }\n if (\"quantity\" in item) {\n itemCount += item.quantity;\n amountCents += (product.amountCents ?? 0) * item.quantity;\n continue;\n }\n itemCount += 1;\n amountCents +=\n \"amountCents\" in item ? item.amountCents : (product.amountCents ?? 0);\n }\n const shipping = catalog.widget.requiredShipping;\n const triggerQuantity = shipping\n ? selection.reduce((total, item) => {\n const product = catalog.products.find(\n (candidate) => candidate.slug === item.productSlug\n );\n if (!(product && shipping.triggerProductIds.includes(product.id))) {\n return total;\n }\n return total + (\"quantity\" in item ? item.quantity : 1);\n }, 0)\n : 0;\n const needsShipping = triggerQuantity > 0;\n if (shipping && needsShipping) {\n amountCents +=\n (catalog.products.find((product) => product.id === shipping.productId)\n ?.amountCents ?? 0) +\n Math.max(0, triggerQuantity - 1) *\n (shipping.additionalUnitAmountCents ?? 0);\n }\n return { amountCents, itemCount, needsShipping };\n}\n\nfunction LauncherLoading() {\n return (\n <div\n aria-label=\"Loading donation options\"\n className=\"lockerverse-launcher__loading\"\n role=\"status\"\n >\n {[0, 1, 2].map((item) => (\n <span\n aria-hidden=\"true\"\n className=\"lockerverse-launcher__loading-row\"\n key={item}\n />\n ))}\n </div>\n );\n}\n\nfunction createLauncherSelection(\n catalog: LockerverseCatalog,\n quantities: Record<string, number>,\n customAmounts: Record<string, string>,\n recurringProductId: string | null\n): LockerversePaymentSelectionItem[] {\n if (recurringProductId) {\n const product = catalog.products.find(\n (candidate) =>\n candidate.id === recurringProductId &&\n candidate.paymentOption !== \"one-time\"\n );\n return product ? [{ productSlug: product.slug }] : [];\n }\n\n return catalog.products.flatMap(\n (product): LockerversePaymentSelectionItem[] => {\n const quantity = quantities[product.id] ?? 0;\n if (\n product.pricingMode === \"fixed\" &&\n product.paymentOption === \"one-time\" &&\n quantity > 0\n ) {\n return [{ productSlug: product.slug, quantity }];\n }\n const amountCents = parseAmountCents(customAmounts[product.id] ?? \"\");\n if (\n product.pricingMode === \"custom\" &&\n product.paymentOption === \"one-time\" &&\n amountCents !== null &&\n amountCents >= getLockerverseMinimumCustomAmountCents(product)\n ) {\n return [{ amountCents, productSlug: product.slug }];\n }\n return [];\n }\n );\n}\n\ntype LauncherSelectionStateProps = Omit<LauncherProductControlProps, \"product\">;\n\ntype LauncherCatalogProps = LauncherSelectionStateProps & {\n catalog: LockerverseCatalog;\n onContinue: (selection: LockerversePaymentSelectionItem[]) => void;\n};\n\nfunction LauncherCatalog({\n catalog,\n onContinue,\n ...selectionState\n}: LauncherCatalogProps) {\n const draftSelection = createLauncherSelection(\n catalog,\n selectionState.quantities,\n selectionState.customAmounts,\n selectionState.recurringProductId\n );\n const summary = getSelectionSummary(catalog, draftSelection);\n const donationProducts = catalog.products.filter(\n (product) =>\n product.paymentOption === \"one-time\" && product.pricingMode === \"custom\"\n );\n const orderProducts = catalog.products.filter(\n (product) =>\n !donationProducts.includes(product) &&\n product.id !== catalog.widget.requiredShipping?.productId\n );\n\n return (\n <form\n className=\"lockerverse-launcher__products\"\n onSubmit={(event) => {\n event.preventDefault();\n if (draftSelection.length > 0) {\n onContinue(draftSelection);\n }\n }}\n >\n {orderProducts.length > 0 ? (\n <section className=\"lockerverse-launcher__section\">\n <LauncherProductList {...selectionState} products={orderProducts} />\n </section>\n ) : null}\n {donationProducts.length > 0 ? (\n <section className=\"lockerverse-launcher__donation\">\n <header className=\"lockerverse-launcher__section-header\">\n <h3>Add a donation</h3>\n <p>Choose an amount to add to this order.</p>\n </header>\n <LauncherProductList\n {...selectionState}\n products={donationProducts}\n variant=\"donation\"\n />\n </section>\n ) : null}\n {orderProducts.length + donationProducts.length > 0 ? (\n <footer className=\"lockerverse-launcher__footer\">\n <p aria-live=\"polite\" className=\"lockerverse-launcher__summary\">\n <span>\n {summary.itemCount === 0\n ? \"No items selected\"\n : `${summary.itemCount} ${summary.itemCount === 1 ? \"item\" : \"items\"} selected`}\n </span>\n {summary.itemCount === 0 ? null : (\n <strong>{usd.format(summary.amountCents / 100)}</strong>\n )}\n </p>\n {summary.needsShipping ? (\n <p>Shipping is included once per order.</p>\n ) : null}\n <button\n className=\"lockerverse-launcher__continue\"\n disabled={draftSelection.length === 0}\n type=\"submit\"\n >\n Continue\n </button>\n </footer>\n ) : (\n <p>No products are available for this link.</p>\n )}\n </form>\n );\n}\n\ntype LauncherPaymentProps = Omit<\n LockerversePaymentProps,\n \"selection\" | \"widget\"\n>;\n\ntype LauncherCheckoutProps = {\n presentation: \"dialog\" | \"page\";\n onEdit: () => void;\n paymentProps: LauncherPaymentProps;\n selection: LockerversePaymentSelectionItem[];\n style: LockerversePaymentStyle;\n widget: UseLockerverseWidgetResult;\n};\n\nfunction LauncherCheckout({\n presentation,\n onEdit,\n paymentProps,\n selection,\n style,\n widget,\n}: LauncherCheckoutProps) {\n return (\n <div className=\"lockerverse-launcher__checkout\">\n <header className=\"lockerverse-launcher__checkout-toolbar\">\n <button\n className=\"lockerverse-launcher__back\"\n onClick={onEdit}\n type=\"button\"\n >\n Edit order\n </button>\n </header>\n <LockerversePayment\n {...paymentProps}\n className={presentation === \"page\" ? undefined : paymentProps.className}\n selection={selection}\n style={style}\n widget={widget}\n />\n </div>\n );\n}\n\nfunction LauncherDialogHeading({\n catalog,\n checkout,\n presentation = \"dialog\",\n showDescription = true,\n}: {\n presentation?: \"dialog\" | \"page\";\n showDescription?: boolean;\n catalog: LockerverseCatalog | null;\n checkout: boolean;\n}) {\n const Title = presentation === \"page\" ? \"h1\" : Dialog.Title;\n const Description = presentation === \"page\" ? \"p\" : Dialog.Description;\n if (checkout && presentation === \"page\") {\n return null;\n }\n if (checkout) {\n return (\n <>\n <Title className=\"lockerverse-launcher__sr-only\">Checkout</Title>\n <Description className=\"lockerverse-launcher__sr-only\">\n Review the order and complete payment.\n </Description>\n </>\n );\n }\n\n if (!catalog) {\n return (\n <header className=\"lockerverse-launcher__header\">\n <Title className=\"lockerverse-launcher__title\">Donate</Title>\n <Description\n className=\"lockerverse-launcher__description\"\n hidden={!showDescription}\n >\n Choose your options, then continue to checkout.\n </Description>\n </header>\n );\n }\n\n return (\n <header className=\"lockerverse-launcher__header\">\n {catalog.community ? (\n <div className=\"lockerverse-launcher__brand\">\n {catalog.community.imageUrl ? (\n <img\n alt={`${catalog.community.name} logo`}\n height=\"28\"\n src={catalog.community.imageUrl}\n width=\"28\"\n />\n ) : null}\n <span>{catalog.community.name}</span>\n </div>\n ) : null}\n <Title className=\"lockerverse-launcher__title\">\n {catalog.widget.title ?? catalog.widget.name}\n </Title>\n <Description\n className=\"lockerverse-launcher__description\"\n hidden={!showDescription}\n >\n {catalog.widget.description ??\n \"Choose your options, then continue to checkout.\"}\n </Description>\n </header>\n );\n}\n\nfunction hasPageLoadingFallback(\n presentation: \"dialog\" | \"page\",\n loading: boolean,\n fallback: ReactNode\n) {\n return presentation === \"page\" && loading && fallback !== undefined;\n}\n\nexport function LockerverseDonateLauncher({\n buttonLabel = \"Donate\",\n position = \"inline\",\n presentation = \"dialog\",\n loadingFallback,\n initialSelection = [],\n productIds,\n showDescription = true,\n widget,\n ...paymentProps\n}: LockerverseDonateLauncherProps) {\n const [selection, setSelection] = useState<\n LockerversePaymentSelectionItem[] | null\n >(null);\n const [customAmounts, setCustomAmounts] = useState<Record<string, string>>(\n {}\n );\n const [quantities, setQuantities] = useState<Record<string, number>>({});\n const [recurringProductId, setRecurringProductId] = useState<string | null>(\n null\n );\n const [linkConfiguration] = useState(() => ({\n initialSelection: initialSelection.map((item) => ({ ...item })),\n productIds: productIds ? [...productIds] : undefined,\n }));\n const [initialized, setInitialized] = useState(false);\n const { error, loading } = widget;\n const paymentCatalog = useMemo(\n () => launcherPaymentCatalog(widget.catalog, showDescription),\n [widget.catalog, showDescription]\n );\n const catalog = filterLauncherCatalog(\n widget.catalog,\n linkConfiguration.productIds\n );\n useEffect(() => {\n if (initialized || !widget.catalog) {\n return;\n }\n const initialCatalog = filterLauncherCatalog(\n widget.catalog,\n linkConfiguration.productIds\n );\n if (!initialCatalog) {\n return;\n }\n const choices = getInitialChoices(\n initialCatalog,\n linkConfiguration.initialSelection\n );\n setQuantities(choices.quantities);\n setCustomAmounts(choices.customAmounts);\n setRecurringProductId(choices.recurringProductId);\n setInitialized(true);\n }, [initialized, widget.catalog, linkConfiguration]);\n const accent = normalizeAccentColor(\n paymentProps.style?.[\"--lockerverse-accent\"] ??\n catalog?.community?.accentColor ??\n \"#38d77a\"\n );\n const accentContrast = getAccentContrast(accent);\n const launcherStyle: LockerversePaymentStyle = { ...paymentProps.style };\n if (\n paymentProps.style?.[\"--lockerverse-accent\"] !== undefined ||\n catalog?.community?.accentColor\n ) {\n launcherStyle[\"--lockerverse-accent\"] = accent;\n }\n if (\n accentContrast &&\n paymentProps.style?.[\"--lockerverse-accent-contrast\"] === undefined\n ) {\n launcherStyle[\"--lockerverse-accent-contrast\"] = accentContrast;\n }\n\n const optionsLoading = loading || !(initialized || error);\n let content: ReactNode;\n if (optionsLoading) {\n content = <LauncherLoading />;\n } else if (error) {\n content = (\n <div role=\"alert\">\n <p>Unable to load donation options.</p>\n <button onClick={widget.refresh} type=\"button\">\n Retry\n </button>\n </div>\n );\n } else if (catalog) {\n content = (\n <LauncherCatalog\n catalog={catalog}\n customAmounts={customAmounts}\n onContinue={setSelection}\n quantities={quantities}\n recurringProductId={recurringProductId}\n setCustomAmounts={setCustomAmounts}\n setQuantities={setQuantities}\n setRecurringProductId={setRecurringProductId}\n />\n );\n } else {\n content = <LauncherLoading />;\n }\n if (!(loading || error) && selection && catalog) {\n content = (\n <LauncherCheckout\n onEdit={() => setSelection(null)}\n paymentProps={paymentProps}\n presentation={presentation}\n selection={selection}\n style={launcherStyle}\n widget={{ ...widget, catalog: paymentCatalog }}\n />\n );\n }\n\n if (hasPageLoadingFallback(presentation, optionsLoading, loadingFallback)) {\n return loadingFallback;\n }\n if (presentation === \"page\") {\n return (\n <section\n className={`lockerverse-launcher__dialog lockerverse-launcher__page ${paymentProps.className ?? \"\"}`}\n data-lockerverse-theme={paymentProps.theme ?? \"dark\"}\n style={launcherStyle}\n >\n <LauncherDialogHeading\n catalog={catalog}\n checkout={selection !== null}\n presentation=\"page\"\n showDescription={showDescription}\n />\n {content}\n </section>\n );\n }\n\n return (\n <Dialog.Root\n onOpenChange={(open) => {\n if (open && catalog && paymentProps.stripeLoader === undefined) {\n requestAnimationFrame(() => {\n preloadLockerversePayment(catalog);\n });\n }\n }}\n >\n <Dialog.Trigger\n className={`lockerverse-launcher lockerverse-launcher--${position}`}\n data-lockerverse-theme={paymentProps.theme ?? \"dark\"}\n style={launcherStyle}\n >\n {buttonLabel}\n </Dialog.Trigger>\n <Dialog.Portal>\n <Dialog.Backdrop className=\"lockerverse-launcher__backdrop\" />\n <Dialog.Viewport className=\"lockerverse-launcher__viewport\">\n <Dialog.Popup\n className=\"lockerverse-launcher__dialog\"\n data-lockerverse-theme={paymentProps.theme ?? \"dark\"}\n style={launcherStyle}\n >\n <LauncherDialogHeading\n catalog={catalog}\n checkout={selection !== null}\n showDescription={showDescription}\n />\n <Dialog.Close\n aria-label=\"Close donation dialog\"\n className=\"lockerverse-launcher__close\"\n >\n <span aria-hidden=\"true\">×</span>\n </Dialog.Close>\n {content}\n </Dialog.Popup>\n </Dialog.Viewport>\n </Dialog.Portal>\n </Dialog.Root>\n );\n}\n"],"mappings":"4WAOA,SAAgB,EACd,EACA,EACA,CACA,IAAM,EAAqC,CAAC,EACtC,EAAwC,CAAC,EAC3C,EAAoC,KACxC,IAAK,IAAM,KAAQ,EAAW,CAC5B,I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AAE,GAAW,IAAU,GAAa,IACtC,EACE,EAAC,EAAD,CACE,WAAc,EAAa,IAAI,EACjB,eACA,eACH,YACX,MAAO,EACP,OAAQ,CAAE,GAAG,EAAQ,QAAS,CAAe,CAC9C,CAAA,GAID,EAAuB,EAAc,EAAgB,CAAe,EAC/D,EAEL,IAAiB,OAEjB,EAAC,UAAD,CACE,UAAW,2DAA2D,EAAa,WAAa,KAChG,yBAAwB,EAAa,OAAS,OAC9C,MAAO,EAHT,SAAA,CAKE,EAAC,EAAD,CACW,UACT,SAAU,IAAc,KACxB,aAAa,OACI,iBAClB,CAAA,EACA,CACM,IAKX,EAAC,EAAO,KAAR,CACE,aAAe,GAAS,CAClB,GAAQ,GAAW,EAAa,eAAiB,IAAA,IACnD,0BAA4B,CAC1B,EAA0B,CAAO,CACnC,CAAC,CAEL,EAPF,SAAA,CASE,EAAC,EAAO,QAAR,CACE,UAAW,8CAA8C,IACzD,yBAAwB,EAAa,OAAS,OAC9C,MAAO,EAEN,SAAA,CACa,CAAA,EAChB,EAAC,EAAO,OAAR,CAAA,SAAA,CACE,EAAC,EAAO,SAAR,CAAiB,UAAU,gCAAkC,CAAA,EAC7D,EAAC,EAAO,SAAR,CAAiB,UAAU,iCACzB,SAAA,EAAC,EAAO,MAAR,CACE,UAAU,+BACV,yBAAwB,EAAa,OAAS,OAC9C,MAAO,EAHT,SAAA,CAKE,EAAC,EAAD,CACW,UACT,SAAU,IAAc,KACP,iBAClB,CAAA,EACD,EAAC,EAAO,MAAR,CACE,aAAW,wBACX,UAAU,8BAEV,SAAA,EAAC,OAAD,CAAM,cAAY,OAAO,SAAA,GAAO,CAAA,CACpB,CAAA,EACb,CACW,GACC,CAAA,CACJ,CAAA,CAAA,CACJ,GAEjB"}
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as LockerverseTheme, t as LockerverseStyle } from "./theme.js";
2
2
  import { n as CustomFieldValues } from "./custom-fields.js";
3
3
  import { n as UseLockerverseWidgetResult } from "./use-lockerverse-widget.js";
4
- import { ComponentPropsWithoutRef } from "react";
4
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
5
5
  import { LockerversePaymentCompletion } from "@lockerverse/sdk/checkout";
6
6
  import { loadStripe } from "@stripe/stripe-js";
7
7
  //#region src/types.d.ts
@@ -57,6 +57,8 @@ type LockerverseDonateLauncherProps = Omit<LockerversePaymentProps, "selection">
57
57
  position?: LockerverseDonateLauncherPosition;
58
58
  /** Render the two-step flow directly in the page. Defaults to dialog. */
59
59
  presentation?: "dialog" | "page";
60
+ /** Replace the entire page while options initialize. Page presentation only. */
61
+ loadingFallback?: ReactNode;
60
62
  /** Initial editable choices. Remount to load a different link configuration. */
61
63
  initialSelection?: LockerversePaymentSelectionItem[];
62
64
  /** Product IDs available to select; omitted means all, an empty array means none. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;KAOY;EACN;EAAqB;;EACrB;EAAqB;;EACrB;;KAEM,0BAA0B;KAE1B;EACV;EACA;EACA;;KAGU,0BAA0B;KAE1B;EACV;EACA;;KAGU;EACV;EACA;;KAGU,8BACP,MAAM,kBAAkB,gBACxB,kBAAkB;KAElB,8BAA8B,KACjC;EAGA,WAAW;;EAEX;;EAEA;;EAEA,2BAA2B;EAC3B,WAAW;EACX,qBAAqB,SAAS;EAC9B,2BACE,UAAU;EAEZ,sBAAsB,SAAS;EAC/B,gBAAgB;EAChB,WAAW;EACX,eAAe;EACf,QAAQ;EACR,QAAQ;;KAGE,0BAA0B;EACpC,QAAQ;;KAGE;KAKA,iCAAiC,KAC3C;EAGA;EACA,WAAW;;EAEX;;EAEA,mBAAmB;;EAEnB;;EAEA"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;KAOY;EACN;EAAqB;;EACrB;EAAqB;;EACrB;;KAEM,0BAA0B;KAE1B;EACV;EACA;EACA;;KAGU,0BAA0B;KAE1B;EACV;EACA;;KAGU;EACV;EACA;;KAGU,8BACP,MAAM,kBAAkB,gBACxB,kBAAkB;KAElB,8BAA8B,KACjC;EAGA,WAAW;;EAEX;;EAEA;;EAEA,2BAA2B;EAC3B,WAAW;EACX,qBAAqB,SAAS;EAC9B,2BACE,UAAU;EAEZ,sBAAsB,SAAS;EAC/B,gBAAgB;EAChB,WAAW;EACX,eAAe;EACf,QAAQ;EACR,QAAQ;;KAGE,0BAA0B;EACpC,QAAQ;;KAGE;KAKA,iCAAiC,KAC3C;EAGA;EACA,WAAW;;EAEX;;EAEA,kBAAkB;;EAElB,mBAAmB;;EAEnB;;EAEA"}
@@ -1,6 +1,6 @@
1
1
  # Lockerverse auctions guide
2
2
 
3
- Package: @lockerverse/react@0.2.198-dev.1
3
+ Package: @lockerverse/react@0.2.200
4
4
 
5
5
  Generated from this release's maintained documentation. Do not edit this copy.
6
6
 
package/guides/events.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Lockerverse events guide
2
2
 
3
- Package: @lockerverse/react@0.2.198-dev.1
3
+ Package: @lockerverse/react@0.2.200
4
4
 
5
5
  Generated from this release's maintained documentation. Do not edit this copy.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Lockerverse integration guide
2
2
 
3
- Package: @lockerverse/react@0.2.198-dev.1
3
+ Package: @lockerverse/react@0.2.200
4
4
 
5
5
  Generated from this release's maintained documentation. Do not edit this copy.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Lockerverse payment-widgets guide
2
2
 
3
- Package: @lockerverse/react@0.2.198-dev.1
3
+ Package: @lockerverse/react@0.2.200
4
4
 
5
5
  Generated from this release's maintained documentation. Do not edit this copy.
6
6
 
package/guides/signup.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Lockerverse signup guide
2
2
 
3
- Package: @lockerverse/react@0.2.198-dev.1
3
+ Package: @lockerverse/react@0.2.200
4
4
 
5
5
  Generated from this release's maintained documentation. Do not edit this copy.
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lockerverse/react",
3
- "version": "0.2.198-dev.1",
3
+ "version": "0.2.200",
4
4
  "description": "Tree-shakable React payment and signup UI for Lockerverse",
5
5
  "repository": {
6
6
  "type": "git",
@@ -136,7 +136,7 @@
136
136
  "embla-carousel-react": "8.6.0",
137
137
  "lucide-react": "0.536.0",
138
138
  "valibot": "1.4.2",
139
- "@lockerverse/sdk": "0.2.198-dev.1"
139
+ "@lockerverse/sdk": "0.2.200"
140
140
  },
141
141
  "devDependencies": {
142
142
  "@size-limit/file": "13.0.3",