@useinsider/guido 1.0.3-beta.72dd3c0 → 1.0.3-beta.734efde

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 (109) hide show
  1. package/README.md +32 -3
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +73 -79
  4. package/dist/components/organisms/header/RightSlot.vue.js +1 -1
  5. package/dist/components/organisms/header/RightSlot.vue2.js +22 -23
  6. package/dist/composables/useBlocksConfig.js +1 -2
  7. package/dist/composables/useGuidoActions.js +9 -19
  8. package/dist/composables/useStripo.js +36 -38
  9. package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
  10. package/dist/enums/defaults.js +1 -2
  11. package/dist/enums/extensions/recommendationBlock.js +2 -2
  12. package/dist/enums/unsubscribe.js +25 -27
  13. package/dist/extensions/Blocks/Checkbox/block.js +5 -2
  14. package/dist/extensions/Blocks/Items/block.js +66 -0
  15. package/dist/extensions/Blocks/Items/controls/button/link.js +68 -0
  16. package/dist/extensions/Blocks/Items/controls/cardComposition.js +99 -0
  17. package/dist/extensions/Blocks/Items/controls/image/link.js +68 -0
  18. package/dist/extensions/Blocks/Items/controls/index.js +217 -0
  19. package/dist/extensions/Blocks/Items/controls/name/trimming.js +70 -0
  20. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +107 -0
  21. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +123 -0
  22. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +76 -0
  23. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +61 -0
  24. package/dist/extensions/Blocks/Items/controls/settingsControl.js +280 -0
  25. package/dist/extensions/Blocks/Items/enums/controlEnums.js +5 -0
  26. package/dist/extensions/Blocks/Items/enums/productEnums.js +195 -0
  27. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +70 -0
  28. package/dist/extensions/Blocks/Items/extension.js +19 -0
  29. package/dist/extensions/Blocks/Items/iconsRegistry.js +32 -0
  30. package/dist/extensions/Blocks/Items/items.css.js +23 -0
  31. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +61 -0
  32. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +61 -0
  33. package/dist/extensions/Blocks/Items/settingsPanel.js +106 -0
  34. package/dist/extensions/Blocks/Items/store/items-block.js +71 -0
  35. package/dist/extensions/Blocks/Items/template.js +110 -0
  36. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +17 -0
  37. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +28 -0
  38. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +67 -0
  39. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +44 -0
  40. package/dist/extensions/Blocks/RadioButton/block.js +5 -2
  41. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +43 -43
  42. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  43. package/dist/extensions/Blocks/common-control.js +174 -110
  44. package/dist/extensions/Blocks/controlFactories.js +223 -0
  45. package/dist/extensions/DynamicContent/dynamic-content-modal.js +19 -25
  46. package/dist/extensions/DynamicContent/dynamic-content.js +33 -128
  47. package/dist/guido.css +1 -1
  48. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +213 -168
  49. package/dist/package.json.js +1 -1
  50. package/dist/services/recommendationApi.js +13 -19
  51. package/dist/src/@types/generic.d.ts +6 -27
  52. package/dist/src/components/Guido.vue.d.ts +2 -3
  53. package/dist/src/composables/useGuidoActions.d.ts +0 -9
  54. package/dist/src/extensions/Blocks/Checkbox/block.d.ts +1 -0
  55. package/dist/src/extensions/Blocks/Items/block.d.ts +13 -0
  56. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +14 -0
  57. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +20 -0
  58. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +14 -0
  59. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +501 -0
  60. package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +14 -0
  61. package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +19 -0
  62. package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +21 -0
  63. package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +14 -0
  64. package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +13 -0
  65. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +42 -0
  66. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +61 -0
  67. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +154 -0
  68. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +43 -0
  69. package/dist/src/extensions/Blocks/Items/extension.d.ts +2 -0
  70. package/dist/src/extensions/Blocks/Items/iconsRegistry.d.ts +4 -0
  71. package/dist/src/extensions/Blocks/Items/settingsPanel.d.ts +4 -0
  72. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +41 -0
  73. package/dist/src/extensions/Blocks/Items/template.d.ts +16 -0
  74. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +23 -0
  75. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +32 -0
  76. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +44 -0
  77. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +8 -0
  78. package/dist/src/extensions/Blocks/RadioButton/block.d.ts +1 -0
  79. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  80. package/dist/src/extensions/Blocks/common-control.d.ts +44 -7
  81. package/dist/src/extensions/Blocks/controlFactories.d.ts +312 -0
  82. package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -9
  83. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -52
  84. package/dist/src/stores/config.d.ts +2 -3
  85. package/dist/src/stores/dynamic-content.d.ts +3 -3
  86. package/dist/src/stores/editor.d.ts +1 -1
  87. package/dist/src/stores/onboarding.d.ts +1 -1
  88. package/dist/src/stores/preview.d.ts +1 -1
  89. package/dist/src/stores/recommendation.d.ts +1 -1
  90. package/dist/src/stores/save-as-template.d.ts +1 -1
  91. package/dist/src/stores/toaster.d.ts +1 -1
  92. package/dist/src/stores/unsubscribe.d.ts +1 -1
  93. package/dist/src/stores/version-history.d.ts +1 -1
  94. package/dist/src/utils/genericUtil.d.ts +0 -1
  95. package/dist/static/styles/customEditorStyle.css.js +1 -1
  96. package/dist/stores/config.js +5 -5
  97. package/dist/stores/dynamic-content.js +2 -2
  98. package/dist/stores/editor.js +1 -1
  99. package/dist/stores/onboarding.js +27 -27
  100. package/dist/stores/preview.js +1 -1
  101. package/dist/stores/recommendation.js +3 -3
  102. package/dist/stores/save-as-template.js +2 -2
  103. package/dist/stores/toaster.js +1 -1
  104. package/dist/stores/unsubscribe.js +1 -1
  105. package/dist/stores/version-history.js +4 -4
  106. package/dist/utils/genericUtil.js +11 -23
  107. package/package.json +12 -5
  108. package/dist/src/utils/environmentUtil.d.ts +0 -5
  109. package/dist/utils/environmentUtil.js +0 -4
