@depict-ai/react-ui 3.0.0 → 3.0.2

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/latest/index.cjs CHANGED
@@ -39,7 +39,7 @@ $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fb
39
39
  $parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
40
40
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
41
41
  // Note, if you add an export here, also add one in src-server/main.ts
42
- const $db7b67857900028b$export$83d89fbfd8236492 = "3.0.0";
42
+ const $db7b67857900028b$export$83d89fbfd8236492 = "3.0.2";
43
43
  const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
44
44
  usedLocale: $2IzJs$solidjs.createSignal((0, $2IzJs$depictaiuilocales.defaultLocale)),
45
45
  search_instances: new Map(),
@@ -55,7 +55,6 @@ const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
55
55
  category_page_in_dom: $2IzJs$solidjs.createSignal(false),
56
56
  provider_is_updating: $2IzJs$solidjs.createSignal(false),
57
57
  enable_content_search: $2IzJs$solidjs.createSignal(),
58
- category_meta_title_suffix: $2IzJs$solidjs.createSignal(),
59
58
  disable_override_listing_id: $2IzJs$solidjs.createSignal()
60
59
  };
61
60
  let $b4d0d98857ed9934$var$run_on_href_change;
@@ -306,7 +305,6 @@ function $da98aca6c7d4c3f9$export$248b95d5073d5bab(disposable, stateKey) {
306
305
  usedLocale: [get_locale],
307
306
  merchant: [get_merchant],
308
307
  market: [get_market],
309
- category_meta_title_suffix: [get_category_meta_title_suffix],
310
308
  disable_override_listing_id: [get_disable_override_listing_id]
311
309
  } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
