@gem-sdk/core 2.1.20 → 2.1.21

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.
@@ -294,24 +294,27 @@ const RenderChildren = (props)=>{
294
294
  const WrapRenderChildren = ({ uid, customProps }, codes)=>{
295
295
  let liquid = '';
296
296
  if (codes?.length) {
297
- // Limit each child item of an element (e.g., marquee, ...) to ensure the total element size does not exceed 256KB.
298
- const itemMaxSize = 200 / codes.length;
297
+ let tempLiquid = '';
298
+ let fileIndex = 0;
299
299
  for(let i = 0; i < codes.length; i++){
300
300
  const code = codes[i];
301
301
  if (code) {
302
- const newLiquid = liquid + code;
303
- // Fix limit 256kb
304
302
  const textEncoder = new TextEncoder();
305
- const size = newLiquid ? textEncoder.encode(newLiquid).length : 0;
306
- if (Math.ceil(size / 1024) >= itemMaxSize) {
307
- const fileName = `gp-section-snippet-${uid + i}`;
308
- customProps.extraFiles[fileName] = code;
309
- liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`;
303
+ const newTempLiquid = tempLiquid + code;
304
+ const newSize = textEncoder.encode(newTempLiquid).length;
305
+ if (Math.ceil(newSize / 1024) < 180) {
306
+ tempLiquid = newTempLiquid;
310
307
  } else {
311
- liquid += code;
308
+ const fileName = `gp-section-snippet-${uid}-${fileIndex++}`;
309
+ customProps.extraFiles[fileName] = tempLiquid;
310
+ liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`;
311
+ tempLiquid = code;
312
312
  }
313
313
  }
314
314
  }
315
+ if (tempLiquid) {
316
+ liquid += tempLiquid;
317
+ }
315
318
  }
316
319
  return liquid;
317
320
  };
@@ -22,6 +22,11 @@ const createPageStoreProvider = (data)=>zustand.createStore((set)=>({
22
22
  productOffers: productOffers
23
23
  });
24
24
  },
25
+ setDynamicDiscountOffer: (dynamicDiscountOffer)=>{
26
+ set({
27
+ dynamicDiscountOffer: dynamicDiscountOffer
28
+ });
29
+ },
25
30
  setSalePageProductId: (id)=>{
26
31
  set({
27
32
  salePageProductId: id
@@ -71,11 +76,12 @@ const createPageStoreProvider = (data)=>zustand.createStore((set)=>({
71
76
  }));
72
77
  }
73
78
  }));
