@cimplify/sdk 0.45.4 → 0.46.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/{chunk-GDGDDGAE.mjs → chunk-IF22UYTT.mjs} +1 -1
- package/dist/{chunk-CJN5SPXN.js → chunk-K6FCVLZA.js} +447 -1
- package/dist/{chunk-BGCEKFLA.js → chunk-MN4PNKJA.js} +40 -0
- package/dist/{chunk-IRJFDKFV.mjs → chunk-NRDRVZ62.mjs} +37 -1
- package/dist/{chunk-DZGOF7CA.mjs → chunk-RQ3ILHUQ.mjs} +447 -1
- package/dist/{chunk-3OPVWRIP.js → chunk-ZH6ZST5T.js} +2 -2
- package/dist/{client-B0RPhAvp.d.ts → client-BDYBB-ME.d.ts} +1 -1
- package/dist/{client-BUtbmHv-.d.mts → client-MUD63aYS.d.mts} +1 -1
- package/dist/index.d.mts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +22 -6
- package/dist/index.mjs +1 -1
- package/dist/mock/cli.mjs +447 -1
- package/dist/mock/library.d.mts +2 -2
- package/dist/mock/library.d.ts +2 -2
- package/dist/mock/library.js +447 -1
- package/dist/mock/library.mjs +447 -1
- package/dist/mock/msw.d.mts +1 -1
- package/dist/mock/msw.d.ts +1 -1
- package/dist/mock/msw.js +447 -1
- package/dist/mock/msw.mjs +447 -1
- package/dist/react.js +45 -45
- package/dist/react.mjs +2 -2
- package/dist/{server-DkrQ4Idn.d.ts → server-Bg3VtA1D.d.ts} +1 -1
- package/dist/{server-CiUhgjZA.d.ts → server-CzthOeYS.d.mts} +1 -1
- package/dist/{server-CiUhgjZA.d.mts → server-CzthOeYS.d.ts} +1 -1
- package/dist/{server-BY-DDUM0.d.mts → server-kakjHRgj.d.mts} +1 -1
- 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 +3 -3
- package/dist/testing/suite.d.ts +3 -3
- package/dist/testing/suite.js +21 -21
- package/dist/testing/suite.mjs +2 -2
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +77 -77
- package/dist/testing.mjs +3 -3
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkMN4PNKJA_js = require('./chunk-MN4PNKJA.js');
|
|
5
5
|
var chunkLLZZMHSU_js = require('./chunk-LLZZMHSU.js');
|
|
6
6
|
var chunkGVLWRI5I_js = require('./chunk-GVLWRI5I.js');
|
|
7
7
|
var chunkBN2CXGMO_js = require('./chunk-BN2CXGMO.js');
|
|
@@ -4006,7 +4006,7 @@ function VariantSelector({
|
|
|
4006
4006
|
{
|
|
4007
4007
|
"data-cimplify-variant-name": true,
|
|
4008
4008
|
className: cn("flex-1 min-w-0 text-sm", classNames?.name),
|
|
4009
|
-
children:
|
|
4009
|
+
children: chunkMN4PNKJA_js.getVariantDisplayName(variant, productName)
|
|
4010
4010
|
}
|
|
4011
4011
|
),
|
|
4012
4012
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-variant-pricing": true, className: cn("text-sm text-muted-foreground", classNames?.pricing), children: [
|
|
@@ -5223,12 +5223,12 @@ function FieldInput({
|
|
|
5223
5223
|
classNames?.input
|
|
5224
5224
|
);
|
|
5225
5225
|
switch (field.field_type) {
|
|
5226
|
-
case
|
|
5227
|
-
case
|
|
5226
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Text:
|
|
5227
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Url:
|
|
5228
5228
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5229
5229
|
"input",
|
|
5230
5230
|
{
|
|
5231
|
-
type: field.field_type ===
|
|
5231
|
+
type: field.field_type === chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Url ? "url" : "text",
|
|
5232
5232
|
value: typeof value === "string" ? value : "",
|
|
5233
5233
|
onChange: (e) => onValueChange(e.target.value),
|
|
5234
5234
|
placeholder: field.placeholder,
|
|
@@ -5237,7 +5237,7 @@ function FieldInput({
|
|
|
5237
5237
|
className: inputClass
|
|
5238
5238
|
}
|
|
5239
5239
|
);
|
|
5240
|
-
case
|
|
5240
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Textarea:
|
|
5241
5241
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5242
5242
|
"textarea",
|
|
5243
5243
|
{
|
|
@@ -5250,7 +5250,7 @@ function FieldInput({
|
|
|
5250
5250
|
className: cn(inputClass, "resize-none", classNames?.textarea)
|
|
5251
5251
|
}
|
|
5252
5252
|
);
|
|
5253
|
-
case
|
|
5253
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Number:
|
|
5254
5254
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5255
5255
|
"input",
|
|
5256
5256
|
{
|
|
@@ -5264,7 +5264,7 @@ function FieldInput({
|
|
|
5264
5264
|
className: inputClass
|
|
5265
5265
|
}
|
|
5266
5266
|
);
|
|
5267
|
-
case
|
|
5267
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Select:
|
|
5268
5268
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5269
5269
|
"select",
|
|
5270
5270
|
{
|
|
@@ -5278,7 +5278,7 @@ function FieldInput({
|
|
|
5278
5278
|
]
|
|
5279
5279
|
}
|
|
5280
5280
|
);
|
|
5281
|
-
case
|
|
5281
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Radio:
|
|
5282
5282
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-y-2", classNames?.radioGroup), children: (field.options || []).map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5283
5283
|
"label",
|
|
5284
5284
|
{
|
|
@@ -5303,7 +5303,7 @@ function FieldInput({
|
|
|
5303
5303
|
},
|
|
5304
5304
|
opt
|
|
5305
5305
|
)) });
|
|
5306
|
-
case
|
|
5306
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Checkbox:
|
|
5307
5307
|
return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: cn("flex items-center gap-2 text-sm cursor-pointer", classNames?.checkboxLabel), children: [
|
|
5308
5308
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5309
5309
|
"input",
|
|
@@ -5316,7 +5316,7 @@ function FieldInput({
|
|
|
5316
5316
|
),
|
|
5317
5317
|
field.placeholder || field.name
|
|
5318
5318
|
] });
|
|
5319
|
-
case
|
|
5319
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Color:
|
|
5320
5320
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5321
5321
|
"input",
|
|
5322
5322
|
{
|
|
@@ -5326,7 +5326,7 @@ function FieldInput({
|
|
|
5326
5326
|
className: cn("w-12 h-10 rounded-md border border-input cursor-pointer", classNames?.colorInput)
|
|
5327
5327
|
}
|
|
5328
5328
|
);
|
|
5329
|
-
case
|
|
5329
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Date:
|
|
5330
5330
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5331
5331
|
"input",
|
|
5332
5332
|
{
|
|
@@ -5337,8 +5337,8 @@ function FieldInput({
|
|
|
5337
5337
|
className: inputClass
|
|
5338
5338
|
}
|
|
5339
5339
|
);
|
|
5340
|
-
case
|
|
5341
|
-
case
|
|
5340
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.File:
|
|
5341
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Image:
|
|
5342
5342
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5343
5343
|
FileUploadInput,
|
|
5344
5344
|
{
|
|
@@ -5349,7 +5349,7 @@ function FieldInput({
|
|
|
5349
5349
|
classNames
|
|
5350
5350
|
}
|
|
5351
5351
|
);
|
|
5352
|
-
case
|
|
5352
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Email:
|
|
5353
5353
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5354
5354
|
"input",
|
|
5355
5355
|
{
|
|
@@ -5361,7 +5361,7 @@ function FieldInput({
|
|
|
5361
5361
|
className: inputClass
|
|
5362
5362
|
}
|
|
5363
5363
|
);
|
|
5364
|
-
case
|
|
5364
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.DateTime: {
|
|
5365
5365
|
const dtLocalValue = typeof value === "string" && value.includes("T") ? value.slice(0, 16) : typeof value === "string" ? value : "";
|
|
5366
5366
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5367
5367
|
"input",
|
|
@@ -5381,7 +5381,7 @@ function FieldInput({
|
|
|
5381
5381
|
}
|
|
5382
5382
|
);
|
|
5383
5383
|
}
|
|
5384
|
-
case
|
|
5384
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Time:
|
|
5385
5385
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5386
5386
|
"input",
|
|
5387
5387
|
{
|
|
@@ -5392,7 +5392,7 @@ function FieldInput({
|
|
|
5392
5392
|
className: inputClass
|
|
5393
5393
|
}
|
|
5394
5394
|
);
|
|
5395
|
-
case
|
|
5395
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.MultiSelect:
|
|
5396
5396
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5397
5397
|
MultiSelectInput,
|
|
5398
5398
|
{
|
|
@@ -5402,7 +5402,7 @@ function FieldInput({
|
|
|
5402
5402
|
classNames
|
|
5403
5403
|
}
|
|
5404
5404
|
);
|
|
5405
|
-
case
|
|
5405
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.DateRange:
|
|
5406
5406
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5407
5407
|
DateRangeInput,
|
|
5408
5408
|
{
|
|
@@ -5413,7 +5413,7 @@ function FieldInput({
|
|
|
5413
5413
|
inputClass
|
|
5414
5414
|
}
|
|
5415
5415
|
);
|
|
5416
|
-
case
|
|
5416
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Address:
|
|
5417
5417
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5418
5418
|
AddressInput,
|
|
5419
5419
|
{
|
|
@@ -5424,7 +5424,7 @@ function FieldInput({
|
|
|
5424
5424
|
inputClass
|
|
5425
5425
|
}
|
|
5426
5426
|
);
|
|
5427
|
-
case
|
|
5427
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Location:
|
|
5428
5428
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5429
5429
|
LocationInput,
|
|
5430
5430
|
{
|
|
@@ -5435,7 +5435,7 @@ function FieldInput({
|
|
|
5435
5435
|
inputClass
|
|
5436
5436
|
}
|
|
5437
5437
|
);
|
|
5438
|
-
case
|
|
5438
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Phone:
|
|
5439
5439
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5440
5440
|
PhoneInput,
|
|
5441
5441
|
{
|
|
@@ -5446,7 +5446,7 @@ function FieldInput({
|
|
|
5446
5446
|
inputClass
|
|
5447
5447
|
}
|
|
5448
5448
|
);
|
|
5449
|
-
case
|
|
5449
|
+
case chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Signature:
|
|
5450
5450
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5451
5451
|
SignatureInput,
|
|
5452
5452
|
{
|
|
@@ -5479,7 +5479,7 @@ function FileUploadInput({
|
|
|
5479
5479
|
const [isUploading, setIsUploading] = React10__default.default.useState(false);
|
|
5480
5480
|
const fileUrl = typeof value === "string" ? value : void 0;
|
|
5481
5481
|
const acceptedFormats = field.validation?.accepted_formats;
|
|
5482
|
-
const accept = acceptedFormats ? acceptedFormats.map((f) => `.${f}`).join(",") : field.field_type ===
|
|
5482
|
+
const accept = acceptedFormats ? acceptedFormats.map((f) => `.${f}`).join(",") : field.field_type === chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Image ? "image/*" : void 0;
|
|
5483
5483
|
const handleFile = async (file) => {
|
|
5484
5484
|
if (!onFileUpload) return;
|
|
5485
5485
|
if (field.validation?.max_size_mb) {
|
|
@@ -5497,7 +5497,7 @@ function FileUploadInput({
|
|
|
5497
5497
|
}
|
|
5498
5498
|
};
|
|
5499
5499
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-y-2", classNames?.fileInput), children: fileUrl ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
5500
|
-
field.field_type ===
|
|
5500
|
+
field.field_type === chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Image && /* @__PURE__ */ jsxRuntime.jsx("img", { src: fileUrl, alt: "Uploaded", className: "w-16 h-16 object-cover rounded-md border border-border" }),
|
|
5501
5501
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground truncate", children: fileUrl.split("/").pop() }) }),
|
|
5502
5502
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5503
5503
|
"button",
|
|
@@ -5523,7 +5523,7 @@ function FileUploadInput({
|
|
|
5523
5523
|
}
|
|
5524
5524
|
),
|
|
5525
5525
|
isUploading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "Uploading..." }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5526
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: field.placeholder || `Upload ${field.field_type ===
|
|
5526
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: field.placeholder || `Upload ${field.field_type === chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Image ? "image" : "file"}` }),
|
|
5527
5527
|
acceptedFormats && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground/60 mt-1", children: [
|
|
5528
5528
|
acceptedFormats.map((f) => f.toUpperCase()).join(", "),
|
|
5529
5529
|
field.validation?.max_size_mb && ` \xB7 Max ${field.validation.max_size_mb}MB`
|
|
@@ -6742,7 +6742,7 @@ function CartLineItemRow({
|
|
|
6742
6742
|
const isOptimistic = item.isOptimistic === true;
|
|
6743
6743
|
const lineTotal = chunkBN2CXGMO_js.parsePrice(unitPrice) * item.quantity;
|
|
6744
6744
|
const imageUrl = item.product.image_url;
|
|
6745
|
-
const variantLabel = item.variant ?
|
|
6745
|
+
const variantLabel = item.variant ? chunkMN4PNKJA_js.getVariantDisplayName(item.variant, item.product.name) : null;
|
|
6746
6746
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6747
6747
|
"div",
|
|
6748
6748
|
{
|
|
@@ -6842,7 +6842,7 @@ function CartLineItemRow({
|
|
|
6842
6842
|
input.field_name,
|
|
6843
6843
|
":"
|
|
6844
6844
|
] }),
|
|
6845
|
-
/* @__PURE__ */ jsxRuntime.jsx("dd", { "data-cimplify-cart-input-value": true, className: "text-foreground m-0 truncate", children: input.field_type ===
|
|
6845
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { "data-cimplify-cart-input-value": true, className: "text-foreground m-0 truncate", children: input.field_type === chunkMN4PNKJA_js.INPUT_FIELD_TYPE.File || input.field_type === chunkMN4PNKJA_js.INPUT_FIELD_TYPE.Image ? String(input.value).split("/").pop() || "Uploaded file" : String(input.value) })
|
|
6846
6846
|
] }, input.field_id)) }),
|
|
6847
6847
|
(item.lineType === "service" || item.product.type === "service") && item.scheduledStart && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-info": true, className: cn("mt-1.5 flex items-center gap-1.5 text-xs text-muted-foreground", classNames?.serviceInfo), children: [
|
|
6848
6848
|
/* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3.5 h-3.5 shrink-0", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
|
|
@@ -7399,7 +7399,7 @@ function FoodProductCard({
|
|
|
7399
7399
|
const tags = product.tags || [];
|
|
7400
7400
|
const isSignature = product.metadata?.is_signature === true;
|
|
7401
7401
|
const isNew = product.metadata?.is_new === true;
|
|
7402
|
-
const isComposite = product.type ===
|
|
7402
|
+
const isComposite = product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Composite;
|
|
7403
7403
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
7404
7404
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
7405
7405
|
isSignature && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "absolute top-3 left-3 inline-flex items-center gap-1 text-[11px] font-semibold tracking-wide bg-amber-50 text-amber-700 border border-amber-200/60 px-2 py-0.5 rounded-md", children: [
|
|
@@ -8152,26 +8152,26 @@ var BUILT_IN_CARDS = {
|
|
|
8152
8152
|
["composite" /* Composite */]: CompositeProductCard,
|
|
8153
8153
|
["subscription" /* Subscription */]: SubscriptionCard
|
|
8154
8154
|
};
|
|
8155
|
-
var RENTAL_UNITS = /* @__PURE__ */ new Set([
|
|
8156
|
-
var LEASE_UNITS = /* @__PURE__ */ new Set([
|
|
8155
|
+
var RENTAL_UNITS = /* @__PURE__ */ new Set([chunkMN4PNKJA_js.DURATION_UNIT.Days, chunkMN4PNKJA_js.DURATION_UNIT.Hours]);
|
|
8156
|
+
var LEASE_UNITS = /* @__PURE__ */ new Set([chunkMN4PNKJA_js.DURATION_UNIT.Weeks, chunkMN4PNKJA_js.DURATION_UNIT.Months, chunkMN4PNKJA_js.DURATION_UNIT.Years]);
|
|
8157
8157
|
function resolveCardVariant(product) {
|
|
8158
|
-
if (product.type ===
|
|
8158
|
+
if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Bundle) {
|
|
8159
8159
|
return "bundle" /* Bundle */;
|
|
8160
8160
|
}
|
|
8161
|
-
if (product.type ===
|
|
8161
|
+
if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Composite) {
|
|
8162
8162
|
return "composite" /* Composite */;
|
|
8163
8163
|
}
|
|
8164
8164
|
if (product.quantity_pricing && product.quantity_pricing.length > 1) {
|
|
8165
8165
|
return "wholesale" /* Wholesale */;
|
|
8166
8166
|
}
|
|
8167
|
-
if (product.type ===
|
|
8167
|
+
if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Digital) {
|
|
8168
8168
|
return "digital" /* Digital */;
|
|
8169
8169
|
}
|
|
8170
|
-
if (product.type ===
|
|
8170
|
+
if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Service) {
|
|
8171
8171
|
if (product.duration_unit && RENTAL_UNITS.has(product.duration_unit)) {
|
|
8172
8172
|
return "rental" /* Rental */;
|
|
8173
8173
|
}
|
|
8174
|
-
if (product.duration_unit ===
|
|
8174
|
+
if (product.duration_unit === chunkMN4PNKJA_js.DURATION_UNIT.Nights) {
|
|
8175
8175
|
return "accommodation" /* Accommodation */;
|
|
8176
8176
|
}
|
|
8177
8177
|
if (product.duration_unit && LEASE_UNITS.has(product.duration_unit)) {
|
|
@@ -8182,10 +8182,10 @@ function resolveCardVariant(product) {
|
|
|
8182
8182
|
}
|
|
8183
8183
|
return "standard" /* Standard */;
|
|
8184
8184
|
}
|
|
8185
|
-
if (product.render_hint ===
|
|
8185
|
+
if (product.render_hint === chunkMN4PNKJA_js.RENDER_HINT.Food) {
|
|
8186
8186
|
return "food" /* Food */;
|
|
8187
8187
|
}
|
|
8188
|
-
if (product.render_hint ===
|
|
8188
|
+
if (product.render_hint === chunkMN4PNKJA_js.RENDER_HINT.Physical) {
|
|
8189
8189
|
return "retail" /* Retail */;
|
|
8190
8190
|
}
|
|
8191
8191
|
return "retail" /* Retail */;
|
|
@@ -11125,25 +11125,25 @@ function resolveTemplateKey(product) {
|
|
|
11125
11125
|
if (typeof metaTemplate === "string" && metaTemplate.trim()) {
|
|
11126
11126
|
return metaTemplate.trim();
|
|
11127
11127
|
}
|
|
11128
|
-
if (product.type ===
|
|
11128
|
+
if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Bundle) {
|
|
11129
11129
|
return "bundle" /* Bundle */;
|
|
11130
11130
|
}
|
|
11131
|
-
if (product.type ===
|
|
11131
|
+
if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Composite) {
|
|
11132
11132
|
return "composite" /* Composite */;
|
|
11133
11133
|
}
|
|
11134
11134
|
if (product.quantity_pricing && product.quantity_pricing.length > 1) {
|
|
11135
11135
|
return "wholesale" /* Wholesale */;
|
|
11136
11136
|
}
|
|
11137
|
-
if (product.type ===
|
|
11137
|
+
if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Service) {
|
|
11138
11138
|
return "service" /* Service */;
|
|
11139
11139
|
}
|
|
11140
|
-
if (product.type ===
|
|
11140
|
+
if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Digital) {
|
|
11141
11141
|
return "digital" /* Digital */;
|
|
11142
11142
|
}
|
|
11143
|
-
if (product.render_hint ===
|
|
11143
|
+
if (product.render_hint === chunkMN4PNKJA_js.RENDER_HINT.Food) {
|
|
11144
11144
|
return "food" /* Food */;
|
|
11145
11145
|
}
|
|
11146
|
-
if (product.render_hint ===
|
|
11146
|
+
if (product.render_hint === chunkMN4PNKJA_js.RENDER_HINT.Physical) {
|
|
11147
11147
|
return "physical" /* Physical */;
|
|
11148
11148
|
}
|
|
11149
11149
|
return "default" /* Default */;
|
|
@@ -13369,7 +13369,7 @@ function SparkleIcon({ className }) {
|
|
|
13369
13369
|
|
|
13370
13370
|
Object.defineProperty(exports, "getVariantDisplayName", {
|
|
13371
13371
|
enumerable: true,
|
|
13372
|
-
get: function () { return
|
|
13372
|
+
get: function () { return chunkMN4PNKJA_js.getVariantDisplayName; }
|
|
13373
13373
|
});
|
|
13374
13374
|
exports.AccommodationCard = AccommodationCard;
|
|
13375
13375
|
exports.Ad = Ad;
|
package/dist/react.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT } from './chunk-
|
|
3
|
-
export { getVariantDisplayName } from './chunk-
|
|
2
|
+
import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT } from './chunk-NRDRVZ62.mjs';
|
|
3
|
+
export { getVariantDisplayName } from './chunk-NRDRVZ62.mjs';
|
|
4
4
|
import { createCimplifyClient } from './chunk-RR3ZJQW5.mjs';
|
|
5
5
|
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-AIXUFSA6.mjs';
|
|
6
6
|
import { formatPrice, parsePrice, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-NRT6PVW5.mjs';
|
|
@@ -1072,7 +1072,7 @@ interface LinkService {
|
|
|
1072
1072
|
revokeAllSessions(customerId: string): number;
|
|
1073
1073
|
}
|
|
1074
1074
|
|
|
1075
|
-
type SeedName = "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion" | "pharmacy";
|
|
1075
|
+
type SeedName = "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion" | "pharmacy" | "auto";
|
|
1076
1076
|
|
|
1077
1077
|
interface MockOptions {
|
|
1078
1078
|
seed?: SeedName;
|
|
@@ -1105,7 +1105,7 @@ interface LinkService {
|
|
|
1105
1105
|
revokeAllSessions(customerId: string): number;
|
|
1106
1106
|
}
|
|
1107
1107
|
|
|
1108
|
-
type SeedName = "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion" | "pharmacy";
|
|
1108
|
+
type SeedName = "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion" | "pharmacy" | "auto";
|
|
1109
1109
|
declare function applySeed(registry: StateRegistry, name: SeedName): {
|
|
1110
1110
|
businessId: string;
|
|
1111
1111
|
};
|
|
@@ -1105,7 +1105,7 @@ interface LinkService {
|
|
|
1105
1105
|
revokeAllSessions(customerId: string): number;
|
|
1106
1106
|
}
|
|
1107
1107
|
|
|
1108
|
-
type SeedName = "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion" | "pharmacy";
|
|
1108
|
+
type SeedName = "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion" | "pharmacy" | "auto";
|
|
1109
1109
|
declare function applySeed(registry: StateRegistry, name: SeedName): {
|
|
1110
1110
|
businessId: string;
|
|
1111
1111
|
};
|
|
@@ -1072,7 +1072,7 @@ interface LinkService {
|
|
|
1072
1072
|
revokeAllSessions(customerId: string): number;
|
|
1073
1073
|
}
|
|
1074
1074
|
|
|
1075
|
-
type SeedName = "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion" | "pharmacy";
|
|
1075
|
+
type SeedName = "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion" | "pharmacy" | "auto";
|
|
1076
1076
|
|
|
1077
1077
|
interface MockOptions {
|
|
1078
1078
|
seed?: SeedName;
|
package/dist/testing/msw.d.mts
CHANGED
package/dist/testing/msw.d.ts
CHANGED
package/dist/testing/msw.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkK6FCVLZA_js = require('../chunk-K6FCVLZA.js');
|
|
4
4
|
require('../chunk-QBQCMQ4F.js');
|
|
5
5
|
|
|
6
6
|
// src/mock/msw.ts
|
|
7
7
|
async function createMswHandlers(options = {}) {
|
|
8
8
|
const baseUrl = options.baseUrl ?? "http://localhost:8787";
|
|
9
|
-
const handle =
|
|
9
|
+
const handle = chunkK6FCVLZA_js.createMockApp(options);
|
|
10
10
|
const msw = await import('msw').catch(() => {
|
|
11
11
|
throw new Error("msw is required to use @cimplify/sdk/mock/msw \u2014 install it as a peer dependency");
|
|
12
12
|
});
|
package/dist/testing/msw.mjs
CHANGED
package/dist/testing/suite.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
2
|
+
import { T as TestClientHandle } from '../client-MUD63aYS.mjs';
|
|
3
|
+
import { C as CreateAppOptions } from '../server-kakjHRgj.mjs';
|
|
4
|
+
export { S as SeedName } from '../server-kakjHRgj.mjs';
|
|
5
5
|
import '../client-CDUY-6nC.mjs';
|
|
6
6
|
import '../product-DiX-HGkT.mjs';
|
|
7
7
|
import '../payment-Bse2XJ-c.mjs';
|
package/dist/testing/suite.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
2
|
+
import { T as TestClientHandle } from '../client-BDYBB-ME.js';
|
|
3
|
+
import { C as CreateAppOptions } from '../server-Bg3VtA1D.js';
|
|
4
|
+
export { S as SeedName } from '../server-Bg3VtA1D.js';
|
|
5
5
|
import '../client-aZInadOY.js';
|
|
6
6
|
import '../product-DiX-HGkT.js';
|
|
7
7
|
import '../payment-JcNqOf_T.js';
|
package/dist/testing/suite.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkZH6ZST5T_js = require('../chunk-ZH6ZST5T.js');
|
|
4
4
|
require('../chunk-LLZZMHSU.js');
|
|
5
5
|
require('../chunk-GVLWRI5I.js');
|
|
6
6
|
require('../chunk-BN2CXGMO.js');
|
|
7
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-K6FCVLZA.js');
|
|
8
8
|
require('../chunk-QBQCMQ4F.js');
|
|
9
9
|
var vitest = require('vitest');
|
|
10
10
|
|
|
@@ -19,11 +19,11 @@ var PLACEHOLDER_PHRASES = [
|
|
|
19
19
|
function createBrandSuite(opts) {
|
|
20
20
|
vitest.describe(opts.label ?? "brand schema", () => {
|
|
21
21
|
vitest.it("conforms to the Cimplify brand contract", () => {
|
|
22
|
-
vitest.expect(() =>
|
|
22
|
+
vitest.expect(() => chunkZH6ZST5T_js.assertBrand(opts.brand)).not.toThrow();
|
|
23
23
|
});
|
|
24
24
|
vitest.it("declares a known mock seed", () => {
|
|
25
25
|
const b = opts.brand;
|
|
26
|
-
vitest.expect(
|
|
26
|
+
vitest.expect(chunkZH6ZST5T_js.SeedNameSchema.safeParse(b.mock?.seed).success).toBe(true);
|
|
27
27
|
});
|
|
28
28
|
vitest.it("has no placeholder copy left in", () => {
|
|
29
29
|
const offenders = [];
|
|
@@ -55,7 +55,7 @@ ${msg}`);
|
|
|
55
55
|
vitest.expect(b.mock?.businessId).toMatch(/^bus_/);
|
|
56
56
|
});
|
|
57
57
|
vitest.it("zod-parses cleanly", () => {
|
|
58
|
-
const result =
|
|
58
|
+
const result = chunkZH6ZST5T_js.BrandSchema.safeParse(opts.brand);
|
|
59
59
|
if (!result.success) {
|
|
60
60
|
throw new Error(
|
|
61
61
|
"Brand schema violations:\n" + result.error.issues.map((i) => ` \u2022 brand.${i.path.join(".")}: ${i.message}`).join("\n")
|
|
@@ -70,23 +70,23 @@ function createCartFlowSuite(opts = {}) {
|
|
|
70
70
|
vitest.describe(opts.label ?? "cart flow against in-process mock", () => {
|
|
71
71
|
let h;
|
|
72
72
|
vitest.beforeEach(() => {
|
|
73
|
-
h =
|
|
73
|
+
h = chunkZH6ZST5T_js.createTestClient(opts);
|
|
74
74
|
});
|
|
75
75
|
vitest.afterEach(() => h.dispose());
|
|
76
76
|
vitest.it("starts with an empty cart matching the canonical shape", async () => {
|
|
77
77
|
const res = await h.client.cart.get();
|
|
78
78
|
vitest.expect(res.ok).toBe(true);
|
|
79
79
|
if (!res.ok) return;
|
|
80
|
-
vitest.expect(() =>
|
|
80
|
+
vitest.expect(() => chunkZH6ZST5T_js.assertCart(res.value)).not.toThrow();
|
|
81
81
|
vitest.expect(res.value.items).toHaveLength(0);
|
|
82
82
|
});
|
|
83
83
|
vitest.it("adds the first product, persists it, and returns a shape-valid cart", async () => {
|
|
84
|
-
const { product, variantId } = await
|
|
84
|
+
const { product, variantId } = await chunkZH6ZST5T_js.fixtures.addFirstProduct(h.client);
|
|
85
85
|
vitest.expect(product.id).toBeTruthy();
|
|
86
86
|
const get = await h.client.cart.get();
|
|
87
87
|
vitest.expect(get.ok).toBe(true);
|
|
88
88
|
if (!get.ok) return;
|
|
89
|
-
vitest.expect(() =>
|
|
89
|
+
vitest.expect(() => chunkZH6ZST5T_js.assertCart(get.value)).not.toThrow();
|
|
90
90
|
vitest.expect(get.value.items).toHaveLength(1);
|
|
91
91
|
vitest.expect(get.value.items[0]?.item_id).toBe(product.id);
|
|
92
92
|
if (variantId) {
|
|
@@ -97,8 +97,8 @@ function createCartFlowSuite(opts = {}) {
|
|
|
97
97
|
vitest.expect(parseFloat(String(get.value.pricing.subtotal))).toBeGreaterThan(0);
|
|
98
98
|
});
|
|
99
99
|
vitest.it("dedupes by line_key when adding the same product twice", async () => {
|
|
100
|
-
await
|
|
101
|
-
await
|
|
100
|
+
await chunkZH6ZST5T_js.fixtures.addFirstProduct(h.client);
|
|
101
|
+
await chunkZH6ZST5T_js.fixtures.addFirstProduct(h.client);
|
|
102
102
|
const res = await h.client.cart.get();
|
|
103
103
|
vitest.expect(res.ok).toBe(true);
|
|
104
104
|
if (!res.ok) return;
|
|
@@ -106,7 +106,7 @@ function createCartFlowSuite(opts = {}) {
|
|
|
106
106
|
vitest.expect(res.value.items[0]?.quantity).toBe(2);
|
|
107
107
|
});
|
|
108
108
|
vitest.it("removes items and zeroes the subtotal", async () => {
|
|
109
|
-
await
|
|
109
|
+
await chunkZH6ZST5T_js.fixtures.addFirstProduct(h.client);
|
|
110
110
|
const before = await h.client.cart.get();
|
|
111
111
|
if (!before.ok) throw before.error;
|
|
112
112
|
const itemId = before.value.items[0]?.id;
|
|
@@ -132,28 +132,28 @@ function createContractSuite(opts = {}) {
|
|
|
132
132
|
vitest.describe(opts.label ?? "SDK \u2194 mock contract", () => {
|
|
133
133
|
let h;
|
|
134
134
|
vitest.beforeEach(() => {
|
|
135
|
-
h =
|
|
135
|
+
h = chunkZH6ZST5T_js.createTestClient(opts);
|
|
136
136
|
});
|
|
137
137
|
vitest.afterEach(() => h.dispose());
|
|
138
138
|
vitest.it("AddItemPayload schema accepts a minimal valid body", () => {
|
|
139
|
-
const result =
|
|
139
|
+
const result = chunkZH6ZST5T_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: 1 });
|
|
140
140
|
vitest.expect(result.success).toBe(true);
|
|
141
141
|
});
|
|
142
142
|
vitest.it("AddItemPayload schema rejects negative quantity", () => {
|
|
143
|
-
const result =
|
|
143
|
+
const result = chunkZH6ZST5T_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: -1 });
|
|
144
144
|
vitest.expect(result.success).toBe(false);
|
|
145
145
|
});
|
|
146
146
|
vitest.it("AddItemPayload schema rejects empty item_id", () => {
|
|
147
|
-
const result =
|
|
147
|
+
const result = chunkZH6ZST5T_js.AddItemPayloadSchema.safeParse({ item_id: "", quantity: 1 });
|
|
148
148
|
vitest.expect(result.success).toBe(false);
|
|
149
149
|
});
|
|
150
150
|
vitest.it("Cart line items returned by the mock match CartItemSchema", async () => {
|
|
151
|
-
const { product } = await
|
|
151
|
+
const { product } = await chunkZH6ZST5T_js.fixtures.addFirstProduct(h.client);
|
|
152
152
|
const get = await h.client.cart.get();
|
|
153
153
|
if (!get.ok) throw get.error;
|
|
154
154
|
vitest.expect(get.value.items.length).toBeGreaterThan(0);
|
|
155
155
|
for (const item of get.value.items) {
|
|
156
|
-
const result =
|
|
156
|
+
const result = chunkZH6ZST5T_js.CartItemSchema.safeParse(item);
|
|
157
157
|
if (!result.success) {
|
|
158
158
|
const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
|
|
159
159
|
throw new Error(`Cart item shape mismatch for ${product.name}:
|
|
@@ -163,19 +163,19 @@ ${issues}`);
|
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
165
|
vitest.it("CheckoutResponse from the mock includes bill_token", async () => {
|
|
166
|
-
await
|
|
166
|
+
await chunkZH6ZST5T_js.fixtures.addFirstProduct(h.client);
|
|
167
167
|
const cartRes = await h.client.cart.get();
|
|
168
168
|
if (!cartRes.ok) throw cartRes.error;
|
|
169
169
|
const checkout = await h.client.checkout.process({
|
|
170
170
|
cart_id: cartRes.value.id,
|
|
171
|
-
customer:
|
|
171
|
+
customer: chunkZH6ZST5T_js.fixtures.customer(),
|
|
172
172
|
order_type: "delivery",
|
|
173
173
|
payment_method: "mobile_money",
|
|
174
174
|
mobile_money_details: { phone_number: "+233244000000", provider: "mtn" }
|
|
175
175
|
});
|
|
176
176
|
vitest.expect(checkout.ok).toBe(true);
|
|
177
177
|
if (!checkout.ok) return;
|
|
178
|
-
const result =
|
|
178
|
+
const result = chunkZH6ZST5T_js.CheckoutResponseSchema.safeParse(checkout.value);
|
|
179
179
|
if (!result.success) {
|
|
180
180
|
const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
|
|
181
181
|
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-
|
|
1
|
+
import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-IF22UYTT.mjs';
|
|
2
2
|
import '../chunk-RR3ZJQW5.mjs';
|
|
3
3
|
import '../chunk-AIXUFSA6.mjs';
|
|
4
4
|
import '../chunk-NRT6PVW5.mjs';
|
|
5
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-RQ3ILHUQ.mjs';
|
|
6
6
|
import '../chunk-XPXAZXF2.mjs';
|
|
7
7
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
8
8
|
|
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-
|
|
3
|
+
export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-MUD63aYS.mjs';
|
|
4
4
|
import './client-CDUY-6nC.mjs';
|
|
5
5
|
import './product-DiX-HGkT.mjs';
|
|
6
6
|
import './payment-Bse2XJ-c.mjs';
|
|
7
|
-
import './server-
|
|
7
|
+
import './server-kakjHRgj.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-
|
|
3
|
+
export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-BDYBB-ME.js';
|
|
4
4
|
import './client-aZInadOY.js';
|
|
5
5
|
import './product-DiX-HGkT.js';
|
|
6
6
|
import './payment-JcNqOf_T.js';
|
|
7
|
-
import './server-
|
|
7
|
+
import './server-Bg3VtA1D.js';
|
|
8
8
|
import 'hono';
|
|
9
9
|
|
|
10
10
|
/**
|