@useinsider/guido 2.0.0-beta.4f6e85f → 2.0.0-beta.522e9d9

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 (106) hide show
  1. package/README.md +0 -2
  2. package/dist/@types/config/schemas.js +39 -55
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +17 -15
  5. package/dist/components/organisms/email-preview/PreviewContainer.vue.js +3 -3
  6. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.js +8 -8
  7. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue2.js +17 -13
  8. package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +7 -8
  9. package/dist/components/organisms/email-preview/amp/AmpToggle.vue2.js +14 -12
  10. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +10 -14
  11. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +18 -22
  12. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +3 -3
  13. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +12 -11
  14. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue.js +11 -10
  15. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue2.js +15 -14
  16. package/dist/components/organisms/header/LeftSlot.vue.js +9 -9
  17. package/dist/components/organisms/header/LeftSlot.vue2.js +13 -14
  18. package/dist/components/organisms/header/MiddleSlot.vue.js +5 -4
  19. package/dist/components/organisms/header/MiddleSlot.vue2.js +14 -13
  20. package/dist/components/organisms/header/RightSlot.vue.js +12 -12
  21. package/dist/components/organisms/header/RightSlot.vue2.js +26 -20
  22. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +15 -15
  23. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +1 -1
  24. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +20 -19
  25. package/dist/composables/useConfig.js +27 -29
  26. package/dist/composables/useSave.js +11 -13
  27. package/dist/composables/useStripo.js +40 -40
  28. package/dist/config/migrator/index.js +8 -9
  29. package/dist/enums/academy.js +8 -0
  30. package/dist/enums/onboarding.js +1 -2
  31. package/dist/enums/unsubscribe.js +20 -21
  32. package/dist/extensions/Blocks/Items/block.js +40 -39
  33. package/dist/extensions/Blocks/Items/controls/button/link.js +29 -22
  34. package/dist/extensions/Blocks/Items/controls/cardComposition.js +46 -66
  35. package/dist/extensions/Blocks/Items/controls/image/link.js +30 -23
  36. package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
  37. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +17 -19
  38. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +29 -31
  39. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +36 -36
  40. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +19 -21
  41. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +27 -29
  42. package/dist/extensions/Blocks/Items/controls/settingsControl.js +143 -152
  43. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  44. package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -43
  45. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +3 -4
  46. package/dist/extensions/Blocks/Items/extension.js +6 -7
  47. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +49 -58
  48. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +59 -48
  49. package/dist/extensions/Blocks/Items/settingsPanel.js +26 -27
  50. package/dist/extensions/Blocks/Items/store/items-block.js +7 -11
  51. package/dist/extensions/Blocks/Items/template.js +129 -366
  52. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +17 -0
  53. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +28 -0
  54. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +76 -0
  55. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +46 -0
  56. package/dist/extensions/Blocks/Recommendation/control.js +1 -1
  57. package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
  58. package/dist/extensions/Blocks/common-control.js +30 -29
  59. package/dist/extensions/Blocks/controlFactories.js +45 -55
  60. package/dist/guido.css +1 -1
  61. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +285 -364
  62. package/dist/package.json.js +1 -1
  63. package/dist/services/stripoApi.js +10 -6
  64. package/dist/src/@types/config/index.d.ts +2 -2
  65. package/dist/src/@types/config/schemas.d.ts +0 -30
  66. package/dist/src/@types/config/types.d.ts +1 -7
  67. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  68. package/dist/src/composables/useConfig.d.ts +0 -8
  69. package/dist/src/enums/academy.d.ts +12 -0
  70. package/dist/src/enums/onboarding.d.ts +0 -1
  71. package/dist/src/enums/unsubscribe.d.ts +0 -1
  72. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +2 -0
  73. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +0 -9
  74. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +2 -0
  75. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
  76. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +4 -0
  77. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +0 -1
  78. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +26 -24
  79. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +0 -1
  80. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -2
  81. package/dist/src/extensions/Blocks/Items/template.d.ts +1 -22
  82. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +23 -0
  83. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +32 -0
  84. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +50 -0
  85. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +8 -0
  86. package/dist/src/extensions/Blocks/common-control.d.ts +10 -9
  87. package/dist/src/stores/config.d.ts +1 -164
  88. package/dist/static/assets/desktop/desktop-mockup-center.svg.js +4 -0
  89. package/dist/static/assets/desktop/desktop-mockup-left.svg.js +4 -0
  90. package/dist/static/assets/desktop/desktop-mockup-right.svg.js +4 -0
  91. package/dist/static/assets/mobile/email-mockup.svg.js +4 -0
  92. package/dist/static/assets/mobile/inbox-mockup.svg.js +4 -0
  93. package/dist/static/styles/components/button.css.js +1 -1
  94. package/dist/stores/config.js +0 -7
  95. package/dist/utils/pairProductVariables.js +58 -61
  96. package/package.json +3 -3
  97. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.js +0 -17
  98. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +0 -20
  99. package/dist/config/migrator/itemsBlockMigrator.js +0 -342
  100. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +0 -93
  101. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +0 -184
  102. package/dist/src/config/migrator/itemsBlockMigrator.d.ts +0 -6
  103. package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +0 -18
  104. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +0 -73
  105. package/dist/static/assets/inbox-mockup.svg.js +0 -4
  106. package/dist/static/assets/phone-mockup.svg.js +0 -4
