@cimplify/sdk 0.106.1 → 0.107.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/advanced.d.mts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/advanced.js +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{catalogue-ChBjPPME.d.ts → catalogue-BohD-jU_.d.mts} +44 -38
- package/dist/{catalogue-CVKH9faR.d.mts → catalogue-C4xKpirp.d.ts} +44 -38
- package/dist/{chunk-YHR6LFQ7.mjs → chunk-2I6YKE6Q.mjs} +55 -94
- package/dist/{chunk-LJSQ7TUV.js → chunk-73HY36Z7.js} +4 -4
- package/dist/{chunk-SFG2LMRD.js → chunk-HKCB73AJ.js} +55 -94
- package/dist/{chunk-IWXVKW22.mjs → chunk-IWZKCL3P.mjs} +2 -2
- package/dist/{chunk-L4XKIMUO.mjs → chunk-MKZXZDHE.mjs} +17 -0
- package/dist/{chunk-NJK3THWT.js → chunk-NX5YBQZP.js} +17 -0
- package/dist/{chunk-ABAK4YVY.mjs → chunk-P4HYAV3L.mjs} +102 -82
- package/dist/{chunk-QKL5L5IU.js → chunk-W4ZFZPPY.js} +181 -160
- package/dist/{client-BfKFK7cn.d.mts → client-BBFfAtn4.d.mts} +2 -2
- package/dist/{client-DoczTJbs.d.ts → client-ByURQZM9.d.ts} +2 -2
- package/dist/{checkout-XoV4HNg2.d.mts → elements-Dtqe9Ekd.d.mts} +348 -361
- package/dist/{checkout-XoV4HNg2.d.ts → elements-Dtqe9Ekd.d.ts} +348 -361
- package/dist/{index-DEUorPUO.d.mts → index-7oz-hVVA.d.mts} +2 -2
- package/dist/{index-DRMBo26v.d.mts → index-B6mukQYB.d.mts} +2 -2
- package/dist/{index-Dn6xCpDe.d.ts → index-CvLuAMjQ.d.ts} +2 -2
- package/dist/{index-DweR60Cv.d.ts → index-DFqDU6yU.d.ts} +2 -2
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +71 -67
- package/dist/index.mjs +3 -3
- package/dist/mock/cli.mjs +17 -0
- package/dist/mock/library.js +17 -0
- package/dist/mock/library.mjs +17 -0
- package/dist/mock/msw.js +17 -0
- package/dist/mock/msw.mjs +17 -0
- package/dist/{price-De-sxcuj.d.ts → price-B4jL81ef.d.ts} +1 -1
- package/dist/{price-CUGIYRtD.d.mts → price-Pyq-vlrm.d.mts} +1 -1
- package/dist/react.d.mts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +34 -34
- package/dist/react.mjs +5 -5
- package/dist/{server-7soMMUgP.d.ts → server-Cowuvfbr.d.ts} +1 -1
- package/dist/{server-DDEJ7e9s.d.mts → server-KilvZJU0.d.mts} +1 -1
- package/dist/server.d.mts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/server.js +7 -7
- package/dist/server.mjs +2 -2
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +2 -2
- package/dist/testing/msw.mjs +1 -1
- package/dist/testing/suite.d.mts +5 -5
- package/dist/testing/suite.d.ts +5 -5
- package/dist/testing/suite.js +24 -24
- package/dist/testing/suite.mjs +4 -4
- package/dist/testing.d.mts +4 -4
- package/dist/testing.d.ts +4 -4
- package/dist/testing.js +116 -116
- package/dist/testing.mjs +5 -5
- package/dist/utils.d.mts +3 -3
- package/dist/utils.d.ts +3 -3
- package/package.json +1 -1
package/dist/testing/suite.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TestAPI } from 'vitest';
|
|
2
|
-
import { T as TestClientHandle } from '../client-
|
|
3
|
-
import { C as CreateAppOptions } from '../server-
|
|
4
|
-
export { S as SeedName } from '../server-
|
|
5
|
-
import '../catalogue-
|
|
6
|
-
import '../
|
|
2
|
+
import { T as TestClientHandle } from '../client-ByURQZM9.js';
|
|
3
|
+
import { C as CreateAppOptions } from '../server-Cowuvfbr.js';
|
|
4
|
+
export { S as SeedName } from '../server-Cowuvfbr.js';
|
|
5
|
+
import '../catalogue-C4xKpirp.js';
|
|
6
|
+
import '../elements-Dtqe9Ekd.js';
|
|
7
7
|
import 'hono';
|
|
8
8
|
|
|
9
9
|
/**
|
package/dist/testing/suite.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunk73HY36Z7_js = require('../chunk-73HY36Z7.js');
|
|
4
|
+
require('../chunk-NX5YBQZP.js');
|
|
5
|
+
require('../chunk-W4ZFZPPY.js');
|
|
6
6
|
require('../chunk-XREIZ56K.js');
|
|
7
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-HKCB73AJ.js');
|
|
8
8
|
require('../chunk-EV2EVOYS.js');
|
|
9
9
|
require('../chunk-UYFTOIFW.js');
|
|
10
10
|
require('../chunk-AVXA4F6G.js');
|
|
@@ -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(() =>
|
|
25
|
+
vitest.expect(() => chunk73HY36Z7_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(
|
|
29
|
+
vitest.expect(chunk73HY36Z7_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 =
|
|
61
|
+
const result = chunk73HY36Z7_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 =
|
|
76
|
+
h = chunk73HY36Z7_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(() =>
|
|
83
|
+
vitest.expect(() => chunk73HY36Z7_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
|
|
87
|
+
const { product, variantId } = await chunk73HY36Z7_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(() =>
|
|
92
|
+
vitest.expect(() => chunk73HY36Z7_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
|
|
104
|
-
await
|
|
103
|
+
await chunk73HY36Z7_js.fixtures.addFirstProduct(h.client);
|
|
104
|
+
await chunk73HY36Z7_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
|
|
112
|
+
await chunk73HY36Z7_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 =
|
|
138
|
+
h = chunk73HY36Z7_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 =
|
|
142
|
+
const result = chunk73HY36Z7_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 =
|
|
146
|
+
const result = chunk73HY36Z7_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 =
|
|
150
|
+
const result = chunk73HY36Z7_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
|
|
154
|
+
const { product } = await chunk73HY36Z7_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 =
|
|
159
|
+
const result = chunk73HY36Z7_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}:
|
|
@@ -166,20 +166,20 @@ ${issues}`);
|
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
vitest.it("CheckoutResponse projects purchase-intent authority without fabricating a bill token", async () => {
|
|
169
|
-
await
|
|
169
|
+
await chunk73HY36Z7_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:
|
|
174
|
+
customer: chunk73HY36Z7_js.fixtures.customer(),
|
|
175
175
|
order_type: "delivery",
|
|
176
|
-
address_info:
|
|
176
|
+
address_info: chunk73HY36Z7_js.fixtures.deliveryAddress(),
|
|
177
177
|
payment_method: "mobile_money",
|
|
178
178
|
mobile_money_details: { phone_number: "+233244000000", provider: "mtn" }
|
|
179
179
|
});
|
|
180
180
|
vitest.expect(checkout.ok).toBe(true);
|
|
181
181
|
if (!checkout.ok) return;
|
|
182
|
-
const result =
|
|
182
|
+
const result = chunk73HY36Z7_js.CheckoutResponseSchema.safeParse(checkout.value);
|
|
183
183
|
if (!result.success) {
|
|
184
184
|
const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
|
|
185
185
|
throw new Error(`CheckoutResponse shape mismatch:
|
package/dist/testing/suite.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-IWZKCL3P.mjs';
|
|
2
|
+
import '../chunk-MKZXZDHE.mjs';
|
|
3
|
+
import '../chunk-P4HYAV3L.mjs';
|
|
4
4
|
import '../chunk-U4MW6PYU.mjs';
|
|
5
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-2I6YKE6Q.mjs';
|
|
6
6
|
import '../chunk-33VCYWVL.mjs';
|
|
7
7
|
import '../chunk-NYDVVNZI.mjs';
|
|
8
8
|
import '../chunk-NJYR6GGM.mjs';
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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-
|
|
4
|
-
import './catalogue-
|
|
5
|
-
import './
|
|
6
|
-
import './server-
|
|
3
|
+
export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-BBFfAtn4.mjs';
|
|
4
|
+
import './catalogue-BohD-jU_.mjs';
|
|
5
|
+
import './elements-Dtqe9Ekd.mjs';
|
|
6
|
+
import './server-KilvZJU0.mjs';
|
|
7
7
|
import 'hono';
|
|
8
8
|
|
|
9
9
|
/**
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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-
|
|
4
|
-
import './catalogue-
|
|
5
|
-
import './
|
|
6
|
-
import './server-
|
|
3
|
+
export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-ByURQZM9.js';
|
|
4
|
+
import './catalogue-C4xKpirp.js';
|
|
5
|
+
import './elements-Dtqe9Ekd.js';
|
|
6
|
+
import './server-Cowuvfbr.js';
|
|
7
7
|
import 'hono';
|
|
8
8
|
|
|
9
9
|
/**
|