@gem-sdk/core 1.48.0-dev.0 → 1.48.0

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 (42) hide show
  1. package/dist/cjs/components/ComponentToolbarPreview.js +100 -114
  2. package/dist/cjs/components/ComponentWrapperPreview.js +2 -16
  3. package/dist/cjs/components/Render.liquid.js +6 -21
  4. package/dist/cjs/components/RenderPreview.js +0 -1
  5. package/dist/cjs/components/constant.js +1 -2
  6. package/dist/cjs/contexts/PageContext.js +1 -29
  7. package/dist/cjs/contexts/SectionContext.js +1 -0
  8. package/dist/cjs/helpers/colors.js +1 -1
  9. package/dist/cjs/helpers/shadow.js +1 -1
  10. package/dist/cjs/helpers/third-party/addAppBlockId.js +1 -1
  11. package/dist/cjs/helpers/third-party/appConfig.js +0 -14
  12. package/dist/cjs/helpers/third-party/appSetting.js +0 -22
  13. package/dist/cjs/helpers/third-party/constant.js +1 -3
  14. package/dist/cjs/hooks/animation/useApplyAnimation.js +0 -1
  15. package/dist/cjs/hooks/useFormatMoney.js +60 -61
  16. package/dist/cjs/index.js +0 -12
  17. package/dist/esm/components/ComponentToolbarPreview.js +100 -114
  18. package/dist/esm/components/ComponentWrapperPreview.js +2 -16
  19. package/dist/esm/components/Render.liquid.js +6 -21
  20. package/dist/esm/components/RenderPreview.js +0 -1
  21. package/dist/esm/components/constant.js +1 -2
  22. package/dist/esm/contexts/PageContext.js +1 -29
  23. package/dist/esm/contexts/SectionContext.js +1 -0
  24. package/dist/esm/helpers/colors.js +1 -1
  25. package/dist/esm/helpers/shadow.js +1 -1
  26. package/dist/esm/helpers/third-party/addAppBlockId.js +1 -1
  27. package/dist/esm/helpers/third-party/appConfig.js +1 -13
  28. package/dist/esm/helpers/third-party/appSetting.js +0 -22
  29. package/dist/esm/helpers/third-party/constant.js +2 -4
  30. package/dist/esm/hooks/animation/useApplyAnimation.js +0 -1
  31. package/dist/esm/hooks/useFormatMoney.js +61 -61
  32. package/dist/esm/index.js +1 -3
  33. package/dist/types/index.d.ts +3 -168
  34. package/package.json +3 -3
  35. package/dist/cjs/components/InteractionSuffix.js +0 -107
  36. package/dist/cjs/helpers/align.js +0 -19
  37. package/dist/cjs/hooks/useInteraction.js +0 -19
  38. package/dist/cjs/types/custom.js +0 -44
  39. package/dist/esm/components/InteractionSuffix.js +0 -105
  40. package/dist/esm/helpers/align.js +0 -17
  41. package/dist/esm/hooks/useInteraction.js +0 -17
  42. package/dist/esm/types/custom.js +0 -44
@@ -5,71 +5,70 @@ var shop = require('./shop.js');
5
5
  const shopifyPriceRounding = (amount, precision)=>{
6
6
  return parseFloat(`${amount}`).toFixed(Number(precision) + 1).slice(0, -1);
7
7
  };
