@cimplify/sdk 0.94.2 → 0.96.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.
package/dist/react.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  var chunkHKN3YG76_js = require('./chunk-HKN3YG76.js');
5
5
  var chunkXREIZ56K_js = require('./chunk-XREIZ56K.js');
6
- var chunkQLGZIBRO_js = require('./chunk-QLGZIBRO.js');
6
+ var chunkW5PH7SPK_js = require('./chunk-W5PH7SPK.js');
7
7
  var chunkVEOAMBEX_js = require('./chunk-VEOAMBEX.js');
8
8
  var chunkPTPOQVXS_js = require('./chunk-PTPOQVXS.js');
9
9
  var chunkAETVRBKI_js = require('./chunk-AETVRBKI.js');
@@ -806,7 +806,7 @@ async function syncFromServer(entry) {
806
806
  return next;
807
807
  }
808
808
  function emitMutationError(entry, operation, opId, idempotencyKey, error) {
809
- entry.client.events.emit(chunkQLGZIBRO_js.MUTATION_ERROR, {
809
+ entry.client.events.emit(chunkW5PH7SPK_js.MUTATION_ERROR, {
810
810
  service: "cart",
811
811
  operation,
812
812
  opId,
@@ -846,10 +846,10 @@ function getOrCreateStore(params) {
846
846
  syncTail: Promise.resolve(),
847
847
  failedOpRemovers: /* @__PURE__ */ new Set()
848
848
  };
849
- client.events.on(chunkQLGZIBRO_js.SESSION_CLAIMED, () => {
849
+ client.events.on(chunkW5PH7SPK_js.SESSION_CLAIMED, () => {
850
850
  if (entry.initialized) void syncFromServer(entry);
851
851
  });
852
- client.events.on(chunkQLGZIBRO_js.SESSION_CLEARED, () => {
852
+ client.events.on(chunkW5PH7SPK_js.SESSION_CLEARED, () => {
853
853
  if (entry.initialized) void syncFromServer(entry);
854
854
  });
855
855
  cartStores.set(storeKey, entry);
@@ -1137,40 +1137,6 @@ function preconnectOrigin(url, crossOrigin) {
1137
1137
  if (crossOrigin) link.crossOrigin = crossOrigin;
1138
1138
  document.head.appendChild(link);
1139
1139
  }
1140
- function subscribeToPathChanges(onChange) {
1141
- const { pushState, replaceState } = window.history;
1142
- window.history.pushState = function(...args) {
1143
- pushState.apply(this, args);
1144
- onChange();
1145
- };
1146
- window.history.replaceState = function(...args) {
1147
- replaceState.apply(this, args);
1148
- onChange();
1149
- };
1150
- window.addEventListener("popstate", onChange);
1151
- return () => {
1152
- window.history.pushState = pushState;
1153
- window.history.replaceState = replaceState;
1154
- window.removeEventListener("popstate", onChange);
1155
- };
1156
- }
1157
- function usePageViewTracking(client, enabled) {
1158
- React14.useEffect(() => {
1159
- if (!enabled || typeof window === "undefined") return;
1160
- let lastPath = null;
1161
- const record = () => {
1162
- const path = window.location.pathname;
1163
- if (path === lastPath) return;
1164
- lastPath = path;
1165
- try {
1166
- client.activity?.trackPageView({ pagePath: path });
1167
- } catch {
1168
- }
1169
- };
1170
- record();
1171
- return subscribeToPathChanges(record);
1172
- }, [client, enabled]);
1173
- }
1174
1140
  var LOCATION_STORAGE_KEY = "cimplify_location_id";
1175
1141
  var DISPLAY_CURRENCY_STORAGE_KEY = "cimplify_display_currency";
1176
1142
  var FX_REFRESH_INTERVAL = 12e4;
@@ -1179,7 +1145,7 @@ var DEFAULT_COUNTRY = "US";
1179
1145
  function createDefaultClient() {
1180
1146
  const processRef = globalThis.process;
1181
1147
  const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
1182
- return chunkQLGZIBRO_js.createCimplifyClient({ publicKey: envPublicKey });
1148
+ return chunkW5PH7SPK_js.createCimplifyClient({ publicKey: envPublicKey });
1183
1149
  }
1184
1150
  function getStoredLocationId() {
1185
1151
  if (typeof window === "undefined" || !window.localStorage) {
@@ -1251,11 +1217,9 @@ function CimplifyProvider({
1251
1217
  initialLocations,
1252
1218
  optimistic = true,
1253
1219
  prefetch,
1254
- linkComponent,
1255
- trackPageViews = true
1220
+ linkComponent
1256
1221
  }) {
1257
1222
  const resolvedClient = React14.useMemo(() => client ?? createDefaultClient(), [client]);
1258
- usePageViewTracking(resolvedClient, trackPageViews);
1259
1223
  const resolvedPrefetch = React14.useMemo(
1260
1224
  () => ({
1261
1225
  mode: prefetch?.mode ?? DEFAULT_PREFETCH_OPTIONS.mode,
@@ -6195,7 +6159,7 @@ function useChat(options = {}) {
6195
6159
  const watchSessionClaims = React14.useCallback(() => {
6196
6160
  const c = clientRef.current;
6197
6161
  if (!c || claimUnsubRef.current) return;
6198
- const unsubClaimed = c.events.on(chunkQLGZIBRO_js.SESSION_CLAIMED, (event) => {
6162
+ const unsubClaimed = c.events.on(chunkW5PH7SPK_js.SESSION_CLAIMED, (event) => {
6199
6163
  setClaimedAs(event.customerName || c.support.claimedCustomerName || null);
6200
6164
  if (!openedRef.current) {
6201
6165
  void openIfExisting();
@@ -6204,7 +6168,7 @@ function useChat(options = {}) {
6204
6168
  connectWebSocket();
6205
6169
  void resyncConversation();
6206
6170
  });
6207
- const unsubCleared = c.events.on(chunkQLGZIBRO_js.SESSION_CLEARED, resetConversation);
6171
+ const unsubCleared = c.events.on(chunkW5PH7SPK_js.SESSION_CLEARED, resetConversation);
6208
6172
  claimUnsubRef.current = () => {
6209
6173
  unsubClaimed();
6210
6174
  unsubCleared();
@@ -9299,6 +9263,7 @@ function SlotPicker({
9299
9263
  hideElapsedSlots = true,
9300
9264
  minLeadMinutes = 0,
9301
9265
  emptyMessage = "No available slots",
9266
+ contactPhone,
9302
9267
  className,
9303
9268
  classNames
9304
9269
  }) {
@@ -9331,13 +9296,20 @@ function SlotPicker({
9331
9296
  );
9332
9297
  }
9333
9298
  if (slots.length === 0) {
9334
- return /* @__PURE__ */ jsxRuntime.jsx(
9299
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9335
9300
  "div",
9336
9301
  {
9337
9302
  "data-cimplify-slot-picker": true,
9338
9303
  "data-empty": true,
9339
9304
  className: cn(className, classNames?.root, classNames?.empty),
9340
- children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: emptyMessage })
9305
+ children: [
9306
+ /* @__PURE__ */ jsxRuntime.jsx("p", { children: emptyMessage }),
9307
+ contactPhone ? /* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: `tel:${contactPhone.replace(/\s+/g, "")}`, children: [
9308
+ "Call ",
9309
+ contactPhone,
9310
+ " to book"
9311
+ ] }) }) : null
9312
+ ]
9341
9313
  }
9342
9314
  );
9343
9315
  }
@@ -9464,6 +9436,7 @@ function DateSlotPicker({
9464
9436
  durationValue,
9465
9437
  hideElapsedSlots = true,
9466
9438
  minLeadMinutes = 0,
9439
+ contactPhone,
9467
9440
  className,
9468
9441
  classNames
9469
9442
  }) {
@@ -9613,7 +9586,8 @@ function DateSlotPicker({
9613
9586
  durationUnit,
9614
9587
  durationValue,
9615
9588
  hideElapsedSlots,
9616
- minLeadMinutes
9589
+ minLeadMinutes,
9590
+ contactPhone
9617
9591
  }
9618
9592
  ) })
9619
9593
  ]
package/dist/react.mjs CHANGED
@@ -3,7 +3,7 @@ import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, isMultiDayServi
3
3
  export { getVariantDisplayName } from './chunk-RRBY35TJ.mjs';
4
4
  import { messagePreview } from './chunk-U4MW6PYU.mjs';
5
5
  export { messagePreview, splitGenUIContent } from './chunk-U4MW6PYU.mjs';
6
- import { SESSION_CLAIMED, SESSION_CLEARED, createCimplifyClient, MUTATION_ERROR } from './chunk-FKARGZK3.mjs';
6
+ import { SESSION_CLAIMED, SESSION_CLEARED, createCimplifyClient, MUTATION_ERROR } from './chunk-XMDLF5Y6.mjs';
7
7
  import { generateIdempotencyKey, ELEMENT_TYPES, EVENT_TYPES, startSignIn } from './chunk-VUSHG3HA.mjs';
8
8
  import { parsePrice, formatMoney, formatPrice, getProductCurrency, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-KFLGQGMC.mjs';
9
9
  import { isSupportedCurrency, CimplifyError } from './chunk-K5EN2W2Q.mjs';
@@ -1113,40 +1113,6 @@ function preconnectOrigin(url, crossOrigin) {
1113
1113
  if (crossOrigin) link.crossOrigin = crossOrigin;
1114
1114
  document.head.appendChild(link);
1115
1115
  }
1116
- function subscribeToPathChanges(onChange) {
1117
- const { pushState, replaceState } = window.history;
1118
- window.history.pushState = function(...args) {
1119
- pushState.apply(this, args);
1120
- onChange();
1121
- };
1122
- window.history.replaceState = function(...args) {
1123
- replaceState.apply(this, args);
1124
- onChange();
1125
- };
1126
- window.addEventListener("popstate", onChange);
1127
- return () => {
1128
- window.history.pushState = pushState;
1129
- window.history.replaceState = replaceState;
1130
- window.removeEventListener("popstate", onChange);
1131
- };
1132
- }
1133
- function usePageViewTracking(client, enabled) {
1134
- useEffect(() => {
1135
- if (!enabled || typeof window === "undefined") return;
1136
- let lastPath = null;
1137
- const record = () => {
1138
- const path = window.location.pathname;
1139
- if (path === lastPath) return;
1140
- lastPath = path;
1141
- try {
1142
- client.activity?.trackPageView({ pagePath: path });
1143
- } catch {
1144
- }
1145
- };
1146
- record();
1147
- return subscribeToPathChanges(record);
1148
- }, [client, enabled]);
1149
- }
1150
1116
  var LOCATION_STORAGE_KEY = "cimplify_location_id";
1151
1117
  var DISPLAY_CURRENCY_STORAGE_KEY = "cimplify_display_currency";
1152
1118
  var FX_REFRESH_INTERVAL = 12e4;
@@ -1227,11 +1193,9 @@ function CimplifyProvider({
1227
1193
  initialLocations,
1228
1194
  optimistic = true,
1229
1195
  prefetch,
1230
- linkComponent,
1231
- trackPageViews = true
1196
+ linkComponent
1232
1197
  }) {
1233
1198
  const resolvedClient = useMemo(() => client ?? createDefaultClient(), [client]);
1234
- usePageViewTracking(resolvedClient, trackPageViews);
1235
1199
  const resolvedPrefetch = useMemo(
1236
1200
  () => ({
1237
1201
  mode: prefetch?.mode ?? DEFAULT_PREFETCH_OPTIONS.mode,
@@ -9275,6 +9239,7 @@ function SlotPicker({
9275
9239
  hideElapsedSlots = true,
9276
9240
  minLeadMinutes = 0,
9277
9241
  emptyMessage = "No available slots",
9242
+ contactPhone,
9278
9243
  className,
9279
9244
  classNames
9280
9245
  }) {
@@ -9307,13 +9272,20 @@ function SlotPicker({
9307
9272
  );
9308
9273
  }
9309
9274
  if (slots.length === 0) {
9310
- return /* @__PURE__ */ jsx(
9275
+ return /* @__PURE__ */ jsxs(
9311
9276
  "div",
9312
9277
  {
9313
9278
  "data-cimplify-slot-picker": true,
9314
9279
  "data-empty": true,
9315
9280
  className: cn(className, classNames?.root, classNames?.empty),
9316
- children: /* @__PURE__ */ jsx("p", { children: emptyMessage })
9281
+ children: [
9282
+ /* @__PURE__ */ jsx("p", { children: emptyMessage }),
9283
+ contactPhone ? /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsxs("a", { href: `tel:${contactPhone.replace(/\s+/g, "")}`, children: [
9284
+ "Call ",
9285
+ contactPhone,
9286
+ " to book"
9287
+ ] }) }) : null
9288
+ ]
9317
9289
  }
9318
9290
  );
9319
9291
  }
@@ -9440,6 +9412,7 @@ function DateSlotPicker({
9440
9412
  durationValue,
9441
9413
  hideElapsedSlots = true,
9442
9414
  minLeadMinutes = 0,
9415
+ contactPhone,
9443
9416
  className,
9444
9417
  classNames
9445
9418
  }) {
@@ -9589,7 +9562,8 @@ function DateSlotPicker({
9589
9562
  durationUnit,
9590
9563
  durationValue,
9591
9564
  hideElapsedSlots,
9592
- minLeadMinutes
9565
+ minLeadMinutes,
9566
+ contactPhone
9593
9567
  }
9594
9568
  ) })
9595
9569
  ]
package/dist/server.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { af as CimplifyClient } from './client-BTL9d_nN.mjs';
2
- export { J as CacheOptions, cC as ReadRequestOptions, cZ as Result } from './client-BTL9d_nN.mjs';
1
+ import { af as CimplifyClient } from './client-BNfVL2IL.mjs';
2
+ export { J as CacheOptions, cC as ReadRequestOptions, cZ as Result } from './client-BNfVL2IL.mjs';
3
3
  export { S as Category, V as CimplifyError, W as Collection, aZ as Product, bb as ProductWithDetails } from './product-O8-wcHSe.mjs';
4
4
  import { JWTVerifyResult } from 'jose';
5
5
  import './payment-pKPpaORI.mjs';
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { af as CimplifyClient } from './client-BX30FAWZ.js';
2
- export { J as CacheOptions, cC as ReadRequestOptions, cZ as Result } from './client-BX30FAWZ.js';
1
+ import { af as CimplifyClient } from './client-CX59ew7C.js';
2
+ export { J as CacheOptions, cC as ReadRequestOptions, cZ as Result } from './client-CX59ew7C.js';
3
3
  export { S as Category, V as CimplifyError, W as Collection, aZ as Product, bb as ProductWithDetails } from './product-O8-wcHSe.js';
4
4
  import { JWTVerifyResult } from 'jose';
5
5
  import './payment-By0JidTe.js';
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkQLGZIBRO_js = require('./chunk-QLGZIBRO.js');
3
+ var chunkW5PH7SPK_js = require('./chunk-W5PH7SPK.js');
4
4
  var chunkVEOAMBEX_js = require('./chunk-VEOAMBEX.js');
5
5
  require('./chunk-PTPOQVXS.js');
6
6
  var chunkAETVRBKI_js = require('./chunk-AETVRBKI.js');
@@ -26,7 +26,7 @@ function readEnv(...keys) {
26
26
  var getServerClient = react.cache((opts = {}) => {
27
27
  const baseUrl = opts.apiUrl ?? readEnv("CIMPLIFY_API_URL", "NEXT_PUBLIC_CIMPLIFY_API_URL") ?? defaultBaseUrl();
28
28
  const publicKey = opts.secretKey ?? readEnv("CIMPLIFY_SECRET_KEY", "NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY") ?? "mock-dev";
29
- const client = chunkQLGZIBRO_js.createCimplifyClient({
29
+ const client = chunkW5PH7SPK_js.createCimplifyClient({
30
30
  baseUrl,
31
31
  publicKey,
32
32
  suppressPublicKeyWarning: true
package/dist/server.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createCimplifyClient } from './chunk-FKARGZK3.mjs';
1
+ import { createCimplifyClient } from './chunk-XMDLF5Y6.mjs';
2
2
  import { PKCE_COOKIE, decodePkceState, PKCE_COOKIE_PATH, DEFAULT_ISSUER } from './chunk-VUSHG3HA.mjs';
3
3
  import './chunk-KFLGQGMC.mjs';
4
4
  export { CimplifyError } from './chunk-K5EN2W2Q.mjs';
@@ -1,8 +1,8 @@
1
1
  import { TestAPI } from 'vitest';
2
- import { T as TestClientHandle } from '../client-BycFj07D.mjs';
2
+ import { T as TestClientHandle } from '../client-BeMhSkRT.mjs';
3
3
  import { C as CreateAppOptions } from '../server-HVDbbqR9.mjs';
4
4
  export { S as SeedName } from '../server-HVDbbqR9.mjs';
5
- import '../client-BTL9d_nN.mjs';
5
+ import '../client-BNfVL2IL.mjs';
6
6
  import '../product-O8-wcHSe.mjs';
7
7
  import '../payment-pKPpaORI.mjs';
8
8
  import 'hono';
@@ -1,8 +1,8 @@
1
1
  import { TestAPI } from 'vitest';
2
- import { T as TestClientHandle } from '../client-DqYNEMce.js';
2
+ import { T as TestClientHandle } from '../client-CCCOOaI3.js';
3
3
  import { C as CreateAppOptions } from '../server-JBuTPY-j.js';
4
4
  export { S as SeedName } from '../server-JBuTPY-j.js';
5
- import '../client-BX30FAWZ.js';
5
+ import '../client-CX59ew7C.js';
6
6
  import '../product-O8-wcHSe.js';
7
7
  import '../payment-By0JidTe.js';
8
8
  import 'hono';
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkRQMCRU4C_js = require('../chunk-RQMCRU4C.js');
3
+ var chunkWEEGNH7K_js = require('../chunk-WEEGNH7K.js');
4
4
  require('../chunk-FECGCIVV.js');
5
5
  require('../chunk-XREIZ56K.js');
6
- require('../chunk-QLGZIBRO.js');
6
+ require('../chunk-W5PH7SPK.js');
7
7
  require('../chunk-VEOAMBEX.js');
8
8
  require('../chunk-PTPOQVXS.js');
9
9
  require('../chunk-AETVRBKI.js');
@@ -21,11 +21,11 @@ var PLACEHOLDER_PHRASES = [
21
21
  function createBrandSuite(opts) {
22
22
  vitest.describe(opts.label ?? "brand schema", () => {
23
23
  vitest.it("conforms to the Cimplify brand contract", () => {
24
- vitest.expect(() => chunkRQMCRU4C_js.assertBrand(opts.brand)).not.toThrow();
24
+ vitest.expect(() => chunkWEEGNH7K_js.assertBrand(opts.brand)).not.toThrow();
25
25
  });
26
26
  vitest.it("declares a known mock seed", () => {
27
27
  const b = opts.brand;
28
- vitest.expect(chunkRQMCRU4C_js.SeedNameSchema.safeParse(b.mock?.seed).success).toBe(true);
28
+ vitest.expect(chunkWEEGNH7K_js.SeedNameSchema.safeParse(b.mock?.seed).success).toBe(true);
29
29
  });
30
30
  vitest.it("has no placeholder copy left in", () => {
31
31
  const offenders = [];
@@ -57,7 +57,7 @@ ${msg}`);
57
57
  vitest.expect(b.mock?.businessId).toMatch(/^bus_/);
58
58
  });
59
59
  vitest.it("zod-parses cleanly", () => {
60
- const result = chunkRQMCRU4C_js.BrandSchema.safeParse(opts.brand);
60
+ const result = chunkWEEGNH7K_js.BrandSchema.safeParse(opts.brand);
61
61
  if (!result.success) {
62
62
  throw new Error(
63
63
  "Brand schema violations:\n" + result.error.issues.map((i) => ` \u2022 brand.${i.path.join(".")}: ${i.message}`).join("\n")
@@ -72,23 +72,23 @@ function createCartFlowSuite(opts = {}) {
72
72
  vitest.describe(opts.label ?? "cart flow against in-process mock", () => {
73
73
  let h;
74
74
  vitest.beforeEach(() => {
75
- h = chunkRQMCRU4C_js.createTestClient(opts);
75
+ h = chunkWEEGNH7K_js.createTestClient(opts);
76
76
  });
77
77
  vitest.afterEach(() => h.dispose());
78
78
  vitest.it("starts with an empty cart matching the canonical shape", async () => {
79
79
  const res = await h.client.cart.get();
80
80
  vitest.expect(res.ok).toBe(true);
81
81
  if (!res.ok) return;
82
- vitest.expect(() => chunkRQMCRU4C_js.assertCart(res.value)).not.toThrow();
82
+ vitest.expect(() => chunkWEEGNH7K_js.assertCart(res.value)).not.toThrow();
83
83
  vitest.expect(res.value.items).toHaveLength(0);
84
84
  });
85
85
  vitest.it("adds the first product, persists it, and returns a shape-valid cart", async () => {
86
- const { product, variantId } = await chunkRQMCRU4C_js.fixtures.addFirstProduct(h.client);
86
+ const { product, variantId } = await chunkWEEGNH7K_js.fixtures.addFirstProduct(h.client);
87
87
  vitest.expect(product.id).toBeTruthy();
88
88
  const get = await h.client.cart.get();
89
89
  vitest.expect(get.ok).toBe(true);
90
90
  if (!get.ok) return;
91
- vitest.expect(() => chunkRQMCRU4C_js.assertCart(get.value)).not.toThrow();
91
+ vitest.expect(() => chunkWEEGNH7K_js.assertCart(get.value)).not.toThrow();
92
92
  vitest.expect(get.value.items).toHaveLength(1);
93
93
  vitest.expect(get.value.items[0]?.item_id).toBe(product.id);
94
94
  if (variantId) {
@@ -99,8 +99,8 @@ function createCartFlowSuite(opts = {}) {
99
99
  vitest.expect(parseFloat(String(get.value.pricing.subtotal))).toBeGreaterThan(0);
100
100
  });
101
101
  vitest.it("dedupes by line_key when adding the same product twice", async () => {
102
- await chunkRQMCRU4C_js.fixtures.addFirstProduct(h.client);
103
- await chunkRQMCRU4C_js.fixtures.addFirstProduct(h.client);
102
+ await chunkWEEGNH7K_js.fixtures.addFirstProduct(h.client);
103
+ await chunkWEEGNH7K_js.fixtures.addFirstProduct(h.client);
104
104
  const res = await h.client.cart.get();
105
105
  vitest.expect(res.ok).toBe(true);
106
106
  if (!res.ok) return;
@@ -108,7 +108,7 @@ function createCartFlowSuite(opts = {}) {
108
108
  vitest.expect(res.value.items[0]?.quantity).toBe(2);
109
109
  });
110
110
  vitest.it("removes items and zeroes the subtotal", async () => {
111
- await chunkRQMCRU4C_js.fixtures.addFirstProduct(h.client);
111
+ await chunkWEEGNH7K_js.fixtures.addFirstProduct(h.client);
112
112
  const before = await h.client.cart.get();
113
113
  if (!before.ok) throw before.error;
114
114
  const itemId = before.value.items[0]?.id;
@@ -134,28 +134,28 @@ function createContractSuite(opts = {}) {
134
134
  vitest.describe(opts.label ?? "SDK \u2194 mock contract", () => {
135
135
  let h;
136
136
  vitest.beforeEach(() => {
137
- h = chunkRQMCRU4C_js.createTestClient(opts);
137
+ h = chunkWEEGNH7K_js.createTestClient(opts);
138
138
  });
139
139
  vitest.afterEach(() => h.dispose());
140
140
  vitest.it("AddItemPayload schema accepts a minimal valid body", () => {
141
- const result = chunkRQMCRU4C_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: 1 });
141
+ const result = chunkWEEGNH7K_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: 1 });
142
142
  vitest.expect(result.success).toBe(true);
143
143
  });
144
144
  vitest.it("AddItemPayload schema rejects negative quantity", () => {
145
- const result = chunkRQMCRU4C_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: -1 });
145
+ const result = chunkWEEGNH7K_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: -1 });
146
146
  vitest.expect(result.success).toBe(false);
147
147
  });
148
148
  vitest.it("AddItemPayload schema rejects empty item_id", () => {
149
- const result = chunkRQMCRU4C_js.AddItemPayloadSchema.safeParse({ item_id: "", quantity: 1 });
149
+ const result = chunkWEEGNH7K_js.AddItemPayloadSchema.safeParse({ item_id: "", quantity: 1 });
150
150
  vitest.expect(result.success).toBe(false);
151
151
  });
152
152
  vitest.it("Cart line items returned by the mock match CartItemSchema", async () => {
153
- const { product } = await chunkRQMCRU4C_js.fixtures.addFirstProduct(h.client);
153
+ const { product } = await chunkWEEGNH7K_js.fixtures.addFirstProduct(h.client);
154
154
  const get = await h.client.cart.get();
155
155
  if (!get.ok) throw get.error;
156
156
  vitest.expect(get.value.items.length).toBeGreaterThan(0);
157
157
  for (const item of get.value.items) {
158
- const result = chunkRQMCRU4C_js.CartItemSchema.safeParse(item);
158
+ const result = chunkWEEGNH7K_js.CartItemSchema.safeParse(item);
159
159
  if (!result.success) {
160
160
  const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
161
161
  throw new Error(`Cart item shape mismatch for ${product.name}:
@@ -165,19 +165,19 @@ ${issues}`);
165
165
  }
166
166
  });
167
167
  vitest.it("CheckoutResponse from the mock includes bill_token", async () => {
168
- await chunkRQMCRU4C_js.fixtures.addFirstProduct(h.client);
168
+ await chunkWEEGNH7K_js.fixtures.addFirstProduct(h.client);
169
169
  const cartRes = await h.client.cart.get();
170
170
  if (!cartRes.ok) throw cartRes.error;
171
171
  const checkout = await h.client.checkout.process({
172
172
  cart_id: cartRes.value.id,
173
- customer: chunkRQMCRU4C_js.fixtures.customer(),
173
+ customer: chunkWEEGNH7K_js.fixtures.customer(),
174
174
  order_type: "delivery",
175
175
  payment_method: "mobile_money",
176
176
  mobile_money_details: { phone_number: "+233244000000", provider: "mtn" }
177
177
  });
178
178
  vitest.expect(checkout.ok).toBe(true);
179
179
  if (!checkout.ok) return;
180
- const result = chunkRQMCRU4C_js.CheckoutResponseSchema.safeParse(checkout.value);
180
+ const result = chunkWEEGNH7K_js.CheckoutResponseSchema.safeParse(checkout.value);
181
181
  if (!result.success) {
182
182
  const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
183
183
  throw new Error(`CheckoutResponse shape mismatch:
@@ -1,7 +1,7 @@
1
- import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-VZWK2FJM.mjs';
1
+ import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-BUPCMMRR.mjs';
2
2
  import '../chunk-7TEMLVDT.mjs';
3
3
  import '../chunk-U4MW6PYU.mjs';
4
- import '../chunk-FKARGZK3.mjs';
4
+ import '../chunk-XMDLF5Y6.mjs';
5
5
  import '../chunk-VUSHG3HA.mjs';
6
6
  import '../chunk-KFLGQGMC.mjs';
7
7
  import '../chunk-K5EN2W2Q.mjs';
@@ -1,7 +1,7 @@
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-BycFj07D.mjs';
4
- import './client-BTL9d_nN.mjs';
3
+ export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-BeMhSkRT.mjs';
4
+ import './client-BNfVL2IL.mjs';
5
5
  import './product-O8-wcHSe.mjs';
6
6
  import './payment-pKPpaORI.mjs';
7
7
  import './server-HVDbbqR9.mjs';
package/dist/testing.d.ts CHANGED
@@ -1,7 +1,7 @@
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-DqYNEMce.js';
4
- import './client-BX30FAWZ.js';
3
+ export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-CCCOOaI3.js';
4
+ import './client-CX59ew7C.js';
5
5
  import './product-O8-wcHSe.js';
6
6
  import './payment-By0JidTe.js';
7
7
  import './server-JBuTPY-j.js';