@depict-ai/react-ui 2.1.13 → 2.1.14

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/ES10/index.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  var $2kiy7$depictaiutilishared = require("@depict-ai/utilishared/ES10");
2
3
  var $2kiy7$depictaiui = require("@depict-ai/ui/ES10");
3
4
  var $2kiy7$solidjs = require("solid-js");
@@ -38,7 +39,7 @@ $parcel$export(module.exports, "version", () => $efbdd2dab4314170$export$83d89fb
38
39
  $parcel$export(module.exports, "Navigation", () => $0d3a2413fdeb34b9$export$b8a61e5c71402559);
39
40
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
40
41
  // Note, if you add an export here, also add one in src-server/main.ts
41
- const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.1.13";
42
+ const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.1.14";
42
43
  const $ef516b1f92253963$export$8e769ad4338a911e = {
43
44
  usedLocale: $2kiy7$solidjs.createSignal((0, $2kiy7$depictaiuilocales.defaultLocale)),
44
45
  search_instances: new Map(),
@@ -1029,4 +1030,4 @@ const $6bf91538dbdf0252$export$804fac5697cfbe35 = router => (relativeUrl, _ref)
1029
1030
  const $0d3a2413fdeb34b9$export$b8a61e5c71402559 = {
1030
1031
  nextRouterNavigation: $6bf91538dbdf0252$export$804fac5697cfbe35
1031
1032
  };
1032
- $2kiy7$depictaiutilishared.add_to_version_info("react-ui", (0, $efbdd2dab4314170$export$83d89fbfd8236492));
1033
+ $2kiy7$depictaiutilishared.add_to_version_info("react-ui", (0, $efbdd2dab4314170$export$83d89fbfd8236492));
package/ES10/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactNode, FC, ReactPortal, ReactElement } fr
3
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";
4
4
  import { Locale } from "@depict-ai/ui/locales/ES10";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/ES10";
6
- export const version = "2.1.13";
6
+ export const version = "2.1.14";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
package/ES10/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { add_to_version_info as $jb2Oo$add_to_version_info, catchify as $jb2Oo$catchify, queueMacroTask as $jb2Oo$queueMacroTask, instant_exec_on_suspect_history_change as $jb2Oo$instant_exec_on_suspect_history_change, derror as $jb2Oo$derror, dwarn as $jb2Oo$dwarn } from "@depict-ai/utilishared/ES10";
2
3
  import { CategoryTitle as $383b6fd56bf151bd$re_export$CategoryTitle, embedded_num_products as $383b6fd56bf151bd$re_export$EmbeddedNumProducts, DepictAPI as $jb2Oo$DepictAPI, DepictSearch as $jb2Oo$DepictSearch, DepictCategory as $jb2Oo$DepictCategory, get_search_query_updating_blocked_signal as $jb2Oo$get_search_query_updating_blocked_signal, SearchPage as $jb2Oo$SearchPage, defaultColsAtSize as $jb2Oo$defaultColsAtSize, defaultGridSpacing as $jb2Oo$defaultGridSpacing, ProductCardError as $jb2Oo$ProductCardError, CategoryPage as $jb2Oo$CategoryPage, defaultCategoryTitlePlugin as $jb2Oo$defaultCategoryTitlePlugin, BreadCrumbs as $jb2Oo$BreadCrumbs, QuickLinks as $jb2Oo$QuickLinks, ImagePlaceholder as $jb2Oo$ImagePlaceholder, TextPlaceholder as $jb2Oo$TextPlaceholder, RecommendationSlider as $jb2Oo$RecommendationSlider, RecommendationGrid as $jb2Oo$RecommendationGrid, open_modal_with_alignment as $jb2Oo$open_modal_with_alignment, SearchField as $jb2Oo$SearchField, fetchDepictRecommendations as $jb2Oo$fetchDepictRecommendations } from "@depict-ai/ui/ES10";
3
4
  import { untrack as $jb2Oo$untrack, createRoot as $jb2Oo$createRoot, createEffect as $jb2Oo$createEffect, createMemo as $jb2Oo$createMemo, createComponent as $jb2Oo$createComponent, Show as $jb2Oo$Show, createSignal as $jb2Oo$createSignal, createComputed as $jb2Oo$createComputed, onCleanup as $jb2Oo$onCleanup, getOwner as $jb2Oo$getOwner, runWithOwner as $jb2Oo$runWithOwner, on as $jb2Oo$on, mapArray as $jb2Oo$mapArray } from "solid-js";
@@ -14,7 +15,7 @@ import { renderToString as $jb2Oo$renderToString } from "react-dom/server";
14
15
  // Note, if you add an export here, also add one in src-server/main.ts
15
16
  import { register_es_version } from "../multi_import_deduplicator.mjs";
16
17
  register_es_version("react-ui", "ES10");
17
- const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.1.13";
18
+ const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.1.14";
18
19
  const $8c691d7f86317052$export$8e769ad4338a911e = {
19
20
  usedLocale: $jb2Oo$createSignal((0, $jb2Oo$defaultLocale)),
20
21
  search_instances: new Map(),
@@ -1006,4 +1007,4 @@ const $a7dfdd84298ae791$export$b8a61e5c71402559 = {
1006
1007
  nextRouterNavigation: $05726fa9c7eda0a1$export$804fac5697cfbe35
1007
1008
  };
1008
1009
  $jb2Oo$add_to_version_info("react-ui", (0, $9bd9bb8700ab2ada$export$83d89fbfd8236492));
1009
- export { $c61814cfb91ead09$export$466cdc317043f6cb as QuickLinks, $ec632214ac078e79$export$5646050d516e06bc as BreadCrumbs, $f6a205a95e4fdee3$export$80e99ee6b29cadd2 as ComponentAligner, $18e5b9f66c7ade8e$export$9fac37a9c21c2f3b as DepictProvider, $e86a296a07b17ad5$export$f7d2f673fc2f091d as CategoryPage, $d059770e7af9e2dc$export$a54ec244c8863715 as SearchPage, $6406849926c3f794$export$3f37af283f8fb843 as ImagePlaceholder, $2c7738b65cbcac1c$export$89c6019e4baa40b1 as TextPlaceholder, $31abef71c0a2d3fc$export$b0a773486c1c2312 as RecommendationGrid, $c02e9fd51f31a1bd$export$82cfdc85a4d15688 as RecommendationSlider, $356d18d3ed66814e$export$912994940e660d32 as useSearchModal, $4c71282d292aac6d$export$9bb30bbe003b82e0 as useSearchField, $1895644749ca8d8a$export$6501da23a2770fc as useFetchRecommendations, $b34796f5ebe3470e$export$38b98fae14bd1f64 as usePerformanceClient, $383b6fd56bf151bd$re_export$CategoryTitle as CategoryTitle, $383b6fd56bf151bd$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $9bd9bb8700ab2ada$export$83d89fbfd8236492 as version, $a7dfdd84298ae791$export$b8a61e5c71402559 as Navigation };
1010
+ export { $c61814cfb91ead09$export$466cdc317043f6cb as QuickLinks, $ec632214ac078e79$export$5646050d516e06bc as BreadCrumbs, $f6a205a95e4fdee3$export$80e99ee6b29cadd2 as ComponentAligner, $18e5b9f66c7ade8e$export$9fac37a9c21c2f3b as DepictProvider, $e86a296a07b17ad5$export$f7d2f673fc2f091d as CategoryPage, $d059770e7af9e2dc$export$a54ec244c8863715 as SearchPage, $6406849926c3f794$export$3f37af283f8fb843 as ImagePlaceholder, $2c7738b65cbcac1c$export$89c6019e4baa40b1 as TextPlaceholder, $31abef71c0a2d3fc$export$b0a773486c1c2312 as RecommendationGrid, $c02e9fd51f31a1bd$export$82cfdc85a4d15688 as RecommendationSlider, $356d18d3ed66814e$export$912994940e660d32 as useSearchModal, $4c71282d292aac6d$export$9bb30bbe003b82e0 as useSearchField, $1895644749ca8d8a$export$6501da23a2770fc as useFetchRecommendations, $b34796f5ebe3470e$export$38b98fae14bd1f64 as usePerformanceClient, $383b6fd56bf151bd$re_export$CategoryTitle as CategoryTitle, $383b6fd56bf151bd$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $9bd9bb8700ab2ada$export$83d89fbfd8236492 as version, $a7dfdd84298ae791$export$b8a61e5c71402559 as Navigation };
package/latest/index.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  var $2IzJs$depictaiutilishared = require("@depict-ai/utilishared/latest");
2
3
  var $2IzJs$depictaiui = require("@depict-ai/ui/latest");
3
4
  var $2IzJs$solidjs = require("solid-js");
@@ -38,7 +39,7 @@ $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fb
38
39
  $parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
39
40
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
40
41
  // Note, if you add an export here, also add one in src-server/main.ts
41
- const $db7b67857900028b$export$83d89fbfd8236492 = "2.1.13";
42
+ const $db7b67857900028b$export$83d89fbfd8236492 = "2.1.14";
42
43
  const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
43
44
  usedLocale: $2IzJs$solidjs.createSignal((0, $2IzJs$depictaiuilocales.defaultLocale)),
44
45
  search_instances: new Map(),
@@ -987,4 +988,4 @@ const $e387bd534de10acd$export$804fac5697cfbe35 = router => (relativeUrl, {
987
988
  const $b742053c966024b4$export$b8a61e5c71402559 = {
988
989
  nextRouterNavigation: $e387bd534de10acd$export$804fac5697cfbe35
989
990
  };
990
- $2IzJs$depictaiutilishared.add_to_version_info("react-ui", (0, $db7b67857900028b$export$83d89fbfd8236492));
991
+ $2IzJs$depictaiutilishared.add_to_version_info("react-ui", (0, $db7b67857900028b$export$83d89fbfd8236492));
package/latest/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactNode, FC, ReactPortal, ReactElement } fr
3
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";
4
4
  import { Locale } from "@depict-ai/ui/locales/latest";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/latest";
6
- export const version = "2.1.13";
6
+ export const version = "2.1.14";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
package/latest/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { add_to_version_info as $2GFvs$add_to_version_info, catchify as $2GFvs$catchify, queueMacroTask as $2GFvs$queueMacroTask, instant_exec_on_suspect_history_change as $2GFvs$instant_exec_on_suspect_history_change, derror as $2GFvs$derror, dwarn as $2GFvs$dwarn } from "@depict-ai/utilishared/latest";
2
3
  import { CategoryTitle as $43099132aad1ceb6$re_export$CategoryTitle, embedded_num_products as $43099132aad1ceb6$re_export$EmbeddedNumProducts, DepictAPI as $2GFvs$DepictAPI, DepictSearch as $2GFvs$DepictSearch, DepictCategory as $2GFvs$DepictCategory, get_search_query_updating_blocked_signal as $2GFvs$get_search_query_updating_blocked_signal, SearchPage as $2GFvs$SearchPage, defaultColsAtSize as $2GFvs$defaultColsAtSize, defaultGridSpacing as $2GFvs$defaultGridSpacing, ProductCardError as $2GFvs$ProductCardError, CategoryPage as $2GFvs$CategoryPage, defaultCategoryTitlePlugin as $2GFvs$defaultCategoryTitlePlugin, BreadCrumbs as $2GFvs$BreadCrumbs, QuickLinks as $2GFvs$QuickLinks, ImagePlaceholder as $2GFvs$ImagePlaceholder, TextPlaceholder as $2GFvs$TextPlaceholder, RecommendationSlider as $2GFvs$RecommendationSlider, RecommendationGrid as $2GFvs$RecommendationGrid, open_modal_with_alignment as $2GFvs$open_modal_with_alignment, SearchField as $2GFvs$SearchField, fetchDepictRecommendations as $2GFvs$fetchDepictRecommendations } from "@depict-ai/ui/latest";
3
4
  import { untrack as $2GFvs$untrack, createRoot as $2GFvs$createRoot, createEffect as $2GFvs$createEffect, createMemo as $2GFvs$createMemo, createComponent as $2GFvs$createComponent, Show as $2GFvs$Show, createSignal as $2GFvs$createSignal, createComputed as $2GFvs$createComputed, onCleanup as $2GFvs$onCleanup, getOwner as $2GFvs$getOwner, runWithOwner as $2GFvs$runWithOwner, on as $2GFvs$on, mapArray as $2GFvs$mapArray } from "solid-js";
@@ -14,7 +15,7 @@ import { renderToString as $2GFvs$renderToString } from "react-dom/server";
14
15
  // Note, if you add an export here, also add one in src-server/main.ts
15
16
  import { register_es_version } from "../multi_import_deduplicator.mjs";
16
17
  register_es_version("react-ui", "latest");
17
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.1.13";
18
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.1.14";
18
19
  const $42858f023ef23dab$export$8e769ad4338a911e = {
19
20
  usedLocale: $2GFvs$createSignal((0, $2GFvs$defaultLocale)),
20
21
  search_instances: new Map(),
@@ -964,4 +965,4 @@ const $97603d19204ec48d$export$b8a61e5c71402559 = {
964
965
  nextRouterNavigation: $a92aa2beb560b8af$export$804fac5697cfbe35
965
966
  };
966
967
  $2GFvs$add_to_version_info("react-ui", (0, $c9c4d066f9a5b51b$export$83d89fbfd8236492));
967
- export { $b68a14248b7ef667$export$466cdc317043f6cb as QuickLinks, $f866f7ed9f751af4$export$5646050d516e06bc as BreadCrumbs, $421f32789b6f111f$export$80e99ee6b29cadd2 as ComponentAligner, $5376eb2a386cd90d$export$9fac37a9c21c2f3b as DepictProvider, $48d7f568740a317d$export$f7d2f673fc2f091d as CategoryPage, $4a678f0c87b12e78$export$a54ec244c8863715 as SearchPage, $f446a84f85ba06f6$export$3f37af283f8fb843 as ImagePlaceholder, $cbd250061abf11cb$export$89c6019e4baa40b1 as TextPlaceholder, $73b783bfc241b2d9$export$b0a773486c1c2312 as RecommendationGrid, $4fd5dc0e231a60d9$export$82cfdc85a4d15688 as RecommendationSlider, $70344e5e0d0fea06$export$912994940e660d32 as useSearchModal, $2b886cf548a4775c$export$9bb30bbe003b82e0 as useSearchField, $1bb4271dc44722e2$export$6501da23a2770fc as useFetchRecommendations, $a00d8f27abd5d0b0$export$38b98fae14bd1f64 as usePerformanceClient, $43099132aad1ceb6$re_export$CategoryTitle as CategoryTitle, $43099132aad1ceb6$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version, $97603d19204ec48d$export$b8a61e5c71402559 as Navigation };
968
+ export { $b68a14248b7ef667$export$466cdc317043f6cb as QuickLinks, $f866f7ed9f751af4$export$5646050d516e06bc as BreadCrumbs, $421f32789b6f111f$export$80e99ee6b29cadd2 as ComponentAligner, $5376eb2a386cd90d$export$9fac37a9c21c2f3b as DepictProvider, $48d7f568740a317d$export$f7d2f673fc2f091d as CategoryPage, $4a678f0c87b12e78$export$a54ec244c8863715 as SearchPage, $f446a84f85ba06f6$export$3f37af283f8fb843 as ImagePlaceholder, $cbd250061abf11cb$export$89c6019e4baa40b1 as TextPlaceholder, $73b783bfc241b2d9$export$b0a773486c1c2312 as RecommendationGrid, $4fd5dc0e231a60d9$export$82cfdc85a4d15688 as RecommendationSlider, $70344e5e0d0fea06$export$912994940e660d32 as useSearchModal, $2b886cf548a4775c$export$9bb30bbe003b82e0 as useSearchField, $1bb4271dc44722e2$export$6501da23a2770fc as useFetchRecommendations, $a00d8f27abd5d0b0$export$38b98fae14bd1f64 as usePerformanceClient, $43099132aad1ceb6$re_export$CategoryTitle as CategoryTitle, $43099132aad1ceb6$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version, $97603d19204ec48d$export$b8a61e5c71402559 as Navigation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/react-ui",
3
- "version": "2.1.13",
3
+ "version": "2.1.14",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/index.ts",
6
6
  "types": "ES10/index.d.ts",
@@ -137,7 +137,7 @@
137
137
  "@babel/runtime-corejs3": "latest",
138
138
  "@depict-ai/dpc": "^1.0.45",
139
139
  "@depict-ai/plp-styling": "^1.2.14",
140
- "@depict-ai/ui": "^2.1.22",
140
+ "@depict-ai/ui": "^2.1.23",
141
141
  "@depict-ai/utilishared": "^1.0.51",
142
142
  "solid-js": "^1.8.1"
143
143
  },
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  var $aNCHr$react = require("react");
2
3
  var $aNCHr$depictaiui = require("@depict-ai/ui/ES10");
3
4
  var $aNCHr$solidjsweb = require("solid-js/web");
@@ -31,6 +32,10 @@ $parcel$export(module.exports, "useSearchModal", () => $202459d454907b31$export$
31
32
  $parcel$export(module.exports, "usePerformanceClient", () => $202459d454907b31$export$38b98fae14bd1f64);
32
33
  $parcel$export(module.exports, "useFetchRecommendations", () => $202459d454907b31$export$6501da23a2770fc);
33
34
  $parcel$export(module.exports, "version", () => $efbdd2dab4314170$export$83d89fbfd8236492);
35
+ //"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.
36
+ // 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
37
+ // Doing that freaks react out, one can only have one use client statement: https://depictaiworkspace.slack.com/archives/C02BASM9X5J/p1699972968084709 but leaving it here commented out for you rinformation regardless
38
+
34
39
  function $f144be06c518d0ac$export$4b564d7f5a1b1d43(_ref) {
35
40
  let {
36
41
  solid_component: solid_component,
@@ -185,7 +190,7 @@ function $3b36cc844440a979$export$e46079a2793e9ec7(props, set_portals) {
185
190
  }
186
191
  });
187
192
  }
188
- const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.1.13";
193
+ const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.1.14";
189
194
  function $202459d454907b31$export$9fac37a9c21c2f3b(props) {
190
195
  return props.children;
191
196
  }
@@ -288,4 +293,4 @@ function $202459d454907b31$export$6501da23a2770fc() {
288
293
  throw new Error("fetchRecommendations is currently not available on the server due to personalisation/user_id related issues. Please only call it on the client.");
289
294
  }
290
295
  };
291
- }
296
+ }
@@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactNode, FC, ReactPortal, ReactElement } fr
3
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";
4
4
  import { Locale } from "@depict-ai/ui/locales/ES10";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/ES10";
