@gem-sdk/pages 1.57.0-staging.23 → 1.57.0-staging.37

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.
@@ -8,28 +8,28 @@ var core = require('@gem-sdk/core');
8
8
  var CollectionGlobalProvider = require('../../pages/CollectionGlobalProvider.js');
9
9
 
10
10
  const Body = ({ pageType, isThemeSectionEditor })=>{
11
- const interactionData = core.usePageStore((s)=>s.interactionData);
12
- const sidebarMode = core.usePageStore((s)=>s.sidebarMode);
13
- const isInteractionSelectModeClass = react.useMemo(()=>interactionData?.isSelectOnPage ? 'interaction-select-mode' : '', [
14
- interactionData?.isSelectOnPage
11
+ const { isInteractionMode, isSelectOnPage } = core.useInteraction();
12
+ const interactionSelectModeClass = react.useMemo(()=>isSelectOnPage ? 'interaction-select-mode' : '', [
13
+ isSelectOnPage
15
14
  ]);
16
- const isInteractionMode = react.useMemo(()=>sidebarMode === 'interaction' && !interactionData?.isSelectOnPage, [
17
- sidebarMode,
18
- interactionData?.isSelectOnPage
19
- ]);
20
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
15
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
21
16
  id: "storefront",
22
- className: core.cls(isThemeSectionEditor ? 'theme-section-editor' : '', pageType === 'POST_PURCHASE' ? 'post-purchase-page' : '', isInteractionSelectModeClass),
23
- style: {
24
- pointerEvents: isInteractionMode ? 'none' : 'auto'
25
- },
26
- children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsxRuntime.jsx(CollectionGlobalProvider.default, {
27
- children: /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
17
+ className: core.cls(isThemeSectionEditor ? 'theme-section-editor' : '', pageType === 'POST_PURCHASE' ? 'post-purchase-page' : '', interactionSelectModeClass),
18
+ children: [
19
+ pageType !== 'POST_PURCHASE' && /*#__PURE__*/ jsxRuntime.jsx("div", {
20
+ className: "gp-w-full gp-h-full gp-fixed gp-left-0 gp-top-0 gp-z-[99999999]",
21
+ style: {
22
+ pointerEvents: isInteractionMode ? 'auto' : 'none'
23
+ }
24
+ }),
25
+ pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsxRuntime.jsx(CollectionGlobalProvider.default, {
26
+ children: /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
27
+ uid: "ROOT"
28
+ })
29
+ }) : /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
28
30
  uid: "ROOT"
29
31
  })
30
- }) : /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
31
- uid: "ROOT"
32
- })
32
+ ]
33
33
  });
34
34
  };
35
35
 
