@cimplify/sdk 0.65.0 → 0.67.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.
Files changed (53) hide show
  1. package/dist/advanced.d.mts +1 -1
  2. package/dist/advanced.d.ts +1 -1
  3. package/dist/advanced.js +20 -20
  4. package/dist/advanced.mjs +1 -1
  5. package/dist/{chunk-AVQL3TSJ.js → chunk-3QSW33RG.js} +389 -78
  6. package/dist/chunk-E6T5VJMG.mjs +156 -0
  7. package/dist/{chunk-WDTFIIY6.mjs → chunk-FNK6UZOE.mjs} +2 -2
  8. package/dist/{chunk-3G4QCENX.mjs → chunk-FVGVJ4TC.mjs} +12 -50
  9. package/dist/chunk-IQLJJW2H.js +168 -0
  10. package/dist/{chunk-PKYZBKZD.mjs → chunk-JAPCAZN4.mjs} +10 -29
  11. package/dist/{chunk-R6363CC7.mjs → chunk-QQMDEGAK.mjs} +382 -79
  12. package/dist/{chunk-VKID3QUE.js → chunk-SH6HJW4A.js} +4 -4
  13. package/dist/{chunk-VAMZPBA4.js → chunk-SSLFZPAI.js} +44 -63
  14. package/dist/{chunk-HCZTBWU4.js → chunk-SXGFJEME.js} +12 -50
  15. package/dist/{client-BS5lNWWH.d.mts → client-ByI_3jfL.d.mts} +33 -20
  16. package/dist/{client-p1Iofyc9.d.ts → client-CQlEWH5j.d.ts} +1 -1
  17. package/dist/{client-QTrsv6Gu.d.ts → client-DVFQoDtI.d.ts} +33 -20
  18. package/dist/{client-XoswXzib.d.mts → client-Dd82KQ_G.d.mts} +1 -1
  19. package/dist/index.d.mts +2 -2
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +80 -81
  22. package/dist/index.mjs +4 -5
  23. package/dist/mock/cli.mjs +12 -50
  24. package/dist/mock/library.js +12 -50
  25. package/dist/mock/library.mjs +12 -50
  26. package/dist/mock/msw.js +12 -50
  27. package/dist/mock/msw.mjs +12 -50
  28. package/dist/react.d.mts +4 -7
  29. package/dist/react.d.ts +4 -7
  30. package/dist/react.js +63 -71
  31. package/dist/react.mjs +5 -13
  32. package/dist/server.d.mts +18 -3
  33. package/dist/server.d.ts +18 -3
  34. package/dist/server.js +175 -29
  35. package/dist/server.mjs +167 -25
  36. package/dist/{sign-in-dr7m09nm.d.ts → sign-in-RFuWZOgF.d.mts} +6 -1
  37. package/dist/{sign-in-dr7m09nm.d.mts → sign-in-RFuWZOgF.d.ts} +6 -1
  38. package/dist/styles.css +1 -1
  39. package/dist/testing/msw.js +2 -2
  40. package/dist/testing/msw.mjs +1 -1
  41. package/dist/testing/suite.d.mts +2 -2
  42. package/dist/testing/suite.d.ts +2 -2
  43. package/dist/testing/suite.js +23 -23
  44. package/dist/testing/suite.mjs +4 -4
  45. package/dist/testing.d.mts +2 -2
  46. package/dist/testing.d.ts +2 -2
  47. package/dist/testing.js +79 -79
  48. package/dist/testing.mjs +5 -5
  49. package/package.json +1 -1
  50. package/dist/chunk-2AU263DK.mjs +0 -323
  51. package/dist/chunk-6DMHVQ42.js +0 -338
  52. package/dist/chunk-DKT62WQW.js +0 -53
  53. package/dist/chunk-XSOYJLMZ.mjs +0 -45
