@gem-sdk/components 2.0.0-dev.367 → 2.0.0-dev.369

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 (34) hide show
  1. package/dist/cjs/builder.js +104 -102
  2. package/dist/cjs/index.js +2 -0
  3. package/dist/cjs/index.liquid.js +2 -0
  4. package/dist/cjs/line/components/Divider.liquid.js +1 -1
  5. package/dist/cjs/line/components/Line.liquid.js +1 -1
  6. package/dist/cjs/sticky/components/Sticky.js +18 -113
  7. package/dist/cjs/sticky/components/Sticky.liquid.js +18 -51
  8. package/dist/cjs/sticky/components/common/styles.js +42 -0
  9. package/dist/cjs/sticky/components/hooks/useSticky.js +119 -0
  10. package/dist/cjs/sticky/index.js +1 -0
  11. package/dist/cjs/third-party/components/AppstleBundlesDiscounts.js +33 -0
  12. package/dist/cjs/third-party/components/AppstleBundlesDiscounts.liquid.js +12 -0
  13. package/dist/cjs/third-party/configs/AppstleBundlesDiscounts.js +12 -0
  14. package/dist/cjs/third-party/index.js +3 -1
  15. package/dist/cjs/third-party/next.js +5 -0
  16. package/dist/cjs/third-party/setting/AppstleBundlesDiscounts.js +146 -0
  17. package/dist/esm/builder.js +104 -102
  18. package/dist/esm/index.js +1 -0
  19. package/dist/esm/index.liquid.js +1 -0
  20. package/dist/esm/line/components/Divider.liquid.js +1 -1
  21. package/dist/esm/line/components/Line.liquid.js +1 -1
  22. package/dist/esm/sticky/components/Sticky.js +19 -114
  23. package/dist/esm/sticky/components/Sticky.liquid.js +19 -52
  24. package/dist/esm/sticky/components/common/styles.js +40 -0
  25. package/dist/esm/sticky/components/hooks/useSticky.js +114 -0
  26. package/dist/esm/sticky/index.js +1 -0
  27. package/dist/esm/third-party/components/AppstleBundlesDiscounts.js +29 -0
  28. package/dist/esm/third-party/components/AppstleBundlesDiscounts.liquid.js +8 -0
  29. package/dist/esm/third-party/configs/AppstleBundlesDiscounts.js +8 -0
  30. package/dist/esm/third-party/index.js +3 -1
  31. package/dist/esm/third-party/next.js +5 -0
  32. package/dist/esm/third-party/setting/AppstleBundlesDiscounts.js +142 -0
  33. package/dist/types/index.d.ts +18 -1
  34. package/package.json +2 -2
@@ -1,71 +1,30 @@
1
1
  'use client';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
- import { makeStyleResponsive, usePageStore, useCurrentDevice, cls, getStyleBackgroundByDevice, isEmptyChildren } from '@gem-sdk/core';
3
+ import { getStyleBackgroundByDevice, composeClasses, cls, isEmptyChildren } from '@gem-sdk/core';
4
4
  import Head from 'next/head';
5
5
  import ChildrenDroppable from '../../grid/components/ChildrenDroppable.js';
6
- import { useMemo, useCallback } from 'react';
6
+ import 'react';
7
7
  import { ELEMENT_Z_INDEX } from '../../common/const.js';
8
- import { createStyleObject } from '../../grid/row/commons/helpers.js';
8
+ import useSticky, { minimizeSvg } from './hooks/useSticky.js';
9
+ import { createStyle, createClass } from '@gem-sdk/system';
9
10
 
10
11
  const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
