@cimplify/sdk 0.70.3 → 0.72.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 (56) hide show
  1. package/dist/{chunk-UUW7WBCG.mjs → chunk-BYWJSPT4.mjs} +1 -1
  2. package/dist/{chunk-QXMO2LGU.mjs → chunk-J7L5LHGK.mjs} +3 -1
  3. package/dist/{chunk-XQ6LEDEO.js → chunk-OGQFDCZM.js} +3 -1
  4. package/dist/{chunk-XGKMSLMJ.js → chunk-Y64AIRGW.js} +2 -2
  5. package/dist/mock/cli.mjs +3 -1
  6. package/dist/mock/library.js +3 -1
  7. package/dist/mock/library.mjs +3 -1
  8. package/dist/mock/msw.js +3 -1
  9. package/dist/mock/msw.mjs +3 -1
  10. package/dist/react.d.mts +55 -17
  11. package/dist/react.d.ts +55 -17
  12. package/dist/react.js +148 -84
  13. package/dist/react.mjs +149 -85
  14. package/dist/server/tanstack.d.mts +74 -0
  15. package/dist/server/tanstack.d.ts +74 -0
  16. package/dist/server/tanstack.js +291 -0
  17. package/dist/server/tanstack.mjs +279 -0
  18. package/dist/testing/msw.js +2 -2
  19. package/dist/testing/msw.mjs +1 -1
  20. package/dist/testing/suite.js +21 -21
  21. package/dist/testing/suite.mjs +2 -2
  22. package/dist/testing.js +77 -77
  23. package/dist/testing.mjs +3 -3
  24. package/package.json +7 -1
  25. package/registry/accommodation-card.json +1 -1
  26. package/registry/add-on-selector.json +1 -1
  27. package/registry/billing-plan-selector.json +1 -1
  28. package/registry/booking-page.json +1 -1
  29. package/registry/bundle-selector.json +1 -1
  30. package/registry/compact-service-card.json +1 -1
  31. package/registry/composite-selector.json +1 -1
  32. package/registry/customer-input-fields.json +1 -1
  33. package/registry/date-slot-picker.json +1 -1
  34. package/registry/default-product-layout.json +1 -1
  35. package/registry/digital-product-card.json +1 -1
  36. package/registry/digital-product-layout.json +1 -1
  37. package/registry/food-product-card.json +1 -1
  38. package/registry/food-product-layout.json +1 -1
  39. package/registry/lease-service-card.json +1 -1
  40. package/registry/price-range.json +1 -1
  41. package/registry/price.json +1 -1
  42. package/registry/product-card.json +1 -1
  43. package/registry/product-customizer.json +1 -1
  44. package/registry/product-sheet.json +1 -1
  45. package/registry/rental-service-card.json +1 -1
  46. package/registry/retail-product-card.json +1 -1
  47. package/registry/sale-badge.json +1 -1
  48. package/registry/schedule-service-card.json +1 -1
  49. package/registry/service-product-layout.json +1 -1
  50. package/registry/slot-picker.json +1 -1
  51. package/registry/standard-service-card.json +1 -1
  52. package/registry/subscription-card.json +1 -1
  53. package/registry/variant-selector.json +1 -1
  54. package/registry/volume-pricing.json +1 -1
  55. package/registry/wholesale-product-card.json +1 -1
  56. package/registry/wholesale-product-layout.json +1 -1