@@ -1,41 +1,36 @@
1
- import { usePartner as N } from "../../composables/usePartner.js";
2
- import { LINK_REGEXES as l, LINK_TYPES as g, INSIDER_ID as f, URLS as S } from "../../enums/unsubscribe.js";
3
- import { parsePageList as U } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
- import { useConfigStore as B } from "../../stores/config.js";
5
- import { useDynamicContentStore as y } from "../../stores/dynamic-content.js";
6
- import { useUnsubscribeStore as L } from "../../stores/unsubscribe.js";
7
- const D = [
1
+ import { usePartner as U } from "../../composables/usePartner.js";
2
+ import { LINK_REGEXES as l, LINK_TYPES as b, URLS as f } from "../../enums/unsubscribe.js";
3
+ import { parsePageList as B } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
+ import { useConfigStore as N } from "../../stores/config.js";
5
+ import { useUnsubscribeStore as I } from "../../stores/unsubscribe.js";
6
+ const T = [
8
7
  {
9
8
  id: "add-unsubscribe-link-values",
10
9
  description: "Adding unsubscribe link values",
11
10
  type: "custom",
12
11
  processor: (t) => {
13
- const { getPartnerName: i } = N(), c = B(), n = y(), u = L(), a = c.getVariationId;
14
- if (!a)
12
+ const { getPartnerName: i } = U(), a = N(), n = I(), u = a.getVariationId;
13
+ if (!u)
15
14
  return t;
16
- let e = t;
17
- const r = `/${i()}/email/${a}?user={{iid}}`;
18
- return new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]").forEach((p) => {
19
- var b;
20
- const m = p.getAttribute("data-unsubscribe-page-list");
21
- if (!m)
15
+ let o = t;
16
+ const e = `/${i()}/email/${u}?user={{iid}}`;
17
+ return new DOMParser().parseFromString(o, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]").forEach((p) => {
18
+ var g;
19
+ const d = p.getAttribute("data-unsubscribe-page-list");
20
+ if (!d)
22
21
  return;
23
- const R = U(m), d = ((b = u.templates) == null ? void 0 : b.filter(
24
- (o) => R.includes(o.id)
25
- )) ?? [], _ = d.some((o) => o.type === g.UNSUBSCRIBE_LINK_TYPE), I = d.some((o) => o.type === g.PREFERENCES_LINK_TYPE), E = p.outerHTML;
22
+ const S = B(d), m = ((g = n.templates) == null ? void 0 : g.filter(
23
+ (c) => S.includes(c.id)
24
+ )) ?? [], R = m.some((c) => c.type === b.UNSUBSCRIBE_LINK_TYPE), _ = m.some((c) => c.type === b.PREFERENCES_LINK_TYPE), E = p.outerHTML;
26
25
  let s = E;
27
- _ && (n.selectedDynamicContentList.push({
28
- text: f,
29
- value: f,
30
- fallback: ""
31
- }), s = s.replace(
26
+ R && (s = s.replace(
32
27
  l.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
33
- S.UNSUBSCRIBE_URL + r
34
- )), I && (s = s.replace(
28
+ f.UNSUBSCRIBE_URL + e
29
+ )), _ && (s = s.replace(
35
30
  l.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
36
- S.PREFERENCES_URL + r
37
- )), s = s.replace(l.UNSUBSCRIBE_LINK_REGEX, ""), e = e.replace(E, s);
38
- }), e;
31
+ f.PREFERENCES_URL + e
32
+ )), s = s.replace(l.UNSUBSCRIBE_LINK_REGEX, ""), o = o.replace(E, s);
33
+ }), o;
39
34
  },
