@cimplify/sdk 0.100.5 → 0.101.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.
Files changed (68) hide show
  1. package/dist/advanced.d.mts +3 -3
  2. package/dist/advanced.d.ts +3 -3
  3. package/dist/advanced.js +20 -20
  4. package/dist/advanced.mjs +1 -1
  5. package/dist/{chunk-HSDQWJLA.mjs → chunk-7H6IL7CX.mjs} +2 -2
  6. package/dist/{chunk-RWR7JF7F.mjs → chunk-DKLHCZ5M.mjs} +13 -3
  7. package/dist/{chunk-PNTINRAU.js → chunk-H5SSGN7W.js} +28 -0
  8. package/dist/{chunk-LMD7B33E.js → chunk-ICCCSVN3.js} +4 -4
  9. package/dist/{chunk-JEVCHTKZ.js → chunk-YDA46OZ6.js} +59 -49
  10. package/dist/{chunk-3HU5I5VG.js → chunk-YER7DIOM.js} +15 -0
  11. package/dist/{chunk-RQPXLXB2.mjs → chunk-YHPMFTMN.mjs} +28 -0
  12. package/dist/{chunk-Z7M6GAHS.mjs → chunk-Z3K2D3TE.mjs} +15 -0
  13. package/dist/{client-CrPglBBz.d.ts → client-CdTx7X_X.d.mts} +12 -2
  14. package/dist/{client-CPcZIrjC.d.ts → client-D40kI8z2.d.ts} +2 -2
  15. package/dist/{client-BwRAAk4y.d.mts → client-Db554902.d.ts} +12 -2
  16. package/dist/{client-DGrvLiJv.d.mts → client-WkUcvRvO.d.mts} +2 -2
  17. package/dist/{index-D-LUYk1Y.d.mts → index-BjWUkYgY.d.mts} +3 -3
  18. package/dist/{index-B_RYmvlF.d.ts → index-D3UXgAYl.d.ts} +3 -3
  19. package/dist/index.d.mts +7 -7
  20. package/dist/index.d.ts +7 -7
  21. package/dist/index.js +69 -69
  22. package/dist/index.mjs +3 -3
  23. package/dist/mock/cli.mjs +28 -0
  24. package/dist/mock/library.js +28 -0
  25. package/dist/mock/library.mjs +28 -0
  26. package/dist/mock/msw.js +28 -0
  27. package/dist/mock/msw.mjs +28 -0
  28. package/dist/{payment-BSzy7sly.d.mts → payment-CRqjGrx6.d.mts} +1 -1
  29. package/dist/{payment-jK8ztICx.d.ts → payment-DO1Z1Ip6.d.ts} +1 -1
  30. package/dist/{price-D96h6c6L.d.mts → price-CiQUd_XX.d.mts} +1 -1
  31. package/dist/{price-CJLfcYKd.d.ts → price-D9EOj8y8.d.ts} +1 -1
  32. package/dist/{product-CeV8euw4.d.mts → product-DwKdC_to.d.mts} +727 -625
  33. package/dist/{product-CeV8euw4.d.ts → product-DwKdC_to.d.ts} +727 -625
  34. package/dist/react.d.mts +7 -4
  35. package/dist/react.d.ts +7 -4
  36. package/dist/react.js +75 -34
  37. package/dist/react.mjs +52 -11
  38. package/dist/server/evict.d.mts +12 -8
  39. package/dist/server/evict.d.ts +12 -8
  40. package/dist/server/evict.js +53 -7
  41. package/dist/server/evict.mjs +53 -7
  42. package/dist/server/tanstack.d.mts +4 -2
  43. package/dist/server/tanstack.d.ts +4 -2
  44. package/dist/server/tanstack.js +53 -14
  45. package/dist/server/tanstack.mjs +53 -14
  46. package/dist/{server-zyrpzJVn.d.ts → server-CeDb93WA.d.ts} +13 -1
  47. package/dist/{server-DRAW2OOX.d.mts → server-D-nSkrUr.d.mts} +13 -1
  48. package/dist/server.d.mts +4 -4
  49. package/dist/server.d.ts +4 -4
  50. package/dist/server.js +7 -7
  51. package/dist/server.mjs +2 -2
  52. package/dist/testing/msw.d.mts +2 -2
  53. package/dist/testing/msw.d.ts +2 -2
  54. package/dist/testing/msw.js +2 -2
  55. package/dist/testing/msw.mjs +1 -1
  56. package/dist/testing/suite.d.mts +6 -6
  57. package/dist/testing/suite.d.ts +6 -6
  58. package/dist/testing/suite.js +23 -23
  59. package/dist/testing/suite.mjs +4 -4
  60. package/dist/testing.d.mts +20 -20
  61. package/dist/testing.d.ts +20 -20
  62. package/dist/testing.js +79 -79
  63. package/dist/testing.mjs +5 -5
  64. package/dist/utils.d.mts +4 -4
  65. package/dist/utils.d.ts +4 -4
  66. package/package.json +1 -1
  67. package/registry/cart-summary.json +1 -1
  68. package/registry/chat-widget.json +1 -1
package/dist/testing.js CHANGED
@@ -1,30 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunkLMD7B33E_js = require('./chunk-LMD7B33E.js');
4
- require('./chunk-PNTINRAU.js');
3
+ var chunkICCCSVN3_js = require('./chunk-ICCCSVN3.js');
4
+ require('./chunk-H5SSGN7W.js');
5
5
  require('./chunk-XREIZ56K.js');
6
- require('./chunk-JEVCHTKZ.js');
7
- require('./chunk-3HU5I5VG.js');
6
+ require('./chunk-YDA46OZ6.js');
7
+ require('./chunk-YER7DIOM.js');
8
8
  require('./chunk-WMEC5JWN.js');
9
9
  require('./chunk-NIOUSKQQ.js');
10
10
  require('./chunk-OWW5GUSB.js');
11
11
  var zod = require('zod');
12
12
 
13
13
  var PUBLIC_SCHEMAS = {
14
- Brand: chunkLMD7B33E_js.BrandSchema,
15
- AddItemPayload: chunkLMD7B33E_js.AddItemPayloadSchema,
16
- Cart: chunkLMD7B33E_js.CartSchema,
17
- CartItem: chunkLMD7B33E_js.CartItemSchema,
18
- CartPricing: chunkLMD7B33E_js.CartPricingSchema,
19
- CheckoutBody: chunkLMD7B33E_js.CheckoutBodySchema,
20
- CheckoutResponse: chunkLMD7B33E_js.CheckoutResponseSchema,
21
- VariantInfo: chunkLMD7B33E_js.VariantInfoSchema
14
+ Brand: chunkICCCSVN3_js.BrandSchema,
15
+ AddItemPayload: chunkICCCSVN3_js.AddItemPayloadSchema,
16
+ Cart: chunkICCCSVN3_js.CartSchema,
17
+ CartItem: chunkICCCSVN3_js.CartItemSchema,
18
+ CartPricing: chunkICCCSVN3_js.CartPricingSchema,
19
+ CheckoutBody: chunkICCCSVN3_js.CheckoutBodySchema,
20
+ CheckoutResponse: chunkICCCSVN3_js.CheckoutResponseSchema,
21
+ VariantInfo: chunkICCCSVN3_js.VariantInfoSchema
22
22
  };
