@cimplify/sdk 0.38.5 → 0.39.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/{chunk-JTU5P6GM.mjs → chunk-3WD6U5RD.mjs} +1 -83
- package/dist/chunk-BGCEKFLA.js +89 -0
- package/dist/chunk-IRJFDKFV.mjs +83 -0
- package/dist/{chunk-5VHKZTFJ.js → chunk-OMAP327U.js} +0 -87
- package/dist/index.js +34 -33
- package/dist/index.mjs +2 -1
- package/dist/react.js +47 -46
- package/dist/react.mjs +3 -2
- package/dist/server.d.mts +97 -0
- package/dist/server.d.ts +97 -0
- package/dist/server.js +107 -0
- package/dist/server.mjs +92 -0
- package/dist/styles.css +1 -1
- package/package.json +7 -1
- package/templates/storefront/app/about/page.tsx +61 -0
- package/templates/storefront/app/categories/[slug]/listing-client.tsx +19 -0
- package/templates/storefront/app/categories/[slug]/page.tsx +94 -57
- package/templates/storefront/app/collections/[slug]/listing-client.tsx +20 -0
- package/templates/storefront/app/collections/[slug]/page.tsx +94 -57
- package/templates/storefront/app/faq/page.tsx +122 -0
- package/templates/storefront/app/page.tsx +77 -45
- package/templates/storefront/app/privacy/page.tsx +88 -0
- package/templates/storefront/app/shop/page.tsx +25 -41
- package/templates/storefront/app/shop/shop-client.tsx +27 -0
- package/templates/storefront/app/terms/page.tsx +102 -0
- package/templates/storefront/components/cart-pill.tsx +32 -0
- package/templates/storefront/components/footer.tsx +186 -15
- package/templates/storefront/components/header.tsx +32 -22
- package/templates/storefront/components/nav-link.tsx +20 -0
- package/templates/storefront/components/store-product-card.tsx +9 -25
- package/templates/storefront/lib/server-client.ts +27 -0
- package/templates/storefront/next.config.ts +4 -0
package/dist/react.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkBGCEKFLA_js = require('./chunk-BGCEKFLA.js');
|
|
5
|
+
var chunkOMAP327U_js = require('./chunk-OMAP327U.js');
|
|
5
6
|
var chunkBAWKQRIB_js = require('./chunk-BAWKQRIB.js');
|
|
6
7
|
var chunkV2O5AO7I_js = require('./chunk-V2O5AO7I.js');
|
|
7
8
|
var React10 = require('react');
|
|
@@ -1151,7 +1152,7 @@ var DEFAULT_COUNTRY = "US";
|
|
|
1151
1152
|
function createDefaultClient() {
|
|
1152
1153
|
const processRef = globalThis.process;
|
|
1153
1154
|
const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
1154
|
-
return
|
|
1155
|
+
return chunkOMAP327U_js.createCimplifyClient({ publicKey: envPublicKey });
|
|
1155
1156
|
}
|
|
1156
1157
|
function getStoredLocationId() {
|
|
1157
1158
|
if (typeof window === "undefined" || !window.localStorage) {
|
|
@@ -4004,7 +4005,7 @@ function VariantSelector({
|
|
|
4004
4005
|
{
|
|
4005
4006
|
"data-cimplify-variant-name": true,
|
|
4006
4007
|
className: cn("flex-1 min-w-0 text-sm", classNames?.name),
|
|
4007
|
-
children:
|
|
4008
|
+
children: chunkBGCEKFLA_js.getVariantDisplayName(variant, productName)
|
|
4008
4009
|
}
|
|
4009
4010
|
),
|
|
4010
4011
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-variant-pricing": true, className: cn("text-sm text-muted-foreground", classNames?.pricing), children: [
|
|
@@ -5221,12 +5222,12 @@ function FieldInput({
|
|
|
5221
5222
|
classNames?.input
|
|
5222
5223
|
);
|
|
5223
5224
|
switch (field.field_type) {
|
|
5224
|
-
case
|
|
5225
|
-
case
|
|
5225
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Text:
|
|
5226
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Url:
|
|
5226
5227
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5227
5228
|
"input",
|
|
5228
5229
|
{
|
|
5229
|
-
type: field.field_type ===
|
|
5230
|
+
type: field.field_type === chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Url ? "url" : "text",
|
|
5230
5231
|
value: typeof value === "string" ? value : "",
|
|
5231
5232
|
onChange: (e) => onValueChange(e.target.value),
|
|
5232
5233
|
placeholder: field.placeholder,
|
|
@@ -5235,7 +5236,7 @@ function FieldInput({
|
|
|
5235
5236
|
className: inputClass
|
|
5236
5237
|
}
|
|
5237
5238
|
);
|
|
5238
|
-
case
|
|
5239
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Textarea:
|
|
5239
5240
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5240
5241
|
"textarea",
|
|
5241
5242
|
{
|
|
@@ -5248,7 +5249,7 @@ function FieldInput({
|
|
|
5248
5249
|
className: cn(inputClass, "resize-none", classNames?.textarea)
|
|
5249
5250
|
}
|
|
5250
5251
|
);
|
|
5251
|
-
case
|
|
5252
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Number:
|
|
5252
5253
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5253
5254
|
"input",
|
|
5254
5255
|
{
|
|
@@ -5262,7 +5263,7 @@ function FieldInput({
|
|
|
5262
5263
|
className: inputClass
|
|
5263
5264
|
}
|
|
5264
5265
|
);
|
|
5265
|
-
case
|
|
5266
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Select:
|
|
5266
5267
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5267
5268
|
"select",
|
|
5268
5269
|
{
|
|
@@ -5276,7 +5277,7 @@ function FieldInput({
|
|
|
5276
5277
|
]
|
|
5277
5278
|
}
|
|
5278
5279
|
);
|
|
5279
|
-
case
|
|
5280
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Radio:
|
|
5280
5281
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-y-2", classNames?.radioGroup), children: (field.options || []).map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5281
5282
|
"label",
|
|
5282
5283
|
{
|
|
@@ -5301,7 +5302,7 @@ function FieldInput({
|
|
|
5301
5302
|
},
|
|
5302
5303
|
opt
|
|
5303
5304
|
)) });
|
|
5304
|
-
case
|
|
5305
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Checkbox:
|
|
5305
5306
|
return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: cn("flex items-center gap-2 text-sm cursor-pointer", classNames?.checkboxLabel), children: [
|
|
5306
5307
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5307
5308
|
"input",
|
|
@@ -5314,7 +5315,7 @@ function FieldInput({
|
|
|
5314
5315
|
),
|
|
5315
5316
|
field.placeholder || field.name
|
|
5316
5317
|
] });
|
|
5317
|
-
case
|
|
5318
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Color:
|
|
5318
5319
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5319
5320
|
"input",
|
|
5320
5321
|
{
|
|
@@ -5324,7 +5325,7 @@ function FieldInput({
|
|
|
5324
5325
|
className: cn("w-12 h-10 rounded-md border border-input cursor-pointer", classNames?.colorInput)
|
|
5325
5326
|
}
|
|
5326
5327
|
);
|
|
5327
|
-
case
|
|
5328
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Date:
|
|
5328
5329
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5329
5330
|
"input",
|
|
5330
5331
|
{
|
|
@@ -5335,8 +5336,8 @@ function FieldInput({
|
|
|
5335
5336
|
className: inputClass
|
|
5336
5337
|
}
|
|
5337
5338
|
);
|
|
5338
|
-
case
|
|
5339
|
-
case
|
|
5339
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.File:
|
|
5340
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Image:
|
|
5340
5341
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5341
5342
|
FileUploadInput,
|
|
5342
5343
|
{
|
|
@@ -5347,7 +5348,7 @@ function FieldInput({
|
|
|
5347
5348
|
classNames
|
|
5348
5349
|
}
|
|
5349
5350
|
);
|
|
5350
|
-
case
|
|
5351
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Email:
|
|
5351
5352
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5352
5353
|
"input",
|
|
5353
5354
|
{
|
|
@@ -5359,7 +5360,7 @@ function FieldInput({
|
|
|
5359
5360
|
className: inputClass
|
|
5360
5361
|
}
|
|
5361
5362
|
);
|
|
5362
|
-
case
|
|
5363
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.DateTime: {
|
|
5363
5364
|
const dtLocalValue = typeof value === "string" && value.includes("T") ? value.slice(0, 16) : typeof value === "string" ? value : "";
|
|
5364
5365
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5365
5366
|
"input",
|
|
@@ -5379,7 +5380,7 @@ function FieldInput({
|
|
|
5379
5380
|
}
|
|
5380
5381
|
);
|
|
5381
5382
|
}
|
|
5382
|
-
case
|
|
5383
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Time:
|
|
5383
5384
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5384
5385
|
"input",
|
|
5385
5386
|
{
|
|
@@ -5390,7 +5391,7 @@ function FieldInput({
|
|
|
5390
5391
|
className: inputClass
|
|
5391
5392
|
}
|
|
5392
5393
|
);
|
|
5393
|
-
case
|
|
5394
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.MultiSelect:
|
|
5394
5395
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5395
5396
|
MultiSelectInput,
|
|
5396
5397
|
{
|
|
@@ -5400,7 +5401,7 @@ function FieldInput({
|
|
|
5400
5401
|
classNames
|
|
5401
5402
|
}
|
|
5402
5403
|
);
|
|
5403
|
-
case
|
|
5404
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.DateRange:
|
|
5404
5405
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5405
5406
|
DateRangeInput,
|
|
5406
5407
|
{
|
|
@@ -5411,7 +5412,7 @@ function FieldInput({
|
|
|
5411
5412
|
inputClass
|
|
5412
5413
|
}
|
|
5413
5414
|
);
|
|
5414
|
-
case
|
|
5415
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Address:
|
|
5415
5416
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5416
5417
|
AddressInput,
|
|
5417
5418
|
{
|
|
@@ -5422,7 +5423,7 @@ function FieldInput({
|
|
|
5422
5423
|
inputClass
|
|
5423
5424
|
}
|
|
5424
5425
|
);
|
|
5425
|
-
case
|
|
5426
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Location:
|
|
5426
5427
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5427
5428
|
LocationInput,
|
|
5428
5429
|
{
|
|
@@ -5433,7 +5434,7 @@ function FieldInput({
|
|
|
5433
5434
|
inputClass
|
|
5434
5435
|
}
|
|
5435
5436
|
);
|
|
5436
|
-
case
|
|
5437
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Phone:
|
|
5437
5438
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5438
5439
|
PhoneInput,
|
|
5439
5440
|
{
|
|
@@ -5444,7 +5445,7 @@ function FieldInput({
|
|
|
5444
5445
|
inputClass
|
|
5445
5446
|
}
|
|
5446
5447
|
);
|
|
5447
|
-
case
|
|
5448
|
+
case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Signature:
|
|
5448
5449
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5449
5450
|
SignatureInput,
|
|
5450
5451
|
{
|
|
@@ -5477,7 +5478,7 @@ function FileUploadInput({
|
|
|
5477
5478
|
const [isUploading, setIsUploading] = React10__default.default.useState(false);
|
|
5478
5479
|
const fileUrl = typeof value === "string" ? value : void 0;
|
|
5479
5480
|
const acceptedFormats = field.validation?.accepted_formats;
|
|
5480
|
-
const accept = acceptedFormats ? acceptedFormats.map((f) => `.${f}`).join(",") : field.field_type ===
|
|
5481
|
+
const accept = acceptedFormats ? acceptedFormats.map((f) => `.${f}`).join(",") : field.field_type === chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Image ? "image/*" : void 0;
|
|
5481
5482
|
const handleFile = async (file) => {
|
|
5482
5483
|
if (!onFileUpload) return;
|
|
5483
5484
|
if (field.validation?.max_size_mb) {
|
|
@@ -5495,7 +5496,7 @@ function FileUploadInput({
|
|
|
5495
5496
|
}
|
|
5496
5497
|
};
|
|
5497
5498
|
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: [
|
|
5498
|
-
field.field_type ===
|
|
5499
|
+
field.field_type === chunkBGCEKFLA_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" }),
|
|
5499
5500
|
/* @__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() }) }),
|
|
5500
5501
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5501
5502
|
"button",
|
|
@@ -5521,7 +5522,7 @@ function FileUploadInput({
|
|
|
5521
5522
|
}
|
|
5522
5523
|
),
|
|
5523
5524
|
isUploading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "Uploading..." }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5524
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: field.placeholder || `Upload ${field.field_type ===
|
|
5525
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: field.placeholder || `Upload ${field.field_type === chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Image ? "image" : "file"}` }),
|
|
5525
5526
|
acceptedFormats && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground/60 mt-1", children: [
|
|
5526
5527
|
acceptedFormats.map((f) => f.toUpperCase()).join(", "),
|
|
5527
5528
|
field.validation?.max_size_mb && ` \xB7 Max ${field.validation.max_size_mb}MB`
|
|
@@ -6456,7 +6457,7 @@ function CartLineItemRow({
|
|
|
6456
6457
|
children: [
|
|
6457
6458
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item-info": true, children: [
|
|
6458
6459
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-name": true, className: classNames?.itemName, children: item.product.name }),
|
|
6459
|
-
item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children:
|
|
6460
|
+
item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children: chunkBGCEKFLA_js.getVariantDisplayName(item.variant, item.product.name) }),
|
|
6460
6461
|
item.addOnOptions && item.addOnOptions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-cart-item-addons": true, children: [
|
|
6461
6462
|
"+ ",
|
|
6462
6463
|
item.addOnOptions.map((opt) => opt.name).join(", ")
|
|
@@ -6465,7 +6466,7 @@ function CartLineItemRow({
|
|
|
6465
6466
|
item.specialInstructions && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-instructions": true, className: "text-xs text-muted-foreground", children: item.specialInstructions }),
|
|
6466
6467
|
item.customerInputs && item.customerInputs.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-cart-customer-inputs": true, className: classNames?.customerInputs, children: item.customerInputs.map((input) => /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-input": true, children: [
|
|
6467
6468
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-input-label": true, children: input.field_name }),
|
|
6468
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-input-value": true, children: input.field_type ===
|
|
6469
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-input-value": true, children: input.field_type === chunkBGCEKFLA_js.INPUT_FIELD_TYPE.File || input.field_type === chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Image ? String(input.value).split("/").pop() || "Uploaded file" : String(input.value) })
|
|
6469
6470
|
] }, input.field_id)) }),
|
|
6470
6471
|
(item.lineType === "service" || item.product.type === "service") && item.scheduledStart && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-info": true, className: classNames?.serviceInfo, children: [
|
|
6471
6472
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
@@ -7017,7 +7018,7 @@ function FoodProductCard({
|
|
|
7017
7018
|
const tags = product.tags || [];
|
|
7018
7019
|
const isSignature = product.metadata?.is_signature === true;
|
|
7019
7020
|
const isNew = product.metadata?.is_new === true;
|
|
7020
|
-
const isComposite = product.type ===
|
|
7021
|
+
const isComposite = product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Composite;
|
|
7021
7022
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
7022
7023
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
7023
7024
|
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: [
|
|
@@ -7770,26 +7771,26 @@ var BUILT_IN_CARDS = {
|
|
|
7770
7771
|
["composite" /* Composite */]: CompositeProductCard,
|
|
7771
7772
|
["subscription" /* Subscription */]: SubscriptionCard
|
|
7772
7773
|
};
|
|
7773
|
-
var RENTAL_UNITS = /* @__PURE__ */ new Set([
|
|
7774
|
-
var LEASE_UNITS = /* @__PURE__ */ new Set([
|
|
7774
|
+
var RENTAL_UNITS = /* @__PURE__ */ new Set([chunkBGCEKFLA_js.DURATION_UNIT.Days, chunkBGCEKFLA_js.DURATION_UNIT.Hours]);
|
|
7775
|
+
var LEASE_UNITS = /* @__PURE__ */ new Set([chunkBGCEKFLA_js.DURATION_UNIT.Weeks, chunkBGCEKFLA_js.DURATION_UNIT.Months, chunkBGCEKFLA_js.DURATION_UNIT.Years]);
|
|
7775
7776
|
function resolveCardVariant(product) {
|
|
7776
|
-
if (product.type ===
|
|
7777
|
+
if (product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Bundle) {
|
|
7777
7778
|
return "bundle" /* Bundle */;
|
|
7778
7779
|
}
|
|
7779
|
-
if (product.type ===
|
|
7780
|
+
if (product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Composite) {
|
|
7780
7781
|
return "composite" /* Composite */;
|
|
7781
7782
|
}
|
|
7782
7783
|
if (product.quantity_pricing && product.quantity_pricing.length > 1) {
|
|
7783
7784
|
return "wholesale" /* Wholesale */;
|
|
7784
7785
|
}
|
|
7785
|
-
if (product.type ===
|
|
7786
|
+
if (product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Digital) {
|
|
7786
7787
|
return "digital" /* Digital */;
|
|
7787
7788
|
}
|
|
7788
|
-
if (product.type ===
|
|
7789
|
+
if (product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Service) {
|
|
7789
7790
|
if (product.duration_unit && RENTAL_UNITS.has(product.duration_unit)) {
|
|
7790
7791
|
return "rental" /* Rental */;
|
|
7791
7792
|
}
|
|
7792
|
-
if (product.duration_unit ===
|
|
7793
|
+
if (product.duration_unit === chunkBGCEKFLA_js.DURATION_UNIT.Nights) {
|
|
7793
7794
|
return "accommodation" /* Accommodation */;
|
|
7794
7795
|
}
|
|
7795
7796
|
if (product.duration_unit && LEASE_UNITS.has(product.duration_unit)) {
|
|
@@ -7800,10 +7801,10 @@ function resolveCardVariant(product) {
|
|
|
7800
7801
|
}
|
|
7801
7802
|
return "standard" /* Standard */;
|
|
7802
7803
|
}
|
|
7803
|
-
if (product.render_hint ===
|
|
7804
|
+
if (product.render_hint === chunkBGCEKFLA_js.RENDER_HINT.Food) {
|
|
7804
7805
|
return "food" /* Food */;
|
|
7805
7806
|
}
|
|
7806
|
-
if (product.render_hint ===
|
|
7807
|
+
if (product.render_hint === chunkBGCEKFLA_js.RENDER_HINT.Physical) {
|
|
7807
7808
|
return "retail" /* Retail */;
|
|
7808
7809
|
}
|
|
7809
7810
|
return "retail" /* Retail */;
|
|
@@ -10564,25 +10565,25 @@ function resolveTemplateKey(product) {
|
|
|
10564
10565
|
if (typeof metaTemplate === "string" && metaTemplate.trim()) {
|
|
10565
10566
|
return metaTemplate.trim();
|
|
10566
10567
|
}
|
|
10567
|
-
if (product.type ===
|
|
10568
|
+
if (product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Bundle) {
|
|
10568
10569
|
return "bundle" /* Bundle */;
|
|
10569
10570
|
}
|
|
10570
|
-
if (product.type ===
|
|
10571
|
+
if (product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Composite) {
|
|
10571
10572
|
return "composite" /* Composite */;
|
|
10572
10573
|
}
|
|
10573
10574
|
if (product.quantity_pricing && product.quantity_pricing.length > 1) {
|
|
10574
10575
|
return "wholesale" /* Wholesale */;
|
|
10575
10576
|
}
|
|
10576
|
-
if (product.type ===
|
|
10577
|
+
if (product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Service) {
|
|
10577
10578
|
return "service" /* Service */;
|
|
10578
10579
|
}
|
|
10579
|
-
if (product.type ===
|
|
10580
|
+
if (product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Digital) {
|
|
10580
10581
|
return "digital" /* Digital */;
|
|
10581
10582
|
}
|
|
10582
|
-
if (product.render_hint ===
|
|
10583
|
+
if (product.render_hint === chunkBGCEKFLA_js.RENDER_HINT.Food) {
|
|
10583
10584
|
return "food" /* Food */;
|
|
10584
10585
|
}
|
|
10585
|
-
if (product.render_hint ===
|
|
10586
|
+
if (product.render_hint === chunkBGCEKFLA_js.RENDER_HINT.Physical) {
|
|
10586
10587
|
return "physical" /* Physical */;
|
|
10587
10588
|
}
|
|
10588
10589
|
return "default" /* Default */;
|
|
@@ -12646,7 +12647,7 @@ function SparkleIcon({ className }) {
|
|
|
12646
12647
|
|
|
12647
12648
|
Object.defineProperty(exports, "getVariantDisplayName", {
|
|
12648
12649
|
enumerable: true,
|
|
12649
|
-
get: function () { return
|
|
12650
|
+
get: function () { return chunkBGCEKFLA_js.getVariantDisplayName; }
|
|
12650
12651
|
});
|
|
12651
12652
|
exports.AccommodationCard = AccommodationCard;
|
|
12652
12653
|
exports.Ad = Ad;
|
package/dist/react.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, PRODUCT_TYPE,
|
|
3
|
-
export { getVariantDisplayName } from './chunk-
|
|
2
|
+
import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT } from './chunk-IRJFDKFV.mjs';
|
|
3
|
+
export { getVariantDisplayName } from './chunk-IRJFDKFV.mjs';
|
|
4
|
+
import { createCimplifyClient } from './chunk-3WD6U5RD.mjs';
|
|
4
5
|
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-EZK2FXTM.mjs';
|
|
5
6
|
import { isSupportedCurrency, formatPrice, parsePrice, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-6TVQQYQ5.mjs';
|
|
6
7
|
import React10, { createContext, useRef, useState, useCallback, useEffect, useContext, useMemo, useId, useSyncExternalStore } from 'react';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { C as CimplifyClient } from './client-CkGlXZRd.mjs';
|
|
2
|
+
export { aN as Result } from './client-CkGlXZRd.mjs';
|
|
3
|
+
export { am as Category, h as CimplifyError, ao as Collection, U as Product, a7 as ProductWithDetails } from './payment-DA1i5hhk.mjs';
|
|
4
|
+
|
|
5
|
+
interface ServerClientOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Cimplify API base URL. Defaults to `CIMPLIFY_API_URL`,
|
|
8
|
+
* then `NEXT_PUBLIC_CIMPLIFY_API_URL`, then the local mock at
|
|
9
|
+
* `http://127.0.0.1:8787` for dev.
|
|
10
|
+
*/
|
|
11
|
+
apiUrl?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Server-only key. Defaults to `CIMPLIFY_SECRET_KEY`. Falls back to the
|
|
14
|
+
* publishable key (`NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY`) so the local mock
|
|
15
|
+
* works without forcing consumers to set a fake secret in dev.
|
|
16
|
+
*/
|
|
17
|
+
secretKey?: string;
|
|
18
|
+
/** Optional location id used by location-scoped queries. */
|
|
19
|
+
locationId?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns a `CimplifyClient` configured for server-side execution and
|
|
23
|
+
* memoized **per request** via React's `cache()` — calling this multiple
|
|
24
|
+
* times within a single render tree returns the same instance, so RSC
|
|
25
|
+
* fan-out doesn't create N clients.
|
|
26
|
+
*
|
|
27
|
+
* The returned client is the exact same surface the browser uses — every
|
|
28
|
+
* resource (catalogue, cart, checkout, …) and every method works identically.
|
|
29
|
+
* Caching is Next.js's responsibility: wrap your composed reads with
|
|
30
|
+
* `'use cache'` + `cacheTag` (using the tag builders from `@cimplify/sdk/server`),
|
|
31
|
+
* or set `next: { revalidate, tags }` on individual fetches.
|
|
32
|
+
*
|
|
33
|
+
* Errors continue to flow through `Result<T, CimplifyError>`. Use the SDK's
|
|
34
|
+
* `unwrap()` helper, or `if (!result.ok) notFound()` — whichever is
|
|
35
|
+
* idiomatic for the route.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* import { getServerClient, tags } from "@cimplify/sdk/server";
|
|
39
|
+
* import { cacheTag, cacheLife } from "next/cache";
|
|
40
|
+
*
|
|
41
|
+
* async function getProduct(slug: string) {
|
|
42
|
+
* "use cache";
|
|
43
|
+
* cacheTag(tags.product(slug));
|
|
44
|
+
* cacheLife("hours");
|
|
45
|
+
* const r = await getServerClient().catalogue.getProductBySlug(slug);
|
|
46
|
+
* if (!r.ok) throw new Error(r.error.message);
|
|
47
|
+
* return r.value;
|
|
48
|
+
* }
|
|
49
|
+
*/
|
|
50
|
+
declare const getServerClient: (opts?: ServerClientOptions) => CimplifyClient;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Cimplify cache-tag scheme.
|
|
54
|
+
*
|
|
55
|
+
* Use these constants/builders to tag fetches and invalidate them. The
|
|
56
|
+
* shape is namespaced (`cimplify:<resource>` and `cimplify:<resource>:<id>`)
|
|
57
|
+
* so consumer cache tags can't accidentally collide. Tag strings should
|
|
58
|
+
* always be constructed via these builders so the scheme stays in one place.
|
|
59
|
+
*/
|
|
60
|
+
declare const tags: {
|
|
61
|
+
readonly products: () => string;
|
|
62
|
+
readonly product: (id: string) => string;
|
|
63
|
+
readonly categories: () => string;
|
|
64
|
+
readonly category: (id: string) => string;
|
|
65
|
+
readonly categoryProducts: (id: string) => string;
|
|
66
|
+
readonly collections: () => string;
|
|
67
|
+
readonly collection: (id: string) => string;
|
|
68
|
+
readonly collectionProducts: (id: string) => string;
|
|
69
|
+
readonly business: () => string;
|
|
70
|
+
readonly locations: () => string;
|
|
71
|
+
readonly orders: (customerId: string) => string;
|
|
72
|
+
readonly order: (id: string) => string;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Invalidate every cache entry tagged with the products list. Call after a
|
|
77
|
+
* Server Action that creates / deletes / reorders products.
|
|
78
|
+
*/
|
|
79
|
+
declare function revalidateProducts(): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Invalidate the cached detail of a single product (and the products list,
|
|
82
|
+
* since list-shaped caches typically embed each product's denormalized
|
|
83
|
+
* fields). Call after a Server Action that edits a product.
|
|
84
|
+
*/
|
|
85
|
+
declare function revalidateProduct(id: string): Promise<void>;
|
|
86
|
+
declare function revalidateCategories(): Promise<void>;
|
|
87
|
+
declare function revalidateCategory(id: string): Promise<void>;
|
|
88
|
+
declare function revalidateCollections(): Promise<void>;
|
|
89
|
+
declare function revalidateCollection(id: string): Promise<void>;
|
|
90
|
+
declare function revalidateBusiness(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Escape hatch: invalidate by raw tag string. Prefer the typed helpers
|
|
93
|
+
* above where possible — they keep the tag scheme in one place.
|
|
94
|
+
*/
|
|
95
|
+
declare function revalidateByTag(tag: string): Promise<void>;
|
|
96
|
+
|
|
97
|
+
export { CimplifyClient, type ServerClientOptions, getServerClient, revalidateBusiness, revalidateByTag, revalidateCategories, revalidateCategory, revalidateCollection, revalidateCollections, revalidateProduct, revalidateProducts, tags };
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { C as CimplifyClient } from './client-lvLvB1_K.js';
|
|
2
|
+
export { aN as Result } from './client-lvLvB1_K.js';
|
|
3
|
+
export { am as Category, h as CimplifyError, ao as Collection, U as Product, a7 as ProductWithDetails } from './payment-DA1i5hhk.js';
|
|
4
|
+
|
|
5
|
+
interface ServerClientOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Cimplify API base URL. Defaults to `CIMPLIFY_API_URL`,
|
|
8
|
+
* then `NEXT_PUBLIC_CIMPLIFY_API_URL`, then the local mock at
|
|
9
|
+
* `http://127.0.0.1:8787` for dev.
|
|
10
|
+
*/
|
|
11
|
+
apiUrl?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Server-only key. Defaults to `CIMPLIFY_SECRET_KEY`. Falls back to the
|
|
14
|
+
* publishable key (`NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY`) so the local mock
|
|
15
|
+
* works without forcing consumers to set a fake secret in dev.
|
|
16
|
+
*/
|
|
17
|
+
secretKey?: string;
|
|
18
|
+
/** Optional location id used by location-scoped queries. */
|
|
19
|
+
locationId?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns a `CimplifyClient` configured for server-side execution and
|
|
23
|
+
* memoized **per request** via React's `cache()` — calling this multiple
|
|
24
|
+
* times within a single render tree returns the same instance, so RSC
|
|
25
|
+
* fan-out doesn't create N clients.
|
|
26
|
+
*
|
|
27
|
+
* The returned client is the exact same surface the browser uses — every
|
|
28
|
+
* resource (catalogue, cart, checkout, …) and every method works identically.
|
|
29
|
+
* Caching is Next.js's responsibility: wrap your composed reads with
|
|
30
|
+
* `'use cache'` + `cacheTag` (using the tag builders from `@cimplify/sdk/server`),
|
|
31
|
+
* or set `next: { revalidate, tags }` on individual fetches.
|
|
32
|
+
*
|
|
33
|
+
* Errors continue to flow through `Result<T, CimplifyError>`. Use the SDK's
|
|
34
|
+
* `unwrap()` helper, or `if (!result.ok) notFound()` — whichever is
|
|
35
|
+
* idiomatic for the route.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* import { getServerClient, tags } from "@cimplify/sdk/server";
|
|
39
|
+
* import { cacheTag, cacheLife } from "next/cache";
|
|
40
|
+
*
|
|
41
|
+
* async function getProduct(slug: string) {
|
|
42
|
+
* "use cache";
|
|
43
|
+
* cacheTag(tags.product(slug));
|
|
44
|
+
* cacheLife("hours");
|
|
45
|
+
* const r = await getServerClient().catalogue.getProductBySlug(slug);
|
|
46
|
+
* if (!r.ok) throw new Error(r.error.message);
|
|
47
|
+
* return r.value;
|
|
48
|
+
* }
|
|
49
|
+
*/
|
|
50
|
+
declare const getServerClient: (opts?: ServerClientOptions) => CimplifyClient;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Cimplify cache-tag scheme.
|
|
54
|
+
*
|
|
55
|
+
* Use these constants/builders to tag fetches and invalidate them. The
|
|
56
|
+
* shape is namespaced (`cimplify:<resource>` and `cimplify:<resource>:<id>`)
|
|
57
|
+
* so consumer cache tags can't accidentally collide. Tag strings should
|
|
58
|
+
* always be constructed via these builders so the scheme stays in one place.
|
|
59
|
+
*/
|
|
60
|
+
declare const tags: {
|
|
61
|
+
readonly products: () => string;
|
|
62
|
+
readonly product: (id: string) => string;
|
|
63
|
+
readonly categories: () => string;
|
|
64
|
+
readonly category: (id: string) => string;
|
|
65
|
+
readonly categoryProducts: (id: string) => string;
|
|
66
|
+
readonly collections: () => string;
|
|
67
|
+
readonly collection: (id: string) => string;
|
|
68
|
+
readonly collectionProducts: (id: string) => string;
|
|
69
|
+
readonly business: () => string;
|
|
70
|
+
readonly locations: () => string;
|
|
71
|
+
readonly orders: (customerId: string) => string;
|
|
72
|
+
readonly order: (id: string) => string;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Invalidate every cache entry tagged with the products list. Call after a
|
|
77
|
+
* Server Action that creates / deletes / reorders products.
|
|
78
|
+
*/
|
|
79
|
+
declare function revalidateProducts(): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Invalidate the cached detail of a single product (and the products list,
|
|
82
|
+
* since list-shaped caches typically embed each product's denormalized
|
|
83
|
+
* fields). Call after a Server Action that edits a product.
|
|
84
|
+
*/
|
|
85
|
+
declare function revalidateProduct(id: string): Promise<void>;
|
|
86
|
+
declare function revalidateCategories(): Promise<void>;
|
|
87
|
+
declare function revalidateCategory(id: string): Promise<void>;
|
|
88
|
+
declare function revalidateCollections(): Promise<void>;
|
|
89
|
+
declare function revalidateCollection(id: string): Promise<void>;
|
|
90
|
+
declare function revalidateBusiness(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Escape hatch: invalidate by raw tag string. Prefer the typed helpers
|
|
93
|
+
* above where possible — they keep the tag scheme in one place.
|
|
94
|
+
*/
|
|
95
|
+
declare function revalidateByTag(tag: string): Promise<void>;
|
|
96
|
+
|
|
97
|
+
export { CimplifyClient, type ServerClientOptions, getServerClient, revalidateBusiness, revalidateByTag, revalidateCategories, revalidateCategory, revalidateCollection, revalidateCollections, revalidateProduct, revalidateProducts, tags };
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkOMAP327U_js = require('./chunk-OMAP327U.js');
|
|
4
|
+
require('./chunk-BAWKQRIB.js');
|
|
5
|
+
var chunkV2O5AO7I_js = require('./chunk-V2O5AO7I.js');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
|
|
8
|
+
var DEFAULT_DEV_URL = "http://127.0.0.1:8787";
|
|
9
|
+
function readEnv(...keys) {
|
|
10
|
+
const env = globalThis.process?.env;
|
|
11
|
+
if (!env) return void 0;
|
|
12
|
+
for (const k of keys) {
|
|
13
|
+
const v = env[k]?.trim();
|
|
14
|
+
if (v) return v;
|
|
15
|
+
}
|
|
16
|
+
return void 0;
|
|
17
|
+
}
|
|
18
|
+
var getServerClient = react.cache((opts = {}) => {
|
|
19
|
+
const baseUrl = opts.apiUrl ?? readEnv("CIMPLIFY_API_URL", "NEXT_PUBLIC_CIMPLIFY_API_URL") ?? DEFAULT_DEV_URL;
|
|
20
|
+
const publicKey = opts.secretKey ?? readEnv("CIMPLIFY_SECRET_KEY", "NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY") ?? "mock-dev";
|
|
21
|
+
const client = chunkOMAP327U_js.createCimplifyClient({
|
|
22
|
+
baseUrl,
|
|
23
|
+
publicKey,
|
|
24
|
+
suppressPublicKeyWarning: true
|
|
25
|
+
});
|
|
26
|
+
if (opts.locationId) {
|
|
27
|
+
client.setLocationId(opts.locationId);
|
|
28
|
+
}
|
|
29
|
+
return client;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// src/server/tags.ts
|
|
33
|
+
var tags = {
|
|
34
|
+
products: () => "cimplify:products",
|
|
35
|
+
product: (id) => `cimplify:product:${id}`,
|
|
36
|
+
categories: () => "cimplify:categories",
|
|
37
|
+
category: (id) => `cimplify:category:${id}`,
|
|
38
|
+
categoryProducts: (id) => `cimplify:category:${id}:products`,
|
|
39
|
+
collections: () => "cimplify:collections",
|
|
40
|
+
collection: (id) => `cimplify:collection:${id}`,
|
|
41
|
+
collectionProducts: (id) => `cimplify:collection:${id}:products`,
|
|
42
|
+
business: () => "cimplify:business",
|
|
43
|
+
locations: () => "cimplify:locations",
|
|
44
|
+
orders: (customerId) => `cimplify:orders:${customerId}`,
|
|
45
|
+
order: (id) => `cimplify:order:${id}`
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/server/revalidate.ts
|
|
49
|
+
var _revalidateTag = null;
|
|
50
|
+
async function getRevalidateTag() {
|
|
51
|
+
if (_revalidateTag) return _revalidateTag;
|
|
52
|
+
const specifier = "next/cache";
|
|
53
|
+
const mod = await import(
|
|
54
|
+
/* webpackIgnore: true */
|
|
55
|
+
/* @vite-ignore */
|
|
56
|
+
specifier
|
|
57
|
+
);
|
|
58
|
+
_revalidateTag = mod.revalidateTag;
|
|
59
|
+
return _revalidateTag;
|
|
60
|
+
}
|
|
61
|
+
async function revalidate(...tagList) {
|
|
62
|
+
const fn = await getRevalidateTag();
|
|
63
|
+
for (const t of tagList) fn(t);
|
|
64
|
+
}
|
|
65
|
+
async function revalidateProducts() {
|
|
66
|
+
return revalidate(tags.products());
|
|
67
|
+
}
|
|
68
|
+
async function revalidateProduct(id) {
|
|
69
|
+
return revalidate(tags.product(id), tags.products());
|
|
70
|
+
}
|
|
71
|
+
async function revalidateCategories() {
|
|
72
|
+
return revalidate(tags.categories());
|
|
73
|
+
}
|
|
74
|
+
async function revalidateCategory(id) {
|
|
75
|
+
return revalidate(tags.category(id), tags.categoryProducts(id), tags.categories());
|
|
76
|
+
}
|
|
77
|
+
async function revalidateCollections() {
|
|
78
|
+
return revalidate(tags.collections());
|
|
79
|
+
}
|
|
80
|
+
async function revalidateCollection(id) {
|
|
81
|
+
return revalidate(
|
|
82
|
+
tags.collection(id),
|
|
83
|
+
tags.collectionProducts(id),
|
|
84
|
+
tags.collections()
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
async function revalidateBusiness() {
|
|
88
|
+
return revalidate(tags.business());
|
|
89
|
+
}
|
|
90
|
+
async function revalidateByTag(tag) {
|
|
91
|
+
return revalidate(tag);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
Object.defineProperty(exports, "CimplifyError", {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function () { return chunkV2O5AO7I_js.CimplifyError; }
|
|
97
|
+
});
|
|
98
|
+
exports.getServerClient = getServerClient;
|
|
99
|
+
exports.revalidateBusiness = revalidateBusiness;
|
|
100
|
+
exports.revalidateByTag = revalidateByTag;
|
|
101
|
+
exports.revalidateCategories = revalidateCategories;
|
|
102
|
+
exports.revalidateCategory = revalidateCategory;
|
|
103
|
+
exports.revalidateCollection = revalidateCollection;
|
|
104
|
+
exports.revalidateCollections = revalidateCollections;
|
|
105
|
+
exports.revalidateProduct = revalidateProduct;
|
|
106
|
+
exports.revalidateProducts = revalidateProducts;
|
|
107
|
+
exports.tags = tags;
|