8
- const formatMoney = function(cents, format) {
9
- let value = '';
10
- const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
11
- const formatString = format || '${{amount}}';
12
- /**
13
- * check default
14
- * @param opt opt
15
- * @param def def
16
- * @returns any
17
- */ function defaultOption(opt, def) {
18
- return typeof opt == 'undefined' ? def : opt;
19
- }
20
- /**
21
- * formatWithDelimiters
22
- * @param number number
23
- * @param precision precision
24
- * @param thousands thousands
25
- * @param decimal decimal
26
- * @returns any
27
- */ // eslint-disable-next-line max-params
28
- function formatWithDelimiters(number, precision, thousands, decimal) {
29
- precision = defaultOption(precision, 2);
30
- thousands = defaultOption(thousands, ',');
31
- decimal = defaultOption(decimal, '.');
32
- if (isNaN(number) || number == null) {
33
- return 0;
34
- }
35
- // shopify làm tròn bằng cách cắt đi các số ở đằng sau chứ không sử dụng toFixed để làm tròn như toán học
36
- number = shopifyPriceRounding(number, Number(precision));
37
- const parts = number.split('.'), dollars = parts[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + thousands), cents = parts[1] ? decimal + parts[1] : '';
38
- return dollars + cents;
39
- }
40
- switch(formatString.match(placeholderRegex)[1]){
41
- case 'amount':
42
- value = formatWithDelimiters(cents, 2);
43
- break;
44
- case 'amount_no_decimals':
45
- value = formatWithDelimiters(cents, 0);
46
- break;
47
- case 'amount_with_comma_separator':
48
- value = formatWithDelimiters(cents, 2, '.', ',');
49
- break;
50
- case 'amount_no_decimals_with_comma_separator':
51
- value = formatWithDelimiters(cents, 0, '.', ',');
52
- break;
53
- case 'amount_with_apostrophe_separator':
54
- value = formatWithDelimiters(cents, 2, "'", '.');
55
- break;
56
- case 'amount_no_decimals_with_space_separator':
57
- value = formatWithDelimiters(cents, 0, ' ');
58
- break;
59
- case 'amount_with_space_separator':
60
- value = formatWithDelimiters(cents, 2, ' ', ',');
61
- break;
62
- case 'amount_with_period_and_space_separator':
63
- value = formatWithDelimiters(cents, 2, ' ', '.');
64
- break;
65
- }
66
- return formatString.replace(placeholderRegex, value);
67
- };
68
8
  const useFormatMoney = (amount, withCurrency)=>{
69
9
  const { moneyFormat, moneyWithCurrencyFormat } = shop.useMoneyFormat();
10
+ const formatMoney = function(cents, format) {
11
+ let value = '';
12
+ const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
13
+ const formatString = format || '${{amount}}';
14
+ /**
15
+ * check default
16
+ * @param opt opt
17
+ * @param def def
18
+ * @returns any
19
+ */ function defaultOption(opt, def) {
20
+ return typeof opt == 'undefined' ? def : opt;
21
+ }
22
+ /**
23
+ * formatWithDelimiters
24
+ * @param number number
25
+ * @param precision precision
26
+ * @param thousands thousands
27
+ * @param decimal decimal
28
+ * @returns any
29
+ */ // eslint-disable-next-line max-params
30
+ function formatWithDelimiters(number, precision, thousands, decimal) {
31
+ precision = defaultOption(precision, 2);
32
+ thousands = defaultOption(thousands, ',');
33
+ decimal = defaultOption(decimal, '.');
34
+ if (isNaN(number) || number == null) {
35
+ return 0;
36
+ }
37
+ // shopify làm tròn bằng cách cắt đi các số ở đằng sau chứ không sử dụng toFixed để làm tròn như toán học
38
+ number = shopifyPriceRounding(number, Number(precision));
39
+ const parts = number.split('.'), dollars = parts[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + thousands), cents = parts[1] ? decimal + parts[1] : '';
40
+ return dollars + cents;
41
+ }
42
+ switch(formatString.match(placeholderRegex)[1]){
43
+ case 'amount':
44
+ value = formatWithDelimiters(cents, 2);
45
+ break;
46
+ case 'amount_no_decimals':
47
+ value = formatWithDelimiters(cents, 0);
48
+ break;
49
+ case 'amount_with_comma_separator':
50
+ value = formatWithDelimiters(cents, 2, '.', ',');
51
+ break;
52
+ case 'amount_no_decimals_with_comma_separator':
53
+ value = formatWithDelimiters(cents, 0, '.', ',');
54
+ break;
55
+ case 'amount_with_apostrophe_separator':
56
+ value = formatWithDelimiters(cents, 2, "'", '.');
57
+ break;
58
+ case 'amount_no_decimals_with_space_separator':
59
+ value = formatWithDelimiters(cents, 0, ' ');
60
+ break;
61
+ case 'amount_with_space_separator':
62
+ value = formatWithDelimiters(cents, 2, ' ', ',');
63
+ break;
64
+ case 'amount_with_period_and_space_separator':
65
+ value = formatWithDelimiters(cents, 2, ' ', '.');
66
+ break;
67
+ }
68
+ return formatString.replace(placeholderRegex, value);
69
+ };
70
70
  return withCurrency ? formatMoney(`${amount}`, moneyWithCurrencyFormat || moneyFormat) : formatMoney(`${amount}`, moneyFormat);
71
71
  };
72
72
 
73
- exports.formatMoney = formatMoney;
74
73
  exports.shopifyPriceRounding = shopifyPriceRounding;
75
74
  exports.useFormatMoney = useFormatMoney;
package/dist/cjs/index.js CHANGED
@@ -60,7 +60,6 @@ var iconList = require('./helpers/icon-list.js');
60
60
  var isDefined = require('./helpers/is-defined.js');
61
61
  var layout = require('./helpers/layout.js');
62
62
  var makeStyle = require('./helpers/make-style.js');
63
- var align = require('./helpers/align.js');
64
63
  var product = require('./helpers/product.js');
65
64
  var query = require('./helpers/query.js');
66
65
  var radius = require('./helpers/radius.js');
@@ -98,7 +97,6 @@ var useProductList = require('./hooks/useProductList.js');
98
97
  var useSuspenseFetch = require('./hooks/useSuspenseFetch.js');
99
98
  var useSwatchesOptions = require('./hooks/useSwatchesOptions.js');
100
99
  var useInitialSwatchesOptions = require('./hooks/useInitialSwatchesOptions.js');