@@ -0,0 +1,156 @@
1
+ // src/gallery.ts
2
+ function dedupe(urls) {
3
+ const seen = /* @__PURE__ */ new Set();
4
+ const out = [];
5
+ for (const url of urls) {
6
+ if (url && !seen.has(url)) {
7
+ seen.add(url);
8
+ out.push(url);
9
+ }
10
+ }
11
+ return out;
12
+ }
13
+ function resolveGallery(product, selectedVariantId) {
14
+ const variant = selectedVariantId ? product.variants?.find((v) => v.id === selectedVariantId) : void 0;
15
+ if (variant?.images?.length) return dedupe(variant.images);
16
+ if (product.images?.length) return dedupe(product.images);
17
+ const firstWithImages = product.variants?.find((v) => v.images?.length);
18
+ if (firstWithImages?.images?.length) return dedupe(firstWithImages.images);
19
+ return product.image_url ? [product.image_url] : [];
20
+ }
21
+ function allGalleryImages(product) {
22
+ const seen = /* @__PURE__ */ new Set();
23
+ const out = [];
24
+ const push = (url, variantId) => {
25
+ if (url && !seen.has(url)) {
26
+ seen.add(url);
27
+ out.push({ url, variantId });
28
+ }
29
+ };
30
+ push(product.image_url, null);
31
+ for (const url of product.images ?? []) push(url, null);
32
+ for (const variant of product.variants ?? []) {
33
+ for (const url of variant.images ?? []) push(url, variant.id);
34
+ }
35
+ return out;
36
+ }
37
+
38
+ // src/utils/variant.ts
39
+ function stripProductPrefix(variantName, productName) {
40
+ if (!variantName || !productName) return variantName || productName;
41
+ const lower = variantName.toLowerCase().trim();
42
+ if (lower === "default" || lower === "standard") return productName;
43
+ if (lower.endsWith("-default") || lower.endsWith("-standard")) return productName;
44
+ if (variantName.startsWith(productName)) {
45
+ const rest = variantName.slice(productName.length);
46
+ const match = rest.match(/^\s*[-–—]\s*(.*)/);
47
+ if (match && match[1].length > 0) return match[1];
48
+ }
49
+ const lowerProduct = productName.toLowerCase().trim();
50
+ if (lower.startsWith(lowerProduct)) {
51
+ const rest = variantName.slice(productName.length);
52
+ const match = rest.match(/^\s*[-–—]\s*(.*)/);
53
+ if (match && match[1].length > 0) return match[1];
54
+ }
55
+ const lastDash = variantName.lastIndexOf("-");
56
+ if (lastDash > 0 && lastDash < variantName.length - 1) {
57
+ const prefix = variantName.slice(0, lastDash).trim();
58
+ const suffix = variantName.slice(lastDash + 1).trim();
59
+ if (suffix.length > 0 && prefix.length > suffix.length * 2) {
60
+ return suffix;
61
+ }
62
+ }
63
+ return variantName;
64
+ }
65
+ function getVariantDisplayName(variant, productName) {
66
+ if (variant.display_attributes?.length) {
67
+ return variant.display_attributes.map((a) => a.value_name).join(" / ");
68
+ }
69
+ if (variant.name) {
70
+ return productName ? stripProductPrefix(variant.name, productName) : variant.name;
71
+ }
72
+ return productName || (variant.is_default ? "Default" : "Option");
73
+ }
74
+
75
+ // src/types/product.ts
76
+ var PRODUCT_TYPE = {
77
+ Product: "product",
78
+ Service: "service",
79
+ Digital: "digital",
80
+ Bundle: "bundle",
81
+ Composite: "composite"
82
+ };
83
+ var RENDER_HINT = {
84
+ Food: "food",
85
+ Physical: "physical",
86
+ General: "general"
87
+ };
88
+ var DURATION_UNIT = {
89
+ Minutes: "minutes",
90
+ Hours: "hours",
91
+ Days: "days",
92
+ Nights: "nights",
93
+ Weeks: "weeks",
94
+ Months: "months",
95
+ Years: "years"
96
+ };
97
+ var INPUT_FIELD_TYPE = {
98
+ Text: "text",
99
+ Textarea: "textarea",
100
+ Number: "number",
101
+ Select: "select",
102
+ Radio: "radio",
103
+ Checkbox: "checkbox",
104
+ Color: "color",
105
+ Date: "date",
106
+ File: "file",
107
+ Image: "image",
108
+ Url: "url",
109
+ Address: "address",
110
+ Phone: "phone",
111
+ Email: "email",
112
+ DateTime: "date_time",
113
+ Time: "time",
114
+ Signature: "signature",
115
+ MultiSelect: "multi_select",
116
+ DateRange: "date_range",
117
+ Location: "location"
118
+ };
119
+
120
+ // src/assets/url.ts
121
+ var DEFAULT_CDN_BASE_URL = "https://storefrontassetscdn.cimplify.io";
122
+ var CIMPLIFY_CDN_HOSTS = [
123
+ "storefrontassetscdn.cimplify.io",
124
+ "cdn.cimplify.io",
125
+ "static-tmp.cimplify.io"
126
+ ];
127
+ var ABSOLUTE_URL_RE = /^https?:\/\//i;
128
+ var MOCK_PASSTHROUGH_RE = /^\/(img|elements|_mock)\//;
129
+ function assetUrl(path, opts = {}) {
130
+ if (!path) return path;
131
+ if (ABSOLUTE_URL_RE.test(path)) return appendTransform(path, opts);
132
+ if (MOCK_PASSTHROUGH_RE.test(path)) return appendTransform(path, opts);
133
+ const base = (opts.base ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
134
+ const normalized = path.replace(/^\/+/, "");
135
+ return appendTransform(`${base}/${normalized}`, opts);
136
+ }
137
+ function isCimplifyAsset(src, base) {
138
+ if (!src) return false;
139
+ if (!ABSOLUTE_URL_RE.test(src)) return true;
140
+ if (MOCK_PASSTHROUGH_RE.test(src)) return true;
141
+ const resolvedBase = (base ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
142
+ if (resolvedBase && src.startsWith(resolvedBase)) return true;
143
+ return CIMPLIFY_CDN_HOSTS.some((host) => src.startsWith(`https://${host}/`));
144
+ }
145
+ function appendTransform(url, t) {
146
+ const params = new URLSearchParams();
147
+ if (t.w != null) params.set("w", String(t.w));
148
+ if (t.h != null) params.set("h", String(t.h));
149
+ if (t.quality != null) params.set("quality", String(t.quality));
150
+ if (t.format != null) params.set("format", t.format);
151
+ const query = params.toString();
152
+ if (!query) return url;
153
+ return `${url}${url.includes("?") ? "&" : "?"}${query}`;
154
+ }
155
+
156
+ export { CIMPLIFY_CDN_HOSTS, DEFAULT_CDN_BASE_URL, DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, allGalleryImages, assetUrl, getVariantDisplayName, isCimplifyAsset, resolveGallery };
@@ -1,5 +1,5 @@
1
- import { createMockApp } from './chunk-3G4QCENX.mjs';
2
- import { createCimplifyClient } from './chunk-PKYZBKZD.mjs';
1
+ import { createMockApp } from './chunk-FVGVJ4TC.mjs';
2
+ import { createCimplifyClient } from './chunk-JAPCAZN4.mjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  var cimplifyRegistry = z.registry();
@@ -2645,10 +2645,10 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
2645
2645
  REFRESH_TOKEN: "refresh_token", LOGOUT: "logout",
2646
2646
  PROCESS_CHECKOUT: "process_checkout", ABORT_CHECKOUT: "abort_checkout",
2647
2647
  READY: "ready", HEIGHT_CHANGE: "height_change",
2648
- AUTHENTICATED: "authenticated", REQUIRES_OTP: "requires_otp", ERROR: "error",
2648
+ AUTH_REQUESTED: "auth_requested", ERROR: "error",
2649
2649
  ADDRESS_CHANGED: "address_changed", ADDRESS_SELECTED: "address_selected",
2650
2650
  PAYMENT_METHOD_SELECTED: "payment_method_selected",
2651
- TOKEN_REFRESHED: "token_refreshed", LOGOUT_COMPLETE: "logout_complete",
2651
+ LOGOUT_COMPLETE: "logout_complete",
2652
2652
  CONTACT_PROVIDED: "contact_provided",
2653
2653
  CHECKOUT_STATUS: "checkout_status", CHECKOUT_COMPLETE: "checkout_complete",
2654
2654
  ORDER_TYPE_CHANGED: "order_type_changed", REQUEST_SUBMIT: "request_submit"
@@ -2657,6 +2657,7 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
2657
2657
  var AUTO = qs.get("auto") === "true";
2658
2658
  var DEMO_OTP = qs.get("otp") || "123456";
2659
2659
  var ORIGIN = qs.get("origin") || "*";
2660
+ var NONCE = qs.get("nonce");
2660
2661
  var state = {
2661
2662
  businessId: DEFAULT_BUSINESS,
2662
2663
  token: null,
@@ -2671,7 +2672,10 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
2671
2672
  var content = document.getElementById("content");
2672
2673
  var title = document.getElementById("title");
2673
2674
 
2674
- function send(msg) { parent.postMessage(msg, ORIGIN); }
2675
+ function send(msg) {
2676
+ if (NONCE) msg.nonce = NONCE;
2677
+ parent.postMessage(msg, ORIGIN);
2678
+ }
2675
2679
  function reportHeight() { send({ type: MSG.HEIGHT_CHANGE, height: document.documentElement.scrollHeight }); }
2676
2680
  function ready() { send({ type: MSG.READY, height: document.documentElement.scrollHeight }); }
2677
2681
 
@@ -2691,54 +2695,13 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
2691
2695
  function renderAuth() {
2692
2696
  title.textContent = "Sign in";
2693
2697
  content.innerHTML =
2694
- '<label>Email or phone</label>' +
2695
- '<input id="contact" placeholder="you@example.com or +233..." value="' + (qs.get("contact") || "") + '">' +
2696
- '<button id="send-otp">Send code</button>' +
2697
- '<div id="otp-box" style="display:none">' +
2698
- ' <label>Verification code (mock: ' + DEMO_OTP + ')</label>' +
2699
- ' <input id="otp" maxlength="6" value="' + DEMO_OTP + '">' +
2700
- ' <button id="verify-otp">Verify</button>' +
2701
- '</div>' +
2698
+ '<button id="start-auth">Continue with Cimplify</button>' +
2702
2699
  '<div class="err" id="err"></div>';
2703
- document.getElementById("send-otp").onclick = function () {
2704
- var contact = document.getElementById("contact").value.trim();
2705
- if (!contact) { document.getElementById("err").textContent = "Enter contact"; return; }
2706
- state.contact = contact;
2707
- var contactType = contact.indexOf("@") >= 0 ? "email" : "phone";
2708
- send({ type: MSG.CONTACT_PROVIDED, contact: contact, contactType: contactType });
2709
- send({ type: MSG.REQUIRES_OTP, contactMasked: contact.slice(0, 3) + "***" });
2710
- document.getElementById("otp-box").style.display = "block";
2711
- reportHeight();
2712
- };
2713
- document.getElementById("verify-otp").onclick = function () {
2714
- var code = document.getElementById("otp").value.trim();
2715
- if (code !== DEMO_OTP) { document.getElementById("err").textContent = "Invalid code"; return; }
2716
- fetch("/api/v1/auth/verify-otp", {
2717
- method: "POST",
2718
- headers: { "content-type": "application/json" },
2719
- body: JSON.stringify({ contact: state.contact, code: code })
2720
- }).then(function (r) { return r.json(); }).then(function (body) {
2721
- var session = body.session || {};
2722
- state.token = session.token || body.token;
2723
- state.customer = {
2724
- name: session.customer_name || "Customer",
2725
- email: session.customer_email || (state.contact && state.contact.indexOf("@") >= 0 ? state.contact : null),
2726
- phone: session.customer_phone || (state.contact && state.contact.indexOf("@") < 0 ? state.contact : null)
2727
- };
2728
- send({
2729
- type: MSG.AUTHENTICATED,
2730
- accountId: "acct_mock_" + (session.id || "x"),
2731
- customerId: session.customer_id || "cust_mock",
2732
- token: state.token,
2733
- customer: state.customer
2734
- });
2735
- }).catch(function (e) {
2736
- send({ type: MSG.ERROR, code: "AUTH_FAILED", message: String(e) });
2737
- });
2700
+ document.getElementById("start-auth").onclick = function () {
2701
+ send({ type: MSG.AUTH_REQUESTED });
2738
2702
  };
2739
2703
  if (AUTO) {
2740
- setTimeout(function () { document.getElementById("send-otp").click(); }, 50);
2741
- setTimeout(function () { document.getElementById("verify-otp").click(); }, 150);
2704
+ setTimeout(function () { document.getElementById("start-auth").click(); }, 50);
2742
2705
  }
2743
2706
  }
2744
2707
 
@@ -2915,7 +2878,6 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
2915
2878
  break;
2916
2879
  case MSG.SET_TOKEN:
2917
2880
  state.token = msg.token;
2918
- send({ type: MSG.TOKEN_REFRESHED, token: state.token });
2919
2881
  break;
2920
2882
  case MSG.SET_CART:
2921
2883
  state.cart = msg.cart;
@@ -2927,7 +2889,7 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
2927
2889
  send({ type: MSG.HEIGHT_CHANGE, height: document.documentElement.scrollHeight });
2928
2890
  break;
2929
2891
  case MSG.REFRESH_TOKEN:
2930
- send({ type: MSG.TOKEN_REFRESHED, token: state.token || "tok_mock_refreshed" });
2892
+ reportHeight();
2931
2893
  break;
2932
2894
  case MSG.LOGOUT:
2933
2895
  state.token = null;
@@ -0,0 +1,168 @@
1
+ 'use strict';
2
+
3
+ // src/gallery.ts
4
+ function dedupe(urls) {
5
+ const seen = /* @__PURE__ */ new Set();
6
+ const out = [];
7
+ for (const url of urls) {
8
+ if (url && !seen.has(url)) {
9
+ seen.add(url);
10
+ out.push(url);
11
+ }
12
+ }
13
+ return out;
14
+ }
15
+ function resolveGallery(product, selectedVariantId) {
16
+ const variant = selectedVariantId ? product.variants?.find((v) => v.id === selectedVariantId) : void 0;
17
+ if (variant?.images?.length) return dedupe(variant.images);
18
+ if (product.images?.length) return dedupe(product.images);
19
+ const firstWithImages = product.variants?.find((v) => v.images?.length);
20
+ if (firstWithImages?.images?.length) return dedupe(firstWithImages.images);
21
+ return product.image_url ? [product.image_url] : [];
22
+ }
23
+ function allGalleryImages(product) {
24
+ const seen = /* @__PURE__ */ new Set();
25
+ const out = [];
26
+ const push = (url, variantId) => {
27
+ if (url && !seen.has(url)) {
28
+ seen.add(url);
29
+ out.push({ url, variantId });
30
+ }
31
+ };
32
+ push(product.image_url, null);
33
+ for (const url of product.images ?? []) push(url, null);
34
+ for (const variant of product.variants ?? []) {
35
+ for (const url of variant.images ?? []) push(url, variant.id);
36
+ }
37
+ return out;
38
+ }
39
+
40
+ // src/utils/variant.ts
41
+ function stripProductPrefix(variantName, productName) {
42
+ if (!variantName || !productName) return variantName || productName;
43
+ const lower = variantName.toLowerCase().trim();
44
+ if (lower === "default" || lower === "standard") return productName;
45
+ if (lower.endsWith("-default") || lower.endsWith("-standard")) return productName;
46
+ if (variantName.startsWith(productName)) {
47
+ const rest = variantName.slice(productName.length);
48
+ const match = rest.match(/^\s*[-–—]\s*(.*)/);
49
+ if (match && match[1].length > 0) return match[1];
50
+ }
51
+ const lowerProduct = productName.toLowerCase().trim();
52
+ if (lower.startsWith(lowerProduct)) {
53
+ const rest = variantName.slice(productName.length);
54
+ const match = rest.match(/^\s*[-–—]\s*(.*)/);
55
+ if (match && match[1].length > 0) return match[1];
56
+ }
57
+ const lastDash = variantName.lastIndexOf("-");
58
+ if (lastDash > 0 && lastDash < variantName.length - 1) {
59
+ const prefix = variantName.slice(0, lastDash).trim();
60
+ const suffix = variantName.slice(lastDash + 1).trim();
61
+ if (suffix.length > 0 && prefix.length > suffix.length * 2) {
62
+ return suffix;
63
+ }
64
+ }
65
+ return variantName;
66
+ }
67
+ function getVariantDisplayName(variant, productName) {
68
+ if (variant.display_attributes?.length) {
69
+ return variant.display_attributes.map((a) => a.value_name).join(" / ");
70
+ }
71
+ if (variant.name) {
72
+ return productName ? stripProductPrefix(variant.name, productName) : variant.name;
73
+ }
74
+ return productName || (variant.is_default ? "Default" : "Option");
75
+ }
76
+
77
+ // src/types/product.ts
78
+ var PRODUCT_TYPE = {
79
+ Product: "product",
80
+ Service: "service",
81
+ Digital: "digital",
82
+ Bundle: "bundle",
83
+ Composite: "composite"
84
+ };
85
+ var RENDER_HINT = {
86
+ Food: "food",
87
+ Physical: "physical",
88
+ General: "general"
89
+ };
90
+ var DURATION_UNIT = {
91
+ Minutes: "minutes",
92
+ Hours: "hours",
93
+ Days: "days",
94
+ Nights: "nights",
95
+ Weeks: "weeks",
96
+ Months: "months",
97
+ Years: "years"
98
+ };
99
+ var INPUT_FIELD_TYPE = {
100
+ Text: "text",
101
+ Textarea: "textarea",
102
+ Number: "number",
103
+ Select: "select",
104
+ Radio: "radio",
105
+ Checkbox: "checkbox",
106
+ Color: "color",
107
+ Date: "date",
108
+ File: "file",
109
+ Image: "image",
110
+ Url: "url",
111
+ Address: "address",
112
+ Phone: "phone",
113
+ Email: "email",
114
+ DateTime: "date_time",
115
+ Time: "time",
116
+ Signature: "signature",
117
+ MultiSelect: "multi_select",
118
+ DateRange: "date_range",
119
+ Location: "location"
120
+ };
121
+
122
+ // src/assets/url.ts
123
+ var DEFAULT_CDN_BASE_URL = "https://storefrontassetscdn.cimplify.io";
124
+ var CIMPLIFY_CDN_HOSTS = [
125
+ "storefrontassetscdn.cimplify.io",
126
+ "cdn.cimplify.io",
127
+ "static-tmp.cimplify.io"
128
+ ];
129
+ var ABSOLUTE_URL_RE = /^https?:\/\//i;
130
+ var MOCK_PASSTHROUGH_RE = /^\/(img|elements|_mock)\//;
131
+ function assetUrl(path, opts = {}) {
132
+ if (!path) return path;
133
+ if (ABSOLUTE_URL_RE.test(path)) return appendTransform(path, opts);
134
+ if (MOCK_PASSTHROUGH_RE.test(path)) return appendTransform(path, opts);
135
+ const base = (opts.base ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
136
+ const normalized = path.replace(/^\/+/, "");
137
+ return appendTransform(`${base}/${normalized}`, opts);
138
+ }
139
+ function isCimplifyAsset(src, base) {
140
+ if (!src) return false;
141
+ if (!ABSOLUTE_URL_RE.test(src)) return true;
142
+ if (MOCK_PASSTHROUGH_RE.test(src)) return true;
143
+ const resolvedBase = (base ?? DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
144
+ if (resolvedBase && src.startsWith(resolvedBase)) return true;
145
+ return CIMPLIFY_CDN_HOSTS.some((host) => src.startsWith(`https://${host}/`));
146
+ }
147
+ function appendTransform(url, t) {
148
+ const params = new URLSearchParams();
149
+ if (t.w != null) params.set("w", String(t.w));
150
+ if (t.h != null) params.set("h", String(t.h));
151
+ if (t.quality != null) params.set("quality", String(t.quality));
152
+ if (t.format != null) params.set("format", t.format);
153
+ const query = params.toString();
154
+ if (!query) return url;
155
+ return `${url}${url.includes("?") ? "&" : "?"}${query}`;
156
+ }
157
+
158
+ exports.CIMPLIFY_CDN_HOSTS = CIMPLIFY_CDN_HOSTS;
159
+ exports.DEFAULT_CDN_BASE_URL = DEFAULT_CDN_BASE_URL;
160
+ exports.DURATION_UNIT = DURATION_UNIT;
161
+ exports.INPUT_FIELD_TYPE = INPUT_FIELD_TYPE;
162
+ exports.PRODUCT_TYPE = PRODUCT_TYPE;
163
+ exports.RENDER_HINT = RENDER_HINT;
164
+ exports.allGalleryImages = allGalleryImages;
165
+ exports.assetUrl = assetUrl;
166
+ exports.getVariantDisplayName = getVariantDisplayName;
167
+ exports.isCimplifyAsset = isCimplifyAsset;
168
+ exports.resolveGallery = resolveGallery;
@@ -1,4 +1,4 @@
1
- import { safe, generateIdempotencyKey, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-R6363CC7.mjs';
1
+ import { safe, generateIdempotencyKey, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-QQMDEGAK.mjs';
2
2
  import { CimplifyError, ErrorCode, IdempotencyMismatchError, enrichError } from './chunk-AMZXALF6.mjs';
3
3
 
4
4
  // src/activity.ts
@@ -271,7 +271,6 @@ function createClientEvents() {
271
271
  }
272
272
 
273
273
  // src/client.ts
274
- var ACCESS_TOKEN_STORAGE_KEY = "cimplify_access_token";
275
274
  var SESSION_TOKEN_STORAGE_KEY = "cimplify_session_token";
276
275
  var ORDER_TOKEN_PREFIX = "cimplify_ot_";
277
276
  var SESSION_TOKEN_HEADER = "x-session-token";
@@ -400,7 +399,6 @@ var CimplifyClient = class {
400
399
  this.retryDelay = config.retryDelay ?? DEFAULT_RETRY_DELAY_MS;
401
400
  this.hooks = config.hooks ?? {};
402
401
  this.fetchImpl = (config.fetch ?? globalThis.fetch).bind(globalThis);
403
- this.accessToken = this.loadAccessToken();
404
402
  this.sessionToken = this.loadSessionToken();
405
403
  if (!this.publicKey && !config.suppressPublicKeyWarning) {
406
404
  console.warn(
@@ -427,7 +425,6 @@ var CimplifyClient = class {
427
425
  setAccessToken(token) {
428
426
  const previous = this.accessToken;
429
427
  this.accessToken = token;
430
- this.saveAccessToken(token);
431
428
  this.hooks.onSessionChange?.({
432
429
  previousToken: previous,
433
430
  newToken: token,
@@ -438,7 +435,6 @@ var CimplifyClient = class {
438
435
  const previous = this.accessToken;
439
436
  this.accessToken = null;
440
437
  this.sessionToken = null;
441
- this.saveAccessToken(null);
442
438
  if (typeof window !== "undefined" && window.localStorage) {
443
439
  localStorage.removeItem(SESSION_TOKEN_STORAGE_KEY);
444
440
  }
@@ -531,23 +527,8 @@ var CimplifyClient = class {
531
527
  this.businessIdResolvePromise = null;
532
528
  }
533
529
  }
534
- loadAccessToken() {
535
- if (typeof window !== "undefined" && window.localStorage) {
536
- return localStorage.getItem(ACCESS_TOKEN_STORAGE_KEY);
537
- }
538
- return null;
539
- }
540
- saveAccessToken(token) {
541
- if (typeof window !== "undefined" && window.localStorage) {
542
- try {
543
- if (token) {
544
- localStorage.setItem(ACCESS_TOKEN_STORAGE_KEY, token);
545
- } else {
546
- localStorage.removeItem(ACCESS_TOKEN_STORAGE_KEY);
547
- }
548
- } catch {
549
- }
550
- }
530
+ async authedFetch(url, options) {
531
+ return this.resilientFetch(url, options);
551
532
  }
552
533
  loadSessionToken() {
553
534
  if (typeof window !== "undefined" && window.localStorage) {
@@ -724,7 +705,7 @@ var CimplifyClient = class {
724
705
  async get(path, opts) {
725
706
  const key = this.getDedupeKey("get", path, opts?.cacheOptions);
726
707
  return this.deduplicatedRequest(key, async () => {
727
- const response = await this.resilientFetch(this.buildUrl(this.baseUrl, path), {
708
+ const response = await this.authedFetch(this.buildUrl(this.baseUrl, path), {
728
709
  method: "GET",
729
710
  credentials: this.credentials,
730
711
  headers: this.getHeaders(),
@@ -734,7 +715,7 @@ var CimplifyClient = class {
734
715
  });
735
716
  }
736
717
  async post(path, body, opts) {
737
- const response = await this.resilientFetch(this.buildUrl(this.baseUrl, path), {
718
+ const response = await this.authedFetch(this.buildUrl(this.baseUrl, path), {
738
719
  method: "POST",
739
720
  credentials: this.credentials,
740
721
  headers: mergeOptionHeaders(this.getHeaders(), opts),
@@ -743,7 +724,7 @@ var CimplifyClient = class {
743
724
  return this.handleRestResponse(response);
744
725
  }
745
726
  async patch(path, body, opts) {
746
- const response = await this.resilientFetch(this.buildUrl(this.baseUrl, path), {
727
+ const response = await this.authedFetch(this.buildUrl(this.baseUrl, path), {
747
728
  method: "PATCH",
748
729
  credentials: this.credentials,
749
730
  headers: mergeOptionHeaders(this.getHeaders(), opts),
@@ -752,7 +733,7 @@ var CimplifyClient = class {
752
733
  return this.handleRestResponse(response);
753
734
  }
754
735
  async delete(path, opts) {
755
- const response = await this.resilientFetch(this.buildUrl(this.baseUrl, path), {
736
+ const response = await this.authedFetch(this.buildUrl(this.baseUrl, path), {
756
737
  method: "DELETE",
757
738
  credentials: this.credentials,
758
739
  headers: mergeOptionHeaders(this.getHeaders(), opts)
@@ -762,7 +743,7 @@ var CimplifyClient = class {
762
743
  async linkGet(path, opts) {
763
744
  const key = this.getDedupeKey("linkGet", path, opts?.cacheOptions);
764
745
  return this.deduplicatedRequest(key, async () => {
765
- const response = await this.resilientFetch(`${this.linkApiUrl}${path}`, {
746
+ const response = await this.authedFetch(`${this.linkApiUrl}${path}`, {
766
747
  method: "GET",
767
748
  credentials: this.credentials,
768
749
  headers: this.getHeaders(),
@@ -772,7 +753,7 @@ var CimplifyClient = class {
772
753
  });
773
754
  }
774
755
  async linkPost(path, body, opts) {
775
- const response = await this.resilientFetch(`${this.linkApiUrl}${path}`, {
756
+ const response = await this.authedFetch(`${this.linkApiUrl}${path}`, {
776
757
  method: "POST",
777
758
  credentials: this.credentials,
778
759
  headers: mergeOptionHeaders(this.getHeaders(), opts),
@@ -781,7 +762,7 @@ var CimplifyClient = class {
781
762
  return this.handleRestResponse(response);
782
763
  }
783
764
  async linkDelete(path, opts) {
784
- const response = await this.resilientFetch(`${this.linkApiUrl}${path}`, {
765
+ const response = await this.authedFetch(`${this.linkApiUrl}${path}`, {
785
766
  method: "DELETE",
786
767
  credentials: this.credentials,
787
768
  headers: mergeOptionHeaders(this.getHeaders(), opts)