11
- const { width, fullWidth, position, minimize, background, preloadBgImage } = setting ?? {};
12
- const styleObject = createStyleObject(width, fullWidth ?? {
13
- desktop: false,
14
- tablet: false,
15
- mobile: false
12
+ const { minimize, background, preloadBgImage } = setting ?? {};
13
+ const { w, displayStyle, positionStyle, getCSSAlign } = useSticky(setting);
14
+ const computedContainerStyles = createStyle({
15
+ margin: '0 auto',
16
+ ...style,
17
+ ...w,
18
+ ...getStyleBackgroundByDevice(background),
19
+ ...displayStyle(),
20
+ ...positionStyle(),
21
+ ...getCSSAlign(),
22
+ zIndex: ELEMENT_Z_INDEX.STICKY
16
23
  });
17
- const w = makeStyleResponsive('w', styleObject.content);
18
- const sidebarMode = usePageStore((s)=>s.sidebarMode === 'interaction');
19
- const currentDevice = useCurrentDevice();
20
- const getCSSPosition = (position)=>{
21
- return position == 'top' ? 'sticky' : 'fixed';
22
- };
23
- const getCSSAlignByDevice = (position, device)=>{
24
- return {
25
- [`--left${device}`]: position == 'top' ? '0' : '50%',
26
- [`--t${device}`]: position == 'top' ? 'unset' : 'translateX(-50%)'
27
- };
28
- };
29
- const getCSSAlign = ()=>{
30
- return {
31
- ...getCSSAlignByDevice(position?.desktop, ''),
32
- ...getCSSAlignByDevice(position?.tablet ?? position?.desktop, '-tablet'),
33
- ...getCSSAlignByDevice(position?.mobile ?? position?.desktop, '-mobile')
34
- };
35
- };
36
- const gap = useMemo(()=>{
37
- if (sidebarMode && position?.[currentDevice] === 'top') {
38
- return '40px';
39
- }
40
- return undefined;
41
- }, [
42
- currentDevice,
43
- sidebarMode,
44
- position
45
- ]);
46
- const displayStyle = useCallback(()=>{
47
- return {
48
- [`--top`]: gap ?? 'auto',
49
- [`--top-tablet`]: gap ?? 'auto',
50
- [`--top-mobile`]: gap ?? 'auto',
51
- [`--${position?.desktop}`]: gap ?? 0,
52
- [`--${position?.tablet ?? position?.desktop}-tablet`]: gap ?? 0,
53
- [`--${position?.mobile ?? position?.desktop}-mobile`]: gap ?? 0
54
- };
55
- }, [
56
- gap,
57
- position
58
- ]);
59
- const positionStyle = ()=>{
60
- return {
61
- [`--pos`]: getCSSPosition(position?.desktop),
62
- [`--pos-tablet`]: getCSSPosition(position?.tablet ?? position?.desktop),
63
- [`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop)
64
- };
65
- };
24
+ const computedMinimizeClasses = createClass(composeClasses('sticky-minimize gp-fixed gp-flex gp-h-[32px] gp-w-[76px] gp-cursor-pointer gp-items-center gp-gap-[4px] gp-border gp-border-[#D8E1FF] gp-bg-white hover:gp-bg-[#D8E1FF]'));
66
25
  if (minimize) {
67
26
  return /*#__PURE__*/ jsxs("div", {
68
- className: "sticky-minimize gp-fixed gp-flex gp-h-[32px] gp-w-[76px] gp-cursor-pointer gp-items-center gp-gap-[4px] gp-border gp-border-[#D8E1FF] gp-bg-white hover:gp-bg-[#D8E1FF]",
27
+ className: computedMinimizeClasses,
69
28
  "data-uid": builderProps?.uid,
70
29
  "data-id": builderProps?.uid,
71
30
  ...builderAttrs,
@@ -74,52 +33,7 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
74
33
  zIndex: ELEMENT_Z_INDEX.STICKY
75
34
  },
76
35
  children: [
77
- /*#__PURE__*/ jsxs("svg", {
78
- className: "gp-ml-[7px]",
79
- width: "16",
80
- height: "16",
81
- viewBox: "0 0 16 16",
82
- fill: "none",
83
- xmlns: "http://www.w3.org/2000/svg",
84
- children: [
85
- /*#__PURE__*/ jsx("path", {
86
- fillRule: "evenodd",
87
- clipRule: "evenodd",
88
- d: "M5.75 1.25C4.64543 1.25 3.75 2.14543 3.75 3.25C3.75 4.35457 4.64543 5.25 5.75 5.25C6.85457 5.25 7.75 4.35457 7.75 3.25C7.75 2.14543 6.85457 1.25 5.75 1.25ZM4.75 3.25C4.75 2.69772 5.19772 2.25 5.75 2.25C6.30228 2.25 6.75 2.69772 6.75 3.25C6.75 3.80228 6.30228 4.25 5.75 4.25C5.19772 4.25 4.75 3.80228 4.75 3.25Z",
89
- fill: "#3C67FF"
90
- }),
91
- /*#__PURE__*/ jsx("path", {
92
- fillRule: "evenodd",
93
- clipRule: "evenodd",
94
- d: "M5.75 6C4.64543 6 3.75 6.89543 3.75 8C3.75 9.10457 4.64543 10 5.75 10C6.85457 10 7.75 9.10457 7.75 8C7.75 6.89543 6.85457 6 5.75 6ZM4.75 8C4.75 7.44772 5.19772 7 5.75 7C6.30228 7 6.75 7.44772 6.75 8C6.75 8.55228 6.30228 9 5.75 9C5.19772 9 4.75 8.55228 4.75 8Z",
95
- fill: "#3C67FF"
96
- }),
97
- /*#__PURE__*/ jsx("path", {
98
- fillRule: "evenodd",
99
- clipRule: "evenodd",
100
- d: "M3.75 12.75C3.75 11.6454 4.64543 10.75 5.75 10.75C6.85457 10.75 7.75 11.6454 7.75 12.75C7.75 13.8546 6.85457 14.75 5.75 14.75C4.64543 14.75 3.75 13.8546 3.75 12.75ZM5.75 11.75C5.19772 11.75 4.75 12.1977 4.75 12.75C4.75 13.3023 5.19772 13.75 5.75 13.75C6.30228 13.75 6.75 13.3023 6.75 12.75C6.75 12.1977 6.30228 11.75 5.75 11.75Z",
101
- fill: "#3C67FF"
102
- }),
103
- /*#__PURE__*/ jsx("path", {
104
- fillRule: "evenodd",
105
- clipRule: "evenodd",
106
- d: "M10.25 1.25C9.14543 1.25 8.25 2.14543 8.25 3.25C8.25 4.35457 9.14543 5.25 10.25 5.25C11.3546 5.25 12.25 4.35457 12.25 3.25C12.25 2.14543 11.3546 1.25 10.25 1.25ZM9.25 3.25C9.25 2.69772 9.69772 2.25 10.25 2.25C10.8023 2.25 11.25 2.69772 11.25 3.25C11.25 3.80228 10.8023 4.25 10.25 4.25C9.69772 4.25 9.25 3.80228 9.25 3.25Z",
107
- fill: "#3C67FF"
108
- }),
109
- /*#__PURE__*/ jsx("path", {
110
- fillRule: "evenodd",
111
- clipRule: "evenodd",
112
- d: "M8.25 8C8.25 6.89543 9.14543 6 10.25 6C11.3546 6 12.25 6.89543 12.25 8C12.25 9.10457 11.3546 10 10.25 10C9.14543 10 8.25 9.10457 8.25 8ZM10.25 7C9.69772 7 9.25 7.44772 9.25 8C9.25 8.55228 9.69772 9 10.25 9C10.8023 9 11.25 8.55228 11.25 8C11.25 7.44772 10.8023 7 10.25 7Z",
113
- fill: "#3C67FF"
114
- }),
115
- /*#__PURE__*/ jsx("path", {
116
- fillRule: "evenodd",
117
- clipRule: "evenodd",
118
- d: "M10.25 10.75C9.14543 10.75 8.25 11.6454 8.25 12.75C8.25 13.8546 9.14543 14.75 10.25 14.75C11.3546 14.75 12.25 13.8546 12.25 12.75C12.25 11.6454 11.3546 10.75 10.25 10.75ZM9.25 12.75C9.25 12.1977 9.69772 11.75 10.25 11.75C10.8023 11.75 11.25 12.1977 11.25 12.75C11.25 13.3023 10.8023 13.75 10.25 13.75C9.69772 13.75 9.25 13.3023 9.25 12.75Z",
119
- fill: "#3C67FF"
120
- })
121
- ]
122
- }),
36
+ minimizeSvg,
123
37
  /*#__PURE__*/ jsx("span", {
124
38
  className: "gp-text-[12px] gp-font-medium gp-text-[#3C67FF]",
125
39
  children: "Sticky"
@@ -151,16 +65,7 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
151
65
  /*#__PURE__*/ jsx("div", {
152
66
  className: cls('sticky-wrapper', builderProps?.uid),
153
67
  id: builderProps?.uid,
154
- style: {
155
- margin: '0 auto',
156
- ...style,
157
- ...w,
158
- ...getStyleBackgroundByDevice(background),
159
- ...displayStyle(),
160
- ...positionStyle(),
161
- ...getCSSAlign(),
162
- zIndex: ELEMENT_Z_INDEX.STICKY
163
- },
68
+ style: computedContainerStyles,
164
69
  children: /*#__PURE__*/ jsx("div", {
165
70
  ...builderAttrs,
166
71
  "data-id": builderProps?.uid,
@@ -1,50 +1,21 @@
1
- import { makeWidth, template, RenderIf, makeStyleResponsive, getStyleBackgroundByDevice, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
1
+ import { makeWidth, composeClasses, template, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
2
  import { getSettingPreloadData } from '../../helpers.js';
3
- import 'react/jsx-runtime';
4
- import 'react';
5
- import { ELEMENT_Z_INDEX } from '../../common/const.js';
3
+ import { createStyle, createClass, createStateOrContext } from '@gem-sdk/system';
4
+ import { getContainerStyles } from './common/styles.js';
6
5
 
7
6
  const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced })=>{
8
7
  const { width, fullWidth, position, background, display, preloadBgImage, isScrollToTop } = setting ?? {};
9
8
  const advancedDisplay = advanced?.d;
10
9
  const w = makeWidth(width, fullWidth);
11
- const getCSSPosition = (position)=>{
12
- return position == 'top' ? 'sticky' : 'fixed';
13
- };
14
- const getCSSAlignByDevice = (position, device)=>{
15
- return {
16
- [`--left${device}`]: position == 'top' ? '0' : '50%',
17
- [`--t${device}`]: position == 'top' ? 'unset' : 'translateX(-50%)'
18
- };
19
- };
20
- const getCSSAlign = ()=>{
21
- return {
22
- ...getCSSAlignByDevice(position?.desktop, ''),
23
- ...getCSSAlignByDevice(position?.tablet ?? position?.desktop, '-tablet'),
24
- ...getCSSAlignByDevice(position?.mobile ?? position?.desktop, '-mobile')
25
- };
26
- };
27
- const getDisplayStyle = (device, display, position)=>{
28
- const style = {
29
- [`--top${device}`]: 'auto',
30
- [`--${position + device}`]: '0',
31
- [`--pos${device}`]: getCSSPosition(position)
32
- };
33
- if (display === 'after-first-cart-button') style[`--d${device}`] = 'none';
34
- return style;
35
- };
36
- const displayStyle = ()=>{
37
- return {
38
- ...getDisplayStyle('', display?.desktop, position?.desktop),
39
- ...getDisplayStyle('-tablet', display?.tablet ?? display?.desktop, position?.tablet ?? position?.desktop),
40
- ...getDisplayStyle('-mobile', display?.mobile ?? display?.desktop, position?.mobile ?? position?.desktop)
41
- };
42
- };
43
- return template`
44
- ${RenderIf(!!preloadBgImage, `${RenderIf(!!background?.desktop?.image?.src, `<link rel="preload" href="${background?.desktop?.image?.src}" as="image" />`)}${RenderIf(!!background?.tablet?.image?.src, `<link rel="preload" href="${background?.tablet?.image?.src}" as="image" />`)}${RenderIf(!!background?.mobile?.image?.src, `<link rel="preload" href="${background?.mobile?.image?.src}" as="image" />`)}`)}
45
- <gp-sticky
46
- data-id="${builderProps?.uid}"
47
- gp-data='${JSON.stringify({
10
+ const computedContainerStyles = createStyle(getContainerStyles({
11
+ w,
12
+ background,
13
+ position,
14
+ style,
15
+ display
16
+ }));
17
+ const computedContainerClasses = createClass(composeClasses(`${builderProps?.uid} ${getSettingPreloadData('gps-lazy')} ${advanced?.cssClass} ${isScrollToTop ? '!gp-pointer-events-none [&_gp-button_a]:!gp-pointer-events-auto' : ''}`));
18
+ const createDataState = createStateOrContext({
48
19
  uid: builderProps?.uid,
49
20
  setting: {
50
21
  display
@@ -52,19 +23,15 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced
52
23
  advanced: {
53
24
  d: advancedDisplay
54
25
  }
55
- })}'
26
+ });
27
+ return template`
28
+ ${RenderIf(!!preloadBgImage, `${RenderIf(!!background?.desktop?.image?.src, `<link rel="preload" href="${background?.desktop?.image?.src}" as="image" />`)}${RenderIf(!!background?.tablet?.image?.src, `<link rel="preload" href="${background?.tablet?.image?.src}" as="image" />`)}${RenderIf(!!background?.mobile?.image?.src, `<link rel="preload" href="${background?.mobile?.image?.src}" as="image" />`)}`)}
29
+ <gp-sticky
30
+ gp-data='${JSON.stringify(createDataState)}'
56
31
  id="${builderProps?.uid}"
57
32
  data-id="${builderProps?.uid}"
58
- class="${builderProps?.uid} ${getSettingPreloadData('gps-lazy')} ${advanced?.cssClass} ${isScrollToTop ? '!gp-pointer-events-none [&_gp-button_a]:!gp-pointer-events-auto' : ''}"
59
- style="${{
60
- margin: '0 auto',
61
- ...style,
62
- ...makeStyleResponsive('w', w),
63
- ...getStyleBackgroundByDevice(background),
64
- ...displayStyle(),
65
- ...getCSSAlign(),
66
- 'z-index': ELEMENT_Z_INDEX.STICKY
67
- }}"
33
+ class="${computedContainerClasses}"
34
+ style="${computedContainerStyles}"
68
35
  >
69
36
  <div ${{
70
37
  ...builderAttrs
@@ -0,0 +1,40 @@
1
+ import { makeStyleResponsive, getStyleBackgroundByDevice } from '@gem-sdk/core';
2
+ import { getDisplayStyle } from '../../../helpers.js';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
5
+ import { ELEMENT_Z_INDEX } from '../../../common/const.js';
6
+
7
+ const getCSSAlignByDevice = (position, device)=>{
8
+ return {
9
+ [`--left${device}`]: position == 'top' ? '0' : '50%',
10
+ [`--t${device}`]: position == 'top' ? 'unset' : 'translateX(-50%)'
11
+ };
12
+ };
13
+ const getCSSAlign = (position)=>{
14
+ return {
15
+ ...getCSSAlignByDevice(position?.desktop, ''),
16
+ ...getCSSAlignByDevice(position?.tablet ?? position?.desktop, '-tablet'),
17
+ ...getCSSAlignByDevice(position?.mobile ?? position?.desktop, '-mobile')
18
+ };
19
+ };
20
+ const displayStyle = (display, position)=>{
21
+ return {
22
+ ...getDisplayStyle('', display?.desktop),
23
+ ...getDisplayStyle('-tablet', display?.tablet ?? display?.desktop),
24
+ ...getDisplayStyle('-mobile', display?.mobile ?? display?.desktop)
25
+ };
26
+ };
27
+ const getContainerStyles = (args)=>{
28
+ const { style, w, background, position, display } = args;
29
+ return {
30
+ margin: '0 auto',
31
+ ...style,
32
+ ...makeStyleResponsive('w', w),
33
+ ...getStyleBackgroundByDevice(background),
34
+ ...displayStyle(display),
35
+ ...getCSSAlign(position),
36
+ 'z-index': ELEMENT_Z_INDEX.STICKY
37
+ };
38
+ };
39
+
40
+ export { getContainerStyles };
@@ -0,0 +1,114 @@
1
+ import { makeStyleResponsive, usePageStore, useCurrentDevice } from '@gem-sdk/core';
2
+ import { createStyleObject } from '../../../grid/row/commons/helpers.js';
3
+ import { useMemo, useCallback } from 'react';
4
+
5
+ const minimizeSvg = ` <svg
6
+ className="gp-ml-[7px]"
7
+ width="16"
8
+ height="16"
9
+ viewBox="0 0 16 16"
10
+ fill="none"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ >
13
+ <path
14
+ fillRule="evenodd"
15
+ clipRule="evenodd"
16
+ d="M5.75 1.25C4.64543 1.25 3.75 2.14543 3.75 3.25C3.75 4.35457 4.64543 5.25 5.75 5.25C6.85457 5.25 7.75 4.35457 7.75 3.25C7.75 2.14543 6.85457 1.25 5.75 1.25ZM4.75 3.25C4.75 2.69772 5.19772 2.25 5.75 2.25C6.30228 2.25 6.75 2.69772 6.75 3.25C6.75 3.80228 6.30228 4.25 5.75 4.25C5.19772 4.25 4.75 3.80228 4.75 3.25Z"
17
+ fill="#3C67FF"
18
+ />
19
+ <path
20
+ fillRule="evenodd"
21
+ clipRule="evenodd"
22
+ d="M5.75 6C4.64543 6 3.75 6.89543 3.75 8C3.75 9.10457 4.64543 10 5.75 10C6.85457 10 7.75 9.10457 7.75 8C7.75 6.89543 6.85457 6 5.75 6ZM4.75 8C4.75 7.44772 5.19772 7 5.75 7C6.30228 7 6.75 7.44772 6.75 8C6.75 8.55228 6.30228 9 5.75 9C5.19772 9 4.75 8.55228 4.75 8Z"
23
+ fill="#3C67FF"
24
+ />
25
+ <path
26
+ fillRule="evenodd"
27
+ clipRule="evenodd"
28
+ d="M3.75 12.75C3.75 11.6454 4.64543 10.75 5.75 10.75C6.85457 10.75 7.75 11.6454 7.75 12.75C7.75 13.8546 6.85457 14.75 5.75 14.75C4.64543 14.75 3.75 13.8546 3.75 12.75ZM5.75 11.75C5.19772 11.75 4.75 12.1977 4.75 12.75C4.75 13.3023 5.19772 13.75 5.75 13.75C6.30228 13.75 6.75 13.3023 6.75 12.75C6.75 12.1977 6.30228 11.75 5.75 11.75Z"
29
+ fill="#3C67FF"
30
+ />
31
+ <path
32
+ fillRule="evenodd"
33
+ clipRule="evenodd"
34
+ d="M10.25 1.25C9.14543 1.25 8.25 2.14543 8.25 3.25C8.25 4.35457 9.14543 5.25 10.25 5.25C11.3546 5.25 12.25 4.35457 12.25 3.25C12.25 2.14543 11.3546 1.25 10.25 1.25ZM9.25 3.25C9.25 2.69772 9.69772 2.25 10.25 2.25C10.8023 2.25 11.25 2.69772 11.25 3.25C11.25 3.80228 10.8023 4.25 10.25 4.25C9.69772 4.25 9.25 3.80228 9.25 3.25Z"
35
+ fill="#3C67FF"
36
+ />
37
+ <path
38
+ fillRule="evenodd"
39
+ clipRule="evenodd"
40
+ d="M8.25 8C8.25 6.89543 9.14543 6 10.25 6C11.3546 6 12.25 6.89543 12.25 8C12.25 9.10457 11.3546 10 10.25 10C9.14543 10 8.25 9.10457 8.25 8ZM10.25 7C9.69772 7 9.25 7.44772 9.25 8C9.25 8.55228 9.69772 9 10.25 9C10.8023 9 11.25 8.55228 11.25 8C11.25 7.44772 10.8023 7 10.25 7Z"
41
+ fill="#3C67FF"
42
+ />
43
+ <path
44
+ fillRule="evenodd"
45
+ clipRule="evenodd"
46
+ d="M10.25 10.75C9.14543 10.75 8.25 11.6454 8.25 12.75C8.25 13.8546 9.14543 14.75 10.25 14.75C11.3546 14.75 12.25 13.8546 12.25 12.75C12.25 11.6454 11.3546 10.75 10.25 10.75ZM9.25 12.75C9.25 12.1977 9.69772 11.75 10.25 11.75C10.8023 11.75 11.25 12.1977 11.25 12.75C11.25 13.3023 10.8023 13.75 10.25 13.75C9.69772 13.75 9.25 13.3023 9.25 12.75Z"
47
+ fill="#3C67FF"
48
+ />
49
+ </svg>`;
50
+ const useSticky = (setting)=>{
51
+ const { width, fullWidth, position } = setting ?? {};
52
+ const styleObject = createStyleObject(width, fullWidth ?? {
53
+ desktop: false,
54
+ tablet: false,
55
+ mobile: false
56
+ });
57
+ const w = makeStyleResponsive('w', styleObject.content);
58
+ const sidebarMode = usePageStore((s)=>s.sidebarMode === 'interaction');
59
+ const currentDevice = useCurrentDevice();
60
+ const getCSSPosition = (position)=>{
61
+ return position == 'top' ? 'sticky' : 'fixed';
62
+ };
63
+ const getCSSAlignByDevice = (position, device)=>{
64
+ return {
65
+ [`--left${device}`]: position == 'top' ? '0' : '50%',
66
+ [`--t${device}`]: position == 'top' ? 'unset' : 'translateX(-50%)'
67
+ };
68
+ };
69
+ const getCSSAlign = ()=>{
70
+ return {
71
+ ...getCSSAlignByDevice(position?.desktop, ''),
72
+ ...getCSSAlignByDevice(position?.tablet ?? position?.desktop, '-tablet'),
73
+ ...getCSSAlignByDevice(position?.mobile ?? position?.desktop, '-mobile')
74
+ };
75
+ };
76
+ const gap = useMemo(()=>{
77
+ if (sidebarMode && position?.[currentDevice] === 'top') {
78
+ return '40px';
79
+ }
80
+ return undefined;
81
+ }, [
82
+ currentDevice,
83
+ sidebarMode,
84
+ position
85
+ ]);
86
+ const displayStyle = useCallback(()=>{
87
+ return {
88
+ [`--top`]: gap ?? 'auto',
89
+ [`--top-tablet`]: gap ?? 'auto',
90
+ [`--top-mobile`]: gap ?? 'auto',
91
+ [`--${position?.desktop}`]: gap ?? 0,
92
+ [`--${position?.tablet ?? position?.desktop}-tablet`]: gap ?? 0,
93
+ [`--${position?.mobile ?? position?.desktop}-mobile`]: gap ?? 0
94
+ };
95
+ }, [
96
+ gap,
97
+ position
98
+ ]);
99
+ const positionStyle = ()=>{
100
+ return {
101
+ [`--pos`]: getCSSPosition(position?.desktop),
102
+ [`--pos-tablet`]: getCSSPosition(position?.tablet ?? position?.desktop),
103
+ [`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop)
104
+ };
105
+ };
106
+ return {
107
+ w,
108
+ displayStyle,
109
+ positionStyle,
110
+ getCSSAlign
111
+ };
112
+ };
113
+
114
+ export { useSticky as default, minimizeSvg };
@@ -2,6 +2,7 @@ import 'react/jsx-runtime';
2
2
  import '@gem-sdk/core';
