@commerce-blocks/sdk 1.0.0 → 1.2.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 (3) hide show
  1. package/dist/index.d.ts +39 -2
  2. package/dist/index.js +1344 -1215
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -100,6 +100,10 @@ export declare interface BlocksExecuteQuery {
100
100
  signal?: AbortSignal;
101
101
  discountEntitlements?: DiscountEntitlement[];
102
102
  context?: BlocksContext;
103
+ dynamicLinking?: Record<string, string | number | (string | number)[]>;
104
+ params?: Record<string, unknown>;
105
+ paramDefinitions?: ParamDefinitions;
106
+ transformBody?: BodyTransformer;
103
107
  }
104
108
 
105
109
  export declare type BlocksExtender<P extends Product = Product> = (result: BlocksResult<P>, raw: LayersResponse & {
@@ -127,6 +131,8 @@ export declare interface BlocksResult<P extends Product = Product> extends Layer
127
131
  block?: BlocksInfo;
128
132
  }
129
133
 
134
+ export declare type BodyTransformer = (body: Record<string, unknown>) => Record<string, unknown>;
135
+
130
136
  export declare interface CollectionController<P extends Product = Product> {
131
137
  state: ReadonlySignal<QueryState<CollectionResult<P>>>;
132
138
  execute: (query?: CollectionExecuteQuery) => Promise<Result<CollectionResult<P>, SdkError>>;
@@ -145,6 +151,10 @@ export declare interface CollectionExecuteQuery {
145
151
  key: string;
146
152
  }[];
147
153
  includeFilters?: boolean;
154
+ dynamicLinking?: Record<string, string | number | (string | number)[]>;
155
+ params?: Record<string, unknown>;
156
+ paramDefinitions?: ParamDefinitions;
157
+ transformBody?: BodyTransformer;
148
158
  }
149
159
 
150
160
  export declare type CollectionExtender<P extends Product = Product> = (result: CollectionResult<P>, raw: LayersResponse) => CollectionResult<P>;
@@ -345,6 +355,10 @@ export declare interface ImageSearchOptions {
345
355
  filters?: unknown;
346
356
  tuning?: LayersTuning;
347
357
  signal?: AbortSignal;
358
+ dynamicLinking?: Record<string, string | number | (string | number)[]>;
359
+ params?: Record<string, unknown>;
360
+ paramDefinitions?: ParamDefinitions;
361
+ transformBody?: BodyTransformer;
348
362
  }
349
363
 
350
364
  export declare function inValues(property: string, values: FilterValue[]): FilterExpression;
@@ -431,6 +445,7 @@ declare interface LayersVariant {
431
445
  updated_at?: string;
432
446
  requires_selling_plan?: boolean;
433
447
  has_selling_plan?: boolean;
448
+ inventory_levels?: Record<number, number>;
434
449
  }
435
450
 
436
451
  export declare function lt(property: string, value: number): FilterExpression;
@@ -526,6 +541,14 @@ declare interface PageMeta {
526
541
  lastFetched: number;
527
542
  }
528
543
 
544
+ export declare type ParamDefinition<T = unknown> = (input: ParamInput) => T | undefined | null;
545
+
546
+ export declare type ParamDefinitions = Record<string, ParamDefinition>;
547
+
548
+ export declare interface ParamInput {
549
+ key: string;
550
+ }
551
+
529
552
  declare interface PredictiveSearchResponse {
530
553
  matchedQueries: {
531
554
  query_text: string;
@@ -535,9 +558,18 @@ declare interface PredictiveSearchResponse {
535
558
  normalizedQuery: string;
536
559
  }
537
560
 
538
- declare type PrepareSearchQuery = Pick<SearchQuery, 'query' | 'filters' | 'tuning' | 'signal'>;
561
+ export declare interface PrepareSearchQuery {
562
+ query: string;
563
+ filters?: unknown;
564
+ tuning?: LayersTuning;
565
+ signal?: AbortSignal;
566
+ dynamicLinking?: Record<string, string | number | (string | number)[]>;
567
+ params?: Record<string, unknown>;
568
+ paramDefinitions?: ParamDefinitions;
569
+ transformBody?: BodyTransformer;
570
+ }
539
571
 
540
- declare interface PrepareSearchResult {
572
+ export declare interface PrepareSearchResult {
541
573
  searchId: string;
542
574
  }
543
575
 
@@ -645,6 +677,7 @@ export declare interface ProductVariant {
645
677
  image: Image_2 | null;
646
678
  selectedOptions: ProductOption[];
647
679
  metafields: Metafield[];
680
+ inventoryLevels: Record<number, number>;
648
681
  }
649
682
 
650
683
  declare interface QueryResult<P extends Product = Product> {
@@ -754,6 +787,10 @@ export declare interface SearchQuery {
754
787
  filters?: unknown;
755
788
  tuning?: LayersTuning;
756
789
  signal?: AbortSignal;
790
+ dynamicLinking?: Record<string, string | number | (string | number)[]>;
791
+ params?: Record<string, unknown>;
792
+ paramDefinitions?: ParamDefinitions;
793
+ transformBody?: BodyTransformer;
757
794
  }
758
795
 
759
796
  export declare interface SearchResult<P extends Product = Product> extends LayersPagination {