@depict-ai/ui 1.2.2 → 1.3.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.
package/README.md CHANGED
@@ -4,4 +4,6 @@ You're most likely looking for https://www.npmjs.com/package/@depict-ai/js-ui or
4
4
 
5
5
  Breaking changes:
6
6
 
7
- - 1.1.0 made the `include_input_field` option of `SearchPage` default to true
7
+ - 1.1.0 made the `include_input_field` option of `SearchPage` default to true
8
+ - 1.2.0 added `page_url_creator` and changed typing to support it. The only breaking change is that this potentially causes type errors where the resolution is to move the generics to the provider instead of the SearchPage and CategoryPage components.
9
+ - 1.3.0 moved `depict-filter-sort-mobile-modal-container` from being a class to being an id
@@ -43,7 +43,7 @@ $parcel$export(module.exports, "defaultGridSpacing", () => $a3280f0aad997933$exp
43
43
  $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$export$c3834fa86c616831);
44
44
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
45
45
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
46
- /*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.2.2";
46
+ /*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.3.0";
47
47
 
48
48
 
49
49
 
@@ -371,7 +371,11 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
371
371
  this.page_url_creator = page_url_creator;
372
372
  }
373
373
  async suggest(input_req) {
374
- const request = this.#add_ids_to_request(input_req);
374
+ const with_ids = this.#add_ids_to_request(input_req);
375
+ const metaData = await this.#get_metadata?.();
376
+ const request = metaData ? Object.assign(with_ids, {
377
+ metadata: JSON.stringify(metaData)
378
+ }) : with_ids;
375
379
  const url = (0, $57o7A$depictaiutilishared.make_url_with_query_params)($e1d6c0f3d89d531c$var$search_base_url + "suggestions", request);
376
380
  const results = await (0, $57o7A$depictaiutilishared.fetch_retry)((0, $57o7A$depictaiutilishared.add_version_query_params)(url));
377
381
  attempt_to_return_api_response: {
@@ -3912,7 +3916,7 @@ function $02215fefc955d01e$export$28f6150e232898de() {
3912
3916
  }
3913
3917
 
3914
3918
 
3915
- const $1872ceb56ede7a52$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<button class="clear minor"></button>`, 2), $1872ceb56ede7a52$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="depict plp depict-filter-sort-mobile-modal-container"><div class="depict-filter-sort-modal-backdrop"></div><button class="dismiss-modal"></button><div class="filter-sort-modal"><div class="body"><!#><!/><!#><!/></div><div class="bottom-row"><!#><!/><button class="show-results major"></button></div></div></div>`, 20), $1872ceb56ede7a52$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<details class="sorting"></details>`, 2), $1872ceb56ede7a52$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<summary class="sort-filter-summary"><div class="summary"><div class="left-els"><!#><!/><span></span></div><!#><!/></div></summary>`, 12), $1872ceb56ede7a52$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="body"></div>`, 2), $1872ceb56ede7a52$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<details class="filters"></details>`, 2), $1872ceb56ede7a52$var$_tmpl$7 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<b></b>`, 2);
3919
+ const $1872ceb56ede7a52$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<button class="clear minor"></button>`, 2), $1872ceb56ede7a52$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="depict plp" id="depict-filter-sort-mobile-modal-container"><div class="depict-filter-sort-modal-backdrop"></div><button class="dismiss-modal"></button><div class="filter-sort-modal"><div class="body"><!#><!/><!#><!/></div><div class="bottom-row"><!#><!/><button class="show-results major"></button></div></div></div>`, 20), $1872ceb56ede7a52$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<details class="sorting"></details>`, 2), $1872ceb56ede7a52$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<summary class="sort-filter-summary"><div class="summary"><div class="left-els"><!#><!/><span></span></div><!#><!/></div></summary>`, 12), $1872ceb56ede7a52$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="body"></div>`, 2), $1872ceb56ede7a52$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<details class="filters"></details>`, 2), $1872ceb56ede7a52$var$_tmpl$7 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<b></b>`, 2);
3916
3920
  const $1872ceb56ede7a52$var$no_go_selector = ".range .range-group";
3917
3921
  function $1872ceb56ede7a52$export$9bf11afa910f536e({ args_for_sorting_: args_for_sorting_ , args_for_filtering_: args_for_filtering_ , search_filters_open_: [get_search_filters_open, set_search_filters_open] , search_sorting_open_: [get_search_sorting_open, set_search_sorting_open] , dismiss_modal_: dismiss_modal_ , register_closing_animation_: register_closing_animation_ , formatted_number_of_results_: formatted_number_of_results_ , i18n_: i18n_ }) {
3918
3922
  (0, $ca1176b694a6ee2e$export$fe334901e8bebd57)();
@@ -2,7 +2,7 @@ import {add_to_version_info as $gco9i$add_to_version_info, observer as $gco9i$ob
2
2
  import {createRoot as $gco9i$createRoot, createSignal as $gco9i$createSignal, getOwner as $gco9i$getOwner, runWithOwner as $gco9i$runWithOwner, onCleanup as $gco9i$onCleanup, createComputed as $gco9i$createComputed, createRenderEffect as $gco9i$createRenderEffect, createEffect as $gco9i$createEffect, untrack as $gco9i$untrack, batch as $gco9i$batch, createResource as $gco9i$createResource, createMemo as $gco9i$createMemo, Show as $gco9i$Show, createReaction as $gco9i$createReaction, Suspense as $gco9i$Suspense, on as $gco9i$on, ErrorBoundary as $gco9i$ErrorBoundary, For as $gco9i$For, Index as $gco9i$Index} from "solid-js";
3
3
  import {template as $gco9i$template, getNextElement as $gco9i$getNextElement, spread as $gco9i$spread, mergeProps as $gco9i$mergeProps, runHydrationEvents as $gco9i$runHydrationEvents, effect as $gco9i$effect, setAttribute as $gco9i$setAttribute, insert as $gco9i$insert, isServer as $gco9i$isServer, createComponent as $gco9i$createComponent, getNextMarker as $gco9i$getNextMarker, use as $gco9i$use, memo as $gco9i$memo, addEventListener as $gco9i$addEventListener, delegateEvents as $gco9i$delegateEvents, classList as $gco9i$classList, style as $gco9i$style, className as $gco9i$className, Dynamic as $gco9i$Dynamic} from "solid-js/web";
4
4
 
5
- /*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.2.2";
5
+ /*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.3.0";
6
6
 
7
7
 
8
8
 
@@ -330,7 +330,11 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
330
330
  this.page_url_creator = page_url_creator;
331
331
  }
332
332
  async suggest(input_req) {
333
- const request = this.#add_ids_to_request(input_req);
333
+ const with_ids = this.#add_ids_to_request(input_req);
334
+ const metaData = await this.#get_metadata?.();
335
+ const request = metaData ? Object.assign(with_ids, {
336
+ metadata: JSON.stringify(metaData)
337
+ }) : with_ids;
334
338
  const url = (0, $gco9i$make_url_with_query_params)($7fa23e2a0079eca4$var$search_base_url + "suggestions", request);
335
339
  const results = await (0, $gco9i$fetch_retry)((0, $gco9i$add_version_query_params)(url));
336
340
  attempt_to_return_api_response: {
@@ -3871,7 +3875,7 @@ function $b9bf7fce0ae60241$export$28f6150e232898de() {
3871
3875
  }
3872
3876
 
3873
3877
 
3874
- const $757dac7f7c6c5241$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<button class="clear minor"></button>`, 2), $757dac7f7c6c5241$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<div class="depict plp depict-filter-sort-mobile-modal-container"><div class="depict-filter-sort-modal-backdrop"></div><button class="dismiss-modal"></button><div class="filter-sort-modal"><div class="body"><!#><!/><!#><!/></div><div class="bottom-row"><!#><!/><button class="show-results major"></button></div></div></div>`, 20), $757dac7f7c6c5241$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<details class="sorting"></details>`, 2), $757dac7f7c6c5241$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<summary class="sort-filter-summary"><div class="summary"><div class="left-els"><!#><!/><span></span></div><!#><!/></div></summary>`, 12), $757dac7f7c6c5241$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<div class="body"></div>`, 2), $757dac7f7c6c5241$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<details class="filters"></details>`, 2), $757dac7f7c6c5241$var$_tmpl$7 = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<b></b>`, 2);
3878
+ const $757dac7f7c6c5241$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<button class="clear minor"></button>`, 2), $757dac7f7c6c5241$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<div class="depict plp" id="depict-filter-sort-mobile-modal-container"><div class="depict-filter-sort-modal-backdrop"></div><button class="dismiss-modal"></button><div class="filter-sort-modal"><div class="body"><!#><!/><!#><!/></div><div class="bottom-row"><!#><!/><button class="show-results major"></button></div></div></div>`, 20), $757dac7f7c6c5241$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<details class="sorting"></details>`, 2), $757dac7f7c6c5241$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<summary class="sort-filter-summary"><div class="summary"><div class="left-els"><!#><!/><span></span></div><!#><!/></div></summary>`, 12), $757dac7f7c6c5241$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<div class="body"></div>`, 2), $757dac7f7c6c5241$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<details class="filters"></details>`, 2), $757dac7f7c6c5241$var$_tmpl$7 = /*@__PURE__*/ (0, /*@__PURE__*/$gco9i$template)(`<b></b>`, 2);
3875
3879
  const $757dac7f7c6c5241$var$no_go_selector = ".range .range-group";