312
310
  const instance = new (0, $2IzJs$depictaiui.DepictCategory)({
@@ -328,7 +326,6 @@ function $da98aca6c7d4c3f9$export$248b95d5073d5bab(disposable, stateKey) {
328
326
  if (new_market) instance.market = new_market;
329
327
  });
330
328
  $2IzJs$solidjs.createComputed(() => instance.localization = get_locale());
331
- $2IzJs$solidjs.createComputed(() => instance.meta_title_suffix = get_category_meta_title_suffix());
332
329
  $2IzJs$solidjs.createComputed(() => instance.disable_override_listing_id = get_disable_override_listing_id());
333
330
  return {
334
331
  instance: instance,
@@ -375,7 +372,6 @@ function $24b00503eef73528$var$ActualDepictProvider(props) {
375
372
  (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData = metaData;
376
373
  (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_query_url_param_name = urlParamName;
377
374
  (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).enableCategorySuggestions = enableCategorySuggestions;
378
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_meta_title_suffix[1](props.category?.metaTitleSuffix);
379
375
  (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).disable_override_listing_id[1](props.category?.disableOverrideListingId);
380
376
  $25c0a91312868994$export$47e064413edabf36(merchant, market, sessionId);
381
377
  if (!market || !merchant) return $2IzJs$react.createElement((0, $2IzJs$react.Fragment), null, children);
@@ -404,7 +400,6 @@ function $24b00503eef73528$var$ActualDepictProvider(props) {
404
400
  get_metadata: async () => (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData,
405
401
  get_session_id: () => $2IzJs$solidjs.untrack((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).sessionId[0])
406
402
  });
407
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api.page_url_creator = props.pageURLCreator;
408
403
  (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api.display_transformers = props.displayTransformers;
409
404
  if (searchPagePath) set_search_page_path($24b00503eef73528$var$ensure_correct_formatting(searchPagePath));
410
405
  if (!search_instances.get(undefined)) {
@@ -678,10 +673,10 @@ function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
678
673
  $2IzJs$solidjs.onCleanup(() => set_category_page_in_dom(false));
679
674
  $2IzJs$solidjs.createComputed(() => {
680
675
  const {
681
- listingId: listingId
676
+ listingQuery: listingQuery
682
677
  } = props;
683
- depict_category().listing_id = listingId;
684
- if (listingId) {
678
+ depict_category().listing_query = listingQuery;
679
+ if (listingQuery) {
685
680
  set_category_state_set(true);
686
681
  (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).known_category_paths.add(location.pathname);
687
682
  }
@@ -789,6 +784,29 @@ function $67657ea54664baa8$export$4daadad26e48a2c7(props) {
789
784
  throw new Error(us + " props.recommendations needs to be a promise that is either unresolved (`new Promise(() => {})`) so we can show placeholders, or resolved (`Promise.resolve(recommendation_array)`) to the recommendations to show");
790
785
  }
791
786
  }
787
+ function $3d35ad83c8fdfa92$export$12250cb2badef3d2(props) {
788
+ const recs = props.recommendations;
789
+ if ("then" in recs)
790
+ // Run displayTransformers for RecommendationSlider and RecommendationGrid
791
+ return recs.then(async displays => {
792
+ const transformFunction = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api?.display_transformers?.products;
793
+ if (transformFunction) try {
794
+ return await transformFunction({
795
+ merchant: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).merchant[0](),
796
+ market: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).market[0](),
797
+ displays: displays
798
+ });
799
+ } catch (e) {
800
+ console.error(e);
801
+ throw new Error("Error running display transformer for recommendations", {
802
+ cause: e
803
+ }); // To stop recommendation grid from rendering
804
+ }
805
+
806
+ return displays;
807
+ });
808
+ return recs;
809
+ }
792
810
  function $8ffd7da37fdd46be$export$82cfdc85a4d15688(props) {
793
811
  $67657ea54664baa8$export$4daadad26e48a2c7(props);
794
812
  return $b4d0d98857ed9934$export$f6e64e17bd69eeef({
@@ -800,7 +818,7 @@ function $8ffd7da37fdd46be$export$5abb40edfde2a843(props, set_portals) {
800
818
  const component_portals = new Set();
801
819
  return $2IzJs$depictaiui.RecommendationSlider({
802
820
  get recommendations() {
803
- return props.recommendations;
821
+ return $3d35ad83c8fdfa92$export$12250cb2badef3d2(props);
804
822
  },
805
823
  product_card_template: display => $6081519c185fcf70$export$32024253978abdc7({
806
824
  component_props: {
@@ -825,7 +843,7 @@ function $c6b960f2a07285c8$export$e46079a2793e9ec7(props, set_portals) {
825
843
  const component_portals = new Set();
826
844
  return $2IzJs$depictaiui.RecommendationGrid({
827
845
  get recommendations() {
828
- return props.recommendations;
846
+ return $3d35ad83c8fdfa92$export$12250cb2badef3d2(props);
829
847
  },
830
848
  product_card_template: display => {
831
849
  if (0, $2IzJs$solidjsweb.isServer)
@@ -950,14 +968,17 @@ function $a134ea100690b628$var$fetchRecommendations(opts) {
950
968
  const {
951
969
  merchant: [get_merchant],
952
970
  market: [get_market],
971
+ usedLocale: [get_usedLocale],
953
972
  sessionId: [get_sessionId]
954
973
  } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
955
974
  const merchant = $2IzJs$solidjs.untrack(get_merchant);
956
975
  const market = $2IzJs$solidjs.untrack(get_market);
957
- if (!merchant || !market) throw new Error("Depict recommendations are not configured. Wrap your app in a DepictProvider.");
976
+ const locale = $2IzJs$solidjs.untrack(get_usedLocale).backend_locale_;
977
+ if (!merchant || !market || !locale) throw new Error("Depict recommendations are not configured (merchant, market or locale is falsy). Wrap your app in a DepictProvider.");
958
978
  return $2IzJs$depictaiui.fetchDepictRecommendations({
959
979
  merchant: merchant,
960
980
  market: market,
981
+ locale: locale,
961
982
  sessionId: $2IzJs$solidjs.untrack(get_sessionId),
962
983
  ...opts
963
984
  });
package/latest/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { DPC } from "@depict-ai/dpc/latest";
2
- import React, { PropsWithChildren, ReactNode, FC, ReactPortal, ReactElement } from "react";
3
- import { BaseProviderConfig, BaseSearchProviderConfig, BaseCategoryProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/latest";
2
+ import React, { PropsWithChildren, FC, ReactNode, ReactPortal, ReactElement } from "react";
3
+ import { BaseCategoryProviderConfig, BaseProviderConfig, BaseSearchProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ListingQuery, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/latest";
4
4
  import { Locale } from "@depict-ai/ui/locales/latest";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/latest";
6
- export const version = "3.0.0";
6
+ export const version = "3.0.2";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
@@ -248,9 +248,11 @@ interface SearchPageConfig<T extends Display> extends BaseSearchPageConfig, PLPC
248
248
  export function SearchPage<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never>(props: SearchPageConfig<[OutputDisplay] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<OutputDisplay>>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
249
249
  interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig, PLPConfig<T> {
250
250
  /**
251
- * The listing id to show. Ultimately, this endpoint is what gives you the listing id: https://api.depict.ai/docs#tag/Listing/operation/Get_Listings_v3_listings_get
251
+ * The listing to query Depict for. `type` can be `"listingId"` or `"externalId"` and `id` is the actual id.
252
+ * If `id` is `"listingId"`, it should be a uuid where Depict is the source of truth, you can get them here: https://api.depict.ai/docs#tag/Listing/operation/Get_Listings_v3_listings_get.
253
+ * If `id` is `"externalId"`, it should be the id of the product listing in your system - whatever was passed to Depict during data ingestion.
252
254
  */
253
- listingId: string;
255
+ listingQuery: ListingQuery;
254
256
  /**
255
257
  * categoryTitlePlugin is an optional plugin that can be used to customize the title of the category page.
256
258
  * @default CategoryTitle
@@ -531,7 +533,7 @@ interface UseSearchFieldReturn {
531
533
  * @returns {UseSearchFieldReturn}
532
534
  */
533
535
  export const useSearchField: (props?: SearchFieldProps) => UseSearchFieldReturn;
534
- type FetchRecsOptions = Omit<Parameters<typeof fetchDepictRecommendations>[0], "merchant" | "market" | "sessionId"> & ExclusiveId;
536
+ type FetchRecsOptions = Omit<Parameters<typeof fetchDepictRecommendations>[0], "merchant" | "market" | "sessionId" | "locale"> & ExclusiveId;
535
537
  interface UseFetchRecommendationsReturn<T extends Display> {
536
538
  /**
537
539
  * Fetch recommendations from the Depict API.
@@ -607,5 +609,5 @@ export const Navigation: {
607
609
  nextRouterNavigation: (router: import("next/router").NextRouter) => import("src/ui/components/DepictProvider").NavigateFunction;
608
610
  };
609
611
  export { CategoryTitle, embedded_num_products as EmbeddedNumProducts } from "@depict-ai/ui";
610
- export type { PageURLCreator, DisplayTransformers } from "@depict-ai/ui";
612
+ export type { DisplayTransformers } from "@depict-ai/ui";
611
613
  export type { Locale } from "@depict-ai/ui/locales";
package/latest/index.js CHANGED
@@ -15,7 +15,7 @@ import { renderToString as $2GFvs$renderToString } from "react-dom/server";
15
15
  // Note, if you add an export here, also add one in src-server/main.ts
16
16
  import { register_es_version } from "../multi_import_deduplicator.mjs";
17
17
  register_es_version("react-ui", "latest");
18
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "3.0.0";
18
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "3.0.2";
19
19
  const $42858f023ef23dab$export$8e769ad4338a911e = {
20
20
  usedLocale: $2GFvs$createSignal((0, $2GFvs$defaultLocale)),
21
21
  search_instances: new Map(),
@@ -31,7 +31,6 @@ const $42858f023ef23dab$export$8e769ad4338a911e = {
31
31
  category_page_in_dom: $2GFvs$createSignal(false),
32
32
  provider_is_updating: $2GFvs$createSignal(false),
33
33
  enable_content_search: $2GFvs$createSignal(),
34
- category_meta_title_suffix: $2GFvs$createSignal(),
35
34
  disable_override_listing_id: $2GFvs$createSignal()
36
35
  };
37
36
  let $c83ba9ab79386687$var$run_on_href_change;
@@ -282,7 +281,6 @@ function $9145bcf81a0216ce$export$248b95d5073d5bab(disposable, stateKey) {
282
281
  usedLocale: [get_locale],
283
282
  merchant: [get_merchant],
284
283
  market: [get_market],
285
- category_meta_title_suffix: [get_category_meta_title_suffix],
286
284
  disable_override_listing_id: [get_disable_override_listing_id]
287
285
  } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
288
286
  const instance = new (0, $2GFvs$DepictCategory)({
@@ -304,7 +302,6 @@ function $9145bcf81a0216ce$export$248b95d5073d5bab(disposable, stateKey) {
304
302
  if (new_market) instance.market = new_market;
305
303
  });
306
304
  $2GFvs$createComputed(() => instance.localization = get_locale());
307
- $2GFvs$createComputed(() => instance.meta_title_suffix = get_category_meta_title_suffix());
308
305
  $2GFvs$createComputed(() => instance.disable_override_listing_id = get_disable_override_listing_id());
309
306
  return {
310
307
  instance: instance,
@@ -351,7 +348,6 @@ function $5376eb2a386cd90d$var$ActualDepictProvider(props) {
351
348
  (0, $42858f023ef23dab$export$8e769ad4338a911e).metaData = metaData;
352
349
  (0, $42858f023ef23dab$export$8e769ad4338a911e).search_query_url_param_name = urlParamName;
353
350
  (0, $42858f023ef23dab$export$8e769ad4338a911e).enableCategorySuggestions = enableCategorySuggestions;
354
- (0, $42858f023ef23dab$export$8e769ad4338a911e).category_meta_title_suffix[1](props.category?.metaTitleSuffix);
355
351
  (0, $42858f023ef23dab$export$8e769ad4338a911e).disable_override_listing_id[1](props.category?.disableOverrideListingId);
356
352
  $a00d8f27abd5d0b0$export$47e064413edabf36(merchant, market, sessionId);
357
353
  if (!market || !merchant) return $2GFvs$createElement((0, $2GFvs$Fragment), null, children);
@@ -380,7 +376,6 @@ function $5376eb2a386cd90d$var$ActualDepictProvider(props) {
380
376
  get_metadata: async () => (0, $42858f023ef23dab$export$8e769ad4338a911e).metaData,
381
377
  get_session_id: () => $2GFvs$untrack((0, $42858f023ef23dab$export$8e769ad4338a911e).sessionId[0])
382
378
  });
383
- (0, $42858f023ef23dab$export$8e769ad4338a911e).api.page_url_creator = props.pageURLCreator;
384
379
  (0, $42858f023ef23dab$export$8e769ad4338a911e).api.display_transformers = props.displayTransformers;
385
380
  if (searchPagePath) set_search_page_path($5376eb2a386cd90d$var$ensure_correct_formatting(searchPagePath));
386
381
  if (!search_instances.get(undefined)) {
@@ -654,10 +649,10 @@ function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
654
649
  $2GFvs$onCleanup(() => set_category_page_in_dom(false));
655
650
  $2GFvs$createComputed(() => {
656
651
  const {
657
- listingId: listingId
652
+ listingQuery: listingQuery
658
653
  } = props;
659
- depict_category().listing_id = listingId;
660
- if (listingId) {
654
+ depict_category().listing_query = listingQuery;
655
+ if (listingQuery) {
661
656
  set_category_state_set(true);
662
657
  (0, $42858f023ef23dab$export$8e769ad4338a911e).known_category_paths.add(location.pathname);
663
658
  }
@@ -765,6 +760,29 @@ function $ab2bb2d1f47a25b7$export$4daadad26e48a2c7(props) {
765
760
  throw new Error(us + " props.recommendations needs to be a promise that is either unresolved (`new Promise(() => {})`) so we can show placeholders, or resolved (`Promise.resolve(recommendation_array)`) to the recommendations to show");
766
761
  }
767
762
  }
763
+ function $5ee8e057dabc10d4$export$12250cb2badef3d2(props) {
764
+ const recs = props.recommendations;
765
+ if ("then" in recs)
766
+ // Run displayTransformers for RecommendationSlider and RecommendationGrid
767
+ return recs.then(async displays => {
768
+ const transformFunction = (0, $42858f023ef23dab$export$8e769ad4338a911e).api?.display_transformers?.products;
769
+ if (transformFunction) try {
770
+ return await transformFunction({
771
+ merchant: (0, $42858f023ef23dab$export$8e769ad4338a911e).merchant[0](),
772
+ market: (0, $42858f023ef23dab$export$8e769ad4338a911e).market[0](),
773
+ displays: displays
774
+ });
775
+ } catch (e) {
776
+ console.error(e);
777
+ throw new Error("Error running display transformer for recommendations", {
778
+ cause: e
779
+ }); // To stop recommendation grid from rendering
780
+ }
781
+
782
+ return displays;
783
+ });
784
+ return recs;
785
+ }
768
786
  function $4fd5dc0e231a60d9$export$82cfdc85a4d15688(props) {
769
787
  $ab2bb2d1f47a25b7$export$4daadad26e48a2c7(props);
770
788
  return $c83ba9ab79386687$export$f6e64e17bd69eeef({
@@ -776,7 +794,7 @@ function $4fd5dc0e231a60d9$export$5abb40edfde2a843(props, set_portals) {
776
794
  const component_portals = new Set();
777
795
  return $2GFvs$RecommendationSlider({
778
796
  get recommendations() {
779
- return props.recommendations;
797
+ return $5ee8e057dabc10d4$export$12250cb2badef3d2(props);
780
798
  },
781
799
  product_card_template: display => $bcf84a32dc612a43$export$32024253978abdc7({
782
800
  component_props: {
@@ -801,7 +819,7 @@ function $4d5c3f13a5ae62a7$export$e46079a2793e9ec7(props, set_portals) {
801
819
  const component_portals = new Set();
802
820
  return $2GFvs$RecommendationGrid({
803
821
  get recommendations() {
804
- return props.recommendations;
822
+ return $5ee8e057dabc10d4$export$12250cb2badef3d2(props);
805
823
  },
806
824
  product_card_template: display => {
807
825
  if (0, $2GFvs$isServer)
@@ -926,14 +944,17 @@ function $1bb4271dc44722e2$var$fetchRecommendations(opts) {
926
944
  const {
927
945
  merchant: [get_merchant],
928
946
  market: [get_market],
947
+ usedLocale: [get_usedLocale],
929
948
  sessionId: [get_sessionId]
930
949
  } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
931
950
  const merchant = $2GFvs$untrack(get_merchant);
932
951
  const market = $2GFvs$untrack(get_market);
933
- if (!merchant || !market) throw new Error("Depict recommendations are not configured. Wrap your app in a DepictProvider.");
952
+ const locale = $2GFvs$untrack(get_usedLocale).backend_locale_;
953
+ if (!merchant || !market || !locale) throw new Error("Depict recommendations are not configured (merchant, market or locale is falsy). Wrap your app in a DepictProvider.");
934
954
  return $2GFvs$fetchDepictRecommendations({
935
955
  merchant: merchant,
936
956
  market: market,
957
+ locale: locale,
937
958
  sessionId: $2GFvs$untrack(get_sessionId),
938
959
  ...opts
939
960
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/react-ui",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/index.ts",
6
6
  "types": "ES10/index.d.ts",
@@ -135,10 +135,10 @@
135
135
  "@babel/plugin-transform-typescript": "^7.22.9",
136
136
  "@babel/runtime": "latest",
137
137
  "@babel/runtime-corejs3": "latest",
138
- "@depict-ai/dpc": "^2.0.0",
139
- "@depict-ai/plp-styling": "^2.0.0",
140
- "@depict-ai/ui": "^3.0.0",
141
- "@depict-ai/utilishared": "^2.0.0",
138
+ "@depict-ai/dpc": "^2.0.1",
139
+ "@depict-ai/plp-styling": "^2.0.1",
140
+ "@depict-ai/ui": "^3.0.4",
141
+ "@depict-ai/utilishared": "^2.0.1",
142
142
  "solid-js": "^1.8.1"
143
143
  },
144
144
  "peerDependencies": {
@@ -150,7 +150,7 @@
150
150
  "@babel/core": "latest",
151
151
  "@babel/preset-env": "latest",
152
152
  "@babel/preset-typescript": "latest",
153
- "@depict-ai/plp-styling": "^2.0.0",
153
+ "@depict-ai/plp-styling": "^2.0.1",
154
154
  "@jest/globals": "^29.3.1",
155
155
  "@parcel/babel-preset-env": "^2.10.3",
156
156
  "@parcel/transformer-sass": "^2.10.3",
@@ -7,6 +7,7 @@ var $aNCHr$reactdomserver = require("react-dom/server");
7
7
  var $aNCHr$solidjs = require("solid-js");
8
8
  var $aNCHr$reactjsxruntime = require("react/jsx-runtime");
9
9
  var $aNCHr$reactdom = require("react-dom");
10
+ var $aNCHr$depictaiuilocales = require("@depict-ai/ui/locales/ES10");
10
11
  require("../../multi_import_deduplicator.cjs").register_es_version("react-ui", "ES10");
11
12
  function $parcel$export(e, n, v, s) {
12
13
  Object.defineProperty(e, n, {
@@ -140,11 +141,52 @@ async function $3441d987b5ea85cb$export$32024253978abdc7(_ref) {
140
141
  await react_has_ran_hooks; // After React has created elements it still takes some time to actually connect the refs and run the hooks. We don't want to replace placeholders before then.
141
142
  return [solid_container];
142
143
  }
144
+ const $ef516b1f92253963$export$8e769ad4338a911e = {
145
+ usedLocale: $aNCHr$solidjs.createSignal((0, $aNCHr$depictaiuilocales.defaultLocale)),
146
+ search_instances: new Map(),
147
+ category_instances: new Map(),
148
+ api: null,
149
+ dpc: null,
150
+ merchant: $aNCHr$solidjs.createSignal(),
151
+ market: $aNCHr$solidjs.createSignal(),
152
+ sessionId: $aNCHr$solidjs.createSignal(),
153
+ known_category_paths: new Set(),
154
+ search_page_path_: $aNCHr$solidjs.createSignal(),
155
+ search_page_in_dom: $aNCHr$solidjs.createSignal(false),
156
+ category_page_in_dom: $aNCHr$solidjs.createSignal(false),
157
+ provider_is_updating: $aNCHr$solidjs.createSignal(false),
158
+ enable_content_search: $aNCHr$solidjs.createSignal(),
159
+ disable_override_listing_id: $aNCHr$solidjs.createSignal()
160
+ };
161
+ function $7b4cd941f15b2582$export$12250cb2badef3d2(props) {
162
+ const recs = props.recommendations;
163
+ if ("then" in recs)
164
+ // Run displayTransformers for RecommendationSlider and RecommendationGrid
165
+ return recs.then(async displays => {
166
+ var _globalState$api, _globalState$api$disp;
167
+ const transformFunction = (_globalState$api = (0, $ef516b1f92253963$export$8e769ad4338a911e).api) === null || _globalState$api === void 0 ? void 0 : (_globalState$api$disp = _globalState$api.display_transformers) === null || _globalState$api$disp === void 0 ? void 0 : _globalState$api$disp.products;
168
+ if (transformFunction) try {
169
+ return await transformFunction({
170
+ merchant: (0, $ef516b1f92253963$export$8e769ad4338a911e).merchant[0](),
171
+ market: (0, $ef516b1f92253963$export$8e769ad4338a911e).market[0](),
172
+ displays: displays
173
+ });
174
+ } catch (e) {
175
+ console.error(e);
176
+ throw new Error("Error running display transformer for recommendations", {
177
+ cause: e
178
+ }); // To stop recommendation grid from rendering
179
+ }
180
+
181
+ return displays;
182
+ });
183
+ return recs;
184
+ }
143
185
  function $3b36cc844440a979$export$e46079a2793e9ec7(props, set_portals) {
144
186
  const component_portals = new Set();
145
187
  return $aNCHr$depictaiui.RecommendationGrid({
146
188
  get recommendations() {
147
- return props.recommendations;
189
+ return $7b4cd941f15b2582$export$12250cb2badef3d2(props);
148
190
  },
149
191
  product_card_template: display => {
150
192
  if (0, $aNCHr$solidjsweb.isServer)
@@ -190,7 +232,7 @@ function $3b36cc844440a979$export$e46079a2793e9ec7(props, set_portals) {
190
232
  }
191
233
  });
192
234
  }
193
- const $efbdd2dab4314170$export$83d89fbfd8236492 = "3.0.0";
235
+ const $efbdd2dab4314170$export$83d89fbfd8236492 = "3.0.2";
194
236
  function $202459d454907b31$export$9fac37a9c21c2f3b(props) {
195
237
  return props.children;
196
238
  }
@@ -1,9 +1,9 @@
1
1
  import { DPC } from "@depict-ai/dpc/ES10";
2
- import React, { PropsWithChildren, ReactNode, FC, ReactPortal, ReactElement } from "react";
3
- import { BaseProviderConfig, BaseSearchProviderConfig, BaseCategoryProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/ES10";
2
+ import React, { PropsWithChildren, FC, ReactNode, ReactPortal, ReactElement } from "react";
3
+ import { BaseCategoryProviderConfig, BaseProviderConfig, BaseSearchProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ListingQuery, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/ES10";
4
4
  import { Locale } from "@depict-ai/ui/locales/ES10";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/ES10";
6
- export const version = "3.0.0";
6
+ export const version = "3.0.2";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
@@ -248,9 +248,11 @@ interface SearchPageConfig<T extends Display> extends BaseSearchPageConfig, PLPC
248
248
  export function SearchPage<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never>(props: SearchPageConfig<[OutputDisplay] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<OutputDisplay>>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
249
249
  interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig, PLPConfig<T> {
250
250
  /**
251
- * The listing id to show. Ultimately, this endpoint is what gives you the listing id: https://api.depict.ai/docs#tag/Listing/operation/Get_Listings_v3_listings_get
251
+ * The listing to query Depict for. `type` can be `"listingId"` or `"externalId"` and `id` is the actual id.
252
+ * If `id` is `"listingId"`, it should be a uuid where Depict is the source of truth, you can get them here: https://api.depict.ai/docs#tag/Listing/operation/Get_Listings_v3_listings_get.
253
+ * If `id` is `"externalId"`, it should be the id of the product listing in your system - whatever was passed to Depict during data ingestion.
252
254
  */
253
- listingId: string;
255
+ listingQuery: ListingQuery;
254
256
  /**
255
257
  * categoryTitlePlugin is an optional plugin that can be used to customize the title of the category page.
256
258
  * @default CategoryTitle
@@ -531,7 +533,7 @@ interface UseSearchFieldReturn {
531
533
  * @returns {UseSearchFieldReturn}
532
534
  */
533
535
  export const useSearchField: (props?: SearchFieldProps) => UseSearchFieldReturn;
534
- type FetchRecsOptions = Omit<Parameters<typeof fetchDepictRecommendations>[0], "merchant" | "market" | "sessionId"> & ExclusiveId;
536
+ type FetchRecsOptions = Omit<Parameters<typeof fetchDepictRecommendations>[0], "merchant" | "market" | "sessionId" | "locale"> & ExclusiveId;
535
537
  interface UseFetchRecommendationsReturn<T extends Display> {
536
538
  /**
537
539
  * Fetch recommendations from the Depict API.
@@ -607,5 +609,5 @@ export const Navigation: {
607
609
  nextRouterNavigation: (router: import("next/router").NextRouter) => import("src/ui/components/DepictProvider").NavigateFunction;
608
610
  };
609
611
  export { CategoryTitle, embedded_num_products as EmbeddedNumProducts } from "@depict-ai/ui";
610
- export type { PageURLCreator, DisplayTransformers } from "@depict-ai/ui";
612
+ export type { DisplayTransformers } from "@depict-ai/ui";
611
613
  export type { Locale } from "@depict-ai/ui/locales";
@@ -4,9 +4,10 @@ import { ImagePlaceholder as $7h5e1$ImagePlaceholder, TextPlaceholder as $7h5e1$
4
4
  import { generateHydrationScript as $7h5e1$generateHydrationScript, renderToString as $7h5e1$renderToString, isServer as $7h5e1$isServer } from "solid-js/web";
5
5
  import { dwarn as $7h5e1$dwarn } from "@depict-ai/utilishared/ES10";
6
6
  import { renderToString as $7h5e1$renderToString1 } from "react-dom/server";
7
- import { getOwner as $7h5e1$getOwner, untrack as $7h5e1$untrack, runWithOwner as $7h5e1$runWithOwner, createEffect as $7h5e1$createEffect, on as $7h5e1$on, onCleanup as $7h5e1$onCleanup } from "solid-js";
7
+ import { getOwner as $7h5e1$getOwner, untrack as $7h5e1$untrack, runWithOwner as $7h5e1$runWithOwner, createEffect as $7h5e1$createEffect, on as $7h5e1$on, onCleanup as $7h5e1$onCleanup, createSignal as $7h5e1$createSignal } from "solid-js";
8
8
  import { jsx as $7h5e1$jsx } from "react/jsx-runtime";
9
9
  import { createPortal as $7h5e1$createPortal } from "react-dom";
10
+ import { defaultLocale as $7h5e1$defaultLocale } from "@depict-ai/ui/locales/ES10";
10
11
 
11
12
  //"use client"; // <- opt out of react server components to the rendering method where components are rendered both on the client and on the server and then hydrated on the client, see https://www.joshwcomeau.com/react/server-components/#:~:text=Client%20Components%20render%20on%20both%20the%20client%20and%20the%20server.
12
13
  // This "use client" actually just gets deleted by parcel, but I'm leaving it because we re-add it in the build scripts and this makes you more aware of that
@@ -117,11 +118,52 @@ async function $cce08f18e2476cbf$export$32024253978abdc7(_ref) {
117
118
  await react_has_ran_hooks; // After React has created elements it still takes some time to actually connect the refs and run the hooks. We don't want to replace placeholders before then.
118
119
  return [solid_container];
119
120
  }
121
+ const $8c691d7f86317052$export$8e769ad4338a911e = {
122
+ usedLocale: $7h5e1$createSignal((0, $7h5e1$defaultLocale)),
123
+ search_instances: new Map(),
124
+ category_instances: new Map(),
125
+ api: null,
126
+ dpc: null,
127
+ merchant: $7h5e1$createSignal(),
128
+ market: $7h5e1$createSignal(),
129
+ sessionId: $7h5e1$createSignal(),
130
+ known_category_paths: new Set(),
131
+ search_page_path_: $7h5e1$createSignal(),
132
+ search_page_in_dom: $7h5e1$createSignal(false),
133
+ category_page_in_dom: $7h5e1$createSignal(false),
134
+ provider_is_updating: $7h5e1$createSignal(false),
135
+ enable_content_search: $7h5e1$createSignal(),
136
+ disable_override_listing_id: $7h5e1$createSignal()
137
+ };
138
+ function $9da62538e07f038e$export$12250cb2badef3d2(props) {
139
+ const recs = props.recommendations;
140
+ if ("then" in recs)
141
+ // Run displayTransformers for RecommendationSlider and RecommendationGrid
142
+ return recs.then(async displays => {
143
+ var _globalState$api, _globalState$api$disp;
144
+ const transformFunction = (_globalState$api = (0, $8c691d7f86317052$export$8e769ad4338a911e).api) === null || _globalState$api === void 0 ? void 0 : (_globalState$api$disp = _globalState$api.display_transformers) === null || _globalState$api$disp === void 0 ? void 0 : _globalState$api$disp.products;
145
+ if (transformFunction) try {
146
+ return await transformFunction({
147
+ merchant: (0, $8c691d7f86317052$export$8e769ad4338a911e).merchant[0](),
148
+ market: (0, $8c691d7f86317052$export$8e769ad4338a911e).market[0](),
149
+ displays: displays
150
+ });
151
+ } catch (e) {
152
+ console.error(e);
153
+ throw new Error("Error running display transformer for recommendations", {
154
+ cause: e
155
+ }); // To stop recommendation grid from rendering
156
+ }
157
+
158
+ return displays;
159
+ });
160
+ return recs;
161
+ }
120
162
  function $cd68097a7ee08669$export$e46079a2793e9ec7(props, set_portals) {
121
163
  const component_portals = new Set();
122
164
  return $7h5e1$RecommendationGrid({
123
165
  get recommendations() {
124
- return props.recommendations;
166
+ return $9da62538e07f038e$export$12250cb2badef3d2(props);
125
167
  },
126
168
  product_card_template: display => {
127
169
  if (0, $7h5e1$isServer)
@@ -167,7 +209,7 @@ function $cd68097a7ee08669$export$e46079a2793e9ec7(props, set_portals) {
167
209
  }
168
210
  });
169
211
  }
170
- const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "3.0.0";
212
+ const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "3.0.2";
171
213
  function $5c4add0a8fe94894$export$9fac37a9c21c2f3b(props) {
172
214
  return props.children;
173
215
  }
@@ -7,6 +7,7 @@ var $7QqFM$reactdomserver = require("react-dom/server");
7
7
  var $7QqFM$solidjs = require("solid-js");
8
8
  var $7QqFM$reactjsxruntime = require("react/jsx-runtime");
9
9
  var $7QqFM$reactdom = require("react-dom");
10
+ var $7QqFM$depictaiuilocales = require("@depict-ai/ui/locales/latest");
10
11
  require("../../multi_import_deduplicator.cjs").register_es_version("react-ui", "latest");
11
12
  function $parcel$export(e, n, v, s) {
12
13
  Object.defineProperty(e, n, {
@@ -134,11 +135,51 @@ async function $6081519c185fcf70$export$32024253978abdc7({
134
135
  await react_has_ran_hooks; // After React has created elements it still takes some time to actually connect the refs and run the hooks. We don't want to replace placeholders before then.
135
136
  return [solid_container];
136
137
  }
138
+ const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
139
+ usedLocale: $7QqFM$solidjs.createSignal((0, $7QqFM$depictaiuilocales.defaultLocale)),
140
+ search_instances: new Map(),
141
+ category_instances: new Map(),
142
+ api: null,
143
+ dpc: null,
144
+ merchant: $7QqFM$solidjs.createSignal(),
145
+ market: $7QqFM$solidjs.createSignal(),
146
+ sessionId: $7QqFM$solidjs.createSignal(),
147
+ known_category_paths: new Set(),
148
+ search_page_path_: $7QqFM$solidjs.createSignal(),
149
+ search_page_in_dom: $7QqFM$solidjs.createSignal(false),
150
+ category_page_in_dom: $7QqFM$solidjs.createSignal(false),
151
+ provider_is_updating: $7QqFM$solidjs.createSignal(false),
152
+ enable_content_search: $7QqFM$solidjs.createSignal(),
153
+ disable_override_listing_id: $7QqFM$solidjs.createSignal()
154
+ };
155
+ function $3d35ad83c8fdfa92$export$12250cb2badef3d2(props) {
156
+ const recs = props.recommendations;
157
+ if ("then" in recs)
158
+ // Run displayTransformers for RecommendationSlider and RecommendationGrid
159
+ return recs.then(async displays => {
160
+ const transformFunction = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api?.display_transformers?.products;
161
+ if (transformFunction) try {
162
+ return await transformFunction({
163
+ merchant: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).merchant[0](),
164
+ market: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).market[0](),
165
+ displays: displays
166
+ });
167
+ } catch (e) {
168
+ console.error(e);
169
+ throw new Error("Error running display transformer for recommendations", {
170
+ cause: e
171
+ }); // To stop recommendation grid from rendering
172
+ }
173
+
174
+ return displays;
175
+ });
176
+ return recs;
177
+ }
137
178
  function $c6b960f2a07285c8$export$e46079a2793e9ec7(props, set_portals) {
138
179
  const component_portals = new Set();
139
180
  return $7QqFM$depictaiui.RecommendationGrid({
140
181
  get recommendations() {
141
- return props.recommendations;
182
+ return $3d35ad83c8fdfa92$export$12250cb2badef3d2(props);
142
183
  },
143
184
  product_card_template: display => {
144
185
  if (0, $7QqFM$solidjsweb.isServer)
@@ -182,7 +223,7 @@ function $c6b960f2a07285c8$export$e46079a2793e9ec7(props, set_portals) {
182
223
  }
183
224
  });
184
225
  }
185
- const $db7b67857900028b$export$83d89fbfd8236492 = "3.0.0";
226
+ const $db7b67857900028b$export$83d89fbfd8236492 = "3.0.2";
186
227
  function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
187
228
  return props.children;
188
229
  }
@@ -1,9 +1,9 @@
1
1
  import { DPC } from "@depict-ai/dpc/latest";
2
- import React, { PropsWithChildren, ReactNode, FC, ReactPortal, ReactElement } from "react";
3
- import { BaseProviderConfig, BaseSearchProviderConfig, BaseCategoryProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/latest";
2
+ import React, { PropsWithChildren, FC, ReactNode, ReactPortal, ReactElement } from "react";
3
+ import { BaseCategoryProviderConfig, BaseProviderConfig, BaseSearchProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ListingQuery, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/latest";
4
4
  import { Locale } from "@depict-ai/ui/locales/latest";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/latest";
6
- export const version = "3.0.0";
6
+ export const version = "3.0.2";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
@@ -248,9 +248,11 @@ interface SearchPageConfig<T extends Display> extends BaseSearchPageConfig, PLPC
248
248
  export function SearchPage<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never>(props: SearchPageConfig<[OutputDisplay] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<OutputDisplay>>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
249
249
  interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig, PLPConfig<T> {
250
250
  /**
251
- * The listing id to show. Ultimately, this endpoint is what gives you the listing id: https://api.depict.ai/docs#tag/Listing/operation/Get_Listings_v3_listings_get
251
+ * The listing to query Depict for. `type` can be `"listingId"` or `"externalId"` and `id` is the actual id.
252
+ * If `id` is `"listingId"`, it should be a uuid where Depict is the source of truth, you can get them here: https://api.depict.ai/docs#tag/Listing/operation/Get_Listings_v3_listings_get.
253
+ * If `id` is `"externalId"`, it should be the id of the product listing in your system - whatever was passed to Depict during data ingestion.
252
254
  */
253
- listingId: string;
255
+ listingQuery: ListingQuery;
254
256
  /**
255
257
  * categoryTitlePlugin is an optional plugin that can be used to customize the title of the category page.
256
258
  * @default CategoryTitle
@@ -531,7 +533,7 @@ interface UseSearchFieldReturn {
531
533
  * @returns {UseSearchFieldReturn}
532
534
  */
533
535
  export const useSearchField: (props?: SearchFieldProps) => UseSearchFieldReturn;
534
- type FetchRecsOptions = Omit<Parameters<typeof fetchDepictRecommendations>[0], "merchant" | "market" | "sessionId"> & ExclusiveId;
536
+ type FetchRecsOptions = Omit<Parameters<typeof fetchDepictRecommendations>[0], "merchant" | "market" | "sessionId" | "locale"> & ExclusiveId;
535
537
  interface UseFetchRecommendationsReturn<T extends Display> {
536
538
  /**
537
539
  * Fetch recommendations from the Depict API.
@@ -607,5 +609,5 @@ export const Navigation: {
607
609
  nextRouterNavigation: (router: import("next/router").NextRouter) => import("src/ui/components/DepictProvider").NavigateFunction;
608
610
  };
609
611
  export { CategoryTitle, embedded_num_products as EmbeddedNumProducts } from "@depict-ai/ui";
610
- export type { PageURLCreator, DisplayTransformers } from "@depict-ai/ui";
612
+ export type { DisplayTransformers } from "@depict-ai/ui";
611
613
  export type { Locale } from "@depict-ai/ui/locales";