@gem-sdk/core 1.43.0-dev.85 → 1.43.0-dev.87
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.liquid.js +1 -0
- package/dist/cjs/components/RenderCustomCode.js +1 -0
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +94 -47
- package/dist/cjs/components/ai-generator/components/PickProduct.js +1 -0
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +8 -1
- package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +27 -0
- package/dist/cjs/components/ai-generator/icons/WarningIcon.js +31 -0
- package/dist/cjs/components/resize/Spacing.js +1 -0
- package/dist/cjs/components/theme-section/CreateThemeSection.js +1 -0
- package/dist/cjs/contexts/ShopContext.js +18 -0
- package/dist/cjs/hooks/useAnimations.js +1 -0
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +1 -0
- package/dist/cjs/hooks/useProduct.js +1 -0
- package/dist/esm/components/Render.liquid.js +1 -0
- package/dist/esm/components/RenderCustomCode.js +1 -0
- package/dist/esm/components/ai-generator/AIContentGenerator.js +95 -48
- package/dist/esm/components/ai-generator/components/PickProduct.js +1 -0
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +8 -1
- package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +25 -0
- package/dist/esm/components/ai-generator/icons/WarningIcon.js +29 -0
- package/dist/esm/components/resize/Spacing.js +1 -0
- package/dist/esm/components/theme-section/CreateThemeSection.js +1 -0
- package/dist/esm/contexts/ShopContext.js +19 -1
- package/dist/esm/hooks/useAnimations.js +1 -0
- package/dist/esm/hooks/useInitialSwatchesOptions.js +1 -0
- package/dist/esm/hooks/useProduct.js +1 -0
- package/dist/types/index.d.ts +15 -1
- package/package.json +2 -1
|
@@ -16,6 +16,7 @@ require('react-transition-group');
|
|
|
16
16
|
require('@gem-sdk/core');
|
|
17
17
|
var constant = require('./constant.js');
|
|
18
18
|
require('classnames');
|
|
19
|
+
require('dayjs');
|
|
19
20
|
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
20
21
|
var convert = require('../helpers/convert.js');
|
|
21
22
|
var render = require('../helpers/render.js');
|
|
@@ -5,6 +5,8 @@ var react = require('react');
|
|
|
5
5
|
var AIIcon = require('./icons/AIIcon.js');
|
|
6
6
|
var CloseIcon = require('./icons/CloseIcon.js');
|
|
7
7
|
var ShowMoreIcon = require('./icons/ShowMoreIcon.js');
|
|
8
|
+
var WarningIcon = require('./icons/WarningIcon.js');
|
|
9
|
+
var UpgradeIcon = require('./icons/UpgradeIcon.js');
|
|
8
10
|
var PickProduct = require('./components/PickProduct.js');
|
|
9
11
|
var ToneAndVoice = require('./components/ToneAndVoice.js');
|
|
10
12
|
var classNames = require('classnames');
|
|
@@ -12,6 +14,18 @@ var useListenEventGenerate = require('./hooks/useListenEventGenerate.js');
|
|
|
12
14
|
var useGettingGenerateRequest = require('./hooks/useGettingGenerateRequest.js');
|
|
13
15
|
var useFlipPopup = require('./hooks/useFlipPopup.js');
|
|
14
16
|
var useCheckingProductInside = require('./hooks/useCheckingProductInside.js');
|
|
17
|
+
require('zustand');
|
|
18
|
+
var ShopContext = require('../../contexts/ShopContext.js');
|
|
19
|
+
require('@gem-sdk/adapter-shopify');
|
|
20
|
+
require('swr');
|
|
21
|
+
require('swr/mutation');
|
|
22
|
+
require('swr/infinite');
|
|
23
|
+
require('vanilla-lazyload');
|
|
24
|
+
require('../../hooks/useCartUI.js');
|
|
25
|
+
require('react-transition-group');
|
|
26
|
+
require('@gem-sdk/core');
|
|
27
|
+
var dayjs = require('dayjs');
|
|
28
|
+
require('../../helpers/convert.js');
|
|
15
29
|
|
|
16
30
|
const AIContentGenerator = ({ ...props })=>{
|
|
17
31
|
const [isShowPopup, setIsShowPopup] = react.useState(false);
|
|
@@ -20,18 +34,20 @@ const AIContentGenerator = ({ ...props })=>{
|
|
|
20
34
|
const genPopup = react.useRef(null);
|
|
21
35
|
const genPopupHeader = react.useRef(null);
|
|
22
36
|
const genButtonWrapper = react.useRef(null);
|
|
37
|
+
const nextMonth = dayjs().add(1, 'month').startOf('month').format('DD MMM');
|
|
23
38
|
const { popupPositionX, popupPositionY, isValidating: isValidatingFlipPopup, bodyMaxHeight: popupBodyMaxHeight } = useFlipPopup.useFlipPopup(isShowPopup, {
|
|
24
39
|
genTool,
|
|
25
40
|
genPopup,
|
|
26
41
|
genPopupHeader,
|
|
27
42
|
genButtonWrapper
|
|
28
43
|
});
|
|
29
|
-
const { isGenerating, onGenerate, onOpenProductElementSettings } = useListenEventGenerate.useListenEventGenerate({
|
|
44
|
+
const { isGenerating, onGenerate, onOpenProductElementSettings, goToPricing } = useListenEventGenerate.useListenEventGenerate({
|
|
30
45
|
uid: props.uid,
|
|
31
46
|
tag: String(props.tag)
|
|
32
47
|
});
|
|
33
48
|
const { getRequestBody, prompt, changeProductName, changePrompt, changeTone } = useGettingGenerateRequest.useGettingGenerateRequest();
|
|
34
49
|
const { productElement, checkSectionHasProduct } = useCheckingProductInside.useCheckingProductInside(genTool);
|
|
50
|
+
const generateLimitation = ShopContext.useShopStore((s)=>s.generateContentLimitation);
|
|
35
51
|
const togglePopup = ()=>{
|
|
36
52
|
setIsShowPopup(!isShowPopup);
|
|
37
53
|
};
|
|
@@ -130,70 +146,101 @@ const AIContentGenerator = ({ ...props })=>{
|
|
|
130
146
|
})
|
|
131
147
|
]
|
|
132
148
|
}),
|
|
133
|
-
/*#__PURE__*/ jsxRuntime.
|
|
149
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
134
150
|
className: classNames({
|
|
135
151
|
'gp-overflow-auto': popupBodyMaxHeight !== null
|
|
136
152
|
}, 'gp-pt-2 gp-text-left gp-px-4 scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl'),
|
|
137
153
|
style: {
|
|
138
154
|
maxHeight: popupBodyMaxHeight !== null ? `${popupBodyMaxHeight}px` : 'auto'
|
|
139
155
|
},
|
|
140
|
-
children:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}),
|
|
148
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
149
|
-
className: "gp-mb-4 gp-flex",
|
|
150
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("textarea", {
|
|
151
|
-
className: "gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",
|
|
152
|
-
placeholder: "e.g: generate feature benefits",
|
|
153
|
-
rows: 4,
|
|
154
|
-
value: prompt,
|
|
155
|
-
onChange: onChangePrompt
|
|
156
|
-
})
|
|
157
|
-
}),
|
|
158
|
-
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
159
|
-
className: classNames({
|
|
160
|
-
'gp-hidden': !isShowMore
|
|
161
|
-
}, 'gp-mb-4 gp-gap-4 gp-flex gp-flex-col'),
|
|
162
|
-
children: [
|
|
163
|
-
/*#__PURE__*/ jsxRuntime.jsx(ToneAndVoice.ToneAndVoice, {
|
|
164
|
-
changeToneAndVoice: changeTone
|
|
165
|
-
}),
|
|
166
|
-
/*#__PURE__*/ jsxRuntime.jsx(PickProduct.PickProduct, {
|
|
167
|
-
changeProductName: changeProductName,
|
|
168
|
-
openProductSetting: handleOpenProductSetting,
|
|
169
|
-
productId: productElement.productId
|
|
156
|
+
children: generateLimitation?.isAllow ? /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
157
|
+
children: [
|
|
158
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
159
|
+
className: "gp-mb-4",
|
|
160
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
161
|
+
className: "gp-text-xs",
|
|
162
|
+
children: "What would you like to describe here?"
|
|
170
163
|
})
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
164
|
+
}),
|
|
165
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
166
|
+
className: "gp-mb-4 gp-flex",
|
|
167
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("textarea", {
|
|
168
|
+
className: "gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",
|
|
169
|
+
placeholder: "e.g: generate feature benefits",
|
|
170
|
+
rows: 4,
|
|
171
|
+
value: prompt,
|
|
172
|
+
onChange: onChangePrompt
|
|
173
|
+
})
|
|
174
|
+
}),
|
|
175
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
176
|
+
className: classNames({
|
|
177
|
+
'gp-hidden': !isShowMore
|
|
178
|
+
}, 'gp-mb-4 gp-gap-4 gp-flex gp-flex-col'),
|
|
177
179
|
children: [
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
/*#__PURE__*/ jsxRuntime.jsx(ToneAndVoice.ToneAndVoice, {
|
|
181
|
+
changeToneAndVoice: changeTone
|
|
182
|
+
}),
|
|
183
|
+
/*#__PURE__*/ jsxRuntime.jsx(PickProduct.PickProduct, {
|
|
184
|
+
changeProductName: changeProductName,
|
|
185
|
+
openProductSetting: handleOpenProductSetting,
|
|
186
|
+
productId: productElement.productId
|
|
184
187
|
})
|
|
185
188
|
]
|
|
189
|
+
}),
|
|
190
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
191
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
192
|
+
className: "gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",
|
|
193
|
+
onClick: toggleShowMore,
|
|
194
|
+
children: [
|
|
195
|
+
"Show more",
|
|
196
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
197
|
+
className: classNames({
|
|
198
|
+
'gp-rotate-180': isShowMore
|
|
199
|
+
}),
|
|
200
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(ShowMoreIcon.ShowMoreIcon, {})
|
|
201
|
+
})
|
|
202
|
+
]
|
|
203
|
+
})
|
|
186
204
|
})
|
|
187
|
-
|
|
188
|
-
|
|
205
|
+
]
|
|
206
|
+
}) : /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
207
|
+
className: "gp-flex gp-gap-2 gp-p-3 gp-rounded-xl gp-bg-[#FDB913] gp-bg-opacity-20",
|
|
208
|
+
children: [
|
|
209
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
210
|
+
className: "gp-flex-none gp-w-7 gp-h-7 gp-rounded-lg gp-bg-[#FFB800] gp-flex gp-justify-center gp-items-center",
|
|
211
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(WarningIcon.WarningIcon, {})
|
|
212
|
+
}),
|
|
213
|
+
/*#__PURE__*/ jsxRuntime.jsxs("p", {
|
|
214
|
+
className: "gp-text-xs gp-whitespace-normal",
|
|
215
|
+
children: [
|
|
216
|
+
"You've reached ",
|
|
217
|
+
generateLimitation?.maxGenerateCount,
|
|
218
|
+
"/",
|
|
219
|
+
generateLimitation?.maxGenerateCount,
|
|
220
|
+
" rewrites of your AI generative this month.",
|
|
221
|
+
/*#__PURE__*/ jsxRuntime.jsx("br", {}),
|
|
222
|
+
"Resets on ",
|
|
223
|
+
nextMonth,
|
|
224
|
+
"."
|
|
225
|
+
]
|
|
226
|
+
})
|
|
227
|
+
]
|
|
228
|
+
})
|
|
189
229
|
}),
|
|
190
230
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
191
231
|
className: "gp-p-4",
|
|
192
232
|
ref: genButtonWrapper,
|
|
193
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
233
|
+
children: generateLimitation?.isAllow ? /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
194
234
|
className: "gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",
|
|
195
235
|
onClick: handleGenerateContent,
|
|
196
236
|
children: isGenerating ? 'Generating...' : 'Generate'
|
|
237
|
+
}) : /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
238
|
+
className: "gp-flex gp-items-center gp-gap-2 gp-justify-center gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",
|
|
239
|
+
onClick: goToPricing,
|
|
240
|
+
children: [
|
|
241
|
+
/*#__PURE__*/ jsxRuntime.jsx(UpgradeIcon.UpgradeIcon, {}),
|
|
242
|
+
generateLimitation?.nextQuota ? `Upgrade to generate ${generateLimitation?.nextQuota} rewrites` : 'You have reached limit this month'
|
|
243
|
+
]
|
|
197
244
|
})
|
|
198
245
|
})
|
|
199
246
|
]
|
|
@@ -45,6 +45,12 @@ const useListenEventGenerate = (componentInfo)=>{
|
|
|
45
45
|
});
|
|
46
46
|
window.dispatchEvent(eventCreate);
|
|
47
47
|
};
|
|
48
|
+
const goToPricing = ()=>{
|
|
49
|
+
const eventCreate = new CustomEvent('editor:toolbar:ai-gen-content-go-to-pricing', {
|
|
50
|
+
bubbles: true
|
|
51
|
+
});
|
|
52
|
+
window.dispatchEvent(eventCreate);
|
|
53
|
+
};
|
|
48
54
|
react.useEffect(()=>{
|
|
49
55
|
window.addEventListener('editor:ai-generate-content-status', onGenerateContentStatus);
|
|
50
56
|
return ()=>{
|
|
@@ -56,7 +62,8 @@ const useListenEventGenerate = (componentInfo)=>{
|
|
|
56
62
|
return {
|
|
57
63
|
isGenerating,
|
|
58
64
|
onGenerate,
|
|
59
|
-
onOpenProductElementSettings
|
|
65
|
+
onOpenProductElementSettings,
|
|
66
|
+
goToPricing
|
|
60
67
|
};
|
|
61
68
|
};
|
|
62
69
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
const UpgradeIcon = ()=>{
|
|
6
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
7
|
+
width: "16",
|
|
8
|
+
height: "16",
|
|
9
|
+
viewBox: "0 0 16 16",
|
|
10
|
+
fill: "none",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
14
|
+
d: "M4.5614 3.40226C4.75106 3.05549 5.2491 3.05549 5.43876 3.40226L5.59563 3.68909C5.76081 3.99112 6.00913 4.23944 6.31116 4.40462L6.59799 4.56149C6.94476 4.75115 6.94476 5.24919 6.59799 5.43885L6.31116 5.59572C6.00913 5.7609 5.76081 6.00923 5.59563 6.31125L5.43876 6.59808C5.2491 6.94485 4.75106 6.94485 4.5614 6.59808L4.40453 6.31125C4.23935 6.00923 3.99102 5.7609 3.689 5.59572L3.40217 5.43885C3.0554 5.24919 3.0554 4.75115 3.40217 4.56149L3.689 4.40462C3.99102 4.23944 4.23935 3.99112 4.40453 3.68909L4.5614 3.40226Z",
|
|
15
|
+
fill: "white"
|
|
16
|
+
}),
|
|
17
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
18
|
+
"fill-rule": "evenodd",
|
|
19
|
+
"clip-rule": "evenodd",
|
|
20
|
+
d: "M10.3586 6.31151C10.2145 5.37846 8.87693 5.36015 8.70733 6.2889L8.68345 6.41972C8.45531 7.66902 7.46634 8.63997 6.21306 8.84509C5.29358 8.99558 5.27456 10.3111 6.1893 10.4881L6.27325 10.5044C7.49956 10.7417 8.45849 11.7006 8.69579 12.9269L8.72136 13.0591C8.90841 14.0257 10.2917 14.0257 10.4788 13.0591L10.4987 12.9561C10.739 11.7146 11.7162 10.7476 12.9601 10.5204C13.9075 10.3474 13.8556 8.9775 12.9032 8.83444C11.5987 8.63847 10.56 7.61516 10.3586 6.31151ZM9.60348 11.8213C10.01 10.8962 10.7327 10.146 11.6365 9.70404C10.718 9.2961 9.96932 8.57183 9.53477 7.66527C9.12271 8.54399 8.41761 9.2538 7.54422 9.67221C8.46419 10.1164 9.19752 10.8797 9.60348 11.8213Z",
|
|
21
|
+
fill: "white"
|
|
22
|
+
})
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.UpgradeIcon = UpgradeIcon;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
const WarningIcon = ()=>{
|
|
6
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
7
|
+
width: "20",
|
|
8
|
+
height: "20",
|
|
9
|
+
viewBox: "0 0 20 20",
|
|
10
|
+
fill: "none",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
14
|
+
d: "M9.99997 6.75C10.4142 6.75 10.75 7.08579 10.75 7.5V11C10.75 11.4142 10.4142 11.75 9.99997 11.75C9.58576 11.75 9.24997 11.4142 9.24997 11V7.5C9.24997 7.08579 9.58576 6.75 9.99997 6.75Z",
|
|
15
|
+
fill: "#251A00"
|
|
16
|
+
}),
|
|
17
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
18
|
+
d: "M11 13.5C11 14.0523 10.5523 14.5 10 14.5C9.44775 14.5 9.00003 14.0523 9.00003 13.5C9.00003 12.9477 9.44775 12.5 10 12.5C10.5523 12.5 11 12.9477 11 13.5Z",
|
|
19
|
+
fill: "#251A00"
|
|
20
|
+
}),
|
|
21
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
22
|
+
"fill-rule": "evenodd",
|
|
23
|
+
"clip-rule": "evenodd",
|
|
24
|
+
d: "M10.0001 3.5C8.95474 3.5 8.21619 4.20232 7.84765 4.94672C7.65568 5.33448 6.75987 7.0441 5.84308 8.79353L5.81534 8.84646C4.92293 10.5493 4.01717 12.2777 3.80719 12.702C3.43513 13.4537 3.32934 14.4519 3.89956 15.316C4.46914 16.1791 5.44225 16.5 6.3636 16.5L13.6364 16.5C14.5577 16.5 15.5309 16.1791 16.1005 15.316C16.6707 14.4519 16.5649 13.4537 16.1928 12.702C15.9832 12.2784 15.08 10.555 14.189 8.85476L14.1569 8.79352C13.24 7.044 12.3443 5.33454 12.1525 4.94693C11.784 4.20242 11.0455 3.5 10.0001 3.5ZM9.19193 5.61225C9.59608 4.79592 10.4041 4.79592 10.8081 5.61225C11.0102 6.02061 11.9201 7.75686 12.8297 9.49243C13.7383 11.2262 14.6466 12.9594 14.8485 13.3673C15.2525 14.1837 14.8485 15 13.6364 15L6.3636 15C5.15153 15 4.74749 14.1837 5.15153 13.3673C5.35379 12.9587 6.26471 11.2205 7.17483 9.4838C8.08286 7.75111 8.99008 6.01994 9.19193 5.61225Z",
|
|
25
|
+
fill: "#251A00"
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.WarningIcon = WarningIcon;
|
|
@@ -53,6 +53,24 @@ const ShopProvider = ({ children, addons, storeOption, queryOption, ...passProps
|
|
|
53
53
|
const store = react.useMemo(()=>createShopStoreProvider(storeOption), [
|
|
54
54
|
storeOption
|
|
55
55
|
]);
|
|
56
|
+
const onUpdateLimitation = (e)=>{
|
|
57
|
+
const isAllow = !!e.detail?.isAllow;
|
|
58
|
+
const maxGenerateCount = e.detail?.maxGenerateCount;
|
|
59
|
+
const nextQuota = e.detail?.nextQuota;
|
|
60
|
+
store.setState({
|
|
61
|
+
generateContentLimitation: {
|
|
62
|
+
isAllow,
|
|
63
|
+
maxGenerateCount,
|
|
64
|
+
nextQuota
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
react.useEffect(()=>{
|
|
69
|
+
window.addEventListener('editor:ai-generate-content-update-limitation', onUpdateLimitation);
|
|
70
|
+
return ()=>{
|
|
71
|
+
window.removeEventListener('editor:ai-generate-content-update-limitation', onUpdateLimitation);
|
|
72
|
+
};
|
|
73
|
+
}, []);
|
|
56
74
|
return /*#__PURE__*/ jsxRuntime.jsx(AddonContext.AddonProvider, {
|
|
57
75
|
components: addons,
|
|
58
76
|
children: /*#__PURE__*/ jsxRuntime.jsx(useSWR.SWRConfig, {
|
|
@@ -15,6 +15,7 @@ var variant = require('../helpers/variant.js');
|
|
|
15
15
|
require('react-transition-group');
|
|
16
16
|
require('@gem-sdk/core');
|
|
17
17
|
require('classnames');
|
|
18
|
+
require('dayjs');
|
|
18
19
|
var flattenConnection = require('../helpers/flatten-connection.js');
|
|
19
20
|
require('../helpers/convert.js');
|
|
20
21
|
var product = require('../helpers/product.js');
|
|
@@ -12,6 +12,7 @@ import 'react-transition-group';
|
|
|
12
12
|
import '@gem-sdk/core';
|
|
13
13
|
import { disableWrap, customRenderChildren } from './constant.js';
|
|
14
14
|
import 'classnames';
|
|
15
|
+
import 'dayjs';
|
|
15
16
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
16
17
|
import { baseAssetURL, isLocalEnv } from '../helpers/convert.js';
|
|
17
18
|
import { RenderIf, template } from '../helpers/render.js';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
3
3
|
import { AIIcon } from './icons/AIIcon.js';
|
|
4
4
|
import { CloseIcon } from './icons/CloseIcon.js';
|
|
5
5
|
import { ShowMoreIcon } from './icons/ShowMoreIcon.js';
|
|
6
|
+
import { WarningIcon } from './icons/WarningIcon.js';
|
|
7
|
+
import { UpgradeIcon } from './icons/UpgradeIcon.js';
|
|
6
8
|
import { PickProduct } from './components/PickProduct.js';
|
|
7
9
|
import { ToneAndVoice } from './components/ToneAndVoice.js';
|
|
8
10
|
import classNames from 'classnames';
|
|
@@ -10,6 +12,18 @@ import { useListenEventGenerate } from './hooks/useListenEventGenerate.js';
|
|
|
10
12
|
import { useGettingGenerateRequest } from './hooks/useGettingGenerateRequest.js';
|
|
11
13
|
import { useFlipPopup } from './hooks/useFlipPopup.js';
|
|
12
14
|
import { useCheckingProductInside } from './hooks/useCheckingProductInside.js';
|
|
15
|
+
import 'zustand';
|
|
16
|
+
import { useShopStore } from '../../contexts/ShopContext.js';
|
|
17
|
+
import '@gem-sdk/adapter-shopify';
|
|
18
|
+
import 'swr';
|
|
19
|
+
import 'swr/mutation';
|
|
20
|
+
import 'swr/infinite';
|
|
21
|
+
import 'vanilla-lazyload';
|
|
22
|
+
import '../../hooks/useCartUI.js';
|
|
23
|
+
import 'react-transition-group';
|
|
24
|
+
import '@gem-sdk/core';
|
|
25
|
+
import dayjs from 'dayjs';
|
|
26
|
+
import '../../helpers/convert.js';
|
|
13
27
|
|
|
14
28
|
const AIContentGenerator = ({ ...props })=>{
|
|
15
29
|
const [isShowPopup, setIsShowPopup] = useState(false);
|
|
@@ -18,18 +32,20 @@ const AIContentGenerator = ({ ...props })=>{
|
|
|
18
32
|
const genPopup = useRef(null);
|
|
19
33
|
const genPopupHeader = useRef(null);
|
|
20
34
|
const genButtonWrapper = useRef(null);
|
|
35
|
+
const nextMonth = dayjs().add(1, 'month').startOf('month').format('DD MMM');
|
|
21
36
|
const { popupPositionX, popupPositionY, isValidating: isValidatingFlipPopup, bodyMaxHeight: popupBodyMaxHeight } = useFlipPopup(isShowPopup, {
|
|
22
37
|
genTool,
|
|
23
38
|
genPopup,
|
|
24
39
|
genPopupHeader,
|
|
25
40
|
genButtonWrapper
|
|
26
41
|
});
|
|
27
|
-
const { isGenerating, onGenerate, onOpenProductElementSettings } = useListenEventGenerate({
|
|
42
|
+
const { isGenerating, onGenerate, onOpenProductElementSettings, goToPricing } = useListenEventGenerate({
|
|
28
43
|
uid: props.uid,
|
|
29
44
|
tag: String(props.tag)
|
|
30
45
|
});
|
|
31
46
|
const { getRequestBody, prompt, changeProductName, changePrompt, changeTone } = useGettingGenerateRequest();
|
|
32
47
|
const { productElement, checkSectionHasProduct } = useCheckingProductInside(genTool);
|
|
48
|
+
const generateLimitation = useShopStore((s)=>s.generateContentLimitation);
|
|
33
49
|
const togglePopup = ()=>{
|
|
34
50
|
setIsShowPopup(!isShowPopup);
|
|
35
51
|
};
|
|
@@ -128,70 +144,101 @@ const AIContentGenerator = ({ ...props })=>{
|
|
|
128
144
|
})
|
|
129
145
|
]
|
|
130
146
|
}),
|
|
131
|
-
/*#__PURE__*/
|
|
147
|
+
/*#__PURE__*/ jsx("div", {
|
|
132
148
|
className: classNames({
|
|
133
149
|
'gp-overflow-auto': popupBodyMaxHeight !== null
|
|
134
150
|
}, 'gp-pt-2 gp-text-left gp-px-4 scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl'),
|
|
135
151
|
style: {
|
|
136
152
|
maxHeight: popupBodyMaxHeight !== null ? `${popupBodyMaxHeight}px` : 'auto'
|
|
137
153
|
},
|
|
138
|
-
children:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}),
|
|
146
|
-
/*#__PURE__*/ jsx("div", {
|
|
147
|
-
className: "gp-mb-4 gp-flex",
|
|
148
|
-
children: /*#__PURE__*/ jsx("textarea", {
|
|
149
|
-
className: "gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",
|
|
150
|
-
placeholder: "e.g: generate feature benefits",
|
|
151
|
-
rows: 4,
|
|
152
|
-
value: prompt,
|
|
153
|
-
onChange: onChangePrompt
|
|
154
|
-
})
|
|
155
|
-
}),
|
|
156
|
-
/*#__PURE__*/ jsxs("div", {
|
|
157
|
-
className: classNames({
|
|
158
|
-
'gp-hidden': !isShowMore
|
|
159
|
-
}, 'gp-mb-4 gp-gap-4 gp-flex gp-flex-col'),
|
|
160
|
-
children: [
|
|
161
|
-
/*#__PURE__*/ jsx(ToneAndVoice, {
|
|
162
|
-
changeToneAndVoice: changeTone
|
|
163
|
-
}),
|
|
164
|
-
/*#__PURE__*/ jsx(PickProduct, {
|
|
165
|
-
changeProductName: changeProductName,
|
|
166
|
-
openProductSetting: handleOpenProductSetting,
|
|
167
|
-
productId: productElement.productId
|
|
154
|
+
children: generateLimitation?.isAllow ? /*#__PURE__*/ jsxs(Fragment, {
|
|
155
|
+
children: [
|
|
156
|
+
/*#__PURE__*/ jsx("div", {
|
|
157
|
+
className: "gp-mb-4",
|
|
158
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
159
|
+
className: "gp-text-xs",
|
|
160
|
+
children: "What would you like to describe here?"
|
|
168
161
|
})
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
162
|
+
}),
|
|
163
|
+
/*#__PURE__*/ jsx("div", {
|
|
164
|
+
className: "gp-mb-4 gp-flex",
|
|
165
|
+
children: /*#__PURE__*/ jsx("textarea", {
|
|
166
|
+
className: "gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",
|
|
167
|
+
placeholder: "e.g: generate feature benefits",
|
|
168
|
+
rows: 4,
|
|
169
|
+
value: prompt,
|
|
170
|
+
onChange: onChangePrompt
|
|
171
|
+
})
|
|
172
|
+
}),
|
|
173
|
+
/*#__PURE__*/ jsxs("div", {
|
|
174
|
+
className: classNames({
|
|
175
|
+
'gp-hidden': !isShowMore
|
|
176
|
+
}, 'gp-mb-4 gp-gap-4 gp-flex gp-flex-col'),
|
|
175
177
|
children: [
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
/*#__PURE__*/ jsx(ToneAndVoice, {
|
|
179
|
+
changeToneAndVoice: changeTone
|
|
180
|
+
}),
|
|
181
|
+
/*#__PURE__*/ jsx(PickProduct, {
|
|
182
|
+
changeProductName: changeProductName,
|
|
183
|
+
openProductSetting: handleOpenProductSetting,
|
|
184
|
+
productId: productElement.productId
|
|
182
185
|
})
|
|
183
186
|
]
|
|
187
|
+
}),
|
|
188
|
+
/*#__PURE__*/ jsx("div", {
|
|
189
|
+
children: /*#__PURE__*/ jsxs("button", {
|
|
190
|
+
className: "gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",
|
|
191
|
+
onClick: toggleShowMore,
|
|
192
|
+
children: [
|
|
193
|
+
"Show more",
|
|
194
|
+
/*#__PURE__*/ jsx("span", {
|
|
195
|
+
className: classNames({
|
|
196
|
+
'gp-rotate-180': isShowMore
|
|
197
|
+
}),
|
|
198
|
+
children: /*#__PURE__*/ jsx(ShowMoreIcon, {})
|
|
199
|
+
})
|
|
200
|
+
]
|
|
201
|
+
})
|
|
184
202
|
})
|
|
185
|
-
|
|
186
|
-
|
|
203
|
+
]
|
|
204
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
205
|
+
className: "gp-flex gp-gap-2 gp-p-3 gp-rounded-xl gp-bg-[#FDB913] gp-bg-opacity-20",
|
|
206
|
+
children: [
|
|
207
|
+
/*#__PURE__*/ jsx("div", {
|
|
208
|
+
className: "gp-flex-none gp-w-7 gp-h-7 gp-rounded-lg gp-bg-[#FFB800] gp-flex gp-justify-center gp-items-center",
|
|
209
|
+
children: /*#__PURE__*/ jsx(WarningIcon, {})
|
|
210
|
+
}),
|
|
211
|
+
/*#__PURE__*/ jsxs("p", {
|
|
212
|
+
className: "gp-text-xs gp-whitespace-normal",
|
|
213
|
+
children: [
|
|
214
|
+
"You've reached ",
|
|
215
|
+
generateLimitation?.maxGenerateCount,
|
|
216
|
+
"/",
|
|
217
|
+
generateLimitation?.maxGenerateCount,
|
|
218
|
+
" rewrites of your AI generative this month.",
|
|
219
|
+
/*#__PURE__*/ jsx("br", {}),
|
|
220
|
+
"Resets on ",
|
|
221
|
+
nextMonth,
|
|
222
|
+
"."
|
|
223
|
+
]
|
|
224
|
+
})
|
|
225
|
+
]
|
|
226
|
+
})
|
|
187
227
|
}),
|
|
188
228
|
/*#__PURE__*/ jsx("div", {
|
|
189
229
|
className: "gp-p-4",
|
|
190
230
|
ref: genButtonWrapper,
|
|
191
|
-
children: /*#__PURE__*/ jsx("button", {
|
|
231
|
+
children: generateLimitation?.isAllow ? /*#__PURE__*/ jsx("button", {
|
|
192
232
|
className: "gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",
|
|
193
233
|
onClick: handleGenerateContent,
|
|
194
234
|
children: isGenerating ? 'Generating...' : 'Generate'
|
|
235
|
+
}) : /*#__PURE__*/ jsxs("button", {
|
|
236
|
+
className: "gp-flex gp-items-center gp-gap-2 gp-justify-center gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",
|
|
237
|
+
onClick: goToPricing,
|
|
238
|
+
children: [
|
|
239
|
+
/*#__PURE__*/ jsx(UpgradeIcon, {}),
|
|
240
|
+
generateLimitation?.nextQuota ? `Upgrade to generate ${generateLimitation?.nextQuota} rewrites` : 'You have reached limit this month'
|
|
241
|
+
]
|
|
195
242
|
})
|
|
196
243
|
})
|
|
197
244
|
]
|
|
@@ -43,6 +43,12 @@ const useListenEventGenerate = (componentInfo)=>{
|
|
|
43
43
|
});
|
|
44
44
|
window.dispatchEvent(eventCreate);
|
|
45
45
|
};
|
|
46
|
+
const goToPricing = ()=>{
|
|
47
|
+
const eventCreate = new CustomEvent('editor:toolbar:ai-gen-content-go-to-pricing', {
|
|
48
|
+
bubbles: true
|
|
49
|
+
});
|
|
50
|
+
window.dispatchEvent(eventCreate);
|
|
51
|
+
};
|
|
46
52
|
useEffect(()=>{
|
|
47
53
|
window.addEventListener('editor:ai-generate-content-status', onGenerateContentStatus);
|
|
48
54
|
return ()=>{
|
|
@@ -54,7 +60,8 @@ const useListenEventGenerate = (componentInfo)=>{
|
|
|
54
60
|
return {
|
|
55
61
|
isGenerating,
|
|
56
62
|
onGenerate,
|
|
57
|
-
onOpenProductElementSettings
|
|
63
|
+
onOpenProductElementSettings,
|
|
64
|
+
goToPricing
|
|
58
65
|
};
|
|
59
66
|
};
|
|
60
67
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
const UpgradeIcon = ()=>{
|
|
4
|
+
return /*#__PURE__*/ jsxs("svg", {
|
|
5
|
+
width: "16",
|
|
6
|
+
height: "16",
|
|
7
|
+
viewBox: "0 0 16 16",
|
|
8
|
+
fill: "none",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: [
|
|
11
|
+
/*#__PURE__*/ jsx("path", {
|
|
12
|
+
d: "M4.5614 3.40226C4.75106 3.05549 5.2491 3.05549 5.43876 3.40226L5.59563 3.68909C5.76081 3.99112 6.00913 4.23944 6.31116 4.40462L6.59799 4.56149C6.94476 4.75115 6.94476 5.24919 6.59799 5.43885L6.31116 5.59572C6.00913 5.7609 5.76081 6.00923 5.59563 6.31125L5.43876 6.59808C5.2491 6.94485 4.75106 6.94485 4.5614 6.59808L4.40453 6.31125C4.23935 6.00923 3.99102 5.7609 3.689 5.59572L3.40217 5.43885C3.0554 5.24919 3.0554 4.75115 3.40217 4.56149L3.689 4.40462C3.99102 4.23944 4.23935 3.99112 4.40453 3.68909L4.5614 3.40226Z",
|
|
13
|
+
fill: "white"
|
|
14
|
+
}),
|
|
15
|
+
/*#__PURE__*/ jsx("path", {
|
|
16
|
+
"fill-rule": "evenodd",
|
|
17
|
+
"clip-rule": "evenodd",
|
|
18
|
+
d: "M10.3586 6.31151C10.2145 5.37846 8.87693 5.36015 8.70733 6.2889L8.68345 6.41972C8.45531 7.66902 7.46634 8.63997 6.21306 8.84509C5.29358 8.99558 5.27456 10.3111 6.1893 10.4881L6.27325 10.5044C7.49956 10.7417 8.45849 11.7006 8.69579 12.9269L8.72136 13.0591C8.90841 14.0257 10.2917 14.0257 10.4788 13.0591L10.4987 12.9561C10.739 11.7146 11.7162 10.7476 12.9601 10.5204C13.9075 10.3474 13.8556 8.9775 12.9032 8.83444C11.5987 8.63847 10.56 7.61516 10.3586 6.31151ZM9.60348 11.8213C10.01 10.8962 10.7327 10.146 11.6365 9.70404C10.718 9.2961 9.96932 8.57183 9.53477 7.66527C9.12271 8.54399 8.41761 9.2538 7.54422 9.67221C8.46419 10.1164 9.19752 10.8797 9.60348 11.8213Z",
|
|
19
|
+
fill: "white"
|
|
20
|
+
})
|
|
21
|
+
]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { UpgradeIcon };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
const WarningIcon = ()=>{
|
|
4
|
+
return /*#__PURE__*/ jsxs("svg", {
|
|
5
|
+
width: "20",
|
|
6
|
+
height: "20",
|
|
7
|
+
viewBox: "0 0 20 20",
|
|
8
|
+
fill: "none",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: [
|
|
11
|
+
/*#__PURE__*/ jsx("path", {
|
|
12
|
+
d: "M9.99997 6.75C10.4142 6.75 10.75 7.08579 10.75 7.5V11C10.75 11.4142 10.4142 11.75 9.99997 11.75C9.58576 11.75 9.24997 11.4142 9.24997 11V7.5C9.24997 7.08579 9.58576 6.75 9.99997 6.75Z",
|
|
13
|
+
fill: "#251A00"
|
|
14
|
+
}),
|
|
15
|
+
/*#__PURE__*/ jsx("path", {
|
|
16
|
+
d: "M11 13.5C11 14.0523 10.5523 14.5 10 14.5C9.44775 14.5 9.00003 14.0523 9.00003 13.5C9.00003 12.9477 9.44775 12.5 10 12.5C10.5523 12.5 11 12.9477 11 13.5Z",
|
|
17
|
+
fill: "#251A00"
|
|
18
|
+
}),
|
|
19
|
+
/*#__PURE__*/ jsx("path", {
|
|
20
|
+
"fill-rule": "evenodd",
|
|
21
|
+
"clip-rule": "evenodd",
|
|
22
|
+
d: "M10.0001 3.5C8.95474 3.5 8.21619 4.20232 7.84765 4.94672C7.65568 5.33448 6.75987 7.0441 5.84308 8.79353L5.81534 8.84646C4.92293 10.5493 4.01717 12.2777 3.80719 12.702C3.43513 13.4537 3.32934 14.4519 3.89956 15.316C4.46914 16.1791 5.44225 16.5 6.3636 16.5L13.6364 16.5C14.5577 16.5 15.5309 16.1791 16.1005 15.316C16.6707 14.4519 16.5649 13.4537 16.1928 12.702C15.9832 12.2784 15.08 10.555 14.189 8.85476L14.1569 8.79352C13.24 7.044 12.3443 5.33454 12.1525 4.94693C11.784 4.20242 11.0455 3.5 10.0001 3.5ZM9.19193 5.61225C9.59608 4.79592 10.4041 4.79592 10.8081 5.61225C11.0102 6.02061 11.9201 7.75686 12.8297 9.49243C13.7383 11.2262 14.6466 12.9594 14.8485 13.3673C15.2525 14.1837 14.8485 15 13.6364 15L6.3636 15C5.15153 15 4.74749 14.1837 5.15153 13.3673C5.35379 12.9587 6.26471 11.2205 7.17483 9.4838C8.08286 7.75111 8.99008 6.01994 9.19193 5.61225Z",
|
|
23
|
+
fill: "#251A00"
|
|
24
|
+
})
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { WarningIcon };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { SWRConfig } from 'swr';
|
|
3
3
|
import { useStore, createStore } from 'zustand';
|
|
4
|
-
import { useMemo, useContext, createContext } from 'react';
|
|
4
|
+
import { useMemo, useEffect, useContext, createContext } from 'react';
|
|
5
5
|
import { AddonProvider } from './AddonContext.js';
|
|
6
6
|
import { ModalProvider } from './ModalContext.js';
|
|
7
7
|
|
|
@@ -51,6 +51,24 @@ const ShopProvider = ({ children, addons, storeOption, queryOption, ...passProps
|
|
|
51
51
|
const store = useMemo(()=>createShopStoreProvider(storeOption), [
|
|
52
52
|
storeOption
|
|
53
53
|
]);
|
|
54
|
+
const onUpdateLimitation = (e)=>{
|
|
55
|
+
const isAllow = !!e.detail?.isAllow;
|
|
56
|
+
const maxGenerateCount = e.detail?.maxGenerateCount;
|
|
57
|
+
const nextQuota = e.detail?.nextQuota;
|
|
58
|
+
store.setState({
|
|
59
|
+
generateContentLimitation: {
|
|
60
|
+
isAllow,
|
|
61
|
+
maxGenerateCount,
|
|
62
|
+
nextQuota
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
useEffect(()=>{
|
|
67
|
+
window.addEventListener('editor:ai-generate-content-update-limitation', onUpdateLimitation);
|
|
68
|
+
return ()=>{
|
|
69
|
+
window.removeEventListener('editor:ai-generate-content-update-limitation', onUpdateLimitation);
|
|
70
|
+
};
|
|
71
|
+
}, []);
|
|
54
72
|
return /*#__PURE__*/ jsx(AddonProvider, {
|
|
55
73
|
components: addons,
|
|
56
74
|
children: /*#__PURE__*/ jsx(SWRConfig, {
|
|
@@ -13,6 +13,7 @@ import { checkInStock } from '../helpers/variant.js';
|
|
|
13
13
|
import 'react-transition-group';
|
|
14
14
|
import '@gem-sdk/core';
|
|
15
15
|
import 'classnames';
|
|
16
|
+
import 'dayjs';
|
|
16
17
|
import { flattenConnection } from '../helpers/flatten-connection.js';
|
|
17
18
|
import '../helpers/convert.js';
|
|
18
19
|
import { getSelectedVariant } from '../helpers/product.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7763,7 +7763,16 @@ type ShapeSelectorControlType<T> = SharedControlType<T> & {
|
|
|
7763
7763
|
type: 'shape-selector';
|
|
7764
7764
|
};
|
|
7765
7765
|
|
|
7766
|
-
type
|
|
7766
|
+
type CustomPositionControlType<T> = SharedControlType<T> & {
|
|
7767
|
+
type: 'custom-position';
|
|
7768
|
+
ignoreValue?: string[];
|
|
7769
|
+
topGap?: string;
|
|
7770
|
+
leftGap?: string;
|
|
7771
|
+
rightGap?: string;
|
|
7772
|
+
bottomGap?: string;
|
|
7773
|
+
};
|
|
7774
|
+
|
|
7775
|
+
type ControlProp<T> = AngleControlType<T> | CheckboxControlType<T> | ColorPickerControlType<T> | GroupControlType<T> | IconControlType<T> | InputFixContentControlType<T> | InputNumberControlType<T> | InputUnitControlType<T> | InputUnitSpacingControlType<T> | InputUnitWidthControlType<T> | InputControlType<T> | MarginControlType<T> | PaddingControlType<T> | PositionControlType<T> | RadioGroupControlType | RangeControlType<T> | SegmentControlType<T> | OpenLinkControlType<T> | SelectControlType<T> | TextareaControlType<T> | ToggleControlType<T> | ImageControlType<T> | ChildrensControlType | GridControlType<T> | FlexControlType<T> | TextEditorControlType<T> | ProductControlType<T> | TypographyControlType<T> | TypographyV2ControlType<T> | MenuControlType<T> | BehaviorStateControlType<T> | PickLinkControlType<T> | BoxShadowControlType<T> | TextShadowControlType<T> | BorderControlType<T> | BorderRadiusControlType<T> | RadiusPresetControlType<T> | SizeControlType<T> | ChildItemType<T> | PickMultiProductControlType<T> | CollectionControlType<T> | BackgroundControlType<T> | VisibilityControlType<T> | SelectVariantControlType | CountdownEvergreenType | Timezone<T> | CustomContentControlType<T> | DateTimePickerControlType | CountdownDailyType | KlaviyoCodes | YotpoLoyaltyCodes | InputWidthControlType<T> | LayoutSegmentControlType<T> | InputSpacing<T> | UniqueIdControlType<T> | PositionSquareControlType<T> | CustomCodeEditor | LayoutControlType<T> | LayoutBannerControlType<T> | SwatchesLinkControlType<T> | VariantSwatchesPresetControlType<T> | VariantSwatchesOnlyDefaultVariantControlType<T> | ProductListControlType<T> | ArticleListControlType<T> | CollectionBannerControlType<T> | Ratio<T> | StickyDisplayControlType<T> | SyncProductPropertiesControlType<T> | StepsGuide<T> | ImageShape<T> | GridArrange<T> | SizeSetting$1<T> | ChildIconType<T> | DropdownInput<T> | Dropdown<T> | AliPickSectionControlType<T> | ParallaxScrollingType<T> | BackgroundColorPickerType<T> | PlayPauseControlType<T> | LayoutCustomSegmentControlType<T> | SneakPeakRange<T> | SneakPeakTypeControlType<T> | SneakPeakControlType<T> | ProductInputCurrencyUnitControlType<T> | TypographyPostPurchaseControlType<T> | ProductOffersControlType<T> | DiscountAndShippingFee<T> | PostPurchaseTextareaControlType<T> | NotesControlType<T> | NotesControlType<T> | ButtonLayoutType<T> | ShapeSelectorControlType<T> | CustomPositionControlType<T>;
|
|
7767
7776
|
type ControlTriggerAction = {
|
|
7768
7777
|
controlId: string;
|
|
7769
7778
|
newValue?: any;
|
|
@@ -27581,6 +27590,11 @@ type ShopContextProps = {
|
|
|
27581
27590
|
isStorefront?: boolean;
|
|
27582
27591
|
createThemeSectionCount?: number;
|
|
27583
27592
|
plan?: string;
|
|
27593
|
+
generateContentLimitation?: {
|
|
27594
|
+
isAllow: boolean;
|
|
27595
|
+
maxGenerateCount?: number;
|
|
27596
|
+
nextQuota?: number;
|
|
27597
|
+
};
|
|
27584
27598
|
changeLocale: (locale: string) => void;
|
|
27585
27599
|
changeStorefrontInfo: (args: {
|
|
27586
27600
|
url?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "1.43.0-dev.
|
|
3
|
+
"version": "1.43.0-dev.87",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"classnames": "^2.5.1",
|
|
36
|
+
"dayjs": "^1.11.11",
|
|
36
37
|
"react-error-boundary": "4.0.10",
|
|
37
38
|
"swr": "2.1.2",
|
|
38
39
|
"vanilla-lazyload": "17.8.3",
|