3876
3880
  function $757dac7f7c6c5241$export$9bf11afa910f536e({ args_for_sorting_: args_for_sorting_ , args_for_filtering_: args_for_filtering_ , search_filters_open_: [get_search_filters_open, set_search_filters_open] , search_sorting_open_: [get_search_sorting_open, set_search_sorting_open] , dismiss_modal_: dismiss_modal_ , register_closing_animation_: register_closing_animation_ , formatted_number_of_results_: formatted_number_of_results_ , i18n_: i18n_ }) {
3877
3881
  (0, $aea1edf92433e81e$export$fe334901e8bebd57)();
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { SearchRequest, SearchFilter } from "@depict-ai/types/api/SearchRequest"
7
7
  import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
8
8
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
9
9
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
- export const version = "1.2.2";
10
+ export const version = "1.3.0";
11
11
  type PageURLCreatorAlwaysThereData = {
12
12
  merchant: string;
13
13
  market: string;
@@ -26,13 +26,13 @@ export type ModernDisplayWithPageUrl<T extends ModernDisplay> = {
26
26
  page_url: string;
27
27
  })[] : T[K];
28
28
  };
29
+ type PageURLCreatorOptions<InputDisplay extends ModernDisplay> = (PageURLCreatorAlwaysThereData & PageURLCreatorCategoryData) | (PageURLCreatorAlwaysThereData & PageURLCreatorProductData<InputDisplay>);
29
30
  /**
30
31
  * PageUrlCreator is, in its most basic form, a function that takes in a list of categories or products and returns a list of page_urls for the provided categories or products.
31
32
  * It's main use case is to allow for the creation of links to the product or category pages on the merchant's site.
32
33
  * It can also be used for the depict customers which already have links to change those links (i.e. for staging sites).
33
34
  * Also, it can be used to enrich the data for each product card in a batched way, which is why it can be an async function and return a whole display in the case of products.
34
35
  */