6
- export const version = "2.1.13";
6
+ export const version = "2.1.14";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createElement as $7h5e1$createElement, useRef as $7h5e1$useRef, Fragment as $7h5e1$Fragment, useEffect as $7h5e1$useEffect, useState as $7h5e1$useState, Component as $7h5e1$Component } from "react";
2
3
  import { ImagePlaceholder as $7h5e1$ImagePlaceholder, TextPlaceholder as $7h5e1$TextPlaceholder, RecommendationGrid as $7h5e1$RecommendationGrid, defaultColsAtSize as $7h5e1$defaultColsAtSize, defaultGridSpacing as $7h5e1$defaultGridSpacing, ProductCardError as $7h5e1$ProductCardError } from "@depict-ai/ui/ES10";
3
4
  import { generateHydrationScript as $7h5e1$generateHydrationScript, renderToString as $7h5e1$renderToString, isServer as $7h5e1$isServer } from "solid-js/web";
@@ -6,6 +7,10 @@ import { renderToString as $7h5e1$renderToString1 } from "react-dom/server";
6
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
8
  import { jsx as $7h5e1$jsx } from "react/jsx-runtime";
8
9
  import { createPortal as $7h5e1$createPortal } from "react-dom";
10
+
11
+ //"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
+ // 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
13
+ // Doing that freaks react out, one can only have one use client statement: https://depictaiworkspace.slack.com/archives/C02BASM9X5J/p1699972968084709 but leaving it here commented out for you rinformation regardless
9
14
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
10
15
  register_es_version("react-ui", "ES10");
