@lockerverse/react 0.2.222 → 0.2.223-dev.1
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 +89 -5
- package/dist/booking-payment.d.ts +18 -0
- package/dist/booking-payment.d.ts.map +1 -0
- package/dist/booking-payment.js +2 -0
- package/dist/booking-payment.js.map +1 -0
- package/dist/bookings.d.ts +28 -0
- package/dist/bookings.d.ts.map +1 -0
- package/dist/bookings.js +2 -0
- package/dist/bookings.js.map +1 -0
- package/dist/lockerverse-payment.js +1 -1
- package/dist/lockerverse-payment.js.map +1 -1
- package/guides/auctions.md +1 -1
- package/guides/bookings.md +84 -0
- package/guides/events.md +1 -1
- package/guides/integration.md +1 -1
- package/guides/payment-widgets.md +1 -1
- package/guides/signup.md +1 -1
- package/package.json +23 -3
package/guides/auctions.md
CHANGED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Lockerverse bookings guide
|
|
2
|
+
|
|
3
|
+
Package: @lockerverse/react@0.2.223-dev.1
|
|
4
|
+
|
|
5
|
+
Generated from this release's maintained documentation. Do not edit this copy.
|
|
6
|
+
|
|
7
|
+
Read [the shared integration guide](integration.md) first.
|
|
8
|
+
|
|
9
|
+
## Bookings
|
|
10
|
+
|
|
11
|
+
Booking support is optional. Import the client from `@lockerverse/sdk/bookings`
|
|
12
|
+
and the state hook from `@lockerverse/react/bookings`. Neither entry imports
|
|
13
|
+
Stripe. Existing root entries do not export booking features.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { createLockerverseBookingsClient } from '@lockerverse/sdk/bookings';
|
|
17
|
+
import { useLockerverseBookings } from '@lockerverse/react/bookings';
|
|
18
|
+
import { lazy, useMemo } from 'react';
|
|
19
|
+
|
|
20
|
+
const BookingPayment = lazy(() => import('@lockerverse/react/booking-payment')
|
|
21
|
+
.then(module => ({ default: module.LockerverseBookingPayment })));
|
|
22
|
+
|
|
23
|
+
// Keep the client stable for this mounted business. The host owns access storage.
|
|
24
|
+
const client = createLockerverseBookingsClient({
|
|
25
|
+
businessKey: 'your-business',
|
|
26
|
+
environment: 'development',
|
|
27
|
+
apiBaseUrl: 'https://your-development-api.example/api',
|
|
28
|
+
getAccessToken: () => getCurrentLimitedAccessToken(),
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Create the client once (or with `useMemo`) and pass it to
|
|
33
|
+
`useLockerverseBookings(client, { enabled, sessionKey })`. `sessionKey` is a
|
|
34
|
+
non-secret counter that changes when the access code changes. Remount the hook
|
|
35
|
+
when the business changes. Never place access tokens in public configuration,
|
|
36
|
+
URLs, logs, analytics, or error messages. Do not bundle provider secrets.
|
|
37
|
+
|
|
38
|
+
The hook loads configuration and recovers the saved attempt before it permits
|
|
39
|
+
payment. `findTimes(date)` returns `{ slots, message }`; dates use YYYY-MM-DD in
|
|
40
|
+
`configuration.business.timeZone`. `initialize({ date, start })` selects one
|
|
41
|
+
returned slot. `confirm(confirmationToken)` submits that attempt. Both return the
|
|
42
|
+
server attempt. `recover()` returns the saved attempt or null. `refresh()` loads
|
|
43
|
+
configuration and recovery and returns void. All action promises reject on error;
|
|
44
|
+
handle the rejection and show `error.message`.
|
|
45
|
+
|
|
46
|
+
Use `configuration.business.service` for the name, amount, currency and duration.
|
|
47
|
+
Render the lazy payment component inside a React `Suspense` boundary **only while
|
|
48
|
+
`canPay` is true**, with these props:
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
<BookingPayment
|
|
52
|
+
key={booking.attempt.id}
|
|
53
|
+
publishableKey={booking.attempt.publishableKey}
|
|
54
|
+
amountCents={booking.configuration.business.service.amountCents}
|
|
55
|
+
currency={booking.configuration.business.service.currency}
|
|
56
|
+
onConfirm={booking.confirm}
|
|
57
|
+
disabled={booking.busy}
|
|
58
|
+
buttonClassName="your-existing-button-style"
|
|
59
|
+
/>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Wrap the lazy payment component in a local React error boundary. Keep the
|
|
63
|
+
booking status and recovery controls outside this boundary, so a module load
|
|
64
|
+
error cannot remove the recovery path. Reload or retry card entry only for the
|
|
65
|
+
same recovered attempt; do not create another attempt to handle a load error.
|
|
66
|
+
|
|
67
|
+
The optional payment entry needs the Stripe peer versions in the package
|
|
68
|
+
manifest. It creates a confirmation token with off-session setup and sends it to
|
|
69
|
+
the Lockerverse backend. It does not confirm or charge on the client. Its button
|
|
70
|
+
locks after submission. It adds no CSS; hosts retain their page and button styles.
|
|
71
|
+
|
|
72
|
+
A timeout or lost response does not mean payment failed. Keep the saved attempt,
|
|
73
|
+
show recovery, and call `recover()` before any next action. Do not create a new
|
|
74
|
+
attempt after an unknown result. The hook blocks another payment until recovery
|
|
75
|
+
succeeds, and ignores late responses from an old access session. A returned
|
|
76
|
+
`review` status after confirmation also requires explicit recovery. Only
|
|
77
|
+
`complete` means the backend completed its booking/payment record work. Other
|
|
78
|
+
states remain visible and may need recovery or staff help; never translate them
|
|
79
|
+
into a fresh payment automatically.
|
|
80
|
+
|
|
81
|
+
This first release supports one configured service per business and USD. The
|
|
82
|
+
backend owns Square credentials, the payment amount, payment idempotency, booking
|
|
83
|
+
creation and the staff paid note. SDK availability does not enable production
|
|
84
|
+
booking endpoints: configure and approve each backend environment separately.
|
package/guides/events.md
CHANGED
package/guides/integration.md
CHANGED
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.223-dev.1",
|
|
4
4
|
"description": "Tree-shakable React payment and signup UI for Lockerverse",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -119,7 +119,17 @@
|
|
|
119
119
|
"import": "./dist/payment-primitives.js",
|
|
120
120
|
"default": "./dist/payment-primitives.js"
|
|
121
121
|
},
|
|
122
|
-
"./guides/*": "./guides/*"
|
|
122
|
+
"./guides/*": "./guides/*",
|
|
123
|
+
"./bookings": {
|
|
124
|
+
"types": "./dist/bookings.d.ts",
|
|
125
|
+
"import": "./dist/bookings.js",
|
|
126
|
+
"default": "./dist/bookings.js"
|
|
127
|
+
},
|
|
128
|
+
"./booking-payment": {
|
|
129
|
+
"types": "./dist/booking-payment.d.ts",
|
|
130
|
+
"import": "./dist/booking-payment.js",
|
|
131
|
+
"default": "./dist/booking-payment.js"
|
|
132
|
+
}
|
|
123
133
|
},
|
|
124
134
|
"module": "./dist/index.js",
|
|
125
135
|
"types": "./dist/index.d.ts",
|
|
@@ -136,7 +146,7 @@
|
|
|
136
146
|
"embla-carousel-react": "8.6.0",
|
|
137
147
|
"lucide-react": "0.536.0",
|
|
138
148
|
"valibot": "1.4.2",
|
|
139
|
-
"@lockerverse/sdk": "0.2.
|
|
149
|
+
"@lockerverse/sdk": "0.2.223-dev.1"
|
|
140
150
|
},
|
|
141
151
|
"devDependencies": {
|
|
142
152
|
"@size-limit/file": "13.0.3",
|
|
@@ -220,6 +230,16 @@
|
|
|
220
230
|
"name": "React signup styles",
|
|
221
231
|
"limit": "4 kB",
|
|
222
232
|
"path": "dist/signup.css"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"name": "React booking state",
|
|
236
|
+
"limit": "3 kB",
|
|
237
|
+
"path": "dist/bookings.js"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"name": "React booking card entry",
|
|
241
|
+
"limit": "3 kB",
|
|
242
|
+
"path": "dist/booking-payment.js"
|
|
223
243
|
}
|
|
224
244
|
],
|
|
225
245
|
"scripts": {
|