@cimplify/sdk 0.45.5 → 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.
@@ -82,8 +82,48 @@ var INPUT_FIELD_TYPE = {
82
82
  Location: "location"
83
83
  };
84
84
 
85
+ // src/assets/url.ts
86
+ var DEFAULT_CDN_BASE_URL = "https://storefrontassetscdn.cimplify.io";
87
+ var CIMPLIFY_CDN_HOSTS = [
88
+ "storefrontassetscdn.cimplify.io",
89
+ "cdn.cimplify.io",
90
+ "static-tmp.cimplify.io"
91
+ ];
92
+ var ABSOLUTE_URL_RE = /^https?:\/\//i;
93
+ var MOCK_PASSTHROUGH_RE = /^\/(img|elements|_mock)\//;
94
+ function assetUrl(path, opts = {}) {
95
+ if (!path) return path;
96
+ if (ABSOLUTE_URL_RE.test(path)) return appendTransform(path, opts);
97
+ if (MOCK_PASSTHROUGH_RE.test(path)) return appendTransform(path, opts);
98
+ const base = (opts.base ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
99
+ const normalized = path.replace(/^\/+/, "");
100
+ return appendTransform(`${base}/${normalized}`, opts);
101
+ }
102
+ function isCimplifyAsset(src, base) {
103
+ if (!src) return false;
104
+ if (!ABSOLUTE_URL_RE.test(src)) return true;
105
+ if (MOCK_PASSTHROUGH_RE.test(src)) return true;
106
+ const resolvedBase = (base ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
107
+ if (resolvedBase && src.startsWith(resolvedBase)) return true;
108
+ return CIMPLIFY_CDN_HOSTS.some((host) => src.startsWith(`https://${host}/`));
109
+ }
110
+ function appendTransform(url, t) {
111
+ const params = new URLSearchParams();
112
+ if (t.w != null) params.set("w", String(t.w));
113
+ if (t.h != null) params.set("h", String(t.h));
114
+ if (t.quality != null) params.set("quality", String(t.quality));
115
+ if (t.format != null) params.set("format", t.format);
116
+ const query = params.toString();
117
+ if (!query) return url;
118
+ return `${url}${url.includes("?") ? "&" : "?"}${query}`;
119
+ }
120
+
121
+ exports.CIMPLIFY_CDN_HOSTS = CIMPLIFY_CDN_HOSTS;
122
+ exports.DEFAULT_CDN_BASE_URL = DEFAULT_CDN_BASE_URL;
85
123
  exports.DURATION_UNIT = DURATION_UNIT;
86
124
  exports.INPUT_FIELD_TYPE = INPUT_FIELD_TYPE;
87
125
  exports.PRODUCT_TYPE = PRODUCT_TYPE;
88
126
  exports.RENDER_HINT = RENDER_HINT;
127
+ exports.assetUrl = assetUrl;
89
128
  exports.getVariantDisplayName = getVariantDisplayName;
129
+ exports.isCimplifyAsset = isCimplifyAsset;
@@ -80,4 +80,40 @@ var INPUT_FIELD_TYPE = {
80
80
  Location: "location"
81
81
  };
82
82
 
83
- export { DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, getVariantDisplayName };
83
+ // src/assets/url.ts
84
+ var DEFAULT_CDN_BASE_URL = "https://storefrontassetscdn.cimplify.io";
85
+ var CIMPLIFY_CDN_HOSTS = [
86
+ "storefrontassetscdn.cimplify.io",
87
+ "cdn.cimplify.io",
88
+ "static-tmp.cimplify.io"
89
+ ];
90
+ var ABSOLUTE_URL_RE = /^https?:\/\//i;
91
+ var MOCK_PASSTHROUGH_RE = /^\/(img|elements|_mock)\//;
92
+ function assetUrl(path, opts = {}) {
93
+ if (!path) return path;
94
+ if (ABSOLUTE_URL_RE.test(path)) return appendTransform(path, opts);
95
+ if (MOCK_PASSTHROUGH_RE.test(path)) return appendTransform(path, opts);
96
+ const base = (opts.base ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
97
+ const normalized = path.replace(/^\/+/, "");
98
+ return appendTransform(`${base}/${normalized}`, opts);
99
+ }
100
+ function isCimplifyAsset(src, base) {
101
+ if (!src) return false;
102
+ if (!ABSOLUTE_URL_RE.test(src)) return true;
103
+ if (MOCK_PASSTHROUGH_RE.test(src)) return true;
104
+ const resolvedBase = (base ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
105
+ if (resolvedBase && src.startsWith(resolvedBase)) return true;
106
+ return CIMPLIFY_CDN_HOSTS.some((host) => src.startsWith(`https://${host}/`));
107
+ }
108
+ function appendTransform(url, t) {
109
+ const params = new URLSearchParams();
110
+ if (t.w != null) params.set("w", String(t.w));
111
+ if (t.h != null) params.set("h", String(t.h));
112
+ if (t.quality != null) params.set("quality", String(t.quality));
113
+ if (t.format != null) params.set("format", t.format);
114
+ const query = params.toString();
115
+ if (!query) return url;
116
+ return `${url}${url.includes("?") ? "&" : "?"}${query}`;
117
+ }
118
+
119
+ export { CIMPLIFY_CDN_HOSTS, DEFAULT_CDN_BASE_URL, DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, assetUrl, getVariantDisplayName, isCimplifyAsset };
package/dist/index.d.mts CHANGED
@@ -66,4 +66,18 @@ interface ApiResponse<T> {
66
66
  metadata?: ResponseMetadata;
67
67
  }
68
68
 
69
- export { ApiError, type ApiResponse, type CustomerGroup, type CustomerPricingInfo, type FrontendContext, type MutationRequest, type PriceListItem, type QuantityBreak, type QueryRequest, type ResolvedQuantityBreak, type ResponseMetadata };
69
+ declare const DEFAULT_CDN_BASE_URL = "https://storefrontassetscdn.cimplify.io";
70
+ declare const CIMPLIFY_CDN_HOSTS: readonly ["storefrontassetscdn.cimplify.io", "cdn.cimplify.io", "static-tmp.cimplify.io"];
71
+ interface AssetTransform {
72
+ w?: number;
73
+ h?: number;
74
+ quality?: number;
75
+ format?: "auto" | "webp" | "avif" | "jpeg";
76
+ }
77
+ interface AssetUrlOptions extends AssetTransform {
78
+ base?: string;
79
+ }
80
+ declare function assetUrl(path: string, opts?: AssetUrlOptions): string;
81
+ declare function isCimplifyAsset(src: string, base?: string): boolean;
82
+
83
+ export { ApiError, type ApiResponse, type AssetTransform, type AssetUrlOptions, CIMPLIFY_CDN_HOSTS, type CustomerGroup, type CustomerPricingInfo, DEFAULT_CDN_BASE_URL, type FrontendContext, type MutationRequest, type PriceListItem, type QuantityBreak, type QueryRequest, type ResolvedQuantityBreak, type ResponseMetadata, assetUrl, isCimplifyAsset };
package/dist/index.d.ts CHANGED
@@ -66,4 +66,18 @@ interface ApiResponse<T> {
66
66
  metadata?: ResponseMetadata;
67
67
  }
68
68
 
69
- export { ApiError, type ApiResponse, type CustomerGroup, type CustomerPricingInfo, type FrontendContext, type MutationRequest, type PriceListItem, type QuantityBreak, type QueryRequest, type ResolvedQuantityBreak, type ResponseMetadata };
69
+ declare const DEFAULT_CDN_BASE_URL = "https://storefrontassetscdn.cimplify.io";
70
+ declare const CIMPLIFY_CDN_HOSTS: readonly ["storefrontassetscdn.cimplify.io", "cdn.cimplify.io", "static-tmp.cimplify.io"];
71
+ interface AssetTransform {
72
+ w?: number;
73
+ h?: number;
74
+ quality?: number;
75
+ format?: "auto" | "webp" | "avif" | "jpeg";
76
+ }
77
+ interface AssetUrlOptions extends AssetTransform {
78
+ base?: string;
79
+ }
80
+ declare function assetUrl(path: string, opts?: AssetUrlOptions): string;
81
+ declare function isCimplifyAsset(src: string, base?: string): boolean;
82
+
83
+ export { ApiError, type ApiResponse, type AssetTransform, type AssetUrlOptions, CIMPLIFY_CDN_HOSTS, type CustomerGroup, type CustomerPricingInfo, DEFAULT_CDN_BASE_URL, type FrontendContext, type MutationRequest, type PriceListItem, type QuantityBreak, type QueryRequest, type ResolvedQuantityBreak, type ResponseMetadata, assetUrl, isCimplifyAsset };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkBGCEKFLA_js = require('./chunk-BGCEKFLA.js');
3
+ var chunkMN4PNKJA_js = require('./chunk-MN4PNKJA.js');
4
4
  var chunkL5GKVQVJ_js = require('./chunk-L5GKVQVJ.js');
5
5
  var chunkLLZZMHSU_js = require('./chunk-LLZZMHSU.js');
6
6
  var chunkGVLWRI5I_js = require('./chunk-GVLWRI5I.js');
@@ -9,25 +9,41 @@ var chunkQBQCMQ4F_js = require('./chunk-QBQCMQ4F.js');
9
9
 
10
10
 
11
11
 
12
+ Object.defineProperty(exports, "CIMPLIFY_CDN_HOSTS", {
13
+ enumerable: true,
14
+ get: function () { return chunkMN4PNKJA_js.CIMPLIFY_CDN_HOSTS; }
15
+ });
16
+ Object.defineProperty(exports, "DEFAULT_CDN_BASE_URL", {
17
+ enumerable: true,
18
+ get: function () { return chunkMN4PNKJA_js.DEFAULT_CDN_BASE_URL; }
19
+ });
12
20
  Object.defineProperty(exports, "DURATION_UNIT", {
13
21
  enumerable: true,
14
- get: function () { return chunkBGCEKFLA_js.DURATION_UNIT; }
22
+ get: function () { return chunkMN4PNKJA_js.DURATION_UNIT; }
15
23
  });
16
24
  Object.defineProperty(exports, "INPUT_FIELD_TYPE", {
17
25
  enumerable: true,
18
- get: function () { return chunkBGCEKFLA_js.INPUT_FIELD_TYPE; }
26
+ get: function () { return chunkMN4PNKJA_js.INPUT_FIELD_TYPE; }
19
27
  });
20
28
  Object.defineProperty(exports, "PRODUCT_TYPE", {
21
29
  enumerable: true,
22
- get: function () { return chunkBGCEKFLA_js.PRODUCT_TYPE; }
30
+ get: function () { return chunkMN4PNKJA_js.PRODUCT_TYPE; }
23
31
  });
24
32
  Object.defineProperty(exports, "RENDER_HINT", {
25
33
  enumerable: true,
26
- get: function () { return chunkBGCEKFLA_js.RENDER_HINT; }
34
+ get: function () { return chunkMN4PNKJA_js.RENDER_HINT; }
35
+ });
36
+ Object.defineProperty(exports, "assetUrl", {
37
+ enumerable: true,
38
+ get: function () { return chunkMN4PNKJA_js.assetUrl; }
27
39
  });
28
40
  Object.defineProperty(exports, "getVariantDisplayName", {
29
41
  enumerable: true,
30
- get: function () { return chunkBGCEKFLA_js.getVariantDisplayName; }
42
+ get: function () { return chunkMN4PNKJA_js.getVariantDisplayName; }
43
+ });
44
+ Object.defineProperty(exports, "isCimplifyAsset", {
45
+ enumerable: true,
46
+ get: function () { return chunkMN4PNKJA_js.isCimplifyAsset; }
31
47
  });
32
48
  Object.defineProperty(exports, "isValidPhoneForContext", {
33
49
  enumerable: true,
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, getVariantDisplayName } from './chunk-IRJFDKFV.mjs';
1
+ export { CIMPLIFY_CDN_HOSTS, DEFAULT_CDN_BASE_URL, DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, assetUrl, getVariantDisplayName, isCimplifyAsset } from './chunk-NRDRVZ62.mjs';
2
2
  export { isValidPhoneForContext, normalizePhoneToE164, resolvePhoneCountryCode } from './chunk-YOIVZ6OA.mjs';
3
3
  export { ActivityService, CimplifyClient, DeliveryService, PlacesService, SubscriptionService, SupportService, UploadService, createCimplifyClient } from './chunk-RR3ZJQW5.mjs';
4
4
  export { AUTHORIZATION_TYPE, AUTH_MUTATION, AuthService, BusinessService, CHECKOUT_MODE, CHECKOUT_MUTATION, CHECKOUT_STEP, CONTACT_TYPE, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, DEFAULT_COUNTRY, DEFAULT_CURRENCY, DEVICE_TYPE, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LINK_MUTATION, LINK_QUERY, LinkService, LiteService, MESSAGE_TYPES, MOBILE_MONEY_PROVIDER, ORDER_MUTATION, ORDER_TYPE, OrderQueries, PAYMENT_METHOD, PAYMENT_MUTATION, PAYMENT_STATE, PICKUP_TIME_TYPE, SchedulingService, combine, combineObject, createElements, err, flatMap, fromPromise, generateIdempotencyKey, getOrElse, isErr, isOk, mapError, mapResult, ok, toNullable, tryCatch, unwrap } from './chunk-AIXUFSA6.mjs';
package/dist/react.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkBGCEKFLA_js = require('./chunk-BGCEKFLA.js');
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: chunkBGCEKFLA_js.getVariantDisplayName(variant, productName)
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Text:
5227
- case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Url:
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 === chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Url ? "url" : "text",
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Textarea:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Number:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Select:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Radio:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Checkbox:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Color:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Date:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.File:
5341
- case chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Image:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Email:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.DateTime: {
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Time:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.MultiSelect:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.DateRange:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Address:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Location:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Phone:
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 chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Signature:
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 === chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Image ? "image/*" : void 0;
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 === 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" }),
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 === chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Image ? "image" : "file"}` }),
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 ? chunkBGCEKFLA_js.getVariantDisplayName(item.variant, item.product.name) : null;
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 === 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) })
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 === chunkBGCEKFLA_js.PRODUCT_TYPE.Composite;
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([chunkBGCEKFLA_js.DURATION_UNIT.Days, chunkBGCEKFLA_js.DURATION_UNIT.Hours]);
8156
- var LEASE_UNITS = /* @__PURE__ */ new Set([chunkBGCEKFLA_js.DURATION_UNIT.Weeks, chunkBGCEKFLA_js.DURATION_UNIT.Months, chunkBGCEKFLA_js.DURATION_UNIT.Years]);
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 === chunkBGCEKFLA_js.PRODUCT_TYPE.Bundle) {
8158
+ if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Bundle) {
8159
8159
  return "bundle" /* Bundle */;
8160
8160
  }
8161
- if (product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Composite) {
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 === chunkBGCEKFLA_js.PRODUCT_TYPE.Digital) {
8167
+ if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Digital) {
8168
8168
  return "digital" /* Digital */;
8169
8169
  }
8170
- if (product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Service) {
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 === chunkBGCEKFLA_js.DURATION_UNIT.Nights) {
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 === chunkBGCEKFLA_js.RENDER_HINT.Food) {
8185
+ if (product.render_hint === chunkMN4PNKJA_js.RENDER_HINT.Food) {
8186
8186
  return "food" /* Food */;
8187
8187
  }
8188
- if (product.render_hint === chunkBGCEKFLA_js.RENDER_HINT.Physical) {
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 === chunkBGCEKFLA_js.PRODUCT_TYPE.Bundle) {
11128
+ if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Bundle) {
11129
11129
  return "bundle" /* Bundle */;
11130
11130
  }
11131
- if (product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Composite) {
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 === chunkBGCEKFLA_js.PRODUCT_TYPE.Service) {
11137
+ if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Service) {
11138
11138
  return "service" /* Service */;
11139
11139
  }
11140
- if (product.type === chunkBGCEKFLA_js.PRODUCT_TYPE.Digital) {
11140
+ if (product.type === chunkMN4PNKJA_js.PRODUCT_TYPE.Digital) {
11141
11141
  return "digital" /* Digital */;
11142
11142
  }
11143
- if (product.render_hint === chunkBGCEKFLA_js.RENDER_HINT.Food) {
11143
+ if (product.render_hint === chunkMN4PNKJA_js.RENDER_HINT.Food) {
11144
11144
  return "food" /* Food */;
11145
11145
  }
11146
- if (product.render_hint === chunkBGCEKFLA_js.RENDER_HINT.Physical) {
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 chunkBGCEKFLA_js.getVariantDisplayName; }
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-IRJFDKFV.mjs';
3
- export { getVariantDisplayName } from './chunk-IRJFDKFV.mjs';
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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/sdk",
3
- "version": "0.45.5",
3
+ "version": "0.46.0",
4
4
  "description": "Cimplify Commerce SDK for storefronts",
5
5
  "keywords": [
6
6
  "cimplify",