11
16
  function $e8e755ef02e716bf$export$4b564d7f5a1b1d43(_ref) {
@@ -162,7 +167,7 @@ function $cd68097a7ee08669$export$e46079a2793e9ec7(props, set_portals) {
162
167
  }
163
168
  });
164
169
  }
165
- const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.1.13";
170
+ const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.1.14";
166
171
  function $5c4add0a8fe94894$export$9fac37a9c21c2f3b(props) {
167
172
  return props.children;
168
173
  }
@@ -266,4 +271,4 @@ function $5c4add0a8fe94894$export$6501da23a2770fc() {
266
271
  }
267
272
  };
268
273
  }
269
- export { $5c4add0a8fe94894$export$9fac37a9c21c2f3b as DepictProvider, $5c4add0a8fe94894$export$a54ec244c8863715 as SearchPage, $5c4add0a8fe94894$export$f7d2f673fc2f091d as CategoryPage, $5c4add0a8fe94894$export$5646050d516e06bc as BreadCrumbs, $5c4add0a8fe94894$export$466cdc317043f6cb as QuickLinks, $5c4add0a8fe94894$export$82cfdc85a4d15688 as RecommendationSlider, $5c4add0a8fe94894$export$80e99ee6b29cadd2 as ComponentAligner, $5c4add0a8fe94894$export$3f37af283f8fb843 as ImagePlaceholder, $5c4add0a8fe94894$export$b0a773486c1c2312 as RecommendationGrid, $5c4add0a8fe94894$export$89c6019e4baa40b1 as TextPlaceholder, $5c4add0a8fe94894$export$9bb30bbe003b82e0 as useSearchField, $5c4add0a8fe94894$export$a7f6cffb6b8ba11c as openModal, $5c4add0a8fe94894$export$912994940e660d32 as useSearchModal, $5c4add0a8fe94894$export$38b98fae14bd1f64 as usePerformanceClient, $5c4add0a8fe94894$export$6501da23a2770fc as useFetchRecommendations, $9bd9bb8700ab2ada$export$83d89fbfd8236492 as version };
274
+ export { $5c4add0a8fe94894$export$9fac37a9c21c2f3b as DepictProvider, $5c4add0a8fe94894$export$a54ec244c8863715 as SearchPage, $5c4add0a8fe94894$export$f7d2f673fc2f091d as CategoryPage, $5c4add0a8fe94894$export$5646050d516e06bc as BreadCrumbs, $5c4add0a8fe94894$export$466cdc317043f6cb as QuickLinks, $5c4add0a8fe94894$export$82cfdc85a4d15688 as RecommendationSlider, $5c4add0a8fe94894$export$80e99ee6b29cadd2 as ComponentAligner, $5c4add0a8fe94894$export$3f37af283f8fb843 as ImagePlaceholder, $5c4add0a8fe94894$export$b0a773486c1c2312 as RecommendationGrid, $5c4add0a8fe94894$export$89c6019e4baa40b1 as TextPlaceholder, $5c4add0a8fe94894$export$9bb30bbe003b82e0 as useSearchField, $5c4add0a8fe94894$export$a7f6cffb6b8ba11c as openModal, $5c4add0a8fe94894$export$912994940e660d32 as useSearchModal, $5c4add0a8fe94894$export$38b98fae14bd1f64 as usePerformanceClient, $5c4add0a8fe94894$export$6501da23a2770fc as useFetchRecommendations, $9bd9bb8700ab2ada$export$83d89fbfd8236492 as version };
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  var $7QqFM$react = require("react");
2
3
  var $7QqFM$depictaiui = require("@depict-ai/ui/latest");
3
4
  var $7QqFM$solidjsweb = require("solid-js/web");
@@ -31,6 +32,10 @@ $parcel$export(module.exports, "useSearchModal", () => $41e7e5d85b5e0d49$export$
31
32
  $parcel$export(module.exports, "usePerformanceClient", () => $41e7e5d85b5e0d49$export$38b98fae14bd1f64);
32
33
  $parcel$export(module.exports, "useFetchRecommendations", () => $41e7e5d85b5e0d49$export$6501da23a2770fc);
33
34
  $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fbfd8236492);
35
+ //"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.
36
+ // 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
37
+ // Doing that freaks react out, one can only have one use client statement: https://depictaiworkspace.slack.com/archives/C02BASM9X5J/p1699972968084709 but leaving it here commented out for you rinformation regardless
38
+
34
39
  function $35dfe83eec81954c$export$4b564d7f5a1b1d43({
35
40
  solid_component: solid_component,
36
41
  props: props,
@@ -177,7 +182,7 @@ function $c6b960f2a07285c8$export$e46079a2793e9ec7(props, set_portals) {
177
182
  }
178
183
  });
179
184
  }
180
- const $db7b67857900028b$export$83d89fbfd8236492 = "2.1.13";
185
+ const $db7b67857900028b$export$83d89fbfd8236492 = "2.1.14";
181
186
  function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
182
187
  return props.children;
183
188
  }
@@ -280,4 +285,4 @@ function $41e7e5d85b5e0d49$export$6501da23a2770fc() {
280
285
  throw new Error("fetchRecommendations is currently not available on the server due to personalisation/user_id related issues. Please only call it on the client.");
281
286
  }
282
287
  };
283
- }
288
+ }
@@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactNode, FC, ReactPortal, ReactElement } fr
3
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";
4
4
  import { Locale } from "@depict-ai/ui/locales/latest";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/latest";
6
- export const version = "2.1.13";
6
+ export const version = "2.1.14";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createElement as $eOXet$createElement, useRef as $eOXet$useRef, Fragment as $eOXet$Fragment, useEffect as $eOXet$useEffect, useState as $eOXet$useState, Component as $eOXet$Component } from "react";
2
3
  import { ImagePlaceholder as $eOXet$ImagePlaceholder, TextPlaceholder as $eOXet$TextPlaceholder, RecommendationGrid as $eOXet$RecommendationGrid, defaultColsAtSize as $eOXet$defaultColsAtSize, defaultGridSpacing as $eOXet$defaultGridSpacing, ProductCardError as $eOXet$ProductCardError } from "@depict-ai/ui/latest";
3
4
  import { generateHydrationScript as $eOXet$generateHydrationScript, renderToString as $eOXet$renderToString, isServer as $eOXet$isServer } from "solid-js/web";
@@ -6,6 +7,10 @@ import { renderToString as $eOXet$renderToString1 } from "react-dom/server";
6
7
  import { getOwner as $eOXet$getOwner, untrack as $eOXet$untrack, runWithOwner as $eOXet$runWithOwner, createEffect as $eOXet$createEffect, on as $eOXet$on, onCleanup as $eOXet$onCleanup } from "solid-js";
7
8
  import { jsx as $eOXet$jsx } from "react/jsx-runtime";
8
9
  import { createPortal as $eOXet$createPortal } from "react-dom";
10
+
11
+ //"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
+ // 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
13
+ // Doing that freaks react out, one can only have one use client statement: https://depictaiworkspace.slack.com/archives/C02BASM9X5J/p1699972968084709 but leaving it here commented out for you rinformation regardless
9
14
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
10
15
  register_es_version("react-ui", "latest");
11
16
  function $4568c09979447ab1$export$4b564d7f5a1b1d43({
@@ -154,7 +159,7 @@ function $4d5c3f13a5ae62a7$export$e46079a2793e9ec7(props, set_portals) {
154
159
  }
155
160
  });
156
161
  }
157
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.1.13";
162
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.1.14";
158
163
  function $2b1fdeb83610500f$export$9fac37a9c21c2f3b(props) {
159
164
  return props.children;
160
165
  }
@@ -258,4 +263,4 @@ function $2b1fdeb83610500f$export$6501da23a2770fc() {
258
263
  }
259
264
  };
260
265
  }
