@fast-simon/shopify-hydrogen 1.0.4 → 1.0.6
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/README.md +186 -179
- package/dist/esnext/@types/Tab.d.ts +9 -9
- package/dist/esnext/@types/Tab.js +5 -5
- package/dist/esnext/@types/appServerProps.d.ts +12 -12
- package/dist/esnext/@types/appServerProps.js +1 -1
- package/dist/esnext/@types/articles.d.ts +12 -12
- package/dist/esnext/@types/articles.js +1 -1
- package/dist/esnext/@types/categories.d.ts +10 -10
- package/dist/esnext/@types/categories.js +1 -1
- package/dist/esnext/@types/currency.d.ts +1 -1
- package/dist/esnext/@types/currency.js +1 -1
- package/dist/esnext/@types/device.d.ts +1 -1
- package/dist/esnext/@types/device.js +1 -1
- package/dist/esnext/@types/editor.d.ts +418 -416
- package/dist/esnext/@types/editor.js +6 -6
- package/dist/esnext/@types/facets.d.ts +37 -37
- package/dist/esnext/@types/facets.js +16 -16
- package/dist/esnext/@types/ispOptions.d.ts +6 -6
- package/dist/esnext/@types/ispOptions.js +1 -1
- package/dist/esnext/@types/narrow.d.ts +7 -7
- package/dist/esnext/@types/narrow.js +1 -1
- package/dist/esnext/@types/product.d.ts +134 -134
- package/dist/esnext/@types/product.js +7 -7
- package/dist/esnext/@types/promoTile.d.ts +11 -11
- package/dist/esnext/@types/promoTile.js +1 -1
- package/dist/esnext/@types/results.d.ts +38 -36
- package/dist/esnext/@types/results.js +1 -1
- package/dist/esnext/@types/routing.d.ts +11 -11
- package/dist/esnext/@types/routing.js +1 -1
- package/dist/esnext/@types/siteSetup.d.ts +52 -52
- package/dist/esnext/@types/siteSetup.js +1 -1
- package/dist/esnext/@types/siteStatus.d.ts +5 -5
- package/dist/esnext/@types/siteStatus.js +1 -1
- package/dist/esnext/@types/sortBy.d.ts +12 -12
- package/dist/esnext/@types/sortBy.js +1 -1
- package/dist/esnext/@types/translations.d.ts +12 -12
- package/dist/esnext/@types/translations.js +6 -6
- package/dist/esnext/components/FastSimonApp.server.d.ts +9 -9
- package/dist/esnext/components/FastSimonApp.server.js +45 -45
- package/dist/esnext/components/FastSimonProvider.server.d.ts +10 -10
- package/dist/esnext/components/FastSimonProvider.server.js +9 -9
- package/dist/esnext/components/Filters/DesktopFilters/DesktopFilters.server.d.ts +8 -8
- package/dist/esnext/components/Filters/DesktopFilters/DesktopFilters.server.js +5 -5
- package/dist/esnext/components/Filters/FacetOption.client.d.ts +9 -9
- package/dist/esnext/components/Filters/FacetOption.client.js +39 -39
- package/dist/esnext/components/Filters/Filters.server.d.ts +12 -12
- package/dist/esnext/components/Filters/Filters.server.js +11 -11
- package/dist/esnext/components/Filters/FiltersList.server.d.ts +8 -8
- package/dist/esnext/components/Filters/FiltersList.server.js +11 -11
- package/dist/esnext/components/Filters/FiltersSkeleton.d.ts +3 -3
- package/dist/esnext/components/Filters/FiltersSkeleton.js +32 -32
- package/dist/esnext/components/Filters/MobileFilters/MobileFilters.client.d.ts +6 -6
- package/dist/esnext/components/Filters/MobileFilters/MobileFilters.client.js +20 -20
- package/dist/esnext/components/Filters/RemovableTags/RemovableTag.client.d.ts +8 -8
- package/dist/esnext/components/Filters/RemovableTags/RemovableTag.client.js +11 -11
- package/dist/esnext/components/Filters/RemovableTags/RemovableTags.client.d.ts +8 -8
- package/dist/esnext/components/Filters/RemovableTags/RemovableTags.client.js +51 -51
- package/dist/esnext/components/PageTitle/PageTitle.server.d.ts +7 -7
- package/dist/esnext/components/PageTitle/PageTitle.server.js +4 -4
- package/dist/esnext/components/Pagination/Pagination.client.d.ts +9 -9
- package/dist/esnext/components/Pagination/Pagination.client.js +43 -43
- package/dist/esnext/components/Pagination/utils.d.ts +1 -1
- package/dist/esnext/components/Pagination/utils.js +4 -4
- package/dist/esnext/components/ProductCard/ProductCard.d.ts +10 -10
- package/dist/esnext/components/ProductCard/ProductCard.js +31 -31
- package/dist/esnext/components/ProductCard/components/AddToCart/AddToCart.client.d.ts +10 -10
- package/dist/esnext/components/ProductCard/components/AddToCart/AddToCart.client.js +23 -23
- package/dist/esnext/components/ProductCard/components/Compare/Compare.d.ts +6 -6
- package/dist/esnext/components/ProductCard/components/Compare/Compare.js +6 -6
- package/dist/esnext/components/ProductCard/components/Info/ProductInfo.d.ts +9 -9
- package/dist/esnext/components/ProductCard/components/Info/ProductInfo.js +11 -11
- package/dist/esnext/components/ProductCard/components/Price/Price.d.ts +7 -7
- package/dist/esnext/components/ProductCard/components/Price/Price.js +6 -6
- package/dist/esnext/components/ProductCard/components/ProductImage/ProductImage.d.ts +8 -8
- package/dist/esnext/components/ProductCard/components/ProductImage/ProductImage.js +7 -7
- package/dist/esnext/components/ProductCard/components/Title/Title.d.ts +7 -7
- package/dist/esnext/components/ProductCard/components/Title/Title.js +4 -4
- package/dist/esnext/components/ProductGrid/ProductGrid.server.d.ts +10 -10
- package/dist/esnext/components/ProductGrid/ProductGrid.server.js +10 -10
- package/dist/esnext/components/ProductGrid/stylesUtil.d.ts +138 -138
- package/dist/esnext/components/ProductGrid/stylesUtil.js +122 -122
- package/dist/esnext/components/ResultsSummary/ResultsSummary.server.d.ts +7 -7
- package/dist/esnext/components/ResultsSummary/ResultsSummary.server.js +8 -8
- package/dist/esnext/components/SortBy/SortBy.client.d.ts +10 -10
- package/dist/esnext/components/SortBy/SortBy.client.js +8 -8
- package/dist/esnext/components/SortBy/components/DesktopSortBy.client.d.ts +8 -8
- package/dist/esnext/components/SortBy/components/DesktopSortBy.client.js +30 -30
- package/dist/esnext/components/SortBy/utils.d.ts +8 -8
- package/dist/esnext/components/SortBy/utils.js +28 -28
- package/dist/esnext/components/index.d.ts +2 -2
- package/dist/esnext/components/index.js +2 -2
- package/dist/esnext/context/setRoutingContext.d.ts +2 -2
- package/dist/esnext/context/setRoutingContext.js +14 -14
- package/dist/esnext/context/setSiteContext.d.ts +6 -6
- package/dist/esnext/context/setSiteContext.js +18 -18
- package/dist/esnext/hooks/ResizeDetect.client.d.ts +2 -2
- package/dist/esnext/hooks/ResizeDetect.client.js +6 -6
- package/dist/esnext/hooks/useClickOutside.d.ts +1 -1
- package/dist/esnext/hooks/useClickOutside.js +12 -12
- package/dist/esnext/hooks/useScreenSize.d.ts +1 -1
- package/dist/esnext/hooks/useScreenSize.js +19 -19
- package/dist/esnext/icons/DownArrowIcon.d.ts +9 -9
- package/dist/esnext/icons/DownArrowIcon.js +5 -5
- package/dist/esnext/icons/LeftArrowIcon.d.ts +8 -8
- package/dist/esnext/icons/LeftArrowIcon.js +5 -5
- package/dist/esnext/icons/RejectIcon.d.ts +8 -8
- package/dist/esnext/icons/RejectIcon.js +5 -5
- package/dist/esnext/icons/RightArrowIcon.d.ts +8 -8
- package/dist/esnext/icons/RightArrowIcon.js +5 -5
- package/dist/esnext/icons/Spinner.d.ts +11 -11
- package/dist/esnext/icons/Spinner.js +6 -6
- package/dist/esnext/index.d.ts +1 -1
- package/dist/esnext/index.js +1 -1
- package/dist/esnext/services/__tests__/categories_navigation.test.d.ts +1 -0
- package/dist/esnext/services/__tests__/categories_navigation.test.js +90 -0
- package/dist/esnext/services/categories_navigation.d.ts +69 -48
- package/dist/esnext/services/categories_navigation.js +53 -51
- package/dist/esnext/services/search.d.ts +47 -47
- package/dist/esnext/services/search.js +51 -51
- package/dist/esnext/services/site_setup.d.ts +7 -7
- package/dist/esnext/services/site_setup.js +69 -69
- package/dist/esnext/utils/DynamicStyle.d.ts +7 -7
- package/dist/esnext/utils/DynamicStyle.js +5 -5
- package/dist/esnext/utils/defaults.d.ts +8 -8
- package/dist/esnext/utils/defaults.js +9 -9
- package/dist/esnext/utils/getDynamicStylesVar.d.ts +1 -1
- package/dist/esnext/utils/getDynamicStylesVar.js +5 -5
- package/dist/esnext/utils/getRoutingState.d.ts +9 -9
- package/dist/esnext/utils/getRoutingState.js +13 -13
- package/dist/esnext/utils/makeServingRequests.d.ts +6 -6
- package/dist/esnext/utils/makeServingRequests.js +32 -32
- package/dist/node/plugin/extendOptimizeDeps.d.ts +2 -2
- package/dist/node/plugin/extendOptimizeDeps.js +14 -14
- package/dist/node/plugin/index.d.ts +3 -3
- package/dist/node/plugin/index.js +13 -13
- package/dist/node/plugin/injectCSS.d.ts +2 -2
- package/dist/node/plugin/injectCSS.js +25 -25
- package/dist/node/plugin/suppressWarnings.d.ts +2 -2
- package/dist/node/plugin/suppressWarnings.js +21 -21
- package/package.json +37 -34
- package/dist/esnext/styles/fast-simon.css +0 -622
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { ProductGridEditorSettings } from './editor';
|
|
2
|
-
import { SortBy } from "./sortBy";
|
|
3
|
-
import { Currency } from "./currency";
|
|
4
|
-
import { TextBadge } from "./product";
|
|
5
|
-
import { SiteLanguageConfig, TranslationProvider } from "./translations";
|
|
6
|
-
export interface SortSetupOption {
|
|
7
|
-
active: boolean;
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
}
|
|
11
|
-
export declare type PriceRangeFormat = 'max_price' | 'from_min' | 'price_range' | 'min_price';
|
|
12
|
-
export declare type CurrencySymbolPosition = 'before' | 'after' | 'auto';
|
|
13
|
-
export interface Pricing {
|
|
14
|
-
showPriceWithoutDecimals: boolean;
|
|
15
|
-
priceRangeFormat: PriceRangeFormat;
|
|
16
|
-
currencySymbolPosition: CurrencySymbolPosition;
|
|
17
|
-
currencyConversionRate: string;
|
|
18
|
-
avoidPricesForNonLoginUsers: boolean;
|
|
19
|
-
}
|
|
20
|
-
export interface SiteSetup {
|
|
21
|
-
url: string;
|
|
22
|
-
language: string;
|
|
23
|
-
subscription: number;
|
|
24
|
-
unlimitedAccount: boolean;
|
|
25
|
-
settings: {
|
|
26
|
-
desktopSettings: ProductGridEditorSettings;
|
|
27
|
-
mobileSettings: ProductGridEditorSettings;
|
|
28
|
-
tabletSettings: ProductGridEditorSettings;
|
|
29
|
-
};
|
|
30
|
-
sort: SortSetupOption[];
|
|
31
|
-
default_sort: {
|
|
32
|
-
search: SortBy;
|
|
33
|
-
categories: SortBy;
|
|
34
|
-
custom: Record<string, SortBy>;
|
|
35
|
-
};
|
|
36
|
-
css: string;
|
|
37
|
-
custom_swatches_css: string;
|
|
38
|
-
currency: Currency;
|
|
39
|
-
quickViewAttributes: string[];
|
|
40
|
-
isContent: boolean;
|
|
41
|
-
badges: [string, string][];
|
|
42
|
-
showPriceWithoutDecimals: boolean;
|
|
43
|
-
textBadges: TextBadge[];
|
|
44
|
-
pricing: Pricing;
|
|
45
|
-
imageOptimization: boolean;
|
|
46
|
-
searchPersonalization: boolean;
|
|
47
|
-
customIcons: Record<string, string>;
|
|
48
|
-
categoryNavigationTree: boolean;
|
|
49
|
-
domain: string;
|
|
50
|
-
translationProvider: TranslationProvider;
|
|
51
|
-
siteList: SiteLanguageConfig[];
|
|
52
|
-
}
|
|
1
|
+
import { ProductGridEditorSettings } from './editor';
|
|
2
|
+
import { SortBy } from "./sortBy";
|
|
3
|
+
import { Currency } from "./currency";
|
|
4
|
+
import { TextBadge } from "./product";
|
|
5
|
+
import { SiteLanguageConfig, TranslationProvider } from "./translations";
|
|
6
|
+
export interface SortSetupOption {
|
|
7
|
+
active: boolean;
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
export declare type PriceRangeFormat = 'max_price' | 'from_min' | 'price_range' | 'min_price';
|
|
12
|
+
export declare type CurrencySymbolPosition = 'before' | 'after' | 'auto';
|
|
13
|
+
export interface Pricing {
|
|
14
|
+
showPriceWithoutDecimals: boolean;
|
|
15
|
+
priceRangeFormat: PriceRangeFormat;
|
|
16
|
+
currencySymbolPosition: CurrencySymbolPosition;
|
|
17
|
+
currencyConversionRate: string;
|
|
18
|
+
avoidPricesForNonLoginUsers: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface SiteSetup {
|
|
21
|
+
url: string;
|
|
22
|
+
language: string;
|
|
23
|
+
subscription: number;
|
|
24
|
+
unlimitedAccount: boolean;
|
|
25
|
+
settings: {
|
|
26
|
+
desktopSettings: ProductGridEditorSettings;
|
|
27
|
+
mobileSettings: ProductGridEditorSettings;
|
|
28
|
+
tabletSettings: ProductGridEditorSettings;
|
|
29
|
+
};
|
|
30
|
+
sort: SortSetupOption[];
|
|
31
|
+
default_sort: {
|
|
32
|
+
search: SortBy;
|
|
33
|
+
categories: SortBy;
|
|
34
|
+
custom: Record<string, SortBy>;
|
|
35
|
+
};
|
|
36
|
+
css: string;
|
|
37
|
+
custom_swatches_css: string;
|
|
38
|
+
currency: Currency;
|
|
39
|
+
quickViewAttributes: string[];
|
|
40
|
+
isContent: boolean;
|
|
41
|
+
badges: [string, string][];
|
|
42
|
+
showPriceWithoutDecimals: boolean;
|
|
43
|
+
textBadges: TextBadge[];
|
|
44
|
+
pricing: Pricing;
|
|
45
|
+
imageOptimization: boolean;
|
|
46
|
+
searchPersonalization: boolean;
|
|
47
|
+
customIcons: Record<string, string>;
|
|
48
|
+
categoryNavigationTree: boolean;
|
|
49
|
+
domain: string;
|
|
50
|
+
translationProvider: TranslationProvider;
|
|
51
|
+
siteList: SiteLanguageConfig[];
|
|
52
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export interface SiteStatus {
|
|
2
|
-
cdn_cache_key: number;
|
|
3
|
-
is_suspended: boolean;
|
|
4
|
-
take_over_categories: boolean;
|
|
5
|
-
}
|
|
1
|
+
export interface SiteStatus {
|
|
2
|
+
cdn_cache_key: number;
|
|
3
|
+
is_suspended: boolean;
|
|
4
|
+
take_over_categories: boolean;
|
|
5
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare type SortBy = "price_min_to_max" | "price_max_to_min" | "creation_date" | "creation_date_oldest" | "popularity" | "reviews" | "a_to_z" | "z_to_a" | 'relevency';
|
|
2
|
-
export declare type SortByTranslationKey = 'sort_by_best_match' | 'sort_by_price_low_to_high' | 'sort_by_price_high_to_low' | 'sort_by_newest' | 'sort_by_oldest' | 'sort_by_popularity' | 'sort_by_reviews' | 'sort_by_a_to_z' | 'sort_by_z_to_a';
|
|
3
|
-
export declare type SortByConfig = Record<SortBy, string>;
|
|
4
|
-
export interface SortSetupOption {
|
|
5
|
-
active: boolean;
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
}
|
|
9
|
-
export declare type SelectItem = {
|
|
10
|
-
id: string;
|
|
11
|
-
text: string;
|
|
12
|
-
};
|
|
1
|
+
export declare type SortBy = "price_min_to_max" | "price_max_to_min" | "creation_date" | "creation_date_oldest" | "popularity" | "reviews" | "a_to_z" | "z_to_a" | 'relevency';
|
|
2
|
+
export declare type SortByTranslationKey = 'sort_by_best_match' | 'sort_by_price_low_to_high' | 'sort_by_price_high_to_low' | 'sort_by_newest' | 'sort_by_oldest' | 'sort_by_popularity' | 'sort_by_reviews' | 'sort_by_a_to_z' | 'sort_by_z_to_a';
|
|
3
|
+
export declare type SortByConfig = Record<SortBy, string>;
|
|
4
|
+
export interface SortSetupOption {
|
|
5
|
+
active: boolean;
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
export declare type SelectItem = {
|
|
10
|
+
id: string;
|
|
11
|
+
text: string;
|
|
12
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare enum TranslationProvider {
|
|
2
|
-
NONE = "",
|
|
3
|
-
LANGIFY = "langify",
|
|
4
|
-
WEGOLT = "wegolt"
|
|
5
|
-
}
|
|
6
|
-
export interface SiteLanguageConfig {
|
|
7
|
-
url: string;
|
|
8
|
-
storeID: number;
|
|
9
|
-
uuid: string;
|
|
10
|
-
language: string;
|
|
11
|
-
translation_provider: string;
|
|
12
|
-
}
|
|
1
|
+
export declare enum TranslationProvider {
|
|
2
|
+
NONE = "",
|
|
3
|
+
LANGIFY = "langify",
|
|
4
|
+
WEGOLT = "wegolt"
|
|
5
|
+
}
|
|
6
|
+
export interface SiteLanguageConfig {
|
|
7
|
+
url: string;
|
|
8
|
+
storeID: number;
|
|
9
|
+
uuid: string;
|
|
10
|
+
language: string;
|
|
11
|
+
translation_provider: string;
|
|
12
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export var TranslationProvider;
|
|
2
|
-
(function (TranslationProvider) {
|
|
3
|
-
TranslationProvider["NONE"] = "";
|
|
4
|
-
TranslationProvider["LANGIFY"] = "langify";
|
|
5
|
-
TranslationProvider["WEGOLT"] = "wegolt";
|
|
6
|
-
})(TranslationProvider || (TranslationProvider = {}));
|
|
1
|
+
export var TranslationProvider;
|
|
2
|
+
(function (TranslationProvider) {
|
|
3
|
+
TranslationProvider["NONE"] = "";
|
|
4
|
+
TranslationProvider["LANGIFY"] = "langify";
|
|
5
|
+
TranslationProvider["WEGOLT"] = "wegolt";
|
|
6
|
+
})(TranslationProvider || (TranslationProvider = {}));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AppServerProps } from "../@types/appServerProps";
|
|
3
|
-
interface Props {
|
|
4
|
-
collectionID?: string;
|
|
5
|
-
query?: string;
|
|
6
|
-
fastSimonProps: AppServerProps;
|
|
7
|
-
}
|
|
8
|
-
export declare const FastSimonAppServer: ({ collectionID, query, fastSimonProps }: Props) => React.JSX.Element;
|
|
9
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AppServerProps } from "../@types/appServerProps";
|
|
3
|
+
interface Props {
|
|
4
|
+
collectionID?: string;
|
|
5
|
+
query?: string;
|
|
6
|
+
fastSimonProps: AppServerProps;
|
|
7
|
+
}
|
|
8
|
+
export declare const FastSimonAppServer: ({ collectionID, query, fastSimonProps }: Props) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Suspense } from 'react';
|
|
3
|
-
import { useRequestContext } from "@shopify/hydrogen";
|
|
4
|
-
import { Defaults } from "../utils/defaults";
|
|
5
|
-
import { makeServingRequest } from "../utils/makeServingRequests";
|
|
6
|
-
import { ResizeDetect } from "../hooks/ResizeDetect.client";
|
|
7
|
-
import { PageTitleServer } from "./PageTitle/PageTitle.server";
|
|
8
|
-
import { FiltersServer } from "./Filters/Filters.server";
|
|
9
|
-
import { ResultsSummaryServer } from "./ResultsSummary/ResultsSummary.server";
|
|
10
|
-
import { ProductGridServer } from "./ProductGrid/ProductGrid.server";
|
|
11
|
-
import { Pagination } from "./Pagination/Pagination.client";
|
|
12
|
-
import FiltersSkeleton from "./Filters/FiltersSkeleton";
|
|
13
|
-
import { SortByClient } from "./SortBy/SortBy.client";
|
|
14
|
-
import { getRoutingState } from "../utils/getRoutingState";
|
|
15
|
-
import { RemovableTagsClient } from "./Filters/RemovableTags/RemovableTags.client";
|
|
16
|
-
export const FastSimonAppServer = ({ collectionID, query, fastSimonProps }) => {
|
|
17
|
-
if (collectionID) {
|
|
18
|
-
collectionID = collectionID.split('gid://shopify/Collection/')[1];
|
|
19
|
-
}
|
|
20
|
-
const context = useRequestContext(Defaults.fastSimonServerContextScope);
|
|
21
|
-
const siteConfig = context.fastSimonServerContextScope.config;
|
|
22
|
-
const device = fastSimonProps?.deviceMode || context.fastSimonServerContextScope.device;
|
|
23
|
-
const editorSettings = fastSimonProps?.deviceMode ? (fastSimonProps?.deviceMode === 'mobile' ? siteConfig.settings.mobileSettings : siteConfig.settings.desktopSettings) : context.fastSimonServerContextScope.editorSettings;
|
|
24
|
-
const routingState = getRoutingState({ propsState: fastSimonProps, collectionID, query });
|
|
25
|
-
const res = makeServingRequest({ routingState: routingState });
|
|
26
|
-
return (React.createElement("div", { className: "fast-simon-serp" },
|
|
27
|
-
React.createElement(ResizeDetect, null),
|
|
28
|
-
React.createElement(PageTitleServer, { searchTerm: query, categoryName: res?.data?.category_name }),
|
|
29
|
-
React.createElement("div", { className: 'fs-filters-grid' },
|
|
30
|
-
device === 'desktop' ?
|
|
31
|
-
React.createElement(Suspense, { fallback: React.createElement(FiltersSkeleton, null) },
|
|
32
|
-
React.createElement(FiltersServer, { facets: res.data.facets_completed ? res.data.facets : undefined, getFacetsOnly: res.getFacetsOnly, narrow: routingState.narrow, narrowString: routingState.narrowString, device: 'desktop' })) : null,
|
|
33
|
-
React.createElement("div", null,
|
|
34
|
-
React.createElement("div", { className: "fs-top-page-container" },
|
|
35
|
-
device === 'mobile' ?
|
|
36
|
-
React.createElement("div", { className: 'fs-sort-filters-button-wrapper' },
|
|
37
|
-
React.createElement(SortByClient, { sortSetup: siteConfig.sort, sortingOptions: editorSettings.sorting.sortingOptions, sortBy: routingState?.sortBy }),
|
|
38
|
-
React.createElement(FiltersServer, { facets: res.data.facets_completed ? res.data.facets : undefined, getFacetsOnly: res.getFacetsOnly, narrow: routingState.narrow, narrowString: routingState.narrowString, device: 'mobile' })) :
|
|
39
|
-
React.createElement(SortByClient, { sortSetup: siteConfig.sort, sortingOptions: editorSettings.sorting.sortingOptions, sortBy: routingState?.sortBy }),
|
|
40
|
-
React.createElement("div", { className: "fs-summary-tags-wrapper" },
|
|
41
|
-
React.createElement(ResultsSummaryServer, { totalResults: res?.data?.total_results, term: query ? query : res?.data?.category_name }),
|
|
42
|
-
React.createElement(RemovableTagsClient, { narrowString: routingState.narrowString, removableTagsSettings: editorSettings.filters.removableTags }))),
|
|
43
|
-
React.createElement(ProductGridServer, { data: res?.data, gridSettings: editorSettings.productGrid }),
|
|
44
|
-
React.createElement(Pagination, { currentPage: routingState?.page || 1, paginationSettings: editorSettings.productGrid.pagination, totalPages: res?.data.total_p })))));
|
|
45
|
-
};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Suspense } from 'react';
|
|
3
|
+
import { useRequestContext } from "@shopify/hydrogen";
|
|
4
|
+
import { Defaults } from "../utils/defaults";
|
|
5
|
+
import { makeServingRequest } from "../utils/makeServingRequests";
|
|
6
|
+
import { ResizeDetect } from "../hooks/ResizeDetect.client";
|
|
7
|
+
import { PageTitleServer } from "./PageTitle/PageTitle.server";
|
|
8
|
+
import { FiltersServer } from "./Filters/Filters.server";
|
|
9
|
+
import { ResultsSummaryServer } from "./ResultsSummary/ResultsSummary.server";
|
|
10
|
+
import { ProductGridServer } from "./ProductGrid/ProductGrid.server";
|
|
11
|
+
import { Pagination } from "./Pagination/Pagination.client";
|
|
12
|
+
import FiltersSkeleton from "./Filters/FiltersSkeleton";
|
|
13
|
+
import { SortByClient } from "./SortBy/SortBy.client";
|
|
14
|
+
import { getRoutingState } from "../utils/getRoutingState";
|
|
15
|
+
import { RemovableTagsClient } from "./Filters/RemovableTags/RemovableTags.client";
|
|
16
|
+
export const FastSimonAppServer = ({ collectionID, query, fastSimonProps }) => {
|
|
17
|
+
if (collectionID) {
|
|
18
|
+
collectionID = collectionID.split('gid://shopify/Collection/')[1];
|
|
19
|
+
}
|
|
20
|
+
const context = useRequestContext(Defaults.fastSimonServerContextScope);
|
|
21
|
+
const siteConfig = context.fastSimonServerContextScope.config;
|
|
22
|
+
const device = fastSimonProps?.deviceMode || context.fastSimonServerContextScope.device;
|
|
23
|
+
const editorSettings = fastSimonProps?.deviceMode ? (fastSimonProps?.deviceMode === 'mobile' ? siteConfig.settings.mobileSettings : siteConfig.settings.desktopSettings) : context.fastSimonServerContextScope.editorSettings;
|
|
24
|
+
const routingState = getRoutingState({ propsState: fastSimonProps, collectionID, query });
|
|
25
|
+
const res = makeServingRequest({ routingState: routingState });
|
|
26
|
+
return (React.createElement("div", { className: "fast-simon-serp" },
|
|
27
|
+
React.createElement(ResizeDetect, null),
|
|
28
|
+
React.createElement(PageTitleServer, { searchTerm: query, categoryName: res?.data?.category_name }),
|
|
29
|
+
React.createElement("div", { className: 'fs-filters-grid' },
|
|
30
|
+
device === 'desktop' ?
|
|
31
|
+
React.createElement(Suspense, { fallback: React.createElement(FiltersSkeleton, null) },
|
|
32
|
+
React.createElement(FiltersServer, { facets: res.data.facets_completed ? res.data.facets : undefined, getFacetsOnly: res.getFacetsOnly, narrow: routingState.narrow, narrowString: routingState.narrowString, device: 'desktop' })) : null,
|
|
33
|
+
React.createElement("div", null,
|
|
34
|
+
React.createElement("div", { className: "fs-top-page-container" },
|
|
35
|
+
device === 'mobile' ?
|
|
36
|
+
React.createElement("div", { className: 'fs-sort-filters-button-wrapper' },
|
|
37
|
+
React.createElement(SortByClient, { sortSetup: siteConfig.sort, sortingOptions: editorSettings.sorting.sortingOptions, sortBy: routingState?.sortBy }),
|
|
38
|
+
React.createElement(FiltersServer, { facets: res.data.facets_completed ? res.data.facets : undefined, getFacetsOnly: res.getFacetsOnly, narrow: routingState.narrow, narrowString: routingState.narrowString, device: 'mobile' })) :
|
|
39
|
+
React.createElement(SortByClient, { sortSetup: siteConfig.sort, sortingOptions: editorSettings.sorting.sortingOptions, sortBy: routingState?.sortBy }),
|
|
40
|
+
React.createElement("div", { className: "fs-summary-tags-wrapper" },
|
|
41
|
+
React.createElement(ResultsSummaryServer, { totalResults: res?.data?.total_results, term: query ? query : res?.data?.category_name }),
|
|
42
|
+
React.createElement(RemovableTagsClient, { narrowString: routingState.narrowString, removableTagsSettings: editorSettings.filters.removableTags }))),
|
|
43
|
+
React.createElement(ProductGridServer, { data: res?.data, gridSettings: editorSettings.productGrid }),
|
|
44
|
+
React.createElement(Pagination, { currentPage: routingState?.page || 1, paginationSettings: editorSettings.productGrid.pagination, totalPages: res?.data.total_p })))));
|
|
45
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { HydrogenRouteProps } from "@shopify/hydrogen";
|
|
3
|
-
interface FastSimonProviderProps {
|
|
4
|
-
uuid: string;
|
|
5
|
-
storeID: number;
|
|
6
|
-
request: HydrogenRouteProps;
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
}
|
|
9
|
-
export declare const FastSimonProviderServer: ({ uuid, storeID, request, children }: FastSimonProviderProps) => React.JSX.Element;
|
|
10
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HydrogenRouteProps } from "@shopify/hydrogen";
|
|
3
|
+
interface FastSimonProviderProps {
|
|
4
|
+
uuid: string;
|
|
5
|
+
storeID: number;
|
|
6
|
+
request: HydrogenRouteProps;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const FastSimonProviderServer: ({ uuid, storeID, request, children }: FastSimonProviderProps) => React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { setSiteScopedServerContext } from "../context/setSiteContext";
|
|
3
|
-
import { setRoutingContext } from "../context/setRoutingContext";
|
|
4
|
-
export const FastSimonProviderServer = ({ uuid, storeID, request, children }) => {
|
|
5
|
-
const userAgent = Object.fromEntries(request.headers)?.['user-agent'];
|
|
6
|
-
setSiteScopedServerContext({ uuid, storeID, userAgent });
|
|
7
|
-
setRoutingContext(request);
|
|
8
|
-
return (React.createElement(React.Fragment, null, children));
|
|
9
|
-
};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { setSiteScopedServerContext } from "../context/setSiteContext";
|
|
3
|
+
import { setRoutingContext } from "../context/setRoutingContext";
|
|
4
|
+
export const FastSimonProviderServer = ({ uuid, storeID, request, children }) => {
|
|
5
|
+
const userAgent = Object.fromEntries(request.headers)?.['user-agent'];
|
|
6
|
+
setSiteScopedServerContext({ uuid, storeID, userAgent });
|
|
7
|
+
setRoutingContext(request);
|
|
8
|
+
return (React.createElement(React.Fragment, null, children));
|
|
9
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ServerFacet } from "../../../@types/facets";
|
|
3
|
-
interface Props {
|
|
4
|
-
facets: ServerFacet[];
|
|
5
|
-
narrowString?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function DesktopFiltersServer({ facets, narrowString }: Props): React.JSX.Element;
|
|
8
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ServerFacet } from "../../../@types/facets";
|
|
3
|
+
interface Props {
|
|
4
|
+
facets: ServerFacet[];
|
|
5
|
+
narrowString?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function DesktopFiltersServer({ facets, narrowString }: Props): React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FiltersListServer } from "../FiltersList.server";
|
|
3
|
-
export function DesktopFiltersServer({ facets, narrowString }) {
|
|
4
|
-
return (React.createElement(FiltersListServer, { facets: facets, narrowString: narrowString }));
|
|
5
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FiltersListServer } from "../FiltersList.server";
|
|
3
|
+
export function DesktopFiltersServer({ facets, narrowString }) {
|
|
4
|
+
return (React.createElement(FiltersListServer, { facets: facets, narrowString: narrowString }));
|
|
5
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ServerFacet } from "../../@types/facets";
|
|
3
|
-
interface Props {
|
|
4
|
-
facet: ServerFacet;
|
|
5
|
-
option: any;
|
|
6
|
-
narrowString?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function FacetOptionClient({ facet, option, narrowString }: Props): React.JSX.Element;
|
|
9
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ServerFacet } from "../../@types/facets";
|
|
3
|
+
interface Props {
|
|
4
|
+
facet: ServerFacet;
|
|
5
|
+
option: any;
|
|
6
|
+
narrowString?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function FacetOptionClient({ facet, option, narrowString }: Props): React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { useNavigate, useServerProps, useUrl } from "@shopify/hydrogen";
|
|
3
|
-
import { Narrow } from "@fast-simon/utilities";
|
|
4
|
-
import { Defaults } from "../../utils/defaults";
|
|
5
|
-
export function FacetOptionClient({ facet, option, narrowString }) {
|
|
6
|
-
const [narrow, setNarrow] = useState(Narrow.parseNarrow(narrowString || ''));
|
|
7
|
-
const [isChecked, setIsChecked] = useState(narrow ? Narrow.isInNarrow(narrow, facet[2], option[0]) : false);
|
|
8
|
-
const { setServerProps, serverProps, pending } = useServerProps();
|
|
9
|
-
const url = useUrl();
|
|
10
|
-
const navigation = useNavigate();
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
const newNarrow = Narrow.parseNarrow(narrowString || '');
|
|
13
|
-
setNarrow(newNarrow);
|
|
14
|
-
setIsChecked(Narrow.isInNarrow(newNarrow, facet[2], option[0]));
|
|
15
|
-
}, [narrowString]);
|
|
16
|
-
const onCheckboxClicked = () => {
|
|
17
|
-
setIsChecked(!isChecked);
|
|
18
|
-
let newNarrow = Narrow.updateNarrow(narrow || {}, facet[2], option[0]);
|
|
19
|
-
let dumpedNarrow = Narrow.dumpNarrow(newNarrow);
|
|
20
|
-
url.searchParams.delete('page');
|
|
21
|
-
if (dumpedNarrow) {
|
|
22
|
-
url.searchParams.set('filters', dumpedNarrow);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
url.searchParams.delete('filters');
|
|
26
|
-
}
|
|
27
|
-
navigation(url.href);
|
|
28
|
-
setServerProps(Defaults.fastSimonProps, { ...serverProps?.[Defaults.fastSimonProps], page: 1, narrowString: dumpedNarrow });
|
|
29
|
-
};
|
|
30
|
-
return (React.createElement("div", { className: `fs-facet-option${pending ? ' fs-facet-option-disable' : ''}` },
|
|
31
|
-
React.createElement("span", { className: 'fs-checkbox' + (isChecked ? ' fs-selected-checkbox' : ''), onClick: onCheckboxClicked },
|
|
32
|
-
React.createElement("input", { type: "checkbox" }),
|
|
33
|
-
React.createElement("span", { className: "checkmark" + (isChecked ? ' fs-selected-checkmark' : '') }),
|
|
34
|
-
React.createElement("span", null, facet[2] === 'Categories' ? option[2] : option[0])),
|
|
35
|
-
React.createElement("span", null,
|
|
36
|
-
"(",
|
|
37
|
-
option[1],
|
|
38
|
-
")")));
|
|
39
|
-
}
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { useNavigate, useServerProps, useUrl } from "@shopify/hydrogen";
|
|
3
|
+
import { Narrow } from "@fast-simon/utilities";
|
|
4
|
+
import { Defaults } from "../../utils/defaults";
|
|
5
|
+
export function FacetOptionClient({ facet, option, narrowString }) {
|
|
6
|
+
const [narrow, setNarrow] = useState(Narrow.parseNarrow(narrowString || ''));
|
|
7
|
+
const [isChecked, setIsChecked] = useState(narrow ? Narrow.isInNarrow(narrow, facet[2], option[0]) : false);
|
|
8
|
+
const { setServerProps, serverProps, pending } = useServerProps();
|
|
9
|
+
const url = useUrl();
|
|
10
|
+
const navigation = useNavigate();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const newNarrow = Narrow.parseNarrow(narrowString || '');
|
|
13
|
+
setNarrow(newNarrow);
|
|
14
|
+
setIsChecked(Narrow.isInNarrow(newNarrow, facet[2], option[0]));
|
|
15
|
+
}, [narrowString]);
|
|
16
|
+
const onCheckboxClicked = () => {
|
|
17
|
+
setIsChecked(!isChecked);
|
|
18
|
+
let newNarrow = Narrow.updateNarrow(narrow || {}, facet[2], option[0]);
|
|
19
|
+
let dumpedNarrow = Narrow.dumpNarrow(newNarrow);
|
|
20
|
+
url.searchParams.delete('page');
|
|
21
|
+
if (dumpedNarrow) {
|
|
22
|
+
url.searchParams.set('filters', dumpedNarrow);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
url.searchParams.delete('filters');
|
|
26
|
+
}
|
|
27
|
+
navigation(url.href);
|
|
28
|
+
setServerProps(Defaults.fastSimonProps, { ...serverProps?.[Defaults.fastSimonProps], page: 1, narrowString: dumpedNarrow });
|
|
29
|
+
};
|
|
30
|
+
return (React.createElement("div", { className: `fs-facet-option${pending ? ' fs-facet-option-disable' : ''}` },
|
|
31
|
+
React.createElement("span", { className: 'fs-checkbox' + (isChecked ? ' fs-selected-checkbox' : ''), onClick: onCheckboxClicked },
|
|
32
|
+
React.createElement("input", { type: "checkbox" }),
|
|
33
|
+
React.createElement("span", { className: "checkmark" + (isChecked ? ' fs-selected-checkmark' : '') }),
|
|
34
|
+
React.createElement("span", null, facet[2] === 'Categories' ? option[2] : option[0])),
|
|
35
|
+
React.createElement("span", null,
|
|
36
|
+
"(",
|
|
37
|
+
option[1],
|
|
38
|
+
")")));
|
|
39
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ServerFacet } from "../../@types/facets";
|
|
3
|
-
import { Narrow } from "../../@types/narrow";
|
|
4
|
-
interface Props {
|
|
5
|
-
facets?: ServerFacet[];
|
|
6
|
-
getFacetsOnly?: () => ServerFacet[];
|
|
7
|
-
narrow?: Narrow;
|
|
8
|
-
narrowString?: string;
|
|
9
|
-
device: 'mobile' | 'desktop';
|
|
10
|
-
}
|
|
11
|
-
export declare function FiltersServer({ facets, getFacetsOnly, narrow, device, narrowString }: Props): React.JSX.Element;
|
|
12
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ServerFacet } from "../../@types/facets";
|
|
3
|
+
import { Narrow } from "../../@types/narrow";
|
|
4
|
+
interface Props {
|
|
5
|
+
facets?: ServerFacet[];
|
|
6
|
+
getFacetsOnly?: () => ServerFacet[];
|
|
7
|
+
narrow?: Narrow;
|
|
8
|
+
narrowString?: string;
|
|
9
|
+
device: 'mobile' | 'desktop';
|
|
10
|
+
}
|
|
11
|
+
export declare function FiltersServer({ facets, getFacetsOnly, narrow, device, narrowString }: Props): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DesktopFiltersServer } from "./DesktopFilters/DesktopFilters.server";
|
|
3
|
-
import { MobileFiltersClient } from "./MobileFilters/MobileFilters.client";
|
|
4
|
-
import { FiltersListServer } from "./FiltersList.server";
|
|
5
|
-
export function FiltersServer({ facets, getFacetsOnly, narrow, device, narrowString }) {
|
|
6
|
-
facets = facets ?? getFacetsOnly?.();
|
|
7
|
-
return (React.createElement(React.Fragment, null, device === 'mobile' ?
|
|
8
|
-
React.createElement(MobileFiltersClient, null,
|
|
9
|
-
React.createElement(FiltersListServer, { facets: facets, narrowString: narrowString }))
|
|
10
|
-
: React.createElement(DesktopFiltersServer, { facets: facets, narrowString: narrowString })));
|
|
11
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DesktopFiltersServer } from "./DesktopFilters/DesktopFilters.server";
|
|
3
|
+
import { MobileFiltersClient } from "./MobileFilters/MobileFilters.client";
|
|
4
|
+
import { FiltersListServer } from "./FiltersList.server";
|
|
5
|
+
export function FiltersServer({ facets, getFacetsOnly, narrow, device, narrowString }) {
|
|
6
|
+
facets = facets ?? getFacetsOnly?.();
|
|
7
|
+
return (React.createElement(React.Fragment, null, device === 'mobile' ?
|
|
8
|
+
React.createElement(MobileFiltersClient, null,
|
|
9
|
+
React.createElement(FiltersListServer, { facets: facets, narrowString: narrowString }))
|
|
10
|
+
: React.createElement(DesktopFiltersServer, { facets: facets, narrowString: narrowString })));
|
|
11
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ServerFacet } from "../../@types/facets";
|
|
3
|
-
interface Props {
|
|
4
|
-
facets: ServerFacet[];
|
|
5
|
-
narrowString?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function FiltersListServer({ facets, narrowString }: Props): React.JSX.Element;
|
|
8
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ServerFacet } from "../../@types/facets";
|
|
3
|
+
interface Props {
|
|
4
|
+
facets: ServerFacet[];
|
|
5
|
+
narrowString?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function FiltersListServer({ facets, narrowString }: Props): React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FacetOptionClient } from "./FacetOption.client";
|
|
3
|
-
export function FiltersListServer({ facets, narrowString }) {
|
|
4
|
-
return (React.createElement("div", { className: 'fs-filters' }, facets.map(facet => {
|
|
5
|
-
if (facet[2].toLowerCase().includes('price'))
|
|
6
|
-
return null;
|
|
7
|
-
return (React.createElement("div", { key: 'facet_container' + "_" + facet[2], className: 'fs-facet-container' },
|
|
8
|
-
React.createElement("div", { className: 'fs-facet-title' }, facet[2]),
|
|
9
|
-
React.createElement("div", { className: 'fs-facet-options' }, facet[1].map(option => React.createElement(FacetOptionClient, { key: `facet_option_${facet[2]}_${option[0]}`, option: option, facet: facet, narrowString: narrowString })))));
|
|
10
|
-
})));
|
|
11
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FacetOptionClient } from "./FacetOption.client";
|
|
3
|
+
export function FiltersListServer({ facets, narrowString }) {
|
|
4
|
+
return (React.createElement("div", { className: 'fs-filters' }, facets.map(facet => {
|
|
5
|
+
if (facet[2].toLowerCase().includes('price'))
|
|
6
|
+
return null;
|
|
7
|
+
return (React.createElement("div", { key: 'facet_container' + "_" + facet[2], className: 'fs-facet-container' },
|
|
8
|
+
React.createElement("div", { className: 'fs-facet-title' }, facet[2]),
|
|
9
|
+
React.createElement("div", { className: 'fs-facet-options' }, facet[1].map(option => React.createElement(FacetOptionClient, { key: `facet_option_${facet[2]}_${option[0]}`, option: option, facet: facet, narrowString: narrowString })))));
|
|
10
|
+
})));
|
|
11
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare function FastSkeleton(): React.JSX.Element;
|
|
3
|
-
export default FastSkeleton;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare function FastSkeleton(): React.JSX.Element;
|
|
3
|
+
export default FastSkeleton;
|