101
- var custom = require('./types/custom.js');
102
100
  var shop$1 = require('./types/shop.js');
103
101
  var appAPI = require('./types/appAPI.js');
104
102
  var globalStyle = require('./types/global-style.js');
@@ -245,7 +243,6 @@ exports.makeStyleResponsiveState = makeStyle.makeStyleResponsiveState;
245
243
  exports.makeStyleState = makeStyle.makeStyleState;
246
244
  exports.makeWidth = makeStyle.makeWidth;
247
245
  exports.removeNullUndefined = makeStyle.removeNullUndefined;
248
- exports.convertTextAlignToJustify = align.convertTextAlignToJustify;
249
246
  exports.checkAvailableVariantInStock = product.checkAvailableVariantInStock;
250
247
  exports.getSelectedVariant = product.getSelectedVariant;
251
248
  exports.parseSelectedOption = product.parseSelectedOption;
@@ -320,7 +317,6 @@ exports.useProductQuery = useProductQuery.useProductQuery;
320
317
  exports.useProductsQuery = useProductsQuery.useProductsQuery;
321
318
  exports.useProductsQueryAll = useProductsQuery.useProductsQueryAll;
322
319
  exports.useCurrentDevice = useCurrentDevice.useCurrentDevice;
323
- exports.formatMoney = useFormatMoney.formatMoney;
324
320
  exports.shopifyPriceRounding = useFormatMoney.shopifyPriceRounding;
325
321
  exports.useFormatMoney = useFormatMoney.useFormatMoney;
326
322
  exports.useLazyVideo = useLazyVideo.useLazyVideo;
@@ -359,14 +355,6 @@ exports.useProductListStyles = useProductList.useProductListStyles;
359
355
  exports.useSuspenseFetch = useSuspenseFetch.default;
360
356
  exports.useSwatchesOptions = useSwatchesOptions.default;
361
357
  exports.useInitialSwatchesOptions = useInitialSwatchesOptions.default;
362
- Object.defineProperty(exports, 'InteractionTargetEvent', {
363
- enumerable: true,
364
- get: function () { return custom.InteractionTargetEvent; }
365
- });
366
- Object.defineProperty(exports, 'InteractionTriggerEvent', {
367
- enumerable: true,
368
- get: function () { return custom.InteractionTriggerEvent; }
369
- });
370
358
  exports.ShopType = shop$1;
371
359
  exports.AppAPIType = appAPI;
372
360
  exports.OptionNormalStyle = globalStyle.OptionNormalStyle;
@@ -3,7 +3,6 @@ import { memo, useState, useMemo, useCallback, useEffect } from 'react';
3
3
  import 'zustand';
4
4
  import { useBuilderPreviewStore } from '../contexts/BuilderPreviewContext.js';
5
5
  import { useShopStore } from '../contexts/ShopContext.js';
6
- import { usePageStore } from '../contexts/PageContext.js';
7
6
  import '@gem-sdk/adapter-shopify';
8
7
  import 'swr';
9
8
  import 'swr/mutation';
@@ -18,7 +17,6 @@ import { usePostPurchase } from '../hooks/useToolbarPostPurchase.js';
18
17
  import { ableGenerateContentElements } from './constant.js';
19
18
  import { AIContentGenerator } from './ai-generator/AIContentGenerator.js';
20
19
  import { AIGenContentLoading } from './ai-generator/AIGenContentLoading.js';
21
- import { InteractionSuffix } from './InteractionSuffix.js';
22
20
  import '../helpers/convert.js';
23
21
 
24
22
  const SECTION_LIMIT = 25;
@@ -35,7 +33,6 @@ const ComponentToolbarPreview = (props)=>{
35
33
  const isShopifySection = props.isShopifySection;
36
34
  const storefrontUrl = useShopStore((s)=>s.storefrontUrl);
37
35
  const editingPageType = useShopStore((s)=>s.pageType);
38
- const interactionData = usePageStore((s)=>s.interactionData);
39
36
  const getParents = useBuilderPreviewStore((s)=>s.getParents);
40
37
  const root = useBuilderPreviewStore((s)=>s.getItem('ROOT'));
41
38
  const isThemeSectionEditor = useBuilderPreviewStore((s)=>s.isThemeSectionEditor);
@@ -55,9 +52,6 @@ const ComponentToolbarPreview = (props)=>{
55
52
  const isSaleFunnelPage = useMemo(()=>editingPageType === 'POST_PURCHASE', [
56
53
  editingPageType
57
54
  ]);
58
- const isSelectOnPage = useMemo(()=>interactionData?.isSelectOnPage, [
59
- interactionData
60
- ]);
61
55
  const { checkDisableDelete, getTooltipText, checkDisableDuplicate } = usePostPurchase(props.uid, props.tag || '');
62
56
  const editProductElementList = [
63
57
  'Product Title',
@@ -500,117 +494,109 @@ const ComponentToolbarPreview = (props)=>{
500
494
  ]
501
495
  }, parent.uid);
502
496
  }),
