@cimplify/sdk 0.103.0 → 0.104.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/advanced.d.mts +3 -7
  2. package/dist/advanced.d.ts +3 -7
  3. package/dist/advanced.js +23 -23
  4. package/dist/advanced.mjs +4 -4
  5. package/dist/{client-DHBwvh7U.d.ts → catalogue-BlQ85Uma.d.mts} +492 -748
  6. package/dist/{client-BfpNjJ_a.d.mts → catalogue-C8TqOj9K.d.ts} +492 -748
  7. package/dist/{payment-H5LoIvXU.d.mts → checkout-BqK9XUz5.d.mts} +4338 -1495
  8. package/dist/{payment-H5LoIvXU.d.ts → checkout-BqK9XUz5.d.ts} +4338 -1495
  9. package/dist/{chunk-GOHSXBKW.mjs → chunk-33VCYWVL.mjs} +25 -1
  10. package/dist/{chunk-C2JSNJUC.mjs → chunk-6G3ANKQA.mjs} +1080 -369
  11. package/dist/{chunk-QOWPGS7Z.js → chunk-BWEIMKLF.js} +572 -17
  12. package/dist/{chunk-JSWJ4XDE.js → chunk-DQEXY542.js} +1630 -824
  13. package/dist/{chunk-CNN7Z2IP.js → chunk-EV2EVOYS.js} +27 -0
  14. package/dist/{chunk-VIL6IQCG.js → chunk-HYFA67A7.js} +1084 -373
  15. package/dist/{chunk-H7ACMHM3.mjs → chunk-L5SNEU2O.mjs} +553 -16
  16. package/dist/{chunk-JG5CQNCB.js → chunk-RBNBSQI7.mjs} +221 -19
  17. package/dist/{chunk-VNPEYLB2.mjs → chunk-SFUJMS5E.js} +265 -2
  18. package/dist/{chunk-M4URVKHE.mjs → chunk-U54CWUUT.mjs} +11 -2
  19. package/dist/{chunk-GERXZQSX.mjs → chunk-UFOWPN3D.mjs} +967 -582
  20. package/dist/{chunk-J6PNHDHL.mjs → chunk-V4457OKB.mjs} +1580 -785
  21. package/dist/{chunk-R6OLQ33I.js → chunk-WXREIBFW.js} +1041 -654
  22. package/dist/{chunk-NNG6IFFX.js → chunk-XAUSDMMZ.js} +13 -3
  23. package/dist/{client-DpqRobY9.d.mts → client-DhXeiUrf.d.ts} +2 -2
  24. package/dist/{client-Dqg2mc-7.d.ts → client-mXiUrV4X.d.mts} +2 -2
  25. package/dist/{index-C8uDqLwJ.d.ts → index-B0AdZvrM.d.mts} +9 -4
  26. package/dist/{index-e2y6AK70.d.mts → index-CK8Nk5uQ.d.ts} +9 -4
  27. package/dist/index-DPWI5XcU.d.ts +8 -0
  28. package/dist/index-DVfUh-ci.d.mts +8 -0
  29. package/dist/index.d.mts +34 -15
  30. package/dist/index.d.ts +34 -15
  31. package/dist/index.js +306 -133
  32. package/dist/index.mjs +7 -6
  33. package/dist/mock/cli.mjs +1494 -395
  34. package/dist/mock/library.js +1220 -361
  35. package/dist/mock/library.mjs +1220 -361
  36. package/dist/mock/msw.js +1220 -361
  37. package/dist/mock/msw.mjs +1220 -361
  38. package/dist/{price-C2RqscMY.d.ts → price-6hQIIac9.d.ts} +1 -1
  39. package/dist/{price-BvePgDXe.d.mts → price-BUDv1rI7.d.mts} +1 -1
  40. package/dist/react.d.mts +10 -5
  41. package/dist/react.d.ts +10 -5
  42. package/dist/react.js +279 -225
  43. package/dist/react.mjs +140 -86
  44. package/dist/{server-DoXIpSd7.d.ts → server-DJ0mSs9i.d.mts} +33 -57
  45. package/dist/{server-C7FyLdrz.d.mts → server-DSTX76Ki.d.ts} +33 -57
  46. package/dist/server.d.mts +3 -4
  47. package/dist/server.d.ts +3 -4
  48. package/dist/server.js +12 -11
  49. package/dist/server.mjs +6 -5
  50. package/dist/styles.css +2 -2
  51. package/dist/testing/msw.d.mts +2 -2
  52. package/dist/testing/msw.d.ts +2 -2
  53. package/dist/testing/msw.js +4 -4
  54. package/dist/testing/msw.mjs +3 -3
  55. package/dist/testing/suite.d.mts +5 -6
  56. package/dist/testing/suite.d.ts +5 -6
  57. package/dist/testing/suite.js +29 -28
  58. package/dist/testing/suite.mjs +10 -9
  59. package/dist/testing.d.mts +2217 -14
  60. package/dist/testing.d.ts +2217 -14
  61. package/dist/testing.js +173 -83
  62. package/dist/testing.mjs +28 -10
  63. package/dist/utils.d.mts +3 -4
  64. package/dist/utils.d.ts +3 -4
  65. package/dist/utils.js +35 -31
  66. package/dist/utils.mjs +2 -2
  67. package/package.json +9 -9
  68. package/registry/chat-widget.json +1 -1
  69. package/registry/order-history.json +1 -1
  70. package/registry/order-summary.json +1 -1
  71. package/dist/link-cuNVYc2s.d.mts +0 -297
  72. package/dist/link-cuNVYc2s.d.ts +0 -297
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkQOWPGS7Z_js = require('../chunk-QOWPGS7Z.js');
4
- require('../chunk-VIL6IQCG.js');
3
+ var chunkBWEIMKLF_js = require('../chunk-BWEIMKLF.js');
4
+ require('../chunk-HYFA67A7.js');
5
+ require('../chunk-WXREIBFW.js');
5
6
  require('../chunk-XREIZ56K.js');