@@ -1,26 +1,26 @@
1
- import { useActionsApi as _ } from "./useActionsApi.js";
2
- import { useBlocksConfig as B } from "./useBlocksConfig.js";
3
- import { useConfig as v } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as A } from "./useCustomInterfaceAppearance.js";
5
- import { useStripoEventHandler as F } from "./useStripoEventHandler.js";
6
- import { useToaster as D } from "./useToaster.js";
7
- import { displayConditions as I } from "../enums/displayConditions.js";
8
- import { useStripoApi as M } from "../services/stripoApi.js";
9
- import U from "../static/styles/customEditorStyle.css.js";
10
- import { useEditorStore as P } from "../stores/editor.js";
11
- import { dynamicContentToMergeTags as R } from "../utils/genericUtil.js";
12
- import H from "../package.json.js";
13
- const W = (c) => {
14
- const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = M(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, n = []) => {
15
- var m, g, f;
16
- const o = P(), { html: r, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, T = ((f = y.value) == null ? void 0 : f.forceRecreate) ?? !1;
1
+ import { useActionsApi as T } from "./useActionsApi.js";
2
+ import { useBlocksConfig as V } from "./useBlocksConfig.js";
3
+ import { useConfig as _ } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
5
+ import { useStripoEventHandler as v } from "./useStripoEventHandler.js";
6
+ import { useToaster as A } from "./useToaster.js";
7
+ import { displayConditions as F } from "../enums/displayConditions.js";
8
+ import { useStripoApi as D } from "../services/stripoApi.js";
9
+ import I from "../static/styles/customEditorStyle.css.js";
10
+ import { useEditorStore as M } from "../stores/editor.js";
11
+ import { dynamicContentToMergeTags as U } from "../utils/genericUtil.js";
12
+ import P from "../package.json.js";
13
+ const K = (c) => {
14
+ const { features: l } = _(), { handleError: u } = A(), { getToken: y, getCustomFonts: S } = D(), { handleEvent: C } = v(), { getStripoBlocksConfig: E } = V(), h = async (i, n = []) => {
15
+ var g, f;
16
+ const o = M(), { html: r, css: p, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await E(), m = ((g = l.value) == null ? void 0 : g.displayConditions) ?? !0, b = ((f = l.value) == null ? void 0 : f.modulesDisabled) ?? !1;
17
17
  window.UIEditor.initEditor(
18
18
  document.querySelector("#guido-editor"),
19
19
  {
20
20
  metadata: c,
21
21
  html: r,
22
22
  css: p,
23
- forceRecreate: T,
23
+ forceRecreate: a,
24
24
  locale: "en",
25
25
  undoButtonSelector: "#guido__undo-button",
26
26
  redoButtonSelector: "#guido__redo-button",
@@ -30,19 +30,19 @@ const W = (c) => {
30
30
  customAppearanceMergetags: !0,
31
31
  customAppearanceMergetagsBorderColor: "#f1f3fe",
32
32
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
33
- customViewStyles: U,
34
- conditionsEnabled: a,
35
- customConditionsEnabled: a,
36
- conditionCategories: I,
33
+ customViewStyles: I,
34
+ conditionsEnabled: m,
35
+ customConditionsEnabled: m,
36
+ conditionCategories: F,
37
37
  enableXSSSecurity: !0,
38
- modulesDisabled: k,
38
+ modulesDisabled: b,
39
39
  messageSettingsEnabled: !0,
40
40
  displayGmailAnnotations: !0,
41
41
  displayHiddenPreheader: !1,
42
42
  displayTitle: !1,
43
43
  displayUTM: !1,
44
44
  selectElementAfterDrop: !0,
45
- ...s ? { baseBlocks: s } : {},
45
+ ...t ? { baseBlocks: t } : {},
46
46
  editorFonts: {
47
47
  showDefaultStandardFonts: !0,
48
48
  showDefaultNotStandardFonts: !0,
@@ -50,21 +50,21 @@ const W = (c) => {
50
50
  },
51
51
  mergeTags: [
52
52
  {
53
- entries: R(c.preselectedDynamicContentList)
53
+ entries: U(c.preselectedDynamicContentList)
54
54
  }
55
55
  ],
56
56
  async onTokenRefreshRequest(e) {
57
57
  try {
58
- const d = await C();
59
- e(d);
60
- } catch (d) {
61
- u(d, "Failed to refresh token");
58
+ const s = await y();
59
+ e(s);
60
+ } catch (s) {
61
+ u(s, "Failed to refresh token");
62
62
  }
63
63
  },
64
64
  onTemplateLoaded() {
65
65
  try {
66
- const { importCss: e } = A(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: V } = _();
67
- e(), d(), V(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
66
+ const { importCss: e } = B(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: k } = T();
67
+ e(), s(), k(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
68
68
  o.hasChanges = !1;
69
69
  }, 1e3);
70
70
  } catch (e) {
@@ -83,35 +83,35 @@ const W = (c) => {
83
83
  onDataChanged() {
84
84
  o.hasChanges = !0;
85
85
  },
86
- onEvent: E,
86
+ onEvent: C,
87
87
  ignoreClickOutsideSelectors: [
88
88
  "#guido-dynamic-content-modal",
89
89
  ".in-on-board-wrapper",
90
90
  ".in-drawer__container"
91
91
  ],
92
- extensions: t
92
+ extensions: d
93
93
  }
94
94
  );
95
- }, b = (i) => new Promise((n, o) => {
96
- var a;
95
+ }, w = (i) => new Promise((n, o) => {
96
+ var d;
97
97
  if (document.getElementById("UiEditorScript")) {
98
98
  i(), n();
99
99
  return;
100
100
  }
101
- const r = H.guido, s = `https://email-static.useinsider.com/guido/${(a = r == null ? void 0 : r.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
102
- t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
101
+ const r = P.guido, a = `https://email-static.useinsider.com/guido/${(d = r == null ? void 0 : r.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
102
+ t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
103
103
  i(), n();
104
104
  }, t.onerror = () => {
105
- o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
105
+ o(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
106
106
  }, document.body.appendChild(t);
107
107
  });
108
108
  return { initPlugin: async (i) => {
109
- await b(async () => {
109
+ await w(async () => {
110
110
  const n = await S();
111
- await w(i, n);
111
+ await h(i, n);
112
112
  });
113
113
  } };
114
114
  };
115
115
  export {
116
- W as useStripo
116
+ K as useStripo
117
117
  };
@@ -1,13 +1,12 @@
1
- import { migrateCheckbox as t } from "./checkboxMigrator.js";
1
+ import { migrateCheckbox as m } from "./checkboxMigrator.js";
2
2
  import { migrateCouponBlock as o } from "./couponBlockMigrator.js";
3
- import { migrateItemsBlock as i } from "./itemsBlockMigrator.js";
4
- import { migrateRadioButton as e } from "./radioButtonMigrator.js";
5
- import { migrateRecommendation as a } from "./recommendationMigrator.js";
6
- import { migrateUnsubscribe as g } from "./unsubscribeMigrator.js";
7
- const u = async (r) => {
8
- let m = r;
9
- return m = t(m), m = e(m), m = await g(m), m = o(m), m = a(m), m = i(m), m;
3
+ import { migrateRadioButton as i } from "./radioButtonMigrator.js";
4
+ import { migrateRecommendation as e } from "./recommendationMigrator.js";
5
+ import { migrateUnsubscribe as a } from "./unsubscribeMigrator.js";
6
+ const s = async (t) => {
7
+ let r = t;
8
+ return r = m(r), r = i(r), r = await a(r), r = o(r), r = e(r), r;
10
9
  };
11
10
  export {
12
- u as migrate
11
+ s as migrate
13
12
  };
@@ -0,0 +1,8 @@
1
+ const e = "https://academy.useinsider.com", o = {
2
+ EMAIL_EDITOR: `${e}/docs/email-drag-drop-editor`,
3
+ GLOBAL_UNSUBSCRIBE: `${e}/docs/global-unsubscribe-preference-center`,
4
+ AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`
5
+ };
6
+ export {
7
+ o as ACADEMY_LINKS
8
+ };
@@ -2,9 +2,8 @@ const e = [
2
2
  ".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-0.ng-star-inserted",
3
3
  ".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-1.ng-star-inserted",
4
4
  ".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-2.ng-star-inserted"
5
- ], t = "ui-editor", n = 'button[role="tab"][aria-label="Card Composition"]', s = 'button[role="tab"][aria-label="Settings"]', o = ".in-ribbons-wrapper", a = "https://academy.useinsider.com/docs/email-drag-drop-editor";
5
+ ], t = "ui-editor", n = 'button[role="tab"][aria-label="Card Composition"]', s = 'button[role="tab"][aria-label="Settings"]', o = ".in-ribbons-wrapper";
6
6
  export {
7
- a as ACADEMY_LINK,
8
7
  n as CARD_COMPOSITION_TAB_SELECTOR,
9
8
  o as RIBBON_SELECTOR,
10
9
  e as SERVICE_HOVER_SELECTORS,
@@ -1,26 +1,26 @@
1
- import { useTranslations as n } from "../composables/useTranslations.js";
1
+ import { useTranslations as e } from "../composables/useTranslations.js";
2
2
  import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
3
- const N = {
3
+ const I = {
4
4
  UNSUBSCRIBE_LINK_TYPE: 1,
5
5
  PREFERENCES_LINK_TYPE: 3
6
- }, I = {
6
+ }, r = {
7
7
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
8
8
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
9
9
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
10
10
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
11
- }, s = R(), i = {
11
+ }, s = R(), _ = {
12
12
  UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
13
13
  PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
14
- }, _ = "iid", B = {
14
+ }, i = "iid", B = {
15
15
  name: "Global Unsubscribe",
16
16
  sendGridId: "G"
17
- }, t = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", C = "/email/unsubscribe-pages", E = {
17
+ }, C = "/email/unsubscribe-pages", E = {
18
18
  GLOBAL_UNSUBSCRIBE: 1,
19
19
  GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
20
20
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
21
21
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
22
22
  RESUBSCRIBE: 5
23
- }, c = {
23
+ }, t = {
24
24
  [E.GLOBAL_UNSUBSCRIBE]: [
25
25
  E.GLOBAL_UNSUBSCRIBE,
26
26
  E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
@@ -31,29 +31,28 @@ const N = {
31
31
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
32
32
  ]
33
33
  }, U = () => {
34
- const e = n();
34
+ const n = e();
35
35
  return {
36
- [E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
37
- [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
38
- [E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
39
- [E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
40
- [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
36
+ [E.GLOBAL_UNSUBSCRIBE]: n("unsubscription-preference.type-global-unsubscribe"),
37
+ [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: n("unsubscription-preference.type-global-unsubscription-confirmation"),
38
+ [E.RESUBSCRIBE]: n("unsubscription-preference.type-resubscribe"),
39
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: n("unsubscription-preference.type-subscription-preferences-center"),
40
+ [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: n("unsubscription-preference.type-subscription-preferences-confirmation")
41
41
  };
42
- }, o = {
42
+ }, c = {
43
43
  default: "{{ins-unsubscribe-link}}",
44
44
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
45
45
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
46
46
  };
47
47
  export {
48
- t as ACADEMY_LINK,
49
48
  B as DEFAULT_UNSUBSCRIBE_GROUP,
50
- _ as INSIDER_ID,
51
- I as LINK_REGEXES,
52
- N as LINK_TYPES,
53
- o as MERGE_TAGS,
49
+ i as INSIDER_ID,
50
+ r as LINK_REGEXES,
51
+ I as LINK_TYPES,
52
+ c as MERGE_TAGS,
54
53
  E as PAGE_TYPES,
55
- c as TYPE_COLLECTIONS,
54
+ t as TYPE_COLLECTIONS,
56
55
  C as UNSUBSCRIBE_PAGES_LINK,
57
- i as URLS,
56
+ _ as URLS,
58
57
  U as getTypeTranslations
59
58
  };
@@ -1,20 +1,20 @@
1
- import { useOnboardingStore as d } from "../../../stores/onboarding.js";
2
- import { Block as u, BlockCompositionType as p, ModificationDescription as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
- import { ItemsBlockId as f } from "./enums/controlEnums.js";
4
- import { SETTINGS_ENUMS as c, DefaultConfigValues as o } from "./enums/settingsEnums.js";
5
- import { useItemsBlockStore as g } from "./store/items-block.js";
6
- import { getDefaultTemplate as y } from "./template.js";
7
- import { getItemsBlockContainer as C, getItemsBlockConfig as a, getDefaultItemsBlockConfig as I } from "./utils/nodeConfigUtils.js";
8
- const b = "items-block";
9
- class O extends u {
1
+ import { useOnboardingStore as y } from "../../../stores/onboarding.js";
2
+ import { Block as R, BlockCompositionType as L, ModificationDescription as a } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ import { configAttributes as t } from "./enums/productEnums.js";
4
+ import { DefaultConfigValues as e, SETTINGS_ENUMS as l } from "./enums/settingsEnums.js";
5
+ import { useItemsBlockStore as S } from "./store/items-block.js";
6
+ import { getDefaultTemplate as V } from "./template.js";
7
+ import { syncCurrencySymbolFromAttributes as B, syncCurrencyLocationFromAttributes as U, syncFormattedPriceFromAttributes as k } from "./utils/syncAttributesFromConfigBlock.js";
8
+ const M = "items-block";
9
+ class x extends R {
10
10
  getId() {
11
- return b;
11
+ return M;
12
12
  }
13
13
  getIcon() {
14
14
  return "items-icon";
15
15
  }
16
16
  getBlockCompositionType() {
17
- return p.CONTAINER;
17
+ return L.CONTAINER;
18
18
  }
19
19
  getName() {
20
20
  return this.api.translate("Items");
@@ -23,44 +23,45 @@ class O extends u {
23
23
  return this.api.translate("Items lets you display personalized products based on user behavior.");
24
24
  }
25
25
  getTemplate() {
26
- return y({
27
- orientation: c.ORIENTATION.VERTICAL,
28
- itemsType: c.ITEMS_TYPE.CART_ITEMS,
26
+ return V({
27
+ orientation: l.ORIENTATION.HORIZONTAL,
28
+ itemsType: l.ITEMS_TYPE.CART_ITEMS,
29
29
  itemId: "{{Abandoned Cart Item (1) Url}}",
30
- currencySymbol: o.productPriceCurrencySymbolControlValue,
31
- currencyLocation: o.productPriceCurrencyLocationControlValue,
32
- formattedPrice: o.productPriceFormattedControlValue === "1"
30
+ currencySymbol: e.productPriceCurrencySymbolControlValue,
31
+ currencyLocation: e.productPriceCurrencyLocationControlValue,
32
+ formattedPrice: e.productPriceFormattedControlValue === "1"
33
33
  });
34
34
  }
35
35
  allowInnerBlocksDND() {
36
36
  return !1;
37
37
  }
38
- onCreated(i) {
39
- const e = C(i);
40
- if (!e)
38
+ onCreated(r) {
39
+ const n = r.querySelector("esd-config-block");
40
+ if (!n)
41
41
  return;
42
- const t = e.getNodeConfig(), l = t && Object.keys(t).length > 0, r = a(i);
43
- if (r != null && r.initialized)
44
- l ? r.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...r, blockInstanceId: String(Date.now()) }).apply(new n("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(r).apply(new n("Migrate legacy config to nodeConfig"));
45
- else {
46
- const m = I();
47
- this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(m).apply(new n("Initialize Items block with default configuration")), d().startOnboarding("itemsOnboarding");
42
+ const o = n, s = o.getAttribute("data-initialized") || "0", u = o.getAttribute(t.BLOCK_INSTANCE_ID), c = () => String(Date.now() + Math.floor(Math.random() * 1e3));
43
+ if (Number(s)) {
44
+ if (!u) {
45
+ const i = c();
46
+ this.api.getDocumentModifier().modifyHtml(o).setAttribute(t.BLOCK_INSTANCE_ID, i).apply(new a("Assign block instance ID to legacy block"));
47
+ }
48
+ } else {
49
+ const i = e.itemsType, I = e.cartItemsSelectControlValue, d = e.cardOrientationControlValue, m = e.productNameTrimmingControlValue, C = e.productPriceHideDiscountControlValue, b = e.productPriceFormattedControlValue, T = e.productPriceCurrencySymbolControlValue, A = e.productPriceCurrencyLocationControlValue, E = e.productButtonLinkControlValue, O = e.productImageLinkControlValue, _ = e.productImageVisible, p = e.productNameVisible, N = e.productQuantityVisible, f = e.productPriceVisible, g = e.productOriginalPriceVisible, D = e.productButtonVisible, P = c();
50
+ this.api.getDocumentModifier().modifyHtml(o).setAttribute("data-source", i).setAttribute(t.TYPE, i).setAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE, I).setAttribute(t.ORIENTATION, d).setAttribute(t.PRODUCT_NAME_TRIMMING, m).setAttribute(t.PRODUCT_PRICE_HIDE_DISCOUNT, C).setAttribute(t.PRODUCT_PRICE_FORMATTED, b).setAttribute(t.PRODUCT_PRICE_CURRENCY_SYMBOL, T).setAttribute(t.PRODUCT_PRICE_CURRENCY_LOCATION, A).setAttribute(t.PRODUCT_BUTTON_LINK, E).setAttribute(t.PRODUCT_IMAGE_LINK, O).setAttribute(t.BLOCK_INSTANCE_ID, P).setAttribute("data-initialized", "1").setAttribute(t.NAME_CONTROL_ENABLED, e.productNameControlEnabled).setAttribute(
51
+ t.QUANTITY_CONTROL_ENABLED,
52
+ e.productQuantityControlEnabled
53
+ ).setAttribute(t.PRICE_CONTROL_OPENED, e.productPriceControlOpened).setAttribute(t.PRODUCT_IMAGE_VISIBLE, _).setAttribute(t.PRODUCT_NAME_VISIBLE, p).setAttribute(t.PRODUCT_QUANTITY_VISIBLE, N).setAttribute(t.PRODUCT_PRICE_VISIBLE, f).setAttribute(t.PRODUCT_ORIGINAL_PRICE_VISIBLE, g).setAttribute(t.PRODUCT_BUTTON_VISIBLE, D).apply(new a("Initialize config block attributes with defaults")), y().startOnboarding("itemsOnboarding");
48
54
  }
49
- const s = `[esd-extension-block-id="${f.IMAGE}"] img`;
50
- this.api.getDocumentModifier().modifyHtml(i.querySelector(s)).setStyle("object-fit", "contain").apply(new n("Updated image object-fit"));
51
55
  }
52
- onSelect(i) {
53
- const e = g(), t = a(i);
54
- t && (e.setItemsType(t.type || o.itemsType), e.setItemIds(t.itemsSelectValue || o.cartItemsSelectControlValue), e.setOrientation(t.orientation || o.cardOrientationControlValue), e.setCurrencySymbol(
55
- t.priceCurrencySymbol || o.productPriceCurrencySymbolControlValue
56
- ), e.setCurrencyLocation(
57
- t.priceCurrencyLocation || o.productPriceCurrencyLocationControlValue
58
- ), e.setFormattedPrice(
59
- t.priceFormatted ?? o.productPriceFormattedControlValue === "1"
60
- ));
56
+ onSelect(r) {
57
+ const n = r.querySelector("esd-config-block"), o = S();
58
+ if (!n)
59
+ return;
60
+ const s = n, u = s.getAttribute(t.TYPE) || e.itemsType, c = s.getAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE) || e.cartItemsSelectControlValue, i = s.getAttribute(t.ORIENTATION) || e.cardOrientationControlValue;
61
+ o.setItemsType(u), o.setItemIds(c), o.setOrientation(i), B(r), U(r), k(r);
61
62
  }
62
63
  }
63
64
  export {
64
- b as BLOCK_ID,
65
- O as ItemsBlock
65
+ M as BLOCK_ID,
66
+ x as ItemsBlock
66
67
  };
@@ -1,52 +1,59 @@
1
- var a = Object.defineProperty;
2
- var l = (e, t, n) => t in e ? a(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var i = (e, t, n) => l(e, typeof t != "symbol" ? t + "" : t, n);
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
4
  import { CommonControl as u } from "../../../common-control.js";
5
5
  import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
6
- import { useItemsBlockStore as m } from "../../store/items-block.js";
7
- import { getItemsBlockConfig as L } from "../../utils/nodeConfigUtils.js";
8
- const r = d.BUTTON_LINK, s = {
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 = {
9
10
  LINK: "link"
10
11
  };
11
- class N extends u {
12
+ class C extends u {
12
13
  constructor() {
13
14
  super(...arguments);
14
- i(this, "store", m());
15
+ s(this, "store", l());
15
16
  }
16
17
  getId() {
17
- return r;
18
+ return i;
18
19
  }
19
20
  getTemplate() {
20
21
  return `
21
- <div class="container ${r}">
22
+ <div class="${i}">
22
23
  ${this._getLink()}
23
24
  </div>
24
25
  `;
25
26
  }
26
27
  onRender() {
27
28
  this.api.updateValues({
28
- [s.LINK]: this.store.buttonLink
29
- });
29
+ [n.LINK]: this.store.buttonLink
30
+ }), this._listenToFormUpdates();
30
31
  }
31
- onTemplateNodeUpdated(n) {
32
- super.onTemplateNodeUpdated(n), this.handleBlockInstanceChange(
33
- () => {
34
- const o = L(this.currentNode);
35
- o != null && o.buttonLink && this.store.setButtonLink(o.buttonLink);
36
- },
32
+ onTemplateNodeUpdated(t) {
33
+ super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
34
+ () => h(this.currentNode),
37
35
  () => {
38
36
  this.api.updateValues({
39
- [s.LINK]: this.store.buttonLink
37
+ [n.LINK]: this.store.buttonLink
40
38
  });
41
39
  }
42
40
  );
43
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
+ }
44
51
  _getLink() {
45
52
  return `
46
53
  ${this._GuOneColumn([
47
54
  this._GuLabel({ text: "Link" }),
48
55
  this._GuTextInput({
49
- name: s.LINK,
56
+ name: n.LINK,
50
57
  placeholder: "Enter Link",
51
58
  className: "es-100",
52
59
  disabled: !0
@@ -56,6 +63,6 @@ class N extends u {
56
63
  }
57
64
  }
58
65
  export {
59
- N as ButtonLinkControl,
60
- r as CONTROL_BLOCK_ID
66
+ C as ButtonLinkControl,
67
+ i as CONTROL_BLOCK_ID
61
68
  };