@@ -0,0 +1,279 @@
1
+ import '../chunk-3G6RQLXK.mjs';
2
+
3
+ // src/server/tanstack.ts
4
+ var TANSTACK_R2_BUCKET_BINDING = "CIMPLIFY_CACHE_R2_BUCKET";
5
+ var TANSTACK_R2_PREFIX_ENV = "CIMPLIFY_CACHE_R2_PREFIX";
6
+ var TANSTACK_PATH_INDEX_BINDING = "CIMPLIFY_PATH_INDEX";
7
+ var TANSTACK_CACHE_NAMESPACE = "nitro";
8
+ var CIMPLIFY_TAG_PREFIX = "cimplify:";
9
+ var CIMPLIFY_CACHE_META_FIELD = "__cimplifyCache";
10
+ var EMPTY_STORAGE_KEY = "__cimplify_empty_key__";
11
+ function isRecord(value) {
12
+ return typeof value === "object" && value !== null && !Array.isArray(value);
13
+ }
14
+ function stringArray(value) {
15
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
16
+ }
17
+ function metadataFrom(value) {
18
+ if (!isRecord(value)) return void 0;
19
+ const metadata = value[CIMPLIFY_CACHE_META_FIELD];
20
+ return isRecord(metadata) ? metadata : void 0;
21
+ }
22
+ function cimplifyTagsFrom(candidates) {
23
+ const seen = /* @__PURE__ */ new Set();
24
+ for (const candidate of candidates) {
25
+ for (const tag of candidate ?? []) {
26
+ if (!tag.startsWith(CIMPLIFY_TAG_PREFIX) || seen.has(tag)) continue;
27
+ seen.add(tag);
28
+ }
29
+ }
30
+ return [...seen];
31
+ }
32
+ function extractTags(key, value, options, driverOptions) {
33
+ const optionMeta = metadataFrom(options);
34
+ const valueMeta = metadataFrom(value);
35
+ const valueRecord = isRecord(value) ? value : void 0;
36
+ const nestedValue = isRecord(valueRecord?.value) ? valueRecord.value : void 0;
37
+ const configured = typeof driverOptions.tags === "function" ? driverOptions.tags(key, value, options) : driverOptions.tags;
38
+ return cimplifyTagsFrom([
39
+ configured,
40
+ optionMeta?.tags,
41
+ options?.tags,
42
+ options?.cimplifyTags,
43
+ options?.cacheTags,
44
+ valueMeta?.tags,
45
+ stringArray(valueRecord?.tags),
46
+ stringArray(valueRecord?.cimplifyTags),
47
+ stringArray(valueRecord?.cacheTags),
48
+ stringArray(nestedValue?.tags),
49
+ stringArray(nestedValue?.cimplifyTags),
50
+ stringArray(nestedValue?.cacheTags)
51
+ ]);
52
+ }
53
+ function extractCacheKey(key, value, options, driverOptions) {
54
+ const configured = typeof driverOptions.cacheKey === "function" ? driverOptions.cacheKey(key, value, options) : driverOptions.cacheKey;
55
+ if (configured) return configured;
56
+ const optionMeta = metadataFrom(options);
57
+ const valueMeta = metadataFrom(value);
58
+ if (optionMeta?.cacheKey) return optionMeta.cacheKey;
59
+ if (options?.cacheKey) return options.cacheKey;
60
+ if (options?.cimplifyCacheKey) return options.cimplifyCacheKey;
61
+ if (valueMeta?.cacheKey) return valueMeta.cacheKey;
62
+ return key;
63
+ }
64
+ function extractIsFetch(key, value, options, driverOptions) {
65
+ if (typeof driverOptions.isFetch === "function") {
66
+ return driverOptions.isFetch(key, value, options);
67
+ }
68
+ if (typeof driverOptions.isFetch === "boolean") return driverOptions.isFetch;
69
+ const optionMeta = metadataFrom(options);
70
+ const valueMeta = metadataFrom(value);
71
+ return Boolean(
72
+ optionMeta?.isFetch ?? options?.isFetch ?? options?.cimplifyIsFetch ?? valueMeta?.isFetch ?? false
73
+ );
74
+ }
75
+ function valueForStorage(value) {
76
+ if (!isRecord(value) || !(CIMPLIFY_CACHE_META_FIELD in value)) return value;
77
+ const { [CIMPLIFY_CACHE_META_FIELD]: _metadata, ...rest } = value;
78
+ return rest;
79
+ }
80
+ function joinR2Parts(...parts) {
81
+ return parts.map((part) => part.trim().replace(/^\/+|\/+$/g, "")).filter(Boolean).join("/");
82
+ }
83
+ function encodeStorageKey(key) {
84
+ return key === "" ? EMPTY_STORAGE_KEY : encodeURIComponent(key);
85
+ }
86
+ function decodeStorageKey(key) {
87
+ if (key === EMPTY_STORAGE_KEY) return "";
88
+ try {
89
+ return decodeURIComponent(key);
90
+ } catch {
91
+ return key;
92
+ }
93
+ }
94
+ function cimplifyTanstackR2Key(prefix, key, namespace = TANSTACK_CACHE_NAMESPACE) {
95
+ return joinR2Parts(prefix, namespace, encodeStorageKey(key));
96
+ }
97
+ function cimplifyTanstackR2ListPrefix(prefix, base, namespace) {
98
+ if (!base) return `${joinR2Parts(prefix, namespace)}/`;
99
+ return cimplifyTanstackR2Key(prefix, base, namespace);
100
+ }
101
+ function storageKeyFromR2Key(prefix, namespace, key) {
102
+ const base = `${joinR2Parts(prefix, namespace)}/`;
103
+ const encoded = key.startsWith(base) ? key.slice(base.length) : key;
104
+ return decodeStorageKey(encoded);
105
+ }
106
+ function pathIndexFor(env) {
107
+ if (!env.pathIndex) return null;
108
+ return env.pathIndex.get(env.pathIndex.idFromName(env.prefix));
109
+ }
110
+ async function resolveRuntimeEnv(options) {
111
+ const env = await options.getEnv?.() ?? options.env;
112
+ const r2 = env?.[TANSTACK_R2_BUCKET_BINDING];
113
+ const prefix = options.prefix ?? env?.[TANSTACK_R2_PREFIX_ENV];
114
+ if (!r2 || !prefix) return null;
115
+ return {
116
+ r2,
117
+ prefix,
118
+ pathIndex: env?.[TANSTACK_PATH_INDEX_BINDING]
119
+ };
120
+ }
121
+ async function registerIndex(env, cacheKey, r2Key, tags, isFetch) {
122
+ if (tags.length === 0) return;
123
+ const index = pathIndexFor(env);
124
+ if (!index) return;
125
+ try {
126
+ await index.indexAdd(cacheKey, r2Key, tags, isFetch);
127
+ } catch {
128
+ }
129
+ }
130
+ async function listR2Keys(r2, prefix) {
131
+ const keys = [];
132
+ let cursor;
133
+ do {
134
+ const page = await r2.list({ prefix, cursor });
135
+ keys.push(...page.objects.map((object) => object.key));
136
+ cursor = page.truncated ? page.cursor : void 0;
137
+ } while (cursor);
138
+ return keys;
139
+ }
140
+ async function putAndIndex(runtimeEnv, driverOptions, key, storedValue, indexValue, options) {
141
+ const namespace = driverOptions.namespace ?? TANSTACK_CACHE_NAMESPACE;
142
+ const r2Key = cimplifyTanstackR2Key(runtimeEnv.prefix, key, namespace);
143
+ try {
144
+ await runtimeEnv.r2.put(r2Key, storedValue);
145
+ } catch {
146
+ return;
147
+ }
148
+ try {
149
+ const tags = extractTags(key, indexValue, options, driverOptions);
150
+ if (tags.length === 0) return;
151
+ await registerIndex(
152
+ runtimeEnv,
153
+ extractCacheKey(key, indexValue, options, driverOptions),
154
+ r2Key,
155
+ tags,
156
+ extractIsFetch(key, indexValue, options, driverOptions)
157
+ );
158
+ } catch {
159
+ }
160
+ }
161
+ async function getRawItem(driverOptions, key) {
162
+ const runtimeEnv = await resolveRuntimeEnv(driverOptions);
163
+ if (!runtimeEnv) return null;
164
+ try {
165
+ const object = await runtimeEnv.r2.get(
166
+ cimplifyTanstackR2Key(
167
+ runtimeEnv.prefix,
168
+ key,
169
+ driverOptions.namespace ?? TANSTACK_CACHE_NAMESPACE
170
+ )
171
+ );
172
+ return object ? await object.text() : null;
173
+ } catch {
174
+ return null;
175
+ }
176
+ }
177
+ function cimplifyTanstackCacheOptions(metadata) {
178
+ return { [CIMPLIFY_CACHE_META_FIELD]: metadata };
179
+ }
180
+ function withCimplifyCacheMetadata(value, metadata) {
181
+ return { ...value, [CIMPLIFY_CACHE_META_FIELD]: metadata };
182
+ }
183
+ function createCimplifyTanstackCacheDriver(options = {}) {
184
+ const driverOptions = { ...options };
185
+ return {
186
+ name: "cimplify-tanstack-r2-cache",
187
+ options: driverOptions,
188
+ async hasItem(key) {
189
+ const runtimeEnv = await resolveRuntimeEnv(driverOptions);
190
+ if (!runtimeEnv) return false;
191
+ try {
192
+ const object = await runtimeEnv.r2.head(
193
+ cimplifyTanstackR2Key(
194
+ runtimeEnv.prefix,
195
+ key,
196
+ driverOptions.namespace ?? TANSTACK_CACHE_NAMESPACE
197
+ )
198
+ );
199
+ return Boolean(object);
200
+ } catch {
201
+ return false;
202
+ }
203
+ },
204
+ async getItem(key) {
205
+ const raw = await getRawItem(driverOptions, key);
206
+ if (raw === null) return null;
207
+ try {
208
+ return JSON.parse(raw);
209
+ } catch {
210
+ return raw;
211
+ }
212
+ },
213
+ async getItemRaw(key) {
214
+ return getRawItem(driverOptions, key);
215
+ },
216
+ async setItem(key, value, options2) {
217
+ const runtimeEnv = await resolveRuntimeEnv(driverOptions);
218
+ if (!runtimeEnv) return;
219
+ const strippedValue = valueForStorage(value);
220
+ await putAndIndex(
221
+ runtimeEnv,
222
+ driverOptions,
223
+ key,
224
+ JSON.stringify(strippedValue) ?? "null",
225
+ value,
226
+ options2
227
+ );
228
+ },
229
+ async setItemRaw(key, value, options2) {
230
+ const runtimeEnv = await resolveRuntimeEnv(driverOptions);
231
+ if (!runtimeEnv) return;
232
+ await putAndIndex(runtimeEnv, driverOptions, key, value, value, options2);
233
+ },
234
+ async removeItem(key) {
235
+ const runtimeEnv = await resolveRuntimeEnv(driverOptions);
236
+ if (!runtimeEnv) return;
237
+ try {
238
+ await runtimeEnv.r2.delete(
239
+ cimplifyTanstackR2Key(
240
+ runtimeEnv.prefix,
241
+ key,
242
+ driverOptions.namespace ?? TANSTACK_CACHE_NAMESPACE
243
+ )
244
+ );
245
+ } catch {
246
+ }
247
+ },
248
+ async getKeys(base) {
249
+ const runtimeEnv = await resolveRuntimeEnv(driverOptions);
250
+ if (!runtimeEnv) return [];
251
+ const namespace = driverOptions.namespace ?? TANSTACK_CACHE_NAMESPACE;
252
+ try {
253
+ const keys = await listR2Keys(
254
+ runtimeEnv.r2,
255
+ cimplifyTanstackR2ListPrefix(runtimeEnv.prefix, base, namespace)
256
+ );
257
+ return keys.map((key) => storageKeyFromR2Key(runtimeEnv.prefix, namespace, key));
258
+ } catch {
259
+ return [];
260
+ }
261
+ },
262
+ async clear(base) {
263
+ const runtimeEnv = await resolveRuntimeEnv(driverOptions);
264
+ if (!runtimeEnv) return;
265
+ const namespace = driverOptions.namespace ?? TANSTACK_CACHE_NAMESPACE;
266
+ try {
267
+ const keys = await listR2Keys(
268
+ runtimeEnv.r2,
269
+ cimplifyTanstackR2ListPrefix(runtimeEnv.prefix, base, namespace)
270
+ );
271
+ await Promise.all(keys.map((key) => runtimeEnv.r2.delete(key)));
272
+ } catch {
273
+ }
274
+ }
275
+ };
276
+ }
277
+ var cimplifyTanstackCacheDriver = createCimplifyTanstackCacheDriver;
278
+
279
+ export { CIMPLIFY_CACHE_META_FIELD, CIMPLIFY_TAG_PREFIX, TANSTACK_CACHE_NAMESPACE, TANSTACK_PATH_INDEX_BINDING, TANSTACK_R2_BUCKET_BINDING, TANSTACK_R2_PREFIX_ENV, cimplifyTanstackCacheDriver, cimplifyTanstackCacheOptions, cimplifyTanstackR2Key, createCimplifyTanstackCacheDriver, withCimplifyCacheMetadata };
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkXQ6LEDEO_js = require('../chunk-XQ6LEDEO.js');
3
+ var chunkOGQFDCZM_js = require('../chunk-OGQFDCZM.js');
4
4
  require('../chunk-XA3ZNR75.js');
