@lockerverse/react 0.2.244 → 0.2.245

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.
@@ -1,6 +1,6 @@
1
1
  # Lockerverse auctions guide
2
2
 
3
- Package: @lockerverse/react@0.2.244
3
+ Package: @lockerverse/react@0.2.245
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 bookings guide
2
2
 
3
- Package: @lockerverse/react@0.2.244
3
+ Package: @lockerverse/react@0.2.245
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 browser-embed guide
2
2
 
3
- Package: @lockerverse/react@0.2.244
3
+ Package: @lockerverse/react@0.2.245
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.244
3
+ Package: @lockerverse/react@0.2.245
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.244
3
+ Package: @lockerverse/react@0.2.245
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.244
3
+ Package: @lockerverse/react@0.2.245
4
4
 
5
5
  Generated from this release's maintained documentation. Do not edit this copy.
6
6
 
@@ -62,20 +62,18 @@ one-time cart. Disable checkout when no product is selected or a value violates
62
62
  live limits. Local totals are feedback only; Lockerverse decides the final
63
63
  payable amount.
64
64
 
65
- ## Availability on custom product pages
66
-
67
- For every custom product card, use `getLockerverseProductAvailability` from
68
- `@lockerverse/sdk/checkout` with the current catalog, product, and selected
69
- quantities keyed by product ID. Use nonnegative safe integers. Use the same helper for hosted buttons and native
70
- checkout. Show **Sold out** when the minimum purchase cannot fit even in an empty
71
- cart. Show **Limit reached** when current selections prevent adding another.
72
- Disable adding unavailable packages, keep them visible, and let the customer
73
- reduce the order. `maximumQuantity` is the total quantity of this product that
74
- fits with the other selections, or null for unlimited. Checkout can accept a
75
- valid cart at its maximum. Keep new purchases disabled until the catalog loads.
76
- Offer retry after a loading error and refresh after a sold-out checkout response.
77
- Use the weights and limits from the catalog. Do not hard-code counts, package
78
- names, or weight rules in the host.
65
+ ## Custom product availability
66
+
67
+ Use the live catalog to enable each purchase action. Pass selected quantities by product ID. Keep sold-out options visible and allow a valid cart to check out when it reaches its limit.
68
+
69
+ ```tsx
70
+ import { getLockerverseProductAvailability } from "@lockerverse/sdk/checkout";
71
+
72
+ const { status } = getLockerverseProductAvailability(catalog, product, quantities);
73
+ <button disabled={status !== "available"} onClick={addProduct}>
74
+ {status === "sold_out" ? "Sold out" : status === "limit_reached" ? "Limit reached" : "Add"}
75
+ </button>
76
+ ```
79
77
 
80
78
  ## Hosted checkout URLs
81
79
 
@@ -83,7 +81,7 @@ Given the configured public widget URL
83
81
  `https://host.example/community/widgets/v2/widget/donate`, a product's direct
84
82
  URL is the same resource with `/options/{encodedProductSlug}/donate` in place
85
83
  of its final `/donate`. Use the live product's `slug` and `encodeURIComponent`.
86
- Use `URL` and `URLSearchParams`; preserve the supplied widget origin and route.
84
+ Use `URL` and `URLSearchParams` to preserve the supplied widget origin and route. When opening hosted checkout, set `meta.sourceUrl` to `window.location.origin + window.location.pathname`, preserving the checkout URL’s existing parameters.
87
85
 
88
86
  - For a fixed-price direct product, set `quantity` only when the page collects
89
87
  a quantity. Do not set `amount` or `paymentOption`.
@@ -160,136 +158,6 @@ and no horizontal overflow. Open checkout to check saved settings, but do not
160
158
  submit payment. For native SDK checkout, inspect callback and recovery handling
161
159
  without creating live transactions.
162
160
 
