@resira/ui 0.4.8 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,238 +1,238 @@
1
- # @resira/ui v0.3.2
2
-
3
- React booking UI for Resira. It includes a ready-to-embed widget, modal flow, provider, hooks, and lower-level components for custom booking experiences.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @resira/ui@0.3.2 @resira/sdk@0.3.1
9
- ```
10
-
11
- Peer dependencies:
12
-
13
- - react >= 18
14
- - react-dom >= 18
15
-
16
- ## Quick start
17
-
18
- ```tsx
19
- import { ResiraProvider, ResiraBookingWidget } from "@resira/ui";
20
- import "@resira/ui/styles.css";
21
-
22
- export function App() {
23
- return (
24
- <ResiraProvider
25
- apiKey="resira_live_abc123"
26
- resourceId="prop-1"
27
- domain="rental"
28
- >
29
- <ResiraBookingWidget />
30
- </ResiraProvider>
31
- );
32
- }
33
- ```
34
-
35
- You can also use the higher-level modal component:
36
-
37
- ```tsx
38
- import { BookingModal } from "@resira/ui";
39
- import "@resira/ui/styles.css";
40
-
41
- <BookingModal apiKey="resira_live_abc123" domain="watersport" />;
42
- ```
43
-
44
- ## Supported domains
45
-
46
- | Domain | Flow |
47
- | --- | --- |
48
- | `rental` | Calendar -> guest details -> terms -> payment |
49
- | `restaurant` | Time slots -> guest details -> terms -> payment |
50
- | `watersport` | Service -> time -> guest details -> terms -> payment |
51
- | `service` | Service -> time -> guest details -> terms -> payment |
52
-
53
- ## ResiraProvider
54
-
55
- `ResiraProvider` initializes the SDK client, loads public property configuration, resolves theme and locale values, and provides booking state to child components.
56
-
57
- ```tsx
58
- <ResiraProvider
59
- apiKey="resira_live_..."
60
- resourceId="resource-id"
61
- domain="rental"
62
- config={{
63
- theme: {
64
- primaryColor: "#18181b",
65
- borderRadius: "16px",
66
- },
67
- locale: {
68
- bookNow: "Book now",
69
- },
70
- serviceLayout: "vertical",
71
- visibleServiceCount: 4,
72
- groupServicesByCategory: true,
73
- stripePublishableKey: "pk_live_...",
74
- showTerms: true,
75
- showWaiver: false,
76
- depositPercent: 50,
77
- }}
78
- >
79
- <ResiraBookingWidget />
80
- </ResiraProvider>
81
- ```
82
-
83
- ### Provider props
84
-
85
- | Prop | Type | Required | Description |
86
- | --- | --- | --- | --- |
87
- | `apiKey` | `string` | Yes | Resira public API key |
88
- | `resourceId` | `string` | No | Default resource or property ID. Omit for catalog mode |
89
- | `domain` | `"rental" \| "restaurant" \| "watersport" \| "service"` | Yes | Booking flow type |
90
- | `config` | `ResiraProviderConfig` | No | Theme, locale, layout, payment, and rendering overrides |
91
- | `onClose` | `() => void` | No | Close callback for modal-driven flows |
92
-
93
- ### Important config options
94
-
95
- | Config field | Type | Description |
96
- | --- | --- | --- |
97
- | `theme` | `ResiraTheme` | Theme token overrides |
98
- | `locale` | `ResiraLocale` | Text and i18n overrides |
99
- | `domainConfig` | `DomainConfig` | Domain-specific rules such as min/max party size or duration |
100
- | `classNames` | `ResiraClassNames` | CSS class overrides |
101
- | `serviceLayout` | `"vertical" \| "horizontal"` | Product selector layout |
102
- | `visibleServiceCount` | `number` | Number of visible services before scrolling |
103
- | `groupServicesByCategory` | `boolean` | Group services by linked equipment type |
104
- | `renderServiceCard` | `(product, selected) => ReactNode` | Custom service card rendering |
105
- | `baseUrl` | `string` | Optional API origin override |
106
- | `baseUrls` | `Array<string \| WeightedBaseUrl>` | Optional ordered fallback origin list |
107
- | `stripePublishableKey` | `string` | Stripe publishable key override |
108
- | `termsText` | `string` | Terms text override |
109
- | `waiverText` | `string` | Waiver text override |
110
- | `showWaiver` | `boolean` | Show waiver checkbox |
111
- | `showTerms` | `boolean` | Show terms checkbox |
112
- | `showRemainingSpots` | `boolean` | Show remaining capacity labels |
113
- | `depositPercent` | `number` | Percent charged upfront |
114
-
115
- ## Styling and customization
116
-
117
- Import the stylesheet once:
118
-
119
- ```tsx
120
- import "@resira/ui/styles.css";
121
- ```
122
-
123
- The main customization layers are:
124
-
125
- - `theme` tokens on `ResiraProvider`
126
- - CSS custom properties under `.resira-root`
127
- - `classNames` and `renderServiceCard` for deeper control
128
-
129
- For more styling details, see [CUSTOMIZATION.md](./CUSTOMIZATION.md).
130
-
131
- ## Payment and remote config
132
-
133
- The provider loads public configuration such as:
134
-
135
- - Stripe publishable key
136
- - deposit percentage
137
- - terms requirements
138
- - refund policy
139
-
140
- You can override those values locally through `config` when needed.
141
-
142
- ## Hooks and components
143
-
144
- Main exports:
145
-
146
- - `ResiraProvider`
147
- - `useResira`
148
- - `ResiraBookingWidget`
149
- - `BookingModal`
150
- - `BookingCalendar`
151
- - `TimeSlotPicker`
152
- - `ResourcePicker`
153
- - `ProductSelector`
154
- - `GuestForm`
155
- - `validateGuestForm`
156
- - `WaiverConsent`
157
- - `PaymentForm`
158
- - `SummaryPreview`
159
- - `ConfirmationView`
160
- - `useAvailability`
161
- - `useReservation`
162
- - `useResources`
163
- - `useProducts`
164
- - `usePaymentIntent`
165
- - `DishShowcase`
166
- - `useDish`
167
- - `useDishes`
168
-
169
- ## DishShowcase
170
-
171
- The `DishShowcase` component renders a trigger button that opens a nested modal for browsing dishes with 3D model previews and AR viewing. It uses `<model-viewer>` for the 3D experience.
172
-
173
- ### Prerequisites
174
-
175
- Load the `<model-viewer>` web component in your page:
176
-
177
- ```html
178
- <script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0/model-viewer.min.js"></script>
179
- ```
180
-
181
- ### Single dish (by ID)
182
-
183
- The `dishId` is shown on the dish page in the admin dashboard for easy copying.
184
-
185
- ```tsx
186
- import { DishShowcase } from "@resira/ui";
187
-
188
- <DishShowcase dishId="dish-uuid">
189
- View in 3D
190
- </DishShowcase>
191
- ```
192
-
193
- ### Browse all dishes
194
-
195
- ```tsx
196
- <DishShowcase showAll>
197
- Explore Our Menu
198
- </DishShowcase>
199
- ```
200
-
201
- ### Filter by category
202
-
203
- ```tsx
204
- <DishShowcase showAll category="Main">
205
- View Main Courses
206
- </DishShowcase>
207
- ```
208
-
209
- ### Props
210
-
211
- | Prop | Type | Default | Description |
212
- | --- | --- | --- | --- |
213
- | `dishId` | `string` | — | Single dish ID, opens directly to 3D viewer |
214
- | `showAll` | `boolean` | `false` | Show all dishes in a browsable grid |
215
- | `category` | `string` | — | Filter dishes by category |
216
- | `className` | `string` | — | Custom CSS class on the trigger button |
217
- | `style` | `CSSProperties` | — | Custom inline styles on the trigger button |
218
- | `children` | `ReactNode` | required | Button label / content |
219
-
220
- ### Inside a BookingModal
221
-
222
- `DishShowcase` works as a nested modal — it renders above the booking modal with its own overlay and focus trap:
223
-
224
- ```tsx
225
- <BookingModal apiKey="resira_live_..." domain="restaurant">
226
- <DishShowcase dishId="dish-uuid" style={{ marginBottom: 12 }}>
227
- Preview this dish in 3D
228
- </DishShowcase>
229
- </BookingModal>
230
- ```
231
-
232
- ## Notes
233
-
234
- - The widget supports catalog mode when `resourceId` is omitted.
235
- - Service and watersport flows group services by linked equipment category by default.
236
- - Loading and error states now announce themselves to assistive technologies on the main widget surfaces.
237
- - Client-side API origin stickiness/load-balancing has been removed; routing is deterministic unless you pass explicit fallback origins.
238
- - The package is intended for browser usage and ships CSS separately via `@resira/ui/styles.css`.
1
+ # @resira/ui v0.3.2
2
+
3
+ React booking UI for Resira. It includes a ready-to-embed widget, modal flow, provider, hooks, and lower-level components for custom booking experiences.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @resira/ui@0.3.2 @resira/sdk@0.3.1
9
+ ```
10
+
11
+ Peer dependencies:
12
+
13
+ - react >= 18
14
+ - react-dom >= 18
15
+
16
+ ## Quick start
17
+
18
+ ```tsx
19
+ import { ResiraProvider, ResiraBookingWidget } from "@resira/ui";
20
+ import "@resira/ui/styles.css";
21
+
22
+ export function App() {
23
+ return (
24
+ <ResiraProvider
25
+ apiKey="resira_live_abc123"
26
+ resourceId="prop-1"
27
+ domain="rental"
28
+ >
29
+ <ResiraBookingWidget />
30
+ </ResiraProvider>
31
+ );
32
+ }
33
+ ```
34
+
35
+ You can also use the higher-level modal component:
36
+
37
+ ```tsx
38
+ import { BookingModal } from "@resira/ui";
39
+ import "@resira/ui/styles.css";
40
+
41
+ <BookingModal apiKey="resira_live_abc123" domain="watersport" />;
42
+ ```
43
+
44
+ ## Supported domains
45
+
46
+ | Domain | Flow |
47
+ | --- | --- |
48
+ | `rental` | Calendar -> guest details -> terms -> payment |
49
+ | `restaurant` | Time slots -> guest details -> terms -> payment |
50
+ | `watersport` | Service -> time -> guest details -> terms -> payment |
51
+ | `service` | Service -> time -> guest details -> terms -> payment |
52
+
53
+ ## ResiraProvider
54
+
55
+ `ResiraProvider` initializes the SDK client, loads public property configuration, resolves theme and locale values, and provides booking state to child components.
56
+
57
+ ```tsx
58
+ <ResiraProvider
59
+ apiKey="resira_live_..."
60
+ resourceId="resource-id"
61
+ domain="rental"
62
+ config={{
63
+ theme: {
64
+ primaryColor: "#18181b",
65
+ borderRadius: "16px",
66
+ },
67
+ locale: {
68
+ bookNow: "Book now",
69
+ },
70
+ serviceLayout: "vertical",
71
+ visibleServiceCount: 4,
72
+ groupServicesByCategory: true,
73
+ stripePublishableKey: "pk_live_...",
74
+ showTerms: true,
75
+ showWaiver: false,
76
+ depositPercent: 50,
77
+ }}
78
+ >
79
+ <ResiraBookingWidget />
80
+ </ResiraProvider>
81
+ ```
82
+
83
+ ### Provider props
84
+
85
+ | Prop | Type | Required | Description |
86
+ | --- | --- | --- | --- |
87
+ | `apiKey` | `string` | Yes | Resira public API key |
88
+ | `resourceId` | `string` | No | Default resource or property ID. Omit for catalog mode |
89
+ | `domain` | `"rental" \| "restaurant" \| "watersport" \| "service"` | Yes | Booking flow type |
90
+ | `config` | `ResiraProviderConfig` | No | Theme, locale, layout, payment, and rendering overrides |
91
+ | `onClose` | `() => void` | No | Close callback for modal-driven flows |
92
+
93
+ ### Important config options
94
+
95
+ | Config field | Type | Description |
96
+ | --- | --- | --- |
97
+ | `theme` | `ResiraTheme` | Theme token overrides |
98
+ | `locale` | `ResiraLocale` | Text and i18n overrides |
99
+ | `domainConfig` | `DomainConfig` | Domain-specific rules such as min/max party size or duration |
100
+ | `classNames` | `ResiraClassNames` | CSS class overrides |
101
+ | `serviceLayout` | `"vertical" \| "horizontal"` | Product selector layout |
102
+ | `visibleServiceCount` | `number` | Number of visible services before scrolling |
103
+ | `groupServicesByCategory` | `boolean` | Group services by linked equipment type |
104
+ | `renderServiceCard` | `(product, selected) => ReactNode` | Custom service card rendering |
105
+ | `baseUrl` | `string` | Optional API origin override |
106
+ | `baseUrls` | `Array<string \| WeightedBaseUrl>` | Optional ordered fallback origin list |
107
+ | `stripePublishableKey` | `string` | Stripe publishable key override |
108
+ | `termsText` | `string` | Terms text override |
109
+ | `waiverText` | `string` | Waiver text override |
110
+ | `showWaiver` | `boolean` | Show waiver checkbox |
111
+ | `showTerms` | `boolean` | Show terms checkbox |
112
+ | `showRemainingSpots` | `boolean` | Show remaining capacity labels |
113
+ | `depositPercent` | `number` | Percent charged upfront |
114
+
115
+ ## Styling and customization
116
+
117
+ Import the stylesheet once:
118
+
119
+ ```tsx
120
+ import "@resira/ui/styles.css";
121
+ ```
122
+
123
+ The main customization layers are:
124
+
125
+ - `theme` tokens on `ResiraProvider`
126
+ - CSS custom properties under `.resira-root`
127
+ - `classNames` and `renderServiceCard` for deeper control
128
+
129
+ For more styling details, see [CUSTOMIZATION.md](./CUSTOMIZATION.md).
130
+
131
+ ## Payment and remote config
132
+
133
+ The provider loads public configuration such as:
134
+
135
+ - Stripe publishable key
136
+ - deposit percentage
137
+ - terms requirements
138
+ - refund policy
139
+
140
+ You can override those values locally through `config` when needed.
141
+
142
+ ## Hooks and components
143
+
144
+ Main exports:
145
+
146
+ - `ResiraProvider`
147
+ - `useResira`
148
+ - `ResiraBookingWidget`
149
+ - `BookingModal`
150
+ - `BookingCalendar`
151
+ - `TimeSlotPicker`
152
+ - `ResourcePicker`
153
+ - `ProductSelector`
154
+ - `GuestForm`
155
+ - `validateGuestForm`
156
+ - `WaiverConsent`
157
+ - `PaymentForm`
158
+ - `SummaryPreview`
159
+ - `ConfirmationView`
160
+ - `useAvailability`
161
+ - `useReservation`
162
+ - `useResources`
163
+ - `useProducts`
164
+ - `usePaymentIntent`
165
+ - `DishShowcase`
166
+ - `useDish`
167
+ - `useDishes`
168
+
169
+ ## DishShowcase
170
+
171
+ The `DishShowcase` component renders a trigger button that opens a nested modal for browsing dishes with 3D model previews and AR viewing. It uses `<model-viewer>` for the 3D experience.
172
+
173
+ ### Prerequisites
174
+
175
+ Load the `<model-viewer>` web component in your page:
176
+
177
+ ```html
178
+ <script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0/model-viewer.min.js"></script>
179
+ ```
180
+
181
+ ### Single dish (by ID)
182
+
183
+ The `dishId` is shown on the dish page in the admin dashboard for easy copying.
184
+
185
+ ```tsx
186
+ import { DishShowcase } from "@resira/ui";
187
+
188
+ <DishShowcase dishId="dish-uuid">
189
+ View in 3D
190
+ </DishShowcase>
191
+ ```
192
+
193
+ ### Browse all dishes
194
+
195
+ ```tsx
196
+ <DishShowcase showAll>
197
+ Explore Our Menu
198
+ </DishShowcase>
199
+ ```
200
+
201
+ ### Filter by category
202
+
203
+ ```tsx
204
+ <DishShowcase showAll category="Main">
205
+ View Main Courses
206
+ </DishShowcase>
207
+ ```
208
+
209
+ ### Props
210
+
211
+ | Prop | Type | Default | Description |
212
+ | --- | --- | --- | --- |
213
+ | `dishId` | `string` | — | Single dish ID, opens directly to 3D viewer |
214
+ | `showAll` | `boolean` | `false` | Show all dishes in a browsable grid |
215
+ | `category` | `string` | — | Filter dishes by category |
216
+ | `className` | `string` | — | Custom CSS class on the trigger button |
217
+ | `style` | `CSSProperties` | — | Custom inline styles on the trigger button |
218
+ | `children` | `ReactNode` | required | Button label / content |
219
+
220
+ ### Inside a BookingModal
221
+
222
+ `DishShowcase` works as a nested modal — it renders above the booking modal with its own overlay and focus trap:
223
+
224
+ ```tsx
225
+ <BookingModal apiKey="resira_live_..." domain="restaurant">
226
+ <DishShowcase dishId="dish-uuid" style={{ marginBottom: 12 }}>
227
+ Preview this dish in 3D
228
+ </DishShowcase>
229
+ </BookingModal>
230
+ ```
231
+
232
+ ## Notes
233
+
234
+ - The widget supports catalog mode when `resourceId` is omitted.
235
+ - Service and watersport flows group services by linked equipment category by default.
236
+ - Loading and error states now announce themselves to assistive technologies on the main widget surfaces.
237
+ - Client-side API origin stickiness/load-balancing has been removed; routing is deterministic unless you pass explicit fallback origins.
238
+ - The package is intended for browser usage and ships CSS separately via `@resira/ui/styles.css`.
package/dist/index.cjs CHANGED
@@ -381,7 +381,7 @@ function useReservation() {
381
381
  const [error, setError] = react.useState(null);
382
382
  const submit = react.useCallback(
383
383
  async (data) => {
384
- if (!data.resourceId) {
384
+ if (!data.resourceId && !data.checkoutSessionToken) {
385
385
  setError("No resource selected");
386
386
  return null;
387
387
  }
@@ -1896,18 +1896,28 @@ function groupProductsByCategory(products, resources) {
1896
1896
  );
1897
1897
  const groups = /* @__PURE__ */ new Map();
1898
1898
  products.forEach((product) => {
1899
- let categoryResource;
1900
- const categoryType = product.equipmentIds.map((equipmentId) => {
1901
- const res = resourceById.get(equipmentId);
1902
- if (res?.resourceType?.trim() && !categoryResource) {
1903
- categoryResource = res;
1904
- }
1905
- return res?.resourceType?.trim();
1906
- }).find((resourceType) => Boolean(resourceType));
1907
- const groupId = categoryType?.toLowerCase() ?? UNCATEGORIZED_CATEGORY_KEY;
1908
- const label = categoryType ? formatCategoryLabel(categoryType) : UNCATEGORIZED_CATEGORY_LABEL;
1899
+ const productCategory = product.category?.trim();
1900
+ let groupId;
1901
+ let label;
1902
+ let catImage;
1903
+ if (productCategory) {
1904
+ groupId = productCategory.toLowerCase();
1905
+ label = product.categoryName?.trim() ? product.categoryName.trim() : formatCategoryLabel(productCategory);
1906
+ catImage = product.categoryImage ?? void 0;
1907
+ } else {
1908
+ let categoryResource;
1909
+ const categoryType = product.equipmentIds.map((equipmentId) => {
1910
+ const res = resourceById.get(equipmentId);
1911
+ if (res?.resourceType?.trim() && !categoryResource) {
1912
+ categoryResource = res;
1913
+ }
1914
+ return res?.resourceType?.trim();
1915
+ }).find((resourceType) => Boolean(resourceType));
1916
+ groupId = categoryType?.toLowerCase() ?? UNCATEGORIZED_CATEGORY_KEY;
1917
+ label = categoryType ? formatCategoryLabel(categoryType) : UNCATEGORIZED_CATEGORY_LABEL;
1918
+ catImage = categoryResource?.images?.[0]?.url ?? categoryResource?.imageUrl ?? void 0;
1919
+ }
1909
1920
  if (!groups.has(groupId)) {
1910
- const catImage = categoryResource?.images?.[0]?.url ?? categoryResource?.imageUrl ?? void 0;
1911
1921
  groups.set(groupId, {
1912
1922
  id: groupId,
1913
1923
  label,
@@ -1917,8 +1927,16 @@ function groupProductsByCategory(products, resources) {
1917
1927
  }
1918
1928
  const group = groups.get(groupId);
1919
1929
  group.products.push(product);
1920
- if (!group.imageUrl && categoryResource) {
1921
- group.imageUrl = categoryResource.images?.[0]?.url ?? categoryResource.imageUrl;
1930
+ if (!group.imageUrl) {
1931
+ if (catImage) {
1932
+ group.imageUrl = catImage;
1933
+ } else {
1934
+ const coverImage = product.images?.[0];
1935
+ const firstImage = (coverImage?.showInCategoryHeader !== false ? coverImage?.url : void 0) ?? product.imageUrl;
1936
+ if (firstImage) {
1937
+ group.imageUrl = firstImage;
1938
+ }
1939
+ }
1922
1940
  }
1923
1941
  });
1924
1942
  return Array.from(groups.values());
@@ -3081,9 +3099,10 @@ function ResiraBookingWidget() {
3081
3099
  guestPhone: guest.guestPhone.trim() || void 0,
3082
3100
  notes: guest.notes.trim() || void 0,
3083
3101
  promoCode: discountCode.trim() || void 0,
3084
- termsAccepted: termsAccepted || void 0
3102
+ termsAccepted: termsAccepted || void 0,
3103
+ waiverAccepted: waiverAccepted || void 0
3085
3104
  };
3086
- }, [activeResourceId, selectedProduct, selection, guest, discountCode, termsAccepted, isCheckoutMode, checkoutSession, checkoutSessionToken]);
3105
+ }, [activeResourceId, selectedProduct, selection, guest, discountCode, termsAccepted, waiverAccepted, isCheckoutMode, checkoutSession, checkoutSessionToken]);
3087
3106
  const blockedDates = react.useMemo(() => {
3088
3107
  const dates = calendarData?.dates?.blockedDates ?? availability?.dates?.blockedDates ?? [];
3089
3108
  return new Set(dates);
@@ -3314,7 +3333,9 @@ function ResiraBookingWidget() {
3314
3333
  startTime: selection.startTime,
3315
3334
  endTime: selection.endTime,
3316
3335
  partySize: selection.partySize,
3317
- notes: guest.notes.trim() || void 0
3336
+ notes: guest.notes.trim() || void 0,
3337
+ termsAccepted: termsAccepted || void 0,
3338
+ waiverAccepted: waiverAccepted || void 0
3318
3339
  };
3319
3340
  const result = await submit(payload);
3320
3341
  if (result) {
@@ -3364,6 +3385,10 @@ function ResiraBookingWidget() {
3364
3385
  setTermsError(locale.termsRequired);
3365
3386
  return;
3366
3387
  }
3388
+ if (showWaiver && !waiverAccepted) {
3389
+ setTermsError(locale.termsRequired);
3390
+ return;
3391
+ }
3367
3392
  setTermsError(null);
3368
3393
  const result = await createPayment(paymentPayload);
3369
3394
  if (!result) return;
@@ -3388,7 +3413,8 @@ function ResiraBookingWidget() {
3388
3413
  }
3389
3414
  const resourceId = activeResourceId ?? selectedProduct?.equipmentIds?.[0] ?? "";
3390
3415
  const payload = {
3391
- resourceId,
3416
+ resourceId: isCheckoutMode ? void 0 : resourceId,
3417
+ checkoutSessionToken: isCheckoutMode ? checkoutSessionToken : void 0,
3392
3418
  guestName: guest.guestName.trim(),
3393
3419
  guestEmail: guest.guestEmail.trim() || void 0,
3394
3420
  guestPhone: guest.guestPhone.trim() || void 0,
@@ -3397,7 +3423,9 @@ function ResiraBookingWidget() {
3397
3423
  startTime: selection.startTime,
3398
3424
  endTime: selection.endTime,
3399
3425
  partySize: selection.partySize,
3400
- notes: guest.notes.trim() || void 0
3426
+ notes: guest.notes.trim() || void 0,
3427
+ termsAccepted: termsAccepted || void 0,
3428
+ waiverAccepted: waiverAccepted || void 0
3401
3429
  };
3402
3430
  const result = await submit(payload);
3403
3431
  if (result) {