@@ -11,6 +11,7 @@ const PopupManager = ()=>{
11
11
  const state = core.useBuilderPreviewStore((s)=>s.state);
12
12
  const setModalActive = core.useModalStore((s)=>s.setModalActive);
13
13
  const activeModalId = core.useModalStore((s)=>s.activeId);
14
+ const { isInteractionMode } = core.useInteraction();
14
15
  const popups = react.useMemo(()=>{
15
16
  return state.ROOT.childrens?.map((id)=>{
16
17
  return state?.[id];
@@ -37,10 +38,10 @@ const PopupManager = ()=>{
37
38
  children: popups?.map((item)=>{
38
39
  const display = item?.advanced?.d;
39
40
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
40
- className: core.cls('gp-pointer-events-auto gp-w-full gp-shrink gp-cursor-pointer gp-select-none gp-items-center gp-justify-center gp-whitespace-nowrap gp-py-2 gp-text-white [writing-mode:vertical-lr]', {
41
+ className: core.cls('gp-w-full gp-shrink gp-cursor-pointer gp-select-none gp-items-center gp-justify-center gp-whitespace-nowrap gp-py-2 gp-text-white [writing-mode:vertical-lr]', {
41
42
  'gp-bg-blue-500': activeModalId === item.uid,
42
43
  'gp-bg-blue-700': activeModalId !== item.uid
43
- }),
44
+ }, isInteractionMode ? 'gp-pointer-events-none' : 'gp-pointer-events-auto'),
44
45
  role: "button",
45
46
  "aria-hidden": "true",
46
47
  onClick: ()=>setModalActive(item?.uid, true),
@@ -1,31 +1,31 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { useMemo } from 'react';
3
- import { usePageStore, cls, RenderPreview } from '@gem-sdk/core';
3
+ import { useInteraction, cls, RenderPreview } from '@gem-sdk/core';
4
4
  import CollectionGlobalProvider from '../../pages/CollectionGlobalProvider.js';
5
5
 
6
6
  const Body = ({ pageType, isThemeSectionEditor })=>{
7
- const interactionData = usePageStore((s)=>s.interactionData);
8
- const sidebarMode = usePageStore((s)=>s.sidebarMode);
9
- const isInteractionSelectModeClass = useMemo(()=>interactionData?.isSelectOnPage ? 'interaction-select-mode' : '', [
10
- interactionData?.isSelectOnPage
7
+ const { isInteractionMode, isSelectOnPage } = useInteraction();
8
+ const interactionSelectModeClass = useMemo(()=>isSelectOnPage ? 'interaction-select-mode' : '', [
9
+ isSelectOnPage
11
10
  ]);
12
- const isInteractionMode = useMemo(()=>sidebarMode === 'interaction' && !interactionData?.isSelectOnPage, [
13
- sidebarMode,
14
- interactionData?.isSelectOnPage
15
- ]);
16
- return /*#__PURE__*/ jsx("div", {
11
+ return /*#__PURE__*/ jsxs("div", {
17
12
  id: "storefront",
18
- className: cls(isThemeSectionEditor ? 'theme-section-editor' : '', pageType === 'POST_PURCHASE' ? 'post-purchase-page' : '', isInteractionSelectModeClass),
19
- style: {
20
- pointerEvents: isInteractionMode ? 'none' : 'auto'
21
- },
22
- children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsx(CollectionGlobalProvider, {
23
- children: /*#__PURE__*/ jsx(RenderPreview, {
13
+ className: cls(isThemeSectionEditor ? 'theme-section-editor' : '', pageType === 'POST_PURCHASE' ? 'post-purchase-page' : '', interactionSelectModeClass),
14
+ children: [
15
+ pageType !== 'POST_PURCHASE' && /*#__PURE__*/ jsx("div", {
16
+ className: "gp-w-full gp-h-full gp-fixed gp-left-0 gp-top-0 gp-z-[99999999]",
17
+ style: {
18
+ pointerEvents: isInteractionMode ? 'auto' : 'none'
19
+ }
20
+ }),
21
+ pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsx(CollectionGlobalProvider, {
22
+ children: /*#__PURE__*/ jsx(RenderPreview, {
23
+ uid: "ROOT"
24
+ })
25
+ }) : /*#__PURE__*/ jsx(RenderPreview, {
24
26
  uid: "ROOT"
25
27
  })
26
- }) : /*#__PURE__*/ jsx(RenderPreview, {
27
- uid: "ROOT"
28
- })
28
+ ]
29
29
  });
30
30
  };
31
31
 
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { useBuilderPreviewStore, useModalStore, cls } from '@gem-sdk/core';
2
+ import { useBuilderPreviewStore, useModalStore, useInteraction, cls } from '@gem-sdk/core';
3
3
  import { memo, useMemo, useCallback, useEffect } from 'react';
4
4
 
5
5
  const isDialog = (item)=>!!item && item?.tag === 'Dialog' && item.type === 'component';
@@ -7,6 +7,7 @@ const PopupManager = ()=>{
7
7
  const state = useBuilderPreviewStore((s)=>s.state);
8
8
  const setModalActive = useModalStore((s)=>s.setModalActive);
9
9
  const activeModalId = useModalStore((s)=>s.activeId);
10
+ const { isInteractionMode } = useInteraction();
10
11
  const popups = useMemo(()=>{
11
12
  return state.ROOT.childrens?.map((id)=>{
12
13
  return state?.[id];
@@ -33,10 +34,10 @@ const PopupManager = ()=>{
33
34
  children: popups?.map((item)=>{
34
35
  const display = item?.advanced?.d;
35
36
  return /*#__PURE__*/ jsx("div", {
36
- className: cls('gp-pointer-events-auto gp-w-full gp-shrink gp-cursor-pointer gp-select-none gp-items-center gp-justify-center gp-whitespace-nowrap gp-py-2 gp-text-white [writing-mode:vertical-lr]', {
37
+ className: cls('gp-w-full gp-shrink gp-cursor-pointer gp-select-none gp-items-center gp-justify-center gp-whitespace-nowrap gp-py-2 gp-text-white [writing-mode:vertical-lr]', {
37
38
  'gp-bg-blue-500': activeModalId === item.uid,
38
39
  'gp-bg-blue-700': activeModalId !== item.uid
39
- }),
40
+ }, isInteractionMode ? 'gp-pointer-events-none' : 'gp-pointer-events-auto'),
40
41
  role: "button",
41
42
  "aria-hidden": "true",
42
43
  onClick: ()=>setModalActive(item?.uid, true),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "1.57.0-staging.23",
3
+ "version": "1.57.0-staging.37",
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": "1.57.0-staging.22",
29
+ "@gem-sdk/core": "1.57.0-staging.37",
30
30
  "@gem-sdk/plugin-cookie-bar": "1.57.0-staging.2",
31
31
  "@gem-sdk/plugin-quick-view": "1.57.0-staging.2",
32
32
  "@gem-sdk/plugin-sticky-add-to-cart": "1.57.0-staging.2"