5
5
  require('../chunk-OWW5GUSB.js');
6
6
 
7
7
  // src/mock/msw.ts
8
8
  async function createMswHandlers(options = {}) {
9
9
  const baseUrl = options.baseUrl ?? "http://localhost:8787";
10
- const handle = chunkXQ6LEDEO_js.createMockApp(options);
10
+ const handle = chunkOGQFDCZM_js.createMockApp(options);
11
11
  const msw = await import('msw').catch(() => {
12
12
  throw new Error("msw is required to use @cimplify/sdk/mock/msw \u2014 install it as a peer dependency");
13
13
  });
@@ -1,4 +1,4 @@
1
- import { createMockApp } from '../chunk-QXMO2LGU.mjs';
1
+ import { createMockApp } from '../chunk-J7L5LHGK.mjs';
2
2
  import '../chunk-AMZXALF6.mjs';
3
3
  import '../chunk-3G6RQLXK.mjs';
4
4
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkXGKMSLMJ_js = require('../chunk-XGKMSLMJ.js');
4
- require('../chunk-XQ6LEDEO.js');
3
+ var chunkY64AIRGW_js = require('../chunk-Y64AIRGW.js');
4
+ require('../chunk-OGQFDCZM.js');
5
5
  require('../chunk-QS4XDVHI.js');
6
6
  require('../chunk-CV5QMDQS.js');
7
7
  require('../chunk-7Y2O3E4D.js');
@@ -20,11 +20,11 @@ var PLACEHOLDER_PHRASES = [
20
20
  function createBrandSuite(opts) {
21
21
  vitest.describe(opts.label ?? "brand schema", () => {
22
22
  vitest.it("conforms to the Cimplify brand contract", () => {
23
- vitest.expect(() => chunkXGKMSLMJ_js.assertBrand(opts.brand)).not.toThrow();
23
+ vitest.expect(() => chunkY64AIRGW_js.assertBrand(opts.brand)).not.toThrow();
24
24
  });
25
25
  vitest.it("declares a known mock seed", () => {
26
26
  const b = opts.brand;
27
- vitest.expect(chunkXGKMSLMJ_js.SeedNameSchema.safeParse(b.mock?.seed).success).toBe(true);
27
+ vitest.expect(chunkY64AIRGW_js.SeedNameSchema.safeParse(b.mock?.seed).success).toBe(true);
28
28
  });
29
29
  vitest.it("has no placeholder copy left in", () => {
30
30
  const offenders = [];
@@ -56,7 +56,7 @@ ${msg}`);
56
56
  vitest.expect(b.mock?.businessId).toMatch(/^bus_/);
57
57
  });
58
58
  vitest.it("zod-parses cleanly", () => {
59
- const result = chunkXGKMSLMJ_js.BrandSchema.safeParse(opts.brand);
59
+ const result = chunkY64AIRGW_js.BrandSchema.safeParse(opts.brand);
60
60
  if (!result.success) {
61
61
  throw new Error(
62
62
  "Brand schema violations:\n" + result.error.issues.map((i) => ` \u2022 brand.${i.path.join(".")}: ${i.message}`).join("\n")
@@ -71,23 +71,23 @@ function createCartFlowSuite(opts = {}) {
71
71
  vitest.describe(opts.label ?? "cart flow against in-process mock", () => {
72
72
  let h;
73
73
  vitest.beforeEach(() => {
74
- h = chunkXGKMSLMJ_js.createTestClient(opts);
74
+ h = chunkY64AIRGW_js.createTestClient(opts);
75
75
  });
76
76
  vitest.afterEach(() => h.dispose());
77
77
  vitest.it("starts with an empty cart matching the canonical shape", async () => {
78
78
  const res = await h.client.cart.get();
79
79
  vitest.expect(res.ok).toBe(true);
80
80
  if (!res.ok) return;
81
- vitest.expect(() => chunkXGKMSLMJ_js.assertCart(res.value)).not.toThrow();
81
+ vitest.expect(() => chunkY64AIRGW_js.assertCart(res.value)).not.toThrow();
82
82
  vitest.expect(res.value.items).toHaveLength(0);
83
83
  });
84
84
  vitest.it("adds the first product, persists it, and returns a shape-valid cart", async () => {
85
- const { product, variantId } = await chunkXGKMSLMJ_js.fixtures.addFirstProduct(h.client);
85
+ const { product, variantId } = await chunkY64AIRGW_js.fixtures.addFirstProduct(h.client);
86
86
  vitest.expect(product.id).toBeTruthy();
87
87
  const get = await h.client.cart.get();
88
88
  vitest.expect(get.ok).toBe(true);
89
89
  if (!get.ok) return;
90
- vitest.expect(() => chunkXGKMSLMJ_js.assertCart(get.value)).not.toThrow();
90
+ vitest.expect(() => chunkY64AIRGW_js.assertCart(get.value)).not.toThrow();
91
91
  vitest.expect(get.value.items).toHaveLength(1);
92
92
  vitest.expect(get.value.items[0]?.item_id).toBe(product.id);
93
93
  if (variantId) {
@@ -98,8 +98,8 @@ function createCartFlowSuite(opts = {}) {
98
98
  vitest.expect(parseFloat(String(get.value.pricing.subtotal))).toBeGreaterThan(0);
99
99
  });
100
100
  vitest.it("dedupes by line_key when adding the same product twice", async () => {
101
- await chunkXGKMSLMJ_js.fixtures.addFirstProduct(h.client);
102
- await chunkXGKMSLMJ_js.fixtures.addFirstProduct(h.client);
101
+ await chunkY64AIRGW_js.fixtures.addFirstProduct(h.client);
102
+ await chunkY64AIRGW_js.fixtures.addFirstProduct(h.client);
103
103
  const res = await h.client.cart.get();
104
104
  vitest.expect(res.ok).toBe(true);
105
105
  if (!res.ok) return;
@@ -107,7 +107,7 @@ function createCartFlowSuite(opts = {}) {
107
107
  vitest.expect(res.value.items[0]?.quantity).toBe(2);
108
108
  });
109
109
  vitest.it("removes items and zeroes the subtotal", async () => {
110
- await chunkXGKMSLMJ_js.fixtures.addFirstProduct(h.client);
110
+ await chunkY64AIRGW_js.fixtures.addFirstProduct(h.client);
111
111
  const before = await h.client.cart.get();
112
112
  if (!before.ok) throw before.error;
113
113
  const itemId = before.value.items[0]?.id;
@@ -133,28 +133,28 @@ function createContractSuite(opts = {}) {
133
133
  vitest.describe(opts.label ?? "SDK \u2194 mock contract", () => {
134
134
  let h;
135
135
  vitest.beforeEach(() => {
136
- h = chunkXGKMSLMJ_js.createTestClient(opts);
136
+ h = chunkY64AIRGW_js.createTestClient(opts);
137
137
  });
138
138
  vitest.afterEach(() => h.dispose());
139
139
  vitest.it("AddItemPayload schema accepts a minimal valid body", () => {
140
- const result = chunkXGKMSLMJ_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: 1 });
140
+ const result = chunkY64AIRGW_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: 1 });
141
141
  vitest.expect(result.success).toBe(true);
142
142
  });
143
143
  vitest.it("AddItemPayload schema rejects negative quantity", () => {
144
- const result = chunkXGKMSLMJ_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: -1 });
144
+ const result = chunkY64AIRGW_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: -1 });
145
145
  vitest.expect(result.success).toBe(false);
146
146
  });
147
147
  vitest.it("AddItemPayload schema rejects empty item_id", () => {
148
- const result = chunkXGKMSLMJ_js.AddItemPayloadSchema.safeParse({ item_id: "", quantity: 1 });
148
+ const result = chunkY64AIRGW_js.AddItemPayloadSchema.safeParse({ item_id: "", quantity: 1 });
149
149
  vitest.expect(result.success).toBe(false);
150
150
  });
151
151
  vitest.it("Cart line items returned by the mock match CartItemSchema", async () => {
152
- const { product } = await chunkXGKMSLMJ_js.fixtures.addFirstProduct(h.client);
152
+ const { product } = await chunkY64AIRGW_js.fixtures.addFirstProduct(h.client);
153
153
  const get = await h.client.cart.get();
154
154
  if (!get.ok) throw get.error;
155
155
  vitest.expect(get.value.items.length).toBeGreaterThan(0);
156
156
  for (const item of get.value.items) {
157
- const result = chunkXGKMSLMJ_js.CartItemSchema.safeParse(item);
157
+ const result = chunkY64AIRGW_js.CartItemSchema.safeParse(item);
158
158
  if (!result.success) {
159
159
  const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
160
160
  throw new Error(`Cart item shape mismatch for ${product.name}:
@@ -164,19 +164,19 @@ ${issues}`);
164
164
  }
165
165
  });
166
166
  vitest.it("CheckoutResponse from the mock includes bill_token", async () => {
167
- await chunkXGKMSLMJ_js.fixtures.addFirstProduct(h.client);
167
+ await chunkY64AIRGW_js.fixtures.addFirstProduct(h.client);
168
168
  const cartRes = await h.client.cart.get();
169
169
  if (!cartRes.ok) throw cartRes.error;
170
170
  const checkout = await h.client.checkout.process({
171
171
  cart_id: cartRes.value.id,
172
- customer: chunkXGKMSLMJ_js.fixtures.customer(),
172
+ customer: chunkY64AIRGW_js.fixtures.customer(),
173
173
  order_type: "delivery",
174
174
  payment_method: "mobile_money",
175
175
  mobile_money_details: { phone_number: "+233244000000", provider: "mtn" }
176
176
  });
177
177
  vitest.expect(checkout.ok).toBe(true);
178
178
  if (!checkout.ok) return;
179
- const result = chunkXGKMSLMJ_js.CheckoutResponseSchema.safeParse(checkout.value);
179
+ const result = chunkY64AIRGW_js.CheckoutResponseSchema.safeParse(checkout.value);
180
180
  if (!result.success) {
181
181
  const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
182
182
  throw new Error(`CheckoutResponse shape mismatch:
@@ -1,5 +1,5 @@
1
- import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-UUW7WBCG.mjs';
2
- import '../chunk-QXMO2LGU.mjs';
1
+ import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-BYWJSPT4.mjs';
2
+ import '../chunk-J7L5LHGK.mjs';
3
3
  import '../chunk-H337NF4O.mjs';
4
4
  import '../chunk-3BKMNVTR.mjs';
5
5
  import '../chunk-TD3AY34U.mjs';