@gem-sdk/core 1.22.31-new-feature.3 → 1.22.31-staging.1
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/ComponentWrapperPreview.js +4 -26
- package/dist/cjs/components/Render.liquid.js +0 -8
- package/dist/cjs/components/RenderCustomCode.js +0 -2
- package/dist/cjs/contexts/BuilderPreviewContext.js +4 -24
- package/dist/cjs/contexts/ShopContext.js +0 -10
- package/dist/cjs/helpers/is-empty-children.js +1 -4
- package/dist/cjs/hooks/useProduct.js +1 -9
- package/dist/cjs/index.js +0 -2
- package/dist/esm/components/ComponentWrapperPreview.js +4 -26
- package/dist/esm/components/Render.liquid.js +0 -8
- package/dist/esm/components/RenderCustomCode.js +0 -2
- package/dist/esm/contexts/BuilderPreviewContext.js +4 -24
- package/dist/esm/contexts/ShopContext.js +0 -10
- package/dist/esm/helpers/is-empty-children.js +2 -5
- package/dist/esm/hooks/useProduct.js +1 -9
- package/dist/esm/index.js +0 -1
- package/dist/types/index.d.ts +4 -17
- package/package.json +3 -3
- package/dist/cjs/components/ComponentToolbarPreview.js +0 -362
- package/dist/cjs/components/theme-section/CreateThemeSection.js +0 -124
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +0 -95
- package/dist/cjs/helpers/filter-toolbar-preview.js +0 -14
- package/dist/esm/components/ComponentToolbarPreview.js +0 -360
- package/dist/esm/components/theme-section/CreateThemeSection.js +0 -122
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +0 -93
- package/dist/esm/helpers/filter-toolbar-preview.js +0 -9
|
@@ -7,16 +7,12 @@ var react = require('react');
|
|
|
7
7
|
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
8
8
|
var constant = require('./constant.js');
|
|
9
9
|
var RenderCustomCode = require('./RenderCustomCode.js');
|
|
10
|
-
var ComponentToolbarPreview = require('./ComponentToolbarPreview.js');
|
|
11
10
|
|
|
12
11
|
const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
13
12
|
if (props.type === 'section') {
|
|
14
13
|
return null;
|
|
15
14
|
}
|
|
16
15
|
const customProps = {};
|
|
17
|
-
if (props.tag === 'Section' && props.isThemeSection) {
|
|
18
|
-
customProps['data-theme-section'] = true;
|
|
19
|
-
}
|
|
20
16
|
// Build editor configs
|
|
21
17
|
if (props.editorConfigs) {
|
|
22
18
|
const editorConfigs = props.editorConfigs;
|
|
@@ -47,13 +43,6 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
47
43
|
if (editorConfigs.slots?.children) {
|
|
48
44
|
customProps['data-slots-children'] = true;
|
|
49
45
|
}
|
|
50
|
-
if (!editorConfigs.toolbar?.hide) {
|
|
51
|
-
customProps['data-toolbar-wrap'] = true;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
// Show toolbar wrapper
|
|
55
|
-
if (!props?.editorConfigs?.toolbar?.hide) {
|
|
56
|
-
customProps['data-toolbar-wrap'] = true;
|
|
57
46
|
}
|
|
58
47
|
const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag);
|
|
59
48
|
const advanced = props.advanced;
|
|
@@ -71,18 +60,12 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
71
60
|
uid: props.uid,
|
|
72
61
|
advanced: advanced
|
|
73
62
|
}),
|
|
74
|
-
/*#__PURE__*/ jsxRuntime.
|
|
63
|
+
/*#__PURE__*/ jsxRuntime.jsx(children.type, {
|
|
75
64
|
className: advanced?.cssClass,
|
|
76
65
|
...children.props,
|
|
77
66
|
style,
|
|
78
67
|
builderAttrs,
|
|
79
|
-
advanced
|
|
80
|
-
children: [
|
|
81
|
-
children.props['children'],
|
|
82
|
-
/*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.ComponentToolbarPreview, {
|
|
83
|
-
...props
|
|
84
|
-
})
|
|
85
|
-
]
|
|
68
|
+
advanced
|
|
86
69
|
})
|
|
87
70
|
]
|
|
88
71
|
});
|
|
@@ -94,16 +77,11 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
94
77
|
uid: props.uid,
|
|
95
78
|
advanced: advanced
|
|
96
79
|
}),
|
|
97
|
-
/*#__PURE__*/ jsxRuntime.
|
|
80
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
98
81
|
style: style,
|
|
99
82
|
className: `${props.uid} ${props.advanced?.cssClass ? props.advanced?.cssClass : ''}`,
|
|
100
83
|
...builderAttrs,
|
|
101
|
-
children:
|
|
102
|
-
children,
|
|
103
|
-
/*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.ComponentToolbarPreview, {
|
|
104
|
-
...props
|
|
105
|
-
})
|
|
106
|
-
]
|
|
84
|
+
children: children
|
|
107
85
|
})
|
|
108
86
|
]
|
|
109
87
|
});
|
|
@@ -3,15 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('react');
|
|
6
|
-
require('react/jsx-runtime');
|
|
7
|
-
require('zustand');
|
|
8
6
|
require('swr');
|
|
9
|
-
require('@gem-sdk/adapter-shopify');
|
|
10
|
-
require('swr/mutation');
|
|
11
|
-
require('vanilla-lazyload');
|
|
12
|
-
require('../hooks/useCartUI.js');
|
|
13
|
-
require('react-transition-group');
|
|
14
|
-
require('@gem-sdk/core');
|
|
15
7
|
var render = require('../helpers/render.js');
|
|
16
8
|
require('../helpers/convert.js');
|
|
17
9
|
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
@@ -13,8 +13,6 @@ require('swr/mutation');
|
|
|
13
13
|
var shop = require('../hooks/shop.js');
|
|
14
14
|
require('vanilla-lazyload');
|
|
15
15
|
require('../hooks/useCartUI.js');
|
|
16
|
-
require('react-transition-group');
|
|
17
|
-
require('@gem-sdk/core');
|
|
18
16
|
require('../helpers/convert.js');
|
|
19
17
|
|
|
20
18
|
const RenderCustomCode = ({ uid, advanced })=>{
|
|
@@ -28,10 +28,9 @@ const root = {
|
|
|
28
28
|
label: 'Root',
|
|
29
29
|
childrens: []
|
|
30
30
|
};
|
|
31
|
-
const createBuilderPreviewProvider = (args
|
|
31
|
+
const createBuilderPreviewProvider = (args)=>zustand.createStore((set, get)=>({
|
|
32
32
|
state: args,
|
|
33
33
|
loaded: false,
|
|
34
|
-
isEditThemeSection: !!isEditThemeSection,
|
|
35
34
|
addItem: (args)=>{
|
|
36
35
|
const { position, data } = args;
|
|
37
36
|
const state = get().state;
|
|
@@ -391,33 +390,14 @@ const createBuilderPreviewProvider = (args, isEditThemeSection)=>zustand.createS
|
|
|
391
390
|
ROOT: cloneDeep.cloneDeep(ROOT)
|
|
392
391
|
}
|
|
393
392
|
});
|
|
394
|
-
},
|
|
395
|
-
getParents: (id, limit)=>{
|
|
396
|
-
const state = get().state;
|
|
397
|
-
const parents = [];
|
|
398
|
-
let index = 0;
|
|
399
|
-
let currentId = id;
|
|
400
|
-
// eslint-disable-next-line no-constant-condition
|
|
401
|
-
while(true){
|
|
402
|
-
if (limit && index >= limit) break;
|
|
403
|
-
const parent = Object.entries(state).find(([, value])=>value.type !== 'section' && value.childrens?.includes(currentId));
|
|
404
|
-
if (!parent) break;
|
|
405
|
-
const [, parentItem] = parent;
|
|
406
|
-
if (!parentItem) break;
|
|
407
|
-
parents.push(parentItem);
|
|
408
|
-
currentId = parentItem.uid;
|
|
409
|
-
index++;
|
|
410
|
-
}
|
|
411
|
-
return parents;
|
|
412
393
|
}
|
|
413
394
|
}));
|
|
414
|
-
const BuilderPreviewProvider = ({ children, state,
|
|
395
|
+
const BuilderPreviewProvider = ({ children, state, lazy, ...passProps })=>{
|
|
415
396
|
const Component = lazy ? react.Suspense : react.Fragment;
|
|
416
397
|
const value = react.useMemo(()=>{
|
|
417
|
-
return createBuilderPreviewProvider(state
|
|
398
|
+
return createBuilderPreviewProvider(state);
|
|
418
399
|
}, [
|
|
419
|
-
state
|
|
420
|
-
isEditThemeSection
|
|
400
|
+
state
|
|
421
401
|
]);
|
|
422
402
|
return /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
423
403
|
children: /*#__PURE__*/ jsxRuntime.jsx(BuilderPreviewContext.Provider, {
|
|
@@ -37,16 +37,6 @@ const createShopStoreProvider = (data)=>zustand.createStore((set)=>({
|
|
|
37
37
|
storefrontUrl: url,
|
|
38
38
|
storefrontToken: token
|
|
39
39
|
});
|
|
40
|
-
},
|
|
41
|
-
changeCreateThemeSectionCount: (count)=>{
|
|
42
|
-
set({
|
|
43
|
-
createThemeSectionCount: count
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
changeShopPlan: (plan)=>{
|
|
47
|
-
set({
|
|
48
|
-
plan
|
|
49
|
-
});
|
|
50
40
|
}
|
|
51
41
|
}));
|
|
52
42
|
const ShopProvider = ({ children, addons, storeOption, queryOption, ...passProps })=>{
|
|
@@ -3,12 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var react = require('react');
|
|
6
|
-
var ComponentToolbarPreview = require('../components/ComponentToolbarPreview.js');
|
|
7
6
|
|
|
8
7
|
const isEmptyChildren = (children)=>{
|
|
9
|
-
|
|
10
|
-
arrChild = arrChild.filter((child)=>child?.type != ComponentToolbarPreview.ComponentToolbarPreview && react.isValidElement(child));
|
|
11
|
-
return react.Children.count(arrChild) < 1 || !children;
|
|
8
|
+
return react.Children.count(children) < 1 || !children;
|
|
12
9
|
};
|
|
13
10
|
|
|
14
11
|
exports.default = isEmptyChildren;
|
|
@@ -3,18 +3,10 @@
|
|
|
3
3
|
var react = require('react');
|
|
4
4
|
var ProductContext = require('../contexts/ProductContext.js');
|
|
5
5
|
var flattenConnection = require('../helpers/flatten-connection.js');
|
|
6
|
-
require('react/jsx-runtime');
|
|
7
|
-
require('zustand');
|
|
8
6
|
require('swr');
|
|
9
|
-
require('@gem-sdk/adapter-shopify');
|
|
10
|
-
require('swr/mutation');
|
|
11
|
-
require('vanilla-lazyload');
|
|
12
|
-
require('./useCartUI.js');
|
|
13
|
-
var variant = require('../helpers/variant.js');
|
|
14
|
-
require('react-transition-group');
|
|
15
|
-
require('@gem-sdk/core');
|
|
16
7
|
var product = require('../helpers/product.js');
|
|
17
8
|
require('../helpers/convert.js');
|
|
9
|
+
var variant = require('../helpers/variant.js');
|
|
18
10
|
|
|
19
11
|
const useUniqProductID = ()=>{
|
|
20
12
|
return ProductContext.useProductStore((s)=>s.uiqueId);
|
package/dist/cjs/index.js
CHANGED
|
@@ -32,7 +32,6 @@ var GlobalEvent = require('./helpers/GlobalEvent.js');
|
|
|
32
32
|
var isBrowser = require('./helpers/is-browser.js');
|
|
33
33
|
var isSafari = require('./helpers/is-safari.js');
|
|
34
34
|
var isEmptyChildren = require('./helpers/is-empty-children.js');
|
|
35
|
-
var filterToolbarPreview = require('./helpers/filter-toolbar-preview.js');
|
|
36
35
|
var makeStyle = require('./helpers/make-style.js');
|
|
37
36
|
var normalizeBuilderData = require('./helpers/normalize-builder-data.js');
|
|
38
37
|
var prefetchQueries = require('./helpers/prefetch-queries.js');
|
|
@@ -149,7 +148,6 @@ exports.globalEvent = GlobalEvent.default;
|
|
|
149
148
|
exports.isBrowser = isBrowser.default;
|
|
150
149
|
exports.isSafari = isSafari.default;
|
|
151
150
|
exports.isEmptyChildren = isEmptyChildren.isEmptyChildren;
|
|
152
|
-
exports.filterToolbarPreview = filterToolbarPreview.filterToolbarPreview;
|
|
153
151
|
exports.makeAspectRatio = makeStyle.makeAspectRatio;
|
|
154
152
|
exports.makeHeight = makeStyle.makeHeight;
|
|
155
153
|
exports.makeLineClamp = makeStyle.makeLineClamp;
|
|
@@ -3,16 +3,12 @@ import { isValidElement } from 'react';
|
|
|
3
3
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
4
4
|
import { disableWrap } from './constant.js';
|
|
5
5
|
import RenderCustomCode from './RenderCustomCode.js';
|
|
6
|
-
import { ComponentToolbarPreview } from './ComponentToolbarPreview.js';
|
|
7
6
|
|
|
8
7
|
const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
9
8
|
if (props.type === 'section') {
|
|
10
9
|
return null;
|
|
11
10
|
}
|
|
12
11
|
const customProps = {};
|
|
13
|
-
if (props.tag === 'Section' && props.isThemeSection) {
|
|
14
|
-
customProps['data-theme-section'] = true;
|
|
15
|
-
}
|
|
16
12
|
// Build editor configs
|
|
17
13
|
if (props.editorConfigs) {
|
|
18
14
|
const editorConfigs = props.editorConfigs;
|
|
@@ -43,13 +39,6 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
43
39
|
if (editorConfigs.slots?.children) {
|
|
44
40
|
customProps['data-slots-children'] = true;
|
|
45
41
|
}
|
|
46
|
-
if (!editorConfigs.toolbar?.hide) {
|
|
47
|
-
customProps['data-toolbar-wrap'] = true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// Show toolbar wrapper
|
|
51
|
-
if (!props?.editorConfigs?.toolbar?.hide) {
|
|
52
|
-
customProps['data-toolbar-wrap'] = true;
|
|
53
42
|
}
|
|
54
43
|
const style = composeAdvanceStyle(props.advanced, props.tag);
|
|
55
44
|
const advanced = props.advanced;
|
|
@@ -67,18 +56,12 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
67
56
|
uid: props.uid,
|
|
68
57
|
advanced: advanced
|
|
69
58
|
}),
|
|
70
|
-
/*#__PURE__*/
|
|
59
|
+
/*#__PURE__*/ jsx(children.type, {
|
|
71
60
|
className: advanced?.cssClass,
|
|
72
61
|
...children.props,
|
|
73
62
|
style,
|
|
74
63
|
builderAttrs,
|
|
75
|
-
advanced
|
|
76
|
-
children: [
|
|
77
|
-
children.props['children'],
|
|
78
|
-
/*#__PURE__*/ jsx(ComponentToolbarPreview, {
|
|
79
|
-
...props
|
|
80
|
-
})
|
|
81
|
-
]
|
|
64
|
+
advanced
|
|
82
65
|
})
|
|
83
66
|
]
|
|
84
67
|
});
|
|
@@ -90,16 +73,11 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
90
73
|
uid: props.uid,
|
|
91
74
|
advanced: advanced
|
|
92
75
|
}),
|
|
93
|
-
/*#__PURE__*/
|
|
76
|
+
/*#__PURE__*/ jsx("div", {
|
|
94
77
|
style: style,
|
|
95
78
|
className: `${props.uid} ${props.advanced?.cssClass ? props.advanced?.cssClass : ''}`,
|
|
96
79
|
...builderAttrs,
|
|
97
|
-
children:
|
|
98
|
-
children,
|
|
99
|
-
/*#__PURE__*/ jsx(ComponentToolbarPreview, {
|
|
100
|
-
...props
|
|
101
|
-
})
|
|
102
|
-
]
|
|
80
|
+
children: children
|
|
103
81
|
})
|
|
104
82
|
]
|
|
105
83
|
});
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
import 'react/jsx-runtime';
|
|
3
|
-
import 'zustand';
|
|
4
2
|
import 'swr';
|
|
5
|
-
import '@gem-sdk/adapter-shopify';
|
|
6
|
-
import 'swr/mutation';
|
|
7
|
-
import 'vanilla-lazyload';
|
|
8
|
-
import '../hooks/useCartUI.js';
|
|
9
|
-
import 'react-transition-group';
|
|
10
|
-
import '@gem-sdk/core';
|
|
11
3
|
import { RenderIf, template } from '../helpers/render.js';
|
|
12
4
|
import '../helpers/convert.js';
|
|
13
5
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
@@ -9,8 +9,6 @@ import 'swr/mutation';
|
|
|
9
9
|
import { useEditorMode } from '../hooks/shop.js';
|
|
10
10
|
import 'vanilla-lazyload';
|
|
11
11
|
import '../hooks/useCartUI.js';
|
|
12
|
-
import 'react-transition-group';
|
|
13
|
-
import '@gem-sdk/core';
|
|
14
12
|
import '../helpers/convert.js';
|
|
15
13
|
|
|
16
14
|
const RenderCustomCode = ({ uid, advanced })=>{
|
|
@@ -26,10 +26,9 @@ const root = {
|
|
|
26
26
|
label: 'Root',
|
|
27
27
|
childrens: []
|
|
28
28
|
};
|
|
29
|
-
const createBuilderPreviewProvider = (args
|
|
29
|
+
const createBuilderPreviewProvider = (args)=>createStore((set, get)=>({
|
|
30
30
|
state: args,
|
|
31
31
|
loaded: false,
|
|
32
|
-
isEditThemeSection: !!isEditThemeSection,
|
|
33
32
|
addItem: (args)=>{
|
|
34
33
|
const { position, data } = args;
|
|
35
34
|
const state = get().state;
|
|
@@ -389,33 +388,14 @@ const createBuilderPreviewProvider = (args, isEditThemeSection)=>createStore((se
|
|
|
389
388
|
ROOT: cloneDeep(ROOT)
|
|
390
389
|
}
|
|
391
390
|
});
|
|
392
|
-
},
|
|
393
|
-
getParents: (id, limit)=>{
|
|
394
|
-
const state = get().state;
|
|
395
|
-
const parents = [];
|
|
396
|
-
let index = 0;
|
|
397
|
-
let currentId = id;
|
|
398
|
-
// eslint-disable-next-line no-constant-condition
|
|
399
|
-
while(true){
|
|
400
|
-
if (limit && index >= limit) break;
|
|
401
|
-
const parent = Object.entries(state).find(([, value])=>value.type !== 'section' && value.childrens?.includes(currentId));
|
|
402
|
-
if (!parent) break;
|
|
403
|
-
const [, parentItem] = parent;
|
|
404
|
-
if (!parentItem) break;
|
|
405
|
-
parents.push(parentItem);
|
|
406
|
-
currentId = parentItem.uid;
|
|
407
|
-
index++;
|
|
408
|
-
}
|
|
409
|
-
return parents;
|
|
410
391
|
}
|
|
411
392
|
}));
|
|
412
|
-
const BuilderPreviewProvider = ({ children, state,
|
|
393
|
+
const BuilderPreviewProvider = ({ children, state, lazy, ...passProps })=>{
|
|
413
394
|
const Component = lazy ? Suspense : Fragment;
|
|
414
395
|
const value = useMemo(()=>{
|
|
415
|
-
return createBuilderPreviewProvider(state
|
|
396
|
+
return createBuilderPreviewProvider(state);
|
|
416
397
|
}, [
|
|
417
|
-
state
|
|
418
|
-
isEditThemeSection
|
|
398
|
+
state
|
|
419
399
|
]);
|
|
420
400
|
return /*#__PURE__*/ jsx(Component, {
|
|
421
401
|
children: /*#__PURE__*/ jsx(BuilderPreviewContext.Provider, {
|
|
@@ -35,16 +35,6 @@ const createShopStoreProvider = (data)=>createStore((set)=>({
|
|
|
35
35
|
storefrontUrl: url,
|
|
36
36
|
storefrontToken: token
|
|
37
37
|
});
|
|
38
|
-
},
|
|
39
|
-
changeCreateThemeSectionCount: (count)=>{
|
|
40
|
-
set({
|
|
41
|
-
createThemeSectionCount: count
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
changeShopPlan: (plan)=>{
|
|
45
|
-
set({
|
|
46
|
-
plan
|
|
47
|
-
});
|
|
48
38
|
}
|
|
49
39
|
}));
|
|
50
40
|
const ShopProvider = ({ children, addons, storeOption, queryOption, ...passProps })=>{
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { Children
|
|
2
|
-
import { ComponentToolbarPreview } from '../components/ComponentToolbarPreview.js';
|
|
1
|
+
import { Children } from 'react';
|
|
3
2
|
|
|
4
3
|
const isEmptyChildren = (children)=>{
|
|
5
|
-
|
|
6
|
-
arrChild = arrChild.filter((child)=>child?.type != ComponentToolbarPreview && isValidElement(child));
|
|
7
|
-
return Children.count(arrChild) < 1 || !children;
|
|
4
|
+
return Children.count(children) < 1 || !children;
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
export { isEmptyChildren as default, isEmptyChildren };
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
2
2
|
import { useProductStore } from '../contexts/ProductContext.js';
|
|
3
3
|
import { flattenConnection } from '../helpers/flatten-connection.js';
|
|
4
|
-
import 'react/jsx-runtime';
|
|
5
|
-
import 'zustand';
|
|
6
4
|
import 'swr';
|
|
7
|
-
import '@gem-sdk/adapter-shopify';
|
|
8
|
-
import 'swr/mutation';
|
|
9
|
-
import 'vanilla-lazyload';
|
|
10
|
-
import './useCartUI.js';
|
|
11
|
-
import { checkInStock } from '../helpers/variant.js';
|
|
12
|
-
import 'react-transition-group';
|
|
13
|
-
import '@gem-sdk/core';
|
|
14
5
|
import { getSelectedVariant } from '../helpers/product.js';
|
|
15
6
|
import '../helpers/convert.js';
|
|
7
|
+
import { checkInStock } from '../helpers/variant.js';
|
|
16
8
|
|
|
17
9
|
const useUniqProductID = ()=>{
|
|
18
10
|
return useProductStore((s)=>s.uiqueId);
|
package/dist/esm/index.js
CHANGED
|
@@ -30,7 +30,6 @@ export { default as globalEvent } from './helpers/GlobalEvent.js';
|
|
|
30
30
|
export { default as isBrowser } from './helpers/is-browser.js';
|
|
31
31
|
export { default as isSafari } from './helpers/is-safari.js';
|
|
32
32
|
export { isEmptyChildren } from './helpers/is-empty-children.js';
|
|
33
|
-
export { filterToolbarPreview } from './helpers/filter-toolbar-preview.js';
|
|
34
33
|
export { makeAspectRatio, makeHeight, makeLineClamp, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, removeNullUndefined } from './helpers/make-style.js';
|
|
35
34
|
export { normalizeBuilderData } from './helpers/normalize-builder-data.js';
|
|
36
35
|
export { prefetchQueries } from './helpers/prefetch-queries.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -37,16 +37,12 @@ type BlockEntity = {
|
|
|
37
37
|
styles?: Record<string, any>;
|
|
38
38
|
editorConfigs?: Record<string, any>;
|
|
39
39
|
type?: 'component';
|
|
40
|
-
name?: string;
|
|
41
|
-
isThemeSection?: boolean;
|
|
42
40
|
};
|
|
43
41
|
type SectionEntity = {
|
|
44
42
|
uid: string;
|
|
45
43
|
tag?: string;
|
|
46
44
|
label?: string;
|
|
47
45
|
type: 'section';
|
|
48
|
-
name?: string;
|
|
49
|
-
isThemeSection?: boolean;
|
|
50
46
|
};
|
|
51
47
|
type BuilderEntity = BlockEntity | SectionEntity;
|
|
52
48
|
type BuilderEntityNested = Omit<BlockEntity, 'childrens'> & {
|
|
@@ -7309,7 +7305,6 @@ declare const useBuilderStore: <U>(selector: (state: ExtractState<StoreApi<Build
|
|
|
7309
7305
|
type BuilderPreviewContextProps = {
|
|
7310
7306
|
state: BuilderState;
|
|
7311
7307
|
loaded?: boolean;
|
|
7312
|
-
isEditThemeSection?: boolean;
|
|
7313
7308
|
addItem: (args: {
|
|
7314
7309
|
data: BuilderEntityNested | BuilderEntityNested[];
|
|
7315
7310
|
type?: 'component' | 'section';
|
|
@@ -7330,13 +7325,11 @@ type BuilderPreviewContextProps = {
|
|
|
7330
7325
|
removeItem: (id: string) => void;
|
|
7331
7326
|
forceChangeState: (data: BuilderState) => void;
|
|
7332
7327
|
initState: (data: BuilderEntityNested | BuilderEntityNested[]) => void;
|
|
7333
|
-
getParents: (id: string, limit?: number) => BuilderEntity[];
|
|
7334
7328
|
};
|
|
7335
7329
|
type BuilderPreviewProviderProps = Pick<BuilderPreviewContextProps, 'state'> & {
|
|
7336
7330
|
children: React.ReactNode;
|
|
7337
7331
|
lazy?: boolean;
|
|
7338
7332
|
priority?: boolean;
|
|
7339
|
-
isEditThemeSection?: boolean;
|
|
7340
7333
|
};
|
|
7341
7334
|
declare const BuilderPreviewProvider: React.FC<BuilderPreviewProviderProps>;
|
|
7342
7335
|
declare const useBuilderPreviewStore: <U>(selector: (state: ExtractState<StoreApi<BuilderPreviewContextProps>>) => U, equalityFn?: ((a: U, b: U) => boolean) | undefined) => U;
|
|
@@ -7516,8 +7509,6 @@ type ShopContextProps = {
|
|
|
7516
7509
|
mobileOnly?: boolean;
|
|
7517
7510
|
swatches?: GlobalSwatchesData[];
|
|
7518
7511
|
isStorefront?: boolean;
|
|
7519
|
-
createThemeSectionCount?: number;
|
|
7520
|
-
plan?: string;
|
|
7521
7512
|
changeLocale: (locale: string) => void;
|
|
7522
7513
|
changeStorefrontInfo: (args: {
|
|
7523
7514
|
url?: string;
|
|
@@ -7526,14 +7517,12 @@ type ShopContextProps = {
|
|
|
7526
7517
|
changeCurrency: (currency: string) => void;
|
|
7527
7518
|
changeSwatches: (swatches: GlobalSwatchesData[]) => void;
|
|
7528
7519
|
changeLayoutSettings: (layoutSettings: LayoutSettings) => void;
|
|
7529
|
-
changeCreateThemeSectionCount: (count: number) => void;
|
|
7530
|
-
changeShopPlan: (plan: string) => void;
|
|
7531
7520
|
};
|
|
7532
7521
|
type ShopProviderProps = {
|
|
7533
7522
|
children: React.ReactNode;
|
|
7534
7523
|
key?: React.Key;
|
|
7535
7524
|
addons: AddonContextProps['components'];
|
|
7536
|
-
storeOption: Omit<ShopContextProps, 'changeLocale' | '
|
|
7525
|
+
storeOption: Omit<ShopContextProps, 'changeLocale' | 'changeCurrency' | 'changeSwatches' | 'changeLayoutSettings' | 'changeStorefrontInfo'>;
|
|
7537
7526
|
queryOption?: React.ComponentProps<typeof SWRConfig>['value'];
|
|
7538
7527
|
};
|
|
7539
7528
|
declare const ShopProvider: React.FC<ShopProviderProps>;
|
|
@@ -7825,8 +7814,6 @@ declare function isSafari(): boolean;
|
|
|
7825
7814
|
|
|
7826
7815
|
declare const isEmptyChildren: (children: React.ReactNode) => boolean;
|
|
7827
7816
|
|
|
7828
|
-
declare const filterToolbarPreview: (children: React.ReactNode, keep?: boolean) => React.ReactNode;
|
|
7829
|
-
|
|
7830
7817
|
type ResponsiveKey<T extends ShortHandProperty> = `--${T}` | `--${T}-tablet` | `--${T}-mobile`;
|
|
7831
7818
|
declare const removeNullUndefined: <T extends Record<string, any>>(obj: T) => T;
|
|
7832
7819
|
declare const makeStyle: <T extends ShortHandProperty, K>(style: Record<T, K>) => {
|
|
@@ -9705,11 +9692,11 @@ declare const useSelectedOption: () => {
|
|
|
9705
9692
|
forceSelectedOption: (selectedOption?: Record<string, string>, productId?: Maybe<string>, noEmit?: boolean) => void;
|
|
9706
9693
|
};
|
|
9707
9694
|
declare const useVariants: () => Maybe<Pick<ProductVariant, "title" | "width" | "length" | "weight" | "height" | "id" | "baseID" | "platform" | "sku" | "barcode" | "costPrice" | "inventoryPolicy" | "inventoryQuantity" | "inventoryStatus" | "isDigital" | "lowInventoryAmount" | "manageInventory" | "mediaId" | "price" | "salePrice" | "soldIndividually"> & {
|
|
9708
|
-
selectedOptions: Pick<SelectedOption, "
|
|
9695
|
+
selectedOptions: Pick<SelectedOption, "value" | "name" | "optionType">[];
|
|
9709
9696
|
media?: Maybe<Pick<Media, "width" | "height" | "id" | "src" | "alt" | "contentType" | "previewImage">>;
|
|
9710
9697
|
}>[];
|
|
9711
9698
|
declare const useVariant: (id: string) => Maybe<Pick<ProductVariant, "title" | "width" | "length" | "weight" | "height" | "id" | "baseID" | "platform" | "sku" | "barcode" | "costPrice" | "inventoryPolicy" | "inventoryQuantity" | "inventoryStatus" | "isDigital" | "lowInventoryAmount" | "manageInventory" | "mediaId" | "price" | "salePrice" | "soldIndividually"> & {
|
|
9712
|
-
selectedOptions: Pick<SelectedOption, "
|
|
9699
|
+
selectedOptions: Pick<SelectedOption, "value" | "name" | "optionType">[];
|
|
9713
9700
|
media?: Maybe<Pick<Media, "width" | "height" | "id" | "src" | "alt" | "contentType" | "previewImage">>;
|
|
9714
9701
|
}>;
|
|
9715
9702
|
declare const useCurrentVariant: () => Maybe<VariantSelectFragment>;
|
|
@@ -9758,4 +9745,4 @@ type PublishedThemePageSelectFragment = Pick<PublishedThemePage, 'id' | 'name' |
|
|
|
9758
9745
|
|
|
9759
9746
|
declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
|
|
9760
9747
|
|
|
9761
|
-
export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchCollectionArgs, FetchFunc, FetchProductParams, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, ImageShape$1 as ImageShape, InitComponentType, InstantJudgeMeReviewsWidgetType, InstantKlaviyoWidgetType, InstantLooxReviewsWidgetType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LaiProductReviewsWidgetType, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OptionNormalStyle, OptionSpecialStyle, PageContext, PageType, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, Ratio$1 as Ratio, RenderMemo as Render, RenderChildren, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeType, SpacingType, StampedWidgetType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TypographyProps, TypographySetting, TypographySettingV2, TypographyType, TypographyV2Attrs, TypographyV2Props, VariantSelectFragment, VitalsWidgetType, WiserWidgetType, WrapRenderChildren, baseAssetURL, calculateFirstProduct, checkAvailableVariantInStock, cls, composeAdvanceStyle, composeBackgroundCss, composeBorderCss, composeCornerCss, composeGridLayout, composeMemo, composeRadius, composeRadiusResponsive, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, convertOldLayout, dataStringify, fetchMedias, fetchVariants,
|
|
9748
|
+
export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchCollectionArgs, FetchFunc, FetchProductParams, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, ImageShape$1 as ImageShape, InitComponentType, InstantJudgeMeReviewsWidgetType, InstantKlaviyoWidgetType, InstantLooxReviewsWidgetType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LaiProductReviewsWidgetType, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OptionNormalStyle, OptionSpecialStyle, PageContext, PageType, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, Ratio$1 as Ratio, RenderMemo as Render, RenderChildren, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeType, SpacingType, StampedWidgetType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TypographyProps, TypographySetting, TypographySettingV2, TypographyType, TypographyV2Attrs, TypographyV2Props, VariantSelectFragment, VitalsWidgetType, WiserWidgetType, WrapRenderChildren, baseAssetURL, calculateFirstProduct, checkAvailableVariantInStock, cls, composeAdvanceStyle, composeBackgroundCss, composeBorderCss, composeCornerCss, composeGridLayout, composeMemo, composeRadius, composeRadiusResponsive, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, convertOldLayout, dataStringify, fetchMedias, fetchVariants, flattenConnection, fpixel, genSizeClass, genTypoClass, genVariable, generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey, getBorderStyle, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isColumnDirectionExist, isDefined, isEmptyChildren, isLocalEnv, isSafari, loadScript, makeAspectRatio, makeHeight, makeLineClamp, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, parseValueWithUnit, prefetchQueries, props, removeNullUndefined, splitStyle, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckAvailableVariantInStock, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useInitialSwatchesOptions, useIsSampleProduct, useIsStorefrontProduct, useIsSyncProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, useMoneyFormat, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "1.22.31-
|
|
3
|
+
"version": "1.22.31-staging.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"type-check": "yarn tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@gem-sdk/adapter-shopify": "1.22.31-staging.
|
|
28
|
-
"@gem-sdk/styles": "1.22.31-
|
|
27
|
+
"@gem-sdk/adapter-shopify": "1.22.31-staging.1",
|
|
28
|
+
"@gem-sdk/styles": "1.22.31-staging.1"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"react-error-boundary": "4.0.10",
|