@cimplify/sdk 0.85.0 → 0.86.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 +22 -22
- package/dist/advanced.mjs +3 -3
- package/dist/{chunk-DU4IX2I2.mjs → chunk-A2GXDCSI.mjs} +2 -2
- package/dist/{chunk-XA3ZNR75.js → chunk-AETVRBKI.js} +1 -1
- package/dist/{chunk-GIFVSWYJ.mjs → chunk-D6JWYYTG.mjs} +2 -2
- package/dist/{chunk-A6J7W6DH.js → chunk-ESGKWRQS.js} +4 -4
- package/dist/{chunk-GFM5JW45.js → chunk-HJEKXCG2.js} +62 -62
- package/dist/{chunk-AMZXALF6.mjs → chunk-K5EN2W2Q.mjs} +1 -1
- package/dist/{chunk-TD3AY34U.mjs → chunk-KFLGQGMC.mjs} +3 -3
- package/dist/{chunk-NWUEWUX2.mjs → chunk-MRL53WP6.mjs} +2 -2
- package/dist/{chunk-7BM56JET.mjs → chunk-NN3WC7XZ.mjs} +3 -3
- package/dist/{chunk-7Y2O3E4D.js → chunk-PTPOQVXS.js} +5 -5
- package/dist/{chunk-HPN5R3K2.js → chunk-VUG4HTUM.js} +23 -23
- package/dist/{chunk-NWTCBGJ2.js → chunk-X4UNISYG.js} +4 -4
- package/dist/{client-WKKxIiF1.d.ts → client-BQSRj4iK.d.mts} +528 -539
- package/dist/{client-DLtwQ-jI.d.mts → client-BdI24jUT.d.ts} +528 -539
- package/dist/{client-BT5gaiGR.d.ts → client-CMJO_8zo.d.ts} +2 -2
- package/dist/{client-BEhIE0Dm.d.mts → client-DowGNrTh.d.mts} +2 -2
- package/dist/{index-BrC1x2kK.d.ts → index-BRwHpMY-.d.ts} +3 -3
- package/dist/{index-DZz6hdrT.d.mts → index-DLb_Ldl6.d.mts} +3 -3
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +117 -117
- package/dist/index.mjs +5 -5
- package/dist/mock/cli.mjs +2 -2
- package/dist/mock/library.js +2 -2
- package/dist/mock/library.mjs +2 -2
- package/dist/mock/msw.js +2 -2
- package/dist/mock/msw.mjs +2 -2
- package/dist/{payment-D1f3ZQPC.d.ts → payment-BA7KNBxg.d.ts} +3 -3
- package/dist/{payment-Dh-6cRcV.d.mts → payment-CFev-fOE.d.mts} +3 -3
- package/dist/{price-CQdOJoX-.d.ts → price-BNhGVB5q.d.ts} +1 -1
- package/dist/{price-4T7dlhxM.d.mts → price-nRxqVNGq.d.mts} +1 -1
- package/dist/product-BGxIfTqJ.d.mts +5400 -0
- package/dist/product-BGxIfTqJ.d.ts +5400 -0
- package/dist/react.d.mts +6 -6
- package/dist/react.d.ts +6 -6
- package/dist/react.js +139 -139
- package/dist/react.mjs +19 -19
- package/dist/{server-DjK98UW-.d.mts → server-9u0LiG5U.d.mts} +1 -1
- package/dist/{server-DvThXldo.d.ts → server-BH7DTaaz.d.ts} +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +10 -10
- package/dist/server.mjs +4 -4
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +3 -3
- package/dist/testing/msw.mjs +2 -2
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +25 -25
- package/dist/testing/suite.mjs +6 -6
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +81 -81
- package/dist/testing.mjs +7 -7
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/dist/utils.js +29 -29
- package/dist/utils.mjs +2 -2
- package/package.json +5 -2
- package/registry/currency-selector.json +1 -1
- package/registry/digital-product-card.json +1 -1
- package/registry/digital-product-layout.json +1 -1
- package/dist/product-RJMIdCAf.d.mts +0 -1582
- package/dist/product-RJMIdCAf.d.ts +0 -1582
package/dist/react.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, PRODUCT_TYPE, resolveGallery, RENDER_HINT, DEFAULT_CDN_BASE_URL } from './chunk-E6T5VJMG.mjs';
|
|
3
3
|
export { getVariantDisplayName } from './chunk-E6T5VJMG.mjs';
|
|
4
|
-
import { createCimplifyClient } from './chunk-
|
|
5
|
-
import { ELEMENT_TYPES, EVENT_TYPES, startSignIn } from './chunk-
|
|
6
|
-
import { parsePrice, formatMoney, formatPrice, getProductCurrency, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-
|
|
7
|
-
import { isSupportedCurrency } from './chunk-
|
|
4
|
+
import { createCimplifyClient } from './chunk-MRL53WP6.mjs';
|
|
5
|
+
import { ELEMENT_TYPES, EVENT_TYPES, startSignIn } from './chunk-NN3WC7XZ.mjs';
|
|
6
|
+
import { parsePrice, formatMoney, formatPrice, getProductCurrency, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-KFLGQGMC.mjs';
|
|
7
|
+
import { isSupportedCurrency } from './chunk-K5EN2W2Q.mjs';
|
|
8
8
|
import './chunk-3G6RQLXK.mjs';
|
|
9
9
|
import React14, { createContext, useRef, useState, useCallback, useEffect, useContext, useMemo, useId, useSyncExternalStore } from 'react';
|
|
10
10
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
@@ -1236,7 +1236,7 @@ function CimplifyProvider({
|
|
|
1236
1236
|
);
|
|
1237
1237
|
if (cancelled) return;
|
|
1238
1238
|
if (result.ok) {
|
|
1239
|
-
setFxRate(result.value.rate);
|
|
1239
|
+
setFxRate(Number(result.value.rate));
|
|
1240
1240
|
} else {
|
|
1241
1241
|
setFxRate(null);
|
|
1242
1242
|
}
|
|
@@ -1332,7 +1332,7 @@ function CimplifyProvider({
|
|
|
1332
1332
|
client: resolvedClient,
|
|
1333
1333
|
business,
|
|
1334
1334
|
currency: baseCurrency,
|
|
1335
|
-
country: business?.
|
|
1335
|
+
country: business?.default_country || DEFAULT_COUNTRY,
|
|
1336
1336
|
locations,
|
|
1337
1337
|
isReady,
|
|
1338
1338
|
baseCurrency,
|
|
@@ -11276,10 +11276,10 @@ function WholesaleProductCard({
|
|
|
11276
11276
|
}
|
|
11277
11277
|
var TYPE_BADGES = {
|
|
11278
11278
|
download: { label: "Download", color: "bg-sky-50 text-sky-700 border-sky-200/60" },
|
|
11279
|
-
|
|
11280
|
-
|
|
11281
|
-
|
|
11282
|
-
|
|
11279
|
+
license_key: { label: "License", color: "bg-blue-50 text-blue-700 border-blue-200/60" },
|
|
11280
|
+
ticket: { label: "Event", color: "bg-violet-50 text-violet-700 border-violet-200/60" },
|
|
11281
|
+
access_grant: { label: "Access", color: "bg-emerald-50 text-emerald-700 border-emerald-200/60" },
|
|
11282
|
+
redemption_code: { label: "Code", color: "bg-amber-50 text-amber-700 border-amber-200/60" }
|
|
11283
11283
|
};
|
|
11284
11284
|
function DigitalProductCard({
|
|
11285
11285
|
product,
|
|
@@ -11290,7 +11290,7 @@ function DigitalProductCard({
|
|
|
11290
11290
|
const image = product.image_url || product.images?.[0] || "";
|
|
11291
11291
|
const currency = getProductCurrency(product);
|
|
11292
11292
|
const typeBadge = product.digital_type ? TYPE_BADGES[product.digital_type] : null;
|
|
11293
|
-
const isTicket = product.digital_type === "
|
|
11293
|
+
const isTicket = product.digital_type === "ticket";
|
|
11294
11294
|
return /* @__PURE__ */ jsxs(CardShell, { product, renderLink, className, children: [
|
|
11295
11295
|
/* @__PURE__ */ jsx(CardImage, { src: image, alt: product.name, aspectRatio: "4/3", renderImage, children: typeBadge && /* @__PURE__ */ jsx("span", { className: `absolute top-3 left-3 text-[11px] font-semibold tracking-wide border px-2 py-0.5 rounded-md ${typeBadge.color}`, children: typeBadge.label }) }),
|
|
11296
11296
|
/* @__PURE__ */ jsxs("div", { className: "p-3.5", children: [
|
|
@@ -14589,10 +14589,10 @@ function ServiceProductLayout({
|
|
|
14589
14589
|
}
|
|
14590
14590
|
var DIGITAL_TYPE_LABELS = {
|
|
14591
14591
|
download: "Digital download",
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14592
|
+
license_key: "Software license",
|
|
14593
|
+
ticket: "Event ticket",
|
|
14594
|
+
access_grant: "Access pass",
|
|
14595
|
+
redemption_code: "Redemption code"
|
|
14596
14596
|
};
|
|
14597
14597
|
function DigitalProductLayout({
|
|
14598
14598
|
product,
|
|
@@ -14605,9 +14605,9 @@ function DigitalProductLayout({
|
|
|
14605
14605
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
14606
14606
|
const currency = getProductCurrency(product);
|
|
14607
14607
|
const typeLabel = product.digital_type ? DIGITAL_TYPE_LABELS[product.digital_type] || product.digital_type : "Digital product";
|
|
14608
|
-
const isTicket = product.digital_type === "
|
|
14609
|
-
const isAccessPass = product.digital_type === "
|
|
14610
|
-
const isDownload = product.digital_type === "download" || product.digital_type === "
|
|
14608
|
+
const isTicket = product.digital_type === "ticket";
|
|
14609
|
+
const isAccessPass = product.digital_type === "access_grant";
|
|
14610
|
+
const isDownload = product.digital_type === "download" || product.digital_type === "license_key";
|
|
14611
14611
|
return /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout": "digital", className: cn("space-y-8", className), children: [
|
|
14612
14612
|
renderBreadcrumb?.(product),
|
|
14613
14613
|
/* @__PURE__ */ jsx(
|
|
@@ -16670,7 +16670,7 @@ function CurrencySelector({
|
|
|
16670
16670
|
),
|
|
16671
16671
|
children: renderCurrency ? renderCurrency(currency, isActive, rate) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16672
16672
|
/* @__PURE__ */ jsx("span", { "data-cimplify-currency-label": true, className: classNames?.label, children: currency }),
|
|
16673
|
-
showRate && baseCurrency && currency !== baseCurrency && /* @__PURE__ */ jsx("span", { "data-cimplify-currency-rate": true, className: classNames?.rate, children: isLoadingRates ? "..." : rate ? `1 ${baseCurrency} = ${rate.rate.toFixed(4)} ${currency}` : null })
|
|
16673
|
+
showRate && baseCurrency && currency !== baseCurrency && /* @__PURE__ */ jsx("span", { "data-cimplify-currency-rate": true, className: classNames?.rate, children: isLoadingRates ? "..." : rate ? `1 ${baseCurrency} = ${Number(rate.rate).toFixed(4)} ${currency}` : null })
|
|
16674
16674
|
] })
|
|
16675
16675
|
},
|
|
16676
16676
|
currency
|
package/dist/server.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-
|
|
1
|
+
import { ac as CimplifyClient } from './client-BQSRj4iK.mjs';
|
|
2
|
+
export { J as CacheOptions, cw as ReadRequestOptions, cS as Result } from './client-BQSRj4iK.mjs';
|
|
3
|
+
export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-BGxIfTqJ.mjs';
|
|
4
4
|
import { JWTVerifyResult } from 'jose';
|
|
5
|
-
import './payment-
|
|
5
|
+
import './payment-CFev-fOE.mjs';
|
|
6
6
|
|
|
7
7
|
interface ServerClientOptions {
|
|
8
8
|
/**
|
package/dist/server.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-
|
|
1
|
+
import { ac as CimplifyClient } from './client-BdI24jUT.js';
|
|
2
|
+
export { J as CacheOptions, cw as ReadRequestOptions, cS as Result } from './client-BdI24jUT.js';
|
|
3
|
+
export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-BGxIfTqJ.js';
|
|
4
4
|
import { JWTVerifyResult } from 'jose';
|
|
5
|
-
import './payment-
|
|
5
|
+
import './payment-BA7KNBxg.js';
|
|
6
6
|
|
|
7
7
|
interface ServerClientOptions {
|
|
8
8
|
/**
|
package/dist/server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
var
|
|
3
|
+
var chunkHJEKXCG2_js = require('./chunk-HJEKXCG2.js');
|
|
4
|
+
var chunkVUG4HTUM_js = require('./chunk-VUG4HTUM.js');
|
|
5
|
+
require('./chunk-PTPOQVXS.js');
|
|
6
|
+
var chunkAETVRBKI_js = require('./chunk-AETVRBKI.js');
|
|
7
7
|
require('./chunk-OWW5GUSB.js');
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var jose = require('jose');
|
|
@@ -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 =
|
|
29
|
+
const client = chunkHJEKXCG2_js.createCimplifyClient({
|
|
30
30
|
baseUrl,
|
|
31
31
|
publicKey,
|
|
32
32
|
suppressPublicKeyWarning: true
|
|
@@ -250,7 +250,7 @@ var QUERY_AUTH_ERROR = "cimplify_auth_error";
|
|
|
250
250
|
var discoveryCache = /* @__PURE__ */ new Map();
|
|
251
251
|
var jwksCache = /* @__PURE__ */ new Map();
|
|
252
252
|
function issuerBase(cfg) {
|
|
253
|
-
return (cfg.issuer ?? cfg.authUrl ??
|
|
253
|
+
return (cfg.issuer ?? cfg.authUrl ?? chunkVUG4HTUM_js.DEFAULT_ISSUER).replace(/\/$/, "");
|
|
254
254
|
}
|
|
255
255
|
function cookieName(cfg) {
|
|
256
256
|
return cfg.cookieName ?? SESSION_COOKIE;
|
|
@@ -465,12 +465,12 @@ async function handleOidcCallback(req, opts) {
|
|
|
465
465
|
}
|
|
466
466
|
function readPkceCookie(cookieHeader) {
|
|
467
467
|
if (!cookieHeader) return null;
|
|
468
|
-
const match = cookieHeader.split(/;\s*/).find((p) => p.startsWith(`${
|
|
468
|
+
const match = cookieHeader.split(/;\s*/).find((p) => p.startsWith(`${chunkVUG4HTUM_js.PKCE_COOKIE}=`));
|
|
469
469
|
if (!match) return null;
|
|
470
|
-
return
|
|
470
|
+
return chunkVUG4HTUM_js.decodePkceState(match.slice(chunkVUG4HTUM_js.PKCE_COOKIE.length + 1));
|
|
471
471
|
}
|
|
472
472
|
function buildPkceClearCookie() {
|
|
473
|
-
return `${
|
|
473
|
+
return `${chunkVUG4HTUM_js.PKCE_COOKIE}=; Path=${chunkVUG4HTUM_js.PKCE_COOKIE_PATH}; Max-Age=0; Secure; SameSite=Lax`;
|
|
474
474
|
}
|
|
475
475
|
function safeReturnPath(returnTo, fallback) {
|
|
476
476
|
if (returnTo && returnTo.startsWith("/") && !returnTo.startsWith("//")) return returnTo;
|
|
@@ -642,7 +642,7 @@ async function handleTokenRefresh(req, cfg) {
|
|
|
642
642
|
|
|
643
643
|
Object.defineProperty(exports, "CimplifyError", {
|
|
644
644
|
enumerable: true,
|
|
645
|
-
get: function () { return
|
|
645
|
+
get: function () { return chunkAETVRBKI_js.CimplifyError; }
|
|
646
646
|
});
|
|
647
647
|
exports.CACHE_LIFE_DEFAULT = CACHE_LIFE_DEFAULT;
|
|
648
648
|
exports.CACHE_LIFE_PROBE = CACHE_LIFE_PROBE;
|
package/dist/server.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createCimplifyClient } from './chunk-
|
|
2
|
-
import { PKCE_COOKIE, decodePkceState, PKCE_COOKIE_PATH, DEFAULT_ISSUER } from './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
export { CimplifyError } from './chunk-
|
|
1
|
+
import { createCimplifyClient } from './chunk-MRL53WP6.mjs';
|
|
2
|
+
import { PKCE_COOKIE, decodePkceState, PKCE_COOKIE_PATH, DEFAULT_ISSUER } from './chunk-NN3WC7XZ.mjs';
|
|
3
|
+
import './chunk-KFLGQGMC.mjs';
|
|
4
|
+
export { CimplifyError } from './chunk-K5EN2W2Q.mjs';
|
|
5
5
|
import './chunk-3G6RQLXK.mjs';
|
|
6
6
|
import { cache } from 'react';
|
|
7
7
|
import { jwtVerify, createRemoteJWKSet } from 'jose';
|
package/dist/testing/msw.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AppHandle, C as CreateAppOptions } from '../server-
|
|
1
|
+
import { A as AppHandle, C as CreateAppOptions } from '../server-9u0LiG5U.mjs';
|
|
2
2
|
import 'hono';
|
|
3
|
-
import '../product-
|
|
3
|
+
import '../product-BGxIfTqJ.mjs';
|
|
4
4
|
|
|
5
5
|
interface MswHandlerSetup {
|
|
6
6
|
handlers: unknown[];
|
package/dist/testing/msw.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AppHandle, C as CreateAppOptions } from '../server-
|
|
1
|
+
import { A as AppHandle, C as CreateAppOptions } from '../server-BH7DTaaz.js';
|
|
2
2
|
import 'hono';
|
|
3
|
-
import '../product-
|
|
3
|
+
import '../product-BGxIfTqJ.js';
|
|
4
4
|
|
|
5
5
|
interface MswHandlerSetup {
|
|
6
6
|
handlers: unknown[];
|
package/dist/testing/msw.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkX4UNISYG_js = require('../chunk-X4UNISYG.js');
|
|
4
|
+
require('../chunk-AETVRBKI.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 =
|
|
10
|
+
const handle = chunkX4UNISYG_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
|
});
|
package/dist/testing/msw.mjs
CHANGED
package/dist/testing/suite.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 '../client-
|
|
6
|
-
import '../product-
|
|
7
|
-
import '../payment-
|
|
2
|
+
import { T as TestClientHandle } from '../client-DowGNrTh.mjs';
|
|
3
|
+
import { C as CreateAppOptions } from '../server-9u0LiG5U.mjs';
|
|
4
|
+
export { S as SeedName } from '../server-9u0LiG5U.mjs';
|
|
5
|
+
import '../client-BQSRj4iK.mjs';
|
|
6
|
+
import '../product-BGxIfTqJ.mjs';
|
|
7
|
+
import '../payment-CFev-fOE.mjs';
|
|
8
8
|
import 'hono';
|
|
9
9
|
|
|
10
10
|
/**
|
package/dist/testing/suite.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 '../client-
|
|
6
|
-
import '../product-
|
|
7
|
-
import '../payment-
|
|
2
|
+
import { T as TestClientHandle } from '../client-CMJO_8zo.js';
|
|
3
|
+
import { C as CreateAppOptions } from '../server-BH7DTaaz.js';
|
|
4
|
+
export { S as SeedName } from '../server-BH7DTaaz.js';
|
|
5
|
+
import '../client-BdI24jUT.js';
|
|
6
|
+
import '../product-BGxIfTqJ.js';
|
|
7
|
+
import '../payment-BA7KNBxg.js';
|
|
8
8
|
import 'hono';
|
|
9
9
|
|
|
10
10
|
/**
|
package/dist/testing/suite.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
7
|
-
require('../chunk-
|
|
8
|
-
require('../chunk-
|
|
3
|
+
var chunkESGKWRQS_js = require('../chunk-ESGKWRQS.js');
|
|
4
|
+
require('../chunk-X4UNISYG.js');
|
|
5
|
+
require('../chunk-HJEKXCG2.js');
|
|
6
|
+
require('../chunk-VUG4HTUM.js');
|
|
7
|
+
require('../chunk-PTPOQVXS.js');
|
|
8
|
+
require('../chunk-AETVRBKI.js');
|
|
9
9
|
require('../chunk-OWW5GUSB.js');
|
|
10
10
|
var vitest = require('vitest');
|
|
11
11
|
|
|
@@ -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(() =>
|
|
23
|
+
vitest.expect(() => chunkESGKWRQS_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(
|
|
27
|
+
vitest.expect(chunkESGKWRQS_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 =
|
|
59
|
+
const result = chunkESGKWRQS_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 =
|
|
74
|
+
h = chunkESGKWRQS_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(() =>
|
|
81
|
+
vitest.expect(() => chunkESGKWRQS_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
|
|
85
|
+
const { product, variantId } = await chunkESGKWRQS_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(() =>
|
|
90
|
+
vitest.expect(() => chunkESGKWRQS_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
|
|
102
|
-
await
|
|
101
|
+
await chunkESGKWRQS_js.fixtures.addFirstProduct(h.client);
|
|
102
|
+
await chunkESGKWRQS_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
|
|
110
|
+
await chunkESGKWRQS_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 =
|
|
136
|
+
h = chunkESGKWRQS_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 =
|
|
140
|
+
const result = chunkESGKWRQS_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 =
|
|
144
|
+
const result = chunkESGKWRQS_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 =
|
|
148
|
+
const result = chunkESGKWRQS_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
|
|
152
|
+
const { product } = await chunkESGKWRQS_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 =
|
|
157
|
+
const result = chunkESGKWRQS_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
|
|
167
|
+
await chunkESGKWRQS_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:
|
|
172
|
+
customer: chunkESGKWRQS_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 =
|
|
179
|
+
const result = chunkESGKWRQS_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:
|
package/dist/testing/suite.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
1
|
+
import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-A2GXDCSI.mjs';
|
|
2
|
+
import '../chunk-D6JWYYTG.mjs';
|
|
3
|
+
import '../chunk-MRL53WP6.mjs';
|
|
4
|
+
import '../chunk-NN3WC7XZ.mjs';
|
|
5
|
+
import '../chunk-KFLGQGMC.mjs';
|
|
6
|
+
import '../chunk-K5EN2W2Q.mjs';
|
|
7
7
|
import '../chunk-3G6RQLXK.mjs';
|
|
8
8
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
9
9
|
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 './client-
|
|
5
|
-
import './product-
|
|
6
|
-
import './payment-
|
|
7
|
-
import './server-
|
|
3
|
+
export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-DowGNrTh.mjs';
|
|
4
|
+
import './client-BQSRj4iK.mjs';
|
|
5
|
+
import './product-BGxIfTqJ.mjs';
|
|
6
|
+
import './payment-CFev-fOE.mjs';
|
|
7
|
+
import './server-9u0LiG5U.mjs';
|
|
8
8
|
import 'hono';
|
|
9
9
|
|
|
10
10
|
/**
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 './client-
|
|
5
|
-
import './product-
|
|
6
|
-
import './payment-
|
|
7
|
-
import './server-
|
|
3
|
+
export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-CMJO_8zo.js';
|
|
4
|
+
import './client-BdI24jUT.js';
|
|
5
|
+
import './product-BGxIfTqJ.js';
|
|
6
|
+
import './payment-BA7KNBxg.js';
|
|
7
|
+
import './server-BH7DTaaz.js';
|
|
8
8
|
import 'hono';
|
|
9
9
|
|
|
10
10
|
/**
|