@constructor-io/constructorio-node 5.5.1 → 5.8.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.
@@ -15,6 +15,7 @@ function createQuizUrl(quizId, parameters, userParameters, options, path) {
15
15
  clientId,
16
16
  userId,
17
17
  segments,
18
+ originReferrer,
18
19
  } = userParameters;
19
20
  const serviceUrl = 'https://quizzes.cnstrc.com';
20
21
  let queryParams = { c: version };
@@ -34,6 +35,11 @@ function createQuizUrl(quizId, parameters, userParameters, options, path) {
34
35
  queryParams.ui = String(userId);
35
36
  }
36
37
 
38
+ // Pull origin referrer from userParameters
39
+ if (originReferrer && typeof originReferrer === 'string') {
40
+ queryParams.origin_referrer = originReferrer;
41
+ }
42
+
37
43
  // Validate quiz id is provided
38
44
  if (!quizId || typeof quizId !== 'string') {
39
45
  throw new Error('quizId is a required parameter of type string');
@@ -124,6 +130,7 @@ class Quizzes {
124
130
  * @param {string} [userParameters.userId] - User ID, utilized to personalize results
125
131
  * @param {string[]} [userParameters.segments] - User segments
126
132
  * @param {object} [userParameters.testCells] - User test cells
133
+ * @param {string} [userParameters.originReferrer] - Client page URL (including path)
127
134
  * @param {string} [userParameters.userIp] - Origin user IP, from client
128
135
  * @param {string} [userParameters.userAgent] - Origin user agent, from client
129
136
  * @param {object} [networkParameters] - Parameters relevant to the network request
@@ -207,6 +214,7 @@ class Quizzes {
207
214
  * @param {string} [userParameters.userId] - User ID, utilized to personalize results
208
215
  * @param {string[]} [userParameters.segments] - User segments
209
216
  * @param {object} [userParameters.testCells] - User test cells
217
+ * @param {string} [userParameters.originReferrer] - Client page URL (including path)
210
218
  * @param {string} [userParameters.userIp] - Origin user IP, from client
211
219
  * @param {string} [userParameters.userAgent] - Origin user agent, from client
212
220
  * @param {object} [networkParameters] - Parameters relevant to the network request
@@ -15,6 +15,7 @@ function createRecommendationsUrl(podId, parameters, userParameters, options) {
15
15
  clientId,
16
16
  userId,
17
17
  segments,
18
+ originReferrer,
18
19
  } = userParameters;
19
20
  let queryParams = { c: version };
20
21
 
@@ -37,6 +38,11 @@ function createRecommendationsUrl(podId, parameters, userParameters, options) {
37
38
  queryParams.ui = String(userId);
38
39
  }
39
40
 
41
+ // Pull origin referrer from userParameters
42
+ if (originReferrer && typeof originReferrer === 'string') {
43
+ queryParams.origin_referrer = originReferrer;
44
+ }
45
+
40
46
  if (parameters) {
41
47
  const {
42
48
  numResults,
@@ -147,6 +153,7 @@ class Recommendations {
147
153
  * @param {string} [userParameters.userId] - User ID, utilized to personalize results
148
154
  * @param {string[]} [userParameters.segments] - User segments
149
155
  * @param {object} [userParameters.testCells] - User test cells
156
+ * @param {string} [userParameters.originReferrer] - Client page URL (including path)
150
157
  * @param {string} [userParameters.userIp] - Origin user IP, from client
151
158
  * @param {string} [userParameters.userAgent] - Origin user agent, from client
152
159
  * @param {object} [networkParameters] - Parameters relevant to the network request
@@ -18,6 +18,7 @@ function createSearchUrl(query, parameters, userParameters, options, isVoiceSear
18
18
  userId,
19
19
  segments,
20
20
  testCells,
21
+ originReferrer,
21
22
  } = userParameters;
22
23
  let queryParams = { c: version };
23
24
 
@@ -47,6 +48,11 @@ function createSearchUrl(query, parameters, userParameters, options, isVoiceSear
47
48
  queryParams.ui = String(userId);
48
49
  }
49
50
 
51
+ // Pull origin referrer from userParameters
52
+ if (originReferrer && typeof originReferrer === 'string') {
53
+ queryParams.origin_referrer = originReferrer;
54
+ }
55
+
50
56
  if (parameters) {
51
57
  const {
52
58
  page,
@@ -186,6 +192,7 @@ class Search {
186
192
  * @param {string} [userParameters.userId] - User ID, utilized to personalize results
187
193
  * @param {string[]} [userParameters.segments] - User segments
188
194
  * @param {object} [userParameters.testCells] - User test cells
195
+ * @param {string} [userParameters.originReferrer] - Client page URL (including path)
189
196
  * @param {string} [userParameters.userIp] - Origin user IP, from client
190
197
  * @param {string} [userParameters.userAgent] - Origin user agent, from client
191
198
  * @param {object} [networkParameters] - Parameters relevant to the network request
@@ -288,6 +295,7 @@ class Search {
288
295
  * @param {string} [userParameters.userId] - User ID, utilized to personalize results
289
296
  * @param {string[]} [userParameters.segments] - User segments
290
297
  * @param {object} [userParameters.testCells] - User test cells
298
+ * @param {string} [userParameters.originReferrer] - Client page URL (including path)
291
299
  * @param {string} [userParameters.userIp] - Origin user IP, from client
292
300
  * @param {string} [userParameters.userAgent] - Origin user agent, from client
293
301
  * @param {object} [networkParameters] - Parameters relevant to the network request
@@ -15,6 +15,10 @@ import {
15
15
  SynonymGroup,
16
16
  SearchabilityConfiguration,
17
17
  SearchabilityConfigurationResponse,
18
+ FacetConfigurationV2,
19
+ FacetConfigurationV2Response,
20
+ SearchabilityConfigurationV2,
21
+ SearchabilityConfigurationV2Response,
18
22
  } from '.';
19
23
 
20
24
  export default Catalog;
@@ -173,6 +177,7 @@ export interface ReplaceCatalogParameters {
173
177
  items?: File | fs.ReadStream | Duplex
174
178
  variations?: File | fs.ReadStream | Duplex;
175
179
  itemGroups?: File | fs.ReadStream | Duplex;
180
+ format?: 'csv' | 'jsonl';
176
181
  }
177
182
 
178
183
  export interface UpdateCatalogParameters extends ReplaceCatalogParameters {}
@@ -185,6 +190,7 @@ export interface PatchCatalogParameters {
185
190
  items?: File | fs.ReadStream | Duplex
186
191
  variations?: File | fs.ReadStream | Duplex;
187
192
  itemGroups?: File | fs.ReadStream | Duplex;
193
+ format?: 'csv' | 'jsonl';
188
194
  }
189
195
 
190
196
  export interface ReplaceCatalogUsingTarArchiveParameters {
@@ -192,6 +198,7 @@ export interface ReplaceCatalogUsingTarArchiveParameters {
192
198
  notificationEmail?: string;
193
199
  force?: boolean;
194
200
  tarArchive?: File | fs.ReadStream | Duplex;
201
+ format?: 'csv' | 'jsonl';
195
202
  }
196
203
 
197
204
  export interface UpdateCatalogUsingTarArchiveParameters
@@ -272,6 +279,86 @@ export interface PatchSearchabilitiesParameters {
272
279
  section?: string;
273
280
  }
274
281
 
282
+ // V2 Facet Configuration Parameters
283
+ export type AddFacetConfigurationV2Parameters = FacetConfigurationV2;
284
+
285
+ export type ReplaceFacetConfigurationV2Parameters = FacetConfigurationV2;
286
+
287
+ export interface GetFacetConfigurationsV2Parameters {
288
+ page?: number;
289
+ numResultsPerPage?: number;
290
+ offset?: number;
291
+ section?: string;
292
+ }
293
+
294
+ export interface GetFacetConfigurationV2Parameters {
295
+ name: string;
296
+ section?: string;
297
+ }
298
+
299
+ export interface CreateOrReplaceFacetConfigurationsV2Parameters {
300
+ facetConfigurations: FacetConfigurationV2[];
301
+ section?: string;
302
+ }
303
+
304
+ export interface ModifyFacetConfigurationsV2Parameters {
305
+ facetConfigurations: (Partial<FacetConfigurationV2> & { name: string })[];
306
+ section?: string;
307
+ }
308
+
309
+ export interface RemoveFacetConfigurationV2Parameters {
310
+ name: string;
311
+ section?: string;
312
+ }
313
+
314
+ // V2 Searchabilities Parameters
315
+ export interface RetrieveSearchabilitiesV2Parameters {
316
+ name?: string;
317
+ page?: number;
318
+ offset?: number;
319
+ numResultsPerPage?: number;
320
+ fuzzySearchable?: boolean;
321
+ exactSearchable?: boolean;
322
+ displayable?: boolean;
323
+ matchType?: 'and' | 'or';
324
+ sortBy?: 'name';
325
+ sortOrder?: 'ascending' | 'descending';
326
+ section?: string;
327
+ }
328
+
329
+ export interface RetrieveSearchabilityV2Parameters {
330
+ name: string;
331
+ section?: string;
332
+ }
333
+
334
+ export interface PatchSearchabilitiesV2Parameters {
335
+ searchabilities: SearchabilityConfigurationV2[];
336
+ skipRebuild?: boolean;
337
+ section?: string;
338
+ }
339
+
340
+ export interface PatchSearchabilityV2Parameters {
341
+ name: string;
342
+ fuzzySearchable?: boolean;
343
+ exactSearchable?: boolean;
344
+ displayable?: boolean;
345
+ hidden?: boolean;
346
+ skipRebuild?: boolean;
347
+ section?: string;
348
+ }
349
+
350
+ export interface DeleteSearchabilitiesV2Parameters {
351
+ searchabilities: { name: string }[];
352
+ skipRebuild?: boolean;
353
+ section?: string;
354
+ }
355
+
356
+ export interface DeleteSearchabilityV2Parameters {
357
+ name: string;
358
+ skipRebuild?: boolean;
359
+ section?: string;
360
+ }
361
+
275
362
  interface CatalogMutationResponse {
276
363
  task_id: string;
277
364
  task_status_path: string;
@@ -512,11 +599,13 @@ declare class Catalog {
512
599
  networkParameters?: NetworkParameters
513
600
  ): Promise<CatalogMutationResponse>;
514
601
 
602
+ /** @deprecated Use addFacetConfigurationV2 instead. */
515
603
  addFacetConfiguration(
516
604
  parameters: FacetConfiguration,
517
605
  networkParameters?: NetworkParameters
518
606
  ): Promise<FacetConfiguration>;
519
607
 
608
+ /** @deprecated Use getFacetConfigurationsV2 instead. */
520
609
  getFacetConfigurations(
521
610
  parameters: GetFacetConfigurationsParameters,
522
611
  networkParameters?: NetworkParameters
@@ -526,26 +615,31 @@ declare class Catalog {
526
615
  [key: string]: any;
527
616
  }>;
528
617
 
618
+ /** @deprecated Use getFacetConfigurationV2 instead. */
529
619
  getFacetConfiguration(
530
620
  parameters: GetFacetConfigurationParameters,
531
621
  networkParameters?: NetworkParameters
532
622
  ): Promise<FacetConfiguration>;
533
623
 
624
+ /** @deprecated Use modifyFacetConfigurationsV2 instead. */
534
625
  modifyFacetConfigurations(
535
626
  parameters?: ModifyFacetConfigurationsParameters,
536
627
  networkParameters?: NetworkParameters
537
628
  ): Promise<FacetConfiguration[]>;
538
629
 
630
+ /** @deprecated Use replaceFacetConfigurationV2 instead. */
539
631
  replaceFacetConfiguration(
540
632
  parameters: FacetConfiguration,
541
633
  networkParameters?: NetworkParameters
542
634
  ): Promise<FacetConfiguration>;
543
635
 
636
+ /** @deprecated Use modifyFacetConfigurationV2 instead. */
544
637
  modifyFacetConfiguration(
545
638
  parameters: FacetConfiguration,
546
639
  networkParameters?: NetworkParameters
547
640
  ): Promise<FacetConfiguration>;
548
641
 
642
+ /** @deprecated Use removeFacetConfigurationV2 instead. */
549
643
  removeFacetConfiguration(
550
644
  parameters?: RemoveFacetConfigurationParameters,
551
645
  networkParameters?: NetworkParameters
@@ -590,6 +684,7 @@ declare class Catalog {
590
684
  networkParameters?: NetworkParameters
591
685
  ): Promise<FacetOptionConfiguration>;
592
686
 
687
+ /** @deprecated Use retrieveSearchabilitiesV2 instead. */
593
688
  retrieveSearchabilities(
594
689
  parameters?: RetrieveSearchabilitiesParameters,
595
690
  networkParameters?: NetworkParameters
@@ -598,10 +693,99 @@ declare class Catalog {
598
693
  total_count: number;
599
694
  }>;
600
695
 
696
+ /** @deprecated Use patchSearchabilitiesV2 instead. */
601
697
  patchSearchabilities(
602
698
  parameters: PatchSearchabilitiesParameters,
603
699
  networkParameters?: NetworkParameters
604
700
  ): Promise<{
605
701
  searchabilities: SearchabilityConfigurationResponse[];
606
702
  }>;
703
+
704
+ // V2 Facet Configuration Methods
705
+ addFacetConfigurationV2(
706
+ parameters: AddFacetConfigurationV2Parameters,
707
+ networkParameters?: NetworkParameters
708
+ ): Promise<FacetConfigurationV2Response>;
709
+
710
+ getFacetConfigurationsV2(
711
+ parameters?: GetFacetConfigurationsV2Parameters,
712
+ networkParameters?: NetworkParameters
713
+ ): Promise<{
714
+ facets: FacetConfigurationV2Response[];
715
+ total_count: number;
716
+ }>;
717
+
718
+ getFacetConfigurationV2(
719
+ parameters: GetFacetConfigurationV2Parameters,
720
+ networkParameters?: NetworkParameters
721
+ ): Promise<FacetConfigurationV2Response>;
722
+
723
+ createOrReplaceFacetConfigurationsV2(
724
+ parameters: CreateOrReplaceFacetConfigurationsV2Parameters,
725
+ networkParameters?: NetworkParameters
726
+ ): Promise<{
727
+ facets: FacetConfigurationV2Response[];
728
+ }>;
729
+
730
+ modifyFacetConfigurationsV2(
731
+ parameters: ModifyFacetConfigurationsV2Parameters,
732
+ networkParameters?: NetworkParameters
733
+ ): Promise<{
734
+ facets: FacetConfigurationV2Response[];
735
+ }>;
736
+
737
+ replaceFacetConfigurationV2(
738
+ parameters: ReplaceFacetConfigurationV2Parameters,
739
+ networkParameters?: NetworkParameters
740
+ ): Promise<FacetConfigurationV2Response>;
741
+
742
+ modifyFacetConfigurationV2(
743
+ parameters: Partial<FacetConfigurationV2> & { name: string },
744
+ networkParameters?: NetworkParameters
745
+ ): Promise<FacetConfigurationV2Response>;
746
+
747
+ removeFacetConfigurationV2(
748
+ parameters: RemoveFacetConfigurationV2Parameters,
749
+ networkParameters?: NetworkParameters
750
+ ): Promise<FacetConfigurationV2Response>;
751
+
752
+ // V2 Searchabilities Methods
753
+ retrieveSearchabilitiesV2(
754
+ parameters?: RetrieveSearchabilitiesV2Parameters,
755
+ networkParameters?: NetworkParameters
756
+ ): Promise<{
757
+ searchabilities: SearchabilityConfigurationV2Response[];
758
+ total_count: number;
759
+ }>;
760
+
761
+ retrieveSearchabilityV2(
762
+ parameters: RetrieveSearchabilityV2Parameters,
763
+ networkParameters?: NetworkParameters
764
+ ): Promise<SearchabilityConfigurationV2Response>;
765
+
766
+ patchSearchabilitiesV2(
767
+ parameters: PatchSearchabilitiesV2Parameters,
768
+ networkParameters?: NetworkParameters
769
+ ): Promise<{
770
+ searchabilities: SearchabilityConfigurationV2Response[];
771
+ total_count: number;
772
+ }>;
773
+
774
+ patchSearchabilityV2(
775
+ parameters: PatchSearchabilityV2Parameters,
776
+ networkParameters?: NetworkParameters
777
+ ): Promise<SearchabilityConfigurationV2Response>;
778
+
779
+ deleteSearchabilitiesV2(
780
+ parameters: DeleteSearchabilitiesV2Parameters,
781
+ networkParameters?: NetworkParameters
782
+ ): Promise<{
783
+ searchabilities: SearchabilityConfigurationV2Response[];
784
+ total_count: number;
785
+ }>;
786
+
787
+ deleteSearchabilityV2(
788
+ parameters: DeleteSearchabilityV2Parameters,
789
+ networkParameters?: NetworkParameters
790
+ ): Promise<SearchabilityConfigurationV2Response>;
607
791
  }
@@ -27,6 +27,7 @@ export interface UserParameters {
27
27
  userId?: string;
28
28
  segments?: string[];
29
29
  testCells?: Record<string, any>;
30
+ originReferrer?: string;
30
31
  userIp?: string;
31
32
  userAgent?: string;
32
33
  }
@@ -335,6 +336,70 @@ export interface SearchabilityConfiguration {
335
336
  hidden?: boolean,
336
337
  }
337
338
 
339
+ // V2 Facet Types
340
+ export interface FacetConfigurationV2Base {
341
+ name: string;
342
+ pathInMetadata: string;
343
+ displayName?: string;
344
+ sortOrder?: 'relevance' | 'value' | 'num_matches';
345
+ sortDescending?: boolean;
346
+ matchType?: 'any' | 'all' | 'none';
347
+ position?: number | null;
348
+ hidden?: boolean;
349
+ protected?: boolean;
350
+ countable?: boolean;
351
+ optionsLimit?: number;
352
+ data?: Record<string, unknown>;
353
+ section?: string;
354
+ }
355
+
356
+ export type FacetConfigurationV2 = FacetConfigurationV2Base & (
357
+ | { type: 'multiple' | 'hierarchical'; rangeType?: null; rangeFormat?: null; rangeInclusive?: null; rangeLimits?: null }
358
+ | { type: 'range'; rangeFormat: 'boundaries'; rangeType?: 'static'; rangeInclusive?: 'above' | 'below' | null; rangeLimits?: null }
359
+ | { type: 'range'; rangeFormat: 'options'; rangeLimits: number[]; rangeType?: 'static'; rangeInclusive?: 'above' | 'below' | null }
360
+ );
361
+
362
+ export interface FacetConfigurationV2Response {
363
+ name: string;
364
+ path_in_metadata: string;
365
+ type: 'multiple' | 'hierarchical' | 'range';
366
+ display_name?: string | null;
367
+ sort_order?: 'relevance' | 'value' | 'num_matches';
368
+ sort_descending?: boolean;
369
+ range_type?: 'static' | null;
370
+ range_format?: 'boundaries' | 'options' | null;
371
+ range_inclusive?: 'above' | 'below' | null;
372
+ range_limits?: number[] | null;
373
+ match_type?: 'any' | 'all' | 'none';
374
+ position?: number | null;
375
+ hidden?: boolean;
376
+ protected?: boolean;
377
+ countable?: boolean;
378
+ options_limit?: number;
379
+ data?: Record<string, unknown>;
380
+ created_at: string;
381
+ updated_at?: string;
382
+ }
383
+
384
+ // V2 Searchability Types
385
+ export interface SearchabilityConfigurationV2 {
386
+ name: string;
387
+ fuzzySearchable?: boolean;
388
+ exactSearchable?: boolean;
389
+ displayable?: boolean;
390
+ hidden?: boolean;
391
+ }
392
+
393
+ export interface SearchabilityConfigurationV2Response {
394
+ name: string;
395
+ fuzzy_searchable: boolean;
396
+ exact_searchable: boolean;
397
+ displayable: boolean;
398
+ hidden: boolean;
399
+ created_at: string;
400
+ updated_at?: string;
401
+ }
402
+
338
403
  export interface ItemTracked {
339
404
  itemName?: string;
340
405
  itemId?: string;