@gem-sdk/pages 2.0.0-dev.161 → 2.0.0-dev.168

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.
@@ -21,6 +21,7 @@ const Toolbox = ()=>{
21
21
  const changeStorefrontInfo = core.useShopStore((s)=>s.changeStorefrontInfo);
22
22
  const setDynamicProduct = core.usePageStore((s)=>s.setDynamicProduct);
23
23
  const setPostPurchaseProductOffers = core.usePageStore((s)=>s.setPostPurchaseProductOffers);
24
+ const setDynamicDiscountOffer = core.usePageStore((s)=>s.setDynamicDiscountOffer);
24
25
  const setSalePageProductId = core.usePageStore((s)=>s.setSalePageProductId);
25
26
  const setDynamicCollection = core.usePageStore((s)=>s.setDynamicCollection);
26
27
  const initState = core.useBuilderPreviewStore((s)=>s.initState);
@@ -346,6 +347,13 @@ const Toolbox = ()=>{
346
347
  }, [
347
348
  setPostPurchaseProductOffers
348
349
  ]);
350
+ const onUpdateDynamicDiscountOffer = react.useCallback((e)=>{
351
+ const dynamicDiscountOffer = e.detail;
352
+ if (!dynamicDiscountOffer) return;
353
+ setDynamicDiscountOffer(dynamicDiscountOffer);
354
+ }, [
355
+ setDynamicDiscountOffer
356
+ ]);
349
357
  const onUpdateSalePageProductId = react.useCallback((e)=>{
350
358
  const id = e.detail;
351
359
  if (!id) return;
@@ -417,6 +425,7 @@ const Toolbox = ()=>{
417
425
  window.addEventListener('update-item-name', onUpdateItemName);
418
426
  window.addEventListener('update-item-attribute', onUpdateItemAttribute);
419
427
  window.addEventListener('set-product-offer', onUpdateProductOffers);
428
+ window.addEventListener('set-dynamic-discount-offer', onUpdateDynamicDiscountOffer);
420
429
  window.addEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
421
430
  window.addEventListener('limit-create-theme-section', onLimitCreateThemeSection);
422
431
  window.addEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
@@ -474,7 +483,8 @@ const Toolbox = ()=>{
474
483
  onUpdateInteractionIsSelectOnPage,
475
484
  onUpdateInteractionSettingType,
476
485
  onUpdateFontType,
477
- onChangeSidebarMode
486
+ onChangeSidebarMode,
487
+ onUpdateDynamicDiscountOffer
478
488
  ]);
479
489
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
480
490
  className: "toolbox"
@@ -17,6 +17,7 @@ const Toolbox = ()=>{
17
17
  const changeStorefrontInfo = useShopStore((s)=>s.changeStorefrontInfo);
18
18
  const setDynamicProduct = usePageStore((s)=>s.setDynamicProduct);
19
19
  const setPostPurchaseProductOffers = usePageStore((s)=>s.setPostPurchaseProductOffers);
20
+ const setDynamicDiscountOffer = usePageStore((s)=>s.setDynamicDiscountOffer);
20
21
  const setSalePageProductId = usePageStore((s)=>s.setSalePageProductId);
21
22
  const setDynamicCollection = usePageStore((s)=>s.setDynamicCollection);
22
23
  const initState = useBuilderPreviewStore((s)=>s.initState);
@@ -342,6 +343,13 @@ const Toolbox = ()=>{
342
343
  }, [
343
344
  setPostPurchaseProductOffers
344
345
  ]);
346
+ const onUpdateDynamicDiscountOffer = useCallback((e)=>{
347
+ const dynamicDiscountOffer = e.detail;
348
+ if (!dynamicDiscountOffer) return;
349
+ setDynamicDiscountOffer(dynamicDiscountOffer);
350
+ }, [
351
+ setDynamicDiscountOffer
352
+ ]);
345
353
  const onUpdateSalePageProductId = useCallback((e)=>{
346
354
  const id = e.detail;
347
355
  if (!id) return;
@@ -413,6 +421,7 @@ const Toolbox = ()=>{
413
421
  window.addEventListener('update-item-name', onUpdateItemName);
414
422
  window.addEventListener('update-item-attribute', onUpdateItemAttribute);
415
423
  window.addEventListener('set-product-offer', onUpdateProductOffers);
424
+ window.addEventListener('set-dynamic-discount-offer', onUpdateDynamicDiscountOffer);
416
425
  window.addEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
417
426
  window.addEventListener('limit-create-theme-section', onLimitCreateThemeSection);
418
427
  window.addEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
@@ -470,7 +479,8 @@ const Toolbox = ()=>{
470
479
  onUpdateInteractionIsSelectOnPage,
471
480
  onUpdateInteractionSettingType,
472
481
  onUpdateFontType,
473
- onChangeSidebarMode
482
+ onChangeSidebarMode,
483
+ onUpdateDynamicDiscountOffer
474
484
  ]);
475
485
  return /*#__PURE__*/ jsx("div", {
476
486
  className: "toolbox"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "2.0.0-dev.161",
3
+ "version": "2.0.0-dev.168",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -26,7 +26,7 @@
26
26
  "next": "latest"
27
27
  },
28
28
  "devDependencies": {
29
- "@gem-sdk/core": "2.0.0-dev.160",
29
+ "@gem-sdk/core": "2.0.0-dev.168",
30
30
  "@gem-sdk/plugin-cookie-bar": "1.58.0-dev.142",
31
31
  "@gem-sdk/plugin-quick-view": "1.58.0-dev.142",
32
32
  "@gem-sdk/plugin-sticky-add-to-cart": "1.58.0-dev.142"