@cimplify/sdk 0.105.0 → 0.106.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.
- package/dist/advanced.d.mts +2 -2
- package/dist/advanced.d.ts +2 -2
- package/dist/advanced.js +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{catalogue-DjutZ0FC.d.mts → catalogue-CVKH9faR.d.mts} +5 -0
- package/dist/{catalogue-D1jkpGcr.d.ts → catalogue-ChBjPPME.d.ts} +5 -0
- package/dist/{chunk-37ZZCE7P.mjs → chunk-ABAK4YVY.mjs} +8 -50
- package/dist/{chunk-TINYV5E2.mjs → chunk-IWXVKW22.mjs} +28 -14
- package/dist/{chunk-Q5HX7LVE.mjs → chunk-L4XKIMUO.mjs} +1 -0
- package/dist/{chunk-PDTXSUHZ.js → chunk-LJSQ7TUV.js} +30 -16
- package/dist/{chunk-7PMMV5X4.js → chunk-NJK3THWT.js} +1 -0
- package/dist/{chunk-3IMPJEUI.js → chunk-QKL5L5IU.js} +92 -138
- package/dist/{chunk-XHVQDEVO.js → chunk-SFG2LMRD.js} +99 -12
- package/dist/{chunk-X7RPMALQ.mjs → chunk-YHR6LFQ7.mjs} +95 -13
- package/dist/{client-CZ8MjJ_o.d.mts → client-BfKFK7cn.d.mts} +12 -2
- package/dist/{client-BBZj15JJ.d.ts → client-DoczTJbs.d.ts} +12 -2
- package/dist/{index-DNxWfRHF.d.mts → index-DEUorPUO.d.mts} +1 -1
- package/dist/{index-CZjNWbQf.d.ts → index-Dn6xCpDe.d.ts} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +67 -67
- package/dist/index.mjs +3 -3
- package/dist/mock/cli.mjs +1 -0
- package/dist/mock/library.js +1 -0
- package/dist/mock/library.mjs +1 -0
- package/dist/mock/msw.js +1 -0
- package/dist/mock/msw.mjs +1 -0
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +31 -31
- package/dist/react.mjs +2 -2
- package/dist/{server-C_RIDnHU.d.ts → server-7soMMUgP.d.ts} +2 -1
- package/dist/{server-Byr4d0hL.d.mts → server-DDEJ7e9s.d.mts} +2 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +7 -7
- package/dist/server.mjs +2 -2
- package/dist/testing/msw.d.mts +1 -1
- package/dist/testing/msw.d.ts +1 -1
- package/dist/testing/msw.js +2 -2
- package/dist/testing/msw.mjs +1 -1
- package/dist/testing/suite.d.mts +4 -4
- package/dist/testing/suite.d.ts +4 -4
- package/dist/testing/suite.js +24 -23
- package/dist/testing/suite.mjs +5 -4
- package/dist/testing.d.mts +10 -4
- package/dist/testing.d.ts +10 -4
- package/dist/testing.js +116 -116
- package/dist/testing.mjs +5 -5
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, isMultiDayService, serviceBillingMultiplier, PRODUCT_TYPE, BOUNDARY_KIND, resolveGallery, chatMessageCards, RENDER_HINT, displaysGrossPrices, DEFAULT_CDN_BASE_URL } from './chunk-3V4DVXV3.mjs';
|
|
3
3
|
export { getVariantDisplayName } from './chunk-3V4DVXV3.mjs';
|
|
4
|
-
import { chatRealtimeUpdateFromWire,
|
|
4
|
+
import { chatRealtimeUpdateFromWire, createCimplifyClient } from './chunk-ABAK4YVY.mjs';
|
|
5
5
|
import { splitGenUIContent, messagePreview } from './chunk-U4MW6PYU.mjs';
|
|
6
6
|
export { messagePreview, splitGenUIContent } from './chunk-U4MW6PYU.mjs';
|
|
7
|
-
import { ELEMENT_TYPES, EVENT_TYPES, generateIdempotencyKey, startSignIn } from './chunk-
|
|
7
|
+
import { ELEMENT_TYPES, EVENT_TYPES, SESSION_CLAIMED, SESSION_CLEARED, generateIdempotencyKey, startSignIn, AUTH_TOKEN_CHANGED, MUTATION_ERROR } from './chunk-YHR6LFQ7.mjs';
|
|
8
8
|
import { ORDER_TYPE, CHECKOUT_STATUS } from './chunk-33VCYWVL.mjs';
|
|
9
9
|
import { parsePrice, formatMoney, formatPrice, getVariantUnitPrice, getProductCurrency, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-NYDVVNZI.mjs';
|
|
10
10
|
import { isSupportedCurrency, ErrorCode, currencyCode, CimplifyError } from './chunk-NJYR6GGM.mjs';
|
|
@@ -1108,7 +1108,8 @@ interface LinkService {
|
|
|
1108
1108
|
/** A whole-registry JSON snapshot: `storeName -> id -> row`. */
|
|
1109
1109
|
type RegistrySnapshot = Record<string, Record<string, unknown>>;
|
|
1110
1110
|
|
|
1111
|
-
|
|
1111
|
+
declare const SEED_NAMES: readonly ["default", "empty", "reesa-storefront", "restaurant", "retail", "services", "grocery", "fashion", "pharmacy", "auto"];
|
|
1112
|
+
type SeedName = (typeof SEED_NAMES)[number];
|
|
1112
1113
|
|
|
1113
1114
|
interface SeedBusinessInput extends Partial<Omit<MockBusiness, "id" | "name">> {
|
|
1114
1115
|
name: string;
|
|
@@ -1108,7 +1108,8 @@ interface LinkService {
|
|
|
1108
1108
|
/** A whole-registry JSON snapshot: `storeName -> id -> row`. */
|
|
1109
1109
|
type RegistrySnapshot = Record<string, Record<string, unknown>>;
|
|
1110
1110
|
|
|
1111
|
-
|
|
1111
|
+
declare const SEED_NAMES: readonly ["default", "empty", "reesa-storefront", "restaurant", "retail", "services", "grocery", "fashion", "pharmacy", "auto"];
|
|
1112
|
+
type SeedName = (typeof SEED_NAMES)[number];
|
|
1112
1113
|
|
|
1113
1114
|
interface SeedBusinessInput extends Partial<Omit<MockBusiness, "id" | "name">> {
|
|
1114
1115
|
name: string;
|
package/dist/server.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CimplifyClient } from './catalogue-
|
|
2
|
-
export { a as CacheOptions, R as ReadRequestOptions, b as Result } from './catalogue-
|
|
1
|
+
import { C as CimplifyClient } from './catalogue-CVKH9faR.mjs';
|
|
2
|
+
export { a as CacheOptions, R as ReadRequestOptions, b as Result } from './catalogue-CVKH9faR.mjs';
|
|
3
3
|
export { b as Category, c as CimplifyError, d as Collection, P as Product, e as ProductWithDetails } from './checkout-XoV4HNg2.mjs';
|
|
4
4
|
import { JWTVerifyResult } from 'jose';
|
|
5
5
|
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CimplifyClient } from './catalogue-
|
|
2
|
-
export { a as CacheOptions, R as ReadRequestOptions, b as Result } from './catalogue-
|
|
1
|
+
import { C as CimplifyClient } from './catalogue-ChBjPPME.js';
|
|
2
|
+
export { a as CacheOptions, R as ReadRequestOptions, b as Result } from './catalogue-ChBjPPME.js';
|
|
3
3
|
export { b as Category, c as CimplifyError, d as Collection, P as Product, e as ProductWithDetails } from './checkout-XoV4HNg2.js';
|
|
4
4
|
import { JWTVerifyResult } from 'jose';
|
|
5
5
|
|
package/dist/server.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQKL5L5IU_js = require('./chunk-QKL5L5IU.js');
|
|
4
4
|
require('./chunk-XREIZ56K.js');
|
|
5
|
-
var
|
|
5
|
+
var chunkSFG2LMRD_js = require('./chunk-SFG2LMRD.js');
|
|
6
6
|
require('./chunk-EV2EVOYS.js');
|
|
7
7
|
require('./chunk-UYFTOIFW.js');
|
|
8
8
|
var chunkAVXA4F6G_js = require('./chunk-AVXA4F6G.js');
|
|
@@ -28,7 +28,7 @@ function readEnv(...keys) {
|
|
|
28
28
|
var getServerClient = react.cache((opts = {}) => {
|
|
29
29
|
const baseUrl = opts.apiUrl ?? readEnv("CIMPLIFY_API_URL", "NEXT_PUBLIC_CIMPLIFY_API_URL") ?? defaultBaseUrl();
|
|
30
30
|
const publicKey = opts.secretKey ?? readEnv("CIMPLIFY_SECRET_KEY", "NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY") ?? "mock-dev";
|
|
31
|
-
const client =
|
|
31
|
+
const client = chunkQKL5L5IU_js.createCimplifyClient({
|
|
32
32
|
baseUrl,
|
|
33
33
|
publicKey,
|
|
34
34
|
suppressPublicKeyWarning: true
|
|
@@ -252,7 +252,7 @@ var QUERY_AUTH_ERROR = "cimplify_auth_error";
|
|
|
252
252
|
var discoveryCache = /* @__PURE__ */ new Map();
|
|
253
253
|
var jwksCache = /* @__PURE__ */ new Map();
|
|
254
254
|
function issuerBase(cfg) {
|
|
255
|
-
return (cfg.issuer ?? cfg.authUrl ??
|
|
255
|
+
return (cfg.issuer ?? cfg.authUrl ?? chunkSFG2LMRD_js.DEFAULT_ISSUER).replace(/\/$/, "");
|
|
256
256
|
}
|
|
257
257
|
function cookieName(cfg) {
|
|
258
258
|
return cfg.cookieName ?? SESSION_COOKIE;
|
|
@@ -467,12 +467,12 @@ async function handleOidcCallback(req, opts) {
|
|
|
467
467
|
}
|
|
468
468
|
function readPkceCookie(cookieHeader) {
|
|
469
469
|
if (!cookieHeader) return null;
|
|
470
|
-
const match = cookieHeader.split(/;\s*/).find((p) => p.startsWith(`${
|
|
470
|
+
const match = cookieHeader.split(/;\s*/).find((p) => p.startsWith(`${chunkSFG2LMRD_js.PKCE_COOKIE}=`));
|
|
471
471
|
if (!match) return null;
|
|
472
|
-
return
|
|
472
|
+
return chunkSFG2LMRD_js.decodePkceState(match.slice(chunkSFG2LMRD_js.PKCE_COOKIE.length + 1));
|
|
473
473
|
}
|
|
474
474
|
function buildPkceClearCookie() {
|
|
475
|
-
return `${
|
|
475
|
+
return `${chunkSFG2LMRD_js.PKCE_COOKIE}=; Path=${chunkSFG2LMRD_js.PKCE_COOKIE_PATH}; Max-Age=0; Secure; SameSite=Lax`;
|
|
476
476
|
}
|
|
477
477
|
function safeReturnPath(returnTo, fallback) {
|
|
478
478
|
if (returnTo && returnTo.startsWith("/") && !returnTo.startsWith("//")) return returnTo;
|
package/dist/server.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createCimplifyClient } from './chunk-
|
|
1
|
+
import { createCimplifyClient } from './chunk-ABAK4YVY.mjs';
|
|
2
2
|
import './chunk-U4MW6PYU.mjs';
|
|
3
|
-
import { PKCE_COOKIE, decodePkceState, PKCE_COOKIE_PATH, DEFAULT_ISSUER } from './chunk-
|
|
3
|
+
import { PKCE_COOKIE, decodePkceState, PKCE_COOKIE_PATH, DEFAULT_ISSUER } from './chunk-YHR6LFQ7.mjs';
|
|
4
4
|
import './chunk-33VCYWVL.mjs';
|
|
5
5
|
import './chunk-NYDVVNZI.mjs';
|
|
6
6
|
export { CimplifyError } from './chunk-NJYR6GGM.mjs';
|
package/dist/testing/msw.d.mts
CHANGED
package/dist/testing/msw.d.ts
CHANGED
package/dist/testing/msw.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkNJK3THWT_js = require('../chunk-NJK3THWT.js');
|
|
4
4
|
require('../chunk-XREIZ56K.js');
|
|
5
5
|
require('../chunk-EV2EVOYS.js');
|
|
6
6
|
require('../chunk-AVXA4F6G.js');
|
|
@@ -9,7 +9,7 @@ require('../chunk-OWW5GUSB.js');
|
|
|
9
9
|
// src/mock/msw.ts
|
|
10
10
|
async function createMswHandlers(options = {}) {
|
|
11
11
|
const baseUrl = options.baseUrl ?? "http://localhost:8787";
|
|
12
|
-
const handle =
|
|
12
|
+
const handle = chunkNJK3THWT_js.createMockApp(options);
|
|
13
13
|
const msw = await import('msw').catch(() => {
|
|
14
14
|
throw new Error("msw is required to use @cimplify/sdk/mock/msw \u2014 install it as a peer dependency");
|
|
15
15
|
});
|
package/dist/testing/msw.mjs
CHANGED
package/dist/testing/suite.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
2
|
+
import { T as TestClientHandle } from '../client-BfKFK7cn.mjs';
|
|
3
|
+
import { C as CreateAppOptions } from '../server-DDEJ7e9s.mjs';
|
|
4
|
+
export { S as SeedName } from '../server-DDEJ7e9s.mjs';
|
|
5
|
+
import '../catalogue-CVKH9faR.mjs';
|
|
6
6
|
import '../checkout-XoV4HNg2.mjs';
|
|
7
7
|
import 'hono';
|
|
8
8
|
|
package/dist/testing/suite.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
2
|
+
import { T as TestClientHandle } from '../client-DoczTJbs.js';
|
|
3
|
+
import { C as CreateAppOptions } from '../server-7soMMUgP.js';
|
|
4
|
+
export { S as SeedName } from '../server-7soMMUgP.js';
|
|
5
|
+
import '../catalogue-ChBjPPME.js';
|
|
6
6
|
import '../checkout-XoV4HNg2.js';
|
|
7
7
|
import 'hono';
|
|
8
8
|
|
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 chunkLJSQ7TUV_js = require('../chunk-LJSQ7TUV.js');
|
|
4
|
+
require('../chunk-NJK3THWT.js');
|
|
5
|
+
require('../chunk-QKL5L5IU.js');
|
|
6
6
|
require('../chunk-XREIZ56K.js');
|
|
7
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-SFG2LMRD.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(() => chunkLJSQ7TUV_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(chunkLJSQ7TUV_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 = chunkLJSQ7TUV_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 = chunkLJSQ7TUV_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(() => chunkLJSQ7TUV_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 chunkLJSQ7TUV_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(() => chunkLJSQ7TUV_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 chunkLJSQ7TUV_js.fixtures.addFirstProduct(h.client);
|
|
104
|
+
await chunkLJSQ7TUV_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 chunkLJSQ7TUV_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 = chunkLJSQ7TUV_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 = chunkLJSQ7TUV_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 = chunkLJSQ7TUV_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 = chunkLJSQ7TUV_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 chunkLJSQ7TUV_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 = chunkLJSQ7TUV_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,19 +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 chunkLJSQ7TUV_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: chunkLJSQ7TUV_js.fixtures.customer(),
|
|
175
175
|
order_type: "delivery",
|
|
176
|
+
address_info: chunkLJSQ7TUV_js.fixtures.deliveryAddress(),
|
|
176
177
|
payment_method: "mobile_money",
|
|
177
178
|
mobile_money_details: { phone_number: "+233244000000", provider: "mtn" }
|
|
178
179
|
});
|
|
179
180
|
vitest.expect(checkout.ok).toBe(true);
|
|
180
181
|
if (!checkout.ok) return;
|
|
181
|
-
const result =
|
|
182
|
+
const result = chunkLJSQ7TUV_js.CheckoutResponseSchema.safeParse(checkout.value);
|
|
182
183
|
if (!result.success) {
|
|
183
184
|
const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
|
|
184
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-IWXVKW22.mjs';
|
|
2
|
+
import '../chunk-L4XKIMUO.mjs';
|
|
3
|
+
import '../chunk-ABAK4YVY.mjs';
|
|
4
4
|
import '../chunk-U4MW6PYU.mjs';
|
|
5
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-YHR6LFQ7.mjs';
|
|
6
6
|
import '../chunk-33VCYWVL.mjs';
|
|
7
7
|
import '../chunk-NYDVVNZI.mjs';
|
|
8
8
|
import '../chunk-NJYR6GGM.mjs';
|
|
@@ -171,6 +171,7 @@ ${issues}`);
|
|
|
171
171
|
cart_id: cartRes.value.id,
|
|
172
172
|
customer: fixtures.customer(),
|
|
173
173
|
order_type: "delivery",
|
|
174
|
+
address_info: fixtures.deliveryAddress(),
|
|
174
175
|
payment_method: "mobile_money",
|
|
175
176
|
mobile_money_details: { phone_number: "+233244000000", provider: "mtn" }
|
|
176
177
|
});
|
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-
|
|
3
|
+
export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-BfKFK7cn.mjs';
|
|
4
|
+
import './catalogue-CVKH9faR.mjs';
|
|
5
5
|
import './checkout-XoV4HNg2.mjs';
|
|
6
|
-
import './server-
|
|
6
|
+
import './server-DDEJ7e9s.mjs';
|
|
7
7
|
import 'hono';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -61,6 +61,8 @@ declare const SeedNameSchema: z.ZodEnum<{
|
|
|
61
61
|
services: "services";
|
|
62
62
|
grocery: "grocery";
|
|
63
63
|
fashion: "fashion";
|
|
64
|
+
pharmacy: "pharmacy";
|
|
65
|
+
auto: "auto";
|
|
64
66
|
}>;
|
|
65
67
|
declare const ProductTypeSchema: z.ZodEnum<{
|
|
66
68
|
product: "product";
|
|
@@ -372,6 +374,8 @@ declare const BrandSchema: z.ZodObject<{
|
|
|
372
374
|
services: "services";
|
|
373
375
|
grocery: "grocery";
|
|
374
376
|
fashion: "fashion";
|
|
377
|
+
pharmacy: "pharmacy";
|
|
378
|
+
auto: "auto";
|
|
375
379
|
}>;
|
|
376
380
|
businessId: z.ZodString;
|
|
377
381
|
}, z.core.$strip>;
|
|
@@ -530,7 +534,7 @@ declare const assertBrand: (value: unknown) => asserts value is {
|
|
|
530
534
|
summary: string;
|
|
531
535
|
};
|
|
532
536
|
mock: {
|
|
533
|
-
seed: "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion";
|
|
537
|
+
seed: "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion" | "pharmacy" | "auto";
|
|
534
538
|
businessId: string;
|
|
535
539
|
};
|
|
536
540
|
trustItems?: {
|
|
@@ -3438,6 +3442,8 @@ declare const PUBLIC_SCHEMAS: {
|
|
|
3438
3442
|
services: "services";
|
|
3439
3443
|
grocery: "grocery";
|
|
3440
3444
|
fashion: "fashion";
|
|
3445
|
+
pharmacy: "pharmacy";
|
|
3446
|
+
auto: "auto";
|
|
3441
3447
|
}>;
|
|
3442
3448
|
businessId: z.ZodString;
|
|
3443
3449
|
}, z.core.$strip>;
|
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-
|
|
3
|
+
export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-DoczTJbs.js';
|
|
4
|
+
import './catalogue-ChBjPPME.js';
|
|
5
5
|
import './checkout-XoV4HNg2.js';
|
|
6
|
-
import './server-
|
|
6
|
+
import './server-7soMMUgP.js';
|
|
7
7
|
import 'hono';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -61,6 +61,8 @@ declare const SeedNameSchema: z.ZodEnum<{
|
|
|
61
61
|
services: "services";
|
|
62
62
|
grocery: "grocery";
|
|
63
63
|
fashion: "fashion";
|
|
64
|
+
pharmacy: "pharmacy";
|
|
65
|
+
auto: "auto";
|
|
64
66
|
}>;
|
|
65
67
|
declare const ProductTypeSchema: z.ZodEnum<{
|
|
66
68
|
product: "product";
|
|
@@ -372,6 +374,8 @@ declare const BrandSchema: z.ZodObject<{
|
|
|
372
374
|
services: "services";
|
|
373
375
|
grocery: "grocery";
|
|
374
376
|
fashion: "fashion";
|
|
377
|
+
pharmacy: "pharmacy";
|
|
378
|
+
auto: "auto";
|
|
375
379
|
}>;
|
|
376
380
|
businessId: z.ZodString;
|
|
377
381
|
}, z.core.$strip>;
|
|
@@ -530,7 +534,7 @@ declare const assertBrand: (value: unknown) => asserts value is {
|
|
|
530
534
|
summary: string;
|
|
531
535
|
};
|
|
532
536
|
mock: {
|
|
533
|
-
seed: "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion";
|
|
537
|
+
seed: "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion" | "pharmacy" | "auto";
|
|
534
538
|
businessId: string;
|
|
535
539
|
};
|
|
536
540
|
trustItems?: {
|
|
@@ -3438,6 +3442,8 @@ declare const PUBLIC_SCHEMAS: {
|
|
|
3438
3442
|
services: "services";
|
|
3439
3443
|
grocery: "grocery";
|
|
3440
3444
|
fashion: "fashion";
|
|
3445
|
+
pharmacy: "pharmacy";
|
|
3446
|
+
auto: "auto";
|
|
3441
3447
|
}>;
|
|
3442
3448
|
businessId: z.ZodString;
|
|
3443
3449
|
}, z.core.$strip>;
|