@lockerverse/react 0.2.243 → 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.
- package/MIGRATIONS.md +2 -20
- package/README.md +1 -127
- package/dist/embed/chunks/{auction-payment-view-54VD3GXY.js → auction-payment-view-VU57K6SY.js} +1 -1
- package/dist/embed/chunks/{chunk-CKJMJFV3.js → chunk-BQM7MYAR.js} +2 -2
- package/dist/embed/chunks/{chunk-WITNVKBB.js → chunk-FYXFA2VI.js} +1 -1
- package/dist/embed/chunks/{chunk-A7PT24ZF.js → chunk-P36T6R2V.js} +2 -2
- package/dist/embed/chunks/{lockerverse-auction-item-77YQUWDI.js → lockerverse-auction-item-HZ6RFGBJ.js} +2 -2
- package/dist/embed/lockerverse.js +1 -1
- package/dist/embed/runtime.js +2 -2
- package/dist/form-controls.css +1 -0
- package/guides/auctions.md +1 -1
- package/guides/bookings.md +1 -1
- package/guides/browser-embed.md +1 -1
- package/guides/events.md +1 -1
- package/guides/integration.md +1 -1
- package/guides/payment-widgets.md +14 -146
- package/guides/signup.md +1 -1
- package/package.json +2 -2
- /package/dist/embed/chunks/{chunk-CKJMJFV3.js.LEGAL.txt → chunk-BQM7MYAR.js.LEGAL.txt} +0 -0
- /package/dist/embed/chunks/{chunk-A7PT24ZF.js.LEGAL.txt → chunk-P36T6R2V.js.LEGAL.txt} +0 -0
- /package/dist/embed/chunks/{lockerverse-auction-item-77YQUWDI.js.LEGAL.txt → lockerverse-auction-item-HZ6RFGBJ.js.LEGAL.txt} +0 -0
package/dist/form-controls.css
CHANGED
package/guides/auctions.md
CHANGED
package/guides/bookings.md
CHANGED
package/guides/browser-embed.md
CHANGED
package/guides/events.md
CHANGED
package/guides/integration.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Lockerverse payment-widgets guide
|
|
2
2
|
|
|
3
|
-
Package: @lockerverse/react@0.2.
|
|
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
|
-
##
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lockerverse/react",
|
|
3
|
-
"version": "0.2.
|
|
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.
|
|
155
|
+
"@lockerverse/sdk": "0.2.245"
|
|
156
156
|
},
|
|
157
157
|
"devDependencies": {
|
|
158
158
|
"@size-limit/file": "13.0.3",
|
|
File without changes
|
|
File without changes
|