@gem-sdk/core 1.23.0-staging.350 → 1.23.0-staging.358
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
|
@@ -168,7 +168,7 @@ function Spacing(props) {
|
|
|
168
168
|
children: props.tag !== 'Section' && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
169
169
|
"data-spacing": true,
|
|
170
170
|
"data-spacing-theme-section": isThemeSectionEditor,
|
|
171
|
-
className: "absolute w-full bottom-0",
|
|
171
|
+
className: "gp-absolute gp-w-full gp-bottom-0",
|
|
172
172
|
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
173
173
|
"data-spacing-margin-bottom": true,
|
|
174
174
|
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 = ()=>{
|
|
@@ -164,7 +164,7 @@ function Spacing(props) {
|
|
|
164
164
|
children: props.tag !== 'Section' && /*#__PURE__*/ jsx("div", {
|
|
165
165
|
"data-spacing": true,
|
|
166
166
|
"data-spacing-theme-section": isThemeSectionEditor,
|
|
167
|
-
className: "absolute w-full bottom-0",
|
|
167
|
+
className: "gp-absolute gp-w-full gp-bottom-0",
|
|
168
168
|
children: /*#__PURE__*/ jsxs("div", {
|
|
169
169
|
"data-spacing-margin-bottom": true,
|
|
170
170
|
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
|
@@ -7848,6 +7848,8 @@ type ProductContextProps = {
|
|
|
7848
7848
|
isSubmit?: boolean;
|
|
7849
7849
|
updateIsSubmit: (value: boolean) => void;
|
|
7850
7850
|
isSyncProduct?: boolean;
|
|
7851
|
+
setHasUpdatePriceFollowQuantity: (updatePrice: boolean) => void;
|
|
7852
|
+
updatePrice?: boolean;
|
|
7851
7853
|
};
|
|
7852
7854
|
type ProductProviderProps = Pick<ProductContextProps, 'product' | 'quantity' | 'selectedOptions' | 'isSyncProduct'> & {
|
|
7853
7855
|
initialVariantId?: string;
|
|
@@ -8316,14 +8318,14 @@ declare function isColor(color: string): boolean;
|
|
|
8316
8318
|
declare const getGlobalColorStyle: (data?: ColorValueType) => React.CSSProperties;
|
|
8317
8319
|
declare const composeTextColorCss: (color?: ColorValueType) => string;
|
|
8318
8320
|
|
|
8319
|
-
type TypographyClass = `g-${TypographyType}`;
|
|
8321
|
+
type TypographyClass = `gp-g-${TypographyType}`;
|
|
8320
8322
|
declare const genTypoClass: (name: TypographyType) => TypographyClass;
|
|
8321
8323
|
declare const composeTypographyCss: (typography: TypographySetting | undefined) => string;
|
|
8322
8324
|
declare const composeTypographyV2Css: (typography: TypographySettingV2 | undefined, isImportant?: boolean) => string;
|
|
8323
8325
|
declare const composeTypography: (typography?: ObjectDevices<TypographyProps>) => React.CSSProperties;
|
|
8324
8326
|
declare const composeTypographyV2: (value?: TypographyV2Props, attrs?: TypographyV2Attrs) => React.CSSProperties;
|
|
8325
8327
|
declare const composeTypographyAttr: (attrs?: TypographyV2Attrs) => React.CSSProperties;
|
|
8326
|
-
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;
|
|
8328
|
+
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;
|
|
8327
8329
|
declare const composeTypographyStyle: (typo?: TypographySettingV2, typography?: TypographySetting, disableAttr?: boolean) => {
|
|
8328
8330
|
[x: string]: any;
|
|
8329
8331
|
'--ai'?: csstype.Property.AlignItems | undefined;
|
|
@@ -16161,10 +16163,12 @@ declare const useProductProperties: () => {
|
|
|
16161
16163
|
declare const useIsSyncProduct: () => boolean | undefined;
|
|
16162
16164
|
declare const useQuantity: () => {
|
|
16163
16165
|
quantity: number | undefined;
|
|
16166
|
+
hasUpdatePrice: boolean | undefined;
|
|
16164
16167
|
increment: () => void;
|
|
16165
16168
|
decrement: () => void;
|
|
16166
16169
|
reset: () => void;
|
|
16167
16170
|
setQuantity: (num: number) => void;
|
|
16171
|
+
setUpdatePrice: (updatePrice: boolean) => void;
|
|
16168
16172
|
};
|
|
16169
16173
|
declare const useSelectedOption: () => {
|
|
16170
16174
|
selectedOptions: Record<string, string> | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "1.23.0-staging.
|
|
3
|
+
"version": "1.23.0-staging.358",
|
|
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.23.0-staging.26",
|
|
28
|
-
"@gem-sdk/styles": "1.23.0-staging.
|
|
28
|
+
"@gem-sdk/styles": "1.23.0-staging.358"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"react-error-boundary": "4.0.10",
|