3
3
  import 'next/head';
4
4
  import 'react';
5
+ import '@gem-sdk/system';
5
6
  import config from './setting/Sticky.js';
6
7
 
7
8
  const stickySetting = {
@@ -0,0 +1,29 @@
1
+ 'use client';
2
+ import { jsx, Fragment } from 'react/jsx-runtime';
3
+ import { makeStyleResponsive } from '@gem-sdk/core';
4
+ import ThirdPartyPreview from './ThirdPartyPreview.js';
5
+ import AppConfig from '../configs/AppstleBundlesDiscounts.js';
6
+
7
+ const AppstleBundlesDiscountsContent = ()=>{
8
+ return /*#__PURE__*/ jsx(Fragment, {
9
+ children: /*#__PURE__*/ jsx("div", {
10
+ className: "gp-p-2",
11
+ children: /*#__PURE__*/ jsx(ThirdPartyPreview, {
12
+ setting: {
13
+ label: 'Appstle℠ Bundles & Discounts',
14
+ iconSvg: `<img class="gp-w-[24px] gp-border gp-border-[#494949] gp-rounded-[3px]" src="${AppConfig.logoUrl}">`
15
+ }
16
+ })
17
+ })
18
+ });
19
+ };
20
+ const AppstleBundlesDiscounts = ({ setting })=>{
21
+ return /*#__PURE__*/ jsx("div", {
22
+ style: {
23
+ ...makeStyleResponsive('ta', setting?.align)
24
+ },
25
+ children: /*#__PURE__*/ jsx(AppstleBundlesDiscountsContent, {})
26
+ });
27
+ };
28
+
29
+ export { AppstleBundlesDiscounts as default };
@@ -0,0 +1,8 @@
1
+ import { getLiquidForAppBlock } from '../helpers/thirdParty.js';
2
+
3
+ const AppstleBundlesDiscounts = ({ setting, advanced })=>{
4
+ const { align, appBlockId } = setting ?? {};
5
+ return getLiquidForAppBlock(appBlockId, align, advanced?.cssClass);
6
+ };
7
+
8
+ export { AppstleBundlesDiscounts as default };
@@ -0,0 +1,8 @@
1
+ var AppConfig = {
2
+ id: 'appstle-bundles-discounts',
3
+ label: 'Appstle Bundles & Discounts',
4
+ logoUrl: 'https://cdn.shopify.com/app-store/listing_images/855ee74552c1cca133c12a4364890912/icon/CO69r8mp0oQDEAE=.png',
5
+ tag: 'AppstleBundlesDiscounts'
6
+ };
7
+
8
+ export { AppConfig as default };
@@ -157,6 +157,7 @@ import config$1K from './setting/AlsoBoughtCbb.js';
157
157
  import config$1L from './setting/HextomFreeShippingBar.js';
158
158
  import config$1M from './setting/EcoboostifyShoppableReelUgc.js';
159
159
  import config$1N from './setting/EcomsendBackInStockAlert.js';
160
+ import config$1O from './setting/AppstleBundlesDiscounts.js';
160
161
 
161
162
  const thirdPartySetting = {
162
163
  EstimatedDeliveryDatePlus: config,
@@ -272,7 +273,8 @@ const thirdPartySetting = {
272
273
  AlsoBoughtCbb: config$1K,
273
274
  HextomFreeShippingBar: config$1L,
274
275
  EcoboostifyShoppableReelUgc: config$1M,
275
- EcomsendBackInStockAlert: config$1N
276
+ EcomsendBackInStockAlert: config$1N,
277
+ AppstleBundlesDiscounts: config$1O
276
278
  };
277
279
 
278
280
  export { thirdPartySetting };
@@ -8,6 +8,10 @@ const EcomsendBackInStockAlert = dynamic(()=>import('./components/EcomsendBackIn
8
8
  ssr: false,
9
9
  loading: Loading
10
10
  });
11
+ const AppstleBundlesDiscounts = dynamic(()=>import('./components/AppstleBundlesDiscounts.js'), {
12
+ ssr: false,
13
+ loading: Loading
14
+ });
11
15
  const EstimatedDeliveryDatePlus = dynamic(()=>import('./components/EstimatedDeliveryDatePlus.js'), {
12
16
  ssr: false,
13
17
  loading: Loading
@@ -462,6 +466,7 @@ const EcoboostifyShoppableReelUgc = dynamic(()=>import('./components/Ecoboostify
462
466
  });
463
467
  var thirdParty = {
464
468
  EcomsendBackInStockAlert,
469
+ AppstleBundlesDiscounts,
465
470
  EcoboostifyShoppableReelUgc,
466
471
  EstimatedDeliveryDatePlus,
467
472
  OkendoReviewsLoyalty,
@@ -0,0 +1,142 @@
1
+ import AppConfig from '../configs/AppstleBundlesDiscounts.js';
2
+
3
+ const config = {
4
+ tag: AppConfig.tag,
5
+ label: AppConfig.label,
6
+ icon: '<img class="gp-w-[24px] gp-border gp-border-[#494949] gp-rounded-[3px]" src="https://cdn.shopify.com/app-store/listing_images/855ee74552c1cca133c12a4364890912/icon/CO69r8mp0oQDEAE=.png">',
7
+ editorConfigs: {
8
+ placeholder: {
9
+ flowTag: [
10
+ 'Product'
11
+ ]
12
+ },
13
+ component: {
14
+ isThirdParty: true
15
+ }
16
+ },
17
+ presets: [
18
+ {
19
+ id: AppConfig.id,
20
+ name: {
21
+ en: AppConfig.label
22
+ },
23
+ hideTextContent: true,
24
+ icon: {
25
+ desktop: `<div class="w-full flex flex-col items-center">
26
+ <img class="w-24 border border-dark-200 rounded-medium" src="https://cdn.shopify.com/app-store/listing_images/855ee74552c1cca133c12a4364890912/icon/CO69r8mp0oQDEAE=.png">
27
+ <span class="preset-item-title">Appstle℠ Bundles & Discounts</span>
28
+ </div>`
29
+ },
30
+ components: [
31
+ {
32
+ tag: AppConfig.tag
33
+ }
34
+ ]
35
+ }
36
+ ],
37
+ settings: [
38
+ {
39
+ id: 'setting',
40
+ controls: [
41
+ {
42
+ id: 'appBlockId',
43
+ type: 'input',
44
+ default: ''
45
+ },
46
+ {
47
+ id: 'widgetType',
48
+ label: 'Choose widget',
49
+ type: 'select',
50
+ options: [
51
+ {
52
+ label: 'Classic Bundle',
53
+ value: 'appstle-classic-bundle'
54
+ },
55
+ {
56
+ label: 'Dynamic Bundle',
57
+ value: 'appstle-bundle-product-page-build-a-box'
58
+ }
59
+ ],
60
+ default: 'appstle-classic-bundle'
61
+ },
62
+ {
63
+ id: 'install',
64
+ type: 'open-link',
65
+ target: '_blank',
66
+ linkType: 'install',
67
+ href: 'https://apps.shopify.com/appstle-bundles?utm_source=gempages',
68
+ appName: AppConfig.label
69
+ },
70
+ {
71
+ id: 'openApp',
72
+ type: 'open-link',
73
+ target: '_blank',
74
+ linkType: 'openApp',
75
+ href: '',
76
+ appName: AppConfig.label
77
+ },
78
+ {
79
+ id: 'align',
80
+ label: 'Alignment',
81
+ type: 'segment',
82
+ options: [
83
+ {
84
+ label: 'Left',
85
+ value: 'left',
86
+ type: 'align'
87
+ },
88
+ {
89
+ label: 'Center',
90
+ value: 'center',
91
+ type: 'align'
92
+ },
93
+ {
94
+ label: 'Right',
95
+ value: 'right',
96
+ type: 'align'
97
+ }
98
+ ],
99
+ devices: {
100
+ desktop: {
101
+ default: 'left'
102
+ }
103
+ }
104
+ }
105
+ ]
106
+ }
107
+ ],
108
+ ui: [
109
+ {
110
+ type: 'control',
111
+ setting: {
112
+ id: 'install'
113
+ }
114
+ },
115
+ {
116
+ type: 'control',
117
+ label: {
118
+ en: 'Choose widget'
119
+ },
120
+ setting: {
121
+ id: 'widgetType'
122
+ }
123
+ },
124
+ {
125
+ type: 'control',
126
+ setting: {
127
+ id: 'openApp'
128
+ }
129
+ },
130
+ {
131
+ type: 'control',
132
+ label: {
133
+ en: 'Align'
134
+ },
135
+ setting: {
136
+ id: 'align'
137
+ }
138
+ }
139
+ ]
140
+ };
141
+
142
+ export { config as default };