@gem-sdk/core 1.23.0-staging.452 → 1.23.0-staging.456
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/cjs/components/Render.js +5 -2
- package/dist/cjs/contexts/BuilderContext.js +6 -4
- package/dist/cjs/contexts/PageContext.js +12 -3
- package/dist/cjs/graphql/fragments/product-little.generated.js +9 -0
- package/dist/cjs/graphql/fragments/product.generated.js +9 -0
- package/dist/cjs/graphql/queries/products.generated.js +9 -0
- package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +25 -0
- package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +38 -0
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +12 -4
- package/dist/cjs/helpers/GlobalEvent.js +7 -7
- package/dist/cjs/helpers/queries/get-products.js +24 -0
- package/dist/cjs/hooks/shop/use-product-query.js +2 -2
- package/dist/cjs/hooks/shop/use-products-query.js +11 -1
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +12 -1
- package/dist/cjs/index.js +7 -2
- package/dist/esm/components/Render.js +5 -2
- package/dist/esm/contexts/BuilderContext.js +6 -4
- package/dist/esm/contexts/PageContext.js +12 -3
- package/dist/esm/graphql/fragments/product-little.generated.js +9 -0
- package/dist/esm/graphql/fragments/product.generated.js +9 -0
- package/dist/esm/graphql/queries/products.generated.js +9 -0
- package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +23 -0
- package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +36 -0
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +12 -4
- package/dist/esm/helpers/GlobalEvent.js +7 -7
- package/dist/esm/helpers/queries/get-products.js +24 -1
- package/dist/esm/hooks/shop/use-product-query.js +2 -2
- package/dist/esm/hooks/shop/use-products-query.js +12 -3
- package/dist/esm/hooks/useInitialSwatchesOptions.js +12 -1
- package/dist/esm/index.js +4 -2
- package/dist/types/index.d.ts +4163 -2532
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ const Render = ({ uid, ...passProps })=>{
|
|
|
14
14
|
const item = BuilderContext.useBuilderStore((s)=>s.getItem(uid));
|
|
15
15
|
const Component = BuilderComponent.useBuilderComponent(item?.tag);
|
|
16
16
|
const isPostPurchase = BuilderContext.useBuilderStore((s)=>s.getIsPostPurchase());
|
|
17
|
+
const isPreview = BuilderContext.useBuilderStore((s)=>s.getIsPreview());
|
|
17
18
|
const pageType = react.useMemo(()=>{
|
|
18
19
|
return isPostPurchase ? 'POST_PURCHASE' : undefined;
|
|
19
20
|
}, [
|
|
@@ -45,7 +46,8 @@ const Render = ({ uid, ...passProps })=>{
|
|
|
45
46
|
children: item?.childrens?.length ? /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
46
47
|
builderProps: {
|
|
47
48
|
uid,
|
|
48
|
-
builderData: item
|
|
49
|
+
builderData: item,
|
|
50
|
+
isPreview
|
|
49
51
|
},
|
|
50
52
|
styles: item.styles,
|
|
51
53
|
setting: item.settings,
|
|
@@ -56,7 +58,8 @@ const Render = ({ uid, ...passProps })=>{
|
|
|
56
58
|
}) : /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
57
59
|
builderProps: {
|
|
58
60
|
uid,
|
|
59
|
-
builderData: item
|
|
61
|
+
builderData: item,
|
|
62
|
+
isPreview
|
|
60
63
|
},
|
|
61
64
|
styles: item.styles,
|
|
62
65
|
setting: item.settings,
|
|
@@ -5,17 +5,19 @@ var react = require('react');
|
|
|
5
5
|
var zustand = require('zustand');
|
|
6
6
|
|
|
7
7
|
const BuilderContext = /*#__PURE__*/ react.createContext(null);
|
|
8
|
-
const createBuilderProvider = (data, isPostPurchase)=>zustand.createStore((_, get)=>({
|
|
8
|
+
const createBuilderProvider = (data, isPostPurchase, isPreview)=>zustand.createStore((_, get)=>({
|
|
9
9
|
state: data,
|
|
10
10
|
isPostPurchase: isPostPurchase,
|
|
11
|
+
isPreview: isPreview,
|
|
11
12
|
getItem: (id)=>{
|
|
12
13
|
return get().state[id];
|
|
13
14
|
},
|
|
14
|
-
getIsPostPurchase: ()=>get().isPostPurchase
|
|
15
|
+
getIsPostPurchase: ()=>get().isPostPurchase,
|
|
16
|
+
getIsPreview: ()=>get().isPreview
|
|
15
17
|
}));
|
|
16
|
-
const BuilderProvider = ({ children, state, isPostPurchase, lazy, priority, ...passProps })=>{
|
|
18
|
+
const BuilderProvider = ({ children, state, isPostPurchase, isPreview, lazy, priority, ...passProps })=>{
|
|
17
19
|
const Component = lazy ? react.Suspense : react.Fragment;
|
|
18
|
-
const store = createBuilderProvider(state, isPostPurchase);
|
|
20
|
+
const store = createBuilderProvider(state, isPostPurchase, isPreview);
|
|
19
21
|
return /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
20
22
|
children: /*#__PURE__*/ jsxRuntime.jsx(BuilderContext.Provider, {
|
|
21
23
|
...passProps,
|
|
@@ -26,15 +26,24 @@ const createPageStoreProvider = (data)=>zustand.createStore((set)=>({
|
|
|
26
26
|
set({
|
|
27
27
|
salePageProductId: id
|
|
28
28
|
});
|
|
29
|
+
},
|
|
30
|
+
setPublicStoreFrontData: (publicStoreFrontData)=>{
|
|
31
|
+
set({
|
|
32
|
+
publicStoreFrontData: publicStoreFrontData
|
|
33
|
+
});
|
|
29
34
|
}
|
|
30
35
|
}));
|
|
31
|
-
const PageProvider = ({ children, dynamicProduct, dynamicCollection, ...passProps })=>{
|
|
36
|
+
const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
|
|
32
37
|
const store = react.useMemo(()=>createPageStoreProvider({
|
|
33
38
|
dynamicProduct,
|
|
34
|
-
dynamicCollection
|
|
39
|
+
dynamicCollection,
|
|
40
|
+
productOffers,
|
|
41
|
+
publicStoreFrontData
|
|
35
42
|
}), [
|
|
36
43
|
dynamicProduct,
|
|
37
|
-
dynamicCollection
|
|
44
|
+
dynamicCollection,
|
|
45
|
+
productOffers,
|
|
46
|
+
publicStoreFrontData
|
|
38
47
|
]);
|
|
39
48
|
return /*#__PURE__*/ jsxRuntime.jsx(PageContext.Provider, {
|
|
40
49
|
...passProps,
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
/* eslint-disable */ const ProductSelect = `
|
|
4
4
|
fragment ProductSelect on Product {
|
|
5
5
|
...ProductLittleSelect
|
|
6
|
+
collections {
|
|
7
|
+
edges {
|
|
8
|
+
node {
|
|
9
|
+
id
|
|
10
|
+
title
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
tags
|
|
6
15
|
medias(first: $firstMedia, after: $afterMedia, orderBy: $orderByMedia) {
|
|
7
16
|
edges {
|
|
8
17
|
cursor
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable */ const LibrarySaleFunnelDocument = `
|
|
4
|
+
query LibrarySaleFunnel($librarySaleFunnelId: ID!) {
|
|
5
|
+
librarySaleFunnel(id: $librarySaleFunnelId) {
|
|
6
|
+
id
|
|
7
|
+
type
|
|
8
|
+
name
|
|
9
|
+
offers {
|
|
10
|
+
id
|
|
11
|
+
discounts {
|
|
12
|
+
id
|
|
13
|
+
objectBaseID
|
|
14
|
+
objectType
|
|
15
|
+
position
|
|
16
|
+
title
|
|
17
|
+
type
|
|
18
|
+
value
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
exports.LibrarySaleFunnelDocument = LibrarySaleFunnelDocument;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable */ const SaleFunnelDiscountsDocument = `
|
|
4
|
+
query SaleFunnelDiscounts($where: SaleFunnelDiscountWhereInput, $orderBy: SaleFunnelDiscountOrder, $last: Int, $before: Cursor, $first: Int, $after: Cursor) {
|
|
5
|
+
saleFunnelDiscounts(
|
|
6
|
+
where: $where
|
|
7
|
+
orderBy: $orderBy
|
|
8
|
+
last: $last
|
|
9
|
+
before: $before
|
|
10
|
+
first: $first
|
|
11
|
+
after: $after
|
|
12
|
+
) {
|
|
13
|
+
edges {
|
|
14
|
+
node {
|
|
15
|
+
id
|
|
16
|
+
objectBaseID
|
|
17
|
+
objectType
|
|
18
|
+
position
|
|
19
|
+
title
|
|
20
|
+
type
|
|
21
|
+
value
|
|
22
|
+
valueType
|
|
23
|
+
isEnabled
|
|
24
|
+
}
|
|
25
|
+
cursor
|
|
26
|
+
}
|
|
27
|
+
pageInfo {
|
|
28
|
+
endCursor
|
|
29
|
+
hasNextPage
|
|
30
|
+
hasPreviousPage
|
|
31
|
+
startCursor
|
|
32
|
+
}
|
|
33
|
+
totalCount
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
exports.SaleFunnelDiscountsDocument = SaleFunnelDiscountsDocument;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/* eslint-disable */ const ThemePageDocument = `
|
|
4
|
-
query ThemePage($themePageId: ID
|
|
4
|
+
query ThemePage($themePageId: ID!, $first: Int, $where: ThemeStyleWhereInput) {
|
|
5
5
|
themePage(id: $themePageId) {
|
|
6
6
|
id
|
|
7
7
|
name
|
|
@@ -12,11 +12,19 @@
|
|
|
12
12
|
cid
|
|
13
13
|
component
|
|
14
14
|
id
|
|
15
|
+
deletedAt
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
theme {
|
|
17
18
|
id
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
themeStyles(first: $first, where: $where) {
|
|
20
|
+
edges {
|
|
21
|
+
node {
|
|
22
|
+
data
|
|
23
|
+
id
|
|
24
|
+
name
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
20
28
|
}
|
|
21
29
|
}
|
|
22
30
|
}
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const globalEvent = {
|
|
6
|
-
subscribe (callback) {
|
|
7
|
-
document.addEventListener(
|
|
6
|
+
subscribe (eventName, callback) {
|
|
7
|
+
document.addEventListener(eventName, (e)=>callback(e.detail));
|
|
8
8
|
},
|
|
9
|
-
dispatch (
|
|
10
|
-
document.dispatchEvent(new CustomEvent(
|
|
11
|
-
detail
|
|
9
|
+
dispatch (eventName, detail) {
|
|
10
|
+
document.dispatchEvent(new CustomEvent(eventName, {
|
|
11
|
+
detail
|
|
12
12
|
}));
|
|
13
13
|
},
|
|
14
|
-
remove (callback) {
|
|
15
|
-
document.removeEventListener(
|
|
14
|
+
remove (eventName, callback) {
|
|
15
|
+
document.removeEventListener(eventName, callback);
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -57,6 +57,29 @@ const getProducts = async (fetcher, { ids, isSample, isStorefront, defaultSelect
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
|
+
const getProductQueryAll = async (fetcher, arg)=>{
|
|
61
|
+
const limit = arg?.limit || 4;
|
|
62
|
+
delete arg.limit;
|
|
63
|
+
const variables = {
|
|
64
|
+
first: limit,
|
|
65
|
+
firstMedia: 1,
|
|
66
|
+
firstVariant: 1,
|
|
67
|
+
orderBy: {
|
|
68
|
+
field: 'PLATFORM_CREATED_AT',
|
|
69
|
+
direction: 'DESC'
|
|
70
|
+
},
|
|
71
|
+
orderByMedia: {
|
|
72
|
+
field: 'POSITION',
|
|
73
|
+
direction: 'ASC'
|
|
74
|
+
},
|
|
75
|
+
where: {
|
|
76
|
+
status: 'ACTIVE',
|
|
77
|
+
...arg
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const pageData = await fetchProducts(fetcher, variables);
|
|
81
|
+
return pageData;
|
|
82
|
+
};
|
|
60
83
|
const fetchProducts = async (fetcher, variables)=>{
|
|
61
84
|
return fetcher([
|
|
62
85
|
products_generated.ProductsDocument,
|
|
@@ -164,4 +187,5 @@ const mergeMediasToProducts = async ({ fetcher, products, isSample, isStorefront
|
|
|
164
187
|
// );
|
|
165
188
|
// };
|
|
166
189
|
|
|
190
|
+
exports.getProductQueryAll = getProductQueryAll;
|
|
167
191
|
exports.getProducts = getProducts;
|
|
@@ -6,7 +6,7 @@ var shop = require('../shop.js');
|
|
|
6
6
|
var useFetchHandle = require('../useFetchHandle.js');
|
|
7
7
|
var query = require('../../helpers/query.js');
|
|
8
8
|
|
|
9
|
-
const useProductQuery = (productId, options)=>{
|
|
9
|
+
const useProductQuery = (productId, options, customFetcher)=>{
|
|
10
10
|
const fetcher = useFetchHandle.useFetchHandle();
|
|
11
11
|
const isSample = shop.useIsSampleProduct();
|
|
12
12
|
const isStorefront = shop.useIsStorefrontProduct();
|
|
@@ -15,7 +15,7 @@ const useProductQuery = (productId, options)=>{
|
|
|
15
15
|
isSample,
|
|
16
16
|
isStorefront
|
|
17
17
|
}) : null, async ([, arg])=>{
|
|
18
|
-
return getProduct.getProduct(fetcher, arg);
|
|
18
|
+
return getProduct.getProduct(customFetcher || fetcher, arg);
|
|
19
19
|
}, options);
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -17,8 +17,18 @@ const useProductsQuery = (ids, options, params)=>{
|
|
|
17
17
|
defaultSelectedProductCount: params?.defaultSelectedProductCount,
|
|
18
18
|
allStatus: params?.allStatus
|
|
19
19
|
}) : null, async ([, arg])=>{
|
|
20
|
-
return getProducts.getProducts(fetcher, arg);
|
|
20
|
+
return getProducts.getProducts(params?.fetcher || fetcher, arg);
|
|
21
|
+
}, options);
|
|
22
|
+
};
|
|
23
|
+
const useProductsQueryAll = (variable, options)=>{
|
|
24
|
+
const fetcher = useFetchHandle.useFetchHandle();
|
|
25
|
+
return useSWR(variable ? [
|
|
26
|
+
'query/products',
|
|
27
|
+
variable
|
|
28
|
+
] : null, async ([, arg])=>{
|
|
29
|
+
return getProducts.getProductQueryAll(fetcher, arg);
|
|
21
30
|
}, options);
|
|
22
31
|
};
|
|
23
32
|
|
|
24
33
|
exports.useProductsQuery = useProductsQuery;
|
|
34
|
+
exports.useProductsQueryAll = useProductsQueryAll;
|
|
@@ -8,6 +8,17 @@ var variantPresets = require('../components/src/product/helpers/variant-presets.
|
|
|
8
8
|
var shop = require('./shop.js');
|
|
9
9
|
var useFetchHandle = require('./useFetchHandle.js');
|
|
10
10
|
var ShopContext = require('../contexts/ShopContext.js');
|
|
11
|
+
require('react');
|
|
12
|
+
require('react/jsx-runtime');
|
|
13
|
+
require('zustand');
|
|
14
|
+
require('@gem-sdk/adapter-shopify');
|
|
15
|
+
require('swr/mutation');
|
|
16
|
+
require('vanilla-lazyload');
|
|
17
|
+
require('./useCartUI.js');
|
|
18
|
+
require('react-transition-group');
|
|
19
|
+
require('@gem-sdk/core');
|
|
20
|
+
var isBrowser = require('../helpers/is-browser.js');
|
|
21
|
+
require('../helpers/convert.js');
|
|
11
22
|
|
|
12
23
|
let swatchChange = false;
|
|
13
24
|
let colorChange = false;
|
|
@@ -37,7 +48,7 @@ const useInitialSwatchesOptions = (options)=>{
|
|
|
37
48
|
});
|
|
38
49
|
if (!options) return [];
|
|
39
50
|
setDefaultSwatches(swatches, options);
|
|
40
|
-
if (swatches?.length && (swatchChange || colorChange)) {
|
|
51
|
+
if (isBrowser.default() && swatches?.length && (swatchChange || colorChange)) {
|
|
41
52
|
window?.parent?.postMessage?.(JSON.stringify({
|
|
42
53
|
type: 'update-swatches',
|
|
43
54
|
swatches
|
package/dist/cjs/index.js
CHANGED
|
@@ -24,8 +24,10 @@ var publishedThemePages_generated = require('./graphql/queries/published-theme-p
|
|
|
24
24
|
var products_generated = require('./graphql/queries/products.generated.js');
|
|
25
25
|
var storeProperty_generated = require('./graphql/queries/store-property.generated.js');
|
|
26
26
|
var previewPage_generated = require('./graphql/queries/preview-page.generated.js');
|
|
27
|
-
var ThemePage_generated = require('./graphql-app-api/queries/ThemePage.generated.js');
|
|
28
27
|
var LibraryTemplate_generated = require('./graphql-app-api/queries/LibraryTemplate.generated.js');
|
|
28
|
+
var ThemePage_generated = require('./graphql-app-api/queries/ThemePage.generated.js');
|
|
29
|
+
var SaleFunnelDiscounts_generated = require('./graphql-app-api/queries/SaleFunnelDiscounts.generated.js');
|
|
30
|
+
var LibrarySaleFunnelDiscount_generated = require('./graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js');
|
|
29
31
|
var borders = require('./helpers/borders.js');
|
|
30
32
|
var carousel = require('./helpers/carousel.js');
|
|
31
33
|
var cls = require('./helpers/cls.js');
|
|
@@ -142,8 +144,10 @@ exports.PublishedThemePagesDocument = publishedThemePages_generated.PublishedThe
|
|
|
142
144
|
exports.ProductsDocument = products_generated.ProductsDocument;
|
|
143
145
|
exports.StorePropertyDocument = storeProperty_generated.StorePropertyDocument;
|
|
144
146
|
exports.PreviewPageDocument = previewPage_generated.PreviewPageDocument;
|
|
145
|
-
exports.ThemePageDocument = ThemePage_generated.ThemePageDocument;
|
|
146
147
|
exports.LibraryTemplateDocument = LibraryTemplate_generated.LibraryTemplateDocument;
|
|
148
|
+
exports.ThemePageDocument = ThemePage_generated.ThemePageDocument;
|
|
149
|
+
exports.SaleFunnelDiscountsDocument = SaleFunnelDiscounts_generated.SaleFunnelDiscountsDocument;
|
|
150
|
+
exports.LibrarySaleFunnelDocument = LibrarySaleFunnelDiscount_generated.LibrarySaleFunnelDocument;
|
|
147
151
|
exports.composeBorderCss = borders.composeBorderCss;
|
|
148
152
|
exports.getBorderStyle = borders.getBorderStyle;
|
|
149
153
|
exports.handleConvertBorderColor = borders.handleConvertBorderColor;
|
|
@@ -297,6 +301,7 @@ exports.useCollectionQuery = useCollectionQuery.useCollectionQuery;
|
|
|
297
301
|
exports.useCollectionsQuery = useCollectionsQuery.useCollectionsQuery;
|
|
298
302
|
exports.useProductQuery = useProductQuery.useProductQuery;
|
|
299
303
|
exports.useProductsQuery = useProductsQuery.useProductsQuery;
|
|
304
|
+
exports.useProductsQueryAll = useProductsQuery.useProductsQueryAll;
|
|
300
305
|
exports.useCurrentDevice = useCurrentDevice.useCurrentDevice;
|
|
301
306
|
exports.shopifyPriceRounding = useFormatMoney.shopifyPriceRounding;
|
|
302
307
|
exports.useFormatMoney = useFormatMoney.useFormatMoney;
|
|
@@ -10,6 +10,7 @@ const Render = ({ uid, ...passProps })=>{
|
|
|
10
10
|
const item = useBuilderStore((s)=>s.getItem(uid));
|
|
11
11
|
const Component = useBuilderComponent(item?.tag);
|
|
12
12
|
const isPostPurchase = useBuilderStore((s)=>s.getIsPostPurchase());
|
|
13
|
+
const isPreview = useBuilderStore((s)=>s.getIsPreview());
|
|
13
14
|
const pageType = useMemo(()=>{
|
|
14
15
|
return isPostPurchase ? 'POST_PURCHASE' : undefined;
|
|
15
16
|
}, [
|
|
@@ -41,7 +42,8 @@ const Render = ({ uid, ...passProps })=>{
|
|
|
41
42
|
children: item?.childrens?.length ? /*#__PURE__*/ jsx(Component, {
|
|
42
43
|
builderProps: {
|
|
43
44
|
uid,
|
|
44
|
-
builderData: item
|
|
45
|
+
builderData: item,
|
|
46
|
+
isPreview
|
|
45
47
|
},
|
|
46
48
|
styles: item.styles,
|
|
47
49
|
setting: item.settings,
|
|
@@ -52,7 +54,8 @@ const Render = ({ uid, ...passProps })=>{
|
|
|
52
54
|
}) : /*#__PURE__*/ jsx(Component, {
|
|
53
55
|
builderProps: {
|
|
54
56
|
uid,
|
|
55
|
-
builderData: item
|
|
57
|
+
builderData: item,
|
|
58
|
+
isPreview
|
|
56
59
|
},
|
|
57
60
|
styles: item.styles,
|
|
58
61
|
setting: item.settings,
|
|
@@ -3,17 +3,19 @@ import { useContext, createContext, Suspense, Fragment } from 'react';
|
|
|
3
3
|
import { useStore, createStore } from 'zustand';
|
|
4
4
|
|
|
5
5
|
const BuilderContext = /*#__PURE__*/ createContext(null);
|
|
6
|
-
const createBuilderProvider = (data, isPostPurchase)=>createStore((_, get)=>({
|
|
6
|
+
const createBuilderProvider = (data, isPostPurchase, isPreview)=>createStore((_, get)=>({
|
|
7
7
|
state: data,
|
|
8
8
|
isPostPurchase: isPostPurchase,
|
|
9
|
+
isPreview: isPreview,
|
|
9
10
|
getItem: (id)=>{
|
|
10
11
|
return get().state[id];
|
|
11
12
|
},
|
|
12
|
-
getIsPostPurchase: ()=>get().isPostPurchase
|
|
13
|
+
getIsPostPurchase: ()=>get().isPostPurchase,
|
|
14
|
+
getIsPreview: ()=>get().isPreview
|
|
13
15
|
}));
|
|
14
|
-
const BuilderProvider = ({ children, state, isPostPurchase, lazy, priority, ...passProps })=>{
|
|
16
|
+
const BuilderProvider = ({ children, state, isPostPurchase, isPreview, lazy, priority, ...passProps })=>{
|
|
15
17
|
const Component = lazy ? Suspense : Fragment;
|
|
16
|
-
const store = createBuilderProvider(state, isPostPurchase);
|
|
18
|
+
const store = createBuilderProvider(state, isPostPurchase, isPreview);
|
|
17
19
|
return /*#__PURE__*/ jsx(Component, {
|
|
18
20
|
children: /*#__PURE__*/ jsx(BuilderContext.Provider, {
|
|
19
21
|
...passProps,
|
|
@@ -24,15 +24,24 @@ const createPageStoreProvider = (data)=>createStore((set)=>({
|
|
|
24
24
|
set({
|
|
25
25
|
salePageProductId: id
|
|
26
26
|
});
|
|
27
|
+
},
|
|
28
|
+
setPublicStoreFrontData: (publicStoreFrontData)=>{
|
|
29
|
+
set({
|
|
30
|
+
publicStoreFrontData: publicStoreFrontData
|
|
31
|
+
});
|
|
27
32
|
}
|
|
28
33
|
}));
|
|
29
|
-
const PageProvider = ({ children, dynamicProduct, dynamicCollection, ...passProps })=>{
|
|
34
|
+
const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
|
|
30
35
|
const store = useMemo(()=>createPageStoreProvider({
|
|
31
36
|
dynamicProduct,
|
|
32
|
-
dynamicCollection
|
|
37
|
+
dynamicCollection,
|
|
38
|
+
productOffers,
|
|
39
|
+
publicStoreFrontData
|
|
33
40
|
}), [
|
|
34
41
|
dynamicProduct,
|
|
35
|
-
dynamicCollection
|
|
42
|
+
dynamicCollection,
|
|
43
|
+
productOffers,
|
|
44
|
+
publicStoreFrontData
|
|
36
45
|
]);
|
|
37
46
|
return /*#__PURE__*/ jsx(PageContext.Provider, {
|
|
38
47
|
...passProps,
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
/* eslint-disable */ const ProductSelect = `
|
|
2
2
|
fragment ProductSelect on Product {
|
|
3
3
|
...ProductLittleSelect
|
|
4
|
+
collections {
|
|
5
|
+
edges {
|
|
6
|
+
node {
|
|
7
|
+
id
|
|
8
|
+
title
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
tags
|
|
4
13
|
medias(first: $firstMedia, after: $afterMedia, orderBy: $orderByMedia) {
|
|
5
14
|
edges {
|
|
6
15
|
cursor
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable */ const LibrarySaleFunnelDocument = `
|
|
2
|
+
query LibrarySaleFunnel($librarySaleFunnelId: ID!) {
|
|
3
|
+
librarySaleFunnel(id: $librarySaleFunnelId) {
|
|
4
|
+
id
|
|
5
|
+
type
|
|
6
|
+
name
|
|
7
|
+
offers {
|
|
8
|
+
id
|
|
9
|
+
discounts {
|
|
10
|
+
id
|
|
11
|
+
objectBaseID
|
|
12
|
+
objectType
|
|
13
|
+
position
|
|
14
|
+
title
|
|
15
|
+
type
|
|
16
|
+
value
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export { LibrarySaleFunnelDocument };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable */ const SaleFunnelDiscountsDocument = `
|
|
2
|
+
query SaleFunnelDiscounts($where: SaleFunnelDiscountWhereInput, $orderBy: SaleFunnelDiscountOrder, $last: Int, $before: Cursor, $first: Int, $after: Cursor) {
|
|
3
|
+
saleFunnelDiscounts(
|
|
4
|
+
where: $where
|
|
5
|
+
orderBy: $orderBy
|
|
6
|
+
last: $last
|
|
7
|
+
before: $before
|
|
8
|
+
first: $first
|
|
9
|
+
after: $after
|
|
10
|
+
) {
|
|
11
|
+
edges {
|
|
12
|
+
node {
|
|
13
|
+
id
|
|
14
|
+
objectBaseID
|
|
15
|
+
objectType
|
|
16
|
+
position
|
|
17
|
+
title
|
|
18
|
+
type
|
|
19
|
+
value
|
|
20
|
+
valueType
|
|
21
|
+
isEnabled
|
|
22
|
+
}
|
|
23
|
+
cursor
|
|
24
|
+
}
|
|
25
|
+
pageInfo {
|
|
26
|
+
endCursor
|
|
27
|
+
hasNextPage
|
|
28
|
+
hasPreviousPage
|
|
29
|
+
startCursor
|
|
30
|
+
}
|
|
31
|
+
totalCount
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export { SaleFunnelDiscountsDocument };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */ const ThemePageDocument = `
|
|
2
|
-
query ThemePage($themePageId: ID
|
|
2
|
+
query ThemePage($themePageId: ID!, $first: Int, $where: ThemeStyleWhereInput) {
|
|
3
3
|
themePage(id: $themePageId) {
|
|
4
4
|
id
|
|
5
5
|
name
|
|
@@ -10,11 +10,19 @@
|
|
|
10
10
|
cid
|
|
11
11
|
component
|
|
12
12
|
id
|
|
13
|
+
deletedAt
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
theme {
|
|
15
16
|
id
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
themeStyles(first: $first, where: $where) {
|
|
18
|
+
edges {
|
|
19
|
+
node {
|
|
20
|
+
data
|
|
21
|
+
id
|
|
22
|
+
name
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
18
26
|
}
|
|
19
27
|
}
|
|
20
28
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
const globalEvent = {
|
|
2
|
-
subscribe (callback) {
|
|
3
|
-
document.addEventListener(
|
|
2
|
+
subscribe (eventName, callback) {
|
|
3
|
+
document.addEventListener(eventName, (e)=>callback(e.detail));
|
|
4
4
|
},
|
|
5
|
-
dispatch (
|
|
6
|
-
document.dispatchEvent(new CustomEvent(
|
|
7
|
-
detail
|
|
5
|
+
dispatch (eventName, detail) {
|
|
6
|
+
document.dispatchEvent(new CustomEvent(eventName, {
|
|
7
|
+
detail
|
|
8
8
|
}));
|
|
9
9
|
},
|
|
10
|
-
remove (callback) {
|
|
11
|
-
document.removeEventListener(
|
|
10
|
+
remove (eventName, callback) {
|
|
11
|
+
document.removeEventListener(eventName, callback);
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -55,6 +55,29 @@ const getProducts = async (fetcher, { ids, isSample, isStorefront, defaultSelect
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
|
+
const getProductQueryAll = async (fetcher, arg)=>{
|
|
59
|
+
const limit = arg?.limit || 4;
|
|
60
|
+
delete arg.limit;
|
|
61
|
+
const variables = {
|
|
62
|
+
first: limit,
|
|
63
|
+
firstMedia: 1,
|
|
64
|
+
firstVariant: 1,
|
|
65
|
+
orderBy: {
|
|
66
|
+
field: 'PLATFORM_CREATED_AT',
|
|
67
|
+
direction: 'DESC'
|
|
68
|
+
},
|
|
69
|
+
orderByMedia: {
|
|
70
|
+
field: 'POSITION',
|
|
71
|
+
direction: 'ASC'
|
|
72
|
+
},
|
|
73
|
+
where: {
|
|
74
|
+
status: 'ACTIVE',
|
|
75
|
+
...arg
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const pageData = await fetchProducts(fetcher, variables);
|
|
79
|
+
return pageData;
|
|
80
|
+
};
|
|
58
81
|
const fetchProducts = async (fetcher, variables)=>{
|
|
59
82
|
return fetcher([
|
|
60
83
|
ProductsDocument,
|
|
@@ -162,4 +185,4 @@ const mergeMediasToProducts = async ({ fetcher, products, isSample, isStorefront
|
|
|
162
185
|
// );
|
|
163
186
|
// };
|
|
164
187
|
|
|
165
|
-
export { getProducts };
|
|
188
|
+
export { getProductQueryAll, getProducts };
|