503
- !isSelectOnPage && /*#__PURE__*/ jsxs(Fragment, {
504
- children: [
505
- props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && !props.isShopifySection && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsx(CreateThemeSection, {
506
- ...props
507
- }),
508
- isEnableAIContent() && /*#__PURE__*/ jsx(AIContentGenerator, {
509
- ...props
510
- }),
511
- props.tag == 'Sticky' && /*#__PURE__*/ jsx("div", {
512
- "data-toolbar-zoom-out": true,
513
- onClick: (e)=>onZoomOut(e),
514
- "aria-hidden": "true",
515
- children: /*#__PURE__*/ jsx("svg", {
516
- width: "16",
517
- height: "16",
518
- viewBox: "0 0 16 16",
519
- fill: "none",
520
- xmlns: "http://www.w3.org/2000/svg",
521
- children: /*#__PURE__*/ jsx("path", {
522
- fillRule: "evenodd",
523
- clipRule: "evenodd",
524
- d: "M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",
525
- fill: "currentColor"
526
- })
527
- })
528
- }),
529
- editAbleElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsx(Tooltip, {
530
- "data-toolbar-title": true,
531
- enable: true,
532
- "data-toolbar-disable": false,
533
- text: "Edit content in Shopify",
534
- position: "top",
535
- onClick: goToShopifyEditLink,
536
- "aria-hidden": "true",
537
- children: /*#__PURE__*/ jsxs("svg", {
538
- width: "16",
539
- height: "16",
540
- viewBox: "0 0 16 16",
541
- fill: "none",
542
- xmlns: "http://www.w3.org/2000/svg",
543
- children: [
544
- /*#__PURE__*/ jsx("path", {
545
- fillRule: "evenodd",
546
- clipRule: "evenodd",
547
- d: "M8.61129 2.47348C8.61129 2.47348 8.47099 2.51557 8.23248 2.59274C8.19039 2.46647 8.13427 2.30512 8.05009 2.15079C7.78352 1.6387 7.39068 1.37212 6.91366 1.36511C6.87858 1.36511 6.85052 1.36511 6.81545 1.37212C6.80843 1.36511 6.80142 1.35634 6.7944 1.34757C6.78739 1.3388 6.78037 1.33003 6.77336 1.32302C6.56992 1.09854 6.30335 0.993314 5.98768 1.00033C5.37737 1.02137 4.76706 1.46332 4.269 2.249C3.91825 2.80319 3.65869 3.49767 3.58153 4.03082C3.38823 4.09074 3.21092 4.14586 3.05516 4.19429C2.64595 4.32151 2.3851 4.40261 2.37494 4.40261C2.01718 4.51485 2.01016 4.52888 1.96106 4.85859C1.92598 5.11113 1 12.2945 1 12.2945L7.14764 13.3583C7.18955 13.118 7.30454 12.8953 7.47848 12.7214L8.70249 11.4974V2.45945C8.66741 2.45945 8.63234 2.46647 8.61129 2.47348ZM6.82948 3.02767L6.62554 3.09101C6.27515 3.19989 5.90094 3.31617 5.5317 3.42752C5.65797 2.94349 5.89648 2.46647 6.19111 2.15079C6.30335 2.03154 6.45067 1.90527 6.63306 1.8281C6.80142 2.18587 6.83649 2.68393 6.82948 3.02767ZM5.99469 1.4072C6.13499 1.4072 6.26126 1.43526 6.36649 1.50541C6.19813 1.58959 6.0438 1.71586 5.88947 1.87721C5.50364 2.29109 5.202 2.94349 5.08274 3.56783C4.74459 3.66991 4.41804 3.77199 4.10838 3.8688L4.01646 3.89753C4.22691 2.90841 5.05468 1.43526 5.99469 1.4072ZM4.80214 7.0122C4.81874 7.26957 5.09737 7.44833 5.43473 7.66478C5.95252 7.99699 6.60867 8.41798 6.66813 9.3482C6.7453 10.5548 6.02977 11.3826 4.99154 11.4457C3.7569 11.5229 3.06943 10.7933 3.06943 10.7933L3.32899 9.67791C3.32899 9.67791 4.01646 10.197 4.56363 10.1619C4.92139 10.1409 5.04767 9.84627 5.04065 9.64283C5.01607 9.26796 4.73308 9.06671 4.41569 8.84101C4.00848 8.55142 3.54465 8.22157 3.49735 7.4331C3.42018 6.24756 4.19885 5.05501 5.91051 4.94277C6.57694 4.90068 6.91366 5.06904 6.91366 5.06904L6.52082 6.53518C6.52082 6.53518 6.08589 6.33876 5.56678 6.36682C4.80915 6.41592 4.79512 6.89294 4.80214 7.0122ZM7.23635 2.9014C7.22934 2.59274 7.19426 2.15781 7.04695 1.78601C7.50994 1.87721 7.74143 2.39632 7.83964 2.71199C7.70008 2.75665 7.54275 2.80575 7.37118 2.8593L7.23635 2.9014Z",
548
- fill: "currentColor"
549
- }),
550
- /*#__PURE__*/ jsx("path", {
551
- d: "M10.7719 3.44156C10.7757 3.47543 11.1733 6.16931 11.541 8.65883L8.95503 11.2448V2.57871C9.16548 2.78214 9.71265 3.31528 9.71265 3.31528C9.71265 3.31528 10.6106 3.32931 10.6597 3.33633C10.7088 3.34334 10.7649 3.37842 10.7719 3.44156Z",
552
- fill: "currentColor"
553
- }),
554
- /*#__PURE__*/ jsx("path", {
555
- d: "M14.8056 8.644L14.0424 7.88088C13.7832 7.62163 13.3629 7.62163 13.1036 7.88088L12.1519 8.83258L13.8539 10.5345L14.8056 9.58282C15.0648 9.32357 15.0648 8.90325 14.8056 8.644Z",
556
- fill: "currentColor"
557
- }),
558
- /*#__PURE__*/ jsx("path", {
559
- d: "M7.85018 13.0942L11.6419 9.30246L13.3438 11.0044L9.55212 14.7961C9.43782 14.9104 9.28573 14.9791 9.1244 14.9892L7.93427 15.0641C7.73484 15.0767 7.56961 14.9114 7.58216 14.712L7.65706 13.5219C7.66721 13.3606 7.73588 13.2085 7.85018 13.0942Z",
560
- fill: "currentColor"
561
- })
562
- ]
563
- })
564
- }),
565
- /*#__PURE__*/ jsx(Tooltip, {
566
- enable: props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
567
- text: "Page has reached Shopify’s 25 section-limit",
568
- position: "bottom",
569
- "data-toolbar-duplicate": true,
570
- "data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT || isDisableDuplicate,
571
- onClick: isDisableDuplicate ? undefined : (e)=>onDuplicate(e),
572
- "aria-hidden": "true",
573
- className: isDisableDuplicate ? '!gp-cursor-not-allowed' : '',
574
- children: /*#__PURE__*/ jsx("svg", {
575
- width: "16",
576
- height: "16",
577
- viewBox: "0 0 16 16",
578
- fill: "none",
579
- children: /*#__PURE__*/ jsx("path", {
580
- fillRule: "evenodd",
581
- clipRule: "evenodd",
582
- d: "M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",
583
- fill: "currentColor"
584
- })
585
- })
586
- }),
587
- /*#__PURE__*/ jsx(Tooltip, {
588
- "data-toolbar-delete": true,
589
- onClick: (e)=>isDisableDelete ? null : onDelete(e),
590
- enable: isDisableDelete,
591
- "data-toolbar-disable": isDisableDelete,
592
- width: tooltipText.width,
593
- text: tooltipText.text,
594
- position: deleteTooltipPosition,
595
- "aria-hidden": "true",
596
- children: /*#__PURE__*/ jsx("svg", {
597
- width: "16",
598
- height: "16",
599
- viewBox: "0 0 16 16",
600
- fill: "none",
601
- children: /*#__PURE__*/ jsx("path", {
602
- fillRule: "evenodd",
603
- clipRule: "evenodd",
604
- d: "M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",
605
- fill: "currentColor"
606
- })
497
+ props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && !props.isShopifySection && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsx(CreateThemeSection, {
498
+ ...props
499
+ }),
500
+ isEnableAIContent() && /*#__PURE__*/ jsx(AIContentGenerator, {
501
+ ...props
502
+ }),
503
+ props.tag == 'Sticky' && /*#__PURE__*/ jsx("div", {
504
+ "data-toolbar-zoom-out": true,
505
+ onClick: (e)=>onZoomOut(e),
506
+ "aria-hidden": "true",
507
+ children: /*#__PURE__*/ jsx("svg", {
508
+ width: "16",
509
+ height: "16",
510
+ viewBox: "0 0 16 16",
511
+ fill: "none",
512
+ xmlns: "http://www.w3.org/2000/svg",
513
+ children: /*#__PURE__*/ jsx("path", {
514
+ fillRule: "evenodd",
515
+ clipRule: "evenodd",
516
+ d: "M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",
517
+ fill: "currentColor"
518
+ })
519
+ })
520
+ }),
521
+ editAbleElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsx(Tooltip, {
522
+ "data-toolbar-title": true,
523
+ enable: true,
524
+ "data-toolbar-disable": false,
525
+ text: "Edit content in Shopify",
526
+ position: "top",
527
+ onClick: goToShopifyEditLink,
528
+ "aria-hidden": "true",
529
+ children: /*#__PURE__*/ jsxs("svg", {
530
+ width: "16",
531
+ height: "16",
532
+ viewBox: "0 0 16 16",
533
+ fill: "none",
534
+ xmlns: "http://www.w3.org/2000/svg",
535
+ children: [
536
+ /*#__PURE__*/ jsx("path", {
537
+ fillRule: "evenodd",
538
+ clipRule: "evenodd",
539
+ d: "M8.61129 2.47348C8.61129 2.47348 8.47099 2.51557 8.23248 2.59274C8.19039 2.46647 8.13427 2.30512 8.05009 2.15079C7.78352 1.6387 7.39068 1.37212 6.91366 1.36511C6.87858 1.36511 6.85052 1.36511 6.81545 1.37212C6.80843 1.36511 6.80142 1.35634 6.7944 1.34757C6.78739 1.3388 6.78037 1.33003 6.77336 1.32302C6.56992 1.09854 6.30335 0.993314 5.98768 1.00033C5.37737 1.02137 4.76706 1.46332 4.269 2.249C3.91825 2.80319 3.65869 3.49767 3.58153 4.03082C3.38823 4.09074 3.21092 4.14586 3.05516 4.19429C2.64595 4.32151 2.3851 4.40261 2.37494 4.40261C2.01718 4.51485 2.01016 4.52888 1.96106 4.85859C1.92598 5.11113 1 12.2945 1 12.2945L7.14764 13.3583C7.18955 13.118 7.30454 12.8953 7.47848 12.7214L8.70249 11.4974V2.45945C8.66741 2.45945 8.63234 2.46647 8.61129 2.47348ZM6.82948 3.02767L6.62554 3.09101C6.27515 3.19989 5.90094 3.31617 5.5317 3.42752C5.65797 2.94349 5.89648 2.46647 6.19111 2.15079C6.30335 2.03154 6.45067 1.90527 6.63306 1.8281C6.80142 2.18587 6.83649 2.68393 6.82948 3.02767ZM5.99469 1.4072C6.13499 1.4072 6.26126 1.43526 6.36649 1.50541C6.19813 1.58959 6.0438 1.71586 5.88947 1.87721C5.50364 2.29109 5.202 2.94349 5.08274 3.56783C4.74459 3.66991 4.41804 3.77199 4.10838 3.8688L4.01646 3.89753C4.22691 2.90841 5.05468 1.43526 5.99469 1.4072ZM4.80214 7.0122C4.81874 7.26957 5.09737 7.44833 5.43473 7.66478C5.95252 7.99699 6.60867 8.41798 6.66813 9.3482C6.7453 10.5548 6.02977 11.3826 4.99154 11.4457C3.7569 11.5229 3.06943 10.7933 3.06943 10.7933L3.32899 9.67791C3.32899 9.67791 4.01646 10.197 4.56363 10.1619C4.92139 10.1409 5.04767 9.84627 5.04065 9.64283C5.01607 9.26796 4.73308 9.06671 4.41569 8.84101C4.00848 8.55142 3.54465 8.22157 3.49735 7.4331C3.42018 6.24756 4.19885 5.05501 5.91051 4.94277C6.57694 4.90068 6.91366 5.06904 6.91366 5.06904L6.52082 6.53518C6.52082 6.53518 6.08589 6.33876 5.56678 6.36682C4.80915 6.41592 4.79512 6.89294 4.80214 7.0122ZM7.23635 2.9014C7.22934 2.59274 7.19426 2.15781 7.04695 1.78601C7.50994 1.87721 7.74143 2.39632 7.83964 2.71199C7.70008 2.75665 7.54275 2.80575 7.37118 2.8593L7.23635 2.9014Z",
540
+ fill: "currentColor"
541
+ }),
542
+ /*#__PURE__*/ jsx("path", {
543
+ d: "M10.7719 3.44156C10.7757 3.47543 11.1733 6.16931 11.541 8.65883L8.95503 11.2448V2.57871C9.16548 2.78214 9.71265 3.31528 9.71265 3.31528C9.71265 3.31528 10.6106 3.32931 10.6597 3.33633C10.7088 3.34334 10.7649 3.37842 10.7719 3.44156Z",
544
+ fill: "currentColor"
545
+ }),
546
+ /*#__PURE__*/ jsx("path", {
547
+ d: "M14.8056 8.644L14.0424 7.88088C13.7832 7.62163 13.3629 7.62163 13.1036 7.88088L12.1519 8.83258L13.8539 10.5345L14.8056 9.58282C15.0648 9.32357 15.0648 8.90325 14.8056 8.644Z",
548
+ fill: "currentColor"
549
+ }),
550
+ /*#__PURE__*/ jsx("path", {
551
+ d: "M7.85018 13.0942L11.6419 9.30246L13.3438 11.0044L9.55212 14.7961C9.43782 14.9104 9.28573 14.9791 9.1244 14.9892L7.93427 15.0641C7.73484 15.0767 7.56961 14.9114 7.58216 14.712L7.65706 13.5219C7.66721 13.3606 7.73588 13.2085 7.85018 13.0942Z",
552
+ fill: "currentColor"
607
553
  })
554
+ ]
555
+ })
556
+ }),
557
+ /*#__PURE__*/ jsx(Tooltip, {
558
+ enable: props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
559
+ text: "Page has reached Shopify’s 25 section-limit",
560
+ position: "bottom",
561
+ "data-toolbar-duplicate": true,
562
+ "data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT || isDisableDuplicate,
563
+ onClick: isDisableDuplicate ? undefined : (e)=>onDuplicate(e),
564
+ "aria-hidden": "true",
565
+ className: isDisableDuplicate ? '!gp-cursor-not-allowed' : '',
566
+ children: /*#__PURE__*/ jsx("svg", {
567
+ width: "16",
568
+ height: "16",
569
+ viewBox: "0 0 16 16",
570
+ fill: "none",
571
+ children: /*#__PURE__*/ jsx("path", {
572
+ fillRule: "evenodd",
573
+ clipRule: "evenodd",
574
+ d: "M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",
575
+ fill: "currentColor"
608
576
  })
609
- ]
577
+ })
610
578
  }),
611
- /*#__PURE__*/ jsx(InteractionSuffix, {
612
- tag: props.tag,
613
- uid: props.uid
579
+ /*#__PURE__*/ jsx(Tooltip, {
580
+ "data-toolbar-delete": true,
581
+ onClick: (e)=>isDisableDelete ? null : onDelete(e),
582
+ enable: isDisableDelete,
583
+ "data-toolbar-disable": isDisableDelete,
584
+ width: tooltipText.width,
585
+ text: tooltipText.text,
586
+ position: deleteTooltipPosition,
587
+ "aria-hidden": "true",
588
+ children: /*#__PURE__*/ jsx("svg", {
589
+ width: "16",
590
+ height: "16",
591
+ viewBox: "0 0 16 16",
592
+ fill: "none",
593
+ children: /*#__PURE__*/ jsx("path", {
594
+ fillRule: "evenodd",
595
+ clipRule: "evenodd",
596
+ d: "M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",
597
+ fill: "currentColor"
598
+ })
599
+ })
614
600
  })
615
601
  ]
616
602
  }, props.uid),
@@ -1,7 +1,6 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { memo, useEffect, isValidElement } from 'react';
3
3
  import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
4
- import { useInteraction } from '../hooks/useInteraction.js';
5
4
  import { disableWrap, excludeApplyStyle } from './constant.js';
6
5
  import RenderCustomCode from './RenderCustomCode.js';
7
6
  import ComponentToolbarPreview from './ComponentToolbarPreview.js';
@@ -29,19 +28,6 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
29
28
  }, [
30
29
  props.uid
31
30
  ]);
32
- const currentProps = props;
33
- const { getAnimationByUid } = useInteraction();
34
- const animationByInteraction = getAnimationByUid(props.uid);
35
- if (animationByInteraction) {
36
- currentProps.advanced = {
37
- ...currentProps.advanced,
38
- animation: {
39
- desktop: animationByInteraction,
40
- tablet: animationByInteraction,
41
- mobile: animationByInteraction
42
- }
43
- };
44
- }
45
31
  const pageType = usePageType();
46
32
  if (props.type === 'section') {
47
33
  return null;
@@ -146,7 +132,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
146
132
  return /*#__PURE__*/ jsxs(Fragment, {
147
133
  children: [
148
134
  /*#__PURE__*/ jsx(ComponentAnimation, {
149
- ...currentProps
135
+ ...props
150
136
  }),
151
137
  /*#__PURE__*/ jsx(RenderCustomCode, {
152
138
  uid: props.uid,
@@ -175,7 +161,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
175
161
  return /*#__PURE__*/ jsxs(Fragment, {
176
162
  children: [
177
163
  /*#__PURE__*/ jsx(ComponentAnimation, {
178
- ...currentProps
164
+ ...props
179
165
  }),
180
166
  /*#__PURE__*/ jsx(RenderCustomCode, {
181
167
  uid: props.uid,
@@ -35,6 +35,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
35
35
  const item = builder[uid];
36
36
  const Component = components[item?.tag];
37
37
  if (!Component) {
38
+ console.log('Miss component: ', item);
38
39
  return {
39
40
  liquid: '',
40
41
  extraFiles
@@ -71,10 +72,6 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
71
72
  parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
72
73
  pageContext,
73
74
  ...passProps,
74
- builderAttrs: {
75
- ...passProps.builderAttrs,
76
- 'data-id': uid
77
- },
78
75
  rawChildren: item.childrens.map((id)=>{
79
76
  return {
80
77
  ...builder[id],
@@ -110,15 +107,11 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
110
107
  isText: componentTexts.includes(item.tag) ? true : null,
111
108
  parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
112
109
  pageContext,
113
- ...passProps,
114
- builderAttrs: {
115
- ...passProps.builderAttrs,
116
- 'data-id': uid
117
- }
110
+ ...passProps
118
111
  });
119
112
  });
120
113
  } else {
121
- liquid = template`<div gp-el-wrapper style="${!componentIconList.includes(item.tag) ? style : ''}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
114
+ liquid = template`<div style="${!componentIconList.includes(item.tag) ? style : ''}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
122
115
  ${RenderIf(item?.childrens?.length, ()=>{
123
116
  return Component({
124
117
  builderProps: {
@@ -133,10 +126,6 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
133
126
  },
134
127
  pageContext,
135
128
  ...passProps,
136
- builderAttrs: {
137
- ...passProps.builderAttrs,
138
- 'data-id': uid
139
- },
140
129
  rawChildren: item.childrens.map((id)=>{
141
130
  return {
142
131
  ...builder[id],
@@ -173,11 +162,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
173
162
  pageContext,
174
163
  isText: componentTexts.includes(item.tag) ? true : null,
175
164
  style: componentIconList.includes(item.tag) ? style : null,
176
- ...passProps,
177
- builderAttrs: {
178
- ...passProps.builderAttrs,
179
- 'data-id': uid
180
- }
165
+ ...passProps
181
166
  });
182
167
  })}
183
168
  </div>`;
@@ -230,6 +215,7 @@ const appendAnimation = (props, liquid)=>{
230
215
  const appearTablet = getAnimationType(getSettingsByDevice('tablet'), 'appear');
231
216
  const appearMobile = getAnimationType(getSettingsByDevice('mobile'), 'appear');
232
217
  const enableAnimation = animation?.desktop?.enabled && (appearDesktop !== 'none' || hoverDesktop !== 'none') || animation?.tablet?.enabled && appearTablet !== 'none' || animation?.mobile?.enabled && appearMobile !== 'none';
218
+ if (!enableAnimation) return liquid;
233
219
  const getInitVisibility = (device)=>getSettingsByDevice(device)?.enabled && ![
234
220
  'shake',
235
221
  'none'
@@ -244,8 +230,7 @@ const appendAnimation = (props, liquid)=>{
244
230
  gp-data='${JSON.stringify({
245
231
  config: animation,
246
232
  tag,
247
- opacity,
248
- isEnableInit: enableAnimation
233
+ opacity
249
234
  })}'
250
235
  style="${{
251
236
  display: 'contents'
@@ -41,7 +41,6 @@ const RenderPreview = ({ uid, ...passProps })=>{
41
41
  setting: item.settings,
42
42
  ...passProps,
43
43
  children: item.childrens.map((id)=>/*#__PURE__*/ jsx(RenderPreviewMemo, {
44
- bundleItem: passProps?.bundleItem,
45
44
  uid: id
46
45
  }, id))
47
46
  }) : /*#__PURE__*/ jsx(Component, {
@@ -49,8 +49,7 @@ const customRenderChildren = [
49
49
  ];
50
50
  const excludeApplyStyle = [
51
51
  'IconListV2',
52
- 'IconList',
53
- 'ProductBadge'
52
+ 'IconList'
54
53
  ];
55
54
  const postPurchaseRequiredElements = [
56
55
  'PostPurchaseProductOffer',
@@ -29,31 +29,6 @@ const createPageStoreProvider = (data)=>createStore((set)=>({
29
29
  set({
30
30
  publicStoreFrontData: publicStoreFrontData
31
31
  });
32
- },
33
- setInteractionIsSelectOnPage: (value)=>{
34
- set((state)=>({
35
- interactionData: {
36
- ...state.interactionData,
37
- isSelectOnPage: value
38
- }
39
- }));
40
- },
41
- setInteractionItem: (item)=>{
42
- set((state)=>({
43
- interactionData: {
44
- ...state.interactionData,
45
- item,
46
- isSelectOnPage: state.interactionData?.isSelectOnPage || false
47
- }
48
- }));
49
- },
50
- setInteractionSelectType: (selectType)=>{
51
- set((state)=>({
52
- interactionData: {
53
- ...state.interactionData,
54
- selectType
55
- }
56
- }));
57
32
  }
58
33
  }));
59
34
  const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
@@ -61,10 +36,7 @@ const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffe
61
36
  dynamicProduct,
62
37
  dynamicCollection,
63
38
  productOffers,
64
- publicStoreFrontData,
65
- interactionData: {
66
- selectType: 'element'
67
- }
39
+ publicStoreFrontData
68
40
  }), [
69
41
  dynamicProduct,
70
42
  dynamicCollection,
@@ -8,6 +8,7 @@ const SectionContext = /*#__PURE__*/ createContext(null);
8
8
  const createSectionProvider = (data)=>createStore((set, get)=>({
9
9
  data: data ?? {},
10
10
  getSection: (id)=>{
11
+ console.log('get().data', get().data);
11
12
  const section = get().data[id];
12
13
  return section ?? undefined;
13
14
  },