23
23
  function exportJsonSchemas() {
24
24
  const out = {};
25
25
  for (const [name, schema] of Object.entries(PUBLIC_SCHEMAS)) {
26
- const meta = chunkLMD7B33E_js.cimplifyRegistry.get(schema);
27
- const json = zod.z.toJSONSchema(schema, { metadata: chunkLMD7B33E_js.cimplifyRegistry });
26
+ const meta = chunkICCCSVN3_js.cimplifyRegistry.get(schema);
27
+ const json = zod.z.toJSONSchema(schema, { metadata: chunkICCCSVN3_js.cimplifyRegistry });
28
28
  if (meta) {
29
29
  json.$id = meta.id;
30
30
  json["x-cimplify-version"] = meta.version;
@@ -36,16 +36,16 @@ function exportJsonSchemas() {
36
36
  function listRegisteredSchemas() {
37
37
  const entries = [];
38
38
  for (const schema of [
39
- chunkLMD7B33E_js.BrandSchema,
40
- chunkLMD7B33E_js.AddItemPayloadSchema,
41
- chunkLMD7B33E_js.CartSchema,
42
- chunkLMD7B33E_js.CartItemSchema,
43
- chunkLMD7B33E_js.CartPricingSchema,
44
- chunkLMD7B33E_js.CheckoutBodySchema,
45
- chunkLMD7B33E_js.CheckoutResponseSchema,
46
- chunkLMD7B33E_js.VariantInfoSchema
39
+ chunkICCCSVN3_js.BrandSchema,
40
+ chunkICCCSVN3_js.AddItemPayloadSchema,
41
+ chunkICCCSVN3_js.CartSchema,
42
+ chunkICCCSVN3_js.CartItemSchema,
43
+ chunkICCCSVN3_js.CartPricingSchema,
44
+ chunkICCCSVN3_js.CheckoutBodySchema,
45
+ chunkICCCSVN3_js.CheckoutResponseSchema,
46
+ chunkICCCSVN3_js.VariantInfoSchema
47
47
  ]) {
48
- const meta = chunkLMD7B33E_js.cimplifyRegistry.get(schema);
48
+ const meta = chunkICCCSVN3_js.cimplifyRegistry.get(schema);
49
49
  if (meta) entries.push({ schema, meta });
50
50
  }
51
51
  return entries;
@@ -53,227 +53,227 @@ function listRegisteredSchemas() {
53
53
 
54
54
  Object.defineProperty(exports, "AddItemPayloadSchema", {
55
55
  enumerable: true,
56
- get: function () { return chunkLMD7B33E_js.AddItemPayloadSchema; }
56
+ get: function () { return chunkICCCSVN3_js.AddItemPayloadSchema; }
57
57
  });
58
58
  Object.defineProperty(exports, "AddOnDetailsSchema", {
59
59
  enumerable: true,
60
- get: function () { return chunkLMD7B33E_js.AddOnDetailsSchema; }
60
+ get: function () { return chunkICCCSVN3_js.AddOnDetailsSchema; }
61
61
  });
62
62
  Object.defineProperty(exports, "AddOnGroupDetailsSchema", {
63
63
  enumerable: true,
64
- get: function () { return chunkLMD7B33E_js.AddOnGroupDetailsSchema; }
64
+ get: function () { return chunkICCCSVN3_js.AddOnGroupDetailsSchema; }
65
65
  });
66
66
  Object.defineProperty(exports, "AddOnInDetailsSchema", {
67
67
  enumerable: true,
68
- get: function () { return chunkLMD7B33E_js.AddOnInDetailsSchema; }
68
+ get: function () { return chunkICCCSVN3_js.AddOnInDetailsSchema; }
69
69
  });
70
70
  Object.defineProperty(exports, "AddOnOptionDetailsSchema", {
71
71
  enumerable: true,
72
- get: function () { return chunkLMD7B33E_js.AddOnOptionDetailsSchema; }
72
+ get: function () { return chunkICCCSVN3_js.AddOnOptionDetailsSchema; }
73
73
  });
74
74
  Object.defineProperty(exports, "AuthorizationTypeSchema", {
75
75
  enumerable: true,
76
- get: function () { return chunkLMD7B33E_js.AuthorizationTypeSchema; }
76
+ get: function () { return chunkICCCSVN3_js.AuthorizationTypeSchema; }
77
77
  });
78
78
  Object.defineProperty(exports, "BrandContactSchema", {
79
79
  enumerable: true,
80
- get: function () { return chunkLMD7B33E_js.BrandContactSchema; }
80
+ get: function () { return chunkICCCSVN3_js.BrandContactSchema; }
81
81
  });
82
82
  Object.defineProperty(exports, "BrandFaqSchema", {
83
83
  enumerable: true,
84
- get: function () { return chunkLMD7B33E_js.BrandFaqSchema; }
84
+ get: function () { return chunkICCCSVN3_js.BrandFaqSchema; }
85
85
  });
86
86
  Object.defineProperty(exports, "BrandHeroSchema", {
87
87
  enumerable: true,
88
- get: function () { return chunkLMD7B33E_js.BrandHeroSchema; }
88
+ get: function () { return chunkICCCSVN3_js.BrandHeroSchema; }
89
89
  });
90
90
  Object.defineProperty(exports, "BrandNavLinkSchema", {
91
91
  enumerable: true,
92
- get: function () { return chunkLMD7B33E_js.BrandNavLinkSchema; }
92
+ get: function () { return chunkICCCSVN3_js.BrandNavLinkSchema; }
93
93
  });
94
94
  Object.defineProperty(exports, "BrandPolicyPageSchema", {
95
95
  enumerable: true,
96
- get: function () { return chunkLMD7B33E_js.BrandPolicyPageSchema; }
96
+ get: function () { return chunkICCCSVN3_js.BrandPolicyPageSchema; }
97
97
  });
98
98
  Object.defineProperty(exports, "BrandPolicySectionSchema", {
99
99
  enumerable: true,
100
- get: function () { return chunkLMD7B33E_js.BrandPolicySectionSchema; }
100
+ get: function () { return chunkICCCSVN3_js.BrandPolicySectionSchema; }
101
101
  });
102
102
  Object.defineProperty(exports, "BrandSchema", {
103
103
  enumerable: true,
104
- get: function () { return chunkLMD7B33E_js.BrandSchema; }
104
+ get: function () { return chunkICCCSVN3_js.BrandSchema; }
105
105
  });
106
106
  Object.defineProperty(exports, "BrandSocialSchema", {
107
107
  enumerable: true,
108
- get: function () { return chunkLMD7B33E_js.BrandSocialSchema; }
108
+ get: function () { return chunkICCCSVN3_js.BrandSocialSchema; }
109
109
  });
110
110
  Object.defineProperty(exports, "BundleResolvedSchema", {
111
111
  enumerable: true,
112
- get: function () { return chunkLMD7B33E_js.BundleResolvedSchema; }
112
+ get: function () { return chunkICCCSVN3_js.BundleResolvedSchema; }
113
113
  });
114
114
  Object.defineProperty(exports, "BundleSelectionInputSchema", {
115
115
  enumerable: true,
116
- get: function () { return chunkLMD7B33E_js.BundleSelectionInputSchema; }
116
+ get: function () { return chunkICCCSVN3_js.BundleSelectionInputSchema; }
117
117
  });
118
118
  Object.defineProperty(exports, "CartItemSchema", {
119
119
  enumerable: true,
120
- get: function () { return chunkLMD7B33E_js.CartItemSchema; }
120
+ get: function () { return chunkICCCSVN3_js.CartItemSchema; }
121
121
  });
122
122
  Object.defineProperty(exports, "CartPricingSchema", {
123
123
  enumerable: true,
124
- get: function () { return chunkLMD7B33E_js.CartPricingSchema; }
124
+ get: function () { return chunkICCCSVN3_js.CartPricingSchema; }
125
125
  });
126
126
  Object.defineProperty(exports, "CartSchema", {
127
127
  enumerable: true,
128
- get: function () { return chunkLMD7B33E_js.CartSchema; }
128
+ get: function () { return chunkICCCSVN3_js.CartSchema; }
129
129
  });
130
130
  Object.defineProperty(exports, "CheckoutBodySchema", {
131
131
  enumerable: true,
132
- get: function () { return chunkLMD7B33E_js.CheckoutBodySchema; }
132
+ get: function () { return chunkICCCSVN3_js.CheckoutBodySchema; }
133
133
  });
134
134
  Object.defineProperty(exports, "CheckoutCustomerSchema", {
135
135
  enumerable: true,
136
- get: function () { return chunkLMD7B33E_js.CheckoutCustomerSchema; }
136
+ get: function () { return chunkICCCSVN3_js.CheckoutCustomerSchema; }
137
137
  });
138
138
  Object.defineProperty(exports, "CheckoutResponseSchema", {
139
139
  enumerable: true,
140
- get: function () { return chunkLMD7B33E_js.CheckoutResponseSchema; }
140
+ get: function () { return chunkICCCSVN3_js.CheckoutResponseSchema; }
141
141
  });
142
142
  Object.defineProperty(exports, "ChosenPriceSchema", {
143
143
  enumerable: true,
144
- get: function () { return chunkLMD7B33E_js.ChosenPriceSchema; }
144
+ get: function () { return chunkICCCSVN3_js.ChosenPriceSchema; }
145
145
  });
146
146
  Object.defineProperty(exports, "CompositeResolvedSchema", {
147
147
  enumerable: true,
148
- get: function () { return chunkLMD7B33E_js.CompositeResolvedSchema; }
148
+ get: function () { return chunkICCCSVN3_js.CompositeResolvedSchema; }
149
149
  });
150
150
  Object.defineProperty(exports, "CompositeSelectionInputSchema", {
151
151
  enumerable: true,
152
- get: function () { return chunkLMD7B33E_js.CompositeSelectionInputSchema; }
152
+ get: function () { return chunkICCCSVN3_js.CompositeSelectionInputSchema; }
153
153
  });
154
154
  Object.defineProperty(exports, "CountryCodeSchema", {
155
155
  enumerable: true,
156
- get: function () { return chunkLMD7B33E_js.CountryCodeSchema; }
156
+ get: function () { return chunkICCCSVN3_js.CountryCodeSchema; }
157
157
  });
158
158
  Object.defineProperty(exports, "CurrencyCodeSchema", {
159
159
  enumerable: true,
160
- get: function () { return chunkLMD7B33E_js.CurrencyCodeSchema; }
160
+ get: function () { return chunkICCCSVN3_js.CurrencyCodeSchema; }
161
161
  });
162
162
  Object.defineProperty(exports, "CustomerInputValueSchema", {
163
163
  enumerable: true,
164
- get: function () { return chunkLMD7B33E_js.CustomerInputValueSchema; }
164
+ get: function () { return chunkICCCSVN3_js.CustomerInputValueSchema; }
165
165
  });
166
166
  Object.defineProperty(exports, "DiscountDetailsSchema", {
167
167
  enumerable: true,
168
- get: function () { return chunkLMD7B33E_js.DiscountDetailsSchema; }
168
+ get: function () { return chunkICCCSVN3_js.DiscountDetailsSchema; }
169
169
  });
170
170
  Object.defineProperty(exports, "IsoDateTimeSchema", {
171
171
  enumerable: true,
172
- get: function () { return chunkLMD7B33E_js.IsoDateTimeSchema; }
172
+ get: function () { return chunkICCCSVN3_js.IsoDateTimeSchema; }
173
173
  });
174
174
  Object.defineProperty(exports, "LineTypeSchema", {
175
175
  enumerable: true,
176
- get: function () { return chunkLMD7B33E_js.LineTypeSchema; }
176
+ get: function () { return chunkICCCSVN3_js.LineTypeSchema; }
177
177
  });
178
178
  Object.defineProperty(exports, "LocaleSchema", {
179
179
  enumerable: true,
180
- get: function () { return chunkLMD7B33E_js.LocaleSchema; }
180
+ get: function () { return chunkICCCSVN3_js.LocaleSchema; }
181
181
  });
182
182
  Object.defineProperty(exports, "MoneyLooseSchema", {
183
183
  enumerable: true,
184
- get: function () { return chunkLMD7B33E_js.MoneyLooseSchema; }
184
+ get: function () { return chunkICCCSVN3_js.MoneyLooseSchema; }
185
185
  });
186
186
  Object.defineProperty(exports, "MoneySchema", {
187
187
  enumerable: true,
188
- get: function () { return chunkLMD7B33E_js.MoneySchema; }
188
+ get: function () { return chunkICCCSVN3_js.MoneySchema; }
189
189
  });
190
190
  Object.defineProperty(exports, "NextActionSchema", {
191
191
  enumerable: true,
192
- get: function () { return chunkLMD7B33E_js.NextActionSchema; }
192
+ get: function () { return chunkICCCSVN3_js.NextActionSchema; }
193
193
  });
194
194
  Object.defineProperty(exports, "PhoneE164Schema", {
195
195
  enumerable: true,
196
- get: function () { return chunkLMD7B33E_js.PhoneE164Schema; }
196
+ get: function () { return chunkICCCSVN3_js.PhoneE164Schema; }
197
197
  });
198
198
  Object.defineProperty(exports, "ProductTypeSchema", {
199
199
  enumerable: true,
200
- get: function () { return chunkLMD7B33E_js.ProductTypeSchema; }
200
+ get: function () { return chunkICCCSVN3_js.ProductTypeSchema; }
201
201
  });
202
202
  Object.defineProperty(exports, "SchemaViolationError", {
203
203
  enumerable: true,
204
- get: function () { return chunkLMD7B33E_js.SchemaViolationError; }
204
+ get: function () { return chunkICCCSVN3_js.SchemaViolationError; }
205
205
  });
206
206
  Object.defineProperty(exports, "SeedNameSchema", {
207
207
  enumerable: true,
208
- get: function () { return chunkLMD7B33E_js.SeedNameSchema; }
208
+ get: function () { return chunkICCCSVN3_js.SeedNameSchema; }
209
209
  });
210
210
  Object.defineProperty(exports, "SelectedAddOnOptionSchema", {
211
211
  enumerable: true,
212
- get: function () { return chunkLMD7B33E_js.SelectedAddOnOptionSchema; }
212
+ get: function () { return chunkICCCSVN3_js.SelectedAddOnOptionSchema; }
213
213
  });
214
214
  Object.defineProperty(exports, "ServiceStatusSchema", {
215
215
  enumerable: true,
216
- get: function () { return chunkLMD7B33E_js.ServiceStatusSchema; }
216
+ get: function () { return chunkICCCSVN3_js.ServiceStatusSchema; }
217
217
  });
218
218
  Object.defineProperty(exports, "TimestampSchema", {
219
219
  enumerable: true,
220
- get: function () { return chunkLMD7B33E_js.TimestampSchema; }
220
+ get: function () { return chunkICCCSVN3_js.TimestampSchema; }
221
221
  });
222
222
  Object.defineProperty(exports, "VariantDetailsSchema", {
223
223
  enumerable: true,
224
- get: function () { return chunkLMD7B33E_js.VariantDetailsSchema; }
224
+ get: function () { return chunkICCCSVN3_js.VariantDetailsSchema; }
225
225
  });
226
226
  Object.defineProperty(exports, "VariantDisplayAttributeSchema", {
227
227
  enumerable: true,
228
- get: function () { return chunkLMD7B33E_js.VariantDisplayAttributeSchema; }
228
+ get: function () { return chunkICCCSVN3_js.VariantDisplayAttributeSchema; }
229
229
  });
230
230
  Object.defineProperty(exports, "VariantInfoSchema", {
231
231
  enumerable: true,
232
- get: function () { return chunkLMD7B33E_js.VariantInfoSchema; }
232
+ get: function () { return chunkICCCSVN3_js.VariantInfoSchema; }
233
233
  });
234
234
  Object.defineProperty(exports, "assertAddItemPayload", {
235
235
  enumerable: true,
236
- get: function () { return chunkLMD7B33E_js.assertAddItemPayload; }
236
+ get: function () { return chunkICCCSVN3_js.assertAddItemPayload; }
237
237
  });
238
238
  Object.defineProperty(exports, "assertBrand", {
239
239
  enumerable: true,
240
- get: function () { return chunkLMD7B33E_js.assertBrand; }
240
+ get: function () { return chunkICCCSVN3_js.assertBrand; }
241
241
  });
242
242
  Object.defineProperty(exports, "assertCart", {
243
243
  enumerable: true,
244
- get: function () { return chunkLMD7B33E_js.assertCart; }
244
+ get: function () { return chunkICCCSVN3_js.assertCart; }
245
245
  });
246
246
  Object.defineProperty(exports, "assertCartItem", {
247
247
  enumerable: true,
248
- get: function () { return chunkLMD7B33E_js.assertCartItem; }
248
+ get: function () { return chunkICCCSVN3_js.assertCartItem; }
249
249
  });
250
250
  Object.defineProperty(exports, "assertCheckoutBody", {
251
251
  enumerable: true,
252
- get: function () { return chunkLMD7B33E_js.assertCheckoutBody; }
252
+ get: function () { return chunkICCCSVN3_js.assertCheckoutBody; }
253
253
  });
254
254
  Object.defineProperty(exports, "assertCheckoutResponse", {
255
255
  enumerable: true,
256
- get: function () { return chunkLMD7B33E_js.assertCheckoutResponse; }
256
+ get: function () { return chunkICCCSVN3_js.assertCheckoutResponse; }
257
257
  });
258
258
  Object.defineProperty(exports, "cimplifyRegistry", {
259
259
  enumerable: true,
260
- get: function () { return chunkLMD7B33E_js.cimplifyRegistry; }
260
+ get: function () { return chunkICCCSVN3_js.cimplifyRegistry; }
261
261
  });
262
262
  Object.defineProperty(exports, "createTestClient", {
263
263
  enumerable: true,
264
- get: function () { return chunkLMD7B33E_js.createTestClient; }
264
+ get: function () { return chunkICCCSVN3_js.createTestClient; }
265
265
  });
266
266
  Object.defineProperty(exports, "fixtures", {
267
267
  enumerable: true,
268
- get: function () { return chunkLMD7B33E_js.fixtures; }
268
+ get: function () { return chunkICCCSVN3_js.fixtures; }
269
269
  });
270
270
  Object.defineProperty(exports, "makeAssertion", {
271
271
  enumerable: true,
272
- get: function () { return chunkLMD7B33E_js.makeAssertion; }
272
+ get: function () { return chunkICCCSVN3_js.makeAssertion; }
273
273
  });
274
274
  Object.defineProperty(exports, "registerSchema", {
275
275
  enumerable: true,
276
- get: function () { return chunkLMD7B33E_js.registerSchema; }
276
+ get: function () { return chunkICCCSVN3_js.registerSchema; }
277
277
  });
278
278
  exports.exportJsonSchemas = exportJsonSchemas;
279
279
  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-HSDQWJLA.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-HSDQWJLA.mjs';
3
- import './chunk-RQPXLXB2.mjs';
1
+ import { VariantInfoSchema, CheckoutResponseSchema, CheckoutBodySchema, CartPricingSchema, CartItemSchema, CartSchema, AddItemPayloadSchema, BrandSchema, cimplifyRegistry } from './chunk-7H6IL7CX.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-7H6IL7CX.mjs';
3
+ import './chunk-YHPMFTMN.mjs';
4
4
  import './chunk-U4MW6PYU.mjs';
5
- import './chunk-RWR7JF7F.mjs';
6
- import './chunk-Z7M6GAHS.mjs';
5
+ import './chunk-DKLHCZ5M.mjs';
6
+ import './chunk-Z3K2D3TE.mjs';
7
7
  import './chunk-DLW3RWRK.mjs';
8
8
  import './chunk-O3YUHLZL.mjs';
9
9
  import './chunk-3G6RQLXK.mjs';
package/dist/utils.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as CURRENCY_SYMBOLS, M as MOBILE_MONEY_PROVIDERS, c as categorizePaymentError, d as detectMobileMoneyProvider, f as formatMoney, a as formatNumberCompact, b as formatPrice, e as formatPriceAdjustment, g as formatPriceCompact, i as formatPriceWithTax, j as formatProductPrice, k as getBasePrice, l as getCurrencySymbol, m as getDiscountPercentage, n as getDisplayPrice, o as getMarkupPercentage, q as getProductCurrency, r as getTaxAmount, t as hasTaxInfo, u as isOnSale, v as isPaymentStatusFailure, w as isPaymentStatusRequiresAction, x as isPaymentStatusSuccess, y as isTaxInclusive, z as isValidPhoneForContext, A as normalizePaymentResponse, B as normalizePhoneToE164, D as normalizeStatusResponse, E as parsePrice, F as resolvePhoneCountryCode } from './index-D-LUYk1Y.mjs';
2
- import './product-CeV8euw4.mjs';
3
- import './price-D96h6c6L.mjs';
4
- import './payment-BSzy7sly.mjs';
1
+ export { C as CURRENCY_SYMBOLS, M as MOBILE_MONEY_PROVIDERS, c as categorizePaymentError, d as detectMobileMoneyProvider, f as formatMoney, a as formatNumberCompact, b as formatPrice, e as formatPriceAdjustment, g as formatPriceCompact, i as formatPriceWithTax, j as formatProductPrice, k as getBasePrice, l as getCurrencySymbol, m as getDiscountPercentage, n as getDisplayPrice, o as getMarkupPercentage, q as getProductCurrency, r as getTaxAmount, t as hasTaxInfo, u as isOnSale, v as isPaymentStatusFailure, w as isPaymentStatusRequiresAction, x as isPaymentStatusSuccess, y as isTaxInclusive, z as isValidPhoneForContext, A as normalizePaymentResponse, B as normalizePhoneToE164, D as normalizeStatusResponse, E as parsePrice, F as resolvePhoneCountryCode } from './index-BjWUkYgY.mjs';
2
+ import './product-DwKdC_to.mjs';
3
+ import './price-CiQUd_XX.mjs';
4
+ import './payment-CRqjGrx6.mjs';
5
5
  import 'libphonenumber-js';
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as CURRENCY_SYMBOLS, M as MOBILE_MONEY_PROVIDERS, c as categorizePaymentError, d as detectMobileMoneyProvider, f as formatMoney, a as formatNumberCompact, b as formatPrice, e as formatPriceAdjustment, g as formatPriceCompact, i as formatPriceWithTax, j as formatProductPrice, k as getBasePrice, l as getCurrencySymbol, m as getDiscountPercentage, n as getDisplayPrice, o as getMarkupPercentage, q as getProductCurrency, r as getTaxAmount, t as hasTaxInfo, u as isOnSale, v as isPaymentStatusFailure, w as isPaymentStatusRequiresAction, x as isPaymentStatusSuccess, y as isTaxInclusive, z as isValidPhoneForContext, A as normalizePaymentResponse, B as normalizePhoneToE164, D as normalizeStatusResponse, E as parsePrice, F as resolvePhoneCountryCode } from './index-B_RYmvlF.js';
2
- import './product-CeV8euw4.js';
3
- import './price-CJLfcYKd.js';
4
- import './payment-jK8ztICx.js';
1
+ export { C as CURRENCY_SYMBOLS, M as MOBILE_MONEY_PROVIDERS, c as categorizePaymentError, d as detectMobileMoneyProvider, f as formatMoney, a as formatNumberCompact, b as formatPrice, e as formatPriceAdjustment, g as formatPriceCompact, i as formatPriceWithTax, j as formatProductPrice, k as getBasePrice, l as getCurrencySymbol, m as getDiscountPercentage, n as getDisplayPrice, o as getMarkupPercentage, q as getProductCurrency, r as getTaxAmount, t as hasTaxInfo, u as isOnSale, v as isPaymentStatusFailure, w as isPaymentStatusRequiresAction, x as isPaymentStatusSuccess, y as isTaxInclusive, z as isValidPhoneForContext, A as normalizePaymentResponse, B as normalizePhoneToE164, D as normalizeStatusResponse, E as parsePrice, F as resolvePhoneCountryCode } from './index-D3UXgAYl.js';
2
+ import './product-DwKdC_to.js';
3
+ import './price-D9EOj8y8.js';
4
+ import './payment-DO1Z1Ip6.js';
5
5
  import 'libphonenumber-js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/sdk",
3
- "version": "0.100.5",
3
+ "version": "0.101.1",
4
4
  "description": "Cimplify Commerce SDK for storefronts",
5
5
  "keywords": [
6
6
  "cimplify",
@@ -10,7 +10,7 @@
10
10
  "files": [
11
11
  {
12
12
  "path": "cart-summary.tsx",
13
- "content": "\"use client\";\n\nimport React from \"react\";\nimport type { UseCartItem } from \"@cimplify/sdk/react\";\nimport type { DisplayCart } from \"@cimplify/sdk\";\nimport { useCart } from \"@cimplify/sdk/react\";\nimport { getVariantDisplayName } from \"@cimplify/sdk\";\nimport { INPUT_FIELD_TYPE } from \"@cimplify/sdk\";\nimport { currencyCode, type CurrencyCode } from \"@cimplify/sdk\";\nimport { parsePrice } from \"@cimplify/sdk\";\nimport { Price } from \"@cimplify/sdk/react\";\nimport { QuantitySelector } from \"@cimplify/sdk/react\";\nimport { useProductPrice } from \"@cimplify/sdk/react\";\nimport type { InternalUseCartItem } from \"./hooks/use-cart-types\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport interface CartSummaryClassNames {\n root?: string;\n item?: string;\n itemName?: string;\n itemPrice?: string;\n quantity?: string;\n removeButton?: string;\n totals?: string;\n subtotal?: string;\n tax?: string;\n deliveryFee?: string;\n serviceCharge?: string;\n discount?: string;\n total?: string;\n checkout?: string;\n empty?: string;\n serviceInfo?: string;\n digitalInfo?: string;\n bundleBreakdown?: string;\n compositeBreakdown?: string;\n customerInputs?: string;\n}\n\nexport interface CartSummaryProps {\n /** Optional server cart for extended pricing details (delivery fee, service charge, discounts). */\n cart?: DisplayCart;\n onCheckout?: () => void;\n onItemRemove?: (itemId: string) => void;\n onQuantityChange?: (itemId: string, quantity: number) => void;\n emptyMessage?: string;\n /** Render the totals block (subtotal/tax/total) below the items. Default true. Hosts that show their own totals (drawer, page sidebar) should pass false. */\n showTotals?: boolean;\n /** Render the \"Proceed to Checkout\" button. Defaults to true if `onCheckout` is provided. */\n showCheckoutButton?: boolean;\n className?: string;\n classNames?: CartSummaryClassNames;\n}\n\nfunction CartLineItemRow({\n item,\n onRemove,\n onQuantityChange,\n currency,\n classNames,\n}: {\n item: UseCartItem;\n onRemove: (itemId: string) => void;\n onQuantityChange: (itemId: string, qty: number) => void;\n currency: CurrencyCode;\n classNames?: CartSummaryClassNames;\n}): React.ReactElement {\n const { unitPrice: locallyResolvedUnitPrice } = useProductPrice({\n product: item.product,\n variant: item.variant,\n addOnOptions: item.addOnOptions,\n });\n const pinnedUnitPrice = (item as InternalUseCartItem)._quotedUnitPrice;\n const unitPrice =\n pinnedUnitPrice === undefined ? locallyResolvedUnitPrice : parsePrice(pinnedUnitPrice);\n const hasComposite = item.compositeSelections && item.compositeSelections.length > 0;\n const hasBundle = item.bundleSelections && item.bundleSelections.length > 0;\n\n const isOptimistic = (item as { isOptimistic?: boolean }).isOptimistic === true;\n\n const lineTotal = parsePrice(unitPrice) * item.quantity;\n const imageUrl = item.product.image_url;\n const variantLabel = item.variant ? getVariantDisplayName(item.variant, item.product.name) : null;\n\n return (\n <div\n data-cimplify-cart-item\n data-optimistic={isOptimistic ? \"true\" : undefined}\n className={cn(\n \"group relative flex gap-3 py-4 border-b border-border last:border-b-0 transition-opacity\",\n isOptimistic && \"opacity-60\",\n classNames?.item,\n )}\n >\n {/* Thumbnail */}\n <div\n data-cimplify-cart-item-image\n className=\"relative w-20 h-20 shrink-0 rounded-md overflow-hidden bg-muted\"\n >\n {imageUrl ? (\n <img src={imageUrl} alt=\"\" className=\"w-full h-full object-cover\" loading=\"lazy\" />\n ) : (\n <div className=\"w-full h-full grid place-items-center text-muted-foreground/40\">\n <svg\n className=\"w-6 h-6\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 24 24\"\n aria-hidden\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z\"\n />\n </svg>\n </div>\n )}\n </div>\n\n {/* Info column */}\n <div data-cimplify-cart-item-info className=\"flex-1 min-w-0 flex flex-col\">\n <div className=\"flex items-start justify-between gap-3\">\n <h3\n data-cimplify-cart-item-name\n className={cn(\"text-sm font-medium leading-tight m-0 truncate\", classNames?.itemName)}\n >\n {item.product.name}\n </h3>\n <button\n type=\"button\"\n onClick={() => onRemove(item.id)}\n data-cimplify-cart-item-remove\n className={cn(\n \"shrink-0 -mr-1 -mt-1 grid place-items-center w-7 h-7 rounded-full text-muted-foreground/60 hover:text-foreground hover:bg-muted transition-colors\",\n classNames?.removeButton,\n )}\n aria-label={`Remove ${item.product.name}`}\n >\n <svg\n className=\"w-3.5 h-3.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n aria-hidden\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n </button>\n </div>\n\n {/* Pills row: variant, add-ons, badges */}\n {(variantLabel ||\n (item.addOnOptions && item.addOnOptions.length > 0) ||\n hasComposite ||\n hasBundle) && (\n <div data-cimplify-cart-item-pills className=\"flex flex-wrap gap-1.5 mt-1.5\">\n {variantLabel && (\n <span\n data-cimplify-cart-item-variant\n className=\"inline-flex items-center px-2 py-0.5 rounded-full bg-muted text-[11px] font-medium text-foreground\"\n >\n {variantLabel}\n </span>\n )}\n {item.addOnOptions?.map((opt) => (\n <span\n key={opt.id}\n data-cimplify-cart-item-addon\n className=\"inline-flex items-center px-2 py-0.5 rounded-full bg-muted text-[11px] font-medium text-muted-foreground\"\n >\n + {opt.name}\n </span>\n ))}\n {(hasComposite || hasBundle) && (\n <span\n data-cimplify-cart-item-badge\n className=\"inline-flex items-center px-2 py-0.5 rounded-full bg-primary/10 text-[11px] font-semibold uppercase tracking-wider text-primary\"\n >\n {hasComposite ? \"Custom\" : \"Bundle\"}\n </span>\n )}\n </div>\n )}\n\n {/* Special instructions */}\n {item.specialInstructions && (\n <p\n data-cimplify-cart-item-instructions\n className=\"mt-1.5 text-xs italic text-muted-foreground line-clamp-2\"\n >\n \\u201C{item.specialInstructions}\\u201D\n </p>\n )}\n\n {/* Customer input values */}\n {item.customerInputs && item.customerInputs.length > 0 && (\n <dl\n data-cimplify-cart-customer-inputs\n className={cn(\"mt-1.5 text-xs space-y-0.5\", classNames?.customerInputs)}\n >\n {item.customerInputs.map((input) => (\n <div key={input.field_id} data-cimplify-cart-input className=\"flex gap-1.5\">\n <dt data-cimplify-cart-input-label className=\"text-muted-foreground\">\n {input.field_name}:\n </dt>\n <dd data-cimplify-cart-input-value className=\"text-foreground m-0 truncate\">\n {input.field_type === INPUT_FIELD_TYPE.File ||\n input.field_type === INPUT_FIELD_TYPE.Image\n ? String(input.value).split(\"/\").pop() || \"Uploaded file\"\n : String(input.value)}\n </dd>\n </div>\n ))}\n </dl>\n )}\n\n {/* Service: scheduled details */}\n {(item.lineType === \"service\" || item.product.type === \"service\") &&\n item.scheduledStart && (\n <div\n data-cimplify-cart-service-info\n className={cn(\n \"mt-1.5 flex items-center gap-1.5 text-xs text-muted-foreground\",\n classNames?.serviceInfo,\n )}\n >\n <svg\n className=\"w-3.5 h-3.5 shrink-0\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n aria-hidden\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z\"\n />\n </svg>\n <span>\n {new Date(item.scheduledStart).toLocaleDateString(undefined, {\n month: \"short\",\n day: \"numeric\",\n })}{\" \"}\n at{\" \"}\n {new Date(item.scheduledStart).toLocaleTimeString([], {\n hour: \"2-digit\",\n minute: \"2-digit\",\n })}\n </span>\n {item.serviceStatus && (\n <span\n data-status={item.serviceStatus}\n className=\"ml-auto px-1.5 py-0.5 rounded-full bg-muted text-[10px] uppercase tracking-wider\"\n >\n {item.serviceStatus}\n </span>\n )}\n </div>\n )}\n\n {/* Digital: instant-delivery badge */}\n {(item.lineType === \"digital\" || item.product.type === \"digital\") && (\n <div\n data-cimplify-cart-digital-info\n className={cn(\n \"mt-1.5 flex items-center gap-1 text-xs text-muted-foreground\",\n classNames?.digitalInfo,\n )}\n >\n <svg\n className=\"w-3.5 h-3.5 shrink-0\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n aria-hidden\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M13 10V3L4 14h7v7l9-11h-7z\" />\n </svg>\n <span>Instant digital delivery</span>\n </div>\n )}\n\n {/* Bundle / composite component breakdown */}\n {(item.bundleResolved || item.compositeResolved) && (\n <ul\n data-cimplify-cart-composite-breakdown={item.compositeResolved ? \"\" : undefined}\n data-cimplify-cart-bundle-breakdown={item.bundleResolved ? \"\" : undefined}\n className={cn(\n \"mt-1.5 pl-3 border-l border-border space-y-0.5 text-xs text-muted-foreground\",\n item.compositeResolved ? classNames?.compositeBreakdown : classNames?.bundleBreakdown,\n )}\n >\n {(\n (item.bundleResolved?.selections ??\n item.compositeResolved?.selections ??\n []) as Array<{\n component_id?: string;\n product_name?: string;\n component_name?: string;\n quantity: number;\n product_type?: string;\n }>\n ).map((sel) => {\n const name = sel.product_name ?? sel.component_name ?? \"\";\n const compId = sel.component_id ?? `${name}-${sel.quantity}`;\n return (\n <li\n key={compId}\n data-product-type={sel.product_type}\n className=\"flex items-baseline gap-1.5 m-0\"\n >\n <span className=\"font-medium text-foreground/80\">{sel.quantity}\\u00D7</span>\n <span className=\"truncate\">{name}</span>\n </li>\n );\n })}\n </ul>\n )}\n\n {/* Bottom row: line price + qty stepper */}\n <div className=\"mt-3 flex items-center justify-between gap-3\">\n <Price\n amount={lineTotal}\n currency={currency}\n className={cn(\"text-sm font-semibold tabular-nums\", classNames?.itemPrice)}\n />\n <div data-cimplify-cart-item-controls className={classNames?.quantity}>\n <QuantitySelector\n value={item.quantity}\n onChange={(qty) => onQuantityChange(item.id, qty)}\n min={0}\n />\n </div>\n </div>\n </div>\n </div>\n );\n}\n\n/**\n * CartSummary — renders cart line items + totals.\n *\n * NOT a drawer or modal — just the cart content. Templates wrap this in\n * their own drawer/modal shell with animations.\n */\nexport function CartSummary({\n cart: serverCart,\n onCheckout,\n onItemRemove,\n onQuantityChange,\n emptyMessage = \"Your cart is empty\",\n showTotals = true,\n showCheckoutButton,\n className,\n classNames,\n}: CartSummaryProps): React.ReactElement {\n const {\n items,\n itemCount,\n subtotal,\n tax,\n total,\n isEmpty,\n isOptimistic,\n pendingOpCount,\n currency,\n removeItem,\n updateQuantity,\n } = useCart();\n const displayCurrency = serverCart?.currency ?? currencyCode(currency);\n\n const deliveryFee = serverCart?.delivery_fee;\n const serviceCharge = serverCart?.service_charge;\n const totalDiscounts = serverCart?.total_discounts;\n\n const handleRemove = (itemId: string) => {\n if (onItemRemove) {\n onItemRemove(itemId);\n } else {\n void removeItem(itemId);\n }\n };\n\n const handleQuantityChange = (itemId: string, qty: number) => {\n if (onQuantityChange) {\n onQuantityChange(itemId, qty);\n } else {\n void updateQuantity(itemId, qty);\n }\n };\n\n return (\n <div\n data-cimplify-cart-summary\n data-optimistic={isOptimistic ? \"true\" : undefined}\n data-pending-ops={pendingOpCount > 0 ? pendingOpCount : undefined}\n className={cn(className, classNames?.root)}\n >\n {isEmpty ? (\n <div data-cimplify-cart-empty className={classNames?.empty}>\n <p>{emptyMessage}</p>\n </div>\n ) : (\n <>\n {/* Line items */}\n <div data-cimplify-cart-items>\n {items.map((item) => (\n <CartLineItemRow\n key={item.id}\n item={item}\n onRemove={handleRemove}\n onQuantityChange={handleQuantityChange}\n currency={displayCurrency}\n classNames={classNames}\n />\n ))}\n </div>\n\n {/* Totals */}\n {showTotals && (\n <div\n data-cimplify-cart-totals\n className={cn(\n \"mt-6 pt-4 border-t border-border space-y-2 text-sm\",\n classNames?.totals,\n )}\n >\n <div\n data-cimplify-cart-subtotal\n className={cn(\"flex items-baseline justify-between\", classNames?.subtotal)}\n >\n <span className=\"text-muted-foreground\">\n Subtotal ({itemCount} {itemCount === 1 ? \"item\" : \"items\"})\n </span>\n <Price amount={subtotal} currency={displayCurrency} className=\"tabular-nums\" />\n </div>\n\n {totalDiscounts != null && parsePrice(totalDiscounts) > 0 && (\n <div\n data-cimplify-cart-discount\n className={cn(\"flex items-baseline justify-between\", classNames?.discount)}\n >\n <span className=\"text-muted-foreground\">Discount</span>\n <Price\n amount={totalDiscounts}\n currency={displayCurrency}\n prefix=\"-\"\n className=\"tabular-nums text-primary\"\n />\n </div>\n )}\n\n {deliveryFee != null && (\n <div\n data-cimplify-cart-delivery-fee\n className={cn(\"flex items-baseline justify-between\", classNames?.deliveryFee)}\n >\n <span className=\"text-muted-foreground\">Delivery</span>\n {parsePrice(deliveryFee) > 0 ? (\n <Price\n amount={deliveryFee}\n currency={displayCurrency}\n className=\"tabular-nums\"\n />\n ) : (\n <span className=\"font-medium text-primary\">Free</span>\n )}\n </div>\n )}\n\n {serviceCharge != null && parsePrice(serviceCharge) > 0 && (\n <div\n data-cimplify-cart-service-charge\n className={cn(\"flex items-baseline justify-between\", classNames?.serviceCharge)}\n >\n <span className=\"text-muted-foreground\">Service charge</span>\n <Price\n amount={serviceCharge}\n currency={displayCurrency}\n className=\"tabular-nums\"\n />\n </div>\n )}\n\n <div\n data-cimplify-cart-tax\n className={cn(\"flex items-baseline justify-between\", classNames?.tax)}\n >\n <span className=\"text-muted-foreground\">Tax</span>\n <Price amount={tax} currency={displayCurrency} className=\"tabular-nums\" />\n </div>\n\n <div\n data-cimplify-cart-total\n className={cn(\n \"flex items-baseline justify-between pt-3 mt-1 border-t border-border\",\n classNames?.total,\n )}\n >\n <span className=\"font-semibold\">Total</span>\n <Price\n amount={total}\n currency={displayCurrency}\n className=\"text-base font-bold tabular-nums\"\n />\n </div>\n </div>\n )}\n\n {(showCheckoutButton ?? Boolean(onCheckout)) && onCheckout && (\n <button\n type=\"button\"\n onClick={onCheckout}\n data-cimplify-cart-checkout\n className={cn(\n \"mt-4 w-full h-12 rounded-full bg-foreground text-background font-semibold text-sm hover:bg-foreground/90 active:scale-[0.99] transition-all\",\n classNames?.checkout,\n )}\n >\n Proceed to Checkout\n </button>\n )}\n </>\n )}\n </div>\n );\n}\n"
13
+ "content": "\"use client\";\n\nimport React from \"react\";\nimport type { UseCartItem } from \"@cimplify/sdk/react\";\nimport type { DisplayCart } from \"@cimplify/sdk\";\nimport { useCart } from \"@cimplify/sdk/react\";\nimport { getVariantDisplayName } from \"@cimplify/sdk\";\nimport { INPUT_FIELD_TYPE } from \"@cimplify/sdk\";\nimport { currencyCode, type CurrencyCode } from \"@cimplify/sdk\";\nimport { parsePrice } from \"@cimplify/sdk\";\nimport { Price } from \"@cimplify/sdk/react\";\nimport { QuantitySelector } from \"@cimplify/sdk/react\";\nimport { useProductPrice } from \"@cimplify/sdk/react\";\nimport type { InternalUseCartItem } from \"./hooks/use-cart-types\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport interface CartSummaryClassNames {\n root?: string;\n item?: string;\n itemName?: string;\n itemPrice?: string;\n quantity?: string;\n removeButton?: string;\n totals?: string;\n subtotal?: string;\n tax?: string;\n deliveryFee?: string;\n serviceCharge?: string;\n discount?: string;\n total?: string;\n checkout?: string;\n empty?: string;\n serviceInfo?: string;\n digitalInfo?: string;\n bundleBreakdown?: string;\n compositeBreakdown?: string;\n customerInputs?: string;\n}\n\nexport interface CartSummaryProps {\n /** Optional server cart for extended pricing details (delivery fee, service charge, discounts). */\n cart?: DisplayCart;\n onCheckout?: () => void;\n onItemRemove?: (itemId: string) => void;\n onQuantityChange?: (itemId: string, quantity: number) => void;\n emptyMessage?: string;\n /** Render the totals block (subtotal/tax/total) below the items. Default true. Hosts that show their own totals (drawer, page sidebar) should pass false. */\n showTotals?: boolean;\n /** Render the \"Proceed to Checkout\" button. Defaults to true if `onCheckout` is provided. */\n showCheckoutButton?: boolean;\n className?: string;\n classNames?: CartSummaryClassNames;\n}\n\nfunction CartLineItemRow({\n item,\n onRemove,\n onQuantityChange,\n currency,\n classNames,\n}: {\n item: UseCartItem;\n onRemove: (itemId: string) => void;\n onQuantityChange: (itemId: string, qty: number) => void;\n currency: CurrencyCode;\n classNames?: CartSummaryClassNames;\n}): React.ReactElement {\n const { unitPrice: locallyResolvedUnitPrice } = useProductPrice({\n product: item.product,\n variant: item.variant,\n addOnOptions: item.addOnOptions,\n });\n const pinnedUnitPrice = (item as InternalUseCartItem)._quotedUnitPrice;\n const unitPrice =\n pinnedUnitPrice === undefined ? locallyResolvedUnitPrice : parsePrice(pinnedUnitPrice);\n const hasComposite = item.compositeSelections && item.compositeSelections.length > 0;\n const hasBundle = item.bundleSelections && item.bundleSelections.length > 0;\n\n const isOptimistic = (item as { isOptimistic?: boolean }).isOptimistic === true;\n\n const lineTotal = parsePrice(unitPrice) * item.quantity;\n const imageUrl = item.product.image_url;\n const variantLabel = item.variant ? getVariantDisplayName(item.variant, item.product.name) : null;\n\n return (\n <div\n data-cimplify-cart-item\n data-optimistic={isOptimistic ? \"true\" : undefined}\n className={cn(\n \"group relative flex gap-3 py-4 border-b border-border last:border-b-0 transition-opacity\",\n isOptimistic && \"opacity-60\",\n classNames?.item,\n )}\n >\n {/* Thumbnail */}\n <div\n data-cimplify-cart-item-image\n className=\"relative w-20 h-20 shrink-0 rounded-md overflow-hidden bg-muted\"\n >\n {imageUrl ? (\n <img src={imageUrl} alt=\"\" className=\"w-full h-full object-cover\" loading=\"lazy\" />\n ) : (\n <div className=\"w-full h-full grid place-items-center text-muted-foreground/40\">\n <svg\n className=\"w-6 h-6\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 24 24\"\n aria-hidden\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z\"\n />\n </svg>\n </div>\n )}\n </div>\n\n {/* Info column */}\n <div data-cimplify-cart-item-info className=\"flex-1 min-w-0 flex flex-col\">\n <div className=\"flex items-start justify-between gap-3\">\n <h3\n data-cimplify-cart-item-name\n className={cn(\"text-sm font-medium leading-tight m-0 truncate\", classNames?.itemName)}\n >\n {item.product.name}\n </h3>\n <button\n type=\"button\"\n onClick={() => onRemove(item.id)}\n data-cimplify-cart-item-remove\n className={cn(\n \"shrink-0 -mr-1 -mt-1 grid place-items-center w-7 h-7 rounded-full text-muted-foreground/60 hover:text-foreground hover:bg-muted transition-colors\",\n classNames?.removeButton,\n )}\n aria-label={`Remove ${item.product.name}`}\n >\n <svg\n className=\"w-3.5 h-3.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n aria-hidden\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n </button>\n </div>\n\n {/* Pills row: variant, add-ons, badges */}\n {(variantLabel ||\n (item.addOnOptions && item.addOnOptions.length > 0) ||\n hasComposite ||\n hasBundle) && (\n <div data-cimplify-cart-item-pills className=\"flex flex-wrap gap-1.5 mt-1.5\">\n {variantLabel && (\n <span\n data-cimplify-cart-item-variant\n className=\"inline-flex items-center px-2 py-0.5 rounded-full bg-muted text-[11px] font-medium text-foreground\"\n >\n {variantLabel}\n </span>\n )}\n {item.addOnOptions?.map((opt) => (\n <span\n key={opt.id}\n data-cimplify-cart-item-addon\n className=\"inline-flex items-center px-2 py-0.5 rounded-full bg-muted text-[11px] font-medium text-muted-foreground\"\n >\n + {opt.name}\n </span>\n ))}\n {(hasComposite || hasBundle) && (\n <span\n data-cimplify-cart-item-badge\n className=\"inline-flex items-center px-2 py-0.5 rounded-full bg-primary/10 text-[11px] font-semibold uppercase tracking-wider text-primary\"\n >\n {hasComposite ? \"Custom\" : \"Bundle\"}\n </span>\n )}\n </div>\n )}\n\n {/* Special instructions */}\n {item.specialInstructions && (\n <p\n data-cimplify-cart-item-instructions\n className=\"mt-1.5 text-xs italic text-muted-foreground line-clamp-2\"\n >\n \\u201C{item.specialInstructions}\\u201D\n </p>\n )}\n\n {/* Customer input values */}\n {item.customerInputs && item.customerInputs.length > 0 && (\n <dl\n data-cimplify-cart-customer-inputs\n className={cn(\"mt-1.5 text-xs space-y-0.5\", classNames?.customerInputs)}\n >\n {item.customerInputs.map((input) => (\n <div key={input.field_id} data-cimplify-cart-input className=\"flex gap-1.5\">\n <dt data-cimplify-cart-input-label className=\"text-muted-foreground\">\n {input.field_name}:\n </dt>\n <dd data-cimplify-cart-input-value className=\"text-foreground m-0 truncate\">\n {input.field_type === INPUT_FIELD_TYPE.File ||\n input.field_type === INPUT_FIELD_TYPE.Image\n ? String(input.value).split(\"/\").pop() || \"Uploaded file\"\n : String(input.value)}\n </dd>\n </div>\n ))}\n </dl>\n )}\n\n {/* Service: scheduled details */}\n {(item.lineType === \"service\" || item.product.type === \"service\") &&\n item.scheduledStart && (\n <div\n data-cimplify-cart-service-info\n className={cn(\n \"mt-1.5 flex items-center gap-1.5 text-xs text-muted-foreground\",\n classNames?.serviceInfo,\n )}\n >\n <svg\n className=\"w-3.5 h-3.5 shrink-0\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n aria-hidden\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z\"\n />\n </svg>\n <span>\n {new Date(item.scheduledStart).toLocaleDateString(undefined, {\n month: \"short\",\n day: \"numeric\",\n })}{\" \"}\n at{\" \"}\n {new Date(item.scheduledStart).toLocaleTimeString([], {\n hour: \"2-digit\",\n minute: \"2-digit\",\n })}\n </span>\n {item.serviceStatus && (\n <span\n data-status={item.serviceStatus}\n className=\"ml-auto px-1.5 py-0.5 rounded-full bg-muted text-[10px] uppercase tracking-wider\"\n >\n {item.serviceStatus}\n </span>\n )}\n </div>\n )}\n\n {/* Digital: instant-delivery badge */}\n {(item.lineType === \"digital\" || item.product.type === \"digital\") && (\n <div\n data-cimplify-cart-digital-info\n className={cn(\n \"mt-1.5 flex items-center gap-1 text-xs text-muted-foreground\",\n classNames?.digitalInfo,\n )}\n >\n <svg\n className=\"w-3.5 h-3.5 shrink-0\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n aria-hidden\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M13 10V3L4 14h7v7l9-11h-7z\" />\n </svg>\n <span>Instant digital delivery</span>\n </div>\n )}\n\n {/* Bundle / composite component breakdown */}\n {(item.bundleResolved || item.compositeResolved) && (\n <ul\n data-cimplify-cart-composite-breakdown={item.compositeResolved ? \"\" : undefined}\n data-cimplify-cart-bundle-breakdown={item.bundleResolved ? \"\" : undefined}\n className={cn(\n \"mt-1.5 pl-3 border-l border-border space-y-0.5 text-xs text-muted-foreground\",\n item.compositeResolved ? classNames?.compositeBreakdown : classNames?.bundleBreakdown,\n )}\n >\n {(\n (item.bundleResolved?.selections ??\n item.compositeResolved?.selections ??\n []) as Array<{\n component_id?: string;\n product_name?: string;\n component_name?: string;\n quantity: number;\n product_type?: string;\n }>\n ).map((sel) => {\n const name = sel.product_name ?? sel.component_name ?? \"\";\n const compId = sel.component_id ?? `${name}-${sel.quantity}`;\n return (\n <li\n key={compId}\n data-product-type={sel.product_type}\n className=\"flex items-baseline gap-1.5 m-0\"\n >\n <span className=\"font-medium text-foreground/80\">{sel.quantity}\\u00D7</span>\n <span className=\"truncate\">{name}</span>\n </li>\n );\n })}\n </ul>\n )}\n\n {/* Bottom row: line price + qty stepper */}\n <div className=\"mt-3 flex items-center justify-between gap-3\">\n <Price\n amount={lineTotal}\n currency={currency}\n className={cn(\"text-sm font-semibold tabular-nums\", classNames?.itemPrice)}\n />\n <div data-cimplify-cart-item-controls className={classNames?.quantity}>\n <QuantitySelector\n value={item.quantity}\n onChange={(qty) => onQuantityChange(item.id, qty)}\n min={0}\n />\n </div>\n </div>\n </div>\n </div>\n );\n}\n\n/**\n * CartSummary — renders cart line items + totals.\n *\n * NOT a drawer or modal — just the cart content. Templates wrap this in\n * their own drawer/modal shell with animations.\n */\nexport function CartSummary({\n cart: serverCart,\n onCheckout,\n onItemRemove,\n onQuantityChange,\n emptyMessage = \"Your cart is empty\",\n showTotals = true,\n showCheckoutButton,\n className,\n classNames,\n}: CartSummaryProps): React.ReactElement {\n const {\n items,\n itemCount,\n subtotal,\n tax,\n taxRate,\n taxInclusive,\n taxJurisdictionLabel,\n total,\n isEmpty,\n isOptimistic,\n pendingOpCount,\n currency,\n removeItem,\n updateQuantity,\n } = useCart();\n const displayCurrency = serverCart?.currency ?? currencyCode(currency);\n\n const deliveryFee = serverCart?.delivery_fee;\n const serviceCharge = serverCart?.service_charge;\n const totalDiscounts = serverCart?.total_discounts;\n\n const handleRemove = (itemId: string) => {\n if (onItemRemove) {\n onItemRemove(itemId);\n } else {\n void removeItem(itemId);\n }\n };\n\n const handleQuantityChange = (itemId: string, qty: number) => {\n if (onQuantityChange) {\n onQuantityChange(itemId, qty);\n } else {\n void updateQuantity(itemId, qty);\n }\n };\n\n return (\n <div\n data-cimplify-cart-summary\n data-optimistic={isOptimistic ? \"true\" : undefined}\n data-pending-ops={pendingOpCount > 0 ? pendingOpCount : undefined}\n className={cn(className, classNames?.root)}\n >\n {isEmpty ? (\n <div data-cimplify-cart-empty className={classNames?.empty}>\n <p>{emptyMessage}</p>\n </div>\n ) : (\n <>\n {/* Line items */}\n <div data-cimplify-cart-items>\n {items.map((item) => (\n <CartLineItemRow\n key={item.id}\n item={item}\n onRemove={handleRemove}\n onQuantityChange={handleQuantityChange}\n currency={displayCurrency}\n classNames={classNames}\n />\n ))}\n </div>\n\n {/* Totals */}\n {showTotals && (\n <div\n data-cimplify-cart-totals\n className={cn(\n \"mt-6 pt-4 border-t border-border space-y-2 text-sm\",\n classNames?.totals,\n )}\n >\n <div\n data-cimplify-cart-subtotal\n className={cn(\"flex items-baseline justify-between\", classNames?.subtotal)}\n >\n <span className=\"text-muted-foreground\">\n Subtotal ({itemCount} {itemCount === 1 ? \"item\" : \"items\"})\n </span>\n <Price amount={subtotal} currency={displayCurrency} className=\"tabular-nums\" />\n </div>\n\n {totalDiscounts != null && parsePrice(totalDiscounts) > 0 && (\n <div\n data-cimplify-cart-discount\n className={cn(\"flex items-baseline justify-between\", classNames?.discount)}\n >\n <span className=\"text-muted-foreground\">Discount</span>\n <Price\n amount={totalDiscounts}\n currency={displayCurrency}\n prefix=\"-\"\n className=\"tabular-nums text-primary\"\n />\n </div>\n )}\n\n {deliveryFee != null && (\n <div\n data-cimplify-cart-delivery-fee\n className={cn(\"flex items-baseline justify-between\", classNames?.deliveryFee)}\n >\n <span className=\"text-muted-foreground\">Delivery</span>\n {parsePrice(deliveryFee) > 0 ? (\n <Price\n amount={deliveryFee}\n currency={displayCurrency}\n className=\"tabular-nums\"\n />\n ) : (\n <span className=\"font-medium text-primary\">Free</span>\n )}\n </div>\n )}\n\n {serviceCharge != null && parsePrice(serviceCharge) > 0 && (\n <div\n data-cimplify-cart-service-charge\n className={cn(\"flex items-baseline justify-between\", classNames?.serviceCharge)}\n >\n <span className=\"text-muted-foreground\">Service charge</span>\n <Price\n amount={serviceCharge}\n currency={displayCurrency}\n className=\"tabular-nums\"\n />\n </div>\n )}\n\n <div\n data-cimplify-cart-tax\n className={cn(\"flex items-baseline justify-between\", classNames?.tax)}\n >\n <span className=\"flex items-baseline gap-1.5 text-muted-foreground\">\n {taxInclusive\n ? \"Tax, included in prices\"\n : taxJurisdictionLabel\n ? `Sales tax, ${taxJurisdictionLabel}`\n : \"Sales tax\"}\n {taxRate != null && taxRate > 0 && (\n <span className=\"rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-medium\">\n {taxRate}%\n </span>\n )}\n </span>\n <Price amount={tax} currency={displayCurrency} className=\"tabular-nums\" />\n </div>\n\n <div\n data-cimplify-cart-total\n className={cn(\n \"flex items-baseline justify-between pt-3 mt-1 border-t border-border\",\n classNames?.total,\n )}\n >\n <span className=\"font-semibold\">Total</span>\n <Price\n amount={total}\n currency={displayCurrency}\n className=\"text-base font-bold tabular-nums\"\n />\n </div>\n </div>\n )}\n\n {(showCheckoutButton ?? Boolean(onCheckout)) && onCheckout && (\n <button\n type=\"button\"\n onClick={onCheckout}\n data-cimplify-cart-checkout\n className={cn(\n \"mt-4 w-full h-12 rounded-full bg-foreground text-background font-semibold text-sm hover:bg-foreground/90 active:scale-[0.99] transition-all\",\n classNames?.checkout,\n )}\n >\n Proceed to Checkout\n </button>\n )}\n </>\n )}\n </div>\n );\n}\n"
14
14
  }
15
15
  ]
16
16
  }