261
- export { $2b1fdeb83610500f$export$9fac37a9c21c2f3b as DepictProvider, $2b1fdeb83610500f$export$a54ec244c8863715 as SearchPage, $2b1fdeb83610500f$export$f7d2f673fc2f091d as CategoryPage, $2b1fdeb83610500f$export$5646050d516e06bc as BreadCrumbs, $2b1fdeb83610500f$export$466cdc317043f6cb as QuickLinks, $2b1fdeb83610500f$export$82cfdc85a4d15688 as RecommendationSlider, $2b1fdeb83610500f$export$80e99ee6b29cadd2 as ComponentAligner, $2b1fdeb83610500f$export$3f37af283f8fb843 as ImagePlaceholder, $2b1fdeb83610500f$export$b0a773486c1c2312 as RecommendationGrid, $2b1fdeb83610500f$export$89c6019e4baa40b1 as TextPlaceholder, $2b1fdeb83610500f$export$9bb30bbe003b82e0 as useSearchField, $2b1fdeb83610500f$export$a7f6cffb6b8ba11c as openModal, $2b1fdeb83610500f$export$912994940e660d32 as useSearchModal, $2b1fdeb83610500f$export$38b98fae14bd1f64 as usePerformanceClient, $2b1fdeb83610500f$export$6501da23a2770fc as useFetchRecommendations, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version };
266
+ export { $2b1fdeb83610500f$export$9fac37a9c21c2f3b as DepictProvider, $2b1fdeb83610500f$export$a54ec244c8863715 as SearchPage, $2b1fdeb83610500f$export$f7d2f673fc2f091d as CategoryPage, $2b1fdeb83610500f$export$5646050d516e06bc as BreadCrumbs, $2b1fdeb83610500f$export$466cdc317043f6cb as QuickLinks, $2b1fdeb83610500f$export$82cfdc85a4d15688 as RecommendationSlider, $2b1fdeb83610500f$export$80e99ee6b29cadd2 as ComponentAligner, $2b1fdeb83610500f$export$3f37af283f8fb843 as ImagePlaceholder, $2b1fdeb83610500f$export$b0a773486c1c2312 as RecommendationGrid, $2b1fdeb83610500f$export$89c6019e4baa40b1 as TextPlaceholder, $2b1fdeb83610500f$export$9bb30bbe003b82e0 as useSearchField, $2b1fdeb83610500f$export$a7f6cffb6b8ba11c as openModal, $2b1fdeb83610500f$export$912994940e660d32 as useSearchModal, $2b1fdeb83610500f$export$38b98fae14bd1f64 as usePerformanceClient, $2b1fdeb83610500f$export$6501da23a2770fc as useFetchRecommendations, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version };
package/dist/main.js DELETED
@@ -1,527 +0,0 @@
1
- var $4GYXz$depictaiutilishared = require("@depict-ai/utilishared");
2
- var $4GYXz$depictaiui = require("@depict-ai/ui");
3
- var $4GYXz$solidjs = require("solid-js");
4
- var $4GYXz$solidjsweb = require("solid-js/web");
5
- var $4GYXz$react = require("react");
6
- var $4GYXz$reactjsxruntime = require("react/jsx-runtime");
7
- var $4GYXz$reactdom = require("react-dom");
8
- var $4GYXz$depictaiuilocales = require("@depict-ai/ui/locales");
9
-
10
- function $parcel$export(e, n, v, s) {
11
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
- }
13
-
14
- $parcel$export(module.exports, "QuickLinks", () => $f16af0e861aff3d0$export$466cdc317043f6cb);
15
- $parcel$export(module.exports, "BreadCrumbs", () => $d88e98b11c182b8e$export$5646050d516e06bc);
16
- $parcel$export(module.exports, "DepictAligner", () => $d96434e62e08087d$export$3f4580d6398c5027);
17
- $parcel$export(module.exports, "DepictProvider", () => $24b00503eef73528$export$9fac37a9c21c2f3b);
18
- $parcel$export(module.exports, "DepictCategoryPage", () => $5aa5fcb9f8a2bebc$export$d87c61cecb2edf0d);
19
- $parcel$export(module.exports, "DepictSearchPage", () => $7ad7a3d0011b7b1b$export$210723f5a54a7028);
20
- $parcel$export(module.exports, "DepictSearchField", () => $03c714523ff406fc$export$4c0fa313cf50c4ad);
21
- $parcel$export(module.exports, "ImagePlaceholder", () => $df522c8a81ed5a01$export$3f37af283f8fb843);
22
- $parcel$export(module.exports, "TextPlaceholder", () => $7c8b440edc188ad5$export$89c6019e4baa40b1);
23
- $parcel$export(module.exports, "useDepictSearchModal", () => $3647cad61d03b89c$export$cc1e9aaf280afdcb);
24
- $parcel$export(module.exports, "CategoryTitle", () => $b03e4eee8610ebbe$re_export$CategoryTitle);
25
- $parcel$export(module.exports, "EmbeddedNumProducts", () => $b03e4eee8610ebbe$re_export$EmbeddedNumProducts);
26
- $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fbfd8236492);
27
- $parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
28
- /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
29
- // Note, if you add an export here, also add one in src-server/main.ts
30
-
31
-
32
-
33
- const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
34
- search: null,
35
- category: null,
36
- category_path: null,
37
- search_page_path_: (0, $4GYXz$solidjs.createSignal)(),
38
- required_state_set_: (0, $4GYXz$solidjs.createSignal)(false)
39
- };
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
- let $b4d0d98857ed9934$var$run_on_href_change;
48
- function $b4d0d98857ed9934$export$74f3924c5027fe1d(cb) {
49
- $b4d0d98857ed9934$var$run_on_href_change = cb;
50
- }
51
- (async ()=>{
52
- for await (const href of (0, $4GYXz$depictaiutilishared.href_change_ipns))$b4d0d98857ed9934$var$run_on_href_change?.(href);
53
- })();
54
- const $b4d0d98857ed9934$export$775e6b3892b5ad52 = (url)=>url.pathname == (0, $4GYXz$solidjs.untrack)((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0]); // might have changed therefore get it from globalState
55
- const $b4d0d98857ed9934$export$92a8f8b3c630fa0d = (url)=>{
56
- return $b4d0d98857ed9934$export$775e6b3892b5ad52(url) || url.pathname === (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_path;
57
- };
58
- function $b4d0d98857ed9934$export$f6e64e17bd69eeef(solid_component, props, wrapper_type = "div", wrapper_style = {}, react_render_handler) {
59
- const [portals, set_portals] = (0, $4GYXz$react.useState)([]);
60
- const wrapper_element_ref = (0, $4GYXz$react.useRef)();
61
- (0, $4GYXz$react.useEffect)(()=>{
62
- const wrapper_element = wrapper_element_ref.current;
63
- const dispose = (0, $4GYXz$solidjsweb.render)(()=>solid_component(props, set_portals), wrapper_element);
64
- return dispose;
65
- }, []);
66
- react_render_handler?.(props);
67
- return (0, $4GYXz$react.createElement)(wrapper_type, {
68
- ref: wrapper_element_ref,
69
- style: wrapper_style
70
- }, portals);
71
- }
72
- function $b4d0d98857ed9934$export$e5139bbbb9a05035(component, is_set = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[0]) {
73
- return (...args)=>{
74
- return (0, $4GYXz$solidjs.createComponent)((0, $4GYXz$solidjs.Show), {
75
- get when () {
76
- return is_set();
77
- },
78
- get children () {
79
- return component(...args);
80
- }
81
- });
82
- };
83
- }
84
- async function $b4d0d98857ed9934$export$79c79419c1ef0081({ display: display , info: info , component_portals: component_portals , set_portals: set_portals , react_template: react_template }) {
85
- const solid_container = document.createElement("div");
86
- const react_has_rendered = new Promise((r)=>{
87
- const m_o = new MutationObserver(()=>{
88
- m_o.disconnect();
89
- r();
90
- });
91
- m_o.observe(solid_container, {
92
- childList: true
93
- });
94
- });
95
- const is_placeholder = info.rendering_options.type === "placeholder";
96
- const reactProductCard = (0, $4GYXz$reactjsxruntime.jsx)(react_template, {
97
- display: is_placeholder ? null : display
98
- });
99
- const portal = $4GYXz$reactdom.createPortal(reactProductCard, solid_container);
100
- component_portals.add(portal);
101
- set_portals([
102
- ...component_portals
103
- ]);
104
- (0, $4GYXz$solidjs.onCleanup)(()=>{
105
- // this will stop working after any await so be careful to not await before this, or you'll have to carry the owner over with getOwner and runWithOwner
106
- component_portals.delete(portal);
107
- set_portals([
108
- ...component_portals
109
- ]);
110
- });
111
- await react_has_rendered; // wait for react to have finish portaling the elements so that the placeholders get removed once we have an actual result and so that the PLP code knows it has a placeholder when this is a placeholder rendering
112
- return [
113
- solid_container
114
- ];
115
- }
116
-
117
-
118
-
119
-
120
- function $03c714523ff406fc$export$4c0fa313cf50c4ad() {
121
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)(()=>(0, $4GYXz$depictaiui.SearchField)({
122
- depict_search: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search
123
- })), {});
124
- }
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
- let $6319748b4f0426f0$var$set = false;
133
- let $6319748b4f0426f0$var$padding_animation;
134
- function $6319748b4f0426f0$export$6453cbc34515a94d(is_search_page) {
135
- if ($6319748b4f0426f0$var$set) return; // Just being safe
136
- $6319748b4f0426f0$var$set = true;
137
- let should_use_old_scroll = false;
138
- const old_scrollTo = window.scrollTo;
139
- window.scrollTo = (...args)=>{
140
- if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !is_search_page(location)) return Reflect.apply(old_scrollTo, window, args);
141
- else should_use_old_scroll = true;
142
- };
143
- addEventListener("popstate", (0, $4GYXz$depictaiutilishared.catchify)(()=>{
144
- if (!is_search_page(location)) {
145
- $6319748b4f0426f0$var$removeLotsOfPadding(); // Just making sure
146
- return;
147
- }
148
- should_use_old_scroll = false;
149
- $6319748b4f0426f0$var$addLotsOfPadding();
150
- (0, $4GYXz$depictaiutilishared.observer).wait_for_element(".depict.plp .listing-page").then(()=>{
151
- $6319748b4f0426f0$var$removeLotsOfPadding();
152
- });
153
- }));
154
- (0, $4GYXz$depictaiutilishared.history_replacer)(()=>{
155
- (0, $4GYXz$depictaiutilishared.queueMacroTask)(()=>{
156
- $6319748b4f0426f0$var$removeLotsOfPadding();
157
- });
158
- }, false);
159
- window?.next?.router?.events?.on("routeChangeStart", ()=>{
160
- $6319748b4f0426f0$var$addLotsOfPadding();
161
- });
162
- }
163
- /*
164
- Here we want to be able to add padding that *definitely* gets applied and then be able to revert precisely to what was before.
165
- The best way to achieve this is using an animation that with the fill set to none. This is because animations have the absolute highest precedence in CSS, even higher than !important. Then, to revert to the old padding, we just play the animation which is 1ms long so, it immediately finishes and whatever was defined before takes precedence again.
166
- */ function $6319748b4f0426f0$var$addLotsOfPadding() {
167
- if ($6319748b4f0426f0$var$padding_animation) return; // We're already showing a bunch of padding
168
- $6319748b4f0426f0$var$padding_animation = document.body.animate({
169
- paddingBottom: (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px",
170
- offset: 0
171
- }, 1);
172
- $6319748b4f0426f0$var$padding_animation.pause();
173
- }
174
- function $6319748b4f0426f0$var$removeLotsOfPadding() {
175
- if ($6319748b4f0426f0$var$padding_animation) {
176
- $6319748b4f0426f0$var$padding_animation.play();
177
- $6319748b4f0426f0$var$padding_animation = undefined;
178
- }
179
- }
180
-
181
-
182
-
183
-
184
- const $bc389476eeb2b615$export$599d4515591ef232 = (href)=>{
185
- const shallow = (0, $b4d0d98857ed9934$export$92a8f8b3c630fa0d)(location);
186
- window.next.router.push(href, undefined, {
187
- shallow: shallow,
188
- scroll: true
189
- });
190
- };
191
-
192
-
193
-
194
- function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
195
- const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale } = props;
196
- const usedLocale = locale ?? (0, $4GYXz$depictaiuilocales.en);
197
- const { searchPagePath: searchPagePath , urlParamName: urlParamName , enableCategorySuggestions: enableCategorySuggestions } = props.search ?? {};
198
- if (!market || !merchant) {
199
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](false);
200
- return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, children);
201
- }
202
- try {
203
- const { search: search , category: category } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
204
- const [get_search_page_path, set_search_page_path] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_;
205
- set_search_page_path(searchPagePath);
206
- const on_navigation = typeof window?.next?.router !== "undefined" || navigateFunction ? (new_href)=>{
207
- if (navigateFunction) navigateFunction(new_href);
208
- else (0, $bc389476eeb2b615$export$599d4515591ef232)(new_href);
209
- } : undefined;
210
- if (!search) (0, $4GYXz$solidjs.createRoot)(()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search = new (0, $4GYXz$depictaiui.DepictSearch)({
211
- search_query_url_param_name: urlParamName,
212
- market: market,
213
- merchant: merchant,
214
- enable_category_suggestions: enableCategorySuggestions ?? false,
215
- // default category suggestions to false for @depict-ai/react-ui (https://linear.app/depictai/issue/FRO-401/default-enablecategorysuggestions-to-false)
216
- localization: usedLocale,
217
- url_transformer: (url)=>url.pathname = (0, $4GYXz$solidjs.untrack)(get_search_page_path),
218
- on_navigation: on_navigation
219
- }));
220
- else {
221
- search.market = market;
222
- search.merchant = merchant;
223
- search.localization = usedLocale;
224
- }
225
- if (!category) (0, $4GYXz$solidjs.createRoot)(()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category = new (0, $4GYXz$depictaiui.DepictCategory)({
226
- market: market,
227
- merchant: merchant,
228
- localization: usedLocale,
229
- on_navigation: on_navigation
230
- }));
231
- else {
232
- category.market = market;
233
- category.merchant = merchant;
234
- category.localization = usedLocale;
235
- }
236
- (0, $6319748b4f0426f0$export$6453cbc34515a94d)((0, $b4d0d98857ed9934$export$92a8f8b3c630fa0d));
237
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](true);
238
- } catch (e) {
239
- // Make sure to not break the users app if we throw
240
- queueMicrotask(()=>{
241
- throw e;
242
- });
243
- }
244
- return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, children);
245
- }
246
-
247
-
248
-
249
- const $d96434e62e08087d$export$3f4580d6398c5027 = /*#__PURE__*/ (0, $4GYXz$react.forwardRef)((_, ref)=>{
250
- return /*#__PURE__*/ (0, $4GYXz$react.createElement)("div", {
251
- className: "depict aligner",
252
- style: {
253
- height: "100%"
254
- },
255
- ref: ref
256
- });
257
- });
258
-
259
-
260
-
261
-
262
-
263
-
264
- function $7ad7a3d0011b7b1b$export$210723f5a54a7028(props) {
265
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($7ad7a3d0011b7b1b$var$SolidSearchPage), props);
266
- }
267
- function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
268
- const depict_search = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search;
269
- if (!depict_search) throw Error("No depict_search instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
270
- const search_query_updating_blocked_signal = (0, $4GYXz$depictaiui.get_search_query_updating_blocked_signal)(depict_search);
271
- if (!search_query_updating_blocked_signal) throw Error("No search_query_updating_blocked_signal when rendering SearchPage");
272
- const [, set_search_query_updating_blocked_signal] = search_query_updating_blocked_signal;
273
- const update_updating_blocked_signal = ()=>{
274
- set_search_query_updating_blocked_signal(!(0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(location));
275
- };
276
- // react is really slow with disposing components, we want to avoid a flash of another search query when you click on a product and navigate away
277
- (0, $b4d0d98857ed9934$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
278
- (0, $4GYXz$solidjs.createComputed)(()=>{
279
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0](); // if react defined path changes, re-check
280
- update_updating_blocked_signal();
281
- });
282
- const component_portals = new Set();
283
- return (0, $4GYXz$depictaiui.SearchPage)({
284
- // Default config goes here
285
- include_input_field: props.includeInputField ?? true,
286
- cols_at_size: props.columnsAtSize ?? [
287
- [
288
- 4
289
- ],
290
- [
291
- 3,
292
- 1024
293
- ],
294
- [
295
- 2,
296
- 901
297
- ]
298
- ],
299
- grid_spacing: props.gridSpacing ?? "2%",
300
- // Todo: Do we need this?
301
- get_product_id: ()=>"",
302
- depict_search: depict_search,
303
- product_card_template: (display, info)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
304
- display: display,
305
- info: info,
306
- react_template: props.productCard,
307
- component_portals: component_portals,
308
- set_portals: set_portals
309
- })
310
- });
311
- }
312
-
313
-
314
-
315
-
316
-
317
-
318
- let $5aa5fcb9f8a2bebc$var$render_cb;
319
- function $5aa5fcb9f8a2bebc$export$d87c61cecb2edf0d(props) {
320
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($5aa5fcb9f8a2bebc$var$SolidCategoryPage), props, "div", {}, (props)=>$5aa5fcb9f8a2bebc$var$render_cb?.(props));
321
- }
322
- function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
323
- const depict_category = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category;
324
- if (!depict_category) throw Error("No depict_category instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
325
- const [category_state_set, set_category_state_set] = (0, $4GYXz$solidjs.createSignal)(false);
326
- $5aa5fcb9f8a2bebc$var$render_cb = (props)=>{
327
- depict_category.category_id = props.categoryId;
328
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_path = location.pathname;
329
- if (props.categoryId) set_category_state_set(true);
330
- };
331
- $5aa5fcb9f8a2bebc$var$render_cb(props);
332
- const component_portals = new Set();
333
- const category = ()=>(0, $4GYXz$depictaiui.CategoryPage)({
334
- depict_category: depict_category,
335
- cols_at_size: props.columnsAtSize ?? [
336
- [
337
- 4
338
- ],
339
- [
340
- 3,
341
- 1024
342
- ],
343
- [
344
- 2,
345
- 901
346
- ]
347
- ],
348
- grid_spacing: props.gridSpacing ?? "2%",
349
- get_product_id: ()=>"",
350
- category_title: props.categoryTitlePlugin || (0, $4GYXz$depictaiui.CategoryTitle),
351
- show_breadcrumbs: props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs,
352
- show_quicklinks: props.showQuicklinks === undefined ? true : props.showQuicklinks,
353
- product_card_template: (display, info)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
354
- display: display,
355
- info: info,
356
- react_template: props.productCard,
357
- component_portals: component_portals,
358
- set_portals: set_portals
359
- })
360
- });
361
- return (0, $b4d0d98857ed9934$export$e5139bbbb9a05035)(category, category_state_set);
362
- }
363
-
364
-
365
-
366
-
367
-
368
- function $d88e98b11c182b8e$export$5646050d516e06bc() {
369
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($d88e98b11c182b8e$var$vanilla_breadcrumbs), {});
370
- }
371
- function $d88e98b11c182b8e$var$vanilla_breadcrumbs() {
372
- const depict_category = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category;
373
- if (!depict_category) throw Error("No depict_category instance when rendering BreadCrumbs. Did you forget to wrap your app in DepictProvider?");
374
- return (0, $4GYXz$depictaiui.BreadCrumbs)({
375
- depict_category: depict_category
376
- });
377
- }
378
-
379
-
380
-
381
-
382
-
383
- function $f16af0e861aff3d0$export$466cdc317043f6cb() {
384
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($f16af0e861aff3d0$var$vanilla_quick_links), {});
385
- }
386
- function $f16af0e861aff3d0$var$vanilla_quick_links() {
387
- const depict_category = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category;
388
- if (!depict_category) throw Error("No depict_category instance when rendering QuickLinks. Did you forget to wrap your app in DepictProvider?");
389
- return (0, $4GYXz$depictaiui.QuickLinks)({
390
- depict_category: depict_category
391
- });
392
- }
393
-
394
-
395
-
396
-
397
- const $df522c8a81ed5a01$export$3f37af283f8fb843 = ({ aspectRatio: aspectRatio })=>{
398
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)(()=>(0, $4GYXz$depictaiutilishared.ContainedPlaceholderImage)({
399
- aspect_ratio: aspectRatio
400
- }), {}, "div", {
401
- "height": "100%"
402
- });
403
- };
404
-
405
-
406
-
407
-
408
- const $7c8b440edc188ad5$export$89c6019e4baa40b1 = ({ width: width , height: height })=>{
409
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)(()=>(0, $4GYXz$depictaiutilishared.Placeholder)({
410
- width: width,
411
- height: height
412
- }), {}, "div", {
413
- "height": "100%"
414
- });
415
- };
416
-
417
-
418
-
419
-
420
-
421
-
422
-
423
-
424
- const $ef7db890e488d4f4$export$d69d8daa20eae175 = (createOpenModalParams)=>{
425
- const { globalState: globalState , location: location , alignerRef: alignerRef } = createOpenModalParams;
426
- const openModal = ()=>{
427
- const headerAligner = alignerRef?.current;
428
- if (!globalState.search) throw new Error("No active search in the app!");
429
- if (!headerAligner && location === "aligned") throw new Error("No active search header aligner on the page!");
430
- const alignment_height = headerAligner?.clientHeight;
431
- if (location !== "aligned" || isNaN(alignment_height)) {
432
- // Open centered modal
433
- globalState.search.modal_open = true;
434
- return;
435
- }
436
- const style_element = document.createElement("style");
437
- document.head.append(style_element);
438
- const resize_observer = new ResizeObserver((0, $4GYXz$depictaiutilishared.catchify)(()=>{
439
- const styles = (0, $4GYXz$depictaiui.styles_to_valid_css_string)({
440
- ".depict.plp .depict-search-modal .query-input": {
441
- "height": `${headerAligner?.clientHeight}px`
442
- }
443
- });
444
- style_element.replaceChildren(styles);
445
- }));
446
- resize_observer.observe(headerAligner);
447
- let dispose_aligner;
448
- /**
449
- * Setting position to fixed is important to make the modal work with align_field.
450
- */ const style_props_ = (0, $4GYXz$solidjs.createSignal)({
451
- position: "fixed"
452
- });
453
- (0, $4GYXz$solidjs.createRoot)((dispose)=>{
454
- dispose_aligner = ()=>{
455
- resize_observer.disconnect();
456
- style_element.remove();
457
- dispose();
458
- };
459
- (0, $4GYXz$depictaiui.align_field)(style_props_, headerAligner, undefined, false, "top");
460
- });
461
- globalState.search.modal_open = [
462
- {
463
- style_props_: style_props_
464
- },
465
- dispose_aligner
466
- ];
467
- };
468
- return openModal;
469
- };
470
-
471
-
472
- function $3647cad61d03b89c$export$cc1e9aaf280afdcb(params) {
473
- const open = (0, $ef7db890e488d4f4$export$d69d8daa20eae175)({
474
- globalState: $0b7cd4fb39fc3502$export$8e769ad4338a911e,
475
- ...params
476
- });
477
- return {
478
- open: open
479
- };
480
- }
481
-
482
-
483
-
484
-
485
-
486
- const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.59";
487
-
488
-
489
-
490
-
491
- const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(href)=>{
492
- const shallow = (0, $b4d0d98857ed9934$export$92a8f8b3c630fa0d)(location);
493
- router.push(href, undefined, {
494
- shallow: shallow,
495
- scroll: true
496
- });
497
- };
498
-
499
-
500
- /**
501
- * Helper function that creates a function that can be used as the
502
- * navigateFunction callback for DepictProvider when using react-router.
503
- *
504
- * React-router expect relative URLs, so this function will strip the
505
- * protocol, hostname and port from the URL.
506
- *
507
- * @param navigateFunction what useNavigate() returns
508
- * @returns a function that can be used as the navigateFunction callback for DepictProvider
509
- */ const $201a023b63de7d2f$export$d53481656a62aebe = (navigateFunction)=>(href)=>{
510
- const url_object = new URL(href);
511
- return navigateFunction(url_object.pathname + url_object.search + url_object.hash);
512
- };
513
-
514
-
515
- const $b742053c966024b4$export$b8a61e5c71402559 = {
516
- nextRouterNavigation: $e387bd534de10acd$export$804fac5697cfbe35,
517
- reactRouterNavigation: $201a023b63de7d2f$export$d53481656a62aebe
518
- };
519
-
520
-
521
- const $b03e4eee8610ebbe$var$package_name = "@depict-ai/react-ui";
522
- (0, $4GYXz$depictaiutilishared.dlog)($b03e4eee8610ebbe$var$package_name + " version", (0, $db7b67857900028b$export$83d89fbfd8236492));
523
- (0, $4GYXz$depictaiui.add_to_version_info)({
524
- [$b03e4eee8610ebbe$var$package_name]: (0, $db7b67857900028b$export$83d89fbfd8236492)
525
- });
526
-
527
-
package/dist/module.js DELETED
@@ -1,510 +0,0 @@
1
- import {dlog as $TZSbU$dlog, href_change_ipns as $TZSbU$href_change_ipns, catchify as $TZSbU$catchify, observer as $TZSbU$observer, history_replacer as $TZSbU$history_replacer, queueMacroTask as $TZSbU$queueMacroTask, ContainedPlaceholderImage as $TZSbU$ContainedPlaceholderImage, Placeholder as $TZSbU$Placeholder} from "@depict-ai/utilishared";
2
- import {add_to_version_info as $TZSbU$add_to_version_info, CategoryTitle as $43099132aad1ceb6$re_export$CategoryTitle, embedded_num_products as $43099132aad1ceb6$re_export$EmbeddedNumProducts, SearchField as $TZSbU$SearchField, DepictSearch as $TZSbU$DepictSearch, DepictCategory as $TZSbU$DepictCategory, get_search_query_updating_blocked_signal as $TZSbU$get_search_query_updating_blocked_signal, SearchPage as $TZSbU$SearchPage, CategoryPage as $TZSbU$CategoryPage, BreadCrumbs as $TZSbU$BreadCrumbs, QuickLinks as $TZSbU$QuickLinks, styles_to_valid_css_string as $TZSbU$styles_to_valid_css_string, align_field as $TZSbU$align_field} from "@depict-ai/ui";
3
- import {untrack as $TZSbU$untrack, createComponent as $TZSbU$createComponent, Show as $TZSbU$Show, onCleanup as $TZSbU$onCleanup, createSignal as $TZSbU$createSignal, createRoot as $TZSbU$createRoot, createComputed as $TZSbU$createComputed} from "solid-js";
4
- import {render as $TZSbU$render} from "solid-js/web";
5
- import {useState as $TZSbU$useState, useRef as $TZSbU$useRef, useEffect as $TZSbU$useEffect, createElement as $TZSbU$createElement, Fragment as $TZSbU$Fragment, forwardRef as $TZSbU$forwardRef} from "react";
6
- import {jsx as $TZSbU$jsx} from "react/jsx-runtime";
7
- import {createPortal as $TZSbU$createPortal} from "react-dom";
8
- import {en as $TZSbU$en} from "@depict-ai/ui/locales";
9
-
10
- /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
11
- // Note, if you add an export here, also add one in src-server/main.ts
12
-
13
-
14
-
15
- const $42858f023ef23dab$export$8e769ad4338a911e = {
16
- search: null,
17
- category: null,
18
- category_path: null,
19
- search_page_path_: (0, $TZSbU$createSignal)(),
20
- required_state_set_: (0, $TZSbU$createSignal)(false)
21
- };
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
- let $c83ba9ab79386687$var$run_on_href_change;
30
- function $c83ba9ab79386687$export$74f3924c5027fe1d(cb) {
31
- $c83ba9ab79386687$var$run_on_href_change = cb;
32
- }
33
- (async ()=>{
34
- for await (const href of (0, $TZSbU$href_change_ipns))$c83ba9ab79386687$var$run_on_href_change?.(href);
35
- })();
36
- const $c83ba9ab79386687$export$775e6b3892b5ad52 = (url)=>url.pathname == (0, $TZSbU$untrack)((0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_[0]); // might have changed therefore get it from globalState
37
- const $c83ba9ab79386687$export$92a8f8b3c630fa0d = (url)=>{
38
- return $c83ba9ab79386687$export$775e6b3892b5ad52(url) || url.pathname === (0, $42858f023ef23dab$export$8e769ad4338a911e).category_path;
39
- };
40
- function $c83ba9ab79386687$export$f6e64e17bd69eeef(solid_component, props, wrapper_type = "div", wrapper_style = {}, react_render_handler) {
41
- const [portals, set_portals] = (0, $TZSbU$useState)([]);
42
- const wrapper_element_ref = (0, $TZSbU$useRef)();
43
- (0, $TZSbU$useEffect)(()=>{
44
- const wrapper_element = wrapper_element_ref.current;
45
- const dispose = (0, $TZSbU$render)(()=>solid_component(props, set_portals), wrapper_element);
46
- return dispose;
47
- }, []);
48
- react_render_handler?.(props);
49
- return (0, $TZSbU$createElement)(wrapper_type, {
50
- ref: wrapper_element_ref,
51
- style: wrapper_style
52
- }, portals);
53
- }
54
- function $c83ba9ab79386687$export$e5139bbbb9a05035(component, is_set = (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[0]) {
55
- return (...args)=>{
56
- return (0, $TZSbU$createComponent)((0, $TZSbU$Show), {
57
- get when () {
58
- return is_set();
59
- },
60
- get children () {
61
- return component(...args);
62
- }
63
- });
64
- };
65
- }
66
- async function $c83ba9ab79386687$export$79c79419c1ef0081({ display: display , info: info , component_portals: component_portals , set_portals: set_portals , react_template: react_template }) {
67
- const solid_container = document.createElement("div");
68
- const react_has_rendered = new Promise((r)=>{
69
- const m_o = new MutationObserver(()=>{
70
- m_o.disconnect();
71
- r();
72
- });
73
- m_o.observe(solid_container, {
74
- childList: true
75
- });
76
- });
77
- const is_placeholder = info.rendering_options.type === "placeholder";
78
- const reactProductCard = (0, $TZSbU$jsx)(react_template, {
79
- display: is_placeholder ? null : display
80
- });
81
- const portal = $TZSbU$createPortal(reactProductCard, solid_container);
82
- component_portals.add(portal);
83
- set_portals([
84
- ...component_portals
85
- ]);
86
- (0, $TZSbU$onCleanup)(()=>{
87
- // this will stop working after any await so be careful to not await before this, or you'll have to carry the owner over with getOwner and runWithOwner
88
- component_portals.delete(portal);
89
- set_portals([
90
- ...component_portals
91
- ]);
92
- });
93
- await react_has_rendered; // wait for react to have finish portaling the elements so that the placeholders get removed once we have an actual result and so that the PLP code knows it has a placeholder when this is a placeholder rendering
94
- return [
95
- solid_container
96
- ];
97
- }
98
-
99
-
100
-
101
-
102
- function $02e2452814b6e7d6$export$4c0fa313cf50c4ad() {
103
- return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)(()=>(0, $TZSbU$SearchField)({
104
- depict_search: (0, $42858f023ef23dab$export$8e769ad4338a911e).search
105
- })), {});
106
- }
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
- let $8071251ee4e9ffa1$var$set = false;
115
- let $8071251ee4e9ffa1$var$padding_animation;
116
- function $8071251ee4e9ffa1$export$6453cbc34515a94d(is_search_page) {
117
- if ($8071251ee4e9ffa1$var$set) return; // Just being safe
118
- $8071251ee4e9ffa1$var$set = true;
119
- let should_use_old_scroll = false;
120
- const old_scrollTo = window.scrollTo;
121
- window.scrollTo = (...args)=>{
122
- if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !is_search_page(location)) return Reflect.apply(old_scrollTo, window, args);
123
- else should_use_old_scroll = true;
124
- };
125
- addEventListener("popstate", (0, $TZSbU$catchify)(()=>{
126
- if (!is_search_page(location)) {
127
- $8071251ee4e9ffa1$var$removeLotsOfPadding(); // Just making sure
128
- return;
129
- }
130
- should_use_old_scroll = false;
131
- $8071251ee4e9ffa1$var$addLotsOfPadding();
132
- (0, $TZSbU$observer).wait_for_element(".depict.plp .listing-page").then(()=>{
133
- $8071251ee4e9ffa1$var$removeLotsOfPadding();
134
- });
135
- }));
136
- (0, $TZSbU$history_replacer)(()=>{
137
- (0, $TZSbU$queueMacroTask)(()=>{
138
- $8071251ee4e9ffa1$var$removeLotsOfPadding();
139
- });
140
- }, false);
141
- window?.next?.router?.events?.on("routeChangeStart", ()=>{
142
- $8071251ee4e9ffa1$var$addLotsOfPadding();
143
- });
144
- }
145
- /*
146
- Here we want to be able to add padding that *definitely* gets applied and then be able to revert precisely to what was before.
147
- The best way to achieve this is using an animation that with the fill set to none. This is because animations have the absolute highest precedence in CSS, even higher than !important. Then, to revert to the old padding, we just play the animation which is 1ms long so, it immediately finishes and whatever was defined before takes precedence again.
148
- */ function $8071251ee4e9ffa1$var$addLotsOfPadding() {
149
- if ($8071251ee4e9ffa1$var$padding_animation) return; // We're already showing a bunch of padding
150
- $8071251ee4e9ffa1$var$padding_animation = document.body.animate({
151
- paddingBottom: (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px",
152
- offset: 0
153
- }, 1);
154
- $8071251ee4e9ffa1$var$padding_animation.pause();
155
- }
156
- function $8071251ee4e9ffa1$var$removeLotsOfPadding() {
157
- if ($8071251ee4e9ffa1$var$padding_animation) {
158
- $8071251ee4e9ffa1$var$padding_animation.play();
159
- $8071251ee4e9ffa1$var$padding_animation = undefined;
160
- }
161
- }
162
-
163
-
164
-
165
-
166
- const $7216ca4c8308a0f9$export$599d4515591ef232 = (href)=>{
167
- const shallow = (0, $c83ba9ab79386687$export$92a8f8b3c630fa0d)(location);
168
- window.next.router.push(href, undefined, {
169
- shallow: shallow,
170
- scroll: true
171
- });
172
- };
173
-
174
-
175
-
176
- function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
177
- const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale } = props;
178
- const usedLocale = locale ?? (0, $TZSbU$en);
179
- const { searchPagePath: searchPagePath , urlParamName: urlParamName , enableCategorySuggestions: enableCategorySuggestions } = props.search ?? {};
180
- if (!market || !merchant) {
181
- (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](false);
182
- return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, children);
183
- }
184
- try {
185
- const { search: search , category: category } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
186
- const [get_search_page_path, set_search_page_path] = (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_;
187
- set_search_page_path(searchPagePath);
188
- const on_navigation = typeof window?.next?.router !== "undefined" || navigateFunction ? (new_href)=>{
189
- if (navigateFunction) navigateFunction(new_href);
190
- else (0, $7216ca4c8308a0f9$export$599d4515591ef232)(new_href);
191
- } : undefined;
192
- if (!search) (0, $TZSbU$createRoot)(()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).search = new (0, $TZSbU$DepictSearch)({
193
- search_query_url_param_name: urlParamName,
194
- market: market,
195
- merchant: merchant,
196
- enable_category_suggestions: enableCategorySuggestions ?? false,
197
- // default category suggestions to false for @depict-ai/react-ui (https://linear.app/depictai/issue/FRO-401/default-enablecategorysuggestions-to-false)
198
- localization: usedLocale,
199
- url_transformer: (url)=>url.pathname = (0, $TZSbU$untrack)(get_search_page_path),
200
- on_navigation: on_navigation
201
- }));
202
- else {
203
- search.market = market;
204
- search.merchant = merchant;
205
- search.localization = usedLocale;
206
- }
207
- if (!category) (0, $TZSbU$createRoot)(()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).category = new (0, $TZSbU$DepictCategory)({
208
- market: market,
209
- merchant: merchant,
210
- localization: usedLocale,
211
- on_navigation: on_navigation
212
- }));
213
- else {
214
- category.market = market;
215
- category.merchant = merchant;
216
- category.localization = usedLocale;
217
- }
218
- (0, $8071251ee4e9ffa1$export$6453cbc34515a94d)((0, $c83ba9ab79386687$export$92a8f8b3c630fa0d));
219
- (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](true);
220
- } catch (e) {
221
- // Make sure to not break the users app if we throw
222
- queueMicrotask(()=>{
223
- throw e;
224
- });
225
- }
226
- return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, children);
227
- }
228
-
229
-
230
-
231
- const $4db0e2f013fc5124$export$3f4580d6398c5027 = /*#__PURE__*/ (0, $TZSbU$forwardRef)((_, ref)=>{
232
- return /*#__PURE__*/ (0, $TZSbU$createElement)("div", {
233
- className: "depict aligner",
234
- style: {
235
- height: "100%"
236
- },
237
- ref: ref
238
- });
239
- });
240
-
241
-
242
-
243
-
244
-
245
-
246
- function $4a678f0c87b12e78$export$210723f5a54a7028(props) {
247
- return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($4a678f0c87b12e78$var$SolidSearchPage), props);
248
- }
249
- function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
250
- const depict_search = (0, $42858f023ef23dab$export$8e769ad4338a911e).search;
251
- if (!depict_search) throw Error("No depict_search instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
252
- const search_query_updating_blocked_signal = (0, $TZSbU$get_search_query_updating_blocked_signal)(depict_search);
253
- if (!search_query_updating_blocked_signal) throw Error("No search_query_updating_blocked_signal when rendering SearchPage");
254
- const [, set_search_query_updating_blocked_signal] = search_query_updating_blocked_signal;
255
- const update_updating_blocked_signal = ()=>{
256
- set_search_query_updating_blocked_signal(!(0, $c83ba9ab79386687$export$775e6b3892b5ad52)(location));
257
- };
258
- // react is really slow with disposing components, we want to avoid a flash of another search query when you click on a product and navigate away
259
- (0, $c83ba9ab79386687$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
260
- (0, $TZSbU$createComputed)(()=>{
261
- (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_[0](); // if react defined path changes, re-check
262
- update_updating_blocked_signal();
263
- });
264
- const component_portals = new Set();
265
- return (0, $TZSbU$SearchPage)({
266
- // Default config goes here
267
- include_input_field: props.includeInputField ?? true,
268
- cols_at_size: props.columnsAtSize ?? [
269
- [
270
- 4
271
- ],
272
- [
273
- 3,
274
- 1024
275
- ],
276
- [
277
- 2,
278
- 901
279
- ]
280
- ],
281
- grid_spacing: props.gridSpacing ?? "2%",
282
- // Todo: Do we need this?
283
- get_product_id: ()=>"",
284
- depict_search: depict_search,
285
- product_card_template: (display, info)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
286
- display: display,
287
- info: info,
288
- react_template: props.productCard,
289
- component_portals: component_portals,
290
- set_portals: set_portals
291
- })
292
- });
293
- }
294
-
295
-
296
-
297
-
298
-
299
-
300
- let $48d7f568740a317d$var$render_cb;
301
- function $48d7f568740a317d$export$d87c61cecb2edf0d(props) {
302
- return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($48d7f568740a317d$var$SolidCategoryPage), props, "div", {}, (props)=>$48d7f568740a317d$var$render_cb?.(props));
303
- }
304
- function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
305
- const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
306
- if (!depict_category) throw Error("No depict_category instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
307
- const [category_state_set, set_category_state_set] = (0, $TZSbU$createSignal)(false);
308
- $48d7f568740a317d$var$render_cb = (props)=>{
309
- depict_category.category_id = props.categoryId;
310
- (0, $42858f023ef23dab$export$8e769ad4338a911e).category_path = location.pathname;
311
- if (props.categoryId) set_category_state_set(true);
312
- };
313
- $48d7f568740a317d$var$render_cb(props);
314
- const component_portals = new Set();
315
- const category = ()=>(0, $TZSbU$CategoryPage)({
316
- depict_category: depict_category,
317
- cols_at_size: props.columnsAtSize ?? [
318
- [
319
- 4
320
- ],
321
- [
322
- 3,
323
- 1024
324
- ],
325
- [
326
- 2,
327
- 901
328
- ]
329
- ],
330
- grid_spacing: props.gridSpacing ?? "2%",
331
- get_product_id: ()=>"",
332
- category_title: props.categoryTitlePlugin || (0, $43099132aad1ceb6$re_export$CategoryTitle),
333
- show_breadcrumbs: props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs,
334
- show_quicklinks: props.showQuicklinks === undefined ? true : props.showQuicklinks,
335
- product_card_template: (display, info)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
336
- display: display,
337
- info: info,
338
- react_template: props.productCard,
339
- component_portals: component_portals,
340
- set_portals: set_portals
341
- })
342
- });
343
- return (0, $c83ba9ab79386687$export$e5139bbbb9a05035)(category, category_state_set);
344
- }
345
-
346
-
347
-
348
-
349
-
350
- function $f866f7ed9f751af4$export$5646050d516e06bc() {
351
- return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($f866f7ed9f751af4$var$vanilla_breadcrumbs), {});
352
- }
353
- function $f866f7ed9f751af4$var$vanilla_breadcrumbs() {
354
- const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
355
- if (!depict_category) throw Error("No depict_category instance when rendering BreadCrumbs. Did you forget to wrap your app in DepictProvider?");
356
- return (0, $TZSbU$BreadCrumbs)({
357
- depict_category: depict_category
358
- });
359
- }
360
-
361
-
362
-
363
-
364
-
365
- function $b68a14248b7ef667$export$466cdc317043f6cb() {
366
- return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($b68a14248b7ef667$var$vanilla_quick_links), {});
367
- }
368
- function $b68a14248b7ef667$var$vanilla_quick_links() {
369
- const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
370
- if (!depict_category) throw Error("No depict_category instance when rendering QuickLinks. Did you forget to wrap your app in DepictProvider?");
371
- return (0, $TZSbU$QuickLinks)({
372
- depict_category: depict_category
373
- });
374
- }
375
-
376
-
377
-
378
-
379
- const $f446a84f85ba06f6$export$3f37af283f8fb843 = ({ aspectRatio: aspectRatio })=>{
380
- return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)(()=>(0, $TZSbU$ContainedPlaceholderImage)({
381
- aspect_ratio: aspectRatio
382
- }), {}, "div", {
383
- "height": "100%"
384
- });
385
- };
386
-
387
-
388
-
389
-
390
- const $cbd250061abf11cb$export$89c6019e4baa40b1 = ({ width: width , height: height })=>{
391
- return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)(()=>(0, $TZSbU$Placeholder)({
392
- width: width,
393
- height: height
394
- }), {}, "div", {
395
- "height": "100%"
396
- });
397
- };
398
-
399
-
400
-
401
-
402
-
403
-
404
-
405
-
406
- const $5e26376d86621891$export$d69d8daa20eae175 = (createOpenModalParams)=>{
407
- const { globalState: globalState , location: location , alignerRef: alignerRef } = createOpenModalParams;
408
- const openModal = ()=>{
409
- const headerAligner = alignerRef?.current;
410
- if (!globalState.search) throw new Error("No active search in the app!");
411
- if (!headerAligner && location === "aligned") throw new Error("No active search header aligner on the page!");
412
- const alignment_height = headerAligner?.clientHeight;
413
- if (location !== "aligned" || isNaN(alignment_height)) {
414
- // Open centered modal
415
- globalState.search.modal_open = true;
416
- return;
417
- }
418
- const style_element = document.createElement("style");
419
- document.head.append(style_element);
420
- const resize_observer = new ResizeObserver((0, $TZSbU$catchify)(()=>{
421
- const styles = (0, $TZSbU$styles_to_valid_css_string)({
422
- ".depict.plp .depict-search-modal .query-input": {
423
- "height": `${headerAligner?.clientHeight}px`
424
- }
425
- });
426
- style_element.replaceChildren(styles);
427
- }));
428
- resize_observer.observe(headerAligner);
429
- let dispose_aligner;
430
- /**
431
- * Setting position to fixed is important to make the modal work with align_field.
432
- */ const style_props_ = (0, $TZSbU$createSignal)({
433
- position: "fixed"
434
- });
435
- (0, $TZSbU$createRoot)((dispose)=>{
436
- dispose_aligner = ()=>{
437
- resize_observer.disconnect();
438
- style_element.remove();
439
- dispose();
440
- };
441
- (0, $TZSbU$align_field)(style_props_, headerAligner, undefined, false, "top");
442
- });
443
- globalState.search.modal_open = [
444
- {
445
- style_props_: style_props_
446
- },
447
- dispose_aligner
448
- ];
449
- };
450
- return openModal;
451
- };
452
-
453
-
454
- function $cfa72c75e6cf6901$export$cc1e9aaf280afdcb(params) {
455
- const open = (0, $5e26376d86621891$export$d69d8daa20eae175)({
456
- globalState: $42858f023ef23dab$export$8e769ad4338a911e,
457
- ...params
458
- });
459
- return {
460
- open: open
461
- };
462
- }
463
-
464
-
465
-
466
-
467
-
468
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.59";
469
-
470
-
471
-
472
-
473
- const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(href)=>{
474
- const shallow = (0, $c83ba9ab79386687$export$92a8f8b3c630fa0d)(location);
475
- router.push(href, undefined, {
476
- shallow: shallow,
477
- scroll: true
478
- });
479
- };
480
-
481
-
482
- /**
483
- * Helper function that creates a function that can be used as the
484
- * navigateFunction callback for DepictProvider when using react-router.
485
- *
486
- * React-router expect relative URLs, so this function will strip the
487
- * protocol, hostname and port from the URL.
488
- *
489
- * @param navigateFunction what useNavigate() returns
490
- * @returns a function that can be used as the navigateFunction callback for DepictProvider
491
- */ const $01e1970add53d62a$export$d53481656a62aebe = (navigateFunction)=>(href)=>{
492
- const url_object = new URL(href);
493
- return navigateFunction(url_object.pathname + url_object.search + url_object.hash);
494
- };
495
-
496
-
497
- const $97603d19204ec48d$export$b8a61e5c71402559 = {
498
- nextRouterNavigation: $a92aa2beb560b8af$export$804fac5697cfbe35,
499
- reactRouterNavigation: $01e1970add53d62a$export$d53481656a62aebe
500
- };
501
-
502
-
503
- const $43099132aad1ceb6$var$package_name = "@depict-ai/react-ui";
504
- (0, $TZSbU$dlog)($43099132aad1ceb6$var$package_name + " version", (0, $c9c4d066f9a5b51b$export$83d89fbfd8236492));
505
- (0, $TZSbU$add_to_version_info)({
506
- [$43099132aad1ceb6$var$package_name]: (0, $c9c4d066f9a5b51b$export$83d89fbfd8236492)
507
- });
508
-
509
-
510
- export {$b68a14248b7ef667$export$466cdc317043f6cb as QuickLinks, $f866f7ed9f751af4$export$5646050d516e06bc as BreadCrumbs, $4db0e2f013fc5124$export$3f4580d6398c5027 as DepictAligner, $5376eb2a386cd90d$export$9fac37a9c21c2f3b as DepictProvider, $48d7f568740a317d$export$d87c61cecb2edf0d as DepictCategoryPage, $4a678f0c87b12e78$export$210723f5a54a7028 as DepictSearchPage, $02e2452814b6e7d6$export$4c0fa313cf50c4ad as DepictSearchField, $f446a84f85ba06f6$export$3f37af283f8fb843 as ImagePlaceholder, $cbd250061abf11cb$export$89c6019e4baa40b1 as TextPlaceholder, $cfa72c75e6cf6901$export$cc1e9aaf280afdcb as useDepictSearchModal, $43099132aad1ceb6$re_export$CategoryTitle as CategoryTitle, $43099132aad1ceb6$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version, $97603d19204ec48d$export$b8a61e5c71402559 as Navigation};