@gem-sdk/core 1.53.0-dev.9 → 1.53.0-dev.93

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.
Files changed (32) hide show
  1. package/dist/cjs/components/ComponentToolbarPreview.js +58 -3
  2. package/dist/cjs/components/ComponentWrapper.js +16 -1
  3. package/dist/cjs/components/InteractionSuffix.js +9 -70
  4. package/dist/cjs/components/Render.liquid.js +3 -2
  5. package/dist/cjs/contexts/PageContext.js +9 -1
  6. package/dist/cjs/graphql/queries/published-shop-metas.js +15 -0
  7. package/dist/cjs/helpers/animations.js +11 -2
  8. package/dist/cjs/helpers/background.js +3 -1
  9. package/dist/cjs/helpers/interaction/index.js +15 -5
  10. package/dist/cjs/helpers/third-party/appConfig.js +14 -0
  11. package/dist/cjs/helpers/third-party/appSetting.js +87 -1
  12. package/dist/cjs/helpers/third-party/constant.js +3 -1
  13. package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -1
  14. package/dist/cjs/hooks/animation/useApplyAnimation.js +5 -5
  15. package/dist/cjs/index.js +2 -0
  16. package/dist/esm/components/ComponentToolbarPreview.js +58 -3
  17. package/dist/esm/components/ComponentWrapper.js +16 -1
  18. package/dist/esm/components/InteractionSuffix.js +10 -71
  19. package/dist/esm/components/Render.liquid.js +3 -2
  20. package/dist/esm/contexts/PageContext.js +9 -1
  21. package/dist/esm/graphql/queries/published-shop-metas.js +13 -0
  22. package/dist/esm/helpers/animations.js +11 -2
  23. package/dist/esm/helpers/background.js +3 -1
  24. package/dist/esm/helpers/interaction/index.js +15 -5
  25. package/dist/esm/helpers/third-party/appConfig.js +13 -1
  26. package/dist/esm/helpers/third-party/appSetting.js +87 -1
  27. package/dist/esm/helpers/third-party/constant.js +4 -2
  28. package/dist/esm/hooks/animation/useAnimationConfig.js +2 -1
  29. package/dist/esm/hooks/animation/useApplyAnimation.js +5 -5
  30. package/dist/esm/index.js +1 -0
  31. package/dist/types/index.d.ts +57 -7
  32. package/package.json +2 -2
@@ -56,7 +56,31 @@ const ComponentToolbarPreview = (props)=>{
56
56
  editingPageType
57
57
  ]);
58
58
  const isSelectOnPage = useMemo(()=>interactionData?.isSelectOnPage, [
59
- interactionData
59
+ interactionData?.isSelectOnPage
60
+ ]);
61
+ const settingType = useMemo(()=>interactionData?.settingType, [
62
+ interactionData?.settingType
63
+ ]);
64
+ const isShowIconInteractionTarget = useMemo(()=>{
65
+ return interactionData?.item?.targets?.find((t)=>t.uid === props.uid && t?.type !== 'PAGE') && settingType === 'TARGET';
66
+ }, [
67
+ interactionData?.item?.targets,
68
+ props.uid,
69
+ settingType
70
+ ]);
71
+ const isShowIconInteractionTrigger = useMemo(()=>{
72
+ return interactionData?.item?.self?.uid === props.uid && interactionData?.item?.self.type !== 'PAGE' && settingType === 'TRIGGER';
73
+ }, [
74
+ interactionData?.item?.self?.type,
75
+ interactionData?.item?.self?.uid,
76
+ props.uid,
77
+ settingType
78
+ ]);
79
+ const isDisplayIconDrag = useMemo(()=>{
80
+ return !isShowIconInteractionTarget && !isShowIconInteractionTrigger;
81
+ }, [
82
+ isShowIconInteractionTarget,
83
+ isShowIconInteractionTrigger
60
84
  ]);
61
85
  const { checkDisableDelete, getTooltipText, checkDisableDuplicate } = usePostPurchase(props.uid, props.tag || '');
