@gem-sdk/core 1.35.0 → 1.36.0

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.
@@ -234,7 +234,6 @@ const appendAnimation = (props, liquid)=>{
234
234
  transform: 'unset'
235
235
  };
236
236
  return render.template`
237
- ${render.RenderIf(convert.isLocalEnv, `<script src="{{ 'gp-animation.js' | asset_url }}" defer="defer"></script>`, `<script src="${convert.baseAssetURL}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
238
237
  <gp-animation
239
238
  gp-data='${JSON.stringify({
240
239
  config: animation,
@@ -248,6 +247,7 @@ const appendAnimation = (props, liquid)=>{
248
247
  ...makeStyle.makeStyleResponsive('op', opacityObject)
249
248
  }}">${liquid}</div>
250
249
  </gp-animation>
250
+ ${render.RenderIf(convert.isLocalEnv, `<script src="{{ 'gp-animation.js' | asset_url }}" defer="defer"></script>`, `<script src="${convert.baseAssetURL}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
251
251
  `;
252
252
  };
253
253
  const RenderChildren = (props)=>{
@@ -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 })=>{
@@ -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 = ()=>{
@@ -230,7 +230,6 @@ const appendAnimation = (props, liquid)=>{
230
230
  transform: 'unset'
231
231
  };
232
232
  return template`
233
- ${RenderIf(isLocalEnv, `<script src="{{ 'gp-animation.js' | asset_url }}" defer="defer"></script>`, `<script src="${baseAssetURL}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
234
233
  <gp-animation
235
234
  gp-data='${JSON.stringify({
236
235
  config: animation,
@@ -244,6 +243,7 @@ const appendAnimation = (props, liquid)=>{
244
243
  ...makeStyleResponsive('op', opacityObject)
245
244
  }}">${liquid}</div>
246
245
  </gp-animation>
246
+ ${RenderIf(isLocalEnv, `<script src="{{ 'gp-animation.js' | asset_url }}" defer="defer"></script>`, `<script src="${baseAssetURL}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
247
247
  `;
248
248
  };
249
249
  const RenderChildren = (props)=>{
@@ -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 })=>{
@@ -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 = ()=>{
@@ -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;
@@ -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.35.0",
3
+ "version": "1.36.0",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",