6
- require('../chunk-R6OLQ33I.js');
7
- require('../chunk-JSWJ4XDE.js');
8
- require('../chunk-CNN7Z2IP.js');
9
- require('../chunk-NNG6IFFX.js');
10
- require('../chunk-JG5CQNCB.js');
7
+ require('../chunk-DQEXY542.js');
8
+ require('../chunk-EV2EVOYS.js');
9
+ require('../chunk-XAUSDMMZ.js');
10
+ require('../chunk-SFUJMS5E.js');
11
11
  require('../chunk-OWW5GUSB.js');
12
12
  var vitest = require('vitest');
13
13
 
@@ -22,11 +22,11 @@ var PLACEHOLDER_PHRASES = [
22
22
  function createBrandSuite(opts) {
23
23
  vitest.describe(opts.label ?? "brand schema", () => {
24
24
  vitest.it("conforms to the Cimplify brand contract", () => {
25
- vitest.expect(() => chunkQOWPGS7Z_js.assertBrand(opts.brand)).not.toThrow();
25
+ vitest.expect(() => chunkBWEIMKLF_js.assertBrand(opts.brand)).not.toThrow();
26
26
  });
27
27
  vitest.it("declares a known mock seed", () => {
28
28
  const b = opts.brand;
29
- vitest.expect(chunkQOWPGS7Z_js.SeedNameSchema.safeParse(b.mock?.seed).success).toBe(true);
29
+ vitest.expect(chunkBWEIMKLF_js.SeedNameSchema.safeParse(b.mock?.seed).success).toBe(true);
30
30
  });
31
31
  vitest.it("has no placeholder copy left in", () => {
32
32
  const offenders = [];
@@ -58,7 +58,7 @@ ${msg}`);
58
58
  vitest.expect(b.mock?.businessId).toMatch(/^bus_/);
59
59
  });
60
60
  vitest.it("zod-parses cleanly", () => {
61
- const result = chunkQOWPGS7Z_js.BrandSchema.safeParse(opts.brand);
61
+ const result = chunkBWEIMKLF_js.BrandSchema.safeParse(opts.brand);
62
62
  if (!result.success) {
63
63
  throw new Error(
64
64
  "Brand schema violations:\n" + result.error.issues.map((i) => ` \u2022 brand.${i.path.join(".")}: ${i.message}`).join("\n")
@@ -73,23 +73,23 @@ function createCartFlowSuite(opts = {}) {
73
73
  vitest.describe(opts.label ?? "cart flow against in-process mock", () => {
74
74
  let h;
75
75
  vitest.beforeEach(() => {
76
- h = chunkQOWPGS7Z_js.createTestClient(opts);
76
+ h = chunkBWEIMKLF_js.createTestClient(opts);
77
77
  });
78
78
  vitest.afterEach(() => h.dispose());
79
79
  vitest.it("starts with an empty cart matching the canonical shape", async () => {
80
80
  const res = await h.client.cart.get();
81
81
  vitest.expect(res.ok).toBe(true);
82
82
  if (!res.ok) return;
83
- vitest.expect(() => chunkQOWPGS7Z_js.assertCart(res.value)).not.toThrow();
83
+ vitest.expect(() => chunkBWEIMKLF_js.assertCart(res.value)).not.toThrow();
84
84
  vitest.expect(res.value.items).toHaveLength(0);
85
85
  });
86
86
  vitest.it("adds the first product, persists it, and returns a shape-valid cart", async () => {
87
- const { product, variantId } = await chunkQOWPGS7Z_js.fixtures.addFirstProduct(h.client);
87
+ const { product, variantId } = await chunkBWEIMKLF_js.fixtures.addFirstProduct(h.client);
88
88
  vitest.expect(product.id).toBeTruthy();
89
89
  const get = await h.client.cart.get();
90
90
  vitest.expect(get.ok).toBe(true);
91
91
  if (!get.ok) return;
92
- vitest.expect(() => chunkQOWPGS7Z_js.assertCart(get.value)).not.toThrow();
92
+ vitest.expect(() => chunkBWEIMKLF_js.assertCart(get.value)).not.toThrow();
93
93
  vitest.expect(get.value.items).toHaveLength(1);
94
94
  vitest.expect(get.value.items[0]?.item_id).toBe(product.id);
95
95
  if (variantId) {
@@ -100,8 +100,8 @@ function createCartFlowSuite(opts = {}) {
100
100
  vitest.expect(parseFloat(String(get.value.pricing.subtotal))).toBeGreaterThan(0);
101
101
  });
102
102
  vitest.it("dedupes by line_key when adding the same product twice", async () => {
103
- await chunkQOWPGS7Z_js.fixtures.addFirstProduct(h.client);
104
- await chunkQOWPGS7Z_js.fixtures.addFirstProduct(h.client);
103
+ await chunkBWEIMKLF_js.fixtures.addFirstProduct(h.client);
104
+ await chunkBWEIMKLF_js.fixtures.addFirstProduct(h.client);
105
105
  const res = await h.client.cart.get();
106
106
  vitest.expect(res.ok).toBe(true);
107
107
  if (!res.ok) return;
@@ -109,7 +109,7 @@ function createCartFlowSuite(opts = {}) {
109
109
  vitest.expect(res.value.items[0]?.quantity).toBe(2);
110
110
  });
111
111
  vitest.it("removes items and zeroes the subtotal", async () => {
112
- await chunkQOWPGS7Z_js.fixtures.addFirstProduct(h.client);
112
+ await chunkBWEIMKLF_js.fixtures.addFirstProduct(h.client);
113
113
  const before = await h.client.cart.get();
114
114
  if (!before.ok) throw before.error;
115
115
  const itemId = before.value.items[0]?.id;
@@ -135,28 +135,28 @@ function createContractSuite(opts = {}) {
135
135
  vitest.describe(opts.label ?? "SDK \u2194 mock contract", () => {
136
136
  let h;
137
137
  vitest.beforeEach(() => {
138
- h = chunkQOWPGS7Z_js.createTestClient(opts);
138
+ h = chunkBWEIMKLF_js.createTestClient(opts);
139
139
  });
140
140
  vitest.afterEach(() => h.dispose());
141
141
  vitest.it("AddItemPayload schema accepts a minimal valid body", () => {
142
- const result = chunkQOWPGS7Z_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: 1 });
142
+ const result = chunkBWEIMKLF_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: 1 });
143
143
  vitest.expect(result.success).toBe(true);
144
144
  });
145
145
  vitest.it("AddItemPayload schema rejects negative quantity", () => {
146
- const result = chunkQOWPGS7Z_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: -1 });
146
+ const result = chunkBWEIMKLF_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: -1 });
147
147
  vitest.expect(result.success).toBe(false);
148
148
  });
149
149
  vitest.it("AddItemPayload schema rejects empty item_id", () => {
150
- const result = chunkQOWPGS7Z_js.AddItemPayloadSchema.safeParse({ item_id: "", quantity: 1 });
150
+ const result = chunkBWEIMKLF_js.AddItemPayloadSchema.safeParse({ item_id: "", quantity: 1 });
151
151
  vitest.expect(result.success).toBe(false);
152
152
  });
153
153
  vitest.it("Cart line items returned by the mock match CartItemSchema", async () => {
154
- const { product } = await chunkQOWPGS7Z_js.fixtures.addFirstProduct(h.client);
154
+ const { product } = await chunkBWEIMKLF_js.fixtures.addFirstProduct(h.client);
155
155
  const get = await h.client.cart.get();
156
156
  if (!get.ok) throw get.error;
157
157
  vitest.expect(get.value.items.length).toBeGreaterThan(0);
158
158
  for (const item of get.value.items) {
159
- const result = chunkQOWPGS7Z_js.CartItemSchema.safeParse(item);
159
+ const result = chunkBWEIMKLF_js.CartItemSchema.safeParse(item);
160
160
  if (!result.success) {
161
161
  const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
162
162
  throw new Error(`Cart item shape mismatch for ${product.name}:
@@ -165,26 +165,27 @@ ${issues}`);
165
165
  vitest.expect(result.success).toBe(true);
166
166
  }
167
167
  });
168
- vitest.it("CheckoutResponse from the mock includes bill_token", async () => {
169
- await chunkQOWPGS7Z_js.fixtures.addFirstProduct(h.client);
168
+ vitest.it("CheckoutResponse projects purchase-intent authority without fabricating a bill token", async () => {
169
+ await chunkBWEIMKLF_js.fixtures.addFirstProduct(h.client);
170
170
  const cartRes = await h.client.cart.get();
171
171
  if (!cartRes.ok) throw cartRes.error;
172
172
  const checkout = await h.client.checkout.process({
173
173
  cart_id: cartRes.value.id,
174
- customer: chunkQOWPGS7Z_js.fixtures.customer(),
174
+ customer: chunkBWEIMKLF_js.fixtures.customer(),
175
175
  order_type: "delivery",
176
176
  payment_method: "mobile_money",
177
177
  mobile_money_details: { phone_number: "+233244000000", provider: "mtn" }
178
178
  });
179
179
  vitest.expect(checkout.ok).toBe(true);
180
180
  if (!checkout.ok) return;
181
- const result = chunkQOWPGS7Z_js.CheckoutResponseSchema.safeParse(checkout.value);
181
+ const result = chunkBWEIMKLF_js.CheckoutResponseSchema.safeParse(checkout.value);
182
182
  if (!result.success) {
183
183
  const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
184
184
  throw new Error(`CheckoutResponse shape mismatch:
185
185
  ${issues}`);
186
186
  }
187
- vitest.expect(checkout.value.bill_token).toBeTruthy();
187
+ vitest.expect(checkout.value.intent_id).toBeTruthy();
188
+ vitest.expect(checkout.value.bill_token).toBeUndefined();
188
189
  vitest.expect(checkout.value.order_id).toBeTruthy();
189
190
  });
190
191
  opts.extend?.({ getHandle: () => h, it: vitest.it });
@@ -1,11 +1,11 @@
1
- import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-H7ACMHM3.mjs';
2
- import '../chunk-C2JSNJUC.mjs';
1
+ import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-L5SNEU2O.mjs';
2
+ import '../chunk-6G3ANKQA.mjs';
3
+ import '../chunk-UFOWPN3D.mjs';
3
4
  import '../chunk-U4MW6PYU.mjs';
4
- import '../chunk-GERXZQSX.mjs';
5
- import '../chunk-J6PNHDHL.mjs';
6
- import '../chunk-GOHSXBKW.mjs';
7
- import '../chunk-M4URVKHE.mjs';
8
- import '../chunk-VNPEYLB2.mjs';
5
+ import '../chunk-V4457OKB.mjs';
6
+ import '../chunk-33VCYWVL.mjs';
7
+ import '../chunk-U54CWUUT.mjs';
8
+ import '../chunk-RBNBSQI7.mjs';
9
9
  import '../chunk-3G6RQLXK.mjs';
10
10
  import { describe, it, expect, beforeEach, afterEach } from 'vitest';
11
11
 
@@ -163,7 +163,7 @@ ${issues}`);
163
163
  expect(result.success).toBe(true);
164
164
  }
165
165
  });
166
- it("CheckoutResponse from the mock includes bill_token", async () => {
166
+ it("CheckoutResponse projects purchase-intent authority without fabricating a bill token", async () => {
167
167
  await fixtures.addFirstProduct(h.client);
168
168
  const cartRes = await h.client.cart.get();
169
169
  if (!cartRes.ok) throw cartRes.error;
@@ -182,7 +182,8 @@ ${issues}`);
182
182
  throw new Error(`CheckoutResponse shape mismatch:
183
183
  ${issues}`);
184
184
  }
185
- expect(checkout.value.bill_token).toBeTruthy();
185
+ expect(checkout.value.intent_id).toBeTruthy();
186
+ expect(checkout.value.bill_token).toBeUndefined();
186
187
  expect(checkout.value.order_id).toBeTruthy();
187
188
  });
188
189
  opts.extend?.({ getHandle: () => h, it });