@gem-sdk/core 1.34.6 → 1.35.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/resize/Spacing.js +1 -1
- package/dist/cjs/contexts/ProductContext.js +5 -0
- package/dist/cjs/helpers/colors.js +1 -1
- package/dist/cjs/helpers/size.js +1 -1
- package/dist/cjs/helpers/typography.js +1 -1
- package/dist/cjs/hooks/useProduct.js +8 -2
- package/dist/esm/components/resize/Spacing.js +1 -1
- package/dist/esm/contexts/ProductContext.js +5 -0
- package/dist/esm/helpers/colors.js +1 -1
- package/dist/esm/helpers/size.js +1 -1
- package/dist/esm/helpers/typography.js +1 -1
- package/dist/esm/hooks/useProduct.js +8 -2
- package/dist/types/index.d.ts +6 -2
- package/package.json +2 -2
|
@@ -195,7 +195,7 @@ function Spacing(props) {
|
|
|
195
195
|
children: props.tag !== 'Section' && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
196
196
|
"data-spacing": true,
|
|
197
197
|
"data-spacing-theme-section": isThemeSectionEditor,
|
|
198
|
-
className: "absolute w-full bottom-0",
|
|
198
|
+
className: "gp-absolute gp-w-full gp-bottom-0",
|
|
199
199
|
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
200
200
|
"data-spacing-margin-bottom": true,
|
|
201
201
|
children: [
|
|
@@ -94,6 +94,11 @@ const createProductStoreProvider = (data)=>zustand.createStore((set, get)=>({
|
|
|
94
94
|
set({
|
|
95
95
|
isSubmit: value
|
|
96
96
|
});
|
|
97
|
+
},
|
|
98
|
+
setHasUpdatePriceFollowQuantity: (updatePrice)=>{
|
|
99
|
+
set({
|
|
100
|
+
updatePrice
|
|
101
|
+
});
|
|
97
102
|
}
|
|
98
103
|
}));
|
|
99
104
|
const ProductProvider = ({ children, product, initialVariantId, quantity = 1, isSyncProduct })=>{
|
|
@@ -8,7 +8,7 @@ const getGlobalColorCSSProp = (color)=>{
|
|
|
8
8
|
};
|
|
9
9
|
const getGlobalColorClass = (type, color)=>{
|
|
10
10
|
if (typeof color !== 'string' || !color || color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent')) return '';
|
|
11
|
-
return
|
|
11
|
+
return `gp-${type}-g-${color}`;
|
|
12
12
|
};
|
|
13
13
|
const getGlobalColorResponsiveClass = (type, data)=>{
|
|
14
14
|
if (!data) return '';
|
package/dist/cjs/helpers/size.js
CHANGED
|
@@ -18,7 +18,7 @@ const composeSize = (size)=>{
|
|
|
18
18
|
return Object.assign({}, getCustomSizeCSSByDevice(size, 'desktop'), getCustomSizeCSSByDevice(size, 'tablet'), getCustomSizeCSSByDevice(size, 'mobile'));
|
|
19
19
|
};
|
|
20
20
|
function genSizeClass(name) {
|
|
21
|
-
return `g-s-${name}`;
|
|
21
|
+
return `gp-g-s-${name}`;
|
|
22
22
|
}
|
|
23
23
|
const composeSizeCss = (spacing)=>{
|
|
24
24
|
if (spacing === undefined) return '';
|
|
@@ -33,9 +33,11 @@ const useIsSyncProduct = ()=>{
|
|
|
33
33
|
};
|
|
34
34
|
const useQuantity = ()=>{
|
|
35
35
|
const quantity = ProductContext.useProductStore((s)=>s.quantity);
|
|
36
|
+
const hasUpdatePrice = ProductContext.useProductStore((s)=>s.updatePrice);
|
|
36
37
|
const decrement = ProductContext.useProductStore((s)=>s.decrementQuantity);
|
|
37
38
|
const increment = ProductContext.useProductStore((s)=>s.incrementQuantity);
|
|
38
39
|
const updateQuantity = ProductContext.useProductStore((s)=>s.setQuantity);
|
|
40
|
+
const updatePrice = ProductContext.useProductStore((s)=>s.setHasUpdatePriceFollowQuantity);
|
|
39
41
|
const isSyncProduct = ProductContext.useProductStore((s)=>s.isSyncProduct);
|
|
40
42
|
const product = ProductContext.useProductStore((s)=>s.product);
|
|
41
43
|
const productId = product?.id;
|
|
@@ -64,16 +66,20 @@ const useQuantity = ()=>{
|
|
|
64
66
|
]);
|
|
65
67
|
return react.useMemo(()=>({
|
|
66
68
|
quantity,
|
|
69
|
+
hasUpdatePrice,
|
|
67
70
|
increment,
|
|
68
71
|
decrement,
|
|
69
72
|
reset,
|
|
70
|
-
setQuantity: updateQuantity
|
|
73
|
+
setQuantity: updateQuantity,
|
|
74
|
+
setUpdatePrice: updatePrice
|
|
71
75
|
}), [
|
|
72
76
|
decrement,
|
|
73
77
|
increment,
|
|
74
78
|
quantity,
|
|
75
79
|
reset,
|
|
76
|
-
updateQuantity
|
|
80
|
+
updateQuantity,
|
|
81
|
+
updatePrice,
|
|
82
|
+
hasUpdatePrice
|
|
77
83
|
]);
|
|
78
84
|
};
|
|
79
85
|
const useSelectedOption = ()=>{
|
|
@@ -191,7 +191,7 @@ function Spacing(props) {
|
|
|
191
191
|
children: props.tag !== 'Section' && /*#__PURE__*/ jsx("div", {
|
|
192
192
|
"data-spacing": true,
|
|
193
193
|
"data-spacing-theme-section": isThemeSectionEditor,
|
|
194
|
-
className: "absolute w-full bottom-0",
|
|
194
|
+
className: "gp-absolute gp-w-full gp-bottom-0",
|
|
195
195
|
children: /*#__PURE__*/ jsxs("div", {
|
|
196
196
|
"data-spacing-margin-bottom": true,
|
|
197
197
|
children: [
|
|
@@ -92,6 +92,11 @@ const createProductStoreProvider = (data)=>createStore((set, get)=>({
|
|
|
92
92
|
set({
|
|
93
93
|
isSubmit: value
|
|
94
94
|
});
|
|
95
|
+
},
|
|
96
|
+
setHasUpdatePriceFollowQuantity: (updatePrice)=>{
|
|
97
|
+
set({
|
|
98
|
+
updatePrice
|
|
99
|
+
});
|
|
95
100
|
}
|
|
96
101
|
}));
|
|
97
102
|
const ProductProvider = ({ children, product, initialVariantId, quantity = 1, isSyncProduct })=>{
|
|
@@ -6,7 +6,7 @@ const getGlobalColorCSSProp = (color)=>{
|
|
|
6
6
|
};
|
|
7
7
|
const getGlobalColorClass = (type, color)=>{
|
|
8
8
|
if (typeof color !== 'string' || !color || color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent')) return '';
|
|
9
|
-
return
|
|
9
|
+
return `gp-${type}-g-${color}`;
|
|
10
10
|
};
|
|
11
11
|
const getGlobalColorResponsiveClass = (type, data)=>{
|
|
12
12
|
if (!data) return '';
|
package/dist/esm/helpers/size.js
CHANGED
|
@@ -16,7 +16,7 @@ const composeSize = (size)=>{
|
|
|
16
16
|
return Object.assign({}, getCustomSizeCSSByDevice(size, 'desktop'), getCustomSizeCSSByDevice(size, 'tablet'), getCustomSizeCSSByDevice(size, 'mobile'));
|
|
17
17
|
};
|
|
18
18
|
function genSizeClass(name) {
|
|
19
|
-
return `g-s-${name}`;
|
|
19
|
+
return `gp-g-s-${name}`;
|
|
20
20
|
}
|
|
21
21
|
const composeSizeCss = (spacing)=>{
|
|
22
22
|
if (spacing === undefined) return '';
|
|
@@ -2,7 +2,7 @@ import { getSingleColorVariable } from './colors.js';
|
|
|
2
2
|
import { removeNullUndefined, makeStyle, makeStyleResponsive } from './make-style.js';
|
|
3
3
|
|
|
4
4
|
const genTypoClass = (name)=>{
|
|
5
|
-
return `g-${name}`;
|
|
5
|
+
return `gp-g-${name}`;
|
|
6
6
|
};
|
|
7
7
|
const composeTypographyCss = (typography)=>{
|
|
8
8
|
const typographyCustom = typography?.custom;
|
|
@@ -31,9 +31,11 @@ const useIsSyncProduct = ()=>{
|
|
|
31
31
|
};
|
|
32
32
|
const useQuantity = ()=>{
|
|
33
33
|
const quantity = useProductStore((s)=>s.quantity);
|
|
34
|
+
const hasUpdatePrice = useProductStore((s)=>s.updatePrice);
|
|
34
35
|
const decrement = useProductStore((s)=>s.decrementQuantity);
|
|
35
36
|
const increment = useProductStore((s)=>s.incrementQuantity);
|
|
36
37
|
const updateQuantity = useProductStore((s)=>s.setQuantity);
|
|
38
|
+
const updatePrice = useProductStore((s)=>s.setHasUpdatePriceFollowQuantity);
|
|
37
39
|
const isSyncProduct = useProductStore((s)=>s.isSyncProduct);
|
|
38
40
|
const product = useProductStore((s)=>s.product);
|
|
39
41
|
const productId = product?.id;
|
|
@@ -62,16 +64,20 @@ const useQuantity = ()=>{
|
|
|
62
64
|
]);
|
|
63
65
|
return useMemo(()=>({
|
|
64
66
|
quantity,
|
|
67
|
+
hasUpdatePrice,
|
|
65
68
|
increment,
|
|
66
69
|
decrement,
|
|
67
70
|
reset,
|
|
68
|
-
setQuantity: updateQuantity
|
|
71
|
+
setQuantity: updateQuantity,
|
|
72
|
+
setUpdatePrice: updatePrice
|
|
69
73
|
}), [
|
|
70
74
|
decrement,
|
|
71
75
|
increment,
|
|
72
76
|
quantity,
|
|
73
77
|
reset,
|
|
74
|
-
updateQuantity
|
|
78
|
+
updateQuantity,
|
|
79
|
+
updatePrice,
|
|
80
|
+
hasUpdatePrice
|
|
75
81
|
]);
|
|
76
82
|
};
|
|
77
83
|
const useSelectedOption = ()=>{
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7847,6 +7847,8 @@ type ProductContextProps = {
|
|
|
7847
7847
|
isSubmit?: boolean;
|
|
7848
7848
|
updateIsSubmit: (value: boolean) => void;
|
|
7849
7849
|
isSyncProduct?: boolean;
|
|
7850
|
+
setHasUpdatePriceFollowQuantity: (updatePrice: boolean) => void;
|
|
7851
|
+
updatePrice?: boolean;
|
|
7850
7852
|
};
|
|
7851
7853
|
type ProductProviderProps = Pick<ProductContextProps, 'product' | 'quantity' | 'selectedOptions' | 'isSyncProduct'> & {
|
|
7852
7854
|
initialVariantId?: string;
|
|
@@ -8315,14 +8317,14 @@ declare function isColor(color: string): boolean;
|
|
|
8315
8317
|
declare const getGlobalColorStyle: (data?: ColorValueType) => React.CSSProperties;
|
|
8316
8318
|
declare const composeTextColorCss: (color?: ColorValueType) => string;
|
|
8317
8319
|
|
|
8318
|
-
type TypographyClass = `g-${TypographyType}`;
|
|
8320
|
+
type TypographyClass = `gp-g-${TypographyType}`;
|
|
8319
8321
|
declare const genTypoClass: (name: TypographyType) => TypographyClass;
|
|
8320
8322
|
declare const composeTypographyCss: (typography: TypographySetting | undefined) => string;
|
|
8321
8323
|
declare const composeTypographyV2Css: (typography: TypographySettingV2 | undefined, isImportant?: boolean) => string;
|
|
8322
8324
|
declare const composeTypography: (typography?: ObjectDevices<TypographyProps>) => React.CSSProperties;
|
|
8323
8325
|
declare const composeTypographyV2: (value?: TypographyV2Props, attrs?: TypographyV2Attrs) => React.CSSProperties;
|
|
8324
8326
|
declare const composeTypographyAttr: (attrs?: TypographyV2Attrs) => React.CSSProperties;
|
|
8325
|
-
declare const composeTypographyClassName: (typo?: TypographySettingV2, typography?: TypographySetting) => "" | "g-heading-1" | "g-heading-2" | "g-heading-3" | "g-subheading-1" | "g-subheading-2" | "g-subheading-3" | "g-paragraph-1" | "g-paragraph-2" | "g-paragraph-3" | undefined;
|
|
8327
|
+
declare const composeTypographyClassName: (typo?: TypographySettingV2, typography?: TypographySetting) => "" | "gp-g-heading-1" | "gp-g-heading-2" | "gp-g-heading-3" | "gp-g-subheading-1" | "gp-g-subheading-2" | "gp-g-subheading-3" | "gp-g-paragraph-1" | "gp-g-paragraph-2" | "gp-g-paragraph-3" | undefined;
|
|
8326
8328
|
declare const composeTypographyStyle: (typo?: TypographySettingV2, typography?: TypographySetting, disableAttr?: boolean) => {
|
|
8327
8329
|
[x: string]: any;
|
|
8328
8330
|
'--ai'?: csstype.Property.AlignItems | undefined;
|
|
@@ -16160,10 +16162,12 @@ declare const useProductProperties: () => {
|
|
|
16160
16162
|
declare const useIsSyncProduct: () => boolean | undefined;
|
|
16161
16163
|
declare const useQuantity: () => {
|
|
16162
16164
|
quantity: number | undefined;
|
|
16165
|
+
hasUpdatePrice: boolean | undefined;
|
|
16163
16166
|
increment: () => void;
|
|
16164
16167
|
decrement: () => void;
|
|
16165
16168
|
reset: () => void;
|
|
16166
16169
|
setQuantity: (num: number) => void;
|
|
16170
|
+
setUpdatePrice: (updatePrice: boolean) => void;
|
|
16167
16171
|
};
|
|
16168
16172
|
declare const useSelectedOption: () => {
|
|
16169
16173
|
selectedOptions: Record<string, string> | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@gem-sdk/adapter-shopify": "1.25.0",
|
|
28
|
-
"@gem-sdk/styles": "1.
|
|
28
|
+
"@gem-sdk/styles": "1.35.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"react-error-boundary": "4.0.10",
|