@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,51 +1,51 @@
|
|
|
1
|
-
import { CacheShort, fetchSync } from "@shopify/hydrogen";
|
|
2
|
-
import { Narrow as NarrowUtil } from "@fast-simon/utilities/lib/utils/narrow";
|
|
3
|
-
const ENDPOINT = "https://api.fastsimon.com";
|
|
4
|
-
export const Search = {
|
|
5
|
-
fullTextSearch: ({ query, page = 1, sortBy = "relevency", facets = true, narrow, productsPerPage, withProductAttributes = true, searchWithinResultsQuery, storeID, UUID }) => {
|
|
6
|
-
const narrowParm = narrow ? NarrowUtil.toServerNarrow(narrow) : undefined;
|
|
7
|
-
const params = {
|
|
8
|
-
q: query,
|
|
9
|
-
page_num: page,
|
|
10
|
-
sort_by: sortBy,
|
|
11
|
-
facets_required: facets ? 1 : 0,
|
|
12
|
-
products_per_page: productsPerPage,
|
|
13
|
-
narrow: JSON.stringify(narrowParm),
|
|
14
|
-
with_product_attributes: withProductAttributes ? withProductAttributes : undefined,
|
|
15
|
-
search_within_search: searchWithinResultsQuery ? searchWithinResultsQuery : undefined,
|
|
16
|
-
UUID: UUID,
|
|
17
|
-
store_id: storeID
|
|
18
|
-
};
|
|
19
|
-
const url = `${ENDPOINT}/full_text_search?${Object.keys(params).filter(key => params[key] !== undefined).map(key => key + '=' + params[key]).join('&')}`;
|
|
20
|
-
const data = fetchSync(url, {
|
|
21
|
-
preload: false,
|
|
22
|
-
cache: CacheShort()
|
|
23
|
-
}).json();
|
|
24
|
-
return {
|
|
25
|
-
data: data,
|
|
26
|
-
getFacetsOnly: (facets && !data.facets_completed) ? () => {
|
|
27
|
-
return Search.fullTextSearchFacetsOnly({ query, page, sortBy, narrow, avoid_tag_prefixes: data.avoid_tag_prefixes, productsPerPage, searchWithinResultsQuery, storeID, UUID });
|
|
28
|
-
} : undefined
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
fullTextSearchFacetsOnly: ({ query, page = 1, sortBy = "relevency", narrow, productsPerPage, avoid_tag_prefixes, searchWithinResultsQuery, storeID, UUID }) => {
|
|
32
|
-
const narrowParm = narrow ? NarrowUtil.toServerNarrow(narrow) : undefined;
|
|
33
|
-
const params = {
|
|
34
|
-
q: query,
|
|
35
|
-
page_num: page,
|
|
36
|
-
sort_by: sortBy,
|
|
37
|
-
facets_required: 2,
|
|
38
|
-
products_per_page: productsPerPage,
|
|
39
|
-
narrow: JSON.stringify(narrowParm),
|
|
40
|
-
search_within_search: searchWithinResultsQuery ? searchWithinResultsQuery : undefined,
|
|
41
|
-
UUID: UUID,
|
|
42
|
-
store_id: storeID
|
|
43
|
-
};
|
|
44
|
-
const url = `${ENDPOINT}/full_text_search?${Object.keys(params).filter(key => params[key] !== undefined).map(key => key + '=' + params[key]).join('&')}`;
|
|
45
|
-
const data = fetchSync(url, {
|
|
46
|
-
preload: false,
|
|
47
|
-
cache: CacheShort()
|
|
48
|
-
}).json();
|
|
49
|
-
return data.facets;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
1
|
+
import { CacheShort, fetchSync } from "@shopify/hydrogen";
|
|
2
|
+
import { Narrow as NarrowUtil } from "@fast-simon/utilities/lib/utils/narrow";
|
|
3
|
+
const ENDPOINT = "https://api.fastsimon.com";
|
|
4
|
+
export const Search = {
|
|
5
|
+
fullTextSearch: ({ query, page = 1, sortBy = "relevency", facets = true, narrow, productsPerPage, withProductAttributes = true, searchWithinResultsQuery, storeID, UUID }) => {
|
|
6
|
+
const narrowParm = narrow ? NarrowUtil.toServerNarrow(narrow) : undefined;
|
|
7
|
+
const params = {
|
|
8
|
+
q: query,
|
|
9
|
+
page_num: page,
|
|
10
|
+
sort_by: sortBy,
|
|
11
|
+
facets_required: facets ? 1 : 0,
|
|
12
|
+
products_per_page: productsPerPage,
|
|
13
|
+
narrow: JSON.stringify(narrowParm),
|
|
14
|
+
with_product_attributes: withProductAttributes ? withProductAttributes : undefined,
|
|
15
|
+
search_within_search: searchWithinResultsQuery ? searchWithinResultsQuery : undefined,
|
|
16
|
+
UUID: UUID,
|
|
17
|
+
store_id: storeID
|
|
18
|
+
};
|
|
19
|
+
const url = `${ENDPOINT}/full_text_search?${Object.keys(params).filter(key => params[key] !== undefined).map(key => key + '=' + params[key]).join('&')}`;
|
|
20
|
+
const data = fetchSync(url, {
|
|
21
|
+
preload: false,
|
|
22
|
+
cache: CacheShort()
|
|
23
|
+
}).json();
|
|
24
|
+
return {
|
|
25
|
+
data: data,
|
|
26
|
+
getFacetsOnly: (facets && !data.facets_completed) ? () => {
|
|
27
|
+
return Search.fullTextSearchFacetsOnly({ query, page, sortBy, narrow, avoid_tag_prefixes: data.avoid_tag_prefixes, productsPerPage, searchWithinResultsQuery, storeID, UUID });
|
|
28
|
+
} : undefined
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
fullTextSearchFacetsOnly: ({ query, page = 1, sortBy = "relevency", narrow, productsPerPage, avoid_tag_prefixes, searchWithinResultsQuery, storeID, UUID }) => {
|
|
32
|
+
const narrowParm = narrow ? NarrowUtil.toServerNarrow(narrow) : undefined;
|
|
33
|
+
const params = {
|
|
34
|
+
q: query,
|
|
35
|
+
page_num: page,
|
|
36
|
+
sort_by: sortBy,
|
|
37
|
+
facets_required: 2,
|
|
38
|
+
products_per_page: productsPerPage,
|
|
39
|
+
narrow: JSON.stringify(narrowParm),
|
|
40
|
+
search_within_search: searchWithinResultsQuery ? searchWithinResultsQuery : undefined,
|
|
41
|
+
UUID: UUID,
|
|
42
|
+
store_id: storeID
|
|
43
|
+
};
|
|
44
|
+
const url = `${ENDPOINT}/full_text_search?${Object.keys(params).filter(key => params[key] !== undefined).map(key => key + '=' + params[key]).join('&')}`;
|
|
45
|
+
const data = fetchSync(url, {
|
|
46
|
+
preload: false,
|
|
47
|
+
cache: CacheShort()
|
|
48
|
+
}).json();
|
|
49
|
+
return data.facets;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SiteSetup } from "../@types/siteSetup";
|
|
2
|
-
export declare const Site: {
|
|
3
|
-
getSiteConfiguration: () => SiteSetup;
|
|
4
|
-
getUUID: () => string;
|
|
5
|
-
getStoreID: () => number;
|
|
6
|
-
getEndpoint: () => string;
|
|
7
|
-
};
|
|
1
|
+
import { SiteSetup } from "../@types/siteSetup";
|
|
2
|
+
export declare const Site: {
|
|
3
|
+
getSiteConfiguration: () => SiteSetup;
|
|
4
|
+
getUUID: () => string;
|
|
5
|
+
getStoreID: () => number;
|
|
6
|
+
getEndpoint: () => string;
|
|
7
|
+
};
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { gql, useShopQuery, CacheNone, CacheLong } from "@shopify/hydrogen";
|
|
2
|
-
export const Site = {
|
|
3
|
-
getSiteConfiguration: () => {
|
|
4
|
-
// TODO: Fix any type
|
|
5
|
-
const { data: { shop } } = useShopQuery({
|
|
6
|
-
query: EDITOR_SETUP_QUERY,
|
|
7
|
-
cache: CacheNone(),
|
|
8
|
-
preload: true
|
|
9
|
-
});
|
|
10
|
-
return JSON.parse(shop.editorSetup.value);
|
|
11
|
-
},
|
|
12
|
-
getUUID: () => {
|
|
13
|
-
return useShopQuery({
|
|
14
|
-
query: UUID_QUERY,
|
|
15
|
-
cache: CacheLong(),
|
|
16
|
-
preload: true
|
|
17
|
-
}).data;
|
|
18
|
-
},
|
|
19
|
-
getStoreID: () => {
|
|
20
|
-
return useShopQuery({
|
|
21
|
-
query: STORE_ID_QUERY,
|
|
22
|
-
cache: CacheLong(),
|
|
23
|
-
preload: true
|
|
24
|
-
}).data;
|
|
25
|
-
},
|
|
26
|
-
getEndpoint: () => {
|
|
27
|
-
return useShopQuery({
|
|
28
|
-
query: REQUESTS_ENDPOINT_QUERY,
|
|
29
|
-
cache: CacheLong(),
|
|
30
|
-
preload: true
|
|
31
|
-
}).data;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const EDITOR_SETUP_QUERY = gql `
|
|
35
|
-
query editorSetup {
|
|
36
|
-
shop {
|
|
37
|
-
editorSetup: metafield(namespace: "fastsimon", key: "page_setup") {
|
|
38
|
-
value
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
43
|
-
const UUID_QUERY = gql `
|
|
44
|
-
query fastUUID {
|
|
45
|
-
shop {
|
|
46
|
-
uuid: metafield(namespace: "fastsimon", key: "uuid") {
|
|
47
|
-
value
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
const STORE_ID_QUERY = gql `
|
|
53
|
-
query fastStoreID {
|
|
54
|
-
shop {
|
|
55
|
-
storeID: metafield(namespace: "fastsimon", key: "store_id") {
|
|
56
|
-
value
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
`;
|
|
61
|
-
const REQUESTS_ENDPOINT_QUERY = gql `
|
|
62
|
-
query fastRequestsEndpoint {
|
|
63
|
-
shop {
|
|
64
|
-
endpoint: metafield(namespace: "fastsimon", key: "endpoint") {
|
|
65
|
-
value
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
1
|
+
import { gql, useShopQuery, CacheNone, CacheLong } from "@shopify/hydrogen";
|
|
2
|
+
export const Site = {
|
|
3
|
+
getSiteConfiguration: () => {
|
|
4
|
+
// TODO: Fix any type
|
|
5
|
+
const { data: { shop } } = useShopQuery({
|
|
6
|
+
query: EDITOR_SETUP_QUERY,
|
|
7
|
+
cache: CacheNone(),
|
|
8
|
+
preload: true
|
|
9
|
+
});
|
|
10
|
+
return JSON.parse(shop.editorSetup.value);
|
|
11
|
+
},
|
|
12
|
+
getUUID: () => {
|
|
13
|
+
return useShopQuery({
|
|
14
|
+
query: UUID_QUERY,
|
|
15
|
+
cache: CacheLong(),
|
|
16
|
+
preload: true
|
|
17
|
+
}).data;
|
|
18
|
+
},
|
|
19
|
+
getStoreID: () => {
|
|
20
|
+
return useShopQuery({
|
|
21
|
+
query: STORE_ID_QUERY,
|
|
22
|
+
cache: CacheLong(),
|
|
23
|
+
preload: true
|
|
24
|
+
}).data;
|
|
25
|
+
},
|
|
26
|
+
getEndpoint: () => {
|
|
27
|
+
return useShopQuery({
|
|
28
|
+
query: REQUESTS_ENDPOINT_QUERY,
|
|
29
|
+
cache: CacheLong(),
|
|
30
|
+
preload: true
|
|
31
|
+
}).data;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const EDITOR_SETUP_QUERY = gql `
|
|
35
|
+
query editorSetup {
|
|
36
|
+
shop {
|
|
37
|
+
editorSetup: metafield(namespace: "fastsimon", key: "page_setup") {
|
|
38
|
+
value
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
const UUID_QUERY = gql `
|
|
44
|
+
query fastUUID {
|
|
45
|
+
shop {
|
|
46
|
+
uuid: metafield(namespace: "fastsimon", key: "uuid") {
|
|
47
|
+
value
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
const STORE_ID_QUERY = gql `
|
|
53
|
+
query fastStoreID {
|
|
54
|
+
shop {
|
|
55
|
+
storeID: metafield(namespace: "fastsimon", key: "store_id") {
|
|
56
|
+
value
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
const REQUESTS_ENDPOINT_QUERY = gql `
|
|
62
|
+
query fastRequestsEndpoint {
|
|
63
|
+
shop {
|
|
64
|
+
endpoint: metafield(namespace: "fastsimon", key: "endpoint") {
|
|
65
|
+
value
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface Props {
|
|
3
|
-
styles: object;
|
|
4
|
-
className: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function DynamicStyle({ styles, className }: Props): React.JSX.Element;
|
|
7
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
styles: object;
|
|
4
|
+
className: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function DynamicStyle({ styles, className }: Props): React.JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { getDynamicStylesVar } from "./getDynamicStylesVar";
|
|
3
|
-
export function DynamicStyle({ styles, className }) {
|
|
4
|
-
return (React.createElement("style", { dangerouslySetInnerHTML: { __html: `.${className} {${JSON.stringify(getDynamicStylesVar(styles)).replaceAll('"', '')}}` } }));
|
|
5
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getDynamicStylesVar } from "./getDynamicStylesVar";
|
|
3
|
+
export function DynamicStyle({ styles, className }) {
|
|
4
|
+
return (React.createElement("style", { dangerouslySetInnerHTML: { __html: `.${className} {${JSON.stringify(getDynamicStylesVar(styles)).replaceAll('"', '')}}` } }));
|
|
5
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare enum Defaults {
|
|
2
|
-
site = "fastSimonSite",
|
|
3
|
-
userAgent = "fastSimonUserAgent",
|
|
4
|
-
deviceMode = "fastSimonDeviceMode",
|
|
5
|
-
routingState = "fastSimonRoutingState",
|
|
6
|
-
fastSimonServerContextScope = "fastSimonServerContextScope",
|
|
7
|
-
fastSimonProps = "fastSimonProps"
|
|
8
|
-
}
|
|
1
|
+
export declare enum Defaults {
|
|
2
|
+
site = "fastSimonSite",
|
|
3
|
+
userAgent = "fastSimonUserAgent",
|
|
4
|
+
deviceMode = "fastSimonDeviceMode",
|
|
5
|
+
routingState = "fastSimonRoutingState",
|
|
6
|
+
fastSimonServerContextScope = "fastSimonServerContextScope",
|
|
7
|
+
fastSimonProps = "fastSimonProps"
|
|
8
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export var Defaults;
|
|
2
|
-
(function (Defaults) {
|
|
3
|
-
Defaults["site"] = "fastSimonSite";
|
|
4
|
-
Defaults["userAgent"] = "fastSimonUserAgent";
|
|
5
|
-
Defaults["deviceMode"] = "fastSimonDeviceMode";
|
|
6
|
-
Defaults["routingState"] = "fastSimonRoutingState";
|
|
7
|
-
Defaults["fastSimonServerContextScope"] = "fastSimonServerContextScope";
|
|
8
|
-
Defaults["fastSimonProps"] = "fastSimonProps";
|
|
9
|
-
})(Defaults || (Defaults = {}));
|
|
1
|
+
export var Defaults;
|
|
2
|
+
(function (Defaults) {
|
|
3
|
+
Defaults["site"] = "fastSimonSite";
|
|
4
|
+
Defaults["userAgent"] = "fastSimonUserAgent";
|
|
5
|
+
Defaults["deviceMode"] = "fastSimonDeviceMode";
|
|
6
|
+
Defaults["routingState"] = "fastSimonRoutingState";
|
|
7
|
+
Defaults["fastSimonServerContextScope"] = "fastSimonServerContextScope";
|
|
8
|
+
Defaults["fastSimonProps"] = "fastSimonProps";
|
|
9
|
+
})(Defaults || (Defaults = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getDynamicStylesVar: (styles: object) => string;
|
|
1
|
+
export declare const getDynamicStylesVar: (styles: object) => string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const getDynamicStylesVar = (styles) => {
|
|
2
|
-
return Object.entries(styles)
|
|
3
|
-
.map(([key, value]) => `${key}:${value}`)
|
|
4
|
-
.join(';');
|
|
5
|
-
};
|
|
1
|
+
export const getDynamicStylesVar = (styles) => {
|
|
2
|
+
return Object.entries(styles)
|
|
3
|
+
.map(([key, value]) => `${key}:${value}`)
|
|
4
|
+
.join(';');
|
|
5
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { RoutingState } from "../@types/routing";
|
|
2
|
-
import { AppServerProps } from "../@types/appServerProps";
|
|
3
|
-
interface Props {
|
|
4
|
-
propsState: AppServerProps;
|
|
5
|
-
collectionID?: string;
|
|
6
|
-
query?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const getRoutingState: ({ propsState, collectionID, query }: Props) => RoutingState;
|
|
9
|
-
export {};
|
|
1
|
+
import { RoutingState } from "../@types/routing";
|
|
2
|
+
import { AppServerProps } from "../@types/appServerProps";
|
|
3
|
+
interface Props {
|
|
4
|
+
propsState: AppServerProps;
|
|
5
|
+
collectionID?: string;
|
|
6
|
+
query?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const getRoutingState: ({ propsState, collectionID, query }: Props) => RoutingState;
|
|
9
|
+
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useUrl } from "@shopify/hydrogen";
|
|
2
|
-
import { Narrow } from "@fast-simon/utilities";
|
|
3
|
-
export const getRoutingState = ({ propsState, collectionID, query }) => {
|
|
4
|
-
const { searchParams } = useUrl();
|
|
5
|
-
return {
|
|
6
|
-
page: (propsState?.page || Number(searchParams.get('page')) || 1),
|
|
7
|
-
sortBy: (propsState?.sortBy || searchParams.get('sort') || undefined),
|
|
8
|
-
narrow: propsState?.narrowString ? Narrow.parseNarrow(propsState?.narrowString) : (searchParams.get('filters') ? Narrow.parseNarrow(searchParams.get('filters')) : undefined),
|
|
9
|
-
narrowString: propsState?.narrowString || searchParams.get('filters') || undefined,
|
|
10
|
-
query: (propsState?.query || query || searchParams.get('q') || ''),
|
|
11
|
-
collectionID: (propsState?.collectionID || collectionID || '')
|
|
12
|
-
};
|
|
13
|
-
};
|
|
1
|
+
import { useUrl } from "@shopify/hydrogen";
|
|
2
|
+
import { Narrow } from "@fast-simon/utilities";
|
|
3
|
+
export const getRoutingState = ({ propsState, collectionID, query }) => {
|
|
4
|
+
const { searchParams } = useUrl();
|
|
5
|
+
return {
|
|
6
|
+
page: (propsState?.page || Number(searchParams.get('page')) || 1),
|
|
7
|
+
sortBy: (propsState?.sortBy || searchParams.get('sort') || undefined),
|
|
8
|
+
narrow: propsState?.narrowString ? Narrow.parseNarrow(propsState?.narrowString) : (searchParams.get('filters') ? Narrow.parseNarrow(searchParams.get('filters')) : undefined),
|
|
9
|
+
narrowString: propsState?.narrowString || searchParams.get('filters') || undefined,
|
|
10
|
+
query: (propsState?.query || query || searchParams.get('q') || ''),
|
|
11
|
+
collectionID: (propsState?.collectionID || collectionID || '')
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AppServerProps } from "../@types/appServerProps";
|
|
2
|
-
interface Props {
|
|
3
|
-
routingState: AppServerProps;
|
|
4
|
-
}
|
|
5
|
-
export declare const makeServingRequest: ({ routingState }: Props) => any;
|
|
6
|
-
export {};
|
|
1
|
+
import { AppServerProps } from "../@types/appServerProps";
|
|
2
|
+
interface Props {
|
|
3
|
+
routingState: AppServerProps;
|
|
4
|
+
}
|
|
5
|
+
export declare const makeServingRequest: ({ routingState }: Props) => any;
|
|
6
|
+
export {};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { Search } from "../services/search";
|
|
2
|
-
import { CategoriesNavigation } from "../services/categories_navigation";
|
|
3
|
-
import { useRequestContext } from "@shopify/hydrogen";
|
|
4
|
-
import { Defaults } from "./defaults";
|
|
5
|
-
//TODO: Fix return type
|
|
6
|
-
export const makeServingRequest = ({ routingState }) => {
|
|
7
|
-
const context = useRequestContext(Defaults.fastSimonServerContextScope);
|
|
8
|
-
let res;
|
|
9
|
-
if (routingState.query) {
|
|
10
|
-
res = Search.fullTextSearch({
|
|
11
|
-
query: decodeURI(routingState.query),
|
|
12
|
-
page: routingState?.page || 1,
|
|
13
|
-
sortBy: routingState?.sortBy,
|
|
14
|
-
narrow: routingState?.narrow,
|
|
15
|
-
storeID: context.fastSimonServerContextScope.storeID,
|
|
16
|
-
UUID: context.fastSimonServerContextScope.uuid,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
else if (routingState.collectionID) {
|
|
20
|
-
res = CategoriesNavigation.get({
|
|
21
|
-
categoryID: routingState.collectionID,
|
|
22
|
-
page: routingState?.page || 1,
|
|
23
|
-
storeID: context.fastSimonServerContextScope.storeID,
|
|
24
|
-
UUID: context.fastSimonServerContextScope.uuid,
|
|
25
|
-
sortBy: routingState?.sortBy,
|
|
26
|
-
narrow: routingState?.narrow
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
const fastSimonContext = useRequestContext(Defaults.fastSimonServerContextScope);
|
|
30
|
-
fastSimonContext.servingData = res;
|
|
31
|
-
return res;
|
|
32
|
-
};
|
|
1
|
+
import { Search } from "../services/search";
|
|
2
|
+
import { CategoriesNavigation } from "../services/categories_navigation";
|
|
3
|
+
import { useRequestContext } from "@shopify/hydrogen";
|
|
4
|
+
import { Defaults } from "./defaults";
|
|
5
|
+
//TODO: Fix return type
|
|
6
|
+
export const makeServingRequest = ({ routingState }) => {
|
|
7
|
+
const context = useRequestContext(Defaults.fastSimonServerContextScope);
|
|
8
|
+
let res;
|
|
9
|
+
if (routingState.query) {
|
|
10
|
+
res = Search.fullTextSearch({
|
|
11
|
+
query: decodeURI(routingState.query),
|
|
12
|
+
page: routingState?.page || 1,
|
|
13
|
+
sortBy: routingState?.sortBy,
|
|
14
|
+
narrow: routingState?.narrow,
|
|
15
|
+
storeID: context.fastSimonServerContextScope.storeID,
|
|
16
|
+
UUID: context.fastSimonServerContextScope.uuid,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
else if (routingState.collectionID) {
|
|
20
|
+
res = CategoriesNavigation.get({
|
|
21
|
+
categoryID: routingState.collectionID,
|
|
22
|
+
page: routingState?.page || 1,
|
|
23
|
+
storeID: context.fastSimonServerContextScope.storeID,
|
|
24
|
+
UUID: context.fastSimonServerContextScope.uuid,
|
|
25
|
+
sortBy: routingState?.sortBy,
|
|
26
|
+
narrow: routingState?.narrow
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const fastSimonContext = useRequestContext(Defaults.fastSimonServerContextScope);
|
|
30
|
+
fastSimonContext.servingData = res;
|
|
31
|
+
return res;
|
|
32
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Plugin } from 'vite';
|
|
2
|
-
export declare const extendOptimizeDeps: () => Plugin;
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
export declare const extendOptimizeDeps: () => Plugin;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extendOptimizeDeps = void 0;
|
|
4
|
-
const extendOptimizeDeps = () => ({
|
|
5
|
-
name: 'vite-plugin-fast-simon-hydrogen-extend-optimize-deps',
|
|
6
|
-
config: () => ({
|
|
7
|
-
optimizeDeps: {
|
|
8
|
-
include: [
|
|
9
|
-
'@fast-simon/shopify-hydrogen'
|
|
10
|
-
]
|
|
11
|
-
}
|
|
12
|
-
})
|
|
13
|
-
});
|
|
14
|
-
exports.extendOptimizeDeps = extendOptimizeDeps;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extendOptimizeDeps = void 0;
|
|
4
|
+
const extendOptimizeDeps = () => ({
|
|
5
|
+
name: 'vite-plugin-fast-simon-hydrogen-extend-optimize-deps',
|
|
6
|
+
config: () => ({
|
|
7
|
+
optimizeDeps: {
|
|
8
|
+
include: [
|
|
9
|
+
'@fast-simon/shopify-hydrogen'
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
exports.extendOptimizeDeps = extendOptimizeDeps;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Plugin } from 'vite';
|
|
2
|
-
declare const fastSimonPlugin: () => Plugin[];
|
|
3
|
-
export default fastSimonPlugin;
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
declare const fastSimonPlugin: () => Plugin[];
|
|
3
|
+
export default fastSimonPlugin;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const extendOptimizeDeps_1 = require("./extendOptimizeDeps");
|
|
4
|
-
const suppressWarnings_1 = require("./suppressWarnings");
|
|
5
|
-
const injectCSS_1 = require("./injectCSS");
|
|
6
|
-
const fastSimonPlugin = () => {
|
|
7
|
-
return [
|
|
8
|
-
(0, extendOptimizeDeps_1.extendOptimizeDeps)(),
|
|
9
|
-
(0, suppressWarnings_1.suppressWarnings)(),
|
|
10
|
-
(0, injectCSS_1.injectCSS)()
|
|
11
|
-
];
|
|
12
|
-
};
|
|
13
|
-
exports.default = fastSimonPlugin;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const extendOptimizeDeps_1 = require("./extendOptimizeDeps");
|
|
4
|
+
const suppressWarnings_1 = require("./suppressWarnings");
|
|
5
|
+
const injectCSS_1 = require("./injectCSS");
|
|
6
|
+
const fastSimonPlugin = () => {
|
|
7
|
+
return [
|
|
8
|
+
(0, extendOptimizeDeps_1.extendOptimizeDeps)(),
|
|
9
|
+
(0, suppressWarnings_1.suppressWarnings)(),
|
|
10
|
+
(0, injectCSS_1.injectCSS)()
|
|
11
|
+
];
|
|
12
|
+
};
|
|
13
|
+
exports.default = fastSimonPlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Plugin } from "vite";
|
|
2
|
-
export declare const injectCSS: () => Plugin;
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
export declare const injectCSS: () => Plugin;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.injectCSS = void 0;
|
|
4
|
-
const injectCSS = () => {
|
|
5
|
-
return {
|
|
6
|
-
name: 'html-transform',
|
|
7
|
-
transformIndexHtml: {
|
|
8
|
-
enforce: 'pre',
|
|
9
|
-
transform(html) {
|
|
10
|
-
const htmlTagsToInject = [{
|
|
11
|
-
tag: 'link',
|
|
12
|
-
attrs: {
|
|
13
|
-
'rel': 'stylesheet',
|
|
14
|
-
'href': '/node_modules/@fast-simon/shopify-hydrogen/dist/esnext/styles/fast-simon.css'
|
|
15
|
-
}
|
|
16
|
-
}];
|
|
17
|
-
return {
|
|
18
|
-
html: html,
|
|
19
|
-
tags: htmlTagsToInject
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
exports.injectCSS = injectCSS;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.injectCSS = void 0;
|
|
4
|
+
const injectCSS = () => {
|
|
5
|
+
return {
|
|
6
|
+
name: 'html-transform',
|
|
7
|
+
transformIndexHtml: {
|
|
8
|
+
enforce: 'pre',
|
|
9
|
+
transform(html) {
|
|
10
|
+
const htmlTagsToInject = [{
|
|
11
|
+
tag: 'link',
|
|
12
|
+
attrs: {
|
|
13
|
+
'rel': 'stylesheet',
|
|
14
|
+
'href': '/node_modules/@fast-simon/shopify-hydrogen/dist/esnext/styles/fast-simon.css'
|
|
15
|
+
}
|
|
16
|
+
}];
|
|
17
|
+
return {
|
|
18
|
+
html: html,
|
|
19
|
+
tags: htmlTagsToInject
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.injectCSS = injectCSS;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Plugin } from "vite";
|
|
2
|
-
export declare const suppressWarnings: () => Plugin;
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
export declare const suppressWarnings: () => Plugin;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.suppressWarnings = void 0;
|
|
4
|
-
const suppressWarnings = () => {
|
|
5
|
-
return {
|
|
6
|
-
name: 'fast-simon:suppress-warnings',
|
|
7
|
-
configResolved(config) {
|
|
8
|
-
// TODO: Fix the real issue
|
|
9
|
-
const filterOut = (msg) => msg.startsWith("@fast-simon/shopify-hydrogen doesn't appear to be written in CJS");
|
|
10
|
-
for (const method of ['warn', 'warnOnce']) {
|
|
11
|
-
const original = config.logger[method];
|
|
12
|
-
config.logger[method] = (msg, ...args) => {
|
|
13
|
-
if (filterOut(msg))
|
|
14
|
-
return;
|
|
15
|
-
return original(msg, ...args);
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
exports.suppressWarnings = suppressWarnings;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.suppressWarnings = void 0;
|
|
4
|
+
const suppressWarnings = () => {
|
|
5
|
+
return {
|
|
6
|
+
name: 'fast-simon:suppress-warnings',
|
|
7
|
+
configResolved(config) {
|
|
8
|
+
// TODO: Fix the real issue
|
|
9
|
+
const filterOut = (msg) => msg.startsWith("@fast-simon/shopify-hydrogen doesn't appear to be written in CJS");
|
|
10
|
+
for (const method of ['warn', 'warnOnce']) {
|
|
11
|
+
const original = config.logger[method];
|
|
12
|
+
config.logger[method] = (msg, ...args) => {
|
|
13
|
+
if (filterOut(msg))
|
|
14
|
+
return;
|
|
15
|
+
return original(msg, ...args);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.suppressWarnings = suppressWarnings;
|