@cimplify/sdk 0.45.0 → 0.45.2
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/dist/advanced.d.mts +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/{chunk-W72W6M6M.mjs → chunk-EMEUSFSR.mjs} +32 -12
- package/dist/{chunk-GCSZYC5C.js → chunk-F4CGIOIJ.js} +32 -12
- package/dist/{chunk-T4E4R4YG.js → chunk-JNXCY43J.js} +2 -2
- package/dist/{chunk-D3TVW7JP.mjs → chunk-YVIIBCJR.mjs} +1 -1
- package/dist/{client-5B9IPDmf.d.ts → client-Bsd4Vi_y.d.ts} +1 -0
- package/dist/{client-CpVMRI8V.d.mts → client-C5LcbNxL.d.mts} +1 -0
- package/dist/{client-DMhRxuzm.d.ts → client-DjzIoewX.d.ts} +1 -1
- package/dist/{client-Cwb1sMr3.d.mts → client-EM8xKCPO.d.mts} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/mock/cli.mjs +32 -12
- package/dist/mock/library.js +32 -12
- package/dist/mock/library.mjs +32 -12
- package/dist/mock/msw.js +32 -12
- package/dist/mock/msw.mjs +32 -12
- package/dist/react.d.mts +120 -45
- package/dist/react.d.ts +120 -45
- package/dist/react.js +453 -97
- package/dist/react.mjs +452 -98
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/styles.css +2 -2
- package/dist/testing/msw.js +2 -2
- package/dist/testing/msw.mjs +1 -1
- package/dist/testing/suite.d.mts +2 -2
- package/dist/testing/suite.d.ts +2 -2
- package/dist/testing/suite.js +21 -21
- package/dist/testing/suite.mjs +2 -2
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +77 -77
- package/dist/testing.mjs +3 -3
- package/package.json +1 -1
- package/registry/booking-page.json +19 -0
- package/registry/bookings-page.json +17 -0
- package/registry/index.json +24 -0
package/dist/testing.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJNXCY43J_js = require('./chunk-JNXCY43J.js');
|
|
4
4
|
require('./chunk-LLZZMHSU.js');
|
|
5
5
|
require('./chunk-GVLWRI5I.js');
|
|
6
6
|
require('./chunk-BN2CXGMO.js');
|
|
7
|
-
require('./chunk-
|
|
7
|
+
require('./chunk-F4CGIOIJ.js');
|
|
8
8
|
require('./chunk-QBQCMQ4F.js');
|
|
9
9
|
var zod = require('zod');
|
|
10
10
|
|
|
11
11
|
var PUBLIC_SCHEMAS = {
|
|
12
|
-
Brand:
|
|
13
|
-
AddItemPayload:
|
|
14
|
-
Cart:
|
|
15
|
-
CartItem:
|
|
16
|
-
CartPricing:
|
|
17
|
-
CheckoutBody:
|
|
18
|
-
CheckoutResponse:
|
|
19
|
-
VariantInfo:
|
|
12
|
+
Brand: chunkJNXCY43J_js.BrandSchema,
|
|
13
|
+
AddItemPayload: chunkJNXCY43J_js.AddItemPayloadSchema,
|
|
14
|
+
Cart: chunkJNXCY43J_js.CartSchema,
|
|
15
|
+
CartItem: chunkJNXCY43J_js.CartItemSchema,
|
|
16
|
+
CartPricing: chunkJNXCY43J_js.CartPricingSchema,
|
|
17
|
+
CheckoutBody: chunkJNXCY43J_js.CheckoutBodySchema,
|
|
18
|
+
CheckoutResponse: chunkJNXCY43J_js.CheckoutResponseSchema,
|
|
19
|
+
VariantInfo: chunkJNXCY43J_js.VariantInfoSchema
|
|
20
20
|
};
|
|
21
21
|
function exportJsonSchemas() {
|
|
22
22
|
const out = {};
|
|
23
23
|
for (const [name, schema] of Object.entries(PUBLIC_SCHEMAS)) {
|
|
24
|
-
const meta =
|
|
25
|
-
const json = zod.z.toJSONSchema(schema, { metadata:
|
|
24
|
+
const meta = chunkJNXCY43J_js.cimplifyRegistry.get(schema);
|
|
25
|
+
const json = zod.z.toJSONSchema(schema, { metadata: chunkJNXCY43J_js.cimplifyRegistry });
|
|
26
26
|
if (meta) {
|
|
27
27
|
json.$id = meta.id;
|
|
28
28
|
json["x-cimplify-version"] = meta.version;
|
|
@@ -34,16 +34,16 @@ function exportJsonSchemas() {
|
|
|
34
34
|
function listRegisteredSchemas() {
|
|
35
35
|
const entries = [];
|
|
36
36
|
for (const schema of [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
chunkJNXCY43J_js.BrandSchema,
|
|
38
|
+
chunkJNXCY43J_js.AddItemPayloadSchema,
|
|
39
|
+
chunkJNXCY43J_js.CartSchema,
|
|
40
|
+
chunkJNXCY43J_js.CartItemSchema,
|
|
41
|
+
chunkJNXCY43J_js.CartPricingSchema,
|
|
42
|
+
chunkJNXCY43J_js.CheckoutBodySchema,
|
|
43
|
+
chunkJNXCY43J_js.CheckoutResponseSchema,
|
|
44
|
+
chunkJNXCY43J_js.VariantInfoSchema
|
|
45
45
|
]) {
|
|
46
|
-
const meta =
|
|
46
|
+
const meta = chunkJNXCY43J_js.cimplifyRegistry.get(schema);
|
|
47
47
|
if (meta) entries.push({ schema, meta });
|
|
48
48
|
}
|
|
49
49
|
return entries;
|
|
@@ -51,227 +51,227 @@ function listRegisteredSchemas() {
|
|
|
51
51
|
|
|
52
52
|
Object.defineProperty(exports, "AddItemPayloadSchema", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunkJNXCY43J_js.AddItemPayloadSchema; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "AddOnDetailsSchema", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunkJNXCY43J_js.AddOnDetailsSchema; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "AddOnGroupDetailsSchema", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunkJNXCY43J_js.AddOnGroupDetailsSchema; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "AddOnInDetailsSchema", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunkJNXCY43J_js.AddOnInDetailsSchema; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "AddOnOptionDetailsSchema", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunkJNXCY43J_js.AddOnOptionDetailsSchema; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "AuthorizationTypeSchema", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkJNXCY43J_js.AuthorizationTypeSchema; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "BrandContactSchema", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunkJNXCY43J_js.BrandContactSchema; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "BrandFaqSchema", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunkJNXCY43J_js.BrandFaqSchema; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "BrandHeroSchema", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunkJNXCY43J_js.BrandHeroSchema; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "BrandNavLinkSchema", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunkJNXCY43J_js.BrandNavLinkSchema; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "BrandPolicyPageSchema", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunkJNXCY43J_js.BrandPolicyPageSchema; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "BrandPolicySectionSchema", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunkJNXCY43J_js.BrandPolicySectionSchema; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "BrandSchema", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunkJNXCY43J_js.BrandSchema; }
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "BrandSocialSchema", {
|
|
105
105
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
106
|
+
get: function () { return chunkJNXCY43J_js.BrandSocialSchema; }
|
|
107
107
|
});
|
|
108
108
|
Object.defineProperty(exports, "BundleResolvedSchema", {
|
|
109
109
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
110
|
+
get: function () { return chunkJNXCY43J_js.BundleResolvedSchema; }
|
|
111
111
|
});
|
|
112
112
|
Object.defineProperty(exports, "BundleSelectionInputSchema", {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunkJNXCY43J_js.BundleSelectionInputSchema; }
|
|
115
115
|
});
|
|
116
116
|
Object.defineProperty(exports, "CartItemSchema", {
|
|
117
117
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
118
|
+
get: function () { return chunkJNXCY43J_js.CartItemSchema; }
|
|
119
119
|
});
|
|
120
120
|
Object.defineProperty(exports, "CartPricingSchema", {
|
|
121
121
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunkJNXCY43J_js.CartPricingSchema; }
|
|
123
123
|
});
|
|
124
124
|
Object.defineProperty(exports, "CartSchema", {
|
|
125
125
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
126
|
+
get: function () { return chunkJNXCY43J_js.CartSchema; }
|
|
127
127
|
});
|
|
128
128
|
Object.defineProperty(exports, "CheckoutBodySchema", {
|
|
129
129
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
130
|
+
get: function () { return chunkJNXCY43J_js.CheckoutBodySchema; }
|
|
131
131
|
});
|
|
132
132
|
Object.defineProperty(exports, "CheckoutCustomerSchema", {
|
|
133
133
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
134
|
+
get: function () { return chunkJNXCY43J_js.CheckoutCustomerSchema; }
|
|
135
135
|
});
|
|
136
136
|
Object.defineProperty(exports, "CheckoutResponseSchema", {
|
|
137
137
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
138
|
+
get: function () { return chunkJNXCY43J_js.CheckoutResponseSchema; }
|
|
139
139
|
});
|
|
140
140
|
Object.defineProperty(exports, "ChosenPriceSchema", {
|
|
141
141
|
enumerable: true,
|
|
142
|
-
get: function () { return
|
|
142
|
+
get: function () { return chunkJNXCY43J_js.ChosenPriceSchema; }
|
|
143
143
|
});
|
|
144
144
|
Object.defineProperty(exports, "CompositeResolvedSchema", {
|
|
145
145
|
enumerable: true,
|
|
146
|
-
get: function () { return
|
|
146
|
+
get: function () { return chunkJNXCY43J_js.CompositeResolvedSchema; }
|
|
147
147
|
});
|
|
148
148
|
Object.defineProperty(exports, "CompositeSelectionInputSchema", {
|
|
149
149
|
enumerable: true,
|
|
150
|
-
get: function () { return
|
|
150
|
+
get: function () { return chunkJNXCY43J_js.CompositeSelectionInputSchema; }
|
|
151
151
|
});
|
|
152
152
|
Object.defineProperty(exports, "CountryCodeSchema", {
|
|
153
153
|
enumerable: true,
|
|
154
|
-
get: function () { return
|
|
154
|
+
get: function () { return chunkJNXCY43J_js.CountryCodeSchema; }
|
|
155
155
|
});
|
|
156
156
|
Object.defineProperty(exports, "CurrencyCodeSchema", {
|
|
157
157
|
enumerable: true,
|
|
158
|
-
get: function () { return
|
|
158
|
+
get: function () { return chunkJNXCY43J_js.CurrencyCodeSchema; }
|
|
159
159
|
});
|
|
160
160
|
Object.defineProperty(exports, "CustomerInputValueSchema", {
|
|
161
161
|
enumerable: true,
|
|
162
|
-
get: function () { return
|
|
162
|
+
get: function () { return chunkJNXCY43J_js.CustomerInputValueSchema; }
|
|
163
163
|
});
|
|
164
164
|
Object.defineProperty(exports, "DiscountDetailsSchema", {
|
|
165
165
|
enumerable: true,
|
|
166
|
-
get: function () { return
|
|
166
|
+
get: function () { return chunkJNXCY43J_js.DiscountDetailsSchema; }
|
|
167
167
|
});
|
|
168
168
|
Object.defineProperty(exports, "IsoDateTimeSchema", {
|
|
169
169
|
enumerable: true,
|
|
170
|
-
get: function () { return
|
|
170
|
+
get: function () { return chunkJNXCY43J_js.IsoDateTimeSchema; }
|
|
171
171
|
});
|
|
172
172
|
Object.defineProperty(exports, "LineTypeSchema", {
|
|
173
173
|
enumerable: true,
|
|
174
|
-
get: function () { return
|
|
174
|
+
get: function () { return chunkJNXCY43J_js.LineTypeSchema; }
|
|
175
175
|
});
|
|
176
176
|
Object.defineProperty(exports, "LocaleSchema", {
|
|
177
177
|
enumerable: true,
|
|
178
|
-
get: function () { return
|
|
178
|
+
get: function () { return chunkJNXCY43J_js.LocaleSchema; }
|
|
179
179
|
});
|
|
180
180
|
Object.defineProperty(exports, "MoneyLooseSchema", {
|
|
181
181
|
enumerable: true,
|
|
182
|
-
get: function () { return
|
|
182
|
+
get: function () { return chunkJNXCY43J_js.MoneyLooseSchema; }
|
|
183
183
|
});
|
|
184
184
|
Object.defineProperty(exports, "MoneySchema", {
|
|
185
185
|
enumerable: true,
|
|
186
|
-
get: function () { return
|
|
186
|
+
get: function () { return chunkJNXCY43J_js.MoneySchema; }
|
|
187
187
|
});
|
|
188
188
|
Object.defineProperty(exports, "NextActionSchema", {
|
|
189
189
|
enumerable: true,
|
|
190
|
-
get: function () { return
|
|
190
|
+
get: function () { return chunkJNXCY43J_js.NextActionSchema; }
|
|
191
191
|
});
|
|
192
192
|
Object.defineProperty(exports, "PhoneE164Schema", {
|
|
193
193
|
enumerable: true,
|
|
194
|
-
get: function () { return
|
|
194
|
+
get: function () { return chunkJNXCY43J_js.PhoneE164Schema; }
|
|
195
195
|
});
|
|
196
196
|
Object.defineProperty(exports, "ProductTypeSchema", {
|
|
197
197
|
enumerable: true,
|
|
198
|
-
get: function () { return
|
|
198
|
+
get: function () { return chunkJNXCY43J_js.ProductTypeSchema; }
|
|
199
199
|
});
|
|
200
200
|
Object.defineProperty(exports, "SchemaViolationError", {
|
|
201
201
|
enumerable: true,
|
|
202
|
-
get: function () { return
|
|
202
|
+
get: function () { return chunkJNXCY43J_js.SchemaViolationError; }
|
|
203
203
|
});
|
|
204
204
|
Object.defineProperty(exports, "SeedNameSchema", {
|
|
205
205
|
enumerable: true,
|
|
206
|
-
get: function () { return
|
|
206
|
+
get: function () { return chunkJNXCY43J_js.SeedNameSchema; }
|
|
207
207
|
});
|
|
208
208
|
Object.defineProperty(exports, "SelectedAddOnOptionSchema", {
|
|
209
209
|
enumerable: true,
|
|
210
|
-
get: function () { return
|
|
210
|
+
get: function () { return chunkJNXCY43J_js.SelectedAddOnOptionSchema; }
|
|
211
211
|
});
|
|
212
212
|
Object.defineProperty(exports, "ServiceStatusSchema", {
|
|
213
213
|
enumerable: true,
|
|
214
|
-
get: function () { return
|
|
214
|
+
get: function () { return chunkJNXCY43J_js.ServiceStatusSchema; }
|
|
215
215
|
});
|
|
216
216
|
Object.defineProperty(exports, "TimestampSchema", {
|
|
217
217
|
enumerable: true,
|
|
218
|
-
get: function () { return
|
|
218
|
+
get: function () { return chunkJNXCY43J_js.TimestampSchema; }
|
|
219
219
|
});
|
|
220
220
|
Object.defineProperty(exports, "VariantDetailsSchema", {
|
|
221
221
|
enumerable: true,
|
|
222
|
-
get: function () { return
|
|
222
|
+
get: function () { return chunkJNXCY43J_js.VariantDetailsSchema; }
|
|
223
223
|
});
|
|
224
224
|
Object.defineProperty(exports, "VariantDisplayAttributeSchema", {
|
|
225
225
|
enumerable: true,
|
|
226
|
-
get: function () { return
|
|
226
|
+
get: function () { return chunkJNXCY43J_js.VariantDisplayAttributeSchema; }
|
|
227
227
|
});
|
|
228
228
|
Object.defineProperty(exports, "VariantInfoSchema", {
|
|
229
229
|
enumerable: true,
|
|
230
|
-
get: function () { return
|
|
230
|
+
get: function () { return chunkJNXCY43J_js.VariantInfoSchema; }
|
|
231
231
|
});
|
|
232
232
|
Object.defineProperty(exports, "assertAddItemPayload", {
|
|
233
233
|
enumerable: true,
|
|
234
|
-
get: function () { return
|
|
234
|
+
get: function () { return chunkJNXCY43J_js.assertAddItemPayload; }
|
|
235
235
|
});
|
|
236
236
|
Object.defineProperty(exports, "assertBrand", {
|
|
237
237
|
enumerable: true,
|
|
238
|
-
get: function () { return
|
|
238
|
+
get: function () { return chunkJNXCY43J_js.assertBrand; }
|
|
239
239
|
});
|
|
240
240
|
Object.defineProperty(exports, "assertCart", {
|
|
241
241
|
enumerable: true,
|
|
242
|
-
get: function () { return
|
|
242
|
+
get: function () { return chunkJNXCY43J_js.assertCart; }
|
|
243
243
|
});
|
|
244
244
|
Object.defineProperty(exports, "assertCartItem", {
|
|
245
245
|
enumerable: true,
|
|
246
|
-
get: function () { return
|
|
246
|
+
get: function () { return chunkJNXCY43J_js.assertCartItem; }
|
|
247
247
|
});
|
|
248
248
|
Object.defineProperty(exports, "assertCheckoutBody", {
|
|
249
249
|
enumerable: true,
|
|
250
|
-
get: function () { return
|
|
250
|
+
get: function () { return chunkJNXCY43J_js.assertCheckoutBody; }
|
|
251
251
|
});
|
|
252
252
|
Object.defineProperty(exports, "assertCheckoutResponse", {
|
|
253
253
|
enumerable: true,
|
|
254
|
-
get: function () { return
|
|
254
|
+
get: function () { return chunkJNXCY43J_js.assertCheckoutResponse; }
|
|
255
255
|
});
|
|
256
256
|
Object.defineProperty(exports, "cimplifyRegistry", {
|
|
257
257
|
enumerable: true,
|
|
258
|
-
get: function () { return
|
|
258
|
+
get: function () { return chunkJNXCY43J_js.cimplifyRegistry; }
|
|
259
259
|
});
|
|
260
260
|
Object.defineProperty(exports, "createTestClient", {
|
|
261
261
|
enumerable: true,
|
|
262
|
-
get: function () { return
|
|
262
|
+
get: function () { return chunkJNXCY43J_js.createTestClient; }
|
|
263
263
|
});
|
|
264
264
|
Object.defineProperty(exports, "fixtures", {
|
|
265
265
|
enumerable: true,
|
|
266
|
-
get: function () { return
|
|
266
|
+
get: function () { return chunkJNXCY43J_js.fixtures; }
|
|
267
267
|
});
|
|
268
268
|
Object.defineProperty(exports, "makeAssertion", {
|
|
269
269
|
enumerable: true,
|
|
270
|
-
get: function () { return
|
|
270
|
+
get: function () { return chunkJNXCY43J_js.makeAssertion; }
|
|
271
271
|
});
|
|
272
272
|
Object.defineProperty(exports, "registerSchema", {
|
|
273
273
|
enumerable: true,
|
|
274
|
-
get: function () { return
|
|
274
|
+
get: function () { return chunkJNXCY43J_js.registerSchema; }
|
|
275
275
|
});
|
|
276
276
|
exports.exportJsonSchemas = exportJsonSchemas;
|
|
277
277
|
exports.listRegisteredSchemas = listRegisteredSchemas;
|
package/dist/testing.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { VariantInfoSchema, CheckoutResponseSchema, CheckoutBodySchema, CartPricingSchema, CartItemSchema, CartSchema, AddItemPayloadSchema, BrandSchema, cimplifyRegistry } from './chunk-
|
|
2
|
-
export { AddItemPayloadSchema, AddOnDetailsSchema, AddOnGroupDetailsSchema, AddOnInDetailsSchema, AddOnOptionDetailsSchema, AuthorizationTypeSchema, BrandContactSchema, BrandFaqSchema, BrandHeroSchema, BrandNavLinkSchema, BrandPolicyPageSchema, BrandPolicySectionSchema, BrandSchema, BrandSocialSchema, BundleResolvedSchema, BundleSelectionInputSchema, CartItemSchema, CartPricingSchema, CartSchema, CheckoutBodySchema, CheckoutCustomerSchema, CheckoutResponseSchema, ChosenPriceSchema, CompositeResolvedSchema, CompositeSelectionInputSchema, CountryCodeSchema, CurrencyCodeSchema, CustomerInputValueSchema, DiscountDetailsSchema, IsoDateTimeSchema, LineTypeSchema, LocaleSchema, MoneyLooseSchema, MoneySchema, NextActionSchema, PhoneE164Schema, ProductTypeSchema, SchemaViolationError, SeedNameSchema, SelectedAddOnOptionSchema, ServiceStatusSchema, TimestampSchema, VariantDetailsSchema, VariantDisplayAttributeSchema, VariantInfoSchema, assertAddItemPayload, assertBrand, assertCart, assertCartItem, assertCheckoutBody, assertCheckoutResponse, cimplifyRegistry, createTestClient, fixtures, makeAssertion, registerSchema } from './chunk-
|
|
1
|
+
import { VariantInfoSchema, CheckoutResponseSchema, CheckoutBodySchema, CartPricingSchema, CartItemSchema, CartSchema, AddItemPayloadSchema, BrandSchema, cimplifyRegistry } from './chunk-YVIIBCJR.mjs';
|
|
2
|
+
export { AddItemPayloadSchema, AddOnDetailsSchema, AddOnGroupDetailsSchema, AddOnInDetailsSchema, AddOnOptionDetailsSchema, AuthorizationTypeSchema, BrandContactSchema, BrandFaqSchema, BrandHeroSchema, BrandNavLinkSchema, BrandPolicyPageSchema, BrandPolicySectionSchema, BrandSchema, BrandSocialSchema, BundleResolvedSchema, BundleSelectionInputSchema, CartItemSchema, CartPricingSchema, CartSchema, CheckoutBodySchema, CheckoutCustomerSchema, CheckoutResponseSchema, ChosenPriceSchema, CompositeResolvedSchema, CompositeSelectionInputSchema, CountryCodeSchema, CurrencyCodeSchema, CustomerInputValueSchema, DiscountDetailsSchema, IsoDateTimeSchema, LineTypeSchema, LocaleSchema, MoneyLooseSchema, MoneySchema, NextActionSchema, PhoneE164Schema, ProductTypeSchema, SchemaViolationError, SeedNameSchema, SelectedAddOnOptionSchema, ServiceStatusSchema, TimestampSchema, VariantDetailsSchema, VariantDisplayAttributeSchema, VariantInfoSchema, assertAddItemPayload, assertBrand, assertCart, assertCartItem, assertCheckoutBody, assertCheckoutResponse, cimplifyRegistry, createTestClient, fixtures, makeAssertion, registerSchema } from './chunk-YVIIBCJR.mjs';
|
|
3
3
|
import './chunk-RR3ZJQW5.mjs';
|
|
4
4
|
import './chunk-AIXUFSA6.mjs';
|
|
5
5
|
import './chunk-NRT6PVW5.mjs';
|
|
6
|
-
import './chunk-
|
|
6
|
+
import './chunk-EMEUSFSR.mjs';
|
|
7
7
|
import './chunk-XPXAZXF2.mjs';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "booking-page",
|
|
3
|
+
"title": "BookingPage",
|
|
4
|
+
"description": "Multi-step booking flow: service, staff, resource, date/slot, confirmation.",
|
|
5
|
+
"type": "component",
|
|
6
|
+
"registryDependencies": [
|
|
7
|
+
"date-slot-picker",
|
|
8
|
+
"staff-picker",
|
|
9
|
+
"resource-picker",
|
|
10
|
+
"price",
|
|
11
|
+
"cn"
|
|
12
|
+
],
|
|
13
|
+
"files": [
|
|
14
|
+
{
|
|
15
|
+
"path": "booking-page.tsx",
|
|
16
|
+
"content": "\"use client\";\n\nimport React, { useState, useCallback } from \"react\";\nimport type { Product } from \"@cimplify/sdk\";\nimport type { Service, Staff, AvailableSlot, CustomerBooking } from \"@cimplify/sdk\";\nimport type { Resource } from \"./resource-picker\";\nimport { useCart } from \"@cimplify/sdk/react\";\nimport { useCimplifyClient } from \"@cimplify/sdk/react\";\nimport { DateSlotPicker } from \"@cimplify/sdk/react\";\nimport { StaffPicker } from \"@cimplify/sdk/react\";\nimport { ResourcePicker } from \"./resource-picker\";\nimport { Price } from \"@cimplify/sdk/react\";\nimport { cn } from \"@cimplify/sdk/react\";\nimport { formatDuration } from \"./utils/format-duration\";\nimport { parsePrice } from \"@cimplify/sdk\";\n\nexport interface BookingPageClassNames {\n root?: string;\n header?: string;\n title?: string;\n serviceInfo?: string;\n step?: string;\n stepTitle?: string;\n summary?: string;\n summaryRow?: string;\n confirmButton?: string;\n backButton?: string;\n error?: string;\n rescheduleInfo?: string;\n depositInfo?: string;\n cancellationPolicy?: string;\n resourceStep?: string;\n}\n\nexport interface BookingPageProps {\n /** The service being booked. */\n service: Service;\n /** The underlying product (for deposit/cancellation fields). Falls back to service fields. */\n product?: Product;\n /** Optional staff list for staff selection step. */\n staff?: Staff[];\n /** Optional resources for resource selection step (rooms, equipment, etc.). */\n resources?: Resource[];\n /** Number of participants. */\n participantCount?: number;\n /** Page title. */\n title?: string;\n /** Called after successfully adding to cart. */\n onBooked?: (slot: AvailableSlot, staffId: string | null) => void;\n /** Called when user wants to go back. */\n onBack?: () => void;\n /** Existing booking for reschedule mode. */\n existingBooking?: CustomerBooking;\n /** Called after a successful reschedule. */\n onRescheduled?: (booking: CustomerBooking, newSlot: AvailableSlot) => void;\n /** Show price on slots. Default: true. */\n showPrice?: boolean;\n className?: string;\n classNames?: BookingPageClassNames;\n}\n\nconst STEP = {\n SELECT_SLOT: \"select-slot\",\n SELECT_RESOURCE: \"select-resource\",\n SELECT_STAFF: \"select-staff\",\n CONFIRM: \"confirm\",\n} as const;\n\ntype BookingStep = (typeof STEP)[keyof typeof STEP];\n\nexport function BookingPage({\n service,\n product,\n staff,\n resources,\n participantCount,\n title,\n onBooked,\n onBack,\n existingBooking,\n onRescheduled,\n showPrice = true,\n className,\n classNames,\n}: BookingPageProps): React.ReactElement {\n const { addItem } = useCart();\n const { client } = useCimplifyClient();\n\n const isReschedule = existingBooking !== undefined;\n\n const [step, setStep] = useState<BookingStep>(STEP.SELECT_SLOT);\n const [selectedSlot, setSelectedSlot] = useState<AvailableSlot | null>(null);\n const [selectedDate, setSelectedDate] = useState<string | null>(null);\n const [selectedStaffId, setSelectedStaffId] = useState<string | null>(null);\n const [selectedResourceId, setSelectedResourceId] = useState<string | null>(null);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const hasResourceStep = resources && resources.length > 0;\n const hasStaffStep = staff && staff.length > 0;\n\n // Deposit info — prefer product fields, then fall back to service metadata\n const depositType = product?.deposit_type;\n const depositAmount = product?.deposit_amount;\n const hasDeposit = depositType !== undefined && depositType !== \"none\" && depositAmount !== undefined && parsePrice(depositAmount) !== 0;\n\n // Cancellation policy\n const cancellationMinutes = product?.cancellation_window_minutes;\n const noShowFee = product?.no_show_fee;\n\n const handleSlotSelect = useCallback(\n (slot: AvailableSlot, date: string) => {\n setSelectedSlot(slot);\n setSelectedDate(date);\n setError(null);\n if (hasResourceStep) {\n setStep(STEP.SELECT_RESOURCE);\n } else if (hasStaffStep) {\n setStep(STEP.SELECT_STAFF);\n } else {\n setStep(STEP.CONFIRM);\n }\n },\n [hasResourceStep, hasStaffStep],\n );\n\n const handleResourceSelect = useCallback(\n (resourceId: string | null) => {\n setSelectedResourceId(resourceId);\n if (hasStaffStep) {\n setStep(STEP.SELECT_STAFF);\n } else {\n setStep(STEP.CONFIRM);\n }\n },\n [hasStaffStep],\n );\n\n const handleStaffSelect = useCallback((staffId: string | null) => {\n setSelectedStaffId(staffId);\n setStep(STEP.CONFIRM);\n }, []);\n\n const handleBack = useCallback(() => {\n setError(null);\n if (step === STEP.CONFIRM && hasStaffStep) {\n setStep(STEP.SELECT_STAFF);\n } else if (step === STEP.CONFIRM && hasResourceStep) {\n setStep(STEP.SELECT_RESOURCE);\n } else if (step === STEP.SELECT_STAFF && hasResourceStep) {\n setStep(STEP.SELECT_RESOURCE);\n } else if (step === STEP.CONFIRM || step === STEP.SELECT_STAFF || step === STEP.SELECT_RESOURCE) {\n setStep(STEP.SELECT_SLOT);\n } else {\n onBack?.();\n }\n }, [step, hasStaffStep, hasResourceStep, onBack]);\n\n const handleConfirm = useCallback(async () => {\n if (!selectedSlot || !selectedDate) return;\n\n setIsSubmitting(true);\n setError(null);\n\n try {\n if (isReschedule && existingBooking) {\n // Reschedule mode — call the scheduling API instead of adding to cart\n const serviceItem = existingBooking.service_items[0];\n const result = await client.scheduling.rescheduleBooking({\n order_id: existingBooking.order_id,\n line_item_id: serviceItem?.service_id ?? existingBooking.order_id,\n new_start_time: selectedSlot.start_time,\n new_end_time: selectedSlot.end_time,\n new_staff_id: selectedStaffId || undefined,\n reschedule_type: \"customer\",\n });\n\n if (!result.ok) {\n throw result.error;\n }\n\n onRescheduled?.(existingBooking, selectedSlot);\n } else {\n // Normal booking mode — add to cart\n const serviceProduct = {\n id: service.product_id || service.id,\n business_id: service.business_id || \"\",\n category_id: service.category_id || undefined,\n name: service.name,\n slug: service.id,\n description: service.description || undefined,\n image_url: service.image_url || undefined,\n default_price: (service.price || \"0\") as Product[\"default_price\"],\n type: \"service\" as const,\n inventory_type: \"none\" as const,\n variant_strategy: \"fetch_all\" as const,\n is_active: service.is_available,\n created_at: new Date().toISOString(),\n updated_at: new Date().toISOString(),\n };\n\n await addItem(serviceProduct, 1, {\n scheduledStart: selectedSlot.start_time,\n scheduledEnd: selectedSlot.end_time,\n staffId: selectedStaffId || undefined,\n resourceId: selectedResourceId || undefined,\n });\n\n onBooked?.(selectedSlot, selectedStaffId);\n }\n } catch (err) {\n const fallbackMessage = isReschedule ? \"Failed to reschedule booking\" : \"Failed to add booking to cart\";\n setError(err instanceof Error ? err.message : fallbackMessage);\n } finally {\n setIsSubmitting(false);\n }\n }, [selectedSlot, selectedDate, selectedStaffId, service, addItem, onBooked, isReschedule, existingBooking, client, onRescheduled]);\n\n return (\n <div data-cimplify-booking-page className={cn(className, classNames?.root)}>\n <div data-cimplify-booking-page-header className={classNames?.header}>\n {onBack && step === STEP.SELECT_SLOT && (\n <button\n type=\"button\"\n onClick={onBack}\n data-cimplify-booking-page-back\n className={classNames?.backButton}\n >\n Back\n </button>\n )}\n {step !== STEP.SELECT_SLOT && (\n <button\n type=\"button\"\n onClick={handleBack}\n data-cimplify-booking-page-back\n className={classNames?.backButton}\n >\n Back\n </button>\n )}\n <h1 data-cimplify-booking-page-title className={classNames?.title}>\n {title || (isReschedule ? \"Reschedule Booking\" : `Book ${service.name}`)}\n </h1>\n </div>\n\n {isReschedule && existingBooking && (\n <div data-cimplify-booking-reschedule-info className={classNames?.rescheduleInfo}>\n <span>Rescheduling booking from {new Date(existingBooking.service_items[0]?.scheduled_start ?? existingBooking.created_at).toLocaleDateString()}</span>\n </div>\n )}\n\n <div data-cimplify-booking-service-info className={classNames?.serviceInfo}>\n <span data-cimplify-booking-service-name>{service.name}</span>\n <span data-cimplify-booking-service-duration>{formatDuration(service.duration_minutes, service.duration_unit)}</span>\n {service.price && (\n <span data-cimplify-booking-service-price>\n <Price amount={service.price} />\n </span>\n )}\n {hasDeposit && (\n <span data-cimplify-booking-deposit-info className={classNames?.depositInfo}>\n Deposit: {depositType === \"percentage\" ? `${parsePrice(depositAmount!)}%` : <Price amount={depositAmount!} />}\n </span>\n )}\n {cancellationMinutes !== undefined && cancellationMinutes > 0 && (\n <span data-cimplify-booking-cancellation-policy className={classNames?.cancellationPolicy}>\n Free cancellation up to {cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? \"s\" : \"\"}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? \"s\" : \"\"}`} before\n </span>\n )}\n {noShowFee !== undefined && parsePrice(noShowFee) !== 0 && (\n <span data-cimplify-booking-no-show-fee className={classNames?.cancellationPolicy}>\n No-show fee: <Price amount={noShowFee} />\n </span>\n )}\n </div>\n\n {error && (\n <div data-cimplify-booking-error className={classNames?.error}>\n {error}\n </div>\n )}\n\n {step === STEP.SELECT_SLOT && (\n <div data-cimplify-booking-step=\"select-slot\" className={classNames?.step}>\n <h2 data-cimplify-booking-step-title className={classNames?.stepTitle}>\n Select a date & time\n </h2>\n <DateSlotPicker\n serviceId={service.id}\n participantCount={participantCount}\n selectedSlot={selectedSlot}\n onSlotSelect={handleSlotSelect}\n showPrice={showPrice}\n />\n </div>\n )}\n\n {step === STEP.SELECT_RESOURCE && resources && (\n <div data-cimplify-booking-step=\"select-resource\" className={cn(classNames?.step, classNames?.resourceStep)}>\n <h2 data-cimplify-booking-step-title className={classNames?.stepTitle}>\n Choose a room\n </h2>\n <ResourcePicker\n resources={resources}\n selectedResourceId={selectedResourceId}\n onResourceSelect={handleResourceSelect}\n />\n </div>\n )}\n\n {step === STEP.SELECT_STAFF && staff && (\n <div data-cimplify-booking-step=\"select-staff\" className={classNames?.step}>\n <h2 data-cimplify-booking-step-title className={classNames?.stepTitle}>\n Choose a provider\n </h2>\n <StaffPicker\n staff={staff}\n selectedStaffId={selectedStaffId}\n onStaffSelect={handleStaffSelect}\n />\n </div>\n )}\n\n {step === STEP.CONFIRM && selectedSlot && (\n <div data-cimplify-booking-step=\"confirm\" className={classNames?.step}>\n <h2 data-cimplify-booking-step-title className={classNames?.stepTitle}>\n Confirm your booking\n </h2>\n <div data-cimplify-booking-summary className={classNames?.summary}>\n <div data-cimplify-booking-summary-row className={classNames?.summaryRow}>\n <span>Service</span>\n <span>{service.name}</span>\n </div>\n <div data-cimplify-booking-summary-row className={classNames?.summaryRow}>\n <span>Date</span>\n <span>{selectedDate}</span>\n </div>\n <div data-cimplify-booking-summary-row className={classNames?.summaryRow}>\n <span>Time</span>\n <span>\n {new Date(selectedSlot.start_time).toLocaleTimeString(undefined, {\n hour: \"numeric\",\n minute: \"2-digit\",\n })}\n </span>\n </div>\n <div data-cimplify-booking-summary-row className={classNames?.summaryRow}>\n <span>Duration</span>\n <span>{formatDuration(service.duration_minutes, service.duration_unit)}</span>\n </div>\n {selectedResourceId && resources && (\n <div data-cimplify-booking-summary-row className={classNames?.summaryRow}>\n <span>Room</span>\n <span>{resources.find((r) => r.id === selectedResourceId)?.name ?? \"Selected\"}</span>\n </div>\n )}\n {selectedStaffId && staff && (\n <div data-cimplify-booking-summary-row className={classNames?.summaryRow}>\n <span>Provider</span>\n <span>{staff.find((s) => s.id === selectedStaffId)?.name ?? \"Selected\"}</span>\n </div>\n )}\n {(selectedSlot.price || service.price) && (\n <div data-cimplify-booking-summary-row className={classNames?.summaryRow}>\n <span>Price</span>\n <span>\n <Price amount={selectedSlot.price || service.price!} />\n </span>\n </div>\n )}\n {hasDeposit && (\n <div data-cimplify-booking-summary-row className={cn(classNames?.summaryRow, classNames?.depositInfo)}>\n <span>Deposit</span>\n <span>\n {depositType === \"percentage\" ? `${parsePrice(depositAmount!)}%` : <Price amount={depositAmount!} />}\n </span>\n </div>\n )}\n </div>\n <button\n type=\"button\"\n onClick={handleConfirm}\n disabled={isSubmitting}\n data-cimplify-booking-confirm\n className={classNames?.confirmButton}\n >\n {isSubmitting\n ? (isReschedule ? \"Rescheduling…\" : \"Adding to cart…\")\n : (isReschedule ? \"Reschedule\" : \"Confirm Booking\")}\n </button>\n </div>\n )}\n </div>\n );\n}\n"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bookings-page",
|
|
3
|
+
"title": "BookingsPage",
|
|
4
|
+
"description": "Account-area page listing a customer's bookings with filters and detail view.",
|
|
5
|
+
"type": "component",
|
|
6
|
+
"registryDependencies": [
|
|
7
|
+
"booking-list",
|
|
8
|
+
"booking-card",
|
|
9
|
+
"cn"
|
|
10
|
+
],
|
|
11
|
+
"files": [
|
|
12
|
+
{
|
|
13
|
+
"path": "bookings-page.tsx",
|
|
14
|
+
"content": "\"use client\";\n\nimport React, { useState, useCallback } from \"react\";\nimport { Tabs } from \"@base-ui/react/tabs\";\nimport type { CustomerBooking } from \"@cimplify/sdk\";\nimport { BookingList } from \"@cimplify/sdk/react\";\nimport { BookingCard } from \"@cimplify/sdk/react\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport interface BookingsPageClassNames {\n root?: string;\n header?: string;\n title?: string;\n filters?: string;\n filterButton?: string;\n list?: string;\n detail?: string;\n backButton?: string;\n}\n\nexport interface BookingsPageProps {\n /** Page title. */\n title?: string;\n /** Pre-fetched bookings for SSR. */\n bookings?: CustomerBooking[];\n /** Called when navigating to a booking detail (e.g. for routing). */\n onBookingNavigate?: (booking: CustomerBooking) => void;\n /** Called when cancel is clicked. */\n onCancel?: (booking: CustomerBooking) => void;\n /** Called when reschedule is clicked. */\n onReschedule?: (booking: CustomerBooking) => void;\n /** Show filter tabs. Default: true. */\n showFilters?: boolean;\n /** Custom booking renderer. */\n renderBooking?: (booking: CustomerBooking) => React.ReactNode;\n className?: string;\n classNames?: BookingsPageClassNames;\n}\n\nconst BOOKING_FILTERS: { label: string; value: \"all\" | \"upcoming\" | \"past\" }[] = [\n { label: \"All\", value: \"all\" },\n { label: \"Upcoming\", value: \"upcoming\" },\n { label: \"Past\", value: \"past\" },\n];\n\nexport function BookingsPage({\n title = \"My Bookings\",\n bookings: bookingsProp,\n onBookingNavigate,\n onCancel,\n onReschedule,\n showFilters = true,\n renderBooking,\n className,\n classNames,\n}: BookingsPageProps): React.ReactElement {\n const [filter, setFilter] = useState<\"all\" | \"upcoming\" | \"past\">(\"all\");\n const [selectedBooking, setSelectedBooking] = useState<CustomerBooking | null>(null);\n\n const handleBookingClick = useCallback(\n (booking: CustomerBooking) => {\n if (onBookingNavigate) {\n onBookingNavigate(booking);\n } else {\n setSelectedBooking(booking);\n }\n },\n [onBookingNavigate],\n );\n\n const handleBack = useCallback(() => {\n setSelectedBooking(null);\n }, []);\n\n if (selectedBooking && !onBookingNavigate) {\n return (\n <div data-cimplify-bookings-page className={cn(className, classNames?.root)}>\n <div data-cimplify-bookings-detail className={classNames?.detail}>\n <button\n type=\"button\"\n onClick={handleBack}\n data-cimplify-bookings-back\n className={classNames?.backButton}\n >\n Back to bookings\n </button>\n <BookingCard\n booking={selectedBooking}\n onCancel={onCancel}\n onReschedule={onReschedule}\n />\n </div>\n </div>\n );\n }\n\n return (\n <div data-cimplify-bookings-page className={cn(className, classNames?.root)}>\n <div data-cimplify-bookings-header className={classNames?.header}>\n <h1 data-cimplify-bookings-title className={classNames?.title}>\n {title}\n </h1>\n </div>\n\n {showFilters && (\n <Tabs.Root\n value={filter}\n onValueChange={(value) => setFilter(value as \"all\" | \"upcoming\" | \"past\")}\n >\n <Tabs.List data-cimplify-bookings-filters className={classNames?.filters}>\n {BOOKING_FILTERS.map((f) => (\n <Tabs.Tab\n key={f.value}\n value={f.value}\n data-cimplify-booking-filter\n data-selected={filter === f.value || undefined}\n className={classNames?.filterButton}\n >\n {f.label}\n </Tabs.Tab>\n ))}\n </Tabs.List>\n </Tabs.Root>\n )}\n\n <div data-cimplify-bookings-list className={classNames?.list}>\n <BookingList\n bookings={bookingsProp}\n filter={filter}\n onCancel={onCancel}\n onReschedule={onReschedule}\n onBookingClick={handleBookingClick}\n renderBooking={renderBooking}\n />\n </div>\n </div>\n );\n}\n"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
package/registry/index.json
CHANGED
|
@@ -365,6 +365,30 @@
|
|
|
365
365
|
"cn"
|
|
366
366
|
]
|
|
367
367
|
},
|
|
368
|
+
{
|
|
369
|
+
"name": "booking-page",
|
|
370
|
+
"title": "BookingPage",
|
|
371
|
+
"description": "Multi-step booking flow: service, staff, resource, date/slot, confirmation.",
|
|
372
|
+
"type": "component",
|
|
373
|
+
"registryDependencies": [
|
|
374
|
+
"date-slot-picker",
|
|
375
|
+
"staff-picker",
|
|
376
|
+
"resource-picker",
|
|
377
|
+
"price",
|
|
378
|
+
"cn"
|
|
379
|
+
]
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"name": "bookings-page",
|
|
383
|
+
"title": "BookingsPage",
|
|
384
|
+
"description": "Account-area page listing a customer's bookings with filters and detail view.",
|
|
385
|
+
"type": "component",
|
|
386
|
+
"registryDependencies": [
|
|
387
|
+
"booking-list",
|
|
388
|
+
"booking-card",
|
|
389
|
+
"cn"
|
|
390
|
+
]
|
|
391
|
+
},
|
|
368
392
|
{
|
|
369
393
|
"name": "food-product-card",
|
|
370
394
|
"title": "FoodProductCard",
|