40
35
  priority: 60
41
36
  },
@@ -61,16 +56,16 @@ const D = [
61
56
  type: "custom",
62
57
  processor: (t) => {
63
58
  let i = t;
64
- const c = i.match(/<a[^>]+>(.*?)<\/a>/gm);
65
- return c && c.forEach((n) => {
59
+ const a = i.match(/<a[^>]+>(.*?)<\/a>/gm);
60
+ return a && a.forEach((n) => {
66
61
  if (n.includes("insEmail=1"))
67
62
  return;
68
63
  if (n.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
69
- const a = n.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
64
+ const o = n.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
70
65
  const r = e.slice(6, e.length - 1).trim();
71
66
  return e.includes("?") || e.includes("#") ? r.slice(-1) === "&" ? e.replace(r, `${r}insEmail=1`) : e.replace(r, `${r}&insEmail=1`) : e.replace(r, `${r}?insEmail=1`);
72
67
  });
73
- i = i.replace(n, a);
68
+ i = i.replace(n, o);
74
69
  }
75
70
  }), i;
76
71
  },
@@ -78,5 +73,5 @@ const D = [
78
73
  }
79
74
  ];
80
75
  export {
81
- D as unsubscribeCompilerRules
76
+ T as unsubscribeCompilerRules
82
77
  };
@@ -16,8 +16,7 @@ const e = {
16
16
  dynamicContent: !0,
17
17
  saveAsTemplate: !0,
18
18
  versionHistory: !0,
19
- testMessage: !0,
20
- displayConditions: !0
19
+ testMessage: !0
21
20
  },
22
21
  useHeader: !0
