@cimplify/sdk 0.6.9 → 0.6.10

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/index.js CHANGED
@@ -3306,6 +3306,11 @@ function deriveUrls() {
3306
3306
  linkApiUrl: "https://api.cimplify.io"
3307
3307
  };
3308
3308
  }
3309
+ function normalizeUrl(url) {
3310
+ const trimmed = url.trim();
3311
+ if (!trimmed) return trimmed;
3312
+ return trimmed.replace(/\/+$/, "");
3313
+ }
3309
3314
  function getEnvPublicKey() {
3310
3315
  try {
3311
3316
  const env = globalThis.process;
@@ -3323,8 +3328,8 @@ var CimplifyClient = class {
3323
3328
  this.inflightRequests = /* @__PURE__ */ new Map();
3324
3329
  this.publicKey = config.publicKey || getEnvPublicKey() || "";
3325
3330
  const urls = deriveUrls();
3326
- this.baseUrl = urls.baseUrl;
3327
- this.linkApiUrl = urls.linkApiUrl;
3331
+ this.baseUrl = config.baseUrl ? normalizeUrl(config.baseUrl) : urls.baseUrl;
3332
+ this.linkApiUrl = config.linkApiUrl ? normalizeUrl(config.linkApiUrl) : urls.linkApiUrl;
3328
3333
  this.credentials = config.credentials || "include";
3329
3334
  this.timeout = config.timeout ?? DEFAULT_TIMEOUT_MS;
3330
3335
  this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
package/dist/index.mjs CHANGED
@@ -3304,6 +3304,11 @@ function deriveUrls() {
3304
3304
  linkApiUrl: "https://api.cimplify.io"
3305
3305
  };
3306
3306
  }
3307
+ function normalizeUrl(url) {
3308
+ const trimmed = url.trim();
3309
+ if (!trimmed) return trimmed;
3310
+ return trimmed.replace(/\/+$/, "");
3311
+ }
3307
3312
  function getEnvPublicKey() {
3308
3313
  try {
3309
3314
  const env = globalThis.process;
@@ -3321,8 +3326,8 @@ var CimplifyClient = class {
3321
3326
  this.inflightRequests = /* @__PURE__ */ new Map();
3322
3327
  this.publicKey = config.publicKey || getEnvPublicKey() || "";
3323
3328
  const urls = deriveUrls();
3324
- this.baseUrl = urls.baseUrl;
3325
- this.linkApiUrl = urls.linkApiUrl;
3329
+ this.baseUrl = config.baseUrl ? normalizeUrl(config.baseUrl) : urls.baseUrl;
3330
+ this.linkApiUrl = config.linkApiUrl ? normalizeUrl(config.linkApiUrl) : urls.linkApiUrl;
3326
3331
  this.credentials = config.credentials || "include";
3327
3332
  this.timeout = config.timeout ?? DEFAULT_TIMEOUT_MS;
3328
3333
  this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
package/dist/react.js CHANGED
@@ -3438,6 +3438,11 @@ function deriveUrls() {
3438
3438
  linkApiUrl: "https://api.cimplify.io"
3439
3439
  };
3440
3440
  }
3441
+ function normalizeUrl(url) {
3442
+ const trimmed = url.trim();
3443
+ if (!trimmed) return trimmed;
3444
+ return trimmed.replace(/\/+$/, "");
3445
+ }
3441
3446
  function getEnvPublicKey() {
3442
3447
  try {
3443
3448
  const env = globalThis.process;
@@ -3455,8 +3460,8 @@ var CimplifyClient = class {
3455
3460
  this.inflightRequests = /* @__PURE__ */ new Map();
3456
3461
  this.publicKey = config.publicKey || getEnvPublicKey() || "";
3457
3462
  const urls = deriveUrls();
3458
- this.baseUrl = urls.baseUrl;
3459
- this.linkApiUrl = urls.linkApiUrl;
3463
+ this.baseUrl = config.baseUrl ? normalizeUrl(config.baseUrl) : urls.baseUrl;
3464
+ this.linkApiUrl = config.linkApiUrl ? normalizeUrl(config.linkApiUrl) : urls.linkApiUrl;
3460
3465
  this.credentials = config.credentials || "include";
3461
3466
  this.timeout = config.timeout ?? DEFAULT_TIMEOUT_MS;
3462
3467
  this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
package/dist/react.mjs CHANGED
@@ -3436,6 +3436,11 @@ function deriveUrls() {
3436
3436
  linkApiUrl: "https://api.cimplify.io"
3437
3437
  };
3438
3438
  }
3439
+ function normalizeUrl(url) {
3440
+ const trimmed = url.trim();
3441
+ if (!trimmed) return trimmed;
3442
+ return trimmed.replace(/\/+$/, "");
3443
+ }
3439
3444
  function getEnvPublicKey() {
3440
3445
  try {
3441
3446
  const env = globalThis.process;
@@ -3453,8 +3458,8 @@ var CimplifyClient = class {
3453
3458
  this.inflightRequests = /* @__PURE__ */ new Map();
3454
3459
  this.publicKey = config.publicKey || getEnvPublicKey() || "";
3455
3460
  const urls = deriveUrls();
3456
- this.baseUrl = urls.baseUrl;
3457
- this.linkApiUrl = urls.linkApiUrl;
3461
+ this.baseUrl = config.baseUrl ? normalizeUrl(config.baseUrl) : urls.baseUrl;
3462
+ this.linkApiUrl = config.linkApiUrl ? normalizeUrl(config.linkApiUrl) : urls.linkApiUrl;
3458
3463
  this.credentials = config.credentials || "include";
3459
3464
  this.timeout = config.timeout ?? DEFAULT_TIMEOUT_MS;
3460
3465
  this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/sdk",
3
- "version": "0.6.9",
3
+ "version": "0.6.10",
4
4
  "description": "Cimplify Commerce SDK for storefronts",
5
5
  "keywords": [
6
6
  "cimplify",
@@ -1,20 +0,0 @@
1
- type AdSlot = "banner" | "sidebar" | "in-content" | "native" | "footer";
2
- type AdPosition = "static" | "sticky" | "fixed";
3
- type AdTheme = "light" | "dark" | "auto";
4
- interface AdConfig {
5
- enabled: boolean;
6
- theme: AdTheme;
7
- excludePaths?: string[];
8
- }
9
- interface AdCreative {
10
- id: string;
11
- html: string;
12
- clickUrl: string;
13
- }
14
- interface AdContextValue {
15
- siteId: string | null;
16
- config: AdConfig | null;
17
- isLoading: boolean;
18
- }
19
-
20
- export type { AdSlot as A, AdPosition as a, AdTheme as b, AdConfig as c, AdCreative as d, AdContextValue as e };
@@ -1,20 +0,0 @@
1
- type AdSlot = "banner" | "sidebar" | "in-content" | "native" | "footer";
2
- type AdPosition = "static" | "sticky" | "fixed";
3
- type AdTheme = "light" | "dark" | "auto";
4
- interface AdConfig {
5
- enabled: boolean;
6
- theme: AdTheme;
7
- excludePaths?: string[];
8
- }
9
- interface AdCreative {
10
- id: string;
11
- html: string;
12
- clickUrl: string;
13
- }
14
- interface AdContextValue {
15
- siteId: string | null;
16
- config: AdConfig | null;
17
- isLoading: boolean;
18
- }
19
-
20
- export type { AdSlot as A, AdPosition as a, AdTheme as b, AdConfig as c, AdCreative as d, AdContextValue as e };
@@ -1,25 +0,0 @@
1
- export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, v as CimplifyElement, u as CimplifyElements, x as ELEMENT_TYPES, E as EVENT_TYPES, H as ElementEventType, z as ElementOptions, D as ElementType, y as ElementsOptions, F as FetchQuoteInput, r as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, q as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, p as SchedulingService, S as SearchOptions, w as createElements, k as generateIdempotencyKey } from './client-vmXPt1j0.mjs';
2
- import './payment-Cu75tmUc.mjs';
3
-
4
- type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
5
- type SortOrder = "asc" | "desc";
6
- declare class QueryBuilder {
7
- private entity;
8
- private filters;
9
- private modifiers;
10
- private pathSegments;
11
- constructor(entity: string);
12
- path(segment: string): this;
13
- where(field: string, op: Operator, value: unknown): this;
14
- and(field: string, op: Operator, value: unknown): this;
15
- sort(field: string, order?: SortOrder): this;
16
- limit(n: number): this;
17
- offset(n: number): this;
18
- count(): this;
19
- enriched(): this;
20
- build(): string;
21
- toString(): string;
22
- }
23
- declare function query(entity: string): QueryBuilder;
24
-
25
- export { QueryBuilder, query };
@@ -1,25 +0,0 @@
1
- export { A as AuthService, B as BusinessService, i as CartOperations, b as CatalogueQueries, j as CheckoutOperations, j as CheckoutService, v as CimplifyElement, u as CimplifyElements, x as ELEMENT_TYPES, E as EVENT_TYPES, H as ElementEventType, z as ElementOptions, D as ElementType, y as ElementsOptions, F as FetchQuoteInput, r as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, q as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, h as RefreshQuoteResult, p as SchedulingService, S as SearchOptions, w as createElements, k as generateIdempotencyKey } from './client-COpV6Yuu.js';
2
- import './payment-Cu75tmUc.js';
3
-
4
- type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
5
- type SortOrder = "asc" | "desc";
6
- declare class QueryBuilder {
7
- private entity;
8
- private filters;
9
- private modifiers;
10
- private pathSegments;
11
- constructor(entity: string);
12
- path(segment: string): this;
13
- where(field: string, op: Operator, value: unknown): this;
14
- and(field: string, op: Operator, value: unknown): this;
15
- sort(field: string, order?: SortOrder): this;
16
- limit(n: number): this;
17
- offset(n: number): this;
18
- count(): this;
19
- enriched(): this;
20
- build(): string;
21
- toString(): string;
22
- }
23
- declare function query(entity: string): QueryBuilder;
24
-
25
- export { QueryBuilder, query };