@cimplify/sdk 0.75.0 → 0.78.0

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 (49) hide show
  1. package/dist/advanced.d.mts +3 -3
  2. package/dist/advanced.d.ts +3 -3
  3. package/dist/{chunk-OGQFDCZM.js → chunk-2SJUHD32.js} +24 -11
  4. package/dist/{chunk-BYWJSPT4.mjs → chunk-7EYA527E.mjs} +5 -2
  5. package/dist/{chunk-Y64AIRGW.js → chunk-EIJKO43W.js} +6 -3
  6. package/dist/{chunk-J7L5LHGK.mjs → chunk-XRJCLWJ2.mjs} +24 -11
  7. package/dist/{client-xDpke-KS.d.ts → client-B1ix2-Og.d.mts} +11 -4
  8. package/dist/{client-yFghjc1-.d.mts → client-BFuRYjAL.d.mts} +2 -2
  9. package/dist/{client--w53owD4.d.ts → client-BW82Vq-p.d.ts} +2 -2
  10. package/dist/{client-D7uHF_jh.d.mts → client-DxW_uHll.d.ts} +11 -4
  11. package/dist/{index-lt-fe29V.d.mts → index-Bu76UyFz.d.mts} +3 -3
  12. package/dist/{index-DTGS0QC1.d.ts → index-Moe4cGMB.d.ts} +3 -3
  13. package/dist/index.d.mts +6 -6
  14. package/dist/index.d.ts +6 -6
  15. package/dist/mock/cli.mjs +24 -11
  16. package/dist/mock/library.js +24 -11
  17. package/dist/mock/library.mjs +24 -11
  18. package/dist/mock/msw.js +24 -11
  19. package/dist/mock/msw.mjs +24 -11
  20. package/dist/{payment-C-2gApyQ.d.mts → payment-B7qzWdaJ.d.mts} +1 -1
  21. package/dist/{payment-CfemTORM.d.ts → payment-mVIJIJcq.d.ts} +1 -1
  22. package/dist/{price-CZBQw-Rh.d.mts → price-BfOaGqjx.d.mts} +1 -1
  23. package/dist/{price-DNeyoO7y.d.ts → price-CS1IsORZ.d.ts} +1 -1
  24. package/dist/{product-_GFoaPHU.d.mts → product-BgFOFmQw.d.mts} +7 -0
  25. package/dist/{product-_GFoaPHU.d.ts → product-BgFOFmQw.d.ts} +7 -0
  26. package/dist/react.d.mts +4 -4
  27. package/dist/react.d.ts +4 -4
  28. package/dist/react.js +5 -1
  29. package/dist/react.mjs +5 -1
  30. package/dist/{server-G8I4JtqK.d.mts → server-CGO4zneR.d.mts} +1 -1
  31. package/dist/{server-1hXIXH2k.d.ts → server-Daq42vK7.d.ts} +1 -1
  32. package/dist/server.d.mts +4 -4
  33. package/dist/server.d.ts +4 -4
  34. package/dist/testing/msw.d.mts +2 -2
  35. package/dist/testing/msw.d.ts +2 -2
  36. package/dist/testing/msw.js +2 -2
  37. package/dist/testing/msw.mjs +1 -1
  38. package/dist/testing/suite.d.mts +6 -6
  39. package/dist/testing/suite.d.ts +6 -6
  40. package/dist/testing/suite.js +21 -21
  41. package/dist/testing/suite.mjs +2 -2
  42. package/dist/testing.d.mts +20 -5
  43. package/dist/testing.d.ts +20 -5
  44. package/dist/testing.js +77 -77
  45. package/dist/testing.mjs +3 -3
  46. package/dist/utils.d.mts +4 -4
  47. package/dist/utils.d.ts +4 -4
  48. package/package.json +1 -1
  49. package/registry/order-summary.json +1 -1
@@ -1,10 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import { $ZodType } from 'zod/v4/core';
3
- export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-yFghjc1-.mjs';
4
- import './client-D7uHF_jh.mjs';
5
- import './product-_GFoaPHU.mjs';
6
- import './payment-C-2gApyQ.mjs';
7
- import './server-G8I4JtqK.mjs';
3
+ export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-BFuRYjAL.mjs';
4
+ import './client-B1ix2-Og.mjs';
5
+ import './product-BgFOFmQw.mjs';
6
+ import './payment-B7qzWdaJ.mjs';
7
+ import './server-CGO4zneR.mjs';
8
8
  import 'hono';
9
9
 
