@depict-ai/react-ui 0.0.46 → 0.0.47
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/dist/index.d.ts +57 -65
- package/dist/main.js +26 -58
- package/dist/module.js +28 -59
- package/dist-server/index.d.ts +1 -1
- package/dist-server/main.js +1 -1
- package/dist-server/module.js +1 -1
- package/locales/index.d.ts +88 -0
- package/locales/index.js +1136 -0
- package/locales/require.js +1152 -0
- package/package.json +12 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import React, { PropsWithChildren, ReactNode } from "react";
|
|
2
|
+
// @ts-ignore -- react-router is optional and only used for typing the reactRouterUseNavigate property
|
|
3
|
+
import { useNavigate } from "react-router";
|
|
4
|
+
import { Locale } from "@depict-ai/ui/locales";
|
|
2
5
|
import { Display } from "@depict-ai/utilishared";
|
|
3
6
|
import { SDKColsAtSize, SDKGridSpacing } from "@depict-ai/ui";
|
|
4
7
|
export function DepictSearchField(): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
5
|
-
type
|
|
6
|
-
|
|
8
|
+
type BaseSearchConfig = {
|
|
9
|
+
/**
|
|
10
|
+
* The merchant to use for the search.
|
|
11
|
+
* @example "YOUR_MERCHANT", "stronger"
|
|
12
|
+
*/
|
|
13
|
+
merchant: string;
|
|
14
|
+
/**
|
|
15
|
+
* The market to use for the search.
|
|
16
|
+
* @example "YOUR_MARKET", "no", "en-de"
|
|
17
|
+
*/
|
|
18
|
+
market: string;
|
|
7
19
|
/**
|
|
8
20
|
* The path to the search page.
|
|
9
21
|
* @example "/search", "/sok"
|
|
@@ -20,61 +32,49 @@ type DepictSearchConfig = {
|
|
|
20
32
|
* @default false
|
|
21
33
|
*/
|
|
22
34
|
enableCategorySuggestions?: boolean;
|
|
23
|
-
|
|
24
|
-
type DepictBaseConfig = {
|
|
25
|
-
/**
|
|
26
|
-
* The merchant to use for the search.
|
|
27
|
-
* @example "YOUR_MERCHANT", "stronger"
|
|
28
|
-
*/
|
|
29
|
-
merchant: string;
|
|
30
|
-
/**
|
|
31
|
-
* The market to use for the search.
|
|
32
|
-
* @example "YOUR_MARKET", "no", "en-de"
|
|
33
|
-
*/
|
|
34
|
-
market: string;
|
|
35
|
-
/**
|
|
36
|
-
* The function to use for navigating to a new page.
|
|
37
|
-
* This function will be used internally by our components to navigate.
|
|
38
|
-
*
|
|
39
|
-
* You don't need to provide any in a Next.js context.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* Here is how you would use it with react-router, using our helper function.
|
|
43
|
-
* ```tsx
|
|
44
|
-
* import { DepictProvider, Navigation } from "@depict-ai/react-ui";
|
|
45
|
-
*
|
|
46
|
-
* function Router() {
|
|
47
|
-
* const navigate = useNavigate();
|
|
48
|
-
* return (
|
|
49
|
-
* <DepictProvider
|
|
50
|
-
* merchant="houdini"
|
|
51
|
-
* market="en-de"
|
|
52
|
-
* navigateFunction={Navigation.reactRouterNavigation(navigate)}
|
|
53
|
-
* search={{
|
|
54
|
-
* searchPagePath: "/search",
|
|
55
|
-
* }}
|
|
56
|
-
* >
|
|
57
|
-
* <Routes>[...]</Routes>
|
|
58
|
-
* </DepictProvider>
|
|
59
|
-
* );
|
|
60
|
-
* }
|
|
61
|
-
* ```
|
|
62
|
-
* @example
|
|
63
|
-
* If you're using another library, you can define your own navigate function, that's compatible with the `NavigateFunction` type.
|
|
64
|
-
* ```tsx
|
|
65
|
-
* const navigateFunction = (href: string) => {
|
|
66
|
-
* router.push(href);
|
|
67
|
-
* };
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
navigateFunction?: NavigateFunction;
|
|
35
|
+
locale: Locale;
|
|
71
36
|
};
|
|
72
37
|
/**
|
|
73
|
-
*
|
|
38
|
+
* You can pass the function you use to navigate to a new page.
|
|
39
|
+
*
|
|
40
|
+
* Currently only works with react-router's useNavigate hook.
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* import { useNavigate } from "react-router-dom";
|
|
44
|
+
*
|
|
45
|
+
* const App = () => {
|
|
46
|
+
* return (
|
|
47
|
+
* <DepictProvider
|
|
48
|
+
* merchant="YOUR_MERCHANT"
|
|
49
|
+
* market="YOUR_MARKET"
|
|
50
|
+
* searchPagePath="/search"
|
|
51
|
+
* reactRouterUseNavigate={useNavigate}
|
|
52
|
+
* >
|
|
53
|
+
* <App />
|
|
54
|
+
* </DepictProvider>
|
|
55
|
+
* );
|
|
56
|
+
* };
|
|
57
|
+
* ```
|
|
74
58
|
*/
|
|
75
|
-
type
|
|
76
|
-
|
|
77
|
-
|
|
59
|
+
type DepictConfigInReactRouterContext = {
|
|
60
|
+
/** Expects useNavigate hook from react-router */
|
|
61
|
+
reactRouterUseNavigate: ReactRouterUseNavigate;
|
|
62
|
+
/** Not to be used in this context */
|
|
63
|
+
onNavigation?: undefined;
|
|
64
|
+
} & BaseSearchConfig;
|
|
65
|
+
type DepictConfigInOtherContext = {
|
|
66
|
+
/** Expects a function that takes a url and navigates to it */
|
|
67
|
+
onNavigation: (href: string, shallow?: boolean) => unknown;
|
|
68
|
+
/** Not to be used in this context */
|
|
69
|
+
reactRouterUseNavigate?: undefined;
|
|
70
|
+
} & BaseSearchConfig;
|
|
71
|
+
type DepictConfig = BaseSearchConfig | DepictConfigInReactRouterContext | DepictConfigInOtherContext;
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
If react-router does not exist, useNavigate will fall back to "any".
|
|
75
|
+
In that case, the ReactRouterUseNavigate type becomes "never" and cannot be used.
|
|
76
|
+
*/
|
|
77
|
+
type ReactRouterUseNavigate = any extends typeof useNavigate ? never : typeof useNavigate;
|
|
78
78
|
/**
|
|
79
79
|
* The DepictProvider is a wrapper component that should be used to wrap any component that uses Depict components.
|
|
80
80
|
*
|
|
@@ -89,9 +89,7 @@ type DepictConfig = DepictBaseConfig & {
|
|
|
89
89
|
* <DepictProvider
|
|
90
90
|
* merchant="YOUR_MERCHANT"
|
|
91
91
|
* market="YOUR_MARKET"
|
|
92
|
-
* search
|
|
93
|
-
* searchPagePath: "/search",
|
|
94
|
-
* }}
|
|
92
|
+
* searchPagePath="/search"
|
|
95
93
|
* >
|
|
96
94
|
* <App />
|
|
97
95
|
* </DepictProvider>
|
|
@@ -227,11 +225,5 @@ interface TextPlaceholderProps {
|
|
|
227
225
|
}
|
|
228
226
|
/** A placeholder text that can be used in place of a text that is loading. */
|
|
229
227
|
export const TextPlaceholder: React.FC<TextPlaceholderProps>;
|
|
230
|
-
export const version = "0.0.
|
|
231
|
-
|
|
232
|
-
* Helper function to navigate to a new page depending on the navigation library used.
|
|
233
|
-
*/
|
|
234
|
-
export const Navigation: {
|
|
235
|
-
nextRouterNavigation: (router: import("next/router").NextRouter) => (href: string) => void;
|
|
236
|
-
reactRouterNavigation: (navigateFunction: import("react-router").NavigateFunction) => (href: string) => void;
|
|
237
|
-
};
|
|
228
|
+
export const version = "0.0.47";
|
|
229
|
+
export type { Locale } from "@depict-ai/ui";
|
package/dist/main.js
CHANGED
|
@@ -3,6 +3,7 @@ var $4GYXz$depictaiui = require("@depict-ai/ui");
|
|
|
3
3
|
var $4GYXz$solidjs = require("solid-js");
|
|
4
4
|
var $4GYXz$solidjsweb = require("solid-js/web");
|
|
5
5
|
var $4GYXz$react = require("react");
|
|
6
|
+
var $4GYXz$depictaiuilocales = require("@depict-ai/ui/locales");
|
|
6
7
|
var $4GYXz$reactdom = require("react-dom");
|
|
7
8
|
var $4GYXz$reactjsxruntime = require("react/jsx-runtime");
|
|
8
9
|
|
|
@@ -18,7 +19,6 @@ $parcel$export(module.exports, "DepictSearchPage", () => $a6bedbe4b4d6d027$expor
|
|
|
18
19
|
$parcel$export(module.exports, "ImagePlaceholder", () => $308b2c6db21be2eb$export$3f37af283f8fb843);
|
|
19
20
|
$parcel$export(module.exports, "TextPlaceholder", () => $afce04c26b0c4208$export$89c6019e4baa40b1);
|
|
20
21
|
$parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fbfd8236492);
|
|
21
|
-
$parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
|
|
22
22
|
/*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
|
|
23
23
|
// Note, if you add an export here, also add one in src-server/main.ts
|
|
24
24
|
|
|
@@ -83,6 +83,7 @@ function $a48f3b1a4abf2e0c$export$d2c02478244f91f7() {
|
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
|
|
86
|
+
|
|
86
87
|
let $6319748b4f0426f0$var$set = false;
|
|
87
88
|
let $6319748b4f0426f0$var$padding_animation;
|
|
88
89
|
function $6319748b4f0426f0$export$6453cbc34515a94d(is_search_page) {
|
|
@@ -135,20 +136,9 @@ function $6319748b4f0426f0$var$removeLotsOfPadding() {
|
|
|
135
136
|
|
|
136
137
|
|
|
137
138
|
|
|
138
|
-
|
|
139
|
-
const $bc389476eeb2b615$export$599d4515591ef232 = (href)=>{
|
|
140
|
-
const shallow = (0, $b4d0d98857ed9934$export$6cb4d3a5c1ac9b43)(location);
|
|
141
|
-
if (window.next) window.next.router.push(href, undefined, {
|
|
142
|
-
shallow: shallow,
|
|
143
|
-
scroll: true
|
|
144
|
-
});
|
|
145
|
-
else location.href = href;
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
|
|
149
139
|
function $18b830ef84ac138a$export$9fac37a9c21c2f3b(props) {
|
|
150
|
-
const { children: children , market: market , merchant: merchant ,
|
|
151
|
-
const
|
|
140
|
+
const { children: children , searchPagePath: searchPagePath , urlParamName: urlParamName , enableCategorySuggestions: enableCategorySuggestions , market: market , merchant: merchant , locale: locale } = props;
|
|
141
|
+
const usedLocale = locale ?? (0, $4GYXz$depictaiuilocales.en);
|
|
152
142
|
if (!market || !merchant) {
|
|
153
143
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](false);
|
|
154
144
|
return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, children);
|
|
@@ -158,25 +148,33 @@ function $18b830ef84ac138a$export$9fac37a9c21c2f3b(props) {
|
|
|
158
148
|
const [get_search_page_path, set_search_page_path] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_;
|
|
159
149
|
set_search_page_path(searchPagePath);
|
|
160
150
|
if (!search) {
|
|
151
|
+
let react_router_navigate;
|
|
152
|
+
if ("reactRouterUseNavigate" in props) {
|
|
153
|
+
const { reactRouterUseNavigate: reactRouterUseNavigate } = props;
|
|
154
|
+
if (typeof reactRouterUseNavigate === "function") react_router_navigate = reactRouterUseNavigate();
|
|
155
|
+
}
|
|
161
156
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search = new (0, $4GYXz$depictaiui.DepictSearch)({
|
|
162
157
|
search_query_url_param_name: urlParamName,
|
|
163
158
|
market: market,
|
|
164
159
|
merchant: merchant,
|
|
165
160
|
enable_category_suggestions: enableCategorySuggestions ?? false,
|
|
166
161
|
// default category suggestions to false for @depict-ai/react-ui (https://linear.app/depictai/issue/FRO-401/default-enablecategorysuggestions-to-false)
|
|
167
|
-
localization:
|
|
168
|
-
...(0, $4GYXz$depictaiui.swedish_search_translation),
|
|
169
|
-
price_formatting_: {
|
|
170
|
-
pre_: "kr ",
|
|
171
|
-
post_: "",
|
|
172
|
-
decimal_places_delimiter_: ",",
|
|
173
|
-
thousands_delimiter_: " ",
|
|
174
|
-
places_after_comma_: 2
|
|
175
|
-
}
|
|
176
|
-
},
|
|
162
|
+
localization: usedLocale,
|
|
177
163
|
on_navigation: (new_href)=>{
|
|
178
|
-
|
|
179
|
-
|
|
164
|
+
const shallow = (0, $b4d0d98857ed9934$export$6cb4d3a5c1ac9b43)(location);
|
|
165
|
+
if ("onNavigation" in props) {
|
|
166
|
+
const { onNavigation: onNavigation } = props;
|
|
167
|
+
if (typeof onNavigation === "function") return onNavigation(new_href, shallow);
|
|
168
|
+
}
|
|
169
|
+
if (react_router_navigate) {
|
|
170
|
+
const url_object = new URL(new_href);
|
|
171
|
+
return react_router_navigate(url_object.pathname + url_object.search + url_object.hash);
|
|
172
|
+
}
|
|
173
|
+
if (window.next) window.next.router.push(new_href, undefined, {
|
|
174
|
+
shallow: shallow,
|
|
175
|
+
scroll: true
|
|
176
|
+
});
|
|
177
|
+
else location.href = new_href;
|
|
180
178
|
},
|
|
181
179
|
url_transformer: (url)=>url.pathname = (0, $4GYXz$solidjs.untrack)(get_search_page_path)
|
|
182
180
|
});
|
|
@@ -184,6 +182,7 @@ function $18b830ef84ac138a$export$9fac37a9c21c2f3b(props) {
|
|
|
184
182
|
} else {
|
|
185
183
|
search.market = market;
|
|
186
184
|
search.merchant = merchant;
|
|
185
|
+
search.localization = usedLocale;
|
|
187
186
|
}
|
|
188
187
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](true);
|
|
189
188
|
} catch (e) {
|
|
@@ -347,41 +346,10 @@ const $afce04c26b0c4208$export$89c6019e4baa40b1 = ({ width: width , height: heig
|
|
|
347
346
|
};
|
|
348
347
|
|
|
349
348
|
|
|
350
|
-
const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.
|
|
349
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.47";
|
|
351
350
|
|
|
352
351
|
|
|
353
352
|
|
|
354
|
-
|
|
355
|
-
const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(href)=>{
|
|
356
|
-
const shallow = (0, $b4d0d98857ed9934$export$6cb4d3a5c1ac9b43)(location);
|
|
357
|
-
router.push(href, undefined, {
|
|
358
|
-
shallow: shallow,
|
|
359
|
-
scroll: true
|
|
360
|
-
});
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Helper function that creates a function that can be used as the
|
|
366
|
-
* navigateFunction callback for DepictProvider when using react-router.
|
|
367
|
-
*
|
|
368
|
-
* React-router expect relative URLs, so this function will strip the
|
|
369
|
-
* protocol, hostname and port from the URL.
|
|
370
|
-
*
|
|
371
|
-
* @param navigateFunction what useNavigate() returns
|
|
372
|
-
* @returns a function that can be used as the navigateFunction callback for DepictProvider
|
|
373
|
-
*/ const $201a023b63de7d2f$export$d53481656a62aebe = (navigateFunction)=>(href)=>{
|
|
374
|
-
const url_object = new URL(href);
|
|
375
|
-
return navigateFunction(url_object.pathname + url_object.search + url_object.hash);
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
const $b742053c966024b4$export$b8a61e5c71402559 = {
|
|
380
|
-
nextRouterNavigation: $e387bd534de10acd$export$804fac5697cfbe35,
|
|
381
|
-
reactRouterNavigation: $201a023b63de7d2f$export$d53481656a62aebe
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
|
|
385
353
|
const $b03e4eee8610ebbe$var$package_name = "@depict-ai/react-ui";
|
|
386
354
|
(0, $4GYXz$depictaiutilishared.dlog)($b03e4eee8610ebbe$var$package_name + " version", (0, $db7b67857900028b$export$83d89fbfd8236492));
|
|
387
355
|
(0, $4GYXz$depictaiui.add_to_version_info)({
|
package/dist/module.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {dlog as $TZSbU$dlog, href_change_ipns as $TZSbU$href_change_ipns, catchify as $TZSbU$catchify, observer as $TZSbU$observer, history_replacer as $TZSbU$history_replacer, queueMacroTask as $TZSbU$queueMacroTask, ContainedPlaceholderImage as $TZSbU$ContainedPlaceholderImage, Placeholder as $TZSbU$Placeholder} from "@depict-ai/utilishared";
|
|
2
|
-
import {add_to_version_info as $TZSbU$add_to_version_info, SearchField as $TZSbU$SearchField, DepictSearch as $TZSbU$DepictSearch,
|
|
2
|
+
import {add_to_version_info as $TZSbU$add_to_version_info, SearchField as $TZSbU$SearchField, DepictSearch as $TZSbU$DepictSearch, get_search_query_updating_blocked_signal as $TZSbU$get_search_query_updating_blocked_signal, SearchPage as $TZSbU$SearchPage} from "@depict-ai/ui";
|
|
3
3
|
import {untrack as $TZSbU$untrack, createComponent as $TZSbU$createComponent, Show as $TZSbU$Show, createSignal as $TZSbU$createSignal, createMemo as $TZSbU$createMemo, createComputed as $TZSbU$createComputed, onCleanup as $TZSbU$onCleanup} from "solid-js";
|
|
4
4
|
import {render as $TZSbU$render} from "solid-js/web";
|
|
5
5
|
import {useState as $TZSbU$useState, useRef as $TZSbU$useRef, useEffect as $TZSbU$useEffect, createElement as $TZSbU$createElement, Fragment as $TZSbU$Fragment} from "react";
|
|
6
|
+
import {en as $TZSbU$en} from "@depict-ai/ui/locales";
|
|
6
7
|
import {createPortal as $TZSbU$createPortal} from "react-dom";
|
|
7
8
|
import {jsx as $TZSbU$jsx} from "react/jsx-runtime";
|
|
8
9
|
|
|
@@ -70,6 +71,7 @@ function $54b0d21b77e719c4$export$d2c02478244f91f7() {
|
|
|
70
71
|
|
|
71
72
|
|
|
72
73
|
|
|
74
|
+
|
|
73
75
|
let $8071251ee4e9ffa1$var$set = false;
|
|
74
76
|
let $8071251ee4e9ffa1$var$padding_animation;
|
|
75
77
|
function $8071251ee4e9ffa1$export$6453cbc34515a94d(is_search_page) {
|
|
@@ -122,20 +124,9 @@ function $8071251ee4e9ffa1$var$removeLotsOfPadding() {
|
|
|
122
124
|
|
|
123
125
|
|
|
124
126
|
|
|
125
|
-
|
|
126
|
-
const $7216ca4c8308a0f9$export$599d4515591ef232 = (href)=>{
|
|
127
|
-
const shallow = (0, $c83ba9ab79386687$export$6cb4d3a5c1ac9b43)(location);
|
|
128
|
-
if (window.next) window.next.router.push(href, undefined, {
|
|
129
|
-
shallow: shallow,
|
|
130
|
-
scroll: true
|
|
131
|
-
});
|
|
132
|
-
else location.href = href;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
|
|
136
127
|
function $faf794495ff8b304$export$9fac37a9c21c2f3b(props) {
|
|
137
|
-
const { children: children , market: market , merchant: merchant ,
|
|
138
|
-
const
|
|
128
|
+
const { children: children , searchPagePath: searchPagePath , urlParamName: urlParamName , enableCategorySuggestions: enableCategorySuggestions , market: market , merchant: merchant , locale: locale } = props;
|
|
129
|
+
const usedLocale = locale ?? (0, $TZSbU$en);
|
|
139
130
|
if (!market || !merchant) {
|
|
140
131
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](false);
|
|
141
132
|
return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, children);
|
|
@@ -145,25 +136,33 @@ function $faf794495ff8b304$export$9fac37a9c21c2f3b(props) {
|
|
|
145
136
|
const [get_search_page_path, set_search_page_path] = (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_;
|
|
146
137
|
set_search_page_path(searchPagePath);
|
|
147
138
|
if (!search) {
|
|
139
|
+
let react_router_navigate;
|
|
140
|
+
if ("reactRouterUseNavigate" in props) {
|
|
141
|
+
const { reactRouterUseNavigate: reactRouterUseNavigate } = props;
|
|
142
|
+
if (typeof reactRouterUseNavigate === "function") react_router_navigate = reactRouterUseNavigate();
|
|
143
|
+
}
|
|
148
144
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).search = new (0, $TZSbU$DepictSearch)({
|
|
149
145
|
search_query_url_param_name: urlParamName,
|
|
150
146
|
market: market,
|
|
151
147
|
merchant: merchant,
|
|
152
148
|
enable_category_suggestions: enableCategorySuggestions ?? false,
|
|
153
149
|
// default category suggestions to false for @depict-ai/react-ui (https://linear.app/depictai/issue/FRO-401/default-enablecategorysuggestions-to-false)
|
|
154
|
-
localization:
|
|
155
|
-
...(0, $TZSbU$swedish_search_translation),
|
|
156
|
-
price_formatting_: {
|
|
157
|
-
pre_: "kr ",
|
|
158
|
-
post_: "",
|
|
159
|
-
decimal_places_delimiter_: ",",
|
|
160
|
-
thousands_delimiter_: " ",
|
|
161
|
-
places_after_comma_: 2
|
|
162
|
-
}
|
|
163
|
-
},
|
|
150
|
+
localization: usedLocale,
|
|
164
151
|
on_navigation: (new_href)=>{
|
|
165
|
-
|
|
166
|
-
|
|
152
|
+
const shallow = (0, $c83ba9ab79386687$export$6cb4d3a5c1ac9b43)(location);
|
|
153
|
+
if ("onNavigation" in props) {
|
|
154
|
+
const { onNavigation: onNavigation } = props;
|
|
155
|
+
if (typeof onNavigation === "function") return onNavigation(new_href, shallow);
|
|
156
|
+
}
|
|
157
|
+
if (react_router_navigate) {
|
|
158
|
+
const url_object = new URL(new_href);
|
|
159
|
+
return react_router_navigate(url_object.pathname + url_object.search + url_object.hash);
|
|
160
|
+
}
|
|
161
|
+
if (window.next) window.next.router.push(new_href, undefined, {
|
|
162
|
+
shallow: shallow,
|
|
163
|
+
scroll: true
|
|
164
|
+
});
|
|
165
|
+
else location.href = new_href;
|
|
167
166
|
},
|
|
168
167
|
url_transformer: (url)=>url.pathname = (0, $TZSbU$untrack)(get_search_page_path)
|
|
169
168
|
});
|
|
@@ -171,6 +170,7 @@ function $faf794495ff8b304$export$9fac37a9c21c2f3b(props) {
|
|
|
171
170
|
} else {
|
|
172
171
|
search.market = market;
|
|
173
172
|
search.merchant = merchant;
|
|
173
|
+
search.localization = usedLocale;
|
|
174
174
|
}
|
|
175
175
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](true);
|
|
176
176
|
} catch (e) {
|
|
@@ -334,41 +334,10 @@ const $8aa3ab31237c8dc9$export$89c6019e4baa40b1 = ({ width: width , height: heig
|
|
|
334
334
|
};
|
|
335
335
|
|
|
336
336
|
|
|
337
|
-
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.
|
|
337
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.47";
|
|
338
338
|
|
|
339
339
|
|
|
340
340
|
|
|
341
|
-
|
|
342
|
-
const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(href)=>{
|
|
343
|
-
const shallow = (0, $c83ba9ab79386687$export$6cb4d3a5c1ac9b43)(location);
|
|
344
|
-
router.push(href, undefined, {
|
|
345
|
-
shallow: shallow,
|
|
346
|
-
scroll: true
|
|
347
|
-
});
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Helper function that creates a function that can be used as the
|
|
353
|
-
* navigateFunction callback for DepictProvider when using react-router.
|
|
354
|
-
*
|
|
355
|
-
* React-router expect relative URLs, so this function will strip the
|
|
356
|
-
* protocol, hostname and port from the URL.
|
|
357
|
-
*
|
|
358
|
-
* @param navigateFunction what useNavigate() returns
|
|
359
|
-
* @returns a function that can be used as the navigateFunction callback for DepictProvider
|
|
360
|
-
*/ const $01e1970add53d62a$export$d53481656a62aebe = (navigateFunction)=>(href)=>{
|
|
361
|
-
const url_object = new URL(href);
|
|
362
|
-
return navigateFunction(url_object.pathname + url_object.search + url_object.hash);
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
const $97603d19204ec48d$export$b8a61e5c71402559 = {
|
|
367
|
-
nextRouterNavigation: $a92aa2beb560b8af$export$804fac5697cfbe35,
|
|
368
|
-
reactRouterNavigation: $01e1970add53d62a$export$d53481656a62aebe
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
|
|
372
341
|
const $43099132aad1ceb6$var$package_name = "@depict-ai/react-ui";
|
|
373
342
|
(0, $TZSbU$dlog)($43099132aad1ceb6$var$package_name + " version", (0, $c9c4d066f9a5b51b$export$83d89fbfd8236492));
|
|
374
343
|
(0, $TZSbU$add_to_version_info)({
|
|
@@ -376,4 +345,4 @@ const $43099132aad1ceb6$var$package_name = "@depict-ai/react-ui";
|
|
|
376
345
|
});
|
|
377
346
|
|
|
378
347
|
|
|
379
|
-
export {$54b0d21b77e719c4$export$d2c02478244f91f7 as DepictSearchField, $faf794495ff8b304$export$9fac37a9c21c2f3b as DepictProvider, $f41a371216eff80b$export$a7f6cffb6b8ba11c as openModal, $f41a371216eff80b$export$cbcd1ecdb41b1d0a as DepictSearchHeader, $9f8d5ef3c016c493$export$210723f5a54a7028 as DepictSearchPage, $c95f83f01e99fc18$export$3f37af283f8fb843 as ImagePlaceholder, $8aa3ab31237c8dc9$export$89c6019e4baa40b1 as TextPlaceholder, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version
|
|
348
|
+
export {$54b0d21b77e719c4$export$d2c02478244f91f7 as DepictSearchField, $faf794495ff8b304$export$9fac37a9c21c2f3b as DepictProvider, $f41a371216eff80b$export$a7f6cffb6b8ba11c as openModal, $f41a371216eff80b$export$cbcd1ecdb41b1d0a as DepictSearchHeader, $9f8d5ef3c016c493$export$210723f5a54a7028 as DepictSearchPage, $c95f83f01e99fc18$export$3f37af283f8fb843 as ImagePlaceholder, $8aa3ab31237c8dc9$export$89c6019e4baa40b1 as TextPlaceholder, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version};
|
package/dist-server/index.d.ts
CHANGED
package/dist-server/main.js
CHANGED
|
@@ -15,7 +15,7 @@ $parcel$export(module.exports, "openModal", () => $41e7e5d85b5e0d49$export$a7f6c
|
|
|
15
15
|
$parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fbfd8236492);
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.
|
|
18
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.47";
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
|
package/dist-server/module.js
CHANGED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Elem } from "@depict-ai/utilishared";
|
|
2
|
+
/**
|
|
3
|
+
* PLP internationalisation shared between search and category listing
|
|
4
|
+
*/
|
|
5
|
+
type plp_shared_i18n = {
|
|
6
|
+
scroll_to_top_: string;
|
|
7
|
+
back_: string;
|
|
8
|
+
open_sorting_: string;
|
|
9
|
+
close_sorting_: string;
|
|
10
|
+
open_filters_: string;
|
|
11
|
+
close_filters_: string;
|
|
12
|
+
close_: string;
|
|
13
|
+
ok_: string;
|
|
14
|
+
filters_cleared_: string;
|
|
15
|
+
we_cleared_your_filters_: string;
|
|
16
|
+
restore_: string;
|
|
17
|
+
sorting_text_: string;
|
|
18
|
+
filter_text_: string;
|
|
19
|
+
selected_filters_title_: string;
|
|
20
|
+
filters_: string;
|
|
21
|
+
view_less_: string;
|
|
22
|
+
view_more_: string;
|
|
23
|
+
clear_all_from_filter_crumbs_: string;
|
|
24
|
+
clear_individual_filter_: string;
|
|
25
|
+
of_: string;
|
|
26
|
+
clear_all_filters_from_big_button_: string;
|
|
27
|
+
try_without_filters_: string;
|
|
28
|
+
range_filter_low_point_aria_label_: string;
|
|
29
|
+
range_filter_high_point_aria_label_: string;
|
|
30
|
+
morphing_sign_expanded_aria_label_: string;
|
|
31
|
+
morphing_sign_collapsed_aria_label_: string;
|
|
32
|
+
price_formatting_: {
|
|
33
|
+
pre_: string;
|
|
34
|
+
post_: string;
|
|
35
|
+
decimal_places_delimiter_: string;
|
|
36
|
+
thousands_delimiter_: string;
|
|
37
|
+
places_after_comma_: number | "auto";
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Search internationalisation
|
|
42
|
+
*/
|
|
43
|
+
interface search_i18n extends plp_shared_i18n {
|
|
44
|
+
placeholder_text_: string;
|
|
45
|
+
show_n_results_: (number_of_results: HTMLElement) => Elem[];
|
|
46
|
+
no_results_text_: string;
|
|
47
|
+
search_recs_title_: string;
|
|
48
|
+
clear_filters_query_sorting_after_submit_: string;
|
|
49
|
+
modal_view_all_results_: (number_of_results: HTMLElement) => Elem[];
|
|
50
|
+
modal_discover_more_: string;
|
|
51
|
+
get_showing_results_for_: (query: HTMLElement, number_of_results: HTMLElement) => Elem[];
|
|
52
|
+
previous_searches_text_: string;
|
|
53
|
+
category_: string;
|
|
54
|
+
suggestions_: string;
|
|
55
|
+
search_submit_button_aria_label_: string;
|
|
56
|
+
query_input_field_aria_label_: string;
|
|
57
|
+
previous_searches_delete_entry_from_history_: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Category internationalisation
|
|
61
|
+
*/
|
|
62
|
+
interface category_i18n extends plp_shared_i18n {
|
|
63
|
+
show_n_products_: (number_of_results: HTMLElement) => Elem[];
|
|
64
|
+
no_products_text_: string;
|
|
65
|
+
product_: string;
|
|
66
|
+
products_: string;
|
|
67
|
+
breadcrumbs_aria_label_: string;
|
|
68
|
+
quicklinks_aria_label_: string;
|
|
69
|
+
breadcrumbs_separator_: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Depict UI internationalisation
|
|
73
|
+
*/
|
|
74
|
+
interface Locale extends category_i18n, search_i18n {
|
|
75
|
+
}
|
|
76
|
+
export const cz: Locale;
|
|
77
|
+
export const da: Locale;
|
|
78
|
+
export const nl: Locale;
|
|
79
|
+
export const en: Locale;
|
|
80
|
+
export const fi: Locale;
|
|
81
|
+
export const fr: Locale;
|
|
82
|
+
export const de: Locale;
|
|
83
|
+
export const it: Locale;
|
|
84
|
+
export const no: Locale;
|
|
85
|
+
export const pl: Locale;
|
|
86
|
+
export const pt: Locale;
|
|
87
|
+
export const es: Locale;
|
|
88
|
+
export const sv: Locale;
|