@gem-sdk/core 1.22.21 → 1.22.31-new-feature.2
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/ComponentToolbarPreview.js +362 -0
- package/dist/cjs/components/ComponentWrapperPreview.js +26 -4
- package/dist/cjs/components/Render.liquid.js +8 -0
- package/dist/cjs/components/RenderCustomCode.js +2 -0
- package/dist/cjs/components/theme-section/CreateThemeSection.js +124 -0
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +95 -0
- package/dist/cjs/contexts/BuilderPreviewContext.js +24 -4
- package/dist/cjs/contexts/ShopContext.js +10 -0
- package/dist/cjs/helpers/filter-toolbar-preview.js +14 -0
- package/dist/cjs/helpers/is-empty-children.js +4 -1
- package/dist/cjs/hooks/useProduct.js +9 -1
- package/dist/cjs/index.js +2 -0
- package/dist/esm/components/ComponentToolbarPreview.js +360 -0
- package/dist/esm/components/ComponentWrapperPreview.js +26 -4
- package/dist/esm/components/Render.liquid.js +8 -0
- package/dist/esm/components/RenderCustomCode.js +2 -0
- package/dist/esm/components/theme-section/CreateThemeSection.js +122 -0
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +93 -0
- package/dist/esm/contexts/BuilderPreviewContext.js +24 -4
- package/dist/esm/contexts/ShopContext.js +10 -0
- package/dist/esm/helpers/filter-toolbar-preview.js +9 -0
- package/dist/esm/helpers/is-empty-children.js +5 -2
- package/dist/esm/hooks/useProduct.js +9 -1
- package/dist/esm/index.js +1 -0
- package/dist/types/index.d.ts +16 -3
- package/package.json +3 -3
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import 'zustand';
|
|
2
4
|
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';
|
|
3
11
|
import { RenderIf, template } from '../helpers/render.js';
|
|
4
12
|
import '../helpers/convert.js';
|
|
5
13
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
@@ -9,6 +9,8 @@ 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';
|
|
12
14
|
import '../helpers/convert.js';
|
|
13
15
|
|
|
14
16
|
const RenderCustomCode = ({ uid, advanced })=>{
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { ThemeSectionTooltip } from './ThemeSectionTooltip.js';
|
|
4
|
+
import 'zustand';
|
|
5
|
+
import { useShopStore } from '../../contexts/ShopContext.js';
|
|
6
|
+
import '@gem-sdk/adapter-shopify';
|
|
7
|
+
import 'swr';
|
|
8
|
+
import 'swr/mutation';
|
|
9
|
+
import 'vanilla-lazyload';
|
|
10
|
+
import '../../hooks/useCartUI.js';
|
|
11
|
+
import '../../helpers/convert.js';
|
|
12
|
+
|
|
13
|
+
const SHOW_TOOLTIP_TIMEOUT = 600;
|
|
14
|
+
const LIMIT_PLANS = [
|
|
15
|
+
'trial',
|
|
16
|
+
'trial2022'
|
|
17
|
+
];
|
|
18
|
+
const CreateThemeSection = ({ ...props })=>{
|
|
19
|
+
const isThemeSection = props.isThemeSection;
|
|
20
|
+
const shopPlan = useShopStore((s)=>s.plan);
|
|
21
|
+
const createThemeSectionCount = useShopStore((s)=>s.createThemeSectionCount);
|
|
22
|
+
const isLimit = LIMIT_PLANS.includes(shopPlan ?? '');
|
|
23
|
+
const isRenderTooltip = useMemo(()=>{
|
|
24
|
+
return createThemeSectionCount === undefined || createThemeSectionCount < 100;
|
|
25
|
+
}, [
|
|
26
|
+
createThemeSectionCount
|
|
27
|
+
]);
|
|
28
|
+
const isRenderCreateThemeSection = useMemo(()=>{
|
|
29
|
+
return props.tag === 'Section' && !isThemeSection;
|
|
30
|
+
}, [
|
|
31
|
+
props.tag,
|
|
32
|
+
isThemeSection
|
|
33
|
+
]);
|
|
34
|
+
const timeoutRef = useRef();
|
|
35
|
+
const [isShowTooltip, setIsShowTooltip] = useState(false);
|
|
36
|
+
const showTooltip = ()=>{
|
|
37
|
+
if (!isRenderTooltip) return;
|
|
38
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
39
|
+
timeoutRef.current = setTimeout(()=>{
|
|
40
|
+
setIsShowTooltip(true);
|
|
41
|
+
}, SHOW_TOOLTIP_TIMEOUT);
|
|
42
|
+
};
|
|
43
|
+
const hideTooltip = ()=>{
|
|
44
|
+
if (!isRenderTooltip) return;
|
|
45
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
46
|
+
setIsShowTooltip(false);
|
|
47
|
+
};
|
|
48
|
+
const onActions = (e)=>{
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
isLimit ? onUpgrade() : onCreate();
|
|
52
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
53
|
+
setIsShowTooltip(false);
|
|
54
|
+
return false;
|
|
55
|
+
};
|
|
56
|
+
const onUpgrade = ()=>{
|
|
57
|
+
const eventUpgrade = new CustomEvent('editor:toolbar:upgrade', {
|
|
58
|
+
bubbles: true
|
|
59
|
+
});
|
|
60
|
+
window.dispatchEvent(eventUpgrade);
|
|
61
|
+
};
|
|
62
|
+
const onCreate = ()=>{
|
|
63
|
+
const eventCreate = new CustomEvent('editor:toolbar:create-theme-section', {
|
|
64
|
+
bubbles: true,
|
|
65
|
+
detail: {
|
|
66
|
+
componentUid: props.uid
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
window.dispatchEvent(eventCreate);
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
72
|
+
children: /*#__PURE__*/ jsxs(ThemeSectionTooltip, {
|
|
73
|
+
isLimit: isLimit,
|
|
74
|
+
isShow: isShowTooltip,
|
|
75
|
+
isRender: isRenderTooltip,
|
|
76
|
+
onActions: onActions,
|
|
77
|
+
onMouseEnter: showTooltip,
|
|
78
|
+
onMouseLeave: hideTooltip,
|
|
79
|
+
children: [
|
|
80
|
+
isRenderCreateThemeSection && isRenderTooltip && /*#__PURE__*/ jsx("div", {
|
|
81
|
+
"data-toolbar-create-theme-section": true,
|
|
82
|
+
children: "You can create reusable sections"
|
|
83
|
+
}),
|
|
84
|
+
isRenderCreateThemeSection && /*#__PURE__*/ jsx("div", {
|
|
85
|
+
"data-toolbar-active-create-theme-section-wrapper": true,
|
|
86
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
87
|
+
"data-toolbar-active-create-theme-section": true,
|
|
88
|
+
onClick: (e)=>onActions(e),
|
|
89
|
+
"aria-hidden": "true",
|
|
90
|
+
children: [
|
|
91
|
+
/*#__PURE__*/ jsxs("svg", {
|
|
92
|
+
width: "16",
|
|
93
|
+
height: "16",
|
|
94
|
+
viewBox: "0 0 16 16",
|
|
95
|
+
fill: "none",
|
|
96
|
+
children: [
|
|
97
|
+
/*#__PURE__*/ jsx("path", {
|
|
98
|
+
d: "M1 2C1 1.44772 1.44772 1 2 1H6C6.55228 1 7 1.44772 7 2V6C7 6.55228 6.55228 7 6 7H2C1.44772 7 1 6.55228 1 6V2Z",
|
|
99
|
+
fill: "#F9F9F9"
|
|
100
|
+
}),
|
|
101
|
+
/*#__PURE__*/ jsx("path", {
|
|
102
|
+
d: "M9 10C9 9.44772 9.44772 9 10 9H14C14.5523 9 15 9.44772 15 10V14C15 14.5523 14.5523 15 14 15H10C9.44772 15 9 14.5523 9 14V10Z",
|
|
103
|
+
fill: "#F9F9F9"
|
|
104
|
+
}),
|
|
105
|
+
/*#__PURE__*/ jsx("path", {
|
|
106
|
+
d: "M2 9C1.44772 9 1 9.44772 1 10V14C1 14.5523 1.44772 15 2 15H6C6.55228 15 7 14.5523 7 14V10C7 9.44772 6.55228 9 6 9H2Z",
|
|
107
|
+
fill: "#F9F9F9"
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
}),
|
|
111
|
+
/*#__PURE__*/ jsx("p", {
|
|
112
|
+
children: "Create Theme section"
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
})
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export { CreateThemeSection };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { Transition } from 'react-transition-group';
|
|
4
|
+
import { cls } from '@gem-sdk/core';
|
|
5
|
+
|
|
6
|
+
const TRANSITION_DURATION = 350;
|
|
7
|
+
const defaultStyles = {
|
|
8
|
+
transition: `all ${TRANSITION_DURATION}ms ease-out`,
|
|
9
|
+
opacity: 0
|
|
10
|
+
};
|
|
11
|
+
const transitions = {
|
|
12
|
+
entering: {
|
|
13
|
+
opacity: 1
|
|
14
|
+
},
|
|
15
|
+
entered: {
|
|
16
|
+
opacity: 1
|
|
17
|
+
},
|
|
18
|
+
exiting: {
|
|
19
|
+
opacity: 0
|
|
20
|
+
},
|
|
21
|
+
exited: {
|
|
22
|
+
opacity: 0
|
|
23
|
+
},
|
|
24
|
+
unmounted: {
|
|
25
|
+
opacity: 0
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const ThemeSectionTooltip = ({ isShow, isLimit, isRender, children, onMouseEnter, onMouseLeave, onActions })=>{
|
|
29
|
+
const nodeRef = useRef(null);
|
|
30
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
31
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
32
|
+
className: "theme-section-tooltip-wrapper",
|
|
33
|
+
onMouseEnter: onMouseEnter,
|
|
34
|
+
onMouseLeave: onMouseLeave,
|
|
35
|
+
children: [
|
|
36
|
+
children,
|
|
37
|
+
isRender && /*#__PURE__*/ jsx(Transition, {
|
|
38
|
+
in: isShow,
|
|
39
|
+
timeout: TRANSITION_DURATION,
|
|
40
|
+
nodeRef: nodeRef,
|
|
41
|
+
unmountOnExit: true,
|
|
42
|
+
children: (state)=>/*#__PURE__*/ jsxs("div", {
|
|
43
|
+
className: "theme-section-tooltip",
|
|
44
|
+
ref: nodeRef,
|
|
45
|
+
style: {
|
|
46
|
+
...defaultStyles,
|
|
47
|
+
...transitions[state]
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ jsx("div", {
|
|
51
|
+
className: "theme-section-tooltip__image",
|
|
52
|
+
children: /*#__PURE__*/ jsx("img", {
|
|
53
|
+
src: "https://ucarecdn.com/6a9f408a-aa8c-434a-890b-81067a14aceb/-/format/auto/-/preview/1920x1920/-/quality/lighter/theme-section-illustration.png",
|
|
54
|
+
alt: ""
|
|
55
|
+
})
|
|
56
|
+
}),
|
|
57
|
+
/*#__PURE__*/ jsxs("div", {
|
|
58
|
+
className: "theme-section-tooltip__body",
|
|
59
|
+
children: [
|
|
60
|
+
/*#__PURE__*/ jsx("div", {
|
|
61
|
+
className: "theme-section-tooltip__body-title",
|
|
62
|
+
children: "Create once, use everywhere with Theme section"
|
|
63
|
+
}),
|
|
64
|
+
/*#__PURE__*/ jsx("div", {
|
|
65
|
+
className: "theme-section-tooltip__body-desc",
|
|
66
|
+
children: "A global section that can be used on all your GemPages & pages."
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
}),
|
|
70
|
+
/*#__PURE__*/ jsxs("div", {
|
|
71
|
+
className: cls('theme-section-tooltip__action', {
|
|
72
|
+
'theme-section-tooltip__action-limit': isLimit
|
|
73
|
+
}),
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ jsx("button", {
|
|
76
|
+
onClick: (e)=>onActions(e),
|
|
77
|
+
children: isLimit ? 'Upgrade to create Theme section' : 'Create theme section'
|
|
78
|
+
}),
|
|
79
|
+
isLimit && /*#__PURE__*/ jsx("div", {
|
|
80
|
+
className: "theme-section-tooltip__action-learn-more",
|
|
81
|
+
children: "Learn more about Theme section"
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
})
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export { ThemeSectionTooltip };
|
|
@@ -26,9 +26,10 @@ const root = {
|
|
|
26
26
|
label: 'Root',
|
|
27
27
|
childrens: []
|
|
28
28
|
};
|
|
29
|
-
const createBuilderPreviewProvider = (args)=>createStore((set, get)=>({
|
|
29
|
+
const createBuilderPreviewProvider = (args, isEditThemeSection)=>createStore((set, get)=>({
|
|
30
30
|
state: args,
|
|
31
31
|
loaded: false,
|
|
32
|
+
isEditThemeSection: !!isEditThemeSection,
|
|
32
33
|
addItem: (args)=>{
|
|
33
34
|
const { position, data } = args;
|
|
34
35
|
const state = get().state;
|
|
@@ -388,14 +389,33 @@ const createBuilderPreviewProvider = (args)=>createStore((set, get)=>({
|
|
|
388
389
|
ROOT: cloneDeep(ROOT)
|
|
389
390
|
}
|
|
390
391
|
});
|
|
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;
|
|
391
410
|
}
|
|
392
411
|
}));
|
|
393
|
-
const BuilderPreviewProvider = ({ children, state, lazy, ...passProps })=>{
|
|
412
|
+
const BuilderPreviewProvider = ({ children, state, isEditThemeSection, lazy, ...passProps })=>{
|
|
394
413
|
const Component = lazy ? Suspense : Fragment;
|
|
395
414
|
const value = useMemo(()=>{
|
|
396
|
-
return createBuilderPreviewProvider(state);
|
|
415
|
+
return createBuilderPreviewProvider(state, isEditThemeSection);
|
|
397
416
|
}, [
|
|
398
|
-
state
|
|
417
|
+
state,
|
|
418
|
+
isEditThemeSection
|
|
399
419
|
]);
|
|
400
420
|
return /*#__PURE__*/ jsx(Component, {
|
|
401
421
|
children: /*#__PURE__*/ jsx(BuilderPreviewContext.Provider, {
|
|
@@ -35,6 +35,16 @@ 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
|
+
});
|
|
38
48
|
}
|
|
39
49
|
}));
|
|
40
50
|
const ShopProvider = ({ children, addons, storeOption, queryOption, ...passProps })=>{
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Children } from 'react';
|
|
2
|
+
import { ComponentToolbarPreview } from '../components/ComponentToolbarPreview.js';
|
|
3
|
+
|
|
4
|
+
const filterToolbarPreview = (children, keep = false)=>{
|
|
5
|
+
const arrChild = Children.toArray(children);
|
|
6
|
+
return arrChild.filter((child)=>!keep ? child?.type != ComponentToolbarPreview : child?.type == ComponentToolbarPreview);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { filterToolbarPreview as default, filterToolbarPreview };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { Children } from 'react';
|
|
1
|
+
import { Children, isValidElement } from 'react';
|
|
2
|
+
import { ComponentToolbarPreview } from '../components/ComponentToolbarPreview.js';
|
|
2
3
|
|
|
3
4
|
const isEmptyChildren = (children)=>{
|
|
4
|
-
|
|
5
|
+
let arrChild = Children.toArray(children);
|
|
6
|
+
arrChild = arrChild.filter((child)=>child?.type != ComponentToolbarPreview && isValidElement(child));
|
|
7
|
+
return Children.count(arrChild) < 1 || !children;
|
|
5
8
|
};
|
|
6
9
|
|
|
7
10
|
export { isEmptyChildren as default, isEmptyChildren };
|
|
@@ -1,10 +1,18 @@
|
|
|
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';
|
|
4
6
|
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';
|
|
5
14
|
import { getSelectedVariant } from '../helpers/product.js';
|
|
6
15
|
import '../helpers/convert.js';
|
|
7
|
-
import { checkInStock } from '../helpers/variant.js';
|
|
8
16
|
|
|
9
17
|
const useUniqProductID = ()=>{
|
|
10
18
|
return useProductStore((s)=>s.uiqueId);
|
package/dist/esm/index.js
CHANGED
|
@@ -30,6 +30,7 @@ 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';
|
|
33
34
|
export { makeAspectRatio, makeHeight, makeLineClamp, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, removeNullUndefined } from './helpers/make-style.js';
|
|
34
35
|
export { normalizeBuilderData } from './helpers/normalize-builder-data.js';
|
|
35
36
|
export { prefetchQueries } from './helpers/prefetch-queries.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -37,12 +37,16 @@ type BlockEntity = {
|
|
|
37
37
|
styles?: Record<string, any>;
|
|
38
38
|
editorConfigs?: Record<string, any>;
|
|
39
39
|
type?: 'component';
|
|
40
|
+
name?: string;
|
|
41
|
+
isThemeSection?: boolean;
|
|
40
42
|
};
|
|
41
43
|
type SectionEntity = {
|
|
42
44
|
uid: string;
|
|
43
45
|
tag?: string;
|
|
44
46
|
label?: string;
|
|
45
47
|
type: 'section';
|
|
48
|
+
name?: string;
|
|
49
|
+
isThemeSection?: boolean;
|
|
46
50
|
};
|
|
47
51
|
type BuilderEntity = BlockEntity | SectionEntity;
|
|
48
52
|
type BuilderEntityNested = Omit<BlockEntity, 'childrens'> & {
|
|
@@ -7305,6 +7309,7 @@ declare const useBuilderStore: <U>(selector: (state: ExtractState<StoreApi<Build
|
|
|
7305
7309
|
type BuilderPreviewContextProps = {
|
|
7306
7310
|
state: BuilderState;
|
|
7307
7311
|
loaded?: boolean;
|
|
7312
|
+
isEditThemeSection?: boolean;
|
|
7308
7313
|
addItem: (args: {
|
|
7309
7314
|
data: BuilderEntityNested | BuilderEntityNested[];
|
|
7310
7315
|
type?: 'component' | 'section';
|
|
@@ -7325,11 +7330,13 @@ type BuilderPreviewContextProps = {
|
|
|
7325
7330
|
removeItem: (id: string) => void;
|
|
7326
7331
|
forceChangeState: (data: BuilderState) => void;
|
|
7327
7332
|
initState: (data: BuilderEntityNested | BuilderEntityNested[]) => void;
|
|
7333
|
+
getParents: (id: string, limit?: number) => BuilderEntity[];
|
|
7328
7334
|
};
|
|
7329
7335
|
type BuilderPreviewProviderProps = Pick<BuilderPreviewContextProps, 'state'> & {
|
|
7330
7336
|
children: React.ReactNode;
|
|
7331
7337
|
lazy?: boolean;
|
|
7332
7338
|
priority?: boolean;
|
|
7339
|
+
isEditThemeSection?: boolean;
|
|
7333
7340
|
};
|
|
7334
7341
|
declare const BuilderPreviewProvider: React.FC<BuilderPreviewProviderProps>;
|
|
7335
7342
|
declare const useBuilderPreviewStore: <U>(selector: (state: ExtractState<StoreApi<BuilderPreviewContextProps>>) => U, equalityFn?: ((a: U, b: U) => boolean) | undefined) => U;
|
|
@@ -7509,6 +7516,8 @@ type ShopContextProps = {
|
|
|
7509
7516
|
mobileOnly?: boolean;
|
|
7510
7517
|
swatches?: GlobalSwatchesData[];
|
|
7511
7518
|
isStorefront?: boolean;
|
|
7519
|
+
createThemeSectionCount?: number;
|
|
7520
|
+
plan?: string;
|
|
7512
7521
|
changeLocale: (locale: string) => void;
|
|
7513
7522
|
changeStorefrontInfo: (args: {
|
|
7514
7523
|
url?: string;
|
|
@@ -7517,6 +7526,8 @@ type ShopContextProps = {
|
|
|
7517
7526
|
changeCurrency: (currency: string) => void;
|
|
7518
7527
|
changeSwatches: (swatches: GlobalSwatchesData[]) => void;
|
|
7519
7528
|
changeLayoutSettings: (layoutSettings: LayoutSettings) => void;
|
|
7529
|
+
changeCreateThemeSectionCount: (count: number) => void;
|
|
7530
|
+
changeShopPlan: (plan: string) => void;
|
|
7520
7531
|
};
|
|
7521
7532
|
type ShopProviderProps = {
|
|
7522
7533
|
children: React.ReactNode;
|
|
@@ -7814,6 +7825,8 @@ declare function isSafari(): boolean;
|
|
|
7814
7825
|
|
|
7815
7826
|
declare const isEmptyChildren: (children: React.ReactNode) => boolean;
|
|
7816
7827
|
|
|
7828
|
+
declare const filterToolbarPreview: (children: React.ReactNode, keep?: boolean) => React.ReactNode;
|
|
7829
|
+
|
|
7817
7830
|
type ResponsiveKey<T extends ShortHandProperty> = `--${T}` | `--${T}-tablet` | `--${T}-mobile`;
|
|
7818
7831
|
declare const removeNullUndefined: <T extends Record<string, any>>(obj: T) => T;
|
|
7819
7832
|
declare const makeStyle: <T extends ShortHandProperty, K>(style: Record<T, K>) => {
|
|
@@ -9692,11 +9705,11 @@ declare const useSelectedOption: () => {
|
|
|
9692
9705
|
forceSelectedOption: (selectedOption?: Record<string, string>, productId?: Maybe<string>, noEmit?: boolean) => void;
|
|
9693
9706
|
};
|
|
9694
9707
|
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"> & {
|
|
9695
|
-
selectedOptions: Pick<SelectedOption, "
|
|
9708
|
+
selectedOptions: Pick<SelectedOption, "name" | "value" | "optionType">[];
|
|
9696
9709
|
media?: Maybe<Pick<Media, "width" | "height" | "id" | "src" | "alt" | "contentType" | "previewImage">>;
|
|
9697
9710
|
}>[];
|
|
9698
9711
|
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"> & {
|
|
9699
|
-
selectedOptions: Pick<SelectedOption, "
|
|
9712
|
+
selectedOptions: Pick<SelectedOption, "name" | "value" | "optionType">[];
|
|
9700
9713
|
media?: Maybe<Pick<Media, "width" | "height" | "id" | "src" | "alt" | "contentType" | "previewImage">>;
|
|
9701
9714
|
}>;
|
|
9702
9715
|
declare const useCurrentVariant: () => Maybe<VariantSelectFragment>;
|
|
@@ -9745,4 +9758,4 @@ type PublishedThemePageSelectFragment = Pick<PublishedThemePage, 'id' | 'name' |
|
|
|
9745
9758
|
|
|
9746
9759
|
declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
|
|
9747
9760
|
|
|
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 };
|
|
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, filterToolbarPreview, 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.
|
|
3
|
+
"version": "1.22.31-new-feature.2",
|
|
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.
|
|
28
|
-
"@gem-sdk/styles": "1.22.
|
|
27
|
+
"@gem-sdk/adapter-shopify": "1.22.31-staging.0",
|
|
28
|
+
"@gem-sdk/styles": "1.22.31-new-feature.2"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"react-error-boundary": "4.0.10",
|