62
86
  const editProductElementList = [
@@ -334,7 +358,6 @@ const ComponentToolbarPreview = (props)=>{
334
358
  if (isShopifySection || isThemeSection && !isThemeSectionEditor) return false;
335
359
  return ableGenerateContentElements.includes(tag);
336
360
  };
337
- // if (!isActive) return null;
338
361
  return /*#__PURE__*/ jsxs(Fragment, {
339
362
  children: [
340
363
  !(props.tag == 'Section' && isThemeSectionEditor) && /*#__PURE__*/ jsxs("div", {
@@ -349,7 +372,39 @@ const ComponentToolbarPreview = (props)=>{
349
372
  onClick: (e)=>onShowParent(e),
350
373
  "aria-hidden": "true",
351
374
  children: [
352
- /*#__PURE__*/ jsx("div", {
375
+ isShowIconInteractionTrigger && /*#__PURE__*/ jsx("div", {
376
+ className: "gp-hidden gp-w-[12px] interaction-use-custom-element",
377
+ children: /*#__PURE__*/ jsx("svg", {
378
+ width: "12",
379
+ height: "13",
380
+ viewBox: "0 0 12 13",
381
+ fill: "none",
382
+ xmlns: "http://www.w3.org/2000/svg",
383
+ children: /*#__PURE__*/ jsx("path", {
384
+ fillRule: "evenodd",
385
+ clipRule: "evenodd",
386
+ d: "M4.36823 0.430157C4.51621 0.205309 4.76733 0.0699463 5.0365 0.0699463H9.886C10.2045 0.0699463 10.3952 0.424012 10.2201 0.689974L8.36993 3.49883C8.28234 3.63182 8.37772 3.80885 8.53695 3.80885H10.7492C11.1114 3.80885 11.2871 4.25167 11.0235 4.5L3.03995 12.0213C2.75745 12.2874 2.29956 12.0357 2.37286 11.6546L3.28019 6.93662C3.30391 6.81327 3.20939 6.69885 3.08379 6.69885H0.984895C0.666494 6.69885 0.475723 6.34493 0.650759 6.07895L4.36823 0.430157ZM5.48883 1.20046C5.35424 1.20046 5.22868 1.26814 5.15469 1.38057L2.6027 5.25839C2.51518 5.39137 2.61056 5.56833 2.76976 5.56833H4.27861C4.52982 5.56833 4.71885 5.79718 4.67141 6.04387L4.12087 8.9066C4.08422 9.09717 4.31317 9.22301 4.45442 9.08994L8.49328 5.28494C8.62508 5.16077 8.53721 4.93936 8.35614 4.93936H6.75127C6.4328 4.93936 6.24204 4.5853 6.41722 4.31934L8.26734 1.51048C8.35494 1.37749 8.25956 1.20046 8.10032 1.20046H5.48883Z",
387
+ fill: "#F9F9F9"
388
+ })
389
+ })
390
+ }),
391
+ isShowIconInteractionTarget && /*#__PURE__*/ jsx("div", {
392
+ className: "gp-hidden gp-w-[14px] interaction-use-custom-element",
393
+ children: /*#__PURE__*/ jsx("svg", {
394
+ width: "14",
395
+ height: "14",
396
+ viewBox: "0 0 14 14",
397
+ fill: "none",
398
+ xmlns: "http://www.w3.org/2000/svg",
399
+ children: /*#__PURE__*/ jsx("path", {
400
+ fillRule: "evenodd",
401
+ clipRule: "evenodd",
402
+ d: "M6.2941 2.19513C6.70415 2.13657 6.9891 1.75669 6.93054 1.34663C6.87198 0.936581 6.49209 0.651638 6.08204 0.710196C2.98687 1.15221 0.607666 3.8125 0.607666 7.02978C0.607666 10.5556 3.46588 13.4138 6.99166 13.4138C10.1798 13.4138 12.8209 11.0775 13.2987 8.02354C13.3627 7.61431 13.0828 7.23065 12.6736 7.16663C12.2644 7.1026 11.8807 7.38245 11.8167 7.79169C11.4513 10.127 9.42946 11.9138 6.99166 11.9138C4.2943 11.9138 2.10767 9.72714 2.10767 7.02978C2.10767 4.56958 3.92742 2.53311 6.2941 2.19513ZM9.32325 0.978487C9.59794 0.703796 10.0673 0.833594 10.1618 1.21039L10.648 3.14898C10.6705 3.2384 10.7403 3.30822 10.8297 3.33065L12.7683 3.81691C13.1451 3.91143 13.2749 4.38075 13.0002 4.65544L11.3265 6.32911C11.099 6.55668 10.7758 6.66082 10.4581 6.60891L9.03886 6.37696C8.72123 6.32505 8.39804 6.42918 8.17046 6.65676L7.40064 7.42658C7.16633 7.66089 6.78643 7.66089 6.55211 7.42658C6.3178 7.19227 6.3178 6.81237 6.55211 6.57805L7.32193 5.80823C7.54951 5.58066 7.65364 5.25746 7.60173 4.93983L7.36978 3.52055C7.31787 3.20293 7.42201 2.87973 7.64958 2.65216L9.32325 0.978487ZM8.79074 4.77514C8.82538 4.98713 8.99156 5.15331 9.20355 5.18795L10.2975 5.36674C10.4564 5.3927 10.618 5.34063 10.7317 5.22684L10.9663 4.99227C11.1037 4.85492 11.0388 4.62026 10.8504 4.573L9.98586 4.35615C9.80703 4.3113 9.66739 4.17166 9.62254 3.99283L9.40569 3.12832C9.35843 2.93992 9.12377 2.87502 8.98642 3.01237L8.75185 3.24695C8.63806 3.36073 8.58599 3.52233 8.61195 3.68114L8.79074 4.77514ZM7.02213 4.44284C7.14103 4.83962 6.91577 5.25766 6.51899 5.37657C5.8172 5.58687 5.30708 6.2382 5.30708 7.00672C5.30708 7.94638 6.06883 8.70813 7.00849 8.70813C7.77819 8.70813 8.43033 8.19644 8.6396 7.49302C8.75772 7.096 9.17531 6.86991 9.57233 6.98802C9.96934 7.10614 10.1954 7.52373 10.0773 7.92075C9.68401 9.24279 8.45997 10.2081 7.00849 10.2081C5.2404 10.2081 3.80708 8.77481 3.80708 7.00672C3.80708 5.55746 4.76949 4.33493 6.0884 3.9397C6.48518 3.82079 6.90323 4.04606 7.02213 4.44284Z",
403
+ fill: "#F9F9F9"
404
+ })
405
+ })
406
+ }),
407
+ isDisplayIconDrag && /*#__PURE__*/ jsx("div", {
353
408
  "data-toolbar-icon-drag": true,
354
409
  children: /*#__PURE__*/ jsxs("svg", {
355
410
  width: "16",
@@ -8,6 +8,16 @@ const ComponentWrapper = ({ children, pageType, ...props })=>{
8
8
  if (props.type === 'section') return null;
9
9
  const style = composeAdvanceStyle(props.advanced, props.tag, pageType);
10
10
  const advanced = props.advanced;
11
+ const interactionAttributes = ()=>{
12
+ let result = {};
13
+ if (props.advanced?.displayInitInteraction !== undefined) {
14
+ result = {
15
+ 'display-init': props.advanced?.displayInitInteraction === false ? 'hide' : 'show',
16
+ 'gp-interaction-wrapper': ''
17
+ };
18
+ }
19
+ return result;
20
+ };
11
21
  if (disableWrap.includes(props.tag) && /*#__PURE__*/ isValidElement(children)) {
12
22
  return /*#__PURE__*/ jsxs(Fragment, {
13
23
  children: [
@@ -19,7 +29,11 @@ const ComponentWrapper = ({ children, pageType, ...props })=>{
19
29
  className: advanced?.cssClass,
20
30
  ...children.props,
21
31
  style,
22
- advanced
32
+ advanced,
33
+ builderAttrs: {
34
+ ...children.props.builderAttrs,
35
+ ...interactionAttributes()
36
+ }
23
37
  })
24
38
  ]
25
39
  });
@@ -32,6 +46,7 @@ const ComponentWrapper = ({ children, pageType, ...props })=>{
32
46
  }),
33
47
  /*#__PURE__*/ jsx("div", {
34
48
  style: style,
49
+ ...interactionAttributes(),
35
50
  className: `${props.uid} ${advanced?.cssClass}`,
36
51
  children: children
37
52
  })
@@ -1,4 +1,4 @@
1
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
1
+ import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { useMemo } from 'react';
3
3
  import 'zustand';
4
4
  import 'swr';
@@ -15,18 +15,18 @@ import 'dayjs';
15
15
  import { useInteraction } from '../helpers/interaction/index.js';
16
16
  import '../helpers/convert.js';
17
17
 
18
- const InteractionSuffix = ({ tag, uid })=>{
18
+ const InteractionSuffix = ({ uid })=>{
19
19
  const { closeSelectOnPage } = useInteraction();
20
20
  const currentInteraction = usePageStore((s)=>s.interactionData?.item);
21
21
  const isSelectOnPage = usePageStore((s)=>s.interactionData?.isSelectOnPage);
22
22
  const isCurrentInteractionTarget = useMemo(()=>{
23
- return currentInteraction?.targets?.find((t)=>t.uid === uid);
23
+ return currentInteraction?.targets?.find((t)=>t.uid === uid && t.type !== 'PAGE');
24
24
  }, [
25
25
  currentInteraction,
26
26
  uid
27
27
  ]);
28
28
  const isCurrentInteractionTrigger = useMemo(()=>{
29
- return currentInteraction?.self?.uid === uid;
29
+ return currentInteraction?.self?.uid === uid && currentInteraction?.self?.type !== 'PAGE';
30
30
  }, [
31
31
  currentInteraction,
32
32
  uid
@@ -37,76 +37,15 @@ const InteractionSuffix = ({ tag, uid })=>{
37
37
  isCurrentInteractionTarget,
38
38
  isCurrentInteractionTrigger
39
39
  ]);
40
- const positionOffset = useMemo(()=>{
41
- if (isCurrentInteractionTrigger && isCurrentInteractionTarget) {
42
- return 80;
43
- }
44
- return 40;
45
- }, [
46
- isCurrentInteractionTrigger,
47
- isCurrentInteractionTarget
48
- ]);
49
40
  if (!isDisplay) {
50
41
  return /*#__PURE__*/ jsx(Fragment, {});
51
42
  }
52
- return /*#__PURE__*/ jsxs(Fragment, {
53
- children: [
54
- isSelectOnPage && /*#__PURE__*/ jsx("button", {
55
- className: "gp-bg-[#F4F4F4] gp-px-2 gp-py-0.5 gp-rounded-lg gp-text-[#212121] gp-text-sm gp-font-medium gp-hidden interaction-use-element-btn",
56
- onClick: closeSelectOnPage,
57
- children: "Use element"
58
- }),
59
- /*#__PURE__*/ jsx("div", {
60
- className: "hidden gp-left-[-40px] gp-left-[-80px] gp-right-[-40px] gp-right-[-80px]"
61
- }),
62
- /*#__PURE__*/ jsxs("div", {
63
- className: `gp-hidden gp-absolute interaction-suffix gp-gap-[8px] ${tag == 'Section' ? `gp-left-[-${positionOffset}px]` : `gp-right-[-${positionOffset}px]`}`,
64
- children: [
65
- isCurrentInteractionTrigger && /*#__PURE__*/ jsx("div", {
66
- className: `gp-h-8 gp-rounded-[8px] gp-w-8 gp-bg-[#212121] gp-flex gp-justify-center gp-items-center `,
67
- children: /*#__PURE__*/ jsx("svg", {
68
- width: "16",
69
- height: "16",
70
- viewBox: "0 0 16 16",
71
- fill: "none",
72
- xmlns: "http://www.w3.org/2000/svg",
73
- children: /*#__PURE__*/ jsx("path", {
74
- fillRule: "evenodd",
75
- clipRule: "evenodd",
76
- d: "M12.9196 5.80449C13.0989 5.80449 13.1876 6.02216 13.0595 6.14749L4.83569 14.1892C4.69517 14.3267 4.46149 14.2002 4.49967 14.0074L5.50422 8.93537C5.53483 8.7808 5.41656 8.6368 5.25898 8.6368H3.08019C2.92551 8.6368 2.82938 8.46874 2.90779 8.33541L6.72099 1.85154C6.75692 1.79045 6.8225 1.75293 6.89338 1.75293H12.5729C12.7386 1.75293 12.8324 1.94273 12.7319 2.07435L10.1891 5.40272C10.0634 5.56724 10.1807 5.80449 10.3877 5.80449H12.9196Z",
77
- fill: "#F9F9F9"
78
- })
79
- })
80
- }),
81
- isCurrentInteractionTarget && /*#__PURE__*/ jsx("div", {
82
- className: `gp-h-8 min-w-8 gp-rounded-[8px] gp-w-8 gp-bg-[#212121] gp-flex gp-justify-center gp-items-center`,
83
- children: /*#__PURE__*/ jsxs("svg", {
84
- width: "16",
85
- height: "16",
86
- viewBox: "0 0 16 16",
87
- fill: "none",
88
- xmlns: "http://www.w3.org/2000/svg",
89
- children: [
90
- /*#__PURE__*/ jsx("path", {
91
- d: "M8.58987 2.11238C8.62815 2.66333 8.21254 3.141 7.66158 3.17928C6.73192 3.24386 5.84034 3.57396 5.09276 4.13034C4.34519 4.68673 3.77304 5.44602 3.44429 6.31801C3.11554 7.19 3.04401 8.13803 3.23821 9.04947C3.4324 9.96092 3.88415 10.7975 4.53978 11.4597C5.19541 12.122 6.02737 12.5821 6.93682 12.7854C7.84626 12.9888 8.79496 12.9268 9.67021 12.6068C10.5455 12.2869 11.3105 11.7224 11.8743 10.9804C12.4382 10.2385 12.7772 9.35025 12.8512 8.42129C12.895 7.87074 13.3768 7.45996 13.9273 7.50377C14.4779 7.54758 14.8887 8.0294 14.8449 8.57994C14.7406 9.8906 14.2622 11.1438 13.4667 12.1906C12.6711 13.2374 11.5918 14.0338 10.3569 14.4852C9.12204 14.9367 7.78353 15.0241 6.50041 14.7373C5.2173 14.4504 4.0435 13.8012 3.11848 12.8668C2.19345 11.9324 1.55609 10.7522 1.28211 9.46624C1.00813 8.1803 1.10905 6.84274 1.57287 5.61247C2.03669 4.3822 2.84393 3.31093 3.89867 2.52593C4.95342 1.74093 6.21133 1.27521 7.52297 1.18409C8.07393 1.14581 8.5516 1.56142 8.58987 2.11238Z",
92
- fill: "#F9F9F9"
93
- }),
94
- /*#__PURE__*/ jsx("path", {
95
- fillRule: "evenodd",
96
- clipRule: "evenodd",
97
- d: "M11.9757 1.25658C12.184 1.31428 12.3452 1.47958 12.3976 1.68929L12.7872 3.24774L14.3457 3.63736C14.5554 3.68978 14.7207 3.85096 14.7784 4.05928C14.8361 4.2676 14.7773 4.49085 14.6244 4.64371L12.7167 6.55141C12.5677 6.70044 12.3514 6.76035 12.1469 6.70924L10.5688 6.3147L8.42436 8.45912C8.19005 8.69344 7.81015 8.69344 7.57583 8.45912C7.34152 8.22481 7.34152 7.84491 7.57583 7.61059L9.72025 5.46617L9.32572 3.88804C9.2746 3.68357 9.33451 3.46728 9.48354 3.31825L11.3912 1.41054C11.5441 1.25769 11.7674 1.19888 11.9757 1.25658ZM10.8795 5.15545L12.1084 5.46267L13.0266 4.54451L12.1469 4.3246C11.9319 4.27086 11.7641 4.10301 11.7104 3.88804L11.4904 3.0084L10.5723 3.92656L10.8795 5.15545Z",
98
- fill: "#F9F9F9"
99
- }),
100
- /*#__PURE__*/ jsx("path", {
101
- d: "M7.35783 6.45343C7.87208 6.25201 8.12568 5.67185 7.92426 5.15761C7.72284 4.64336 7.14268 4.38976 6.62844 4.59118C6.05705 4.81498 5.55049 5.17772 5.15453 5.64655C4.75858 6.11538 4.4857 6.67552 4.36055 7.27631C4.23539 7.87709 4.26189 8.49961 4.43764 9.08758C4.6134 9.67555 4.93289 10.2105 5.36727 10.6439C5.80165 11.0774 6.33722 11.3958 6.92556 11.5702C7.51391 11.7445 8.13643 11.7695 8.73683 11.6427C9.33723 11.5158 9.89652 11.2413 10.3641 10.8439C10.8318 10.4465 11.1929 9.93885 11.4151 9.36679C11.615 8.85196 11.3597 8.27254 10.8449 8.07262C10.3301 7.87269 9.75066 8.12797 9.55073 8.6428C9.44887 8.9051 9.28329 9.1378 9.06901 9.3199C8.85474 9.50199 8.59851 9.62774 8.32352 9.68582C8.04853 9.7439 7.76341 9.73249 7.49394 9.65262C7.22445 9.57274 6.97907 9.42691 6.78001 9.22825C6.58093 9.0296 6.43446 8.78439 6.35386 8.51478C6.27327 8.24517 6.26112 7.9597 6.31851 7.6842C6.37591 7.4087 6.50102 7.1519 6.68251 6.93702C6.86399 6.72214 7.0961 6.55595 7.35783 6.45343Z",
102
- fill: "#F9F9F9"
103
- })
104
- ]
105
- })
106
- })
107
- ]
108
- })
109
- ]
43
+ return /*#__PURE__*/ jsx(Fragment, {
44
+ children: isSelectOnPage && /*#__PURE__*/ jsx("button", {
45
+ className: "gp-bg-[#F4F4F4] gp-px-2 gp-py-0.5 gp-rounded-lg gp-text-[#212121] gp-text-sm gp-font-medium gp-hidden interaction-use-custom-element",
46
+ onClick: closeSelectOnPage,
47
+ children: "Use element"
48
+ })
110
49
  });
111
50
  };
112
51
 
@@ -211,7 +211,7 @@ const RenderCustomCode = (item)=>{
211
211
  };
212
212
  const appendAnimation = (props, liquid)=>{
213
213
  const { advanced, tag } = props;
214
- const { animation, op: opacity, hasAnimationInteraction, displayInitInteraction = true } = advanced ?? {};
214
+ const { animation, op: opacity, hasAnimationInteraction, displayInitInteraction } = advanced ?? {};
215
215
  const getAnimationType = (settings, type)=>{
216
216
  return settings?.triggerConfig?.[type]?.animation ?? 'none';
217
217
  };
@@ -239,7 +239,8 @@ const appendAnimation = (props, liquid)=>{
239
239
  };
240
240
  return template`
241
241
  <gp-animation
242
- display-init="${!displayInitInteraction ? 'hide' : 'show'}"
242
+ gp-interaction-wrapper
243
+ display-init="${displayInitInteraction === false ? 'hide' : 'show'}"
243
244
  gp-data='${JSON.stringify({
244
245
  config: animation,
245
246
  tag,
@@ -54,6 +54,14 @@ const createPageStoreProvider = (data)=>createStore((set)=>({
54
54
  selectType
55
55
  }
56
56
  }));
57
+ },
58
+ setInteractionSettingType: (settingType)=>{
59
+ set((state)=>({
60
+ interactionData: {
61
+ ...state.interactionData,
62
+ settingType
63
+ }
64
+ }));
57
65
  }
58
66
  }));
59
67
  const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
@@ -63,7 +71,7 @@ const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffe
63
71
  productOffers,
64
72
  publicStoreFrontData,
65
73
  interactionData: {
66
- selectType: 'element'
74
+ selectType: 'ELEMENT'
67
75
  }
68
76
  }), [
69
77
  dynamicProduct,
@@ -0,0 +1,13 @@
1
+ const PublishedShopMetasDocument = `
2
+ query PublishedShopMetas($keys: [String!]) {
3
+ publishedShopMetas(keys: $keys) {
4
+ id
5
+ createdAt
6
+ updatedAt
7
+ key
8
+ value
9
+ }
10
+ }
11
+ `;
12
+
13
+ export { PublishedShopMetasDocument };
@@ -51,10 +51,16 @@ const animations = ()=>{
51
51
  'left',
52
52
  'right'
53
53
  ].includes(direction ?? '') ? 'X' : 'Y';
54
- const isNeg = [
54
+ let isNeg = [
55
55
  'left',
56
56
  'down'
57
57
  ].includes(direction ?? '') ? '-' : '';
58
+ if (reverse) {
59
+ isNeg = [
60
+ 'left',
61
+ 'down'
62
+ ].includes(direction ?? '') ? '' : '-';
63
+ }
58
64
  const preset = [
59
65
  {
60
66
  opacity: 0,
@@ -124,7 +130,10 @@ const animations = ()=>{
124
130
  opacity: 1
125
131
  }
126
132
  ];
127
- const zoomPreset = zoomDirection === 'in' ? zoomInPreset : zoomOutPreset;
133
+ let zoomPreset = zoomDirection === 'in' ? zoomInPreset : zoomOutPreset;
134
+ if (reverse) {
135
+ zoomPreset = zoomDirection === 'in' ? zoomOutPreset : zoomInPreset;
136
+ }
128
137
  return generateAnimationInstance(target, reverse ? zoomPreset.reverse() : zoomPreset, {
129
138
  ...generateOptions(normalizedOptions, 700)
130
139
  });
@@ -11,7 +11,9 @@ const getStyleBackgroundByDevice = (background, options)=>{
11
11
  ...getStyleBgColor(background)
12
12
  } : {},
13
13
  ...!options?.ignoreBackgroundImage ? {
14
- ...getStyleBgImage(background, options),
14
+ ...getStyleBgImage(background, options)
15
+ } : {},
16
+ ...!options?.ignoreBackgroundImageProperties ? {
15
17
  ...getStyleBgPosition(background),
16
18
  ...getStyleBgSize(background),
17
19
  ...getStyleBgRepeat(background)
@@ -1,6 +1,6 @@
1
+ import { useRef } from 'react';
1
2
  import 'react/jsx-runtime';
2
3
  import 'zustand';
3
- import 'react';
4
4
  import 'swr';
5
5
  import { usePageStore } from '../../contexts/PageContext.js';
6
6
  import '@gem-sdk/adapter-shopify';
@@ -15,9 +15,17 @@ import 'dayjs';
15
15
  import '../convert.js';
16
16
 
17
17
  const useInteraction = ()=>{
18
+ const ref = useRef(null);
18
19
  const setInteractionIsSelectOnPage = usePageStore((s)=>s.setInteractionIsSelectOnPage);
20
+ function findElementIncludingSelf(element, selector) {
21
+ if (!(element instanceof Document) && element?.matches(selector)) {
22
+ return element;
23
+ } else {
24
+ return element?.querySelector(selector);
25
+ }
26
+ }
19
27
  const onListener = ({ event, selector }, callback)=>{
20
- const element = document.querySelector(selector);
28
+ const element = findElementIncludingSelf(ref.current || document, selector);
21
29
  if (!element) return;
22
30
  element.addEventListener(event, (e)=>{
23
31
  const event = e;
@@ -25,8 +33,8 @@ const useInteraction = ()=>{
25
33
  if (callback) callback(params);
26
34
  });
27
35
  };
28
- const trigger = ({ event, data, selector })=>{
29
- const element = document.querySelector(selector);
36
+ const trigger = ({ event, data, selector, element: elementParam })=>{
37
+ const element = elementParam || document.querySelector(selector);
30
38
  if (!element) return;
31
39
  const eventDispatch = new CustomEvent(event, {
32
40
  bubbles: false,
@@ -57,7 +65,9 @@ const useInteraction = ()=>{
57
65
  onListener,
58
66
  trigger,
59
67
  saveToElementInteractionData,
60
- closeSelectOnPage
68
+ closeSelectOnPage,
69
+ ref,
70
+ findElementIncludingSelf
61
71
  };
62
72
  };
63
73
 
@@ -112,5 +112,17 @@ const YotpoReviewsV3UgcConfig = {
112
112
  appId: 'eb7dfd7d-db44-4334-bc49-c893b51b36cf'
113
113
  }
114
114
  };
115
+ const WhatmoreShoppableVideosreelConfig = {
116
+ WhatmoreShoppableVideosreel: {
117
+ appName: 'whatmore-shoppable-videos',
118
+ appId: '20db8a72-315a-4364-8885-64219ee48303'
119
+ }
120
+ };
121
+ const ProductOptionsCustomizerConfig = {
122
+ ProductOptionsCustomizer: {
123
+ appName: 'product-options-customizer',
124
+ appId: '6857ca6c-35eb-4b6f-9d58-a039f31d9406'
125
+ }
126
+ };
115
127
 
116
- export { BonLoyaltyRewardsReferralsConfig, EasyBundleBuilderSkailamaConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, KiteFreeGiftDiscountConfig, LoopSubscriptionsConfig, PreorderNowPreOrderPqConfig, PreorderNowWodPresaleConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SubifySubscriptionsConfig, UnlimitedBundlesDiscountsConfig, YotpoReviewsV3UgcConfig };
128
+ export { BonLoyaltyRewardsReferralsConfig, EasyBundleBuilderSkailamaConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, KiteFreeGiftDiscountConfig, LoopSubscriptionsConfig, PreorderNowPreOrderPqConfig, PreorderNowWodPresaleConfig, ProductOptionsCustomizerConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SubifySubscriptionsConfig, UnlimitedBundlesDiscountsConfig, WhatmoreShoppableVideosreelConfig, YotpoReviewsV3UgcConfig };
@@ -86,6 +86,13 @@ const overrideSettings = (tag, currentSetting, appSetting)=>{
86
86
  bundle_id: appSetting?.['customBundleId']
87
87
  };
88
88
  }
89
+ case 'PumperBundlesVolumeDiscount':
90
+ {
91
+ return {
92
+ ...currentSetting,
93
+ selected_product: appSetting?.['productHandle'] || '{{ product }}'
94
+ };
95
+ }
89
96
  default:
90
97
  return currentSetting;
91
98
  }
@@ -105,7 +112,7 @@ const ReviewxpoProductReviewsApp = {
105
112
  const PumperBundlesVolumeDiscount = {
106
113
  PumperBundlesVolumeDiscount: {
107
114
  'app-block': {
108
- selected_product: '{{product}}',
115
+ selected_product: '{{ product }}',
109
116
  using_page_builder: false
110
117
  }
111
118
  }
@@ -205,7 +212,86 @@ const YotpoReviews = {
205
212
  }
206
213
  }
207
214
  };
215
+ const WhatmoreShoppableVideosreel = {
216
+ WhatmoreShoppableVideosreel: {
217
+ 'app-block': {
218
+ "heading": "Watch and Buy",
219
+ "template-type": "template-f",
220
+ "show-views": "show",
221
+ "ui-theme": "round",
222
+ "color-primary": "#343434",
223
+ "color-secondary": "#343434",
224
+ "title-font": "poppins_n4",
225
+ "primary-font": "poppins_n4",
226
+ "title-font-size": 40,
227
+ "title-font-size-portrait": 24,
228
+ "landscape-padding": 40,
229
+ "top-bottom-padding": 20,
230
+ "scroll-video-tile-size": 80,
231
+ "scroll-video-tile-size-portrait": 80,
232
+ "min-height": 380
233
+ },
234
+ 'app-block-banner': {
235
+ "template-type": "template-banner-a",
236
+ "ui-theme": "round",
237
+ "banner-video-tile-size": 80
238
+ },
239
+ 'app-block-collections': {
240
+ "collectionHeading": "W",
241
+ "template-type": "template-collections-b",
242
+ "ui-theme": "round",
243
+ "color-secondary": "#343434",
244
+ "primary-font": "poppins_n4",
245
+ "tile-size": 60,
246
+ "tile-size-portrait": 60,
247
+ "min-height": 250
248
+ },
249
+ 'app-block-stories': {
250
+ "template-type": "template-stories-a",
251
+ "ui-theme": "round",
252
+ "color-primary": "#343434",
253
+ "color-secondary": "#343434",
254
+ "primary-font": "poppins_n4",
255
+ "stories-top-bottom-padding": 0,
256
+ "story-tile-size": 40,
257
+ "story-tile-size-desktop": 40
258
+ }
259
+ }
260
+ };
261
+ const ProductOptionsCustomizer = {
262
+ ProductOptionsCustomizer: {
263
+ 'product-page-customizer': {
264
+ "pc_container_size": 100,
265
+ "pc_show_options_total": "initial",
266
+ "pc_customizations_total_text": "Customizations Total:",
267
+ "pc_show_preloader": "hide",
268
+ "pc_preloader_color": "",
269
+ "pc_ignore_redirect_command": true,
270
+ "pc_basic_label_text_color": "#000000",
271
+ "pc_basic_label_font_size": 14,
272
+ "pc_basic_label_bolden": "unset",
273
+ "pc_basic_label_space_above": 0,
274
+ "pc_basic_option_background_color": "#FFFFFF",
275
+ "pc_basic_option_text_color": "#000000",
276
+ "pc_basic_option_border_color": "#000000",
277
+ "pc_basic_option_border_style": "solid",
278
+ "pc_basic_option_border_width": 1,
279
+ "pc_basic_option_curve_the_corners": "none",
280
+ "pc_basic_option_font_size": 14,
281
+ "pc_basic_option_bolden": "none",
282
+ "pc_basic_option_width": 100,
283
+ "pc_basic_option_space_above": 0,
284
+ "pc_basic_option_space_below": 0,
285
+ "pc_basic_option_space_inside": 10,
286
+ "pc_advanced_custom_css": "",
287
+ "pc_advanced_custom_js": "",
288
+ "pc_show_image_swatch_preview": false
289
+ }
290
+ }
291
+ };
208
292
  const composeSettingsByWidgetType = {
293
+ ...ProductOptionsCustomizer,
294
+ ...WhatmoreShoppableVideosreel,
209
295
  ...JunipProductReviewsUgc,
210
296
  ...FlyBundlesUpsellsFbt,
211
297
  ...PreorderNowWodPresale,
@@ -1,4 +1,4 @@
1
- import { RechargeSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, SubifySubscriptionsConfig, SelleasyConfig, LoopSubscriptionsConfig, SkioSubscriptionsYcS20Config, ShopifyFormsConfig, ReviewxpoProductReviewsAppConfig, PumperBundlesVolumeDiscountConfig, UnlimitedBundlesDiscountsConfig, KiteFreeGiftDiscountConfig, FastBundleBundlesDiscountsConfig, SimpleBundlesKitsConfig, EasyBundleBuilderSkailamaConfig, PreorderNowPreOrderPqConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, PreorderNowWodPresaleConfig, YotpoReviewsV3UgcConfig } from './appConfig.js';
1
+ import { RechargeSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, SubifySubscriptionsConfig, SelleasyConfig, LoopSubscriptionsConfig, SkioSubscriptionsYcS20Config, ShopifyFormsConfig, ReviewxpoProductReviewsAppConfig, PumperBundlesVolumeDiscountConfig, UnlimitedBundlesDiscountsConfig, KiteFreeGiftDiscountConfig, FastBundleBundlesDiscountsConfig, SimpleBundlesKitsConfig, EasyBundleBuilderSkailamaConfig, PreorderNowPreOrderPqConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, PreorderNowWodPresaleConfig, YotpoReviewsV3UgcConfig, WhatmoreShoppableVideosreelConfig, ProductOptionsCustomizerConfig } from './appConfig.js';
2
2
 
3
3
  const mapShopifyAppMeta = {
4
4
  ...RechargeSubscriptionsConfig,
@@ -19,7 +19,9 @@ const mapShopifyAppMeta = {
19
19
  ...FlyBundlesUpsellsFbtConfig,
20
20
  ...JunipProductReviewsUgcConfig,
21
21
  ...PreorderNowWodPresaleConfig,
22
- ...YotpoReviewsV3UgcConfig
22
+ ...YotpoReviewsV3UgcConfig,
23
+ ...WhatmoreShoppableVideosreelConfig,
24
+ ...ProductOptionsCustomizerConfig
23
25
  };
24
26
  const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
25
27
 
@@ -12,7 +12,8 @@ const useAnimationConfig = (props)=>{
12
12
  const { animation, setting } = triggerConfig[trigger];
13
13
  return {
14
14
  type: animation,
15
- setting: setting[animation]
15
+ setting: setting[animation],
16
+ reverse: trigger === "hidden"
16
17
  };
17
18
  }, [
18
19
  configByDevices
@@ -21,13 +21,13 @@ const useApplyAnimation = ({ props })=>{
21
21
  setAnimationOnFinish,
22
22
  setToolbarActive
23
23
  });
24
- const generateAnimation = useCallback(({ target, setting, type })=>{
25
- return animation[type](target, setting);
24
+ const generateAnimation = useCallback(({ target, setting, type, reverse })=>{
25
+ return animation[type](target, setting, reverse);
26
26
  }, [
27
27
  animation
28
28
  ]);
29
29
  const initListAnimations = useCallback(()=>{
30
- const { type, setting } = getAnimationConfig();
30
+ const { type, setting, reverse } = getAnimationConfig();
31
31
  if (!type || type === AnimationType.None || !targetObjects.current.length) {
32
32
  cancelAnimation();
33
33
  return;
@@ -35,9 +35,9 @@ const useApplyAnimation = ({ props })=>{
35
35
  const listAnimations = targetObjects.current.map((item)=>generateAnimation({
36
36
  type,
37
37
  setting,
38
- target: item.target
38
+ target: item.target,
39
+ reverse
39
40
  }));
40
- console.log('listAnimations', listAnimations);
41
41
  cancelAnimation();
42
42
  setAnimation(listAnimations);
43
43
  }, [
package/dist/esm/index.js CHANGED
@@ -17,6 +17,7 @@ export { ModalProvider, useModalStore } from './contexts/ModalContext.js';
17
17
  export { ArticleListProvider, useArticleListStore } from './contexts/ArticleListContext.js';
18
18
  export { ArticleProvider, useArticleStore } from './contexts/ArticleContext.js';
19
19
  export { PageViewUpDocument } from './graphql/mutations/page-view-up.generated.js';
20
+ export { PublishedShopMetasDocument } from './graphql/queries/published-shop-metas.js';
20
21
  export { CollectionDetailFilterDocument } from './graphql/queries/collection-detail-filter.generated.js';
21
22
  export { CollectionDocument } from './graphql/queries/collection.generated.js';
22
23
  export { CollectionsDocument } from './graphql/queries/collections.generated.js';