@sonic-equipment/ui 0.0.41 → 0.0.43
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/algolia/algolia-index-config.d.ts +1 -0
- package/dist/algolia/algolia-provider.d.ts +3 -3
- package/dist/algolia/algolia-searchclient-offline.d.ts +1 -1
- package/dist/algolia/algolia-sonic-searchclient.d.ts +7 -2
- package/dist/cards/product-card/product-card.d.ts +3 -1
- package/dist/config.d.ts +10 -2
- package/dist/global-search/global-search-provider/algolia-search-provider.d.ts +1 -1
- package/dist/global-search/global-search-provider/use-algolia-search.d.ts +1 -1
- package/dist/global-search/global-search.d.ts +1 -1
- package/dist/global-search/global-search.stories.d.ts +7 -3
- package/dist/global-search/plugins/categories-plugin.d.ts +1 -1
- package/dist/global-search/plugins/popular-categories-plugin.d.ts +1 -1
- package/dist/global-search/plugins/popular-searches-plugin.d.ts +1 -1
- package/dist/global-search/plugins/products-plugin.d.ts +1 -1
- package/dist/global-search/plugins/query-suggestions-plugin.d.ts +1 -1
- package/dist/global-search/plugins/quick-access-plugin.d.ts +1 -1
- package/dist/global-search/types.d.ts +1 -1
- package/dist/index.d.ts +16 -11
- package/dist/index.js +120 -65
- package/dist/pages/product-listing-page/product-listing-page.d.ts +2 -3
- package/dist/pages/product-listing-page/product-listing-page.stories.d.ts +0 -1
- package/dist/shared/api/bff/hooks/use-fetch-product-listing-page-data.d.ts +1 -1
- package/dist/shared/api/bff/hooks/use-fetch-product-listing-page-data.stories.d.ts +1 -3
- package/dist/styles.css +7 -9
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ export interface Indexes {
|
|
|
6
6
|
index: string;
|
|
7
7
|
name: string;
|
|
8
8
|
}[];
|
|
9
|
+
suggestions: string;
|
|
9
10
|
}
|
|
10
11
|
export declare const algoliaIndexesPerEnvironment: Record<Environment, Indexes>;
|
|
11
12
|
export declare const getAlgoliaIndex: (environment: Environment, languageCode: LanguageCode) => Indexes;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SearchClient } from 'algoliasearch
|
|
2
|
+
import { SearchClient } from 'algoliasearch';
|
|
3
3
|
import { RouterProps } from 'instantsearch.js/es/middlewares/createRouterMiddleware';
|
|
4
4
|
import { UiState } from 'instantsearch.js/es/types';
|
|
5
5
|
interface AlgoliaContextType {
|
|
@@ -8,7 +8,7 @@ interface AlgoliaContextType {
|
|
|
8
8
|
toggleOnline: VoidFunction;
|
|
9
9
|
}
|
|
10
10
|
interface AlgoliaProviderProps {
|
|
11
|
-
categoryPages: string
|
|
11
|
+
categoryPages: string;
|
|
12
12
|
children: ReactNode;
|
|
13
13
|
languageCode: string;
|
|
14
14
|
offlineSearchClient?: SearchClient;
|
|
@@ -16,6 +16,6 @@ interface AlgoliaProviderProps {
|
|
|
16
16
|
routing?: boolean | RouterProps<UiState, UiState> | undefined;
|
|
17
17
|
searchClient: SearchClient;
|
|
18
18
|
}
|
|
19
|
-
export declare function AlgoliaProvider({ categoryPages, children, languageCode, offlineSearchClient, online: _online, routing, searchClient, }: AlgoliaProviderProps): import("react/jsx-runtime").JSX.Element
|
|
19
|
+
export declare function AlgoliaProvider({ categoryPages, children, languageCode, offlineSearchClient, online: _online, routing, searchClient, }: AlgoliaProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export declare function useAlgolia(): AlgoliaContextType;
|
|
21
21
|
export {};
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import { SearchClient } from 'algoliasearch
|
|
2
|
-
export declare const createSonicSearchClient: (
|
|
1
|
+
import { SearchClient } from 'algoliasearch';
|
|
2
|
+
export declare const createSonicSearchClient: ({ apiKey, appId, path, }: {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
appId: string;
|
|
5
|
+
host: string | undefined;
|
|
6
|
+
path: string;
|
|
7
|
+
}) => SearchClient;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
+
import { PressEvent } from 'react-aria-components';
|
|
2
3
|
import type { ImageSource } from 'shared/types/image';
|
|
3
4
|
import type { ProductPrice as ProductPriceType } from 'shared/types/price';
|
|
4
5
|
export interface ProductCardProps {
|
|
@@ -6,9 +7,10 @@ export interface ProductCardProps {
|
|
|
6
7
|
favoriteButton?: ReactElement;
|
|
7
8
|
href: string;
|
|
8
9
|
image: ImageSource;
|
|
10
|
+
onPress?: (e: PressEvent) => void;
|
|
9
11
|
price: ProductPriceType;
|
|
10
12
|
sku: string;
|
|
11
13
|
tags?: string[];
|
|
12
14
|
title: string;
|
|
13
15
|
}
|
|
14
|
-
export declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image, price, sku, tags, title, }: ProductCardProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image, onPress, price, sku, tags, title, }: ProductCardProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { Environment } from 'shared/utils/environment';
|
|
2
|
+
interface Config {
|
|
3
|
+
ALGOLIA_API_KEY: string;
|
|
4
|
+
ALGOLIA_APP_ID: string;
|
|
5
|
+
ALGOLIA_HOST: string;
|
|
6
|
+
BFF_API_URL: string;
|
|
2
7
|
SHOP_API_URL: string;
|
|
3
|
-
}
|
|
8
|
+
}
|
|
9
|
+
export declare const configPerEnvironment: Record<Environment, Config>;
|
|
10
|
+
export declare const config: Config;
|
|
11
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { SearchClient } from 'algoliasearch
|
|
2
|
+
import { SearchClient } from 'algoliasearch';
|
|
3
3
|
import { Autocomplete, GlobalSearchContextValue } from 'global-search/types';
|
|
4
4
|
export declare const GlobalSearchContext: React.Context<GlobalSearchContextValue | null>;
|
|
5
5
|
export declare function AlgoliaSearchProvider({ children, searchClient, }: {
|
|
@@ -21,7 +21,7 @@ export declare function useAlgoliaSearch(): {
|
|
|
21
21
|
panelRef: React.RefObject<HTMLDivElement>;
|
|
22
22
|
productsIndexName: string;
|
|
23
23
|
productsQuerySuggestionsIndexName: string;
|
|
24
|
-
searchClient: import("algoliasearch
|
|
24
|
+
searchClient: import("algoliasearch").SearchClient;
|
|
25
25
|
setState: React.Dispatch<React.SetStateAction<import("../types").AutocompleteState>>;
|
|
26
26
|
state: import("../types").AutocompleteState;
|
|
27
27
|
};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
2
|
import { StoryObj } from '@storybook/react';
|
|
3
3
|
import { GlobalSearch } from './global-search';
|
|
4
|
+
type StoryProps = Omit<ComponentProps<typeof GlobalSearch>, 'searchClient'> & {
|
|
5
|
+
bff: boolean;
|
|
6
|
+
languageCode: string;
|
|
7
|
+
online: boolean;
|
|
8
|
+
};
|
|
4
9
|
declare const meta: {
|
|
5
10
|
args: {
|
|
6
|
-
|
|
11
|
+
bff: true;
|
|
12
|
+
languageCode: string;
|
|
7
13
|
};
|
|
8
|
-
component: typeof GlobalSearch;
|
|
9
14
|
parameters: {
|
|
10
15
|
layout: string;
|
|
11
16
|
};
|
|
@@ -13,6 +18,5 @@ declare const meta: {
|
|
|
13
18
|
title: string;
|
|
14
19
|
};
|
|
15
20
|
export default meta;
|
|
16
|
-
type StoryProps = ComponentProps<typeof GlobalSearch>;
|
|
17
21
|
type Story = StoryObj<StoryProps>;
|
|
18
22
|
export declare const Default: Story;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AutocompletePlugin } from '@algolia/autocomplete-core';
|
|
2
2
|
import { Hit } from '@algolia/client-search';
|
|
3
|
-
import { SearchClient } from 'algoliasearch
|
|
3
|
+
import { SearchClient } from 'algoliasearch';
|
|
4
4
|
export type CategoryHit = Hit<{
|
|
5
5
|
listCategories: string[];
|
|
6
6
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AutocompletePlugin } from '@algolia/autocomplete-core';
|
|
2
2
|
import { Hit } from '@algolia/client-search';
|
|
3
|
-
import { SearchClient } from 'algoliasearch
|
|
3
|
+
import { SearchClient } from 'algoliasearch';
|
|
4
4
|
export type PopularCategoryHit = Hit<{
|
|
5
5
|
count: number;
|
|
6
6
|
label: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query-suggestions';
|
|
2
2
|
import { Hit } from '@algolia/client-search';
|
|
3
|
-
import { SearchClient } from 'algoliasearch
|
|
3
|
+
import { SearchClient } from 'algoliasearch';
|
|
4
4
|
export type PopularSearchHit = Hit<{
|
|
5
5
|
nb_words: number;
|
|
6
6
|
popularity: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AutocompletePlugin } from '@algolia/autocomplete-core';
|
|
2
2
|
import { Hit } from '@algolia/client-search';
|
|
3
|
-
import { SearchClient } from 'algoliasearch
|
|
3
|
+
import { SearchClient } from 'algoliasearch';
|
|
4
4
|
import type { ProductHit as ProductHitType } from 'shared/types/product';
|
|
5
5
|
export type ProductHit = Hit<ProductHitType>;
|
|
6
6
|
export declare const productsPlugin: ({ productsIndexName, searchClient, }: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query-suggestions';
|
|
2
2
|
import { Hit } from '@algolia/client-search';
|
|
3
|
-
import { SearchClient } from 'algoliasearch
|
|
3
|
+
import { SearchClient } from 'algoliasearch';
|
|
4
4
|
export type QuerySuggestionHit = Hit<{
|
|
5
5
|
nb_words: number;
|
|
6
6
|
popularity: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AutocompletePlugin } from '@algolia/autocomplete-core';
|
|
2
2
|
import { Hit } from '@algolia/client-search';
|
|
3
|
-
import { SearchClient } from 'algoliasearch
|
|
3
|
+
import { SearchClient } from 'algoliasearch';
|
|
4
4
|
export type QuickAccessHit = Hit<{
|
|
5
5
|
id: number;
|
|
6
6
|
image: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AutocompleteApi, AutocompleteState as _AutocompleteState } from '@algolia/autocomplete-core';
|
|
2
|
-
import { SearchClient } from 'algoliasearch
|
|
2
|
+
import { SearchClient } from 'algoliasearch';
|
|
3
3
|
import { CategoryHit } from './plugins/categories-plugin';
|
|
4
4
|
import { PopularCategoryHit } from './plugins/popular-categories-plugin';
|
|
5
5
|
import { PopularSearchHit } from './plugins/popular-searches-plugin';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { ReactElement, MutableRefObject, ReactNode, RefAttributes, HTMLAttributeAnchorTarget, FormEventHandler, KeyboardEvent, ComponentType } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { LinkProps, ButtonProps as ButtonProps$1 } from 'react-aria-components';
|
|
5
|
-
import * as
|
|
6
|
-
import { SearchClient } from 'algoliasearch
|
|
4
|
+
import { LinkProps, ButtonProps as ButtonProps$1, PressEvent } from 'react-aria-components';
|
|
5
|
+
import * as algoliasearch from 'algoliasearch';
|
|
6
|
+
import { SearchClient } from 'algoliasearch';
|
|
7
7
|
import { RouterProps } from 'instantsearch.js/es/middlewares/createRouterMiddleware';
|
|
8
8
|
import { UiState } from 'instantsearch.js/es/types';
|
|
9
9
|
import { AutocompleteApi, AutocompleteState as AutocompleteState$1, AutocompleteCollection } from '@algolia/autocomplete-core';
|
|
@@ -133,7 +133,7 @@ interface FetchProductListingPageDataArgs {
|
|
|
133
133
|
declare class FetchProductListingPageDataError extends ResponseError {
|
|
134
134
|
constructor(response: Response, message?: string);
|
|
135
135
|
}
|
|
136
|
-
declare function useFetchProductListingPageData(
|
|
136
|
+
declare function useFetchProductListingPageData({ languageCode, pageUrl, }: FetchProductListingPageDataArgs): _tanstack_react_query.UseQueryResult<ProductListingPageData, Error>;
|
|
137
137
|
|
|
138
138
|
interface BaseModel$1 {
|
|
139
139
|
properties: {
|
|
@@ -3684,12 +3684,13 @@ interface ProductCardProps {
|
|
|
3684
3684
|
favoriteButton?: ReactElement;
|
|
3685
3685
|
href: string;
|
|
3686
3686
|
image: ImageSource;
|
|
3687
|
+
onPress?: (e: PressEvent) => void;
|
|
3687
3688
|
price: ProductPrice$1;
|
|
3688
3689
|
sku: string;
|
|
3689
3690
|
tags?: string[];
|
|
3690
3691
|
title: string;
|
|
3691
3692
|
}
|
|
3692
|
-
declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image, price, sku, tags, title, }: ProductCardProps): react_jsx_runtime.JSX.Element;
|
|
3693
|
+
declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image, onPress, price, sku, tags, title, }: ProductCardProps): react_jsx_runtime.JSX.Element;
|
|
3693
3694
|
|
|
3694
3695
|
interface CategoryCarouselProps {
|
|
3695
3696
|
categoryCards: ReactNode[];
|
|
@@ -3918,11 +3919,10 @@ interface Filters {
|
|
|
3918
3919
|
};
|
|
3919
3920
|
}
|
|
3920
3921
|
interface ProductListingPageProps {
|
|
3921
|
-
bffUrl: string;
|
|
3922
3922
|
pageUrl: string;
|
|
3923
3923
|
searchClient?: SearchClient;
|
|
3924
3924
|
}
|
|
3925
|
-
declare function ProductListingPage({
|
|
3925
|
+
declare function ProductListingPage({ pageUrl, searchClient: _searchClient, }: ProductListingPageProps): react_jsx_runtime.JSX.Element;
|
|
3926
3926
|
|
|
3927
3927
|
interface SidebarProps {
|
|
3928
3928
|
children: React.ReactNode;
|
|
@@ -3969,7 +3969,12 @@ interface AlgoliaPaginationProps {
|
|
|
3969
3969
|
}
|
|
3970
3970
|
declare function AlgoliaPagination({ onChange }: AlgoliaPaginationProps): react_jsx_runtime.JSX.Element;
|
|
3971
3971
|
|
|
3972
|
-
declare const createSonicSearchClient: (
|
|
3972
|
+
declare const createSonicSearchClient: ({ apiKey, appId, path, }: {
|
|
3973
|
+
apiKey: string;
|
|
3974
|
+
appId: string;
|
|
3975
|
+
host: string | undefined;
|
|
3976
|
+
path: string;
|
|
3977
|
+
}) => SearchClient;
|
|
3973
3978
|
|
|
3974
3979
|
interface AlgoliaContextType {
|
|
3975
3980
|
online: boolean;
|
|
@@ -3977,7 +3982,7 @@ interface AlgoliaContextType {
|
|
|
3977
3982
|
toggleOnline: VoidFunction;
|
|
3978
3983
|
}
|
|
3979
3984
|
interface AlgoliaProviderProps {
|
|
3980
|
-
categoryPages: string
|
|
3985
|
+
categoryPages: string;
|
|
3981
3986
|
children: ReactNode;
|
|
3982
3987
|
languageCode: string;
|
|
3983
3988
|
offlineSearchClient?: SearchClient;
|
|
@@ -3985,7 +3990,7 @@ interface AlgoliaProviderProps {
|
|
|
3985
3990
|
routing?: boolean | RouterProps<UiState, UiState> | undefined;
|
|
3986
3991
|
searchClient: SearchClient;
|
|
3987
3992
|
}
|
|
3988
|
-
declare function AlgoliaProvider({ categoryPages, children, languageCode, offlineSearchClient, online: _online, routing, searchClient, }: AlgoliaProviderProps): react_jsx_runtime.JSX.Element
|
|
3993
|
+
declare function AlgoliaProvider({ categoryPages, children, languageCode, offlineSearchClient, online: _online, routing, searchClient, }: AlgoliaProviderProps): react_jsx_runtime.JSX.Element;
|
|
3989
3994
|
declare function useAlgolia(): AlgoliaContextType;
|
|
3990
3995
|
|
|
3991
3996
|
declare function AlgoliaResultsCount(): string | null;
|
|
@@ -4145,7 +4150,7 @@ declare function useAlgoliaSearch(): {
|
|
|
4145
4150
|
panelRef: React.RefObject<HTMLDivElement>;
|
|
4146
4151
|
productsIndexName: string;
|
|
4147
4152
|
productsQuerySuggestionsIndexName: string;
|
|
4148
|
-
searchClient:
|
|
4153
|
+
searchClient: algoliasearch.SearchClient;
|
|
4149
4154
|
setState: React.Dispatch<React.SetStateAction<AutocompleteState>>;
|
|
4150
4155
|
state: AutocompleteState;
|
|
4151
4156
|
};
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import clsx from 'clsx';
|
|
|
6
6
|
import { useCurrentRefinements, useClearRefinements, useRefinementList, useHits, useDynamicWidgets, usePagination, InstantSearch, Configure, useSortBy } from 'react-instantsearch';
|
|
7
7
|
import { history } from 'instantsearch.js/es/lib/routers/index.js';
|
|
8
8
|
import { simple } from 'instantsearch.js/es/lib/stateMappings/index.js';
|
|
9
|
+
import algoliasearch from 'algoliasearch';
|
|
9
10
|
import ReactDOM from 'react-dom';
|
|
10
11
|
import { TransitionGroup, Transition } from 'react-transition-group';
|
|
11
12
|
import { createAutocomplete } from '@algolia/autocomplete-core';
|
|
@@ -13,6 +14,55 @@ import { getAlgoliaResults, getAlgoliaFacets, parseAlgoliaHitHighlight } from '@
|
|
|
13
14
|
import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query-suggestions';
|
|
14
15
|
import { createLocalStorageRecentSearchesPlugin, search } from '@algolia/autocomplete-plugin-recent-searches';
|
|
15
16
|
|
|
17
|
+
const sandboxUrls = /local|insitesandbox.com|azurestaticapps|ui.sonic-equipment.com|sandbox/i;
|
|
18
|
+
const productionUrls = /sonic-equipment.com|production/i;
|
|
19
|
+
let environmentUrl;
|
|
20
|
+
if (typeof process !== 'undefined' && process.env.ISC_API_URL) {
|
|
21
|
+
environmentUrl = process.env.ISC_API_URL;
|
|
22
|
+
}
|
|
23
|
+
else if (typeof process !== 'undefined' && process.env.BUILD_INFO) {
|
|
24
|
+
environmentUrl = process.env.BUILD_INFO;
|
|
25
|
+
}
|
|
26
|
+
else if (typeof window !== 'undefined') {
|
|
27
|
+
environmentUrl = window.location.hostname;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
environmentUrl = 'production';
|
|
31
|
+
console.error('Unable to detect environment url');
|
|
32
|
+
}
|
|
33
|
+
let environment;
|
|
34
|
+
if (environmentUrl.match(sandboxUrls)) {
|
|
35
|
+
environment = 'sandbox';
|
|
36
|
+
}
|
|
37
|
+
else if (environmentUrl.match(productionUrls)) {
|
|
38
|
+
environment = 'production';
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// TODO; Do not default to sandbox
|
|
42
|
+
environment = 'production';
|
|
43
|
+
console.error(`Environment not detected for url ${environmentUrl}. Defaulting to production.`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const configPerEnvironment = {
|
|
47
|
+
production: {
|
|
48
|
+
ALGOLIA_API_KEY: '0baffaec3208d8afa13b2bad049fd2d4',
|
|
49
|
+
ALGOLIA_APP_ID: '14CUFCVMAD',
|
|
50
|
+
ALGOLIA_HOST: 'bff.shop.sonic-equipment.com',
|
|
51
|
+
BFF_API_URL: 'https://bff.shop.sonic-equipment.com',
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
53
|
+
SHOP_API_URL: '',
|
|
54
|
+
},
|
|
55
|
+
sandbox: {
|
|
56
|
+
ALGOLIA_API_KEY: 'f3c57c730433f5cf7825b62545eccb05',
|
|
57
|
+
ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
|
|
58
|
+
ALGOLIA_HOST: 'test-bff.shop.sonic-equipment.com',
|
|
59
|
+
BFF_API_URL: 'https://test-bff.shop.sonic-equipment.com',
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
61
|
+
SHOP_API_URL: '',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
const config = configPerEnvironment[environment];
|
|
65
|
+
|
|
16
66
|
class ResponseError extends Error {
|
|
17
67
|
constructor(response, message) {
|
|
18
68
|
super(response.statusText);
|
|
@@ -65,18 +115,18 @@ class FetchProductListingPageDataError extends ResponseError {
|
|
|
65
115
|
this.name = 'FetchProductListingPageDataError';
|
|
66
116
|
}
|
|
67
117
|
}
|
|
68
|
-
function useFetchProductListingPageData(
|
|
118
|
+
function useFetchProductListingPageData({ languageCode, pageUrl, }) {
|
|
69
119
|
return useQuery({
|
|
70
120
|
gcTime: 1000 * 60 * 60 * 24,
|
|
71
121
|
queryFn: async () => {
|
|
72
|
-
const res = await fetch(`${
|
|
122
|
+
const res = await fetch(`${config.BFF_API_URL}/api/v1/plp/?pageUrl=${pageUrl}`, {
|
|
73
123
|
headers: { 'Current-Language-Id': languageCode },
|
|
74
124
|
});
|
|
75
125
|
if (!res.ok)
|
|
76
126
|
throw new FetchProductListingPageDataError(res);
|
|
77
127
|
return (await res.json());
|
|
78
128
|
},
|
|
79
|
-
queryKey: [
|
|
129
|
+
queryKey: ['product-listing-page-data', pageUrl, languageCode],
|
|
80
130
|
retry: false,
|
|
81
131
|
select: (data) => {
|
|
82
132
|
return {
|
|
@@ -151,11 +201,6 @@ var BadgeStyleValues;
|
|
|
151
201
|
BadgeStyleValues["Round"] = "Round";
|
|
152
202
|
})(BadgeStyleValues || (BadgeStyleValues = {}));
|
|
153
203
|
|
|
154
|
-
const config = {
|
|
155
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
156
|
-
SHOP_API_URL: '',
|
|
157
|
-
};
|
|
158
|
-
|
|
159
204
|
class AddProductToCurrentCartError extends ResponseError {
|
|
160
205
|
constructor(response, message) {
|
|
161
206
|
super(response, message);
|
|
@@ -471,7 +516,10 @@ function useGlobalState(key, initialState) {
|
|
|
471
516
|
state.removeEventListener('stateChanged', setRerenderState);
|
|
472
517
|
};
|
|
473
518
|
}, [state]);
|
|
474
|
-
return [
|
|
519
|
+
return [
|
|
520
|
+
rerenderState,
|
|
521
|
+
useCallback((value) => (state.value = value), [state]),
|
|
522
|
+
];
|
|
475
523
|
}
|
|
476
524
|
|
|
477
525
|
function CartProvider(props) {
|
|
@@ -944,8 +992,8 @@ function Image({ alt, className, fallbackSrc = 'https://res.cloudinary.com/dkz9e
|
|
|
944
992
|
|
|
945
993
|
var styles$s = {"product-card":"product-card-module-pLaiB","favorite-button":"product-card-module-tvEdz","content":"product-card-module-e0kMu","top":"product-card-module-Q0VvF","tag":"product-card-module-HkWBE","title":"product-card-module-CStNi","bottom":"product-card-module-kD2tU","image":"product-card-module-p-zoi","price":"product-card-module-irW0D","add-to-cart-button":"product-card-module-SnCvX"};
|
|
946
994
|
|
|
947
|
-
function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image, price, sku, tags, title, }) {
|
|
948
|
-
return (jsxs(RouteLink, { className: styles$s['product-card'], href: href, children: [jsx("div", { className: styles$s.image, children: jsx(Image, { ...image }) }), jsx("div", { className: styles$s['favorite-button'], children: FavoriteButton && FavoriteButton }), jsxs("div", { className: styles$s.content, children: [jsxs("div", { className: styles$s.top, children: [jsx("div", { className: styles$s.tag, children: tags?.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { optional: true, fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) }), jsx("h2", { className: styles$s.title, children: title }), jsx(ProductSku, { sku: sku })] }), jsxs("div", { className: styles$s.bottom, children: [jsx("div", { className: styles$s.price, children: jsx(ProductPrice, { isVatIncluded: price.isVatIncluded, originalPrice: price.originalPrice, price: price.price }) }), jsx("div", { className: styles$s['add-to-cart-button'], children: AddToCartButton })] })] })] }));
|
|
995
|
+
function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image, onPress, price, sku, tags, title, }) {
|
|
996
|
+
return (jsxs(RouteLink, { className: styles$s['product-card'], href: href, onPress: onPress, children: [jsx("div", { className: styles$s.image, children: jsx(Image, { ...image }) }), jsx("div", { className: styles$s['favorite-button'], children: FavoriteButton && FavoriteButton }), jsxs("div", { className: styles$s.content, children: [jsxs("div", { className: styles$s.top, children: [jsx("div", { className: styles$s.tag, children: tags?.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { optional: true, fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) }), jsx("h2", { className: styles$s.title, children: title }), jsx(ProductSku, { sku: sku })] }), jsxs("div", { className: styles$s.bottom, children: [jsx("div", { className: styles$s.price, children: jsx(ProductPrice, { isVatIncluded: price.isVatIncluded, originalPrice: price.originalPrice, price: price.price }) }), jsx("div", { className: styles$s['add-to-cart-button'], children: AddToCartButton })] })] })] }));
|
|
949
997
|
}
|
|
950
998
|
|
|
951
999
|
/**
|
|
@@ -1797,7 +1845,7 @@ function Observer(_ref) {
|
|
|
1797
1845
|
});
|
|
1798
1846
|
observer.observe(target, {
|
|
1799
1847
|
attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
|
|
1800
|
-
childList: typeof options.childList === 'undefined' ? true : options.childList,
|
|
1848
|
+
childList: swiper.isElement || (typeof options.childList === 'undefined' ? true : options).childList,
|
|
1801
1849
|
characterData: typeof options.characterData === 'undefined' ? true : options.characterData
|
|
1802
1850
|
});
|
|
1803
1851
|
observers.push(observer);
|
|
@@ -5851,7 +5899,7 @@ const updateOnVirtualData = swiper => {
|
|
|
5851
5899
|
};
|
|
5852
5900
|
|
|
5853
5901
|
/**
|
|
5854
|
-
* Swiper React 11.1.
|
|
5902
|
+
* Swiper React 11.1.5
|
|
5855
5903
|
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
|
5856
5904
|
* https://swiperjs.com
|
|
5857
5905
|
*
|
|
@@ -5859,7 +5907,7 @@ const updateOnVirtualData = swiper => {
|
|
|
5859
5907
|
*
|
|
5860
5908
|
* Released under the MIT License
|
|
5861
5909
|
*
|
|
5862
|
-
* Released on:
|
|
5910
|
+
* Released on: July 15, 2024
|
|
5863
5911
|
*/
|
|
5864
5912
|
|
|
5865
5913
|
|
|
@@ -6438,10 +6486,10 @@ function ProductOverviewGrid({ children }) {
|
|
|
6438
6486
|
return (jsx("div", { className: styles$j['product-grid'], children: Children.map(children, (child, index) => (jsx("div", { className: styles$j['grid-item'], children: child }, index))) }));
|
|
6439
6487
|
}
|
|
6440
6488
|
|
|
6441
|
-
var styles$i = {"progress-circle":"progress-circle-module-4nweP","
|
|
6489
|
+
var styles$i = {"progress-circle":"progress-circle-module-4nweP","spin":"progress-circle-module-kCf7K"};
|
|
6442
6490
|
|
|
6443
6491
|
function ProgressCircle({ className }) {
|
|
6444
|
-
return
|
|
6492
|
+
return (jsxs("svg", { className: clsx(styles$i['progress-circle'], className), viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", children: [jsx("title", { children: "Spinner" }), jsxs("defs", { children: [jsx("pattern", { height: "100%", id: "pattern-1", patternUnits: "objectBoundingBox", width: "100%", children: jsx("use", { xlinkHref: "#image-2" }) }), jsx("image", { height: "24", id: "image-2", width: "24", xlinkHref: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAGKADAAQAAAABAAAAGAAAAADiNXWtAAAB7UlEQVRIDZ2VSaoCQQyG01rOoBtBr+YZXXsFL+BGEHcqDuCE89SPL480hdpiGYil3an/S1KDUavViq/Xq1wul8RPp5Ocz2dhPB6PiR8OB42RAHO5XE7D4zgW/PF4CM/u97tks1n1TCYjURSpB2hraALglw8BQGXOuQQSKk68y+fzL9lRBQAqAUIlVkUoxBUKBZ3sC1irbrdbUoX/PgTyAqDXmFVBBVRCFfYuGMBk67UvRCUA2FFAfgKUSiWhFTgQA9ESjLVgC7NWwEPNFYtFFUEICJnigAxCFbvd7jcAFVi/gbDoCALmOzCMAzebzUILEFculxVgOwcIDqRSqaiTBDadToMhziYDwBgNRmW0rdFoSLPZ1PeDwUDHbz+iTqejyv5VYHuekbVggavVqkLq9fq32hqnLTJxdgmijPQeYSqs1Woa3G63g8QJ1haZKMJkjDgLjLi/Nbvd7m8ARCxry9x2jyn2ej2ZTCb28+tRK/Azpy3vrN/vy2azeffq4zM9aLTFP1jPM4bDoWbPH06o6WXn9/lZgDMxGo1kuVwG/5uhlfkkTsB4PJb5fC7b7VYPH89C7P9GS5nBLYr4er2W/X6vhy4lNPXxR8BisdDWkD13Ee0KtVQAgqvVSncO2XNlc3WEWirAxLmmgf0K+ANZ6DTlvO5jwwAAAABJRU5ErkJggg==" })] }), jsx("g", { fill: "none", fillRule: "evenodd", id: "Page-1", stroke: "none", strokeWidth: "1", children: jsx("path", { d: "M12,0 C18.627417,0 24,5.372583 24,12 C24,14.7277828 23.0855773,17.3196292 21.4324752,19.4188392 C19.1717866,22.2895997 15.7255176,24 12,24 C11.2636203,24 10.6666667,23.4030463 10.6666667,22.6666667 C10.6666667,21.930287 11.2636203,21.3333333 12,21.3333333 C14.8994206,21.3333333 17.5771113,20.0043823 19.3374325,17.7690188 C20.6234737,16.1359252 21.3333333,14.1238938 21.3333333,12 C21.3333333,6.84534234 17.1546577,2.66666667 12,2.66666667 C6.84534234,2.66666667 2.66666667,6.84534234 2.66666667,12 C2.66666667,14.4546154 3.61656005,16.756214 5.28844833,18.485859 C5.80023235,19.015323 5.78589988,19.8594213 5.25643588,20.3712053 C4.72697187,20.8829893 3.88287357,20.8686569 3.37108955,20.3391928 C1.22326178,18.1171666 0,15.1531945 0,12 C0,5.372583 5.372583,0 12,0 Z", fill: "url(#pattern-1)", fillRule: "nonzero", id: "Spinner" }) })] }));
|
|
6445
6493
|
}
|
|
6446
6494
|
|
|
6447
6495
|
var styles$h = {"loading-overlay":"loading-overlay-module-L67Gy"};
|
|
@@ -6501,9 +6549,7 @@ function AlgoliaActiveFilters() {
|
|
|
6501
6549
|
const selectedFilterCategories = items
|
|
6502
6550
|
.sort((a, b) => (a.label.localeCompare(b.label) ? 1 : -1))
|
|
6503
6551
|
.map((category) => ({
|
|
6504
|
-
filters: category.refinements
|
|
6505
|
-
// TODO: Investigate how to sort numerical
|
|
6506
|
-
a.value.toString().localeCompare(b.value.toString()) ? 1 : -1),
|
|
6552
|
+
filters: category.refinements,
|
|
6507
6553
|
label: category.label,
|
|
6508
6554
|
}));
|
|
6509
6555
|
function onClearFilter(categoryLabel, filter) {
|
|
@@ -6587,31 +6633,6 @@ function AlgoliaPagination({ onChange }) {
|
|
|
6587
6633
|
return (jsx(Pagination, { currentPage: currentRefinement + 1, onChange: pageNumber => handlePageChange(pageNumber), totalPages: nbPages }));
|
|
6588
6634
|
}
|
|
6589
6635
|
|
|
6590
|
-
const sandboxUrls = /local|insitesandbox.com|azurestaticapps|ui.sonic-equipment.com/i;
|
|
6591
|
-
const productionUrls = /sonic-equipment.com/i;
|
|
6592
|
-
let environmentUrl;
|
|
6593
|
-
if (typeof process !== 'undefined' && process.env.ISC_API_URL) {
|
|
6594
|
-
environmentUrl = process.env.ISC_API_URL;
|
|
6595
|
-
}
|
|
6596
|
-
else if (typeof window !== 'undefined') {
|
|
6597
|
-
environmentUrl = window.location.hostname;
|
|
6598
|
-
}
|
|
6599
|
-
else {
|
|
6600
|
-
throw new Error('Unable to detect environment url');
|
|
6601
|
-
}
|
|
6602
|
-
let environment;
|
|
6603
|
-
if (environmentUrl.match(sandboxUrls)) {
|
|
6604
|
-
environment = 'sandbox';
|
|
6605
|
-
}
|
|
6606
|
-
else if (environmentUrl.match(productionUrls)) {
|
|
6607
|
-
environment = 'production';
|
|
6608
|
-
}
|
|
6609
|
-
else {
|
|
6610
|
-
// TODO; Do not default to sandbox
|
|
6611
|
-
environment = 'sandbox';
|
|
6612
|
-
console.error(`Environment not detected for url ${environmentUrl}. Defaulting to sandbox.`);
|
|
6613
|
-
}
|
|
6614
|
-
|
|
6615
6636
|
const algoliaIndexesPerEnvironment = {
|
|
6616
6637
|
production: {
|
|
6617
6638
|
default: 'prod_sonic_products_<languageCode>',
|
|
@@ -6633,6 +6654,7 @@ const algoliaIndexesPerEnvironment = {
|
|
|
6633
6654
|
name: 'price_desc',
|
|
6634
6655
|
},
|
|
6635
6656
|
],
|
|
6657
|
+
suggestions: 'prod_sonic_products_<languageCode>_query_suggestions',
|
|
6636
6658
|
},
|
|
6637
6659
|
sandbox: {
|
|
6638
6660
|
default: 'dev_sonic_products_<languageCode>',
|
|
@@ -6654,6 +6676,7 @@ const algoliaIndexesPerEnvironment = {
|
|
|
6654
6676
|
name: 'price_desc',
|
|
6655
6677
|
},
|
|
6656
6678
|
],
|
|
6679
|
+
suggestions: 'dev_sonic_products_<languageCode>_query_suggestions',
|
|
6657
6680
|
},
|
|
6658
6681
|
};
|
|
6659
6682
|
const getAlgoliaIndex = (environment, languageCode) => {
|
|
@@ -6669,6 +6692,7 @@ const getAlgoliaIndex = (environment, languageCode) => {
|
|
|
6669
6692
|
index: index.replace(/<languageCode>/, shortLanguageCode),
|
|
6670
6693
|
name,
|
|
6671
6694
|
})),
|
|
6695
|
+
suggestions: environmentIndex.suggestions.replace(/<languageCode>/, shortLanguageCode),
|
|
6672
6696
|
};
|
|
6673
6697
|
};
|
|
6674
6698
|
|
|
@@ -6735,10 +6759,6 @@ const AlgoliaContext = createContext({
|
|
|
6735
6759
|
function AlgoliaProvider({ categoryPages, children, languageCode, offlineSearchClient, online: _online = true, routing, searchClient, }) {
|
|
6736
6760
|
const [online, setOnline] = useState(_online);
|
|
6737
6761
|
const algoliaIndex = getAlgoliaIndex(environment, languageCode);
|
|
6738
|
-
if (!categoryPages) {
|
|
6739
|
-
// TODO: Implement loading page
|
|
6740
|
-
return null;
|
|
6741
|
-
}
|
|
6742
6762
|
return (jsx(AlgoliaContext.Provider, { value: {
|
|
6743
6763
|
online,
|
|
6744
6764
|
setOnline,
|
|
@@ -6761,15 +6781,38 @@ const offlineSearchClient = {
|
|
|
6761
6781
|
},
|
|
6762
6782
|
};
|
|
6763
6783
|
|
|
6764
|
-
const createSonicSearchClient = (
|
|
6765
|
-
|
|
6766
|
-
|
|
6784
|
+
const createSonicSearchClient = ({ apiKey, appId, path, }) => {
|
|
6785
|
+
const searchClient = algoliasearch(appId, apiKey);
|
|
6786
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6787
|
+
// @ts-ignore
|
|
6788
|
+
searchClient.search = (requests) => {
|
|
6789
|
+
return fetch(`${config.BFF_API_URL}${path}`, {
|
|
6767
6790
|
body: JSON.stringify({ requests }),
|
|
6768
6791
|
headers: { 'Content-Type': 'application/json' },
|
|
6769
6792
|
method: 'post',
|
|
6770
6793
|
}).then(res => res.json());
|
|
6771
|
-
}
|
|
6772
|
-
|
|
6794
|
+
};
|
|
6795
|
+
return searchClient;
|
|
6796
|
+
};
|
|
6797
|
+
// export const createSonicSearchClient = ({
|
|
6798
|
+
// apiKey,
|
|
6799
|
+
// appId,
|
|
6800
|
+
// host,
|
|
6801
|
+
// }: {
|
|
6802
|
+
// apiKey: string
|
|
6803
|
+
// appId: string
|
|
6804
|
+
// host: string | undefined
|
|
6805
|
+
// path: string
|
|
6806
|
+
// }) => {
|
|
6807
|
+
// const searchClient = algoliasearch(appId, apiKey, {
|
|
6808
|
+
// headers: { 'Content-Type': 'appliction/json' },
|
|
6809
|
+
// })
|
|
6810
|
+
// if (host)
|
|
6811
|
+
// searchClient.transporter.hosts = [
|
|
6812
|
+
// { accept: 1, protocol: 'https', url: host },
|
|
6813
|
+
// ]
|
|
6814
|
+
// return searchClient
|
|
6815
|
+
// }
|
|
6773
6816
|
|
|
6774
6817
|
function useLanguageCode() {
|
|
6775
6818
|
const { languageCode } = useContext(IntlContext);
|
|
@@ -6875,9 +6918,19 @@ const ToggleSidebarButton = () => {
|
|
|
6875
6918
|
|
|
6876
6919
|
var styles$8 = {"product-listing":"product-listing-page-module-dmIHF","header":"product-listing-page-module-Oz76Z","action-bar":"product-listing-page-module-XxGrr","sidebar-toggle":"product-listing-page-module-F7bxy","sort":"product-listing-page-module-aQzHr","count":"product-listing-page-module-zx79v","categories":"product-listing-page-module-R4aOl","product-grid-container":"product-listing-page-module-ICkKg","product-grid":"product-listing-page-module-LHE7z","pagination":"product-listing-page-module-xsRaj"};
|
|
6877
6920
|
|
|
6878
|
-
function ProductListingPage({
|
|
6921
|
+
function ProductListingPage({ pageUrl, searchClient: _searchClient, }) {
|
|
6879
6922
|
const languageCode = useLanguageCode();
|
|
6880
|
-
const { data, error, isError, isFetching } = useFetchProductListingPageData(
|
|
6923
|
+
const { data, error, isError, isFetching } = useFetchProductListingPageData({
|
|
6924
|
+
languageCode,
|
|
6925
|
+
pageUrl,
|
|
6926
|
+
});
|
|
6927
|
+
const searchClient = useMemo(() => _searchClient ||
|
|
6928
|
+
createSonicSearchClient({
|
|
6929
|
+
apiKey: config.ALGOLIA_API_KEY,
|
|
6930
|
+
appId: config.ALGOLIA_APP_ID,
|
|
6931
|
+
host: config.ALGOLIA_HOST,
|
|
6932
|
+
path: '/search',
|
|
6933
|
+
}), [_searchClient]);
|
|
6881
6934
|
if (isError) {
|
|
6882
6935
|
if (!isResponseError(error))
|
|
6883
6936
|
throw error;
|
|
@@ -6888,15 +6941,14 @@ function ProductListingPage({ bffUrl, pageUrl, searchClient, }) {
|
|
|
6888
6941
|
return jsx(LoadingOverlay, {});
|
|
6889
6942
|
}
|
|
6890
6943
|
const category = data.breadCrumb.slice(1).map(breadCrumb => breadCrumb.label);
|
|
6891
|
-
return (jsx(ProductListingPageProvider, { data: data, error: error, isError: isError, isLoading: isFetching, children: jsx(AlgoliaProvider, { categoryPages: data.categoryPages, languageCode: languageCode, offlineSearchClient: offlineSearchClient, searchClient: searchClient
|
|
6892
|
-
createSonicSearchClient(`${bffUrl}${bffUrl.endsWith('/') ? '' : '/'}search`), children: jsx(Page, { breadCrumb: data.breadCrumb, className: styles$8['product-listing'], title: category.slice().pop(), children: jsx(ProductListingPageContent, {}) }) }) }));
|
|
6944
|
+
return (jsx(ProductListingPageProvider, { data: data, error: error, isError: isError, isLoading: isFetching, children: jsx(AlgoliaProvider, { categoryPages: data.categoryPages, languageCode: languageCode, offlineSearchClient: offlineSearchClient, searchClient: searchClient, children: jsx(Page, { breadCrumb: data.breadCrumb, className: styles$8['product-listing'], title: category.slice().pop(), children: jsx(ProductListingPageContent, {}) }) }) }));
|
|
6893
6945
|
}
|
|
6894
6946
|
function ProductListingPageContent() {
|
|
6895
6947
|
const { toggle } = useSidebar();
|
|
6896
6948
|
return (jsxs(Fragment, { children: [jsx("section", { className: styles$8.categories, children: jsx(ConnectedCategoryCarousel, {}) }), jsxs("section", { className: styles$8['action-bar'], children: [jsx("div", { className: styles$8['sidebar-toggle'], children: jsx(ToggleSidebarButton, {}) }), jsx("span", { className: styles$8.count, children: jsx(AlgoliaResultsCount, {}) }), jsx("div", { className: styles$8.sort, children: jsx(AlgoliaSortBy, {}) })] }), jsx("section", { children: jsxs("div", { className: styles$8['product-grid-container'], children: [jsx(Sidebar, { children: jsx(AlgoliaFilterPanel, { onShowProducts: toggle }) }), jsxs("div", { className: styles$8['product-grid'], children: [jsx(ProductOverview, {}), jsx("div", { className: styles$8.pagination, children: jsx(AlgoliaPagination, { onChange: () => scrollToTop() }) })] })] }) })] }));
|
|
6897
6949
|
}
|
|
6898
6950
|
function ProductOverview() {
|
|
6899
|
-
const {
|
|
6951
|
+
const { items: productHits } = useHits();
|
|
6900
6952
|
return (jsx(ProductOverviewGrid, { children: productHits.map(productHit => (jsx(ConnectedProductCard, { href: productHit.storefrontSlug, image: {
|
|
6901
6953
|
alt: productHit.name,
|
|
6902
6954
|
fit: 'contain',
|
|
@@ -7188,9 +7240,10 @@ function AlgoliaSearchProvider({ children, searchClient, }) {
|
|
|
7188
7240
|
query: '',
|
|
7189
7241
|
status: 'idle',
|
|
7190
7242
|
});
|
|
7191
|
-
|
|
7192
|
-
const
|
|
7193
|
-
const
|
|
7243
|
+
const languageCode = useLanguageCode();
|
|
7244
|
+
const index = getAlgoliaIndex(environment, languageCode);
|
|
7245
|
+
const productsIndexName = index.default;
|
|
7246
|
+
const productsQuerySuggestionsIndexName = index.suggestions;
|
|
7194
7247
|
/**
|
|
7195
7248
|
* https://www.algolia.com/doc/ui-libraries/autocomplete/guides/creating-a-renderer/#mirror-a-native-mobile-experience
|
|
7196
7249
|
*/
|
|
@@ -7299,7 +7352,8 @@ var styles$5 = {"global-search-overlay-background-position":"global-search-modul
|
|
|
7299
7352
|
const GlobalSearchDisclosureContext = createContext(null);
|
|
7300
7353
|
function GlobalSearchContainer({ children, }) {
|
|
7301
7354
|
const { close, isOpen, open, toggle } = useDisclosure(false);
|
|
7302
|
-
|
|
7355
|
+
const panelRef = useRef(null);
|
|
7356
|
+
return (jsx(TransitionGroup, { children: jsxs(GlobalSearchDisclosureContext.Provider, { value: { close, isOpen, open, toggle }, children: [jsx(Transition, { in: isOpen, nodeRef: panelRef, timeout: 300, children: state => (jsx("div", { ref: panelRef, className: state, children: children })) }), jsx(OverlayBackground, { className: styles$5['global-search-overlay-background-position'], isOpen: isOpen, onClick: toggle })] }) }));
|
|
7303
7357
|
}
|
|
7304
7358
|
|
|
7305
7359
|
const useGlobalSearchDisclosure = () => {
|
|
@@ -7437,6 +7491,7 @@ function SuggestionsSection() {
|
|
|
7437
7491
|
}), children: [jsx("div", { children: item.listCategories[item.listCategories.length - 1] }), jsx("div", { style: { fontSize: '14px' }, children: item.listCategories.slice(0, -1).join(' > ') })] }, item.objectID))) }))] })] }));
|
|
7438
7492
|
}
|
|
7439
7493
|
function ProductResultsSection() {
|
|
7494
|
+
const { close } = useGlobalSearchDisclosure();
|
|
7440
7495
|
const { autocomplete, products: collection } = useAlgoliaSearch();
|
|
7441
7496
|
if (!collection)
|
|
7442
7497
|
return null;
|
|
@@ -7447,11 +7502,11 @@ function ProductResultsSection() {
|
|
|
7447
7502
|
src: product.images?.find(image => image.quality === 'medium')
|
|
7448
7503
|
?.url || '',
|
|
7449
7504
|
title: product.name,
|
|
7450
|
-
}, price: {
|
|
7505
|
+
}, onPress: () => close(), price: {
|
|
7451
7506
|
isVatIncluded: product.isVatIncluded,
|
|
7452
7507
|
originalPrice: product.originalPrice,
|
|
7453
7508
|
price: product.price,
|
|
7454
|
-
}, productId:
|
|
7509
|
+
}, productId: product.storefrontId, sku: product.id, tags: product.labels, title: product.name }, product.id))) }) })] }));
|
|
7455
7510
|
}
|
|
7456
7511
|
|
|
7457
7512
|
function PanelContent() {
|
|
@@ -7483,7 +7538,7 @@ function SearchRoot() {
|
|
|
7483
7538
|
inputRef.current.blur();
|
|
7484
7539
|
}
|
|
7485
7540
|
}, [inputRef, isOpen]);
|
|
7486
|
-
return (jsx(Fragment, { children: jsx(Transition, { in: isOpen, timeout: 300, children: transitionState => (jsxs("div", { className: clsx(styles['search-container'], styles[transitionState]), ...autocomplete.getRootProps({}), children: [jsx("div", { className: styles.input, children: jsx(ConnectedSearchInput, {}) }), jsx("div", { className: styles.panel, children: jsx(SearchResultPanel, {}) })] })) }) }));
|
|
7541
|
+
return (jsx(Fragment, { children: jsx(Transition, { in: isOpen, nodeRef: inputRef, timeout: 300, children: transitionState => (jsxs("div", { className: clsx(styles['search-container'], styles[transitionState]), ...autocomplete.getRootProps({}), children: [jsx("div", { className: styles.input, children: jsx(ConnectedSearchInput, {}) }), jsx("div", { className: styles.panel, children: jsx(SearchResultPanel, {}) })] })) }) }));
|
|
7487
7542
|
}
|
|
7488
7543
|
|
|
7489
7544
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SearchClient } from 'algoliasearch
|
|
1
|
+
import { SearchClient } from 'algoliasearch';
|
|
2
2
|
export interface Filters {
|
|
3
3
|
color: {
|
|
4
4
|
options: {
|
|
@@ -9,8 +9,7 @@ export interface Filters {
|
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
export interface ProductListingPageProps {
|
|
12
|
-
bffUrl: string;
|
|
13
12
|
pageUrl: string;
|
|
14
13
|
searchClient?: SearchClient;
|
|
15
14
|
}
|
|
16
|
-
export declare function ProductListingPage({
|
|
15
|
+
export declare function ProductListingPage({ pageUrl, searchClient: _searchClient, }: ProductListingPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,4 +7,4 @@ export interface FetchProductListingPageDataArgs {
|
|
|
7
7
|
export declare class FetchProductListingPageDataError extends ResponseError {
|
|
8
8
|
constructor(response: Response, message?: string);
|
|
9
9
|
}
|
|
10
|
-
export declare function useFetchProductListingPageData(
|
|
10
|
+
export declare function useFetchProductListingPageData({ languageCode, pageUrl, }: FetchProductListingPageDataArgs): import("@tanstack/react-query").UseQueryResult<ProductListingPageData, Error>;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react';
|
|
2
2
|
interface StoryProps {
|
|
3
|
-
bffUrl: string;
|
|
4
3
|
languageCode: string;
|
|
5
4
|
pageUrl: string;
|
|
6
5
|
}
|
|
7
|
-
declare function UseFetchProductListingPageDataStory({
|
|
6
|
+
declare function UseFetchProductListingPageDataStory({ languageCode, pageUrl, }: StoryProps): import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
declare const meta: {
|
|
9
8
|
args: {
|
|
10
|
-
bffUrl: string;
|
|
11
9
|
languageCode: string;
|
|
12
10
|
pageUrl: string;
|
|
13
11
|
};
|
package/dist/styles.css
CHANGED
|
@@ -916,6 +916,7 @@
|
|
|
916
916
|
-webkit-line-clamp: 4;
|
|
917
917
|
line-height: 1;
|
|
918
918
|
text-wrap: balance;
|
|
919
|
+
word-break: break-word;
|
|
919
920
|
}
|
|
920
921
|
|
|
921
922
|
.product-card-module-pLaiB .product-card-module-kD2tU {
|
|
@@ -990,7 +991,7 @@
|
|
|
990
991
|
}
|
|
991
992
|
|
|
992
993
|
/**
|
|
993
|
-
* Swiper 11.1.
|
|
994
|
+
* Swiper 11.1.5
|
|
994
995
|
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
|
995
996
|
* https://swiperjs.com
|
|
996
997
|
*
|
|
@@ -998,7 +999,7 @@
|
|
|
998
999
|
*
|
|
999
1000
|
* Released under the MIT License
|
|
1000
1001
|
*
|
|
1001
|
-
* Released on:
|
|
1002
|
+
* Released on: July 15, 2024
|
|
1002
1003
|
*/
|
|
1003
1004
|
|
|
1004
1005
|
/* FONT_START */
|
|
@@ -1918,16 +1919,12 @@
|
|
|
1918
1919
|
|
|
1919
1920
|
width: var(--width);
|
|
1920
1921
|
height: var(--width);
|
|
1921
|
-
|
|
1922
|
-
animation: progress-circle-module-jPY-W 0.6s infinite linear;
|
|
1923
|
-
background: conic-gradient(#0000 10%, #000);
|
|
1924
|
-
-webkit-mask: radial-gradient(farthest-side, #0000 9px, #000 0);
|
|
1925
|
-
mask: radial-gradient(farthest-side, #0000 9px, #000 0);
|
|
1922
|
+
animation: progress-circle-module-kCf7K 0.6s infinite linear;
|
|
1926
1923
|
}
|
|
1927
1924
|
|
|
1928
|
-
@keyframes progress-circle-module-
|
|
1925
|
+
@keyframes progress-circle-module-kCf7K {
|
|
1929
1926
|
to {
|
|
1930
|
-
transform: rotate(
|
|
1927
|
+
transform: rotate(360deg);
|
|
1931
1928
|
}
|
|
1932
1929
|
}
|
|
1933
1930
|
|
|
@@ -2401,6 +2398,7 @@
|
|
|
2401
2398
|
|
|
2402
2399
|
.overlay-background-module-j7R7T {
|
|
2403
2400
|
position: fixed;
|
|
2401
|
+
z-index: calc(var(--sidebar-layer) - 1);
|
|
2404
2402
|
-webkit-backdrop-filter: blur(4px);
|
|
2405
2403
|
backdrop-filter: blur(4px);
|
|
2406
2404
|
background-color: rgb(0 0 0 / 52%);
|