@gem-sdk/core 1.45.1-staging.0 → 1.45.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 +6 -1
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +1 -1
- package/dist/cjs/contexts/ModalContext.js +2 -2
- package/dist/esm/components/ComponentToolbarPreview.js +6 -1
- package/dist/esm/components/ai-generator/AIContentGenerator.js +1 -1
- package/dist/esm/contexts/ModalContext.js +2 -2
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -294,6 +294,11 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
294
294
|
const isEnableCreateThemeSection = ()=>{
|
|
295
295
|
return editingPageType !== 'STATIC' && editingPageType !== 'POST_PURCHASE';
|
|
296
296
|
};
|
|
297
|
+
const isEnableAIContent = ()=>{
|
|
298
|
+
const { isShopifySection, tag } = props;
|
|
299
|
+
if (isShopifySection || isThemeSection && !isThemeSectionEditor) return false;
|
|
300
|
+
return constant.ableGenerateContentElements.includes(tag);
|
|
301
|
+
};
|
|
297
302
|
// if (!isActive) return null;
|
|
298
303
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
299
304
|
children: [
|
|
@@ -459,7 +464,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
459
464
|
props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && !props.isShopifySection && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(CreateThemeSection.CreateThemeSection, {
|
|
460
465
|
...props
|
|
461
466
|
}),
|
|
462
|
-
|
|
467
|
+
isEnableAIContent() && /*#__PURE__*/ jsxRuntime.jsx(AIContentGenerator.AIContentGenerator, {
|
|
463
468
|
...props
|
|
464
469
|
}),
|
|
465
470
|
props.tag == 'Sticky' && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -108,7 +108,7 @@ const AIContentGenerator = ({ ...props })=>{
|
|
|
108
108
|
ref: genTool,
|
|
109
109
|
children: [
|
|
110
110
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
111
|
-
className: "gp-gen-content-toolbar gp-border-r
|
|
111
|
+
className: "gp-gen-content-toolbar gp-border-r gp-pr-1 gp-mr-1",
|
|
112
112
|
children: /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
113
113
|
className: classNames({
|
|
114
114
|
'gp-toolbar-ai-active': isShowPopup
|
|
@@ -7,8 +7,8 @@ var zustand = require('zustand');
|
|
|
7
7
|
const ModalContext = /*#__PURE__*/ react.createContext(null);
|
|
8
8
|
const createModalProvider = (data)=>zustand.createStore((set)=>({
|
|
9
9
|
activeId: data,
|
|
10
|
-
setModalActive: (id
|
|
11
|
-
|
|
10
|
+
setModalActive: (id)=>{
|
|
11
|
+
window?.parent?.postMessage?.(JSON.stringify({
|
|
12
12
|
type: 'active-element',
|
|
13
13
|
uid: id
|
|
14
14
|
}), '*');
|
|
@@ -290,6 +290,11 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
290
290
|
const isEnableCreateThemeSection = ()=>{
|
|
291
291
|
return editingPageType !== 'STATIC' && editingPageType !== 'POST_PURCHASE';
|
|
292
292
|
};
|
|
293
|
+
const isEnableAIContent = ()=>{
|
|
294
|
+
const { isShopifySection, tag } = props;
|
|
295
|
+
if (isShopifySection || isThemeSection && !isThemeSectionEditor) return false;
|
|
296
|
+
return ableGenerateContentElements.includes(tag);
|
|
297
|
+
};
|
|
293
298
|
// if (!isActive) return null;
|
|
294
299
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
295
300
|
children: [
|
|
@@ -455,7 +460,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
455
460
|
props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && !props.isShopifySection && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsx(CreateThemeSection, {
|
|
456
461
|
...props
|
|
457
462
|
}),
|
|
458
|
-
|
|
463
|
+
isEnableAIContent() && /*#__PURE__*/ jsx(AIContentGenerator, {
|
|
459
464
|
...props
|
|
460
465
|
}),
|
|
461
466
|
props.tag == 'Sticky' && /*#__PURE__*/ jsx("div", {
|
|
@@ -106,7 +106,7 @@ const AIContentGenerator = ({ ...props })=>{
|
|
|
106
106
|
ref: genTool,
|
|
107
107
|
children: [
|
|
108
108
|
/*#__PURE__*/ jsx("div", {
|
|
109
|
-
className: "gp-gen-content-toolbar gp-border-r
|
|
109
|
+
className: "gp-gen-content-toolbar gp-border-r gp-pr-1 gp-mr-1",
|
|
110
110
|
children: /*#__PURE__*/ jsxs("button", {
|
|
111
111
|
className: classNames({
|
|
112
112
|
'gp-toolbar-ai-active': isShowPopup
|
|
@@ -5,8 +5,8 @@ import { useStore, createStore } from 'zustand';
|
|
|
5
5
|
const ModalContext = /*#__PURE__*/ createContext(null);
|
|
6
6
|
const createModalProvider = (data)=>createStore((set)=>({
|
|
7
7
|
activeId: data,
|
|
8
|
-
setModalActive: (id
|
|
9
|
-
|
|
8
|
+
setModalActive: (id)=>{
|
|
9
|
+
window?.parent?.postMessage?.(JSON.stringify({
|
|
10
10
|
type: 'active-element',
|
|
11
11
|
uid: id
|
|
12
12
|
}), '*');
|
package/dist/types/index.d.ts
CHANGED
|
@@ -28850,7 +28850,7 @@ declare const useCollectionStore: <U>(selector: (state: ExtractState<StoreApi<Co
|
|
|
28850
28850
|
|
|
28851
28851
|
type ModalContextProps = {
|
|
28852
28852
|
activeId?: string;
|
|
28853
|
-
setModalActive: (id?: string
|
|
28853
|
+
setModalActive: (id?: string) => void;
|
|
28854
28854
|
clearModal: () => void;
|
|
28855
28855
|
};
|
|
28856
28856
|
type ModalProviderProps = Pick<ModalContextProps, 'activeId'> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "1.45.
|
|
3
|
+
"version": "1.45.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@gem-sdk/adapter-shopify": "1.45.0",
|
|
31
|
-
"@gem-sdk/styles": "1.45.
|
|
31
|
+
"@gem-sdk/styles": "1.45.2",
|
|
32
32
|
"@types/classnames": "^2.3.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|