35
- type PageURLCreatorOptions<InputDisplay extends ModernDisplay> = (PageURLCreatorAlwaysThereData & PageURLCreatorCategoryData) | (PageURLCreatorAlwaysThereData & PageURLCreatorProductData<InputDisplay>);
36
36
  export type PageURLCreator<InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay | never> = (options: PageURLCreatorOptions<InputDisplay>) => (typeof options)["type"] extends "categories" ? CanBePromiseWrapped<{
37
37
  page_url: string;
38
38
  }[]> : CanBePromiseWrapped<{
@@ -43,7 +43,7 @@ $parcel$export(module.exports, "defaultGridSpacing", () => $a3280f0aad997933$exp
43
43
  $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$export$c3834fa86c616831);
44
44
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
45
45
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
46
- /*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.2.2";
46
+ /*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.3.0";
47
47
 
48
48
 
49
49
 
@@ -355,7 +355,11 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
355
355
  this.page_url_creator = page_url_creator;
356
356
  }
357
357
  async suggest(input_req) {
358
- const request = this.#add_ids_to_request(input_req);
358
+ const with_ids = this.#add_ids_to_request(input_req);
359
+ const metaData = await this.#get_metadata?.();
360
+ const request = metaData ? Object.assign(with_ids, {
361
+ metadata: JSON.stringify(metaData)
362
+ }) : with_ids;
359
363
  const url = (0, $diwD4$depictaiutilishared.make_url_with_query_params)($e1d6c0f3d89d531c$var$search_base_url + "suggestions", request);
360
364
  const results = await (0, $diwD4$depictaiutilishared.fetch_retry)((0, $diwD4$depictaiutilishared.add_version_query_params)(url));
361
365
  attempt_to_return_api_response: {
@@ -3300,7 +3304,7 @@ const $1872ceb56ede7a52$var$_tmpl$ = [
3300
3304
  "</button>"
3301
3305
  ], $1872ceb56ede7a52$var$_tmpl$2 = [
3302
3306
  "<div",
3303
- ' class="depict plp depict-filter-sort-mobile-modal-container"><div class="depict-filter-sort-modal-backdrop"></div><button class="dismiss-modal"',
3307
+ ' class="depict plp" id="depict-filter-sort-mobile-modal-container"><div class="depict-filter-sort-modal-backdrop"></div><button class="dismiss-modal"',
3304
3308
  ">",
3305
3309
  '</button><div class="filter-sort-modal"><div class="body" style="',
3306
3310
  '"><!--#-->',
@@ -2,7 +2,7 @@ import {add_to_version_info as $cV3wj$add_to_version_info, observer as $cV3wj$ob
2
2
  import {createRoot as $cV3wj$createRoot, createSignal as $cV3wj$createSignal, getOwner as $cV3wj$getOwner, runWithOwner as $cV3wj$runWithOwner, onCleanup as $cV3wj$onCleanup, createComputed as $cV3wj$createComputed, createRenderEffect as $cV3wj$createRenderEffect, createEffect as $cV3wj$createEffect, untrack as $cV3wj$untrack, batch as $cV3wj$batch, createResource as $cV3wj$createResource, createMemo as $cV3wj$createMemo, Show as $cV3wj$Show, createReaction as $cV3wj$createReaction, Suspense as $cV3wj$Suspense, on as $cV3wj$on, ErrorBoundary as $cV3wj$ErrorBoundary, For as $cV3wj$For, Index as $cV3wj$Index} from "solid-js";
3
3
  import {ssrElement as $cV3wj$ssrElement, ssr as $cV3wj$ssr, ssrHydrationKey as $cV3wj$ssrHydrationKey, ssrAttribute as $cV3wj$ssrAttribute, escape as $cV3wj$escape, isServer as $cV3wj$isServer, createComponent as $cV3wj$createComponent, ssrClassList as $cV3wj$ssrClassList, insert as $cV3wj$insert, ssrStyle as $cV3wj$ssrStyle, Dynamic as $cV3wj$Dynamic, mergeProps as $cV3wj$mergeProps} from "solid-js/web";
4
4
 
5
- /*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.2.2";
5
+ /*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.3.0";
6
6
 
7
7
 
8
8
 
@@ -314,7 +314,11 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
314
314
  this.page_url_creator = page_url_creator;
315
315
  }
316
316
  async suggest(input_req) {
317
- const request = this.#add_ids_to_request(input_req);
317
+ const with_ids = this.#add_ids_to_request(input_req);
318
+ const metaData = await this.#get_metadata?.();
319
+ const request = metaData ? Object.assign(with_ids, {
320
+ metadata: JSON.stringify(metaData)
321
+ }) : with_ids;
318
322
  const url = (0, $cV3wj$make_url_with_query_params)($7fa23e2a0079eca4$var$search_base_url + "suggestions", request);
319
323
  const results = await (0, $cV3wj$fetch_retry)((0, $cV3wj$add_version_query_params)(url));
320
324
  attempt_to_return_api_response: {
@@ -3259,7 +3263,7 @@ const $757dac7f7c6c5241$var$_tmpl$ = [
3259
3263
  "</button>"
3260
3264
  ], $757dac7f7c6c5241$var$_tmpl$2 = [
3261
3265
  "<div",
3262
- ' class="depict plp depict-filter-sort-mobile-modal-container"><div class="depict-filter-sort-modal-backdrop"></div><button class="dismiss-modal"',
3266
+ ' class="depict plp" id="depict-filter-sort-mobile-modal-container"><div class="depict-filter-sort-modal-backdrop"></div><button class="dismiss-modal"',
3263
3267
  ">",
3264
3268
  '</button><div class="filter-sort-modal"><div class="body" style="',
3265
3269
  '"><!--#-->',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
5
5
  "packageManager": "yarn@3.2.2",
6
6
  "main": "dist/client/main.cjs",
@@ -124,9 +124,9 @@
124
124
  "ts-jest": "^29.0.3"
125
125
  },
126
126
  "dependencies": {
127
- "@depict-ai/plp-styling": "^1.0.24",
128
- "@depict-ai/types": "^1.0.27",
129
- "@depict-ai/utilishared": "^1.0.23",
127
+ "@depict-ai/plp-styling": "^1.0.25",
128
+ "@depict-ai/types": "^1.0.28",
129
+ "@depict-ai/utilishared": "^1.0.24",
130
130
  "solid-js": "^1.7.3"
131
131
  },
132
132
  "types": "dist/index.d.ts",