23
22
  }, t = {
@@ -12,8 +12,8 @@ const s = {
12
12
  { id: 61, key: "mostPopular", name: "Most Popular Items", path: "most-popular" },
13
13
  { id: 62, key: "mostPurchased", name: "Top Sellers", path: "top-sellers" }
14
14
  ], u = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], l = [
15
- { text: "after the amount", value: "1" },
16
- { text: "before the amount", value: "0" }
15
+ { text: "before the amount", value: "0" },
16
+ { text: "after the amount", value: "1" }
17
17
  ], c = [
18
18
  { text: "dot(.)", value: "." },
19
19
  { text: "comma(,)", value: "," }
@@ -1,26 +1,25 @@
1
- import { useTranslations as n } from "../composables/useTranslations.js";
2
- import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
3
- const e = n(), I = {
1
+ import { useTranslations as e } from "../composables/useTranslations.js";
2
+ const s = e(), R = {
4
3
  UNSUBSCRIBE_LINK_TYPE: 1,
5
4
  PREFERENCES_LINK_TYPE: 3
6
- }, r = {
5
+ }, S = {
7
6
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
8
7
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
9
8
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
10
9
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
11
- }, s = R(), _ = {
12
- UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
13
- PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
14
- }, i = "iid", B = {
10
+ }, N = {
11
+ UNSUBSCRIBE_URL: "https://mail.useinsider.com/user/v1/unsub",
12
+ PREFERENCES_URL: "https://mail.useinsider.com/user/v1/prefs"
13
+ }, _ = {
15
14
  name: "Global Unsubscribe",
16
15
  sendGridId: "G"
17
- }, C = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", c = "/email/unsubscribe-pages", E = {
16
+ }, I = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", r = "/email/unsubscribe-pages", E = {
18
17
  GLOBAL_UNSUBSCRIBE: 1,
19
18
  GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
20
19
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
21
20
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
22
21
  RESUBSCRIBE: 5
23
- }, t = {
22
+ }, i = {
24
23
  [E.GLOBAL_UNSUBSCRIBE]: [
25
24
  E.GLOBAL_UNSUBSCRIBE,
26
25
  E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
@@ -30,27 +29,26 @@ const e = n(), I = {
30
29
  E.SUBSCRIPTION_PREFERENCE_CENTER,
31
30
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
32
31
  ]
33
- }, U = {
34
- [E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
35
- [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
36
- [E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
37
- [E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
38
- [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
39
- }, o = {
32
+ }, B = {
33
+ [E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
34
+ [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: s("unsubscription-preference.type-global-unsubscription-confirmation"),
35
+ [E.RESUBSCRIBE]: s("unsubscription-preference.type-resubscribe"),
36
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
37
+ [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
38
+ }, C = {
40
39
  default: "{{ins-unsubscribe-link}}",
41
40
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
42
41
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
43
42
  };
44
43
  export {
45
- C as ACADEMY_LINK,
46
- B as DEFAULT_UNSUBSCRIBE_GROUP,
47
- i as INSIDER_ID,
48
- r as LINK_REGEXES,
49
- I as LINK_TYPES,
50
- o as MERGE_TAGS,
44
+ I as ACADEMY_LINK,
45
+ _ as DEFAULT_UNSUBSCRIBE_GROUP,
46
+ S as LINK_REGEXES,
47
+ R as LINK_TYPES,
48
+ C as MERGE_TAGS,
51
49
  E as PAGE_TYPES,
52
- t as TYPE_COLLECTIONS,
53
- U as TYPE_TRANSLATIONS,
54
- c as UNSUBSCRIBE_PAGES_LINK,
55
- _ as URLS
50
+ i as TYPE_COLLECTIONS,
51
+ B as TYPE_TRANSLATIONS,
52
+ r as UNSUBSCRIBE_PAGES_LINK,
53
+ N as URLS
56
54
  };
@@ -1,7 +1,7 @@
1
1
  import { Block as e, BlockCompositionType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { getDefaultTemplate as o } from "./template.js";
3
3
  const r = "checkbox-block";
4
- class p extends e {
4
+ class s extends e {
5
5
  constructor() {
6
6
  super();
7
7
  }
@@ -23,8 +23,11 @@ class p extends e {
23
23
  getTemplate() {
24
24
  return o();
25
25
  }
26
+ allowInnerBlocksDND() {
27
+ return !1;
28
+ }
26
29
  }
27
30
  export {
28
31
  r as CHECKBOX_BLOCK_ID,
29
- p as CheckboxBlock
32
+ s as CheckboxBlock
30
33
  };
@@ -0,0 +1,66 @@
1
+ import { Block as b, BlockCompositionType as f, ModificationDescription as l } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { configAttributes as t } from "./enums/productEnums.js";
3
+ import { DefaultConfigValues as e, SETTINGS_ENUMS as u } from "./enums/settingsEnums.js";
4
+ import { useItemsBlockStore as d } from "./store/items-block.js";
5
+ import { getDefaultTemplate as D } from "./template.js";
6
+ const g = "items-block";
7
+ class B extends b {
8
+ getId() {
9
+ return g;
10
+ }
11
+ getIcon() {
12
+ return "items-icon";
13
+ }
14
+ getBlockCompositionType() {
15
+ return f.CONTAINER;
16
+ }
17
+ getName() {
18
+ return this.api.translate("Items");
19
+ }
20
+ getDescription() {
21
+ return this.api.translate("Items lets you display personalized products based on user behavior.");
22
+ }
23
+ getTemplate() {
24
+ const r = d();
25
+ return D({
26
+ orientation: u.ORIENTATION.HORIZONTAL,
27
+ itemsType: u.ITEMS_TYPE.CART_ITEMS,
28
+ itemId: "{{Abandoned Cart Item (1) Url}}",
29
+ currencySymbol: r.currencySymbol,
30
+ currencyLocation: r.currencyLocation,
31
+ formattedPrice: r.formattedPrice
32
+ });
33
+ }
34
+ allowInnerBlocksDND() {
35
+ return !1;
36
+ }
37
+ onCreated(r) {
38
+ const n = r.querySelector("esd-config-block");
39
+ if (!n)
40
+ return;
41
+ const o = n, c = o.getAttribute("data-initialized") || "0", a = o.getAttribute(t.BLOCK_INSTANCE_ID), s = () => String(Date.now() + Math.floor(Math.random() * 1e3));
42
+ if (Number(c)) {
43
+ if (!a) {
44
+ const i = s();
45
+ this.api.getDocumentModifier().modifyHtml(o).setAttribute(t.BLOCK_INSTANCE_ID, i).apply(new l("Assign block instance ID to legacy block"));
46
+ }
47
+ } else {
48
+ const i = e.itemsType, m = e.cartItemsSelectControlValue, I = e.cardOrientationControlValue, C = e.productNameTrimmingControlValue, T = e.productPriceHideDiscountControlValue, E = e.productPriceFormattedControlValue, A = e.productPriceCurrencySymbolControlValue, N = e.productPriceCurrencyLocationControlValue, p = e.productButtonLinkControlValue, O = e.productImageLinkControlValue, _ = s();
49
+ this.api.getDocumentModifier().modifyHtml(o).setAttribute("data-source", i).setAttribute(t.TYPE, i).setAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE, m).setAttribute(t.ORIENTATION, I).setAttribute(t.PRODUCT_NAME_TRIMMING, C).setAttribute(t.PRODUCT_PRICE_HIDE_DISCOUNT, T).setAttribute(t.PRODUCT_PRICE_FORMATTED, E).setAttribute(t.PRODUCT_PRICE_CURRENCY_SYMBOL, A).setAttribute(t.PRODUCT_PRICE_CURRENCY_LOCATION, N).setAttribute(t.PRODUCT_BUTTON_LINK, p).setAttribute(t.PRODUCT_IMAGE_LINK, O).setAttribute(t.BLOCK_INSTANCE_ID, _).setAttribute("data-initialized", "1").setAttribute(t.NAME_CONTROL_ENABLED, e.productNameControlEnabled).setAttribute(
50
+ t.QUANTITY_CONTROL_ENABLED,
51
+ e.productQuantityControlEnabled
52
+ ).setAttribute(t.PRICE_CONTROL_OPENED, e.productPriceControlOpened).apply(new l("Initialize config block attributes with defaults"));
53
+ }
54
+ }
55
+ onSelect(r) {
56
+ const n = r.querySelector("esd-config-block"), o = d();
57
+ if (!n)
58
+ return;
59
+ const c = n, a = c.getAttribute(t.TYPE) || e.itemsType, s = c.getAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE) || e.cartItemsSelectControlValue, i = c.getAttribute(t.ORIENTATION) || e.cardOrientationControlValue;
60
+ o.setItemsType(a), o.setItemIds(s), o.setOrientation(i);
61
+ }
62
+ }
63
+ export {
64
+ g as BLOCK_ID,
65
+ B as ItemsBlock
66
+ };
@@ -0,0 +1,68 @@
1
+ var r = Object.defineProperty;
2
+ var a = (o, e, t) => e in o ? r(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var s = (o, e, t) => a(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { CommonControl as u } from "../../../common-control.js";
5
+ import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
6
+ import { useItemsBlockStore as l } from "../../store/items-block.js";
7
+ import { syncButtonLinkFromAttributes as h } from "../../utils/syncAttributesFromConfigBlock.js";
8
+ import { updateConfigBlockAttributes as m } from "../../utils/updateAttributes.js";
9
+ const i = d.BUTTON_LINK, n = {
10
+ LINK: "link"
11
+ };
12
+ class C extends u {
13
+ constructor() {
14
+ super(...arguments);
15
+ s(this, "store", l());
16
+ }
17
+ getId() {
18
+ return i;
19
+ }
20
+ getTemplate() {
21
+ return `
22
+ <div class="${i}">
23
+ ${this._getLink()}
24
+ </div>
25
+ `;
26
+ }
27
+ onRender() {
28
+ this.api.updateValues({
29
+ [n.LINK]: this.store.buttonLink
30
+ }), this._listenToFormUpdates();
31
+ }
32
+ onTemplateNodeUpdated(t) {
33
+ super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
34
+ () => h(this.currentNode),
35
+ () => {
36
+ this.api.updateValues({
37
+ [n.LINK]: this.store.buttonLink
38
+ });
39
+ }
40
+ );
41
+ }
42
+ _listenToFormUpdates() {
43
+ this.api.onValueChanged(
44
+ n.LINK,
45
+ (t) => this._onLinkChange(t)
46
+ );
47
+ }
48
+ _onLinkChange(t) {
49
+ console.debug("Button link changed to: ", t), this.store.setButtonLink(t), m(this.currentNode, this.api);
50
+ }
51
+ _getLink() {
52
+ return `
53
+ ${this._GuOneColumn([
54
+ this._GuLabel({ text: "Link" }),
55
+ this._GuTextInput({
56
+ name: n.LINK,
57
+ placeholder: "Enter Link",
58
+ className: "es-100",
59
+ disabled: !0
60
+ })
61
+ ])}
62
+ `;
63
+ }
64
+ }
65
+ export {
66
+ C as ButtonLinkControl,
67
+ i as CONTROL_BLOCK_ID
68
+ };
@@ -0,0 +1,99 @@
1
+ import { UIElementType as a, UEAttr as l, ModificationDescription as o } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as s } from "../../common-control.js";
3
+ import { ItemsBlockId as r } from "../enums/controlEnums.js";
4
+ const d = "ui-elements-items-card-composition-block", i = {
5
+ PRODUCT_IMAGE: "image",
6
+ PRODUCT_NAME: "name",
7
+ PRODUCT_QUANTITY: "quantity",
8
+ PRODUCT_PRICE: "price",
9
+ PRODUCT_ORIGINAL_PRICE: "originalPrice",
10
+ PRODUCT_BUTTON: "button"
11
+ };
12
+ class g extends s {
13
+ getId() {
14
+ return d;
15
+ }
16
+ getTemplate() {
17
+ return `
18
+ <div class="items-controls-container">
19
+ ${[
20
+ { name: i.PRODUCT_IMAGE, label: "Product Image" },
21
+ { name: i.PRODUCT_NAME, label: "Product Name" },
22
+ { name: i.PRODUCT_QUANTITY, label: "Product Quantity" },
23
+ { name: i.PRODUCT_PRICE, label: "Product Price" },
24
+ { name: i.PRODUCT_ORIGINAL_PRICE, label: "Product Original Price" },
25
+ { name: i.PRODUCT_BUTTON, label: "Product Button" }
26
+ ].map((t) => this._getToggleContainer(t)).join("")}
27
+ </div>
28
+ `;
29
+ }
30
+ onRender() {
31
+ this._initializeToggles(), this._listenToFormUpdates();
32
+ }
33
+ onDestroy() {
34
+ }
35
+ _getToggleContainer({ name: e, label: t }) {
36
+ return `
37
+ <div class="container">
38
+ <div class="display-flex align-items-center justify-content-between">
39
+ <${a.LABEL} ${l.LABEL.text}="${t}"></${a.LABEL}>
40
+ ${this._GuToggle(e)}
41
+ </div>
42
+ </div>
43
+ `;
44
+ }
45
+ _initializeToggles() {
46
+ this.api.updateValues({
47
+ [i.PRODUCT_IMAGE]: !0,
48
+ [i.PRODUCT_NAME]: !0,
49
+ [i.PRODUCT_QUANTITY]: !0,
50
+ [i.PRODUCT_PRICE]: !0,
51
+ [i.PRODUCT_ORIGINAL_PRICE]: !0,
52
+ [i.PRODUCT_BUTTON]: !0
53
+ });
54
+ }
55
+ _listenToFormUpdates() {
56
+ this.api.onValueChanged(i.PRODUCT_IMAGE, (e) => this._onProductImageChange(e)), this.api.onValueChanged(i.PRODUCT_NAME, (e) => this._onProductNameChange(e)), this.api.onValueChanged(i.PRODUCT_QUANTITY, (e) => this._onProductQuantityChange(e)), this.api.onValueChanged(i.PRODUCT_PRICE, (e) => this._onProductPriceChange(e)), this.api.onValueChanged(
57
+ i.PRODUCT_ORIGINAL_PRICE,
58
+ (e) => this._onProductOriginalPriceChange(e)
59
+ ), this.api.onValueChanged(i.PRODUCT_BUTTON, (e) => this._onProductButtonChange(e));
60
+ }
61
+ _onProductImageChange(e) {
62
+ var n;
63
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.IMAGE}"]`);
64
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product image visibility changed to ${e ? "visible" : "hidden"}`));
65
+ }
66
+ _onProductNameChange(e) {
67
+ var n;
68
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.NAME}"]`);
69
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product name visibility changed to ${e ? "visible" : "hidden"}`));
70
+ }
71
+ _onProductQuantityChange(e) {
72
+ var n;
73
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.QUANTITY}"]`);
74
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(
75
+ `Product quantity visibility changed to ${e ? "visible" : "hidden"}`
76
+ ));
77
+ }
78
+ _onProductPriceChange(e) {
79
+ var n;
80
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.PRICE}"]`);
81
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product price visibility changed to ${e ? "visible" : "hidden"}`));
82
+ }
83
+ _onProductOriginalPriceChange(e) {
84
+ var n;
85
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.ORIGINAL_PRICE}"]`);
86
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(
87
+ `Product original price visibility changed to ${e ? "visible" : "hidden"}`
88
+ ));
89
+ }
90
+ _onProductButtonChange(e) {
91
+ var n;
92
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${r.BUTTON}"]`);
93
+ t && this.api.getDocumentModifier().modifyHtml(t).setStyle("display", e ? "table-cell" : "none").apply(new o(`Product button visibility changed to ${e ? "visible" : "hidden"}`));
94
+ }
95
+ }
96
+ export {
97
+ d as COMPOSITION_CONTROL_BLOCK_ID,
98
+ g as ItemsBlockCardCompositionControl
99
+ };
@@ -0,0 +1,68 @@
1
+ var r = Object.defineProperty;
2
+ var a = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var i = (o, t, e) => a(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { CommonControl as m } from "../../../common-control.js";
5
+ import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
6
+ import { useItemsBlockStore as l } from "../../store/items-block.js";
7
+ import { syncImageLinkFromAttributes as h } from "../../utils/syncAttributesFromConfigBlock.js";
8
+ import { updateConfigBlockAttributes as p } from "../../utils/updateAttributes.js";
9
+ const s = d.IMAGE_LINK, n = {
10
+ LINK: "link"
11
+ };
12
+ class N extends m {
13
+ constructor() {
14
+ super(...arguments);
15
+ i(this, "store", l());
16
+ }
17
+ getId() {
18
+ return s;
19
+ }
20
+ getTemplate() {
21
+ return `
22
+ <div class="${s}">
23
+ ${this._getLink()}
24
+ </div>
25
+ `;
26
+ }
27
+ onRender() {
28
+ this.api.updateValues({
29
+ [n.LINK]: this.store.imageLink
30
+ }), this._listenToFormUpdates();
31
+ }
32
+ onTemplateNodeUpdated(e) {
33
+ super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
34
+ () => h(this.currentNode),
35
+ () => {
36
+ this.api.updateValues({
37
+ [n.LINK]: this.store.imageLink
38
+ });
39
+ }
40
+ );
41
+ }
42
+ _listenToFormUpdates() {
43
+ this.api.onValueChanged(
44
+ n.LINK,
45
+ (e) => this._onLinkChange(e)
46
+ );
47
+ }
48
+ _onLinkChange(e) {
49
+ console.debug("Image link changed to: ", e), this.store.setImageLink(e), p(this.currentNode, this.api);
50
+ }
51
+ _getLink() {
52
+ return `
53
+ ${this._GuOneColumn([
54
+ this._GuLabel({ text: "Link" }),
55
+ this._GuTextInput({
56
+ name: n.LINK,
57
+ placeholder: "Enter Link",
58
+ className: "es-100",
59
+ disabled: !0
60
+ })
61
+ ])}
62
+ `;
63
+ }
64
+ }
65
+ export {
66
+ s as CONTROL_BLOCK_ID,
67
+ N as ImageLinkControl
68
+ };