163
- ## Custom Product UI
164
-
165
- Use `useLockerverseWidget` to build custom Product presentation from the live
166
- Lockerverse catalog. This entry point does not import the payment UI or Stripe.
167
-
168
- ```tsx
169
- import {
170
- LockerversePayment,
171
- preloadLockerversePayment,
172
- type LockerversePaymentSelectionItem,
173
- } from "@lockerverse/react/payment";
174
- import "@lockerverse/react/payment.css";
175
- import { useLockerverseWidget } from "@lockerverse/react/widget";
176
- import { getLockerverseProductAvailability } from "@lockerverse/sdk/checkout";
177
- import { useState } from "react";
178
-
179
- const widgetOptions = {
180
- communitySlug: "auburn",
181
- widgetSlug: "tailgate-party",
182
- };
183
-
184
- export function CustomProductCheckout() {
185
- const widget = useLockerverseWidget(widgetOptions);
186
- const [selection, setSelection] =
187
- useState<LockerversePaymentSelectionItem | null>(null);
188
-
189
- if (widget.loading) {
190
- return <p>Loading checkout...</p>;
191
- }
192
- if (widget.error) {
193
- return <button onClick={widget.refresh}>Try again</button>;
194
- }
195
- if (!widget.catalog) {
196
- return null;
197
- }
198
- if (selection) {
199
- return (
200
- <LockerversePayment
201
- selection={[selection]}
202
- widget={widget}
203
- />
204
- );
205
- }
206
-
207
- const catalog = widget.catalog;
208
- return catalog.products
209
- .filter((product) => product.pricingMode === "fixed")
210
- .map((product) => {
211
- const { status } = getLockerverseProductAvailability(catalog, product);
212
- return (
213
- <button
214
- key={product.id}
215
- data-lockerverse-offer={product.listingId}
216
- data-lockerverse-availability={status}
217
- disabled={status !== "available"}
218
- onFocus={() => void preloadLockerversePayment(catalog)}
219
- onPointerEnter={() => void preloadLockerversePayment(catalog)}
220
- onClick={() =>
221
- setSelection(
222
- product.paymentOption === "one-time"
223
- ? { productSlug: product.slug, quantity: product.minimumQuantity ?? 1 }
224
- : { productSlug: product.slug }
225
- )
226
- }
227
- >
228
- {product.name}{status === "sold_out" && " — Sold out"}
229
- </button>
230
- );
231
- });
232
- }
233
- ```
234
-
235
- The hook returns immutable `catalog` data together with `loading`, `error`, and
236
- `refresh`. The host owns presentation and selection state. Pass the
237
- selected Product slugs to `LockerversePayment`; Lockerverse remains
238
- authoritative for availability, pricing, and payment.
239
-
240
- Pass the hook result to `LockerversePayment` with `widget={widget}`. The result
241
- contains the loaded catalog and its client, so the component requests
242
- only the authoritative quote without repeated configuration. The host can show
243
- a local catalog total before checkout. The component uses the same local
244
- estimate to mount the payment form and Stripe immediately, then replaces it
245
- with the authoritative quote in the background. Payment confirmation still
246
- requires the current authoritative quote.
247
-
248
- This small example shows fixed-price Products. For a custom-price Product, ask
249
- for the amount in the host UI and pass `amountCents` with `productSlug`.
250
-
251
- For a monthly, six-month, or annual Product, omit quantity. The component shows the
252
- cadence and configures Stripe Elements for a subscription:
253
-
254
- ```tsx
255
- <LockerversePayment
256
- selection={[{ productSlug: "monthly-supporter" }]}
257
- widget={widget}
258
- />
259
- ```
260
-
261
- Recurring checkout accepts one fixed Product. It does not accept quantities,
262
- custom amounts, or multiple Products.
263
-
264
- ### Live product availability
265
-
266
- Use the live `widget.catalog` for names, prices, and limits. Find the requested
267
- product by its `listingId` or `slug`; do not keep a separate static price list.
268
- Amounts are integer cents. Format them with `catalog.payment.currency`, not a
269
- currency field on the product.
270
-
271
- Use `getLockerverseProductAvailability(catalog, product, quantities)` from
272
- `@lockerverse/sdk/checkout` for each custom product card. Supply selected
273
- package quantities keyed by product ID. Use nonnegative safe integers. The helper applies product inventory,
274
- listing limits, and weighted shared limits. A package can be sold out while
275
- smaller packages in the same group still fit.
276
-
277
- Show **Sold out** and disable adding the item when `status === "sold_out"`.
278
- Show **Limit reached** when `status === "limit_reached"`. Keep the controls
279
- for reducing selected quantities. `maximumQuantity` is the total quantity of
280
- this product that fits with the other selections. A null maximum means there
281
- is no quantity limit. A selection exactly at the maximum can proceed to checkout.
282
- While availability loads or fails, disable new purchases and offer retry on
283
- failure. Refresh after a sold-out response from checkout. Keep an unresolved
284
- payment available for recovery. The authoritative quote and payment reservation
285
- check capacity again.
286
-
287
- If an existing button already selects one product, open its checkout directly.
288
- Use the donate launcher when the visitor needs a product picker. For a custom
289
- dialog, use an accessible title, close button, focus handling, and mobile scroll
290
- area. Keep recovery state in an owner that remains mounted when the dialog
291
- closes. Closing a dialog does not complete or cancel a payment.
292
-
293
161
  ## Donate launcher
294
162
 
295
163
  `LockerverseDonateLauncher` turns an existing payment widget into a native
package/guides/signup.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Lockerverse signup guide
2
2
 
3
- Package: @lockerverse/react@0.2.244
3
+ Package: @lockerverse/react@0.2.245
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.244",
3
+ "version": "0.2.245",
4
4
  "description": "Tree-shakable React payment and signup UI for Lockerverse",
5
5
  "repository": {
6
6
  "type": "git",
@@ -152,7 +152,7 @@
152
152
  "embla-carousel-react": "8.6.0",
153
153
  "lucide-react": "0.536.0",
154
154
  "valibot": "1.4.2",
155
- "@lockerverse/sdk": "0.2.244"
155
+ "@lockerverse/sdk": "0.2.245"
156
156
  },
157
157
  "devDependencies": {
158
158
  "@size-limit/file": "13.0.3",