10
10
  /**
@@ -1065,6 +1065,9 @@ declare const CartPricingSchema: z.ZodObject<{
1065
1065
  currency: z.ZodString;
1066
1066
  tax_rate: z.ZodOptional<z.ZodString>;
1067
1067
  service_charge_rate: z.ZodOptional<z.ZodString>;
1068
+ tax_inclusive: z.ZodBoolean;
1069
+ deposit_required: z.ZodBoolean;
1070
+ deposit_amount: z.ZodString;
1068
1071
  }, z.core.$strip>;
1069
1072
  declare const CartSchema: z.ZodObject<{
1070
1073
  id: z.ZodString;
@@ -1223,6 +1226,9 @@ declare const CartSchema: z.ZodObject<{
1223
1226
  currency: z.ZodString;
1224
1227
  tax_rate: z.ZodOptional<z.ZodString>;
1225
1228
  service_charge_rate: z.ZodOptional<z.ZodString>;
1229
+ tax_inclusive: z.ZodBoolean;
1230
+ deposit_required: z.ZodBoolean;
1231
+ deposit_amount: z.ZodString;
1226
1232
  }, z.core.$strip>;
1227
1233
  customer_info: z.ZodObject<{
1228
1234
  name: z.ZodString;
@@ -1386,6 +1392,9 @@ declare const assertCart: (value: unknown) => asserts value is {
1386
1392
  service_charge: string;
1387
1393
  total_price: string;
1388
1394
  currency: string;
1395
+ tax_inclusive: boolean;
1396
+ deposit_required: boolean;
1397
+ deposit_amount: string;
1389
1398
  tax_rate?: string | undefined;
1390
1399
  service_charge_rate?: string | undefined;
1391
1400
  };
@@ -1932,6 +1941,9 @@ declare const PUBLIC_SCHEMAS: {
1932
1941
  currency: z.ZodString;
1933
1942
  tax_rate: z.ZodOptional<z.ZodString>;
1934
1943
  service_charge_rate: z.ZodOptional<z.ZodString>;
1944
+ tax_inclusive: z.ZodBoolean;
1945
+ deposit_required: z.ZodBoolean;
1946
+ deposit_amount: z.ZodString;
1935
1947
  }, z.core.$strip>;
1936
1948
  customer_info: z.ZodObject<{
1937
1949
  name: z.ZodString;
@@ -2100,6 +2112,9 @@ declare const PUBLIC_SCHEMAS: {
2100
2112
  currency: z.ZodString;
2101
2113
  tax_rate: z.ZodOptional<z.ZodString>;
2102
2114
  service_charge_rate: z.ZodOptional<z.ZodString>;
2115
+ tax_inclusive: z.ZodBoolean;
2116
+ deposit_required: z.ZodBoolean;
2117
+ deposit_amount: z.ZodString;
2103
2118
  }, z.core.$strip>;
2104
2119
  readonly CheckoutBody: z.ZodObject<{
2105
2120
  cart_id: z.ZodString;
package/dist/testing.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import { $ZodType } from 'zod/v4/core';
3
- export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client--w53owD4.js';
4
- import './client-xDpke-KS.js';
5
- import './product-_GFoaPHU.js';
6
- import './payment-CfemTORM.js';
7
- import './server-1hXIXH2k.js';
3
+ export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-BW82Vq-p.js';
4
+ import './client-DxW_uHll.js';
5
+ import './product-BgFOFmQw.js';
6
+ import './payment-mVIJIJcq.js';
7
+ import './server-Daq42vK7.js';
8
8
  import 'hono';
9
9
 
10
10
  /**
@@ -1065,6 +1065,9 @@ declare const CartPricingSchema: z.ZodObject<{
1065
1065
  currency: z.ZodString;
1066
1066
  tax_rate: z.ZodOptional<z.ZodString>;
1067
1067
  service_charge_rate: z.ZodOptional<z.ZodString>;
1068
+ tax_inclusive: z.ZodBoolean;
1069
+ deposit_required: z.ZodBoolean;
1070
+ deposit_amount: z.ZodString;
1068
1071
  }, z.core.$strip>;
1069
1072
  declare const CartSchema: z.ZodObject<{
1070
1073
  id: z.ZodString;
@@ -1223,6 +1226,9 @@ declare const CartSchema: z.ZodObject<{
1223
1226
  currency: z.ZodString;
1224
1227
  tax_rate: z.ZodOptional<z.ZodString>;
1225
1228
  service_charge_rate: z.ZodOptional<z.ZodString>;
1229
+ tax_inclusive: z.ZodBoolean;
1230
+ deposit_required: z.ZodBoolean;
1231
+ deposit_amount: z.ZodString;
1226
1232
  }, z.core.$strip>;
1227
1233
  customer_info: z.ZodObject<{
1228
1234
  name: z.ZodString;
@@ -1386,6 +1392,9 @@ declare const assertCart: (value: unknown) => asserts value is {
1386
1392
  service_charge: string;
1387
1393
  total_price: string;
1388
1394
  currency: string;
1395
+ tax_inclusive: boolean;
1396
+ deposit_required: boolean;
1397
+ deposit_amount: string;
1389
1398
  tax_rate?: string | undefined;
1390
1399
  service_charge_rate?: string | undefined;
1391
1400
  };
@@ -1932,6 +1941,9 @@ declare const PUBLIC_SCHEMAS: {
1932
1941
  currency: z.ZodString;
1933
1942
  tax_rate: z.ZodOptional<z.ZodString>;
1934
1943
  service_charge_rate: z.ZodOptional<z.ZodString>;
1944
+ tax_inclusive: z.ZodBoolean;
1945
+ deposit_required: z.ZodBoolean;
1946
+ deposit_amount: z.ZodString;
1935
1947
  }, z.core.$strip>;
1936
1948
  customer_info: z.ZodObject<{
1937
1949
  name: z.ZodString;
@@ -2100,6 +2112,9 @@ declare const PUBLIC_SCHEMAS: {
2100
2112
  currency: z.ZodString;
2101
2113
  tax_rate: z.ZodOptional<z.ZodString>;
2102
2114
  service_charge_rate: z.ZodOptional<z.ZodString>;
2115
+ tax_inclusive: z.ZodBoolean;
2116
+ deposit_required: z.ZodBoolean;
2117
+ deposit_amount: z.ZodString;
2103
2118
  }, z.core.$strip>;
2104
2119
  readonly CheckoutBody: z.ZodObject<{
2105
2120
  cart_id: z.ZodString;
package/dist/testing.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkY64AIRGW_js = require('./chunk-Y64AIRGW.js');
4
- require('./chunk-OGQFDCZM.js');
3
+ var chunkEIJKO43W_js = require('./chunk-EIJKO43W.js');
4
+ require('./chunk-2SJUHD32.js');
5
5
  require('./chunk-QS4XDVHI.js');
6
6
  require('./chunk-CV5QMDQS.js');
7
7
  require('./chunk-7Y2O3E4D.js');
@@ -10,20 +10,20 @@ require('./chunk-OWW5GUSB.js');
10
10
  var zod = require('zod');
11
11
 
12
12
  var PUBLIC_SCHEMAS = {
13
- Brand: chunkY64AIRGW_js.BrandSchema,
14
- AddItemPayload: chunkY64AIRGW_js.AddItemPayloadSchema,
15
- Cart: chunkY64AIRGW_js.CartSchema,
16
- CartItem: chunkY64AIRGW_js.CartItemSchema,
17
- CartPricing: chunkY64AIRGW_js.CartPricingSchema,
18
- CheckoutBody: chunkY64AIRGW_js.CheckoutBodySchema,
19
- CheckoutResponse: chunkY64AIRGW_js.CheckoutResponseSchema,
20
- VariantInfo: chunkY64AIRGW_js.VariantInfoSchema
13
+ Brand: chunkEIJKO43W_js.BrandSchema,
14
+ AddItemPayload: chunkEIJKO43W_js.AddItemPayloadSchema,
15
+ Cart: chunkEIJKO43W_js.CartSchema,
16
+ CartItem: chunkEIJKO43W_js.CartItemSchema,
17
+ CartPricing: chunkEIJKO43W_js.CartPricingSchema,
18
+ CheckoutBody: chunkEIJKO43W_js.CheckoutBodySchema,
19
+ CheckoutResponse: chunkEIJKO43W_js.CheckoutResponseSchema,
20
+ VariantInfo: chunkEIJKO43W_js.VariantInfoSchema
21
21
  };
22
22
  function exportJsonSchemas() {
23
23
  const out = {};
24
24
  for (const [name, schema] of Object.entries(PUBLIC_SCHEMAS)) {
25
- const meta = chunkY64AIRGW_js.cimplifyRegistry.get(schema);
26
- const json = zod.z.toJSONSchema(schema, { metadata: chunkY64AIRGW_js.cimplifyRegistry });
25
+ const meta = chunkEIJKO43W_js.cimplifyRegistry.get(schema);
26
+ const json = zod.z.toJSONSchema(schema, { metadata: chunkEIJKO43W_js.cimplifyRegistry });
27
27
  if (meta) {
28
28
  json.$id = meta.id;
29
29
  json["x-cimplify-version"] = meta.version;
@@ -35,16 +35,16 @@ function exportJsonSchemas() {
35
35
  function listRegisteredSchemas() {
36
36
  const entries = [];
37
37
  for (const schema of [
38
- chunkY64AIRGW_js.BrandSchema,
39
- chunkY64AIRGW_js.AddItemPayloadSchema,
40
- chunkY64AIRGW_js.CartSchema,
41
- chunkY64AIRGW_js.CartItemSchema,
42
- chunkY64AIRGW_js.CartPricingSchema,
43
- chunkY64AIRGW_js.CheckoutBodySchema,
44
- chunkY64AIRGW_js.CheckoutResponseSchema,
45
- chunkY64AIRGW_js.VariantInfoSchema
38
+ chunkEIJKO43W_js.BrandSchema,
39
+ chunkEIJKO43W_js.AddItemPayloadSchema,
40
+ chunkEIJKO43W_js.CartSchema,
41
+ chunkEIJKO43W_js.CartItemSchema,
42
+ chunkEIJKO43W_js.CartPricingSchema,
43
+ chunkEIJKO43W_js.CheckoutBodySchema,
44
+ chunkEIJKO43W_js.CheckoutResponseSchema,
45
+ chunkEIJKO43W_js.VariantInfoSchema
46
46
  ]) {
47
- const meta = chunkY64AIRGW_js.cimplifyRegistry.get(schema);
47
+ const meta = chunkEIJKO43W_js.cimplifyRegistry.get(schema);
48
48
  if (meta) entries.push({ schema, meta });
49
49
  }
50
50
  return entries;
@@ -52,227 +52,227 @@ function listRegisteredSchemas() {
52
52
 
53
53
  Object.defineProperty(exports, "AddItemPayloadSchema", {
54
54
  enumerable: true,
55
- get: function () { return chunkY64AIRGW_js.AddItemPayloadSchema; }
55
+ get: function () { return chunkEIJKO43W_js.AddItemPayloadSchema; }
56
56
  });
57
57
  Object.defineProperty(exports, "AddOnDetailsSchema", {
58
58
  enumerable: true,
59
- get: function () { return chunkY64AIRGW_js.AddOnDetailsSchema; }
59
+ get: function () { return chunkEIJKO43W_js.AddOnDetailsSchema; }
60
60
  });
61
61
  Object.defineProperty(exports, "AddOnGroupDetailsSchema", {
62
62
  enumerable: true,
63
- get: function () { return chunkY64AIRGW_js.AddOnGroupDetailsSchema; }
63
+ get: function () { return chunkEIJKO43W_js.AddOnGroupDetailsSchema; }
64
64
  });
65
65
  Object.defineProperty(exports, "AddOnInDetailsSchema", {
66
66
  enumerable: true,
67
- get: function () { return chunkY64AIRGW_js.AddOnInDetailsSchema; }
67
+ get: function () { return chunkEIJKO43W_js.AddOnInDetailsSchema; }
68
68
  });
69
69
  Object.defineProperty(exports, "AddOnOptionDetailsSchema", {
70
70
  enumerable: true,
71
- get: function () { return chunkY64AIRGW_js.AddOnOptionDetailsSchema; }
71
+ get: function () { return chunkEIJKO43W_js.AddOnOptionDetailsSchema; }
72
72
  });
73
73
  Object.defineProperty(exports, "AuthorizationTypeSchema", {
74
74
  enumerable: true,
75
- get: function () { return chunkY64AIRGW_js.AuthorizationTypeSchema; }
75
+ get: function () { return chunkEIJKO43W_js.AuthorizationTypeSchema; }
76
76
  });
77
77
  Object.defineProperty(exports, "BrandContactSchema", {
78
78
  enumerable: true,
79
- get: function () { return chunkY64AIRGW_js.BrandContactSchema; }
79
+ get: function () { return chunkEIJKO43W_js.BrandContactSchema; }
80
80
  });
81
81
  Object.defineProperty(exports, "BrandFaqSchema", {
82
82
  enumerable: true,
83
- get: function () { return chunkY64AIRGW_js.BrandFaqSchema; }
83
+ get: function () { return chunkEIJKO43W_js.BrandFaqSchema; }
84
84
  });
85
85
  Object.defineProperty(exports, "BrandHeroSchema", {
86
86
  enumerable: true,
87
- get: function () { return chunkY64AIRGW_js.BrandHeroSchema; }
87
+ get: function () { return chunkEIJKO43W_js.BrandHeroSchema; }
88
88
  });
89
89
  Object.defineProperty(exports, "BrandNavLinkSchema", {
90
90
  enumerable: true,
91
- get: function () { return chunkY64AIRGW_js.BrandNavLinkSchema; }
91
+ get: function () { return chunkEIJKO43W_js.BrandNavLinkSchema; }
92
92
  });
93
93
  Object.defineProperty(exports, "BrandPolicyPageSchema", {
94
94
  enumerable: true,
95
- get: function () { return chunkY64AIRGW_js.BrandPolicyPageSchema; }
95
+ get: function () { return chunkEIJKO43W_js.BrandPolicyPageSchema; }
96
96
  });
97
97
  Object.defineProperty(exports, "BrandPolicySectionSchema", {
98
98
  enumerable: true,
99
- get: function () { return chunkY64AIRGW_js.BrandPolicySectionSchema; }
99
+ get: function () { return chunkEIJKO43W_js.BrandPolicySectionSchema; }
100
100
  });
101
101
  Object.defineProperty(exports, "BrandSchema", {
102
102
  enumerable: true,
103
- get: function () { return chunkY64AIRGW_js.BrandSchema; }
103
+ get: function () { return chunkEIJKO43W_js.BrandSchema; }
104
104
  });
105
105
  Object.defineProperty(exports, "BrandSocialSchema", {
106
106
  enumerable: true,
107
- get: function () { return chunkY64AIRGW_js.BrandSocialSchema; }
107
+ get: function () { return chunkEIJKO43W_js.BrandSocialSchema; }
108
108
  });
109
109
  Object.defineProperty(exports, "BundleResolvedSchema", {
110
110
  enumerable: true,
111
- get: function () { return chunkY64AIRGW_js.BundleResolvedSchema; }
111
+ get: function () { return chunkEIJKO43W_js.BundleResolvedSchema; }
112
112
  });
113
113
  Object.defineProperty(exports, "BundleSelectionInputSchema", {
114
114
  enumerable: true,
115
- get: function () { return chunkY64AIRGW_js.BundleSelectionInputSchema; }
115
+ get: function () { return chunkEIJKO43W_js.BundleSelectionInputSchema; }
116
116
  });
117
117
  Object.defineProperty(exports, "CartItemSchema", {
118
118
  enumerable: true,
119
- get: function () { return chunkY64AIRGW_js.CartItemSchema; }
119
+ get: function () { return chunkEIJKO43W_js.CartItemSchema; }
120
120
  });
121
121
  Object.defineProperty(exports, "CartPricingSchema", {
122
122
  enumerable: true,
123
- get: function () { return chunkY64AIRGW_js.CartPricingSchema; }
123
+ get: function () { return chunkEIJKO43W_js.CartPricingSchema; }
124
124
  });
125
125
  Object.defineProperty(exports, "CartSchema", {
126
126
  enumerable: true,
127
- get: function () { return chunkY64AIRGW_js.CartSchema; }
127
+ get: function () { return chunkEIJKO43W_js.CartSchema; }
128
128
  });
129
129
  Object.defineProperty(exports, "CheckoutBodySchema", {
130
130
  enumerable: true,
131
- get: function () { return chunkY64AIRGW_js.CheckoutBodySchema; }
131
+ get: function () { return chunkEIJKO43W_js.CheckoutBodySchema; }
132
132
  });
133
133
  Object.defineProperty(exports, "CheckoutCustomerSchema", {
134
134
  enumerable: true,
135
- get: function () { return chunkY64AIRGW_js.CheckoutCustomerSchema; }
135
+ get: function () { return chunkEIJKO43W_js.CheckoutCustomerSchema; }
136
136
  });
137
137
  Object.defineProperty(exports, "CheckoutResponseSchema", {
138
138
  enumerable: true,
139
- get: function () { return chunkY64AIRGW_js.CheckoutResponseSchema; }
139
+ get: function () { return chunkEIJKO43W_js.CheckoutResponseSchema; }
140
140
  });
141
141
  Object.defineProperty(exports, "ChosenPriceSchema", {
142
142
  enumerable: true,
143
- get: function () { return chunkY64AIRGW_js.ChosenPriceSchema; }
143
+ get: function () { return chunkEIJKO43W_js.ChosenPriceSchema; }
144
144
  });
145
145
  Object.defineProperty(exports, "CompositeResolvedSchema", {
146
146
  enumerable: true,
147
- get: function () { return chunkY64AIRGW_js.CompositeResolvedSchema; }
147
+ get: function () { return chunkEIJKO43W_js.CompositeResolvedSchema; }
148
148
  });
149
149
  Object.defineProperty(exports, "CompositeSelectionInputSchema", {
150
150
  enumerable: true,
151
- get: function () { return chunkY64AIRGW_js.CompositeSelectionInputSchema; }
151
+ get: function () { return chunkEIJKO43W_js.CompositeSelectionInputSchema; }
152
152
  });
153
153
  Object.defineProperty(exports, "CountryCodeSchema", {
154
154
  enumerable: true,
155
- get: function () { return chunkY64AIRGW_js.CountryCodeSchema; }
155
+ get: function () { return chunkEIJKO43W_js.CountryCodeSchema; }
156
156
  });
157
157
  Object.defineProperty(exports, "CurrencyCodeSchema", {
158
158
  enumerable: true,
159
- get: function () { return chunkY64AIRGW_js.CurrencyCodeSchema; }
159
+ get: function () { return chunkEIJKO43W_js.CurrencyCodeSchema; }
160
160
  });
161
161
  Object.defineProperty(exports, "CustomerInputValueSchema", {
162
162
  enumerable: true,
163
- get: function () { return chunkY64AIRGW_js.CustomerInputValueSchema; }
163
+ get: function () { return chunkEIJKO43W_js.CustomerInputValueSchema; }
164
164
  });
165
165
  Object.defineProperty(exports, "DiscountDetailsSchema", {
166
166
  enumerable: true,
167
- get: function () { return chunkY64AIRGW_js.DiscountDetailsSchema; }
167
+ get: function () { return chunkEIJKO43W_js.DiscountDetailsSchema; }
168
168
  });
169
169
  Object.defineProperty(exports, "IsoDateTimeSchema", {
170
170
  enumerable: true,
171
- get: function () { return chunkY64AIRGW_js.IsoDateTimeSchema; }
171
+ get: function () { return chunkEIJKO43W_js.IsoDateTimeSchema; }
172
172
  });
173
173
  Object.defineProperty(exports, "LineTypeSchema", {
174
174
  enumerable: true,
175
- get: function () { return chunkY64AIRGW_js.LineTypeSchema; }
175
+ get: function () { return chunkEIJKO43W_js.LineTypeSchema; }
176
176
  });
177
177
  Object.defineProperty(exports, "LocaleSchema", {
178
178
  enumerable: true,
179
- get: function () { return chunkY64AIRGW_js.LocaleSchema; }
179
+ get: function () { return chunkEIJKO43W_js.LocaleSchema; }
180
180
  });
181
181
  Object.defineProperty(exports, "MoneyLooseSchema", {
182
182
  enumerable: true,
183
- get: function () { return chunkY64AIRGW_js.MoneyLooseSchema; }
183
+ get: function () { return chunkEIJKO43W_js.MoneyLooseSchema; }
184
184
  });
185
185
  Object.defineProperty(exports, "MoneySchema", {
186
186
  enumerable: true,
187
- get: function () { return chunkY64AIRGW_js.MoneySchema; }
187
+ get: function () { return chunkEIJKO43W_js.MoneySchema; }
188
188
  });
189
189
  Object.defineProperty(exports, "NextActionSchema", {
190
190
  enumerable: true,
191
- get: function () { return chunkY64AIRGW_js.NextActionSchema; }
191
+ get: function () { return chunkEIJKO43W_js.NextActionSchema; }
192
192
  });
193
193
  Object.defineProperty(exports, "PhoneE164Schema", {
194
194
  enumerable: true,
195
- get: function () { return chunkY64AIRGW_js.PhoneE164Schema; }
195
+ get: function () { return chunkEIJKO43W_js.PhoneE164Schema; }
196
196
  });
197
197
  Object.defineProperty(exports, "ProductTypeSchema", {
198
198
  enumerable: true,
199
- get: function () { return chunkY64AIRGW_js.ProductTypeSchema; }
199
+ get: function () { return chunkEIJKO43W_js.ProductTypeSchema; }
200
200
  });
201
201
  Object.defineProperty(exports, "SchemaViolationError", {
202
202
  enumerable: true,
203
- get: function () { return chunkY64AIRGW_js.SchemaViolationError; }
203
+ get: function () { return chunkEIJKO43W_js.SchemaViolationError; }
204
204
  });
205
205
  Object.defineProperty(exports, "SeedNameSchema", {
206
206
  enumerable: true,
207
- get: function () { return chunkY64AIRGW_js.SeedNameSchema; }
207
+ get: function () { return chunkEIJKO43W_js.SeedNameSchema; }
208
208
  });
209
209
  Object.defineProperty(exports, "SelectedAddOnOptionSchema", {
210
210
  enumerable: true,
211
- get: function () { return chunkY64AIRGW_js.SelectedAddOnOptionSchema; }
211
+ get: function () { return chunkEIJKO43W_js.SelectedAddOnOptionSchema; }
212
212
  });
213
213
  Object.defineProperty(exports, "ServiceStatusSchema", {
214
214
  enumerable: true,
215
- get: function () { return chunkY64AIRGW_js.ServiceStatusSchema; }
215
+ get: function () { return chunkEIJKO43W_js.ServiceStatusSchema; }
216
216
  });
217
217
  Object.defineProperty(exports, "TimestampSchema", {
218
218
  enumerable: true,
219
- get: function () { return chunkY64AIRGW_js.TimestampSchema; }
219
+ get: function () { return chunkEIJKO43W_js.TimestampSchema; }
220
220
  });
221
221
  Object.defineProperty(exports, "VariantDetailsSchema", {
222
222
  enumerable: true,
223
- get: function () { return chunkY64AIRGW_js.VariantDetailsSchema; }
223
+ get: function () { return chunkEIJKO43W_js.VariantDetailsSchema; }
224
224
  });
225
225
  Object.defineProperty(exports, "VariantDisplayAttributeSchema", {
226
226
  enumerable: true,
227
- get: function () { return chunkY64AIRGW_js.VariantDisplayAttributeSchema; }
227
+ get: function () { return chunkEIJKO43W_js.VariantDisplayAttributeSchema; }
228
228
  });
229
229
  Object.defineProperty(exports, "VariantInfoSchema", {
230
230
  enumerable: true,
231
- get: function () { return chunkY64AIRGW_js.VariantInfoSchema; }
231
+ get: function () { return chunkEIJKO43W_js.VariantInfoSchema; }
232
232
  });
233
233
  Object.defineProperty(exports, "assertAddItemPayload", {
234
234
  enumerable: true,
235
- get: function () { return chunkY64AIRGW_js.assertAddItemPayload; }
235
+ get: function () { return chunkEIJKO43W_js.assertAddItemPayload; }
236
236
  });
237
237
  Object.defineProperty(exports, "assertBrand", {
238
238
  enumerable: true,
239
- get: function () { return chunkY64AIRGW_js.assertBrand; }
239
+ get: function () { return chunkEIJKO43W_js.assertBrand; }
240
240
  });
241
241
  Object.defineProperty(exports, "assertCart", {
242
242
  enumerable: true,
243
- get: function () { return chunkY64AIRGW_js.assertCart; }
243
+ get: function () { return chunkEIJKO43W_js.assertCart; }
244
244
  });
245
245
  Object.defineProperty(exports, "assertCartItem", {
246
246
  enumerable: true,
247
- get: function () { return chunkY64AIRGW_js.assertCartItem; }
247
+ get: function () { return chunkEIJKO43W_js.assertCartItem; }
248
248
  });
249
249
  Object.defineProperty(exports, "assertCheckoutBody", {
250
250
  enumerable: true,
251
- get: function () { return chunkY64AIRGW_js.assertCheckoutBody; }
251
+ get: function () { return chunkEIJKO43W_js.assertCheckoutBody; }
252
252
  });
253
253
  Object.defineProperty(exports, "assertCheckoutResponse", {
254
254
  enumerable: true,
255
- get: function () { return chunkY64AIRGW_js.assertCheckoutResponse; }
255
+ get: function () { return chunkEIJKO43W_js.assertCheckoutResponse; }
256
256
  });
257
257
  Object.defineProperty(exports, "cimplifyRegistry", {
258
258
  enumerable: true,
259
- get: function () { return chunkY64AIRGW_js.cimplifyRegistry; }
259
+ get: function () { return chunkEIJKO43W_js.cimplifyRegistry; }
260
260
  });
261
261
  Object.defineProperty(exports, "createTestClient", {
262
262
  enumerable: true,
263
- get: function () { return chunkY64AIRGW_js.createTestClient; }
263
+ get: function () { return chunkEIJKO43W_js.createTestClient; }
264
264
  });
265
265
  Object.defineProperty(exports, "fixtures", {
266
266
  enumerable: true,
267
- get: function () { return chunkY64AIRGW_js.fixtures; }
267
+ get: function () { return chunkEIJKO43W_js.fixtures; }
268
268
  });
269
269
  Object.defineProperty(exports, "makeAssertion", {
270
270
  enumerable: true,
271
- get: function () { return chunkY64AIRGW_js.makeAssertion; }
271
+ get: function () { return chunkEIJKO43W_js.makeAssertion; }
272
272
  });
273
273
  Object.defineProperty(exports, "registerSchema", {
274
274
  enumerable: true,
275
- get: function () { return chunkY64AIRGW_js.registerSchema; }
275
+ get: function () { return chunkEIJKO43W_js.registerSchema; }
276
276
  });
277
277
  exports.exportJsonSchemas = exportJsonSchemas;
278
278
  exports.listRegisteredSchemas = listRegisteredSchemas;
package/dist/testing.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { VariantInfoSchema, CheckoutResponseSchema, CheckoutBodySchema, CartPricingSchema, CartItemSchema, CartSchema, AddItemPayloadSchema, BrandSchema, cimplifyRegistry } from './chunk-BYWJSPT4.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-BYWJSPT4.mjs';
3
- import './chunk-J7L5LHGK.mjs';
1
+ import { VariantInfoSchema, CheckoutResponseSchema, CheckoutBodySchema, CartPricingSchema, CartItemSchema, CartSchema, AddItemPayloadSchema, BrandSchema, cimplifyRegistry } from './chunk-7EYA527E.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-7EYA527E.mjs';
3
+ import './chunk-XRJCLWJ2.mjs';
4
4
  import './chunk-H337NF4O.mjs';
5
5
  import './chunk-3BKMNVTR.mjs';
6
6
  import './chunk-TD3AY34U.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-lt-fe29V.mjs';
2
- import './product-_GFoaPHU.mjs';
3
- import './price-CZBQw-Rh.mjs';
4
- import './payment-C-2gApyQ.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-Bu76UyFz.mjs';
2
+ import './product-BgFOFmQw.mjs';
3
+ import './price-BfOaGqjx.mjs';
4
+ import './payment-B7qzWdaJ.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-DTGS0QC1.js';
2
- import './product-_GFoaPHU.js';
3
- import './price-DNeyoO7y.js';
4
- import './payment-CfemTORM.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-Moe4cGMB.js';
2
+ import './product-BgFOFmQw.js';
3
+ import './price-CS1IsORZ.js';
4
+ import './payment-mVIJIJcq.js';
5
5
  import 'libphonenumber-js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/sdk",
3
- "version": "0.75.0",
3
+ "version": "0.78.0",
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": "order-summary.tsx",
13
- "content": "\"use client\";\n\nimport React from \"react\";\nimport type { Order, LineItem, OrderStatus, PaymentState } from \"@cimplify/sdk\";\nimport { useOrder } from \"@cimplify/sdk/react\";\nimport { Price } from \"@cimplify/sdk/react\";\nimport { parsePrice } from \"@cimplify/sdk\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport interface OrderSummaryClassNames {\n root?: string;\n header?: string;\n orderId?: string;\n status?: string;\n paymentState?: string;\n fulfillmentDetails?: string;\n deliveryAddress?: string;\n items?: string;\n lineItem?: string;\n notes?: string;\n totals?: string;\n customer?: string;\n loading?: string;\n serviceInfo?: string;\n digitalInfo?: string;\n bundleBreakdown?: string;\n compositeBreakdown?: string;\n trackingLink?: string;\n reorderButton?: string;\n}\n\nexport interface OrderSummaryProps {\n /** Pass an Order object directly (skips fetch). */\n order?: Order;\n /** Or pass an order ID to fetch via useOrder. */\n orderId?: string;\n /** Poll for status updates. */\n poll?: boolean;\n /** Custom line item renderer. */\n renderLineItem?: (item: LineItem) => React.ReactNode;\n /** Called when the reorder button is clicked. */\n onReorder?: (order: Order) => void;\n /** Called when the order status changes during polling. */\n onStatusChange?: (previousStatus: OrderStatus, newStatus: OrderStatus, order: Order) => void;\n className?: string;\n classNames?: OrderSummaryClassNames;\n}\n\nconst STATUS_LABELS: Record<OrderStatus, string> = {\n pending: \"Pending\",\n created: \"Created\",\n confirmed: \"Confirmed\",\n in_preparation: \"In Preparation\",\n ready_to_serve: \"Ready\",\n partially_served: \"Partially Served\",\n served: \"Served\",\n delivered: \"Delivered\",\n picked_up: \"Picked Up\",\n completed: \"Completed\",\n cancelled: \"Cancelled\",\n refunded: \"Refunded\",\n};\n\nconst PAYMENT_STATE_LABELS: Record<PaymentState, string> = {\n not_paid: \"Not Paid\",\n paid: \"Paid\",\n partially_refunded: \"Partially Refunded\",\n refunded: \"Refunded\",\n};\n\n/**\n * OrderSummary — displays a single order's details, line items, and totals.\n *\n * Accepts either a pre-loaded `order` object or an `orderId` to fetch.\n * Supports polling for live status updates.\n */\nexport function OrderSummary({\n order: orderProp,\n orderId,\n poll = false,\n renderLineItem,\n onReorder,\n onStatusChange,\n className,\n classNames,\n}: OrderSummaryProps): React.ReactElement {\n const { order: fetched, isLoading } = useOrder(orderProp ? null : orderId, {\n enabled: !orderProp && !!orderId,\n poll,\n onStatusChange,\n });\n\n const order = orderProp ?? fetched;\n\n if (isLoading && !order) {\n return (\n <div\n data-cimplify-order-summary\n aria-busy=\"true\"\n className={cn(className, classNames?.root, classNames?.loading)}\n >\n <div data-cimplify-order-summary-skeleton />\n </div>\n );\n }\n\n if (!order) {\n return (\n <div data-cimplify-order-summary className={cn(className, classNames?.root)}>\n <p>Order not found.</p>\n </div>\n );\n }\n\n return (\n <div data-cimplify-order-summary className={cn(className, classNames?.root)}>\n {/* Header */}\n <div data-cimplify-order-header className={classNames?.header}>\n <span data-cimplify-order-id className={classNames?.orderId}>\n Order #{order.user_friendly_id}\n </span>\n <span\n data-cimplify-order-status\n data-status={order.status}\n className={classNames?.status}\n >\n {STATUS_LABELS[order.status] ?? order.status}\n </span>\n {order.payment_state && (\n <span\n data-cimplify-order-payment-state\n data-payment-state={order.payment_state}\n className={classNames?.paymentState}\n >\n {PAYMENT_STATE_LABELS[order.payment_state] ?? order.payment_state}\n </span>\n )}\n </div>\n\n {/* Fulfillment details */}\n {order.order_type === \"pickup\" && order.pickup_time && (\n <div data-cimplify-order-fulfillment className={classNames?.fulfillmentDetails}>\n <span>Pickup time: {new Date(order.pickup_time).toLocaleString()}</span>\n </div>\n )}\n {order.order_type === \"dine-in\" && order.table_number && (\n <div data-cimplify-order-fulfillment className={classNames?.fulfillmentDetails}>\n <span>Table: {order.table_number}</span>\n </div>\n )}\n\n {/* Date */}\n <time data-cimplify-order-date dateTime={order.created_at}>\n {new Date(order.created_at).toLocaleDateString(undefined, {\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n })}\n </time>\n\n {/* Customer info */}\n {(order.customer_name || order.customer_email) && (\n <div data-cimplify-order-customer className={classNames?.customer}>\n {order.customer_name && (\n <span data-cimplify-order-customer-name>{order.customer_name}</span>\n )}\n {order.customer_email && (\n <span data-cimplify-order-customer-email>{order.customer_email}</span>\n )}\n </div>\n )}\n\n {/* Delivery address */}\n {order.delivery_address && (\n <div data-cimplify-order-delivery-address className={classNames?.deliveryAddress}>\n <span>Delivery address</span>\n <p>{order.delivery_address}</p>\n </div>\n )}\n\n {/* Line items */}\n <div data-cimplify-order-items className={classNames?.items}>\n {order.items.map((item) =>\n renderLineItem ? (\n <React.Fragment key={item.id}>{renderLineItem(item)}</React.Fragment>\n ) : (\n <div key={item.id} data-cimplify-order-line-item className={classNames?.lineItem}>\n <div data-cimplify-order-line-info>\n <span data-cimplify-order-line-qty>{item.quantity}&times;</span>\n <span data-cimplify-order-line-key>{item.line_key}</span>\n </div>\n <Price amount={item.price} />\n {item.fulfillment_type === \"digital\" && item.fulfillment_id && (\n <a\n href={item.fulfillment_id}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-cimplify-order-line-download\n className=\"text-sm text-primary underline\"\n >\n Download\n </a>\n )}\n\n {/* Service items: show scheduling and confirmation details */}\n {item.configuration.type === \"service\" && (\n <div data-cimplify-order-service-info className={classNames?.serviceInfo}>\n {item.configuration.scheduled_start && (\n <span>{\"\\u{1F4C5}\"} {new Date(item.configuration.scheduled_start).toLocaleDateString()} at {new Date(item.configuration.scheduled_start).toLocaleTimeString([], { hour: \"2-digit\", minute: \"2-digit\" })}</span>\n )}\n {item.configuration.confirmation_code && (\n <span>Confirmation: {item.configuration.confirmation_code}</span>\n )}\n {item.configuration.service_status && (\n <span data-status={item.configuration.service_status}>{item.configuration.service_status}</span>\n )}\n </div>\n )}\n\n {/* Digital items: instant delivery badge */}\n {item.configuration.type === \"digital\" && (\n <div data-cimplify-order-digital-info className={classNames?.digitalInfo}>\n <span>{\"\\u26A1\"} Instant digital delivery</span>\n </div>\n )}\n\n {/* Bundle items: component breakdown */}\n {item.configuration.type === \"bundle\" && item.configuration.resolved && (\n <div data-cimplify-order-bundle-breakdown className={classNames?.bundleBreakdown}>\n {item.configuration.resolved.selections.map((sel) => (\n <div key={sel.component_id} data-product-type={sel.product_type}>\n <span>{sel.quantity}&times; {sel.product_name}</span>\n {sel.product_type === \"service\" && sel.scheduling?.scheduled_start && (\n <span> &mdash; {new Date(sel.scheduling.scheduled_start).toLocaleDateString()}</span>\n )}\n {sel.product_type === \"digital\" && <span> &mdash; Digital</span>}\n </div>\n ))}\n </div>\n )}\n\n {/* Composite items: component breakdown with pricing */}\n {item.configuration.type === \"composite\" && item.configuration.resolved && (\n <div data-cimplify-order-composite-breakdown className={classNames?.compositeBreakdown}>\n {item.configuration.resolved.selections.map((sel) => (\n <div key={sel.component_id} data-product-type={sel.product_type}>\n <span>{sel.quantity}&times; {sel.component_name}</span>\n {sel.product_type === \"service\" && sel.scheduling?.scheduled_start && (\n <span> &mdash; {new Date(sel.scheduling.scheduled_start).toLocaleDateString()}</span>\n )}\n <Price amount={sel.unit_price} />\n </div>\n ))}\n </div>\n )}\n </div>\n ),\n )}\n </div>\n\n {/* Customer notes / special instructions */}\n {order.customer_notes && order.customer_notes.length > 0 && (\n <div data-cimplify-order-notes className={classNames?.notes}>\n <span>Notes</span>\n {order.customer_notes.map((note, index) => (\n <p key={index} data-cimplify-order-note>{note}</p>\n ))}\n </div>\n )}\n\n {/* Totals */}\n <div data-cimplify-order-totals className={classNames?.totals}>\n {order.total_discount != null && parsePrice(order.total_discount) !== 0 && (\n <div data-cimplify-order-discount>\n <span>Discount</span>\n <Price amount={order.total_discount} prefix=\"-\" />\n </div>\n )}\n {order.delivery_fee != null && parsePrice(order.delivery_fee) > 0 && (\n <div data-cimplify-order-delivery-fee>\n <span>Delivery fee</span>\n <Price amount={order.delivery_fee} />\n </div>\n )}\n {order.service_charge != null && parsePrice(order.service_charge) !== 0 && (\n <div data-cimplify-order-service-charge>\n <span>Service charge</span>\n <Price amount={order.service_charge} />\n </div>\n )}\n {order.tax != null && parsePrice(order.tax) !== 0 && (\n <div data-cimplify-order-tax>\n <span>Tax</span>\n <Price amount={order.tax} />\n </div>\n )}\n <div data-cimplify-order-total>\n <span>Total</span>\n <Price amount={order.total_price} />\n </div>\n </div>\n\n {/* Tracking */}\n {order.tracking_link && (\n <a\n href={order.tracking_link}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-cimplify-order-tracking\n className={classNames?.trackingLink}\n >\n Track your order\n </a>\n )}\n\n {onReorder && (\n <button\n type=\"button\"\n onClick={() => onReorder(order)}\n data-cimplify-order-reorder\n className={classNames?.reorderButton}\n >\n Reorder\n </button>\n )}\n </div>\n );\n}\n"
13
+ "content": "\"use client\";\n\nimport React from \"react\";\nimport type { Order, LineItem, OrderStatus, PaymentState } from \"@cimplify/sdk\";\nimport { useOrder } from \"@cimplify/sdk/react\";\nimport { Price } from \"@cimplify/sdk/react\";\nimport { parsePrice } from \"@cimplify/sdk\";\nimport { cn } from \"@cimplify/sdk/react\";\n\nexport interface OrderSummaryClassNames {\n root?: string;\n header?: string;\n orderId?: string;\n status?: string;\n paymentState?: string;\n fulfillmentDetails?: string;\n deliveryAddress?: string;\n items?: string;\n lineItem?: string;\n notes?: string;\n totals?: string;\n customer?: string;\n loading?: string;\n serviceInfo?: string;\n digitalInfo?: string;\n bundleBreakdown?: string;\n compositeBreakdown?: string;\n trackingLink?: string;\n reorderButton?: string;\n}\n\nexport interface OrderSummaryProps {\n /** Pass an Order object directly (skips fetch). */\n order?: Order;\n /** Or pass an order ID to fetch via useOrder. */\n orderId?: string;\n /** Poll for status updates. */\n poll?: boolean;\n /** Custom line item renderer. */\n renderLineItem?: (item: LineItem) => React.ReactNode;\n /** Called when the reorder button is clicked. */\n onReorder?: (order: Order) => void;\n /** Called when the order status changes during polling. */\n onStatusChange?: (previousStatus: OrderStatus, newStatus: OrderStatus, order: Order) => void;\n className?: string;\n classNames?: OrderSummaryClassNames;\n}\n\nconst STATUS_LABELS: Record<OrderStatus, string> = {\n pending: \"Pending\",\n created: \"Created\",\n confirmed: \"Confirmed\",\n in_preparation: \"In Preparation\",\n ready_to_serve: \"Ready\",\n partially_served: \"Partially Served\",\n served: \"Served\",\n delivered: \"Delivered\",\n picked_up: \"Picked Up\",\n completed: \"Completed\",\n cancelled: \"Cancelled\",\n refunded: \"Refunded\",\n};\n\nconst PAYMENT_STATE_LABELS: Record<PaymentState, string> = {\n not_paid: \"Not Paid\",\n partially_paid: \"Partially Paid\",\n paid: \"Paid\",\n partially_refunded: \"Partially Refunded\",\n refunded: \"Refunded\",\n};\n\n/**\n * OrderSummary — displays a single order's details, line items, and totals.\n *\n * Accepts either a pre-loaded `order` object or an `orderId` to fetch.\n * Supports polling for live status updates.\n */\nexport function OrderSummary({\n order: orderProp,\n orderId,\n poll = false,\n renderLineItem,\n onReorder,\n onStatusChange,\n className,\n classNames,\n}: OrderSummaryProps): React.ReactElement {\n const { order: fetched, isLoading } = useOrder(orderProp ? null : orderId, {\n enabled: !orderProp && !!orderId,\n poll,\n onStatusChange,\n });\n\n const order = orderProp ?? fetched;\n\n if (isLoading && !order) {\n return (\n <div\n data-cimplify-order-summary\n aria-busy=\"true\"\n className={cn(className, classNames?.root, classNames?.loading)}\n >\n <div data-cimplify-order-summary-skeleton />\n </div>\n );\n }\n\n if (!order) {\n return (\n <div data-cimplify-order-summary className={cn(className, classNames?.root)}>\n <p>Order not found.</p>\n </div>\n );\n }\n\n return (\n <div data-cimplify-order-summary className={cn(className, classNames?.root)}>\n {/* Header */}\n <div data-cimplify-order-header className={classNames?.header}>\n <span data-cimplify-order-id className={classNames?.orderId}>\n Order #{order.user_friendly_id}\n </span>\n <span\n data-cimplify-order-status\n data-status={order.status}\n className={classNames?.status}\n >\n {STATUS_LABELS[order.status] ?? order.status}\n </span>\n {order.payment_state && (\n <span\n data-cimplify-order-payment-state\n data-payment-state={order.payment_state}\n className={classNames?.paymentState}\n >\n {PAYMENT_STATE_LABELS[order.payment_state] ?? order.payment_state}\n </span>\n )}\n </div>\n\n {/* Fulfillment details */}\n {order.order_type === \"pickup\" && order.pickup_time && (\n <div data-cimplify-order-fulfillment className={classNames?.fulfillmentDetails}>\n <span>Pickup time: {new Date(order.pickup_time).toLocaleString()}</span>\n </div>\n )}\n {order.order_type === \"dine-in\" && order.table_number && (\n <div data-cimplify-order-fulfillment className={classNames?.fulfillmentDetails}>\n <span>Table: {order.table_number}</span>\n </div>\n )}\n\n {/* Date */}\n <time data-cimplify-order-date dateTime={order.created_at}>\n {new Date(order.created_at).toLocaleDateString(undefined, {\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n })}\n </time>\n\n {/* Customer info */}\n {(order.customer_name || order.customer_email) && (\n <div data-cimplify-order-customer className={classNames?.customer}>\n {order.customer_name && (\n <span data-cimplify-order-customer-name>{order.customer_name}</span>\n )}\n {order.customer_email && (\n <span data-cimplify-order-customer-email>{order.customer_email}</span>\n )}\n </div>\n )}\n\n {/* Delivery address */}\n {order.delivery_address && (\n <div data-cimplify-order-delivery-address className={classNames?.deliveryAddress}>\n <span>Delivery address</span>\n <p>{order.delivery_address}</p>\n </div>\n )}\n\n {/* Line items */}\n <div data-cimplify-order-items className={classNames?.items}>\n {order.items.map((item) =>\n renderLineItem ? (\n <React.Fragment key={item.id}>{renderLineItem(item)}</React.Fragment>\n ) : (\n <div key={item.id} data-cimplify-order-line-item className={classNames?.lineItem}>\n <div data-cimplify-order-line-info>\n <span data-cimplify-order-line-qty>{item.quantity}&times;</span>\n <span data-cimplify-order-line-key>{item.line_key}</span>\n </div>\n <Price amount={item.price} />\n {item.fulfillment_type === \"digital\" && item.fulfillment_id && (\n <a\n href={item.fulfillment_id}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-cimplify-order-line-download\n className=\"text-sm text-primary underline\"\n >\n Download\n </a>\n )}\n\n {/* Service items: show scheduling and confirmation details */}\n {item.configuration.type === \"service\" && (\n <div data-cimplify-order-service-info className={classNames?.serviceInfo}>\n {item.configuration.scheduled_start && (\n <span>{\"\\u{1F4C5}\"} {new Date(item.configuration.scheduled_start).toLocaleDateString()} at {new Date(item.configuration.scheduled_start).toLocaleTimeString([], { hour: \"2-digit\", minute: \"2-digit\" })}</span>\n )}\n {item.configuration.confirmation_code && (\n <span>Confirmation: {item.configuration.confirmation_code}</span>\n )}\n {item.configuration.service_status && (\n <span data-status={item.configuration.service_status}>{item.configuration.service_status}</span>\n )}\n </div>\n )}\n\n {/* Digital items: instant delivery badge */}\n {item.configuration.type === \"digital\" && (\n <div data-cimplify-order-digital-info className={classNames?.digitalInfo}>\n <span>{\"\\u26A1\"} Instant digital delivery</span>\n </div>\n )}\n\n {/* Bundle items: component breakdown */}\n {item.configuration.type === \"bundle\" && item.configuration.resolved && (\n <div data-cimplify-order-bundle-breakdown className={classNames?.bundleBreakdown}>\n {item.configuration.resolved.selections.map((sel) => (\n <div key={sel.component_id} data-product-type={sel.product_type}>\n <span>{sel.quantity}&times; {sel.product_name}</span>\n {sel.product_type === \"service\" && sel.scheduling?.scheduled_start && (\n <span> &mdash; {new Date(sel.scheduling.scheduled_start).toLocaleDateString()}</span>\n )}\n {sel.product_type === \"digital\" && <span> &mdash; Digital</span>}\n </div>\n ))}\n </div>\n )}\n\n {/* Composite items: component breakdown with pricing */}\n {item.configuration.type === \"composite\" && item.configuration.resolved && (\n <div data-cimplify-order-composite-breakdown className={classNames?.compositeBreakdown}>\n {item.configuration.resolved.selections.map((sel) => (\n <div key={sel.component_id} data-product-type={sel.product_type}>\n <span>{sel.quantity}&times; {sel.component_name}</span>\n {sel.product_type === \"service\" && sel.scheduling?.scheduled_start && (\n <span> &mdash; {new Date(sel.scheduling.scheduled_start).toLocaleDateString()}</span>\n )}\n <Price amount={sel.unit_price} />\n </div>\n ))}\n </div>\n )}\n </div>\n ),\n )}\n </div>\n\n {/* Customer notes / special instructions */}\n {order.customer_notes && order.customer_notes.length > 0 && (\n <div data-cimplify-order-notes className={classNames?.notes}>\n <span>Notes</span>\n {order.customer_notes.map((note, index) => (\n <p key={index} data-cimplify-order-note>{note}</p>\n ))}\n </div>\n )}\n\n {/* Totals */}\n <div data-cimplify-order-totals className={classNames?.totals}>\n {order.total_discount != null && parsePrice(order.total_discount) !== 0 && (\n <div data-cimplify-order-discount>\n <span>Discount</span>\n <Price amount={order.total_discount} prefix=\"-\" />\n </div>\n )}\n {order.delivery_fee != null && parsePrice(order.delivery_fee) > 0 && (\n <div data-cimplify-order-delivery-fee>\n <span>Delivery fee</span>\n <Price amount={order.delivery_fee} />\n </div>\n )}\n {order.service_charge != null && parsePrice(order.service_charge) !== 0 && (\n <div data-cimplify-order-service-charge>\n <span>Service charge</span>\n <Price amount={order.service_charge} />\n </div>\n )}\n {order.tax != null && parsePrice(order.tax) !== 0 && (\n <div data-cimplify-order-tax>\n <span>Tax</span>\n <Price amount={order.tax} />\n </div>\n )}\n <div data-cimplify-order-total>\n <span>Total</span>\n <Price amount={order.total_price} />\n </div>\n </div>\n\n {/* Tracking */}\n {order.tracking_link && (\n <a\n href={order.tracking_link}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-cimplify-order-tracking\n className={classNames?.trackingLink}\n >\n Track your order\n </a>\n )}\n\n {onReorder && (\n <button\n type=\"button\"\n onClick={() => onReorder(order)}\n data-cimplify-order-reorder\n className={classNames?.reorderButton}\n >\n Reorder\n </button>\n )}\n </div>\n );\n}\n"
14
14
  }
15
15
  ]
16
16
  }