@depict-ai/react-ui 2.2.0 → 3.0.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 +12 -44
- package/ES10/index.d.ts +9 -18
- package/ES10/index.js +12 -44
- package/dist/styles/plain-css-fallback-styling.css +1 -1
- package/latest/index.cjs +12 -43
- package/latest/index.d.ts +9 -18
- package/latest/index.js +12 -43
- package/locales/ES10/index.d.ts +1 -1
- package/locales/index.d.ts +1 -1
- package/locales/latest/index.d.ts +1 -1
- package/package.json +6 -6
- package/server/ES10/index.cjs +3 -47
- package/server/ES10/index.d.ts +9 -18
- package/server/ES10/index.js +4 -48
- package/server/latest/index.cjs +3 -46
- package/server/latest/index.d.ts +9 -18
- package/server/latest/index.js +4 -47
package/latest/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { renderToString as $2GFvs$renderToString } from "react-dom/server";
|
|
|
15
15
|
// Note, if you add an export here, also add one in src-server/main.ts
|
|
16
16
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
17
17
|
register_es_version("react-ui", "latest");
|
|
18
|
-
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "
|
|
18
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "3.0.0";
|
|
19
19
|
const $42858f023ef23dab$export$8e769ad4338a911e = {
|
|
20
20
|
usedLocale: $2GFvs$createSignal((0, $2GFvs$defaultLocale)),
|
|
21
21
|
search_instances: new Map(),
|
|
@@ -24,7 +24,6 @@ const $42858f023ef23dab$export$8e769ad4338a911e = {
|
|
|
24
24
|
dpc: null,
|
|
25
25
|
merchant: $2GFvs$createSignal(),
|
|
26
26
|
market: $2GFvs$createSignal(),
|
|
27
|
-
userId: $2GFvs$createSignal(),
|
|
28
27
|
sessionId: $2GFvs$createSignal(),
|
|
29
28
|
known_category_paths: new Set(),
|
|
30
29
|
search_page_path_: $2GFvs$createSignal(),
|
|
@@ -33,7 +32,7 @@ const $42858f023ef23dab$export$8e769ad4338a911e = {
|
|
|
33
32
|
provider_is_updating: $2GFvs$createSignal(false),
|
|
34
33
|
enable_content_search: $2GFvs$createSignal(),
|
|
35
34
|
category_meta_title_suffix: $2GFvs$createSignal(),
|
|
36
|
-
|
|
35
|
+
disable_override_listing_id: $2GFvs$createSignal()
|
|
37
36
|
};
|
|
38
37
|
let $c83ba9ab79386687$var$run_on_href_change;
|
|
39
38
|
let $c83ba9ab79386687$var$old_href = location.href;
|
|
@@ -212,7 +211,7 @@ const $a00d8f27abd5d0b0$export$38b98fae14bd1f64 = () => {
|
|
|
212
211
|
dpc: (0, $42858f023ef23dab$export$8e769ad4338a911e).dpc
|
|
213
212
|
};
|
|
214
213
|
};
|
|
215
|
-
const $a00d8f27abd5d0b0$export$47e064413edabf36 = (merchant, market,
|
|
214
|
+
const $a00d8f27abd5d0b0$export$47e064413edabf36 = (merchant, market, sessionId) => {
|
|
216
215
|
if (!merchant) return;
|
|
217
216
|
try {
|
|
218
217
|
let {
|
|
@@ -223,7 +222,6 @@ const $a00d8f27abd5d0b0$export$47e064413edabf36 = (merchant, market, userId, ses
|
|
|
223
222
|
});
|
|
224
223
|
dpc.merchant = merchant;
|
|
225
224
|
dpc.market = market;
|
|
226
|
-
dpc.setUserId(userId);
|
|
227
225
|
dpc.setSessionId(sessionId);
|
|
228
226
|
} catch (e) {
|
|
229
227
|
// Make sure to not break the users app if we throw
|
|
@@ -285,7 +283,7 @@ function $9145bcf81a0216ce$export$248b95d5073d5bab(disposable, stateKey) {
|
|
|
285
283
|
merchant: [get_merchant],
|
|
286
284
|
market: [get_market],
|
|
287
285
|
category_meta_title_suffix: [get_category_meta_title_suffix],
|
|
288
|
-
|
|
286
|
+
disable_override_listing_id: [get_disable_override_listing_id]
|
|
289
287
|
} = (0, $42858f023ef23dab$export$8e769ad4338a911e);
|
|
290
288
|
const instance = new (0, $2GFvs$DepictCategory)({
|
|
291
289
|
api: (0, $42858f023ef23dab$export$8e769ad4338a911e).api,
|
|
@@ -307,7 +305,7 @@ function $9145bcf81a0216ce$export$248b95d5073d5bab(disposable, stateKey) {
|
|
|
307
305
|
});
|
|
308
306
|
$2GFvs$createComputed(() => instance.localization = get_locale());
|
|
309
307
|
$2GFvs$createComputed(() => instance.meta_title_suffix = get_category_meta_title_suffix());
|
|
310
|
-
$2GFvs$createComputed(() => instance.
|
|
308
|
+
$2GFvs$createComputed(() => instance.disable_override_listing_id = get_disable_override_listing_id());
|
|
311
309
|
return {
|
|
312
310
|
instance: instance,
|
|
313
311
|
dispose: dispose,
|
|
@@ -336,7 +334,6 @@ function $5376eb2a386cd90d$var$ActualDepictProvider(props) {
|
|
|
336
334
|
merchant: merchant,
|
|
337
335
|
locale: locale,
|
|
338
336
|
metaData: metaData,
|
|
339
|
-
userId: userId,
|
|
340
337
|
sessionId: sessionId
|
|
341
338
|
} = props;
|
|
342
339
|
const usedLocale = locale ?? (0, $2GFvs$defaultLocale);
|
|
@@ -348,7 +345,6 @@ function $5376eb2a386cd90d$var$ActualDepictProvider(props) {
|
|
|
348
345
|
} = props.search ?? {};
|
|
349
346
|
$5376eb2a386cd90d$var$multiple_depictprovider_guard();
|
|
350
347
|
// Will run on other prop changes, but harmless
|
|
351
|
-
(0, $42858f023ef23dab$export$8e769ad4338a911e).userId[1](userId);
|
|
352
348
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).sessionId[1](sessionId);
|
|
353
349
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).usedLocale[1](usedLocale);
|
|
354
350
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).enable_content_search[1](enableContentSearch);
|
|
@@ -356,8 +352,8 @@ function $5376eb2a386cd90d$var$ActualDepictProvider(props) {
|
|
|
356
352
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).search_query_url_param_name = urlParamName;
|
|
357
353
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).enableCategorySuggestions = enableCategorySuggestions;
|
|
358
354
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).category_meta_title_suffix[1](props.category?.metaTitleSuffix);
|
|
359
|
-
(0, $42858f023ef23dab$export$8e769ad4338a911e).
|
|
360
|
-
$a00d8f27abd5d0b0$export$47e064413edabf36(merchant, market,
|
|
355
|
+
(0, $42858f023ef23dab$export$8e769ad4338a911e).disable_override_listing_id[1](props.category?.disableOverrideListingId);
|
|
356
|
+
$a00d8f27abd5d0b0$export$47e064413edabf36(merchant, market, sessionId);
|
|
361
357
|
if (!market || !merchant) return $2GFvs$createElement((0, $2GFvs$Fragment), null, children);
|
|
362
358
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).market[1](market);
|
|
363
359
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).merchant[1](merchant);
|
|
@@ -382,7 +378,6 @@ function $5376eb2a386cd90d$var$ActualDepictProvider(props) {
|
|
|
382
378
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).on_navigation = on_navigation;
|
|
383
379
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).api ||= new (0, $2GFvs$DepictAPI)({
|
|
384
380
|
get_metadata: async () => (0, $42858f023ef23dab$export$8e769ad4338a911e).metaData,
|
|
385
|
-
get_user_id: () => $2GFvs$untrack((0, $42858f023ef23dab$export$8e769ad4338a911e).userId[0]),
|
|
386
381
|
get_session_id: () => $2GFvs$untrack((0, $42858f023ef23dab$export$8e769ad4338a911e).sessionId[0])
|
|
387
382
|
});
|
|
388
383
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).api.page_url_creator = props.pageURLCreator;
|
|
@@ -659,15 +654,14 @@ function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
|
|
|
659
654
|
$2GFvs$onCleanup(() => set_category_page_in_dom(false));
|
|
660
655
|
$2GFvs$createComputed(() => {
|
|
661
656
|
const {
|
|
662
|
-
|
|
657
|
+
listingId: listingId
|
|
663
658
|
} = props;
|
|
664
|
-
depict_category().
|
|
665
|
-
if (
|
|
659
|
+
depict_category().listing_id = listingId;
|
|
660
|
+
if (listingId) {
|
|
666
661
|
set_category_state_set(true);
|
|
667
662
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).known_category_paths.add(location.pathname);
|
|
668
663
|
}
|
|
669
664
|
});
|
|
670
|
-
$2GFvs$createComputed(() => depict_category().listing_type = props.listingType);
|
|
671
665
|
const category = () => $2GFvs$createMemo(() => {
|
|
672
666
|
const stateKey = $2GFvs$untrack(() => props.stateKey);
|
|
673
667
|
if ($48d7f568740a317d$var$rendered_components_with_state_key.has(stateKey)) throw new Error(`You have multiple CategoryPage components with the same stateKey: ${stateKey}. Each CategoryPage component must have a unique stateKey.`);
|
|
@@ -771,29 +765,6 @@ function $ab2bb2d1f47a25b7$export$4daadad26e48a2c7(props) {
|
|
|
771
765
|
throw new Error(us + " props.recommendations needs to be a promise that is either unresolved (`new Promise(() => {})`) so we can show placeholders, or resolved (`Promise.resolve(recommendation_array)`) to the recommendations to show");
|
|
772
766
|
}
|
|
773
767
|
}
|
|
774
|
-
function $5ee8e057dabc10d4$export$12250cb2badef3d2(props) {
|
|
775
|
-
const recs = props.recommendations;
|
|
776
|
-
if ("then" in recs)
|
|
777
|
-
// Run displayTransformers for RecommendationSlider and RecommendationGrid
|
|
778
|
-
return recs.then(async displays => {
|
|
779
|
-
const transformFunction = (0, $42858f023ef23dab$export$8e769ad4338a911e).api?.display_transformers?.products;
|
|
780
|
-
if (transformFunction) try {
|
|
781
|
-
return await transformFunction({
|
|
782
|
-
merchant: (0, $42858f023ef23dab$export$8e769ad4338a911e).merchant[0](),
|
|
783
|
-
market: (0, $42858f023ef23dab$export$8e769ad4338a911e).market[0](),
|
|
784
|
-
displays: displays
|
|
785
|
-
});
|
|
786
|
-
} catch (e) {
|
|
787
|
-
console.error(e);
|
|
788
|
-
throw new Error("Error running display transformer for recommendations", {
|
|
789
|
-
cause: e
|
|
790
|
-
}); // To stop recommendation grid from rendering
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
return displays;
|
|
794
|
-
});
|
|
795
|
-
return recs;
|
|
796
|
-
}
|
|
797
768
|
function $4fd5dc0e231a60d9$export$82cfdc85a4d15688(props) {
|
|
798
769
|
$ab2bb2d1f47a25b7$export$4daadad26e48a2c7(props);
|
|
799
770
|
return $c83ba9ab79386687$export$f6e64e17bd69eeef({
|
|
@@ -805,7 +776,7 @@ function $4fd5dc0e231a60d9$export$5abb40edfde2a843(props, set_portals) {
|
|
|
805
776
|
const component_portals = new Set();
|
|
806
777
|
return $2GFvs$RecommendationSlider({
|
|
807
778
|
get recommendations() {
|
|
808
|
-
return
|
|
779
|
+
return props.recommendations;
|
|
809
780
|
},
|
|
810
781
|
product_card_template: display => $bcf84a32dc612a43$export$32024253978abdc7({
|
|
811
782
|
component_props: {
|
|
@@ -830,7 +801,7 @@ function $4d5c3f13a5ae62a7$export$e46079a2793e9ec7(props, set_portals) {
|
|
|
830
801
|
const component_portals = new Set();
|
|
831
802
|
return $2GFvs$RecommendationGrid({
|
|
832
803
|
get recommendations() {
|
|
833
|
-
return
|
|
804
|
+
return props.recommendations;
|
|
834
805
|
},
|
|
835
806
|
product_card_template: display => {
|
|
836
807
|
if (0, $2GFvs$isServer)
|
|
@@ -955,7 +926,6 @@ function $1bb4271dc44722e2$var$fetchRecommendations(opts) {
|
|
|
955
926
|
const {
|
|
956
927
|
merchant: [get_merchant],
|
|
957
928
|
market: [get_market],
|
|
958
|
-
userId: [get_userId],
|
|
959
929
|
sessionId: [get_sessionId]
|
|
960
930
|
} = (0, $42858f023ef23dab$export$8e769ad4338a911e);
|
|
961
931
|
const merchant = $2GFvs$untrack(get_merchant);
|
|
@@ -964,7 +934,6 @@ function $1bb4271dc44722e2$var$fetchRecommendations(opts) {
|
|
|
964
934
|
return $2GFvs$fetchDepictRecommendations({
|
|
965
935
|
merchant: merchant,
|
|
966
936
|
market: market,
|
|
967
|
-
userId: $2GFvs$untrack(get_userId),
|
|
968
937
|
sessionId: $2GFvs$untrack(get_sessionId),
|
|
969
938
|
...opts
|
|
970
939
|
});
|
package/locales/ES10/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { plp_shared_i18n, search_i18n, category_i18n, Locale } from "@depict-ai/ui/locales/ES10";
|
|
2
|
-
export
|
|
2
|
+
export * from "@depict-ai/ui/locales/ES10";
|
package/locales/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { plp_shared_i18n, search_i18n, category_i18n, Locale } from "@depict-ai/ui/locales/ES10";
|
|
2
|
-
export
|
|
2
|
+
export * from "@depict-ai/ui/locales/ES10";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { plp_shared_i18n, search_i18n, category_i18n, Locale } from "@depict-ai/ui/locales/latest";
|
|
2
|
-
export
|
|
2
|
+
export * from "@depict-ai/ui/locales/latest";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/react-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"packageManager": "yarn@3.2.2",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"types": "ES10/index.d.ts",
|
|
@@ -135,10 +135,10 @@
|
|
|
135
135
|
"@babel/plugin-transform-typescript": "^7.22.9",
|
|
136
136
|
"@babel/runtime": "latest",
|
|
137
137
|
"@babel/runtime-corejs3": "latest",
|
|
138
|
-
"@depict-ai/dpc": "^
|
|
139
|
-
"@depict-ai/plp-styling": "^
|
|
140
|
-
"@depict-ai/ui": "^
|
|
141
|
-
"@depict-ai/utilishared": "^
|
|
138
|
+
"@depict-ai/dpc": "^2.0.0",
|
|
139
|
+
"@depict-ai/plp-styling": "^2.0.0",
|
|
140
|
+
"@depict-ai/ui": "^3.0.0",
|
|
141
|
+
"@depict-ai/utilishared": "^2.0.0",
|
|
142
142
|
"solid-js": "^1.8.1"
|
|
143
143
|
},
|
|
144
144
|
"peerDependencies": {
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
"@babel/core": "latest",
|
|
151
151
|
"@babel/preset-env": "latest",
|
|
152
152
|
"@babel/preset-typescript": "latest",
|
|
153
|
-
"@depict-ai/plp-styling": "^
|
|
153
|
+
"@depict-ai/plp-styling": "^2.0.0",
|
|
154
154
|
"@jest/globals": "^29.3.1",
|
|
155
155
|
"@parcel/babel-preset-env": "^2.10.3",
|
|
156
156
|
"@parcel/transformer-sass": "^2.10.3",
|
package/server/ES10/index.cjs
CHANGED
|
@@ -7,7 +7,6 @@ var $aNCHr$reactdomserver = require("react-dom/server");
|
|
|
7
7
|
var $aNCHr$solidjs = require("solid-js");
|
|
8
8
|
var $aNCHr$reactjsxruntime = require("react/jsx-runtime");
|
|
9
9
|
var $aNCHr$reactdom = require("react-dom");
|
|
10
|
-
var $aNCHr$depictaiuilocales = require("@depict-ai/ui/locales/ES10");
|
|
11
10
|
require("../../multi_import_deduplicator.cjs").register_es_version("react-ui", "ES10");
|
|
12
11
|
function $parcel$export(e, n, v, s) {
|
|
13
12
|
Object.defineProperty(e, n, {
|
|
@@ -141,54 +140,11 @@ async function $3441d987b5ea85cb$export$32024253978abdc7(_ref) {
|
|
|
141
140
|
await react_has_ran_hooks; // After React has created elements it still takes some time to actually connect the refs and run the hooks. We don't want to replace placeholders before then.
|
|
142
141
|
return [solid_container];
|
|
143
142
|
}
|
|
144
|
-
const $ef516b1f92253963$export$8e769ad4338a911e = {
|
|
145
|
-
usedLocale: $aNCHr$solidjs.createSignal((0, $aNCHr$depictaiuilocales.defaultLocale)),
|
|
146
|
-
search_instances: new Map(),
|
|
147
|
-
category_instances: new Map(),
|
|
148
|
-
api: null,
|
|
149
|
-
dpc: null,
|
|
150
|
-
merchant: $aNCHr$solidjs.createSignal(),
|
|
151
|
-
market: $aNCHr$solidjs.createSignal(),
|
|
152
|
-
userId: $aNCHr$solidjs.createSignal(),
|
|
153
|
-
sessionId: $aNCHr$solidjs.createSignal(),
|
|
154
|
-
known_category_paths: new Set(),
|
|
155
|
-
search_page_path_: $aNCHr$solidjs.createSignal(),
|
|
156
|
-
search_page_in_dom: $aNCHr$solidjs.createSignal(false),
|
|
157
|
-
category_page_in_dom: $aNCHr$solidjs.createSignal(false),
|
|
158
|
-
provider_is_updating: $aNCHr$solidjs.createSignal(false),
|
|
159
|
-
enable_content_search: $aNCHr$solidjs.createSignal(),
|
|
160
|
-
category_meta_title_suffix: $aNCHr$solidjs.createSignal(),
|
|
161
|
-
disable_override_query_id: $aNCHr$solidjs.createSignal()
|
|
162
|
-
};
|
|
163
|
-
function $7b4cd941f15b2582$export$12250cb2badef3d2(props) {
|
|
164
|
-
const recs = props.recommendations;
|
|
165
|
-
if ("then" in recs)
|
|
166
|
-
// Run displayTransformers for RecommendationSlider and RecommendationGrid
|
|
167
|
-
return recs.then(async displays => {
|
|
168
|
-
var _globalState$api, _globalState$api$disp;
|
|
169
|
-
const transformFunction = (_globalState$api = (0, $ef516b1f92253963$export$8e769ad4338a911e).api) === null || _globalState$api === void 0 ? void 0 : (_globalState$api$disp = _globalState$api.display_transformers) === null || _globalState$api$disp === void 0 ? void 0 : _globalState$api$disp.products;
|
|
170
|
-
if (transformFunction) try {
|
|
171
|
-
return await transformFunction({
|
|
172
|
-
merchant: (0, $ef516b1f92253963$export$8e769ad4338a911e).merchant[0](),
|
|
173
|
-
market: (0, $ef516b1f92253963$export$8e769ad4338a911e).market[0](),
|
|
174
|
-
displays: displays
|
|
175
|
-
});
|
|
176
|
-
} catch (e) {
|
|
177
|
-
console.error(e);
|
|
178
|
-
throw new Error("Error running display transformer for recommendations", {
|
|
179
|
-
cause: e
|
|
180
|
-
}); // To stop recommendation grid from rendering
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return displays;
|
|
184
|
-
});
|
|
185
|
-
return recs;
|
|
186
|
-
}
|
|
187
143
|
function $3b36cc844440a979$export$e46079a2793e9ec7(props, set_portals) {
|
|
188
144
|
const component_portals = new Set();
|
|
189
145
|
return $aNCHr$depictaiui.RecommendationGrid({
|
|
190
146
|
get recommendations() {
|
|
191
|
-
return
|
|
147
|
+
return props.recommendations;
|
|
192
148
|
},
|
|
193
149
|
product_card_template: display => {
|
|
194
150
|
if (0, $aNCHr$solidjsweb.isServer)
|
|
@@ -234,7 +190,7 @@ function $3b36cc844440a979$export$e46079a2793e9ec7(props, set_portals) {
|
|
|
234
190
|
}
|
|
235
191
|
});
|
|
236
192
|
}
|
|
237
|
-
const $efbdd2dab4314170$export$83d89fbfd8236492 = "
|
|
193
|
+
const $efbdd2dab4314170$export$83d89fbfd8236492 = "3.0.0";
|
|
238
194
|
function $202459d454907b31$export$9fac37a9c21c2f3b(props) {
|
|
239
195
|
return props.children;
|
|
240
196
|
}
|
|
@@ -334,7 +290,7 @@ function $202459d454907b31$export$38b98fae14bd1f64() {
|
|
|
334
290
|
function $202459d454907b31$export$6501da23a2770fc() {
|
|
335
291
|
return {
|
|
336
292
|
fetchRecommendations: () => {
|
|
337
|
-
throw new Error("fetchRecommendations is currently not available on the server due to personalisation/
|
|
293
|
+
throw new Error("fetchRecommendations is currently not available on the server due to personalisation/session_id related issues. Please only call it on the client.");
|
|
338
294
|
}
|
|
339
295
|
};
|
|
340
296
|
}
|
package/server/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 = "
|
|
6
|
+
export const version = "3.0.0";
|
|
7
7
|
interface UsePerformanceClientReturn {
|
|
8
8
|
dpc: DPC;
|
|
9
9
|
}
|
|
@@ -83,14 +83,9 @@ type ProviderConfig<OriginalDisplay extends Display, OutputDisplay extends Moder
|
|
|
83
83
|
*/
|
|
84
84
|
navigateFunction?: NavigateFunction;
|
|
85
85
|
/**
|
|
86
|
-
* The locale to use for the Depict components.
|
|
87
|
-
* @default en
|
|
86
|
+
* The locale to use for the Depict components as well as Depict results.
|
|
88
87
|
*/
|
|
89
|
-
locale
|
|
90
|
-
/**
|
|
91
|
-
* Unique ID of the currently logged in user, if applicable.
|
|
92
|
-
*/
|
|
93
|
-
userId?: string;
|
|
88
|
+
locale: Locale;
|
|
94
89
|
/**
|
|
95
90
|
* Options that are required for search functionality.
|
|
96
91
|
*/
|
|
@@ -253,23 +248,19 @@ interface SearchPageConfig<T extends Display> extends BaseSearchPageConfig, PLPC
|
|
|
253
248
|
export function SearchPage<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never>(props: SearchPageConfig<[OutputDisplay] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<OutputDisplay>>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
254
249
|
interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig, PLPConfig<T> {
|
|
255
250
|
/**
|
|
256
|
-
* The
|
|
251
|
+
* The listing id to show. Ultimately, this endpoint is what gives you the listing id: https://api.depict.ai/docs#tag/Listing/operation/Get_Listings_v3_listings_get
|
|
257
252
|
*/
|
|
258
|
-
|
|
253
|
+
listingId: string;
|
|
259
254
|
/**
|
|
260
255
|
* categoryTitlePlugin is an optional plugin that can be used to customize the title of the category page.
|
|
261
256
|
* @default CategoryTitle
|
|
262
257
|
*
|
|
263
258
|
* @example
|
|
264
259
|
* ```tsx
|
|
265
|
-
* <CategoryPage
|
|
260
|
+
* <CategoryPage listingId="72909a4a-adf7-4355-b7be-f9090d4185db" productCard={MyCustomCategoryProductCard} categoryTitlePlugin={EmbeddedNumProducts} />
|
|
266
261
|
* ```
|
|
267
262
|
*/
|
|
268
263
|
categoryTitlePlugin?: typeof CategoryTitle | typeof embedded_num_products;
|
|
269
|
-
/**
|
|
270
|
-
* Whether this page is a collection or a category. If not specified it will be inferred as described in the docs https://docs.depict.ai/reference/category-sdk/specifying-listing-type-in-the-category-page-sdk
|
|
271
|
-
*/
|
|
272
|
-
listingType?: "collection" | "category";
|
|
273
264
|
/**
|
|
274
265
|
* When using multiple CategoryPage components on the same page, you need to set a unique stateKey for each one. We recommend using an incrementing number, such as "1", "2", "3", etc. To associate a certain BreadCrumbs or QuickLinks component with a certain CategoryPage component, set the same stateKey on both.
|
|
275
266
|
*/
|
|
@@ -288,7 +279,7 @@ interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig,
|
|
|
288
279
|
* import { DepictProductCard, ImagePlaceholder, Display, CategoryPage } from '@depict-ai/react-ui'
|
|
289
280
|
*
|
|
290
281
|
* function Category() {
|
|
291
|
-
* return <CategoryPage
|
|
282
|
+
* return <CategoryPage listingId="72909a4a-adf7-4355-b7be-f9090d4185db" productCard={MyCustomCategoryProductCard} />
|
|
292
283
|
* }
|
|
293
284
|
*
|
|
294
285
|
* interface MyCustomDisplay extends Display {}
|
|
@@ -540,7 +531,7 @@ interface UseSearchFieldReturn {
|
|
|
540
531
|
* @returns {UseSearchFieldReturn}
|
|
541
532
|
*/
|
|
542
533
|
export const useSearchField: (props?: SearchFieldProps) => UseSearchFieldReturn;
|
|
543
|
-
type FetchRecsOptions = Omit<Parameters<typeof fetchDepictRecommendations>[0], "merchant" | "market" | "
|
|
534
|
+
type FetchRecsOptions = Omit<Parameters<typeof fetchDepictRecommendations>[0], "merchant" | "market" | "sessionId"> & ExclusiveId;
|
|
544
535
|
interface UseFetchRecommendationsReturn<T extends Display> {
|
|
545
536
|
/**
|
|
546
537
|
* Fetch recommendations from the Depict API.
|
|
@@ -608,7 +599,7 @@ interface UseFetchRecommendationsReturn<T extends Display> {
|
|
|
608
599
|
* ```
|
|
609
600
|
* @returns {UseFetchRecommendationsReturn}
|
|
610
601
|
*/
|
|
611
|
-
export function useFetchRecommendations<T extends
|
|
602
|
+
export function useFetchRecommendations<T extends ModernDisplay>(): UseFetchRecommendationsReturn<T>;
|
|
612
603
|
/**
|
|
613
604
|
* Helper function to navigate to a new page depending on the navigation library used.
|
|
614
605
|
*/
|
package/server/ES10/index.js
CHANGED
|
@@ -4,10 +4,9 @@ import { ImagePlaceholder as $7h5e1$ImagePlaceholder, TextPlaceholder as $7h5e1$
|
|
|
4
4
|
import { generateHydrationScript as $7h5e1$generateHydrationScript, renderToString as $7h5e1$renderToString, isServer as $7h5e1$isServer } from "solid-js/web";
|
|
5
5
|
import { dwarn as $7h5e1$dwarn } from "@depict-ai/utilishared/ES10";
|
|
6
6
|
import { renderToString as $7h5e1$renderToString1 } from "react-dom/server";
|
|
7
|
-
import { getOwner as $7h5e1$getOwner, untrack as $7h5e1$untrack, runWithOwner as $7h5e1$runWithOwner, createEffect as $7h5e1$createEffect, on as $7h5e1$on, onCleanup as $7h5e1$onCleanup
|
|
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";
|
|
8
8
|
import { jsx as $7h5e1$jsx } from "react/jsx-runtime";
|
|
9
9
|
import { createPortal as $7h5e1$createPortal } from "react-dom";
|
|
10
|
-
import { defaultLocale as $7h5e1$defaultLocale } from "@depict-ai/ui/locales/ES10";
|
|
11
10
|
|
|
12
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.
|
|
13
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
|
|
@@ -118,54 +117,11 @@ async function $cce08f18e2476cbf$export$32024253978abdc7(_ref) {
|
|
|
118
117
|
await react_has_ran_hooks; // After React has created elements it still takes some time to actually connect the refs and run the hooks. We don't want to replace placeholders before then.
|
|
119
118
|
return [solid_container];
|
|
120
119
|
}
|
|
121
|
-
const $8c691d7f86317052$export$8e769ad4338a911e = {
|
|
122
|
-
usedLocale: $7h5e1$createSignal((0, $7h5e1$defaultLocale)),
|
|
123
|
-
search_instances: new Map(),
|
|
124
|
-
category_instances: new Map(),
|
|
125
|
-
api: null,
|
|
126
|
-
dpc: null,
|
|
127
|
-
merchant: $7h5e1$createSignal(),
|
|
128
|
-
market: $7h5e1$createSignal(),
|
|
129
|
-
userId: $7h5e1$createSignal(),
|
|
130
|
-
sessionId: $7h5e1$createSignal(),
|
|
131
|
-
known_category_paths: new Set(),
|
|
132
|
-
search_page_path_: $7h5e1$createSignal(),
|
|
133
|
-
search_page_in_dom: $7h5e1$createSignal(false),
|
|
134
|
-
category_page_in_dom: $7h5e1$createSignal(false),
|
|
135
|
-
provider_is_updating: $7h5e1$createSignal(false),
|
|
136
|
-
enable_content_search: $7h5e1$createSignal(),
|
|
137
|
-
category_meta_title_suffix: $7h5e1$createSignal(),
|
|
138
|
-
disable_override_query_id: $7h5e1$createSignal()
|
|
139
|
-
};
|
|
140
|
-
function $9da62538e07f038e$export$12250cb2badef3d2(props) {
|
|
141
|
-
const recs = props.recommendations;
|
|
142
|
-
if ("then" in recs)
|
|
143
|
-
// Run displayTransformers for RecommendationSlider and RecommendationGrid
|
|
144
|
-
return recs.then(async displays => {
|
|
145
|
-
var _globalState$api, _globalState$api$disp;
|
|
146
|
-
const transformFunction = (_globalState$api = (0, $8c691d7f86317052$export$8e769ad4338a911e).api) === null || _globalState$api === void 0 ? void 0 : (_globalState$api$disp = _globalState$api.display_transformers) === null || _globalState$api$disp === void 0 ? void 0 : _globalState$api$disp.products;
|
|
147
|
-
if (transformFunction) try {
|
|
148
|
-
return await transformFunction({
|
|
149
|
-
merchant: (0, $8c691d7f86317052$export$8e769ad4338a911e).merchant[0](),
|
|
150
|
-
market: (0, $8c691d7f86317052$export$8e769ad4338a911e).market[0](),
|
|
151
|
-
displays: displays
|
|
152
|
-
});
|
|
153
|
-
} catch (e) {
|
|
154
|
-
console.error(e);
|
|
155
|
-
throw new Error("Error running display transformer for recommendations", {
|
|
156
|
-
cause: e
|
|
157
|
-
}); // To stop recommendation grid from rendering
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return displays;
|
|
161
|
-
});
|
|
162
|
-
return recs;
|
|
163
|
-
}
|
|
164
120
|
function $cd68097a7ee08669$export$e46079a2793e9ec7(props, set_portals) {
|
|
165
121
|
const component_portals = new Set();
|
|
166
122
|
return $7h5e1$RecommendationGrid({
|
|
167
123
|
get recommendations() {
|
|
168
|
-
return
|
|
124
|
+
return props.recommendations;
|
|
169
125
|
},
|
|
170
126
|
product_card_template: display => {
|
|
171
127
|
if (0, $7h5e1$isServer)
|
|
@@ -211,7 +167,7 @@ function $cd68097a7ee08669$export$e46079a2793e9ec7(props, set_portals) {
|
|
|
211
167
|
}
|
|
212
168
|
});
|
|
213
169
|
}
|
|
214
|
-
const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "
|
|
170
|
+
const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "3.0.0";
|
|
215
171
|
function $5c4add0a8fe94894$export$9fac37a9c21c2f3b(props) {
|
|
216
172
|
return props.children;
|
|
217
173
|
}
|
|
@@ -311,7 +267,7 @@ function $5c4add0a8fe94894$export$38b98fae14bd1f64() {
|
|
|
311
267
|
function $5c4add0a8fe94894$export$6501da23a2770fc() {
|
|
312
268
|
return {
|
|
313
269
|
fetchRecommendations: () => {
|
|
314
|
-
throw new Error("fetchRecommendations is currently not available on the server due to personalisation/
|
|
270
|
+
throw new Error("fetchRecommendations is currently not available on the server due to personalisation/session_id related issues. Please only call it on the client.");
|
|
315
271
|
}
|
|
316
272
|
};
|
|
317
273
|
}
|
package/server/latest/index.cjs
CHANGED
|
@@ -7,7 +7,6 @@ var $7QqFM$reactdomserver = require("react-dom/server");
|
|
|
7
7
|
var $7QqFM$solidjs = require("solid-js");
|
|
8
8
|
var $7QqFM$reactjsxruntime = require("react/jsx-runtime");
|
|
9
9
|
var $7QqFM$reactdom = require("react-dom");
|
|
10
|
-
var $7QqFM$depictaiuilocales = require("@depict-ai/ui/locales/latest");
|
|
11
10
|
require("../../multi_import_deduplicator.cjs").register_es_version("react-ui", "latest");
|
|
12
11
|
function $parcel$export(e, n, v, s) {
|
|
13
12
|
Object.defineProperty(e, n, {
|
|
@@ -135,53 +134,11 @@ async function $6081519c185fcf70$export$32024253978abdc7({
|
|
|
135
134
|
await react_has_ran_hooks; // After React has created elements it still takes some time to actually connect the refs and run the hooks. We don't want to replace placeholders before then.
|
|
136
135
|
return [solid_container];
|
|
137
136
|
}
|
|
138
|
-
const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
|
|
139
|
-
usedLocale: $7QqFM$solidjs.createSignal((0, $7QqFM$depictaiuilocales.defaultLocale)),
|
|
140
|
-
search_instances: new Map(),
|
|
141
|
-
category_instances: new Map(),
|
|
142
|
-
api: null,
|
|
143
|
-
dpc: null,
|
|
144
|
-
merchant: $7QqFM$solidjs.createSignal(),
|
|
145
|
-
market: $7QqFM$solidjs.createSignal(),
|
|
146
|
-
userId: $7QqFM$solidjs.createSignal(),
|
|
147
|
-
sessionId: $7QqFM$solidjs.createSignal(),
|
|
148
|
-
known_category_paths: new Set(),
|
|
149
|
-
search_page_path_: $7QqFM$solidjs.createSignal(),
|
|
150
|
-
search_page_in_dom: $7QqFM$solidjs.createSignal(false),
|
|
151
|
-
category_page_in_dom: $7QqFM$solidjs.createSignal(false),
|
|
152
|
-
provider_is_updating: $7QqFM$solidjs.createSignal(false),
|
|
153
|
-
enable_content_search: $7QqFM$solidjs.createSignal(),
|
|
154
|
-
category_meta_title_suffix: $7QqFM$solidjs.createSignal(),
|
|
155
|
-
disable_override_query_id: $7QqFM$solidjs.createSignal()
|
|
156
|
-
};
|
|
157
|
-
function $3d35ad83c8fdfa92$export$12250cb2badef3d2(props) {
|
|
158
|
-
const recs = props.recommendations;
|
|
159
|
-
if ("then" in recs)
|
|
160
|
-
// Run displayTransformers for RecommendationSlider and RecommendationGrid
|
|
161
|
-
return recs.then(async displays => {
|
|
162
|
-
const transformFunction = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api?.display_transformers?.products;
|
|
163
|
-
if (transformFunction) try {
|
|
164
|
-
return await transformFunction({
|
|
165
|
-
merchant: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).merchant[0](),
|
|
166
|
-
market: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).market[0](),
|
|
167
|
-
displays: displays
|
|
168
|
-
});
|
|
169
|
-
} catch (e) {
|
|
170
|
-
console.error(e);
|
|
171
|
-
throw new Error("Error running display transformer for recommendations", {
|
|
172
|
-
cause: e
|
|
173
|
-
}); // To stop recommendation grid from rendering
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return displays;
|
|
177
|
-
});
|
|
178
|
-
return recs;
|
|
179
|
-
}
|
|
180
137
|
function $c6b960f2a07285c8$export$e46079a2793e9ec7(props, set_portals) {
|
|
181
138
|
const component_portals = new Set();
|
|
182
139
|
return $7QqFM$depictaiui.RecommendationGrid({
|
|
183
140
|
get recommendations() {
|
|
184
|
-
return
|
|
141
|
+
return props.recommendations;
|
|
185
142
|
},
|
|
186
143
|
product_card_template: display => {
|
|
187
144
|
if (0, $7QqFM$solidjsweb.isServer)
|
|
@@ -225,7 +182,7 @@ function $c6b960f2a07285c8$export$e46079a2793e9ec7(props, set_portals) {
|
|
|
225
182
|
}
|
|
226
183
|
});
|
|
227
184
|
}
|
|
228
|
-
const $db7b67857900028b$export$83d89fbfd8236492 = "
|
|
185
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "3.0.0";
|
|
229
186
|
function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
|
|
230
187
|
return props.children;
|
|
231
188
|
}
|
|
@@ -325,7 +282,7 @@ function $41e7e5d85b5e0d49$export$38b98fae14bd1f64() {
|
|
|
325
282
|
function $41e7e5d85b5e0d49$export$6501da23a2770fc() {
|
|
326
283
|
return {
|
|
327
284
|
fetchRecommendations: () => {
|
|
328
|
-
throw new Error("fetchRecommendations is currently not available on the server due to personalisation/
|
|
285
|
+
throw new Error("fetchRecommendations is currently not available on the server due to personalisation/session_id related issues. Please only call it on the client.");
|
|
329
286
|
}
|
|
330
287
|
};
|
|
331
288
|
}
|
package/server/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 = "
|
|
6
|
+
export const version = "3.0.0";
|
|
7
7
|
interface UsePerformanceClientReturn {
|
|
8
8
|
dpc: DPC;
|
|
9
9
|
}
|
|
@@ -83,14 +83,9 @@ type ProviderConfig<OriginalDisplay extends Display, OutputDisplay extends Moder
|
|
|
83
83
|
*/
|
|
84
84
|
navigateFunction?: NavigateFunction;
|
|
85
85
|
/**
|
|
86
|
-
* The locale to use for the Depict components.
|
|
87
|
-
* @default en
|
|
86
|
+
* The locale to use for the Depict components as well as Depict results.
|
|
88
87
|
*/
|
|
89
|
-
locale
|
|
90
|
-
/**
|
|
91
|
-
* Unique ID of the currently logged in user, if applicable.
|
|
92
|
-
*/
|
|
93
|
-
userId?: string;
|
|
88
|
+
locale: Locale;
|
|
94
89
|
/**
|
|
95
90
|
* Options that are required for search functionality.
|
|
96
91
|
*/
|
|
@@ -253,23 +248,19 @@ interface SearchPageConfig<T extends Display> extends BaseSearchPageConfig, PLPC
|
|
|
253
248
|
export function SearchPage<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never>(props: SearchPageConfig<[OutputDisplay] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<OutputDisplay>>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
254
249
|
interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig, PLPConfig<T> {
|
|
255
250
|
/**
|
|
256
|
-
* The
|
|
251
|
+
* The listing id to show. Ultimately, this endpoint is what gives you the listing id: https://api.depict.ai/docs#tag/Listing/operation/Get_Listings_v3_listings_get
|
|
257
252
|
*/
|
|
258
|
-
|
|
253
|
+
listingId: string;
|
|
259
254
|
/**
|
|
260
255
|
* categoryTitlePlugin is an optional plugin that can be used to customize the title of the category page.
|
|
261
256
|
* @default CategoryTitle
|
|
262
257
|
*
|
|
263
258
|
* @example
|
|
264
259
|
* ```tsx
|
|
265
|
-
* <CategoryPage
|
|
260
|
+
* <CategoryPage listingId="72909a4a-adf7-4355-b7be-f9090d4185db" productCard={MyCustomCategoryProductCard} categoryTitlePlugin={EmbeddedNumProducts} />
|
|
266
261
|
* ```
|
|
267
262
|
*/
|
|
268
263
|
categoryTitlePlugin?: typeof CategoryTitle | typeof embedded_num_products;
|
|
269
|
-
/**
|
|
270
|
-
* Whether this page is a collection or a category. If not specified it will be inferred as described in the docs https://docs.depict.ai/reference/category-sdk/specifying-listing-type-in-the-category-page-sdk
|
|
271
|
-
*/
|
|
272
|
-
listingType?: "collection" | "category";
|
|
273
264
|
/**
|
|
274
265
|
* When using multiple CategoryPage components on the same page, you need to set a unique stateKey for each one. We recommend using an incrementing number, such as "1", "2", "3", etc. To associate a certain BreadCrumbs or QuickLinks component with a certain CategoryPage component, set the same stateKey on both.
|
|
275
266
|
*/
|
|
@@ -288,7 +279,7 @@ interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig,
|
|
|
288
279
|
* import { DepictProductCard, ImagePlaceholder, Display, CategoryPage } from '@depict-ai/react-ui'
|
|
289
280
|
*
|
|
290
281
|
* function Category() {
|
|
291
|
-
* return <CategoryPage
|
|
282
|
+
* return <CategoryPage listingId="72909a4a-adf7-4355-b7be-f9090d4185db" productCard={MyCustomCategoryProductCard} />
|
|
292
283
|
* }
|
|
293
284
|
*
|
|
294
285
|
* interface MyCustomDisplay extends Display {}
|
|
@@ -540,7 +531,7 @@ interface UseSearchFieldReturn {
|
|
|
540
531
|
* @returns {UseSearchFieldReturn}
|
|
541
532
|
*/
|
|
542
533
|
export const useSearchField: (props?: SearchFieldProps) => UseSearchFieldReturn;
|
|
543
|
-
type FetchRecsOptions = Omit<Parameters<typeof fetchDepictRecommendations>[0], "merchant" | "market" | "
|
|
534
|
+
type FetchRecsOptions = Omit<Parameters<typeof fetchDepictRecommendations>[0], "merchant" | "market" | "sessionId"> & ExclusiveId;
|
|
544
535
|
interface UseFetchRecommendationsReturn<T extends Display> {
|
|
545
536
|
/**
|
|
546
537
|
* Fetch recommendations from the Depict API.
|
|
@@ -608,7 +599,7 @@ interface UseFetchRecommendationsReturn<T extends Display> {
|
|
|
608
599
|
* ```
|
|
609
600
|
* @returns {UseFetchRecommendationsReturn}
|
|
610
601
|
*/
|
|
611
|
-
export function useFetchRecommendations<T extends
|
|
602
|
+
export function useFetchRecommendations<T extends ModernDisplay>(): UseFetchRecommendationsReturn<T>;
|
|
612
603
|
/**
|
|
613
604
|
* Helper function to navigate to a new page depending on the navigation library used.
|
|
614
605
|
*/
|