@commerce-blocks/sdk 1.0.0 → 1.1.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 +37 -2
  2. package/dist/index.js +1343 -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;
@@ -526,6 +540,14 @@ declare interface PageMeta {
526
540
  lastFetched: number;
527
541
  }
528
542
 
543
+ export declare type ParamDefinition<T = unknown> = (input: ParamInput) => T | undefined | null;
544
+
545
+ export declare type ParamDefinitions = Record<string, ParamDefinition>;
546
+
547
+ export declare interface ParamInput {
548
+ key: string;
549
+ }
550
+
529
551
  declare interface PredictiveSearchResponse {
530
552
  matchedQueries: {
531
553
  query_text: string;
@@ -535,9 +557,18 @@ declare interface PredictiveSearchResponse {
535
557
  normalizedQuery: string;
536
558
  }
537
559
 
538
- declare type PrepareSearchQuery = Pick<SearchQuery, 'query' | 'filters' | 'tuning' | 'signal'>;
560
+ export declare interface PrepareSearchQuery {
561
+ query: string;
562
+ filters?: unknown;
563
+ tuning?: LayersTuning;
564
+ signal?: AbortSignal;
565
+ dynamicLinking?: Record<string, string | number | (string | number)[]>;
566
+ params?: Record<string, unknown>;
567
+ paramDefinitions?: ParamDefinitions;
568
+ transformBody?: BodyTransformer;
569
+ }
539
570
 
540
- declare interface PrepareSearchResult {
571
+ export declare interface PrepareSearchResult {
541
572
  searchId: string;
542
573
  }
543
574
 
@@ -754,6 +785,10 @@ export declare interface SearchQuery {
754
785
  filters?: unknown;
755
786
  tuning?: LayersTuning;
756
787
  signal?: AbortSignal;
788
+ dynamicLinking?: Record<string, string | number | (string | number)[]>;
789
+ params?: Record<string, unknown>;
790
+ paramDefinitions?: ParamDefinitions;
791
+ transformBody?: BodyTransformer;
757
792
  }
758
793
 
759
794
  export declare interface SearchResult<P extends Product = Product> extends LayersPagination {