@depict-ai/react-ui 4.0.22 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ES10/index.cjs +116 -22
- package/ES10/index.d.ts +11 -2
- package/ES10/index.js +117 -24
- package/latest/index.cjs +102 -19
- package/latest/index.d.ts +11 -2
- package/latest/index.js +103 -21
- package/package.json +2 -2
- package/server/ES10/index.cjs +10 -1
- package/server/ES10/index.d.ts +11 -2
- package/server/ES10/index.js +10 -2
- package/server/latest/index.cjs +10 -1
- package/server/latest/index.d.ts +11 -2
- package/server/latest/index.js +10 -2
package/ES10/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ $parcel$export(module.exports, "useSearchModal", () => $0991f250194bf9f3$export$
|
|
|
33
33
|
$parcel$export(module.exports, "useSearchField", () => $fea6ed5be1bf2b27$export$9bb30bbe003b82e0);
|
|
34
34
|
$parcel$export(module.exports, "useFetchRecommendations", () => $2ea1d71b29581906$export$6501da23a2770fc);
|
|
35
35
|
$parcel$export(module.exports, "usePerformanceClient", () => $18f442be2cc59de2$export$38b98fae14bd1f64);
|
|
36
|
+
$parcel$export(module.exports, "useCategoryFilterHelpers", () => $b8893da801486712$export$72616730c1fad2f4);
|
|
36
37
|
$parcel$export(module.exports, "CategoryTitle", () => $151509d164ba25a9$re_export$CategoryTitle);
|
|
37
38
|
$parcel$export(module.exports, "EmbeddedNumProducts", () => $151509d164ba25a9$re_export$EmbeddedNumProducts);
|
|
38
39
|
$parcel$export(module.exports, "SearchModalV2", () => $151509d164ba25a9$re_export$SearchModalV2);
|
|
@@ -41,7 +42,7 @@ $parcel$export(module.exports, "version", () => $efbdd2dab4314170$export$83d89fb
|
|
|
41
42
|
$parcel$export(module.exports, "Navigation", () => $0d3a2413fdeb34b9$export$b8a61e5c71402559);
|
|
42
43
|
/*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
|
|
43
44
|
// Note, if you add an export here, also add one in src-server/main.ts
|
|
44
|
-
const $efbdd2dab4314170$export$83d89fbfd8236492 = "4.0
|
|
45
|
+
const $efbdd2dab4314170$export$83d89fbfd8236492 = "4.1.0";
|
|
45
46
|
const $ef516b1f92253963$export$8e769ad4338a911e = {
|
|
46
47
|
usedLocale: $2kiy7$solidjs.createSignal((0, $2kiy7$depictaiuilocales.defaultLocale)),
|
|
47
48
|
search_instances: new Map(),
|
|
@@ -127,29 +128,37 @@ function $e7ba61a7074c02d3$export$f6e64e17bd69eeef(_ref) {
|
|
|
127
128
|
}), ...portals);
|
|
128
129
|
}
|
|
129
130
|
function $e7ba61a7074c02d3$export$e5139bbbb9a05035(component, is_set) {
|
|
131
|
+
const unset = Symbol();
|
|
132
|
+
const [args, setArgs] = $2kiy7$solidjs.createSignal(unset);
|
|
133
|
+
const default_is_set = $2kiy7$solidjs.createMemo(() => {
|
|
134
|
+
var _globalState$usedLoca;
|
|
135
|
+
return !!((0, $ef516b1f92253963$export$8e769ad4338a911e).merchant[0]() && (0, $ef516b1f92253963$export$8e769ad4338a911e).market[0]() && (_globalState$usedLoca = (0, $ef516b1f92253963$export$8e769ad4338a911e).usedLocale[0]()) !== null && _globalState$usedLoca !== void 0 && _globalState$usedLoca.backend_locale_);
|
|
136
|
+
});
|
|
137
|
+
const should_show = $2kiy7$solidjs.createMemo(prev => {
|
|
138
|
+
if (!prev && (0, $ef516b1f92253963$export$8e769ad4338a911e).provider_is_updating[0]())
|
|
139
|
+
// Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
|
|
140
|
+
// If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
|
|
141
|
+
// Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
|
|
142
|
+
return false;
|
|
143
|
+
return (is_set || default_is_set)();
|
|
144
|
+
});
|
|
145
|
+
// @ts-ignore
|
|
146
|
+
const renderedShow = $2kiy7$solidjs.createComponent((0, $2kiy7$solidjs.Show), {
|
|
147
|
+
get when() {
|
|
148
|
+
// Need to wait with rendering component until we've actually received the args
|
|
149
|
+
return should_show() && args() !== unset;
|
|
150
|
+
},
|
|
151
|
+
get children() {
|
|
152
|
+
return component(...$2kiy7$solidjs.untrack(args));
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
// Previously we did above logic in the function that we return here, but we can't do that since in solid-js insertExpression it says `while (typeof v === "function") v = v();`, that means that if a component returns a function containing a signal value, that signal value changing would lead to the entire component re-rendering.
|
|
156
|
+
// Instead, we have to create our show logic and everything that actually needs an owner above and only return a signal getter that isn't created with the same owner as it's called
|
|
157
|
+
// Relevant debugging playground links: https://playground.solidjs.com/anonymous/9b9bdca1-1fe6-4865-a6e7-850026d07a74, https://playground.solidjs.com/anonymous/cfd5e6cd-6931-43dd-aa9e-c73c855010c6, https://playground.solidjs.com/anonymous/c8b019a6-0cda-4863-8345-f42e1616d714
|
|
130
158
|
return function () {
|
|
131
159
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return !!((0, $ef516b1f92253963$export$8e769ad4338a911e).merchant[0]() && (0, $ef516b1f92253963$export$8e769ad4338a911e).market[0]() && (_globalState$usedLoca = (0, $ef516b1f92253963$export$8e769ad4338a911e).usedLocale[0]()) !== null && _globalState$usedLoca !== void 0 && _globalState$usedLoca.backend_locale_);
|
|
135
|
-
}); // Apparently Show re-renders kids otherwise even if the falsiness of the condition doesn't change
|
|
136
|
-
const should_show = $2kiy7$solidjs.createMemo(prev => {
|
|
137
|
-
if (!prev && (0, $ef516b1f92253963$export$8e769ad4338a911e).provider_is_updating[0]())
|
|
138
|
-
// Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
|
|
139
|
-
// If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
|
|
140
|
-
// Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
|
|
141
|
-
return false;
|
|
142
|
-
return (is_set || default_is_set)();
|
|
143
|
-
});
|
|
144
|
-
// @ts-ignore
|
|
145
|
-
return $2kiy7$solidjs.createComponent((0, $2kiy7$solidjs.Show), {
|
|
146
|
-
get when() {
|
|
147
|
-
return should_show();
|
|
148
|
-
},
|
|
149
|
-
get children() {
|
|
150
|
-
return component(...args);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
160
|
+
setArgs(args);
|
|
161
|
+
return renderedShow;
|
|
153
162
|
};
|
|
154
163
|
}
|
|
155
164
|
let $abe6528d061993d2$var$set = false;
|
|
@@ -1045,6 +1054,91 @@ async function $2ea1d71b29581906$var$fetchRecommendations(opts) {
|
|
|
1045
1054
|
});
|
|
1046
1055
|
return fetchedRecs;
|
|
1047
1056
|
}
|
|
1057
|
+
function $b8893da801486712$export$72616730c1fad2f4(stateKey) {
|
|
1058
|
+
// Create signal that will persist re-renders
|
|
1059
|
+
const [[getStateKeySignalValue, setStateKeySignalValue]] = $2kiy7$react.useState($2kiy7$solidjs.createSignal(stateKey));
|
|
1060
|
+
const [cachedFunctionCalls] = $2kiy7$react.useState({});
|
|
1061
|
+
const [hookFunctionsObject, setHookFunctionsObject] = $2kiy7$react.useState(new Proxy({}, {
|
|
1062
|
+
get(target, property) {
|
|
1063
|
+
return function () {
|
|
1064
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
1065
|
+
// Cache function calls until we have the real functions
|
|
1066
|
+
cachedFunctionCalls[property] = args;
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
}));
|
|
1070
|
+
$2kiy7$react.useEffect(() => {
|
|
1071
|
+
// get_instance_and_track_component may first return something in useEffect because the next-js router first gives us stuff from the URL after hydration (effects have ran) and we only create the instances if merchant and market is set
|
|
1072
|
+
return $2kiy7$solidjs.createRoot(dispose => {
|
|
1073
|
+
let firstRun = true;
|
|
1074
|
+
$2kiy7$solidjs.createRenderEffect(() => {
|
|
1075
|
+
const depict_category = $fe70497a7dcbe63d$export$f4d89133c6985668("category", getStateKeySignalValue(), "useCategoryFilterHelpers");
|
|
1076
|
+
const functions = $b8893da801486712$var$createHookFunctions(depict_category);
|
|
1077
|
+
if (firstRun) {
|
|
1078
|
+
firstRun = false;
|
|
1079
|
+
// Run cached function calls
|
|
1080
|
+
Object.entries(cachedFunctionCalls).forEach(_ref => {
|
|
1081
|
+
var _functions$key;
|
|
1082
|
+
let [key, args] = _ref;
|
|
1083
|
+
return (_functions$key = functions[key]) === null || _functions$key === void 0 ? void 0 : _functions$key.call(functions, ...args);
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
setHookFunctionsObject(functions);
|
|
1087
|
+
});
|
|
1088
|
+
return dispose;
|
|
1089
|
+
});
|
|
1090
|
+
}, []);
|
|
1091
|
+
// When props change, update our signal value so solid can react to stateKey changing
|
|
1092
|
+
$2kiy7$react.useEffect(() => {
|
|
1093
|
+
setStateKeySignalValue(stateKey);
|
|
1094
|
+
}, [stateKey]);
|
|
1095
|
+
return hookFunctionsObject;
|
|
1096
|
+
}
|
|
1097
|
+
function $b8893da801486712$var$createHookFunctions(depictCategory) {
|
|
1098
|
+
const categorySetShouldShowFilters = newValue => {
|
|
1099
|
+
const {
|
|
1100
|
+
historyStateSignals_: {
|
|
1101
|
+
filters_open: [, setFiltersOpen],
|
|
1102
|
+
sorting_open: [, setSortingOpen]
|
|
1103
|
+
}
|
|
1104
|
+
} = depictCategory;
|
|
1105
|
+
if (newValue)
|
|
1106
|
+
// Close sorting so we don't show both at once
|
|
1107
|
+
setSortingOpen(false);
|
|
1108
|
+
setFiltersOpen(newValue);
|
|
1109
|
+
};
|
|
1110
|
+
const categorySetFilter = filter => {
|
|
1111
|
+
const [selectedFilters, setSelectedFilters] = depictCategory.selectedFilters_;
|
|
1112
|
+
const filteredFilters = $2kiy7$solidjs.untrack(selectedFilters).filter(_ref2 => {
|
|
1113
|
+
let {
|
|
1114
|
+
field: field,
|
|
1115
|
+
op: op
|
|
1116
|
+
} = _ref2;
|
|
1117
|
+
return field !== filter.field && op !== filter.op;
|
|
1118
|
+
});
|
|
1119
|
+
filteredFilters.push(filter);
|
|
1120
|
+
setSelectedFilters(filteredFilters);
|
|
1121
|
+
};
|
|
1122
|
+
const categoryExpandFilterGroup = groupToExpand => {
|
|
1123
|
+
const [expandedFilters, setExpandedFilters] = depictCategory.historyStateSignals_.expanded_filters;
|
|
1124
|
+
const newExpanded = $2kiy7$solidjs.untrack(expandedFilters).filter(_ref3 => {
|
|
1125
|
+
let {
|
|
1126
|
+
section_: section_
|
|
1127
|
+
} = _ref3;
|
|
1128
|
+
return section_ !== groupToExpand;
|
|
1129
|
+
});
|
|
1130
|
+
newExpanded.push({
|
|
1131
|
+
section_: groupToExpand,
|
|
1132
|
+
expanded_: true
|
|
1133
|
+
});
|
|
1134
|
+
setExpandedFilters(newExpanded);
|
|
1135
|
+
};
|
|
1136
|
+
return {
|
|
1137
|
+
categorySetShouldShowFilters: categorySetShouldShowFilters,
|
|
1138
|
+
categorySetFilter: categorySetFilter,
|
|
1139
|
+
categoryExpandFilterGroup: categoryExpandFilterGroup
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1048
1142
|
const $6bf91538dbdf0252$export$804fac5697cfbe35 = router => (relativeUrl, _ref) => {
|
|
1049
1143
|
let {
|
|
1050
1144
|
scroll: scroll,
|
package/ES10/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DPC } from "@depict-ai/dpc/ES10";
|
|
2
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";
|
|
3
|
+
import { BaseCategoryProviderConfig, BaseProviderConfig, BaseSearchProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ListingQuery, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations, FilterWithData } 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 = "4.0
|
|
6
|
+
export const version = "4.1.0";
|
|
7
7
|
interface UsePerformanceClientReturn {
|
|
8
8
|
dpc: DPC;
|
|
9
9
|
}
|
|
@@ -602,6 +602,15 @@ interface UseFetchRecommendationsReturn<T extends Display> {
|
|
|
602
602
|
* @returns {UseFetchRecommendationsReturn}
|
|
603
603
|
*/
|
|
604
604
|
export function useFetchRecommendations<T extends ModernDisplay>(): UseFetchRecommendationsReturn<T>;
|
|
605
|
+
/**
|
|
606
|
+
* Gives you some helpers that let you interact with the state of a category page
|
|
607
|
+
* @param stateKey the stateKey of the components to effect, leave unset if you haven't set a stateKey on your components.
|
|
608
|
+
*/
|
|
609
|
+
export function useCategoryFilterHelpers(stateKey: string | undefined): {
|
|
610
|
+
categorySetShouldShowFilters: (shouldShow: boolean) => void;
|
|
611
|
+
categorySetFilter: (filter: FilterWithData) => void;
|
|
612
|
+
categoryExpandFilterGroup: (title: string) => void;
|
|
613
|
+
};
|
|
605
614
|
/**
|
|
606
615
|
* Helper function to navigate to a new page depending on the navigation library used.
|
|
607
616
|
*/
|
package/ES10/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
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";
|
|
3
3
|
import { CategoryTitle as $383b6fd56bf151bd$re_export$CategoryTitle, embedded_num_products as $383b6fd56bf151bd$re_export$EmbeddedNumProducts, SearchModalV2 as $383b6fd56bf151bd$re_export$SearchModalV2, ClassicSearchModal as $383b6fd56bf151bd$re_export$ClassicSearchModal, 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, modalVersionSymbol as $jb2Oo$modalVersionSymbol, open_modal_with_alignment as $jb2Oo$open_modal_with_alignment, SearchField as $jb2Oo$SearchField, fetchDepictRecommendations as $jb2Oo$fetchDepictRecommendations } from "@depict-ai/ui/ES10";
|
|
4
|
-
import { untrack as $jb2Oo$untrack, createRoot as $jb2Oo$createRoot, createEffect as $jb2Oo$createEffect,
|
|
4
|
+
import { untrack as $jb2Oo$untrack, createRoot as $jb2Oo$createRoot, createEffect as $jb2Oo$createEffect, createSignal as $jb2Oo$createSignal, createMemo as $jb2Oo$createMemo, createComponent as $jb2Oo$createComponent, Show as $jb2Oo$Show, createComputed as $jb2Oo$createComputed, onCleanup as $jb2Oo$onCleanup, getOwner as $jb2Oo$getOwner, runWithOwner as $jb2Oo$runWithOwner, on as $jb2Oo$on, mapArray as $jb2Oo$mapArray, createRenderEffect as $jb2Oo$createRenderEffect } from "solid-js";
|
|
5
5
|
import { createElement as $jb2Oo$createElement, Fragment as $jb2Oo$Fragment, useEffect as $jb2Oo$useEffect, useState as $jb2Oo$useState, useRef as $jb2Oo$useRef, forwardRef as $jb2Oo$forwardRef, Component as $jb2Oo$Component, useCallback as $jb2Oo$useCallback } from "react";
|
|
6
6
|
import { defaultLocale as $jb2Oo$defaultLocale } from "@depict-ai/ui/locales/ES10";
|
|
7
7
|
import { render as $jb2Oo$render, hydrate as $jb2Oo$hydrate, isServer as $jb2Oo$isServer, ssr as $jb2Oo$ssr, ssrHydrationKey as $jb2Oo$ssrHydrationKey } from "solid-js/web";
|
|
@@ -15,7 +15,7 @@ import { renderToString as $jb2Oo$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", "ES10");
|
|
18
|
-
const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "4.0
|
|
18
|
+
const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "4.1.0";
|
|
19
19
|
const $8c691d7f86317052$export$8e769ad4338a911e = {
|
|
20
20
|
usedLocale: $jb2Oo$createSignal((0, $jb2Oo$defaultLocale)),
|
|
21
21
|
search_instances: new Map(),
|
|
@@ -101,29 +101,37 @@ function $0dd9d9a9c7da4c1d$export$f6e64e17bd69eeef(_ref) {
|
|
|
101
101
|
}), ...portals);
|
|
102
102
|
}
|
|
103
103
|
function $0dd9d9a9c7da4c1d$export$e5139bbbb9a05035(component, is_set) {
|
|
104
|
+
const unset = Symbol();
|
|
105
|
+
const [args, setArgs] = $jb2Oo$createSignal(unset);
|
|
106
|
+
const default_is_set = $jb2Oo$createMemo(() => {
|
|
107
|
+
var _globalState$usedLoca;
|
|
108
|
+
return !!((0, $8c691d7f86317052$export$8e769ad4338a911e).merchant[0]() && (0, $8c691d7f86317052$export$8e769ad4338a911e).market[0]() && (_globalState$usedLoca = (0, $8c691d7f86317052$export$8e769ad4338a911e).usedLocale[0]()) !== null && _globalState$usedLoca !== void 0 && _globalState$usedLoca.backend_locale_);
|
|
109
|
+
});
|
|
110
|
+
const should_show = $jb2Oo$createMemo(prev => {
|
|
111
|
+
if (!prev && (0, $8c691d7f86317052$export$8e769ad4338a911e).provider_is_updating[0]())
|
|
112
|
+
// Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
|
|
113
|
+
// If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
|
|
114
|
+
// Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
|
|
115
|
+
return false;
|
|
116
|
+
return (is_set || default_is_set)();
|
|
117
|
+
});
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
const renderedShow = $jb2Oo$createComponent((0, $jb2Oo$Show), {
|
|
120
|
+
get when() {
|
|
121
|
+
// Need to wait with rendering component until we've actually received the args
|
|
122
|
+
return should_show() && args() !== unset;
|
|
123
|
+
},
|
|
124
|
+
get children() {
|
|
125
|
+
return component(...$jb2Oo$untrack(args));
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
// Previously we did above logic in the function that we return here, but we can't do that since in solid-js insertExpression it says `while (typeof v === "function") v = v();`, that means that if a component returns a function containing a signal value, that signal value changing would lead to the entire component re-rendering.
|
|
129
|
+
// Instead, we have to create our show logic and everything that actually needs an owner above and only return a signal getter that isn't created with the same owner as it's called
|
|
130
|
+
// Relevant debugging playground links: https://playground.solidjs.com/anonymous/9b9bdca1-1fe6-4865-a6e7-850026d07a74, https://playground.solidjs.com/anonymous/cfd5e6cd-6931-43dd-aa9e-c73c855010c6, https://playground.solidjs.com/anonymous/c8b019a6-0cda-4863-8345-f42e1616d714
|
|
104
131
|
return function () {
|
|
105
132
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return !!((0, $8c691d7f86317052$export$8e769ad4338a911e).merchant[0]() && (0, $8c691d7f86317052$export$8e769ad4338a911e).market[0]() && (_globalState$usedLoca = (0, $8c691d7f86317052$export$8e769ad4338a911e).usedLocale[0]()) !== null && _globalState$usedLoca !== void 0 && _globalState$usedLoca.backend_locale_);
|
|
109
|
-
}); // Apparently Show re-renders kids otherwise even if the falsiness of the condition doesn't change
|
|
110
|
-
const should_show = $jb2Oo$createMemo(prev => {
|
|
111
|
-
if (!prev && (0, $8c691d7f86317052$export$8e769ad4338a911e).provider_is_updating[0]())
|
|
112
|
-
// Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
|
|
113
|
-
// If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
|
|
114
|
-
// Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
|
|
115
|
-
return false;
|
|
116
|
-
return (is_set || default_is_set)();
|
|
117
|
-
});
|
|
118
|
-
// @ts-ignore
|
|
119
|
-
return $jb2Oo$createComponent((0, $jb2Oo$Show), {
|
|
120
|
-
get when() {
|
|
121
|
-
return should_show();
|
|
122
|
-
},
|
|
123
|
-
get children() {
|
|
124
|
-
return component(...args);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
133
|
+
setArgs(args);
|
|
134
|
+
return renderedShow;
|
|
127
135
|
};
|
|
128
136
|
}
|
|
129
137
|
let $64144f6d578fd8ac$var$set = false;
|
|
@@ -1019,6 +1027,91 @@ async function $1895644749ca8d8a$var$fetchRecommendations(opts) {
|
|
|
1019
1027
|
});
|
|
1020
1028
|
return fetchedRecs;
|
|
1021
1029
|
}
|
|
1030
|
+
function $39af3ccd78996343$export$72616730c1fad2f4(stateKey) {
|
|
1031
|
+
// Create signal that will persist re-renders
|
|
1032
|
+
const [[getStateKeySignalValue, setStateKeySignalValue]] = $jb2Oo$useState($jb2Oo$createSignal(stateKey));
|
|
1033
|
+
const [cachedFunctionCalls] = $jb2Oo$useState({});
|
|
1034
|
+
const [hookFunctionsObject, setHookFunctionsObject] = $jb2Oo$useState(new Proxy({}, {
|
|
1035
|
+
get(target, property) {
|
|
1036
|
+
return function () {
|
|
1037
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
1038
|
+
// Cache function calls until we have the real functions
|
|
1039
|
+
cachedFunctionCalls[property] = args;
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
}));
|
|
1043
|
+
$jb2Oo$useEffect(() => {
|
|
1044
|
+
// get_instance_and_track_component may first return something in useEffect because the next-js router first gives us stuff from the URL after hydration (effects have ran) and we only create the instances if merchant and market is set
|
|
1045
|
+
return $jb2Oo$createRoot(dispose => {
|
|
1046
|
+
let firstRun = true;
|
|
1047
|
+
$jb2Oo$createRenderEffect(() => {
|
|
1048
|
+
const depict_category = $fda7a7820477f957$export$f4d89133c6985668("category", getStateKeySignalValue(), "useCategoryFilterHelpers");
|
|
1049
|
+
const functions = $39af3ccd78996343$var$createHookFunctions(depict_category);
|
|
1050
|
+
if (firstRun) {
|
|
1051
|
+
firstRun = false;
|
|
1052
|
+
// Run cached function calls
|
|
1053
|
+
Object.entries(cachedFunctionCalls).forEach(_ref => {
|
|
1054
|
+
var _functions$key;
|
|
1055
|
+
let [key, args] = _ref;
|
|
1056
|
+
return (_functions$key = functions[key]) === null || _functions$key === void 0 ? void 0 : _functions$key.call(functions, ...args);
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
setHookFunctionsObject(functions);
|
|
1060
|
+
});
|
|
1061
|
+
return dispose;
|
|
1062
|
+
});
|
|
1063
|
+
}, []);
|
|
1064
|
+
// When props change, update our signal value so solid can react to stateKey changing
|
|
1065
|
+
$jb2Oo$useEffect(() => {
|
|
1066
|
+
setStateKeySignalValue(stateKey);
|
|
1067
|
+
}, [stateKey]);
|
|
1068
|
+
return hookFunctionsObject;
|
|
1069
|
+
}
|
|
1070
|
+
function $39af3ccd78996343$var$createHookFunctions(depictCategory) {
|
|
1071
|
+
const categorySetShouldShowFilters = newValue => {
|
|
1072
|
+
const {
|
|
1073
|
+
historyStateSignals_: {
|
|
1074
|
+
filters_open: [, setFiltersOpen],
|
|
1075
|
+
sorting_open: [, setSortingOpen]
|
|
1076
|
+
}
|
|
1077
|
+
} = depictCategory;
|
|
1078
|
+
if (newValue)
|
|
1079
|
+
// Close sorting so we don't show both at once
|
|
1080
|
+
setSortingOpen(false);
|
|
1081
|
+
setFiltersOpen(newValue);
|
|
1082
|
+
};
|
|
1083
|
+
const categorySetFilter = filter => {
|
|
1084
|
+
const [selectedFilters, setSelectedFilters] = depictCategory.selectedFilters_;
|
|
1085
|
+
const filteredFilters = $jb2Oo$untrack(selectedFilters).filter(_ref2 => {
|
|
1086
|
+
let {
|
|
1087
|
+
field: field,
|
|
1088
|
+
op: op
|
|
1089
|
+
} = _ref2;
|
|
1090
|
+
return field !== filter.field && op !== filter.op;
|
|
1091
|
+
});
|
|
1092
|
+
filteredFilters.push(filter);
|
|
1093
|
+
setSelectedFilters(filteredFilters);
|
|
1094
|
+
};
|
|
1095
|
+
const categoryExpandFilterGroup = groupToExpand => {
|
|
1096
|
+
const [expandedFilters, setExpandedFilters] = depictCategory.historyStateSignals_.expanded_filters;
|
|
1097
|
+
const newExpanded = $jb2Oo$untrack(expandedFilters).filter(_ref3 => {
|
|
1098
|
+
let {
|
|
1099
|
+
section_: section_
|
|
1100
|
+
} = _ref3;
|
|
1101
|
+
return section_ !== groupToExpand;
|
|
1102
|
+
});
|
|
1103
|
+
newExpanded.push({
|
|
1104
|
+
section_: groupToExpand,
|
|
1105
|
+
expanded_: true
|
|
1106
|
+
});
|
|
1107
|
+
setExpandedFilters(newExpanded);
|
|
1108
|
+
};
|
|
1109
|
+
return {
|
|
1110
|
+
categorySetShouldShowFilters: categorySetShouldShowFilters,
|
|
1111
|
+
categorySetFilter: categorySetFilter,
|
|
1112
|
+
categoryExpandFilterGroup: categoryExpandFilterGroup
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1022
1115
|
const $05726fa9c7eda0a1$export$804fac5697cfbe35 = router => (relativeUrl, _ref) => {
|
|
1023
1116
|
let {
|
|
1024
1117
|
scroll: scroll,
|
|
@@ -1044,4 +1137,4 @@ const $a7dfdd84298ae791$export$b8a61e5c71402559 = {
|
|
|
1044
1137
|
nextRouterNavigation: $05726fa9c7eda0a1$export$804fac5697cfbe35
|
|
1045
1138
|
};
|
|
1046
1139
|
$jb2Oo$add_to_version_info("react-ui", (0, $9bd9bb8700ab2ada$export$83d89fbfd8236492));
|
|
1047
|
-
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, $383b6fd56bf151bd$re_export$SearchModalV2 as SearchModalV2, $383b6fd56bf151bd$re_export$ClassicSearchModal as ClassicSearchModal, $9bd9bb8700ab2ada$export$83d89fbfd8236492 as version, $a7dfdd84298ae791$export$b8a61e5c71402559 as Navigation };
|
|
1140
|
+
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, $39af3ccd78996343$export$72616730c1fad2f4 as useCategoryFilterHelpers, $383b6fd56bf151bd$re_export$CategoryTitle as CategoryTitle, $383b6fd56bf151bd$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $383b6fd56bf151bd$re_export$SearchModalV2 as SearchModalV2, $383b6fd56bf151bd$re_export$ClassicSearchModal as ClassicSearchModal, $9bd9bb8700ab2ada$export$83d89fbfd8236492 as version, $a7dfdd84298ae791$export$b8a61e5c71402559 as Navigation };
|
package/latest/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ $parcel$export(module.exports, "useSearchModal", () => $ae73b15c325f1b21$export$
|
|
|
33
33
|
$parcel$export(module.exports, "useSearchField", () => $913da7f4d0bc77f2$export$9bb30bbe003b82e0);
|
|
34
34
|
$parcel$export(module.exports, "useFetchRecommendations", () => $a134ea100690b628$export$6501da23a2770fc);
|
|
35
35
|
$parcel$export(module.exports, "usePerformanceClient", () => $25c0a91312868994$export$38b98fae14bd1f64);
|
|
36
|
+
$parcel$export(module.exports, "useCategoryFilterHelpers", () => $a2654d3e936d0024$export$72616730c1fad2f4);
|
|
36
37
|
$parcel$export(module.exports, "CategoryTitle", () => $b03e4eee8610ebbe$re_export$CategoryTitle);
|
|
37
38
|
$parcel$export(module.exports, "EmbeddedNumProducts", () => $b03e4eee8610ebbe$re_export$EmbeddedNumProducts);
|
|
38
39
|
$parcel$export(module.exports, "SearchModalV2", () => $b03e4eee8610ebbe$re_export$SearchModalV2);
|
|
@@ -41,7 +42,7 @@ $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fb
|
|
|
41
42
|
$parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
|
|
42
43
|
/*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
|
|
43
44
|
// Note, if you add an export here, also add one in src-server/main.ts
|
|
44
|
-
const $db7b67857900028b$export$83d89fbfd8236492 = "4.0
|
|
45
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "4.1.0";
|
|
45
46
|
const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
|
|
46
47
|
usedLocale: $2IzJs$solidjs.createSignal((0, $2IzJs$depictaiuilocales.defaultLocale)),
|
|
47
48
|
search_instances: new Map(),
|
|
@@ -119,25 +120,33 @@ function $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
|
119
120
|
}), ...portals);
|
|
120
121
|
}
|
|
121
122
|
function $b4d0d98857ed9934$export$e5139bbbb9a05035(component, is_set) {
|
|
123
|
+
const unset = Symbol();
|
|
124
|
+
const [args, setArgs] = $2IzJs$solidjs.createSignal(unset);
|
|
125
|
+
const default_is_set = $2IzJs$solidjs.createMemo(() => !!((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).merchant[0]() && (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).market[0]() && (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).usedLocale[0]()?.backend_locale_));
|
|
126
|
+
const should_show = $2IzJs$solidjs.createMemo(prev => {
|
|
127
|
+
if (!prev && (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).provider_is_updating[0]())
|
|
128
|
+
// Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
|
|
129
|
+
// If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
|
|
130
|
+
// Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
|
|
131
|
+
return false;
|
|
132
|
+
return (is_set || default_is_set)();
|
|
133
|
+
});
|
|
134
|
+
// @ts-ignore
|
|
135
|
+
const renderedShow = $2IzJs$solidjs.createComponent((0, $2IzJs$solidjs.Show), {
|
|
136
|
+
get when() {
|
|
137
|
+
// Need to wait with rendering component until we've actually received the args
|
|
138
|
+
return should_show() && args() !== unset;
|
|
139
|
+
},
|
|
140
|
+
get children() {
|
|
141
|
+
return component(...$2IzJs$solidjs.untrack(args));
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
// Previously we did above logic in the function that we return here, but we can't do that since in solid-js insertExpression it says `while (typeof v === "function") v = v();`, that means that if a component returns a function containing a signal value, that signal value changing would lead to the entire component re-rendering.
|
|
145
|
+
// Instead, we have to create our show logic and everything that actually needs an owner above and only return a signal getter that isn't created with the same owner as it's called
|
|
146
|
+
// Relevant debugging playground links: https://playground.solidjs.com/anonymous/9b9bdca1-1fe6-4865-a6e7-850026d07a74, https://playground.solidjs.com/anonymous/cfd5e6cd-6931-43dd-aa9e-c73c855010c6, https://playground.solidjs.com/anonymous/c8b019a6-0cda-4863-8345-f42e1616d714
|
|
122
147
|
return (...args) => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (!prev && (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).provider_is_updating[0]())
|
|
126
|
-
// Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
|
|
127
|
-
// If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
|
|
128
|
-
// Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
|
|
129
|
-
return false;
|
|
130
|
-
return (is_set || default_is_set)();
|
|
131
|
-
});
|
|
132
|
-
// @ts-ignore
|
|
133
|
-
return $2IzJs$solidjs.createComponent((0, $2IzJs$solidjs.Show), {
|
|
134
|
-
get when() {
|
|
135
|
-
return should_show();
|
|
136
|
-
},
|
|
137
|
-
get children() {
|
|
138
|
-
return component(...args);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
148
|
+
setArgs(args);
|
|
149
|
+
return renderedShow;
|
|
141
150
|
};
|
|
142
151
|
}
|
|
143
152
|
let $6319748b4f0426f0$var$set = false;
|
|
@@ -994,6 +1003,80 @@ async function $a134ea100690b628$var$fetchRecommendations(opts) {
|
|
|
994
1003
|
});
|
|
995
1004
|
return fetchedRecs;
|
|
996
1005
|
}
|
|
1006
|
+
function $a2654d3e936d0024$export$72616730c1fad2f4(stateKey) {
|
|
1007
|
+
// Create signal that will persist re-renders
|
|
1008
|
+
const [[getStateKeySignalValue, setStateKeySignalValue]] = $2IzJs$react.useState($2IzJs$solidjs.createSignal(stateKey));
|
|
1009
|
+
const [cachedFunctionCalls] = $2IzJs$react.useState({});
|
|
1010
|
+
const [hookFunctionsObject, setHookFunctionsObject] = $2IzJs$react.useState(new Proxy({}, {
|
|
1011
|
+
get(target, property) {
|
|
1012
|
+
return (...args) => {
|
|
1013
|
+
// Cache function calls until we have the real functions
|
|
1014
|
+
cachedFunctionCalls[property] = args;
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
}));
|
|
1018
|
+
$2IzJs$react.useEffect(() => {
|
|
1019
|
+
// get_instance_and_track_component may first return something in useEffect because the next-js router first gives us stuff from the URL after hydration (effects have ran) and we only create the instances if merchant and market is set
|
|
1020
|
+
return $2IzJs$solidjs.createRoot(dispose => {
|
|
1021
|
+
let firstRun = true;
|
|
1022
|
+
$2IzJs$solidjs.createRenderEffect(() => {
|
|
1023
|
+
const depict_category = $2506fd72fd4393aa$export$f4d89133c6985668("category", getStateKeySignalValue(), "useCategoryFilterHelpers");
|
|
1024
|
+
const functions = $a2654d3e936d0024$var$createHookFunctions(depict_category);
|
|
1025
|
+
if (firstRun) {
|
|
1026
|
+
firstRun = false;
|
|
1027
|
+
// Run cached function calls
|
|
1028
|
+
Object.entries(cachedFunctionCalls).forEach(([key, args]) => functions[key]?.(...args));
|
|
1029
|
+
}
|
|
1030
|
+
setHookFunctionsObject(functions);
|
|
1031
|
+
});
|
|
1032
|
+
return dispose;
|
|
1033
|
+
});
|
|
1034
|
+
}, []);
|
|
1035
|
+
// When props change, update our signal value so solid can react to stateKey changing
|
|
1036
|
+
$2IzJs$react.useEffect(() => {
|
|
1037
|
+
setStateKeySignalValue(stateKey);
|
|
1038
|
+
}, [stateKey]);
|
|
1039
|
+
return hookFunctionsObject;
|
|
1040
|
+
}
|
|
1041
|
+
function $a2654d3e936d0024$var$createHookFunctions(depictCategory) {
|
|
1042
|
+
const categorySetShouldShowFilters = newValue => {
|
|
1043
|
+
const {
|
|
1044
|
+
historyStateSignals_: {
|
|
1045
|
+
filters_open: [, setFiltersOpen],
|
|
1046
|
+
sorting_open: [, setSortingOpen]
|
|
1047
|
+
}
|
|
1048
|
+
} = depictCategory;
|
|
1049
|
+
if (newValue)
|
|
1050
|
+
// Close sorting so we don't show both at once
|
|
1051
|
+
setSortingOpen(false);
|
|
1052
|
+
setFiltersOpen(newValue);
|
|
1053
|
+
};
|
|
1054
|
+
const categorySetFilter = filter => {
|
|
1055
|
+
const [selectedFilters, setSelectedFilters] = depictCategory.selectedFilters_;
|
|
1056
|
+
const filteredFilters = $2IzJs$solidjs.untrack(selectedFilters).filter(({
|
|
1057
|
+
field: field,
|
|
1058
|
+
op: op
|
|
1059
|
+
}) => field !== filter.field && op !== filter.op);
|
|
1060
|
+
filteredFilters.push(filter);
|
|
1061
|
+
setSelectedFilters(filteredFilters);
|
|
1062
|
+
};
|
|
1063
|
+
const categoryExpandFilterGroup = groupToExpand => {
|
|
1064
|
+
const [expandedFilters, setExpandedFilters] = depictCategory.historyStateSignals_.expanded_filters;
|
|
1065
|
+
const newExpanded = $2IzJs$solidjs.untrack(expandedFilters).filter(({
|
|
1066
|
+
section_: section_
|
|
1067
|
+
}) => section_ !== groupToExpand);
|
|
1068
|
+
newExpanded.push({
|
|
1069
|
+
section_: groupToExpand,
|
|
1070
|
+
expanded_: true
|
|
1071
|
+
});
|
|
1072
|
+
setExpandedFilters(newExpanded);
|
|
1073
|
+
};
|
|
1074
|
+
return {
|
|
1075
|
+
categorySetShouldShowFilters: categorySetShouldShowFilters,
|
|
1076
|
+
categorySetFilter: categorySetFilter,
|
|
1077
|
+
categoryExpandFilterGroup: categoryExpandFilterGroup
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
997
1080
|
const $e387bd534de10acd$export$804fac5697cfbe35 = router => (relativeUrl, {
|
|
998
1081
|
scroll: scroll,
|
|
999
1082
|
replace: replace
|
package/latest/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DPC } from "@depict-ai/dpc/latest";
|
|
2
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";
|
|
3
|
+
import { BaseCategoryProviderConfig, BaseProviderConfig, BaseSearchProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ListingQuery, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations, FilterWithData } 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 = "4.0
|
|
6
|
+
export const version = "4.1.0";
|
|
7
7
|
interface UsePerformanceClientReturn {
|
|
8
8
|
dpc: DPC;
|
|
9
9
|
}
|
|
@@ -602,6 +602,15 @@ interface UseFetchRecommendationsReturn<T extends Display> {
|
|
|
602
602
|
* @returns {UseFetchRecommendationsReturn}
|
|
603
603
|
*/
|
|
604
604
|
export function useFetchRecommendations<T extends ModernDisplay>(): UseFetchRecommendationsReturn<T>;
|
|
605
|
+
/**
|
|
606
|
+
* Gives you some helpers that let you interact with the state of a category page
|
|
607
|
+
* @param stateKey the stateKey of the components to effect, leave unset if you haven't set a stateKey on your components.
|
|
608
|
+
*/
|
|
609
|
+
export function useCategoryFilterHelpers(stateKey: string | undefined): {
|
|
610
|
+
categorySetShouldShowFilters: (shouldShow: boolean) => void;
|
|
611
|
+
categorySetFilter: (filter: FilterWithData) => void;
|
|
612
|
+
categoryExpandFilterGroup: (title: string) => void;
|
|
613
|
+
};
|
|
605
614
|
/**
|
|
606
615
|
* Helper function to navigate to a new page depending on the navigation library used.
|
|
607
616
|
*/
|
package/latest/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
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";
|
|
3
3
|
import { CategoryTitle as $43099132aad1ceb6$re_export$CategoryTitle, embedded_num_products as $43099132aad1ceb6$re_export$EmbeddedNumProducts, SearchModalV2 as $43099132aad1ceb6$re_export$SearchModalV2, ClassicSearchModal as $43099132aad1ceb6$re_export$ClassicSearchModal, 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, modalVersionSymbol as $2GFvs$modalVersionSymbol, open_modal_with_alignment as $2GFvs$open_modal_with_alignment, SearchField as $2GFvs$SearchField, fetchDepictRecommendations as $2GFvs$fetchDepictRecommendations } from "@depict-ai/ui/latest";
|
|
4
|
-
import { untrack as $2GFvs$untrack, createRoot as $2GFvs$createRoot, createEffect as $2GFvs$createEffect,
|
|
4
|
+
import { untrack as $2GFvs$untrack, createRoot as $2GFvs$createRoot, createEffect as $2GFvs$createEffect, createSignal as $2GFvs$createSignal, createMemo as $2GFvs$createMemo, createComponent as $2GFvs$createComponent, Show as $2GFvs$Show, createComputed as $2GFvs$createComputed, onCleanup as $2GFvs$onCleanup, getOwner as $2GFvs$getOwner, runWithOwner as $2GFvs$runWithOwner, on as $2GFvs$on, mapArray as $2GFvs$mapArray, createRenderEffect as $2GFvs$createRenderEffect } from "solid-js";
|
|
5
5
|
import { createElement as $2GFvs$createElement, Fragment as $2GFvs$Fragment, useEffect as $2GFvs$useEffect, useState as $2GFvs$useState, useRef as $2GFvs$useRef, forwardRef as $2GFvs$forwardRef, Component as $2GFvs$Component, useCallback as $2GFvs$useCallback } from "react";
|
|
6
6
|
import { defaultLocale as $2GFvs$defaultLocale } from "@depict-ai/ui/locales/latest";
|
|
7
7
|
import { render as $2GFvs$render, hydrate as $2GFvs$hydrate, isServer as $2GFvs$isServer, ssr as $2GFvs$ssr, ssrHydrationKey as $2GFvs$ssrHydrationKey } from "solid-js/web";
|
|
@@ -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 = "4.0
|
|
18
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "4.1.0";
|
|
19
19
|
const $42858f023ef23dab$export$8e769ad4338a911e = {
|
|
20
20
|
usedLocale: $2GFvs$createSignal((0, $2GFvs$defaultLocale)),
|
|
21
21
|
search_instances: new Map(),
|
|
@@ -93,25 +93,33 @@ function $c83ba9ab79386687$export$f6e64e17bd69eeef({
|
|
|
93
93
|
}), ...portals);
|
|
94
94
|
}
|
|
95
95
|
function $c83ba9ab79386687$export$e5139bbbb9a05035(component, is_set) {
|
|
96
|
+
const unset = Symbol();
|
|
97
|
+
const [args, setArgs] = $2GFvs$createSignal(unset);
|
|
98
|
+
const default_is_set = $2GFvs$createMemo(() => !!((0, $42858f023ef23dab$export$8e769ad4338a911e).merchant[0]() && (0, $42858f023ef23dab$export$8e769ad4338a911e).market[0]() && (0, $42858f023ef23dab$export$8e769ad4338a911e).usedLocale[0]()?.backend_locale_));
|
|
99
|
+
const should_show = $2GFvs$createMemo(prev => {
|
|
100
|
+
if (!prev && (0, $42858f023ef23dab$export$8e769ad4338a911e).provider_is_updating[0]())
|
|
101
|
+
// Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
|
|
102
|
+
// If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
|
|
103
|
+
// Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
|
|
104
|
+
return false;
|
|
105
|
+
return (is_set || default_is_set)();
|
|
106
|
+
});
|
|
107
|
+
// @ts-ignore
|
|
108
|
+
const renderedShow = $2GFvs$createComponent((0, $2GFvs$Show), {
|
|
109
|
+
get when() {
|
|
110
|
+
// Need to wait with rendering component until we've actually received the args
|
|
111
|
+
return should_show() && args() !== unset;
|
|
112
|
+
},
|
|
113
|
+
get children() {
|
|
114
|
+
return component(...$2GFvs$untrack(args));
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
// Previously we did above logic in the function that we return here, but we can't do that since in solid-js insertExpression it says `while (typeof v === "function") v = v();`, that means that if a component returns a function containing a signal value, that signal value changing would lead to the entire component re-rendering.
|
|
118
|
+
// Instead, we have to create our show logic and everything that actually needs an owner above and only return a signal getter that isn't created with the same owner as it's called
|
|
119
|
+
// Relevant debugging playground links: https://playground.solidjs.com/anonymous/9b9bdca1-1fe6-4865-a6e7-850026d07a74, https://playground.solidjs.com/anonymous/cfd5e6cd-6931-43dd-aa9e-c73c855010c6, https://playground.solidjs.com/anonymous/c8b019a6-0cda-4863-8345-f42e1616d714
|
|
96
120
|
return (...args) => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (!prev && (0, $42858f023ef23dab$export$8e769ad4338a911e).provider_is_updating[0]())
|
|
100
|
-
// Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
|
|
101
|
-
// If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
|
|
102
|
-
// Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
|
|
103
|
-
return false;
|
|
104
|
-
return (is_set || default_is_set)();
|
|
105
|
-
});
|
|
106
|
-
// @ts-ignore
|
|
107
|
-
return $2GFvs$createComponent((0, $2GFvs$Show), {
|
|
108
|
-
get when() {
|
|
109
|
-
return should_show();
|
|
110
|
-
},
|
|
111
|
-
get children() {
|
|
112
|
-
return component(...args);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
121
|
+
setArgs(args);
|
|
122
|
+
return renderedShow;
|
|
115
123
|
};
|
|
116
124
|
}
|
|
117
125
|
let $8071251ee4e9ffa1$var$set = false;
|
|
@@ -968,6 +976,80 @@ async function $1bb4271dc44722e2$var$fetchRecommendations(opts) {
|
|
|
968
976
|
});
|
|
969
977
|
return fetchedRecs;
|
|
970
978
|
}
|
|
979
|
+
function $4d60f63392752531$export$72616730c1fad2f4(stateKey) {
|
|
980
|
+
// Create signal that will persist re-renders
|
|
981
|
+
const [[getStateKeySignalValue, setStateKeySignalValue]] = $2GFvs$useState($2GFvs$createSignal(stateKey));
|
|
982
|
+
const [cachedFunctionCalls] = $2GFvs$useState({});
|
|
983
|
+
const [hookFunctionsObject, setHookFunctionsObject] = $2GFvs$useState(new Proxy({}, {
|
|
984
|
+
get(target, property) {
|
|
985
|
+
return (...args) => {
|
|
986
|
+
// Cache function calls until we have the real functions
|
|
987
|
+
cachedFunctionCalls[property] = args;
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
}));
|
|
991
|
+
$2GFvs$useEffect(() => {
|
|
992
|
+
// get_instance_and_track_component may first return something in useEffect because the next-js router first gives us stuff from the URL after hydration (effects have ran) and we only create the instances if merchant and market is set
|
|
993
|
+
return $2GFvs$createRoot(dispose => {
|
|
994
|
+
let firstRun = true;
|
|
995
|
+
$2GFvs$createRenderEffect(() => {
|
|
996
|
+
const depict_category = $99489374cd4f601d$export$f4d89133c6985668("category", getStateKeySignalValue(), "useCategoryFilterHelpers");
|
|
997
|
+
const functions = $4d60f63392752531$var$createHookFunctions(depict_category);
|
|
998
|
+
if (firstRun) {
|
|
999
|
+
firstRun = false;
|
|
1000
|
+
// Run cached function calls
|
|
1001
|
+
Object.entries(cachedFunctionCalls).forEach(([key, args]) => functions[key]?.(...args));
|
|
1002
|
+
}
|
|
1003
|
+
setHookFunctionsObject(functions);
|
|
1004
|
+
});
|
|
1005
|
+
return dispose;
|
|
1006
|
+
});
|
|
1007
|
+
}, []);
|
|
1008
|
+
// When props change, update our signal value so solid can react to stateKey changing
|
|
1009
|
+
$2GFvs$useEffect(() => {
|
|
1010
|
+
setStateKeySignalValue(stateKey);
|
|
1011
|
+
}, [stateKey]);
|
|
1012
|
+
return hookFunctionsObject;
|
|
1013
|
+
}
|
|
1014
|
+
function $4d60f63392752531$var$createHookFunctions(depictCategory) {
|
|
1015
|
+
const categorySetShouldShowFilters = newValue => {
|
|
1016
|
+
const {
|
|
1017
|
+
historyStateSignals_: {
|
|
1018
|
+
filters_open: [, setFiltersOpen],
|
|
1019
|
+
sorting_open: [, setSortingOpen]
|
|
1020
|
+
}
|
|
1021
|
+
} = depictCategory;
|
|
1022
|
+
if (newValue)
|
|
1023
|
+
// Close sorting so we don't show both at once
|
|
1024
|
+
setSortingOpen(false);
|
|
1025
|
+
setFiltersOpen(newValue);
|
|
1026
|
+
};
|
|
1027
|
+
const categorySetFilter = filter => {
|
|
1028
|
+
const [selectedFilters, setSelectedFilters] = depictCategory.selectedFilters_;
|
|
1029
|
+
const filteredFilters = $2GFvs$untrack(selectedFilters).filter(({
|
|
1030
|
+
field: field,
|
|
1031
|
+
op: op
|
|
1032
|
+
}) => field !== filter.field && op !== filter.op);
|
|
1033
|
+
filteredFilters.push(filter);
|
|
1034
|
+
setSelectedFilters(filteredFilters);
|
|
1035
|
+
};
|
|
1036
|
+
const categoryExpandFilterGroup = groupToExpand => {
|
|
1037
|
+
const [expandedFilters, setExpandedFilters] = depictCategory.historyStateSignals_.expanded_filters;
|
|
1038
|
+
const newExpanded = $2GFvs$untrack(expandedFilters).filter(({
|
|
1039
|
+
section_: section_
|
|
1040
|
+
}) => section_ !== groupToExpand);
|
|
1041
|
+
newExpanded.push({
|
|
1042
|
+
section_: groupToExpand,
|
|
1043
|
+
expanded_: true
|
|
1044
|
+
});
|
|
1045
|
+
setExpandedFilters(newExpanded);
|
|
1046
|
+
};
|
|
1047
|
+
return {
|
|
1048
|
+
categorySetShouldShowFilters: categorySetShouldShowFilters,
|
|
1049
|
+
categorySetFilter: categorySetFilter,
|
|
1050
|
+
categoryExpandFilterGroup: categoryExpandFilterGroup
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
971
1053
|
const $a92aa2beb560b8af$export$804fac5697cfbe35 = router => (relativeUrl, {
|
|
972
1054
|
scroll: scroll,
|
|
973
1055
|
replace: replace
|
|
@@ -992,4 +1074,4 @@ const $97603d19204ec48d$export$b8a61e5c71402559 = {
|
|
|
992
1074
|
nextRouterNavigation: $a92aa2beb560b8af$export$804fac5697cfbe35
|
|
993
1075
|
};
|
|
994
1076
|
$2GFvs$add_to_version_info("react-ui", (0, $c9c4d066f9a5b51b$export$83d89fbfd8236492));
|
|
995
|
-
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, $43099132aad1ceb6$re_export$SearchModalV2 as SearchModalV2, $43099132aad1ceb6$re_export$ClassicSearchModal as ClassicSearchModal, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version, $97603d19204ec48d$export$b8a61e5c71402559 as Navigation };
|
|
1077
|
+
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, $4d60f63392752531$export$72616730c1fad2f4 as useCategoryFilterHelpers, $43099132aad1ceb6$re_export$CategoryTitle as CategoryTitle, $43099132aad1ceb6$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $43099132aad1ceb6$re_export$SearchModalV2 as SearchModalV2, $43099132aad1ceb6$re_export$ClassicSearchModal as ClassicSearchModal, $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": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
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": "^2.0.8",
|
|
139
139
|
"@depict-ai/plp-styling": "^3.0.14",
|
|
140
|
-
"@depict-ai/ui": "^4.0
|
|
140
|
+
"@depict-ai/ui": "^4.1.0",
|
|
141
141
|
"@depict-ai/utilishared": "^2.0.16",
|
|
142
142
|
"solid-js": "^1.8.12"
|
|
143
143
|
},
|
package/server/ES10/index.cjs
CHANGED
|
@@ -17,6 +17,7 @@ function $parcel$export(e, n, v, s) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
$parcel$export(module.exports, "DepictProvider", () => $202459d454907b31$export$9fac37a9c21c2f3b);
|
|
20
|
+
$parcel$export(module.exports, "useCategoryFilterHelpers", () => $202459d454907b31$export$72616730c1fad2f4);
|
|
20
21
|
$parcel$export(module.exports, "SearchPage", () => $202459d454907b31$export$a54ec244c8863715);
|
|
21
22
|
$parcel$export(module.exports, "CategoryPage", () => $202459d454907b31$export$f7d2f673fc2f091d);
|
|
22
23
|
$parcel$export(module.exports, "BreadCrumbs", () => $202459d454907b31$export$5646050d516e06bc);
|
|
@@ -190,10 +191,18 @@ function $3b36cc844440a979$export$e46079a2793e9ec7(props, set_portals) {
|
|
|
190
191
|
}
|
|
191
192
|
});
|
|
192
193
|
}
|
|
193
|
-
const $efbdd2dab4314170$export$83d89fbfd8236492 = "4.0
|
|
194
|
+
const $efbdd2dab4314170$export$83d89fbfd8236492 = "4.1.0";
|
|
194
195
|
function $202459d454907b31$export$9fac37a9c21c2f3b(props) {
|
|
195
196
|
return props.children;
|
|
196
197
|
}
|
|
198
|
+
function $202459d454907b31$export$72616730c1fad2f4() {
|
|
199
|
+
const noop = () => {};
|
|
200
|
+
return {
|
|
201
|
+
categorySetShouldShowFilters: noop,
|
|
202
|
+
categorySetFilter: noop,
|
|
203
|
+
categoryExpandFilterGroup: noop
|
|
204
|
+
};
|
|
205
|
+
}
|
|
197
206
|
function $202459d454907b31$export$a54ec244c8863715() {
|
|
198
207
|
return $aNCHr$react.createElement("div", {
|
|
199
208
|
children: []
|
package/server/ES10/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DPC } from "@depict-ai/dpc/ES10";
|
|
2
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";
|
|
3
|
+
import { BaseCategoryProviderConfig, BaseProviderConfig, BaseSearchProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ListingQuery, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations, FilterWithData } 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 = "4.0
|
|
6
|
+
export const version = "4.1.0";
|
|
7
7
|
interface UsePerformanceClientReturn {
|
|
8
8
|
dpc: DPC;
|
|
9
9
|
}
|
|
@@ -602,6 +602,15 @@ interface UseFetchRecommendationsReturn<T extends Display> {
|
|
|
602
602
|
* @returns {UseFetchRecommendationsReturn}
|
|
603
603
|
*/
|
|
604
604
|
export function useFetchRecommendations<T extends ModernDisplay>(): UseFetchRecommendationsReturn<T>;
|
|
605
|
+
/**
|
|
606
|
+
* Gives you some helpers that let you interact with the state of a category page
|
|
607
|
+
* @param stateKey the stateKey of the components to effect, leave unset if you haven't set a stateKey on your components.
|
|
608
|
+
*/
|
|
609
|
+
export function useCategoryFilterHelpers(stateKey: string | undefined): {
|
|
610
|
+
categorySetShouldShowFilters: (shouldShow: boolean) => void;
|
|
611
|
+
categorySetFilter: (filter: FilterWithData) => void;
|
|
612
|
+
categoryExpandFilterGroup: (title: string) => void;
|
|
613
|
+
};
|
|
605
614
|
/**
|
|
606
615
|
* Helper function to navigate to a new page depending on the navigation library used.
|
|
607
616
|
*/
|
package/server/ES10/index.js
CHANGED
|
@@ -167,10 +167,18 @@ function $cd68097a7ee08669$export$e46079a2793e9ec7(props, set_portals) {
|
|
|
167
167
|
}
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "4.0
|
|
170
|
+
const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "4.1.0";
|
|
171
171
|
function $5c4add0a8fe94894$export$9fac37a9c21c2f3b(props) {
|
|
172
172
|
return props.children;
|
|
173
173
|
}
|
|
174
|
+
function $5c4add0a8fe94894$export$72616730c1fad2f4() {
|
|
175
|
+
const noop = () => {};
|
|
176
|
+
return {
|
|
177
|
+
categorySetShouldShowFilters: noop,
|
|
178
|
+
categorySetFilter: noop,
|
|
179
|
+
categoryExpandFilterGroup: noop
|
|
180
|
+
};
|
|
181
|
+
}
|
|
174
182
|
function $5c4add0a8fe94894$export$a54ec244c8863715() {
|
|
175
183
|
return $7h5e1$createElement("div", {
|
|
176
184
|
children: []
|
|
@@ -271,4 +279,4 @@ function $5c4add0a8fe94894$export$6501da23a2770fc() {
|
|
|
271
279
|
}
|
|
272
280
|
};
|
|
273
281
|
}
|
|
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 };
|
|
282
|
+
export { $5c4add0a8fe94894$export$9fac37a9c21c2f3b as DepictProvider, $5c4add0a8fe94894$export$72616730c1fad2f4 as useCategoryFilterHelpers, $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 };
|
package/server/latest/index.cjs
CHANGED
|
@@ -17,6 +17,7 @@ function $parcel$export(e, n, v, s) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
$parcel$export(module.exports, "DepictProvider", () => $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b);
|
|
20
|
+
$parcel$export(module.exports, "useCategoryFilterHelpers", () => $41e7e5d85b5e0d49$export$72616730c1fad2f4);
|
|
20
21
|
$parcel$export(module.exports, "SearchPage", () => $41e7e5d85b5e0d49$export$a54ec244c8863715);
|
|
21
22
|
$parcel$export(module.exports, "CategoryPage", () => $41e7e5d85b5e0d49$export$f7d2f673fc2f091d);
|
|
22
23
|
$parcel$export(module.exports, "BreadCrumbs", () => $41e7e5d85b5e0d49$export$5646050d516e06bc);
|
|
@@ -182,10 +183,18 @@ function $c6b960f2a07285c8$export$e46079a2793e9ec7(props, set_portals) {
|
|
|
182
183
|
}
|
|
183
184
|
});
|
|
184
185
|
}
|
|
185
|
-
const $db7b67857900028b$export$83d89fbfd8236492 = "4.0
|
|
186
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "4.1.0";
|
|
186
187
|
function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
|
|
187
188
|
return props.children;
|
|
188
189
|
}
|
|
190
|
+
function $41e7e5d85b5e0d49$export$72616730c1fad2f4() {
|
|
191
|
+
const noop = () => {};
|
|
192
|
+
return {
|
|
193
|
+
categorySetShouldShowFilters: noop,
|
|
194
|
+
categorySetFilter: noop,
|
|
195
|
+
categoryExpandFilterGroup: noop
|
|
196
|
+
};
|
|
197
|
+
}
|
|
189
198
|
function $41e7e5d85b5e0d49$export$a54ec244c8863715() {
|
|
190
199
|
return $7QqFM$react.createElement("div", {
|
|
191
200
|
children: []
|
package/server/latest/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DPC } from "@depict-ai/dpc/latest";
|
|
2
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";
|
|
3
|
+
import { BaseCategoryProviderConfig, BaseProviderConfig, BaseSearchProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ListingQuery, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations, FilterWithData } 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 = "4.0
|
|
6
|
+
export const version = "4.1.0";
|
|
7
7
|
interface UsePerformanceClientReturn {
|
|
8
8
|
dpc: DPC;
|
|
9
9
|
}
|
|
@@ -602,6 +602,15 @@ interface UseFetchRecommendationsReturn<T extends Display> {
|
|
|
602
602
|
* @returns {UseFetchRecommendationsReturn}
|
|
603
603
|
*/
|
|
604
604
|
export function useFetchRecommendations<T extends ModernDisplay>(): UseFetchRecommendationsReturn<T>;
|
|
605
|
+
/**
|
|
606
|
+
* Gives you some helpers that let you interact with the state of a category page
|
|
607
|
+
* @param stateKey the stateKey of the components to effect, leave unset if you haven't set a stateKey on your components.
|
|
608
|
+
*/
|
|
609
|
+
export function useCategoryFilterHelpers(stateKey: string | undefined): {
|
|
610
|
+
categorySetShouldShowFilters: (shouldShow: boolean) => void;
|
|
611
|
+
categorySetFilter: (filter: FilterWithData) => void;
|
|
612
|
+
categoryExpandFilterGroup: (title: string) => void;
|
|
613
|
+
};
|
|
605
614
|
/**
|
|
606
615
|
* Helper function to navigate to a new page depending on the navigation library used.
|
|
607
616
|
*/
|
package/server/latest/index.js
CHANGED
|
@@ -159,10 +159,18 @@ function $4d5c3f13a5ae62a7$export$e46079a2793e9ec7(props, set_portals) {
|
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
-
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "4.0
|
|
162
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "4.1.0";
|
|
163
163
|
function $2b1fdeb83610500f$export$9fac37a9c21c2f3b(props) {
|
|
164
164
|
return props.children;
|
|
165
165
|
}
|
|
166
|
+
function $2b1fdeb83610500f$export$72616730c1fad2f4() {
|
|
167
|
+
const noop = () => {};
|
|
168
|
+
return {
|
|
169
|
+
categorySetShouldShowFilters: noop,
|
|
170
|
+
categorySetFilter: noop,
|
|
171
|
+
categoryExpandFilterGroup: noop
|
|
172
|
+
};
|
|
173
|
+
}
|
|
166
174
|
function $2b1fdeb83610500f$export$a54ec244c8863715() {
|
|
167
175
|
return $eOXet$createElement("div", {
|
|
168
176
|
children: []
|
|
@@ -263,4 +271,4 @@ function $2b1fdeb83610500f$export$6501da23a2770fc() {
|
|
|
263
271
|
}
|
|
264
272
|
};
|
|
265
273
|
}
|
|
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 };
|
|
274
|
+
export { $2b1fdeb83610500f$export$9fac37a9c21c2f3b as DepictProvider, $2b1fdeb83610500f$export$72616730c1fad2f4 as useCategoryFilterHelpers, $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 };
|