74
- const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
79
+ const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, dynamicDiscountOffer, publicStoreFrontData, ...passProps })=>{
75
80
  const store = react.useMemo(()=>createPageStoreProvider({
76
81
  dynamicProduct,
77
82
  dynamicCollection,
78
83
  productOffers,
84
+ dynamicDiscountOffer,
79
85
  publicStoreFrontData,
80
86
  interactionData: {
81
87
  selectType: 'ELEMENT'
@@ -84,6 +90,7 @@ const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffe
84
90
  dynamicProduct,
85
91
  dynamicCollection,
86
92
  productOffers,
93
+ dynamicDiscountOffer,
87
94
  publicStoreFrontData
88
95
  ]);
89
96
  return /*#__PURE__*/ jsxRuntime.jsx(PageContext.Provider, {
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ /* eslint-disable */ const SaleFunnelOfferDocument = `
4
+ query SaleFunnelOffer($saleFunnelOfferId: ID!) {
5
+ saleFunnelOffer(id: $saleFunnelOfferId) {
6
+ dynamicDiscounts {
7
+ id
8
+ createdAt
9
+ updatedAt
10
+ type
11
+ valueType
12
+ value
13
+ appliedProductCount
14
+ isEnabled
15
+ }
16
+ id
17
+ isEnabled
18
+ campaignID
19
+ createdAt
20
+ deletedAt
21
+ }
22
+ }
23
+ `;
24
+
25
+ exports.SaleFunnelOfferDocument = SaleFunnelOfferDocument;
package/dist/cjs/index.js CHANGED
@@ -33,6 +33,7 @@ var ThemePage_generated = require('./graphql-app-api/queries/ThemePage.generated
33
33
  var SaleFunnelDiscounts_generated = require('./graphql-app-api/queries/SaleFunnelDiscounts.generated.js');
34
34
  var LibrarySaleFunnelDiscount_generated = require('./graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js');
35
35
  var ShopLibraryPage_generated = require('./graphql-app-api/queries/ShopLibraryPage.generated.js');
36
+ var SaleFunnelOffer_generated = require('./graphql-app-api/queries/SaleFunnelOffer.generated.js');
36
37
  var borders = require('./helpers/borders.js');
37
38
  var carousel = require('./helpers/carousel.js');
38
39
  var cls = require('./helpers/cls.js');
@@ -167,6 +168,7 @@ exports.ThemePageDocument = ThemePage_generated.ThemePageDocument;
167
168
  exports.SaleFunnelDiscountsDocument = SaleFunnelDiscounts_generated.SaleFunnelDiscountsDocument;
168
169
  exports.LibrarySaleFunnelDocument = LibrarySaleFunnelDiscount_generated.LibrarySaleFunnelDocument;
169
170
  exports.ShopLibraryPageDocument = ShopLibraryPage_generated.ShopLibraryPageDocument;
171
+ exports.SaleFunnelOfferDocument = SaleFunnelOffer_generated.SaleFunnelOfferDocument;
170
172
  exports.composeBorderCss = borders.composeBorderCss;
171
173
  exports.getBorderRadiusStyle = borders.getBorderRadiusStyle;
172
174
  exports.getBorderStyle = borders.getBorderStyle;
@@ -290,24 +290,27 @@ const RenderChildren = (props)=>{
290
290
  const WrapRenderChildren = ({ uid, customProps }, codes)=>{
291
291
  let liquid = '';
292
292
  if (codes?.length) {
293
- // Limit each child item of an element (e.g., marquee, ...) to ensure the total element size does not exceed 256KB.
294
- const itemMaxSize = 200 / codes.length;
293
+ let tempLiquid = '';
294
+ let fileIndex = 0;
295
295
  for(let i = 0; i < codes.length; i++){
296
296
  const code = codes[i];
297
297
  if (code) {
298
- const newLiquid = liquid + code;
299
- // Fix limit 256kb
300
298
  const textEncoder = new TextEncoder();
301
- const size = newLiquid ? textEncoder.encode(newLiquid).length : 0;
302
- if (Math.ceil(size / 1024) >= itemMaxSize) {
303
- const fileName = `gp-section-snippet-${uid + i}`;
304
- customProps.extraFiles[fileName] = code;
305
- liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`;
299
+ const newTempLiquid = tempLiquid + code;
300
+ const newSize = textEncoder.encode(newTempLiquid).length;
301
+ if (Math.ceil(newSize / 1024) < 180) {
302
+ tempLiquid = newTempLiquid;
306
303
  } else {
307
- liquid += code;
304
+ const fileName = `gp-section-snippet-${uid}-${fileIndex++}`;
305
+ customProps.extraFiles[fileName] = tempLiquid;
306
+ liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`;
307
+ tempLiquid = code;
308
308
  }
309
309
  }
310
310
  }
311
+ if (tempLiquid) {
312
+ liquid += tempLiquid;
313
+ }
311
314
  }
312
315
  return liquid;
313
316
  };
@@ -20,6 +20,11 @@ const createPageStoreProvider = (data)=>createStore((set)=>({
20
20
  productOffers: productOffers
21
21
  });
22
22
  },
23
+ setDynamicDiscountOffer: (dynamicDiscountOffer)=>{
24
+ set({
25
+ dynamicDiscountOffer: dynamicDiscountOffer
26
+ });
27
+ },
23
28
  setSalePageProductId: (id)=>{
24
29
  set({
25
30
  salePageProductId: id
@@ -69,11 +74,12 @@ const createPageStoreProvider = (data)=>createStore((set)=>({
69
74
  }));
70
75
  }
71
76
  }));
72
- const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
77
+ const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, dynamicDiscountOffer, publicStoreFrontData, ...passProps })=>{
73
78
  const store = useMemo(()=>createPageStoreProvider({
74
79
  dynamicProduct,
75
80
  dynamicCollection,
76
81
  productOffers,
82
+ dynamicDiscountOffer,
77
83
  publicStoreFrontData,
78
84
  interactionData: {
79
85
  selectType: 'ELEMENT'
@@ -82,6 +88,7 @@ const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffe
82
88
  dynamicProduct,
83
89
  dynamicCollection,
84
90
  productOffers,
91
+ dynamicDiscountOffer,
85
92
  publicStoreFrontData
86
93
  ]);
87
94
  return /*#__PURE__*/ jsx(PageContext.Provider, {
@@ -0,0 +1,23 @@
1
+ /* eslint-disable */ const SaleFunnelOfferDocument = `
2
+ query SaleFunnelOffer($saleFunnelOfferId: ID!) {
3
+ saleFunnelOffer(id: $saleFunnelOfferId) {
4
+ dynamicDiscounts {
5
+ id
6
+ createdAt
7
+ updatedAt
8
+ type
9
+ valueType
10
+ value
11
+ appliedProductCount
12
+ isEnabled
13
+ }
14
+ id
15
+ isEnabled
16
+ campaignID
17
+ createdAt
18
+ deletedAt
19
+ }
20
+ }
21
+ `;
22
+
23
+ export { SaleFunnelOfferDocument };
package/dist/esm/index.js CHANGED
@@ -31,6 +31,7 @@ export { ThemePageDocument } from './graphql-app-api/queries/ThemePage.generated
31
31
  export { SaleFunnelDiscountsDocument } from './graphql-app-api/queries/SaleFunnelDiscounts.generated.js';
32
32
  export { LibrarySaleFunnelDocument } from './graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js';
33
33
  export { ShopLibraryPageDocument } from './graphql-app-api/queries/ShopLibraryPage.generated.js';
34
+ export { SaleFunnelOfferDocument } from './graphql-app-api/queries/SaleFunnelOffer.generated.js';
34
35
  export { composeBorderCss, getBorderRadiusStyle, getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn } from './helpers/borders.js';
35
36
  export { getCarouselContainerHeight, makeContainerWidthOrHeight, makeDotGapToCarouselStyle } from './helpers/carousel.js';
36
37
  export { cls } from './helpers/cls.js';