@useinsider/guido 3.11.0 → 3.12.0-beta.0c096f0

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 (66) hide show
  1. package/README.md +29 -0
  2. package/dist/@types/config/schemas.js +104 -84
  3. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +1 -1
  4. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +8 -8
  5. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  6. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +10 -10
  7. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  8. package/dist/components/organisms/header/HeaderWrapper.vue.js +3 -3
  9. package/dist/components/organisms/header/HeaderWrapper.vue2.js +2 -0
  10. package/dist/components/organisms/header/version-history/VersionHistory.vue.js +1 -1
  11. package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +11 -10
  12. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  13. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +6 -6
  14. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +20 -23
  15. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
  16. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +8 -7
  17. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
  18. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +2 -2
  19. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
  20. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +9 -9
  21. package/dist/composables/useModuleDynamicContentRepair.js +37 -0
  22. package/dist/composables/usePreviewInteractionGuard.js +36 -11
  23. package/dist/composables/useRecommendationPreview.js +61 -60
  24. package/dist/composables/useStripo.js +70 -67
  25. package/dist/config/compiler/outlookCompilerRules.js +21 -8
  26. package/dist/config/migrator/index.js +7 -6
  27. package/dist/config/migrator/socialIconMigrator.js +29 -0
  28. package/dist/enums/academy.js +1 -1
  29. package/dist/enums/date.js +3 -4
  30. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +43 -41
  31. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  32. package/dist/extensions/Blocks/Recommendation/controls/blockBackground/index.js +10 -0
  33. package/dist/extensions/Blocks/Recommendation/extension.js +23 -21
  34. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +41 -40
  35. package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +3 -2
  36. package/dist/extensions/Blocks/controlFactories.js +125 -75
  37. package/dist/guido.css +1 -1
  38. package/dist/node_modules/valibot/dist/index.js +148 -112
  39. package/dist/services/stripoApi.js +18 -18
  40. package/dist/src/@types/config/schemas.d.ts +30 -0
  41. package/dist/src/@types/generic.d.ts +18 -0
  42. package/dist/src/composables/useConfig.d.ts +6 -0
  43. package/dist/src/composables/useModuleDynamicContentRepair.d.ts +18 -0
  44. package/dist/src/composables/usePreviewInteractionGuard.d.ts +1 -1
  45. package/dist/src/config/migrator/socialIconMigrator.d.ts +1 -0
  46. package/dist/src/enums/academy.d.ts +3 -3
  47. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  48. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +14 -0
  49. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  50. package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
  51. package/dist/src/extensions/Blocks/controlFactories.d.ts +36 -0
  52. package/dist/src/library.d.ts +1 -1
  53. package/dist/src/stores/config.d.ts +54 -0
  54. package/dist/src/utils/dynamicContentConverter.d.ts +27 -0
  55. package/dist/src/utils/environmentUtil.d.ts +5 -2
  56. package/dist/src/utils/genericUtil.d.ts +18 -1
  57. package/dist/src/utils/urlSchemes.d.ts +6 -0
  58. package/dist/static/styles/components/base-input.css.js +6 -7
  59. package/dist/utils/dateUtil.js +10 -23
  60. package/dist/utils/dynamicContentConverter.js +31 -0
  61. package/dist/utils/environmentUtil.js +3 -2
  62. package/dist/utils/genericUtil.js +42 -21
  63. package/dist/utils/urlSchemes.js +4 -0
  64. package/package.json +10 -1
  65. package/dist/src/composables/useHtmlValidator.test.d.ts +0 -1
  66. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +0 -1
@@ -1,44 +1,45 @@
1
- import { useActionsApi as U } from "./useActionsApi.js";
2
- import { useBlocksConfig as R } from "./useBlocksConfig.js";
3
- import { useConfig as x } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as O } from "./useCustomInterfaceAppearance.js";
5
- import { useFullStoryBridge as q } from "./useFullStoryBridge.js";
6
- import { useStripoEventHandler as H } from "./useStripoEventHandler.js";
7
- import { useStripoNotifications as N } from "./useStripoNotifications.js";
8
- import { useToaster as z } from "./useToaster.js";
9
- import { localePatch as L } from "../config/i18n/index.js";
10
- import { en as h } from "../config/i18n/en/index.js";
11
- import { ToasterTypeOptions as $ } from "../enums/toaster.js";
12
- import { useStripoApi as G } from "../services/stripoApi.js";
13
- import J from "../static/styles/customEditorStyle.css.js";
14
- import { useEditorStore as E } from "../stores/editor.js";
15
- import { dynamicContentToMergeTags as X } from "../utils/genericUtil.js";
16
- import j from "../package.json.js";
17
- const fo = (C, l) => {
18
- const { features: c, template: w, isFeatureEnabled: u } = x(), { handleError: m, showToaster: b } = z(), { getToken: T, getCustomFonts: k, getSyncModulesStatus: B } = G(), { handleEvent: F } = H(), { getStripoBlocksConfig: v } = R(), { getStripoNotifications: V } = N(), _ = async (s, i = [], r = !1) => {
19
- var g, S, y;
20
- const o = E(), { html: p, css: a } = s, { baseBlocks: t, extensions: d } = await v(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, M = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, P = ((y = w.value) == null ? void 0 : y.forceRecreate) ?? !1;
1
+ import { useActionsApi as x } from "./useActionsApi.js";
2
+ import { useBlocksConfig as O } from "./useBlocksConfig.js";
3
+ import { useConfig as q } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as H } from "./useCustomInterfaceAppearance.js";
5
+ import { useFullStoryBridge as L } from "./useFullStoryBridge.js";
6
+ import { useModuleDynamicContentRepair as N } from "./useModuleDynamicContentRepair.js";
7
+ import { useStripoEventHandler as z } from "./useStripoEventHandler.js";
8
+ import { useStripoNotifications as $ } from "./useStripoNotifications.js";
9
+ import { useToaster as G } from "./useToaster.js";
10
+ import { localePatch as J } from "../config/i18n/index.js";
11
+ import { en as E } from "../config/i18n/en/index.js";
12
+ import { ToasterTypeOptions as X } from "../enums/toaster.js";
13
+ import { useStripoApi as j } from "../services/stripoApi.js";
14
+ import K from "../static/styles/customEditorStyle.css.js";
15
+ import { useEditorStore as w } from "../stores/editor.js";
16
+ import { buildMergeTagEntries as Q, flattenDynamicContentList as W } from "../utils/genericUtil.js";
17
+ import Y from "../package.json.js";
18
+ const he = (b, l) => {
19
+ const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: T, getCustomFonts: v, getSyncModulesStatus: B } = j(), { handleEvent: F } = z(), { handleModuleAdd: M } = N(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), _ = async (n, i = [], r = !1) => {
20
+ var S, y, h, C;
21
+ const e = w(), { html: f, css: a } = n, { baseBlocks: o, extensions: d } = await A(), g = ((S = c.value) == null ? void 0 : S.displayConditions) ?? !0, P = ((y = c.value) == null ? void 0 : y.modulesDisabled) ?? !1, I = ((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1;
21
22
  await window.UIEditor.initEditor(
22
23
  document.querySelector("#guido-editor"),
23
24
  {
24
- metadata: C,
25
- html: p,
25
+ metadata: b,
26
+ html: f,
26
27
  css: a,
27
- forceRecreate: P,
28
+ forceRecreate: I,
28
29
  locale: "en",
29
30
  undoButtonSelector: "#guido__undo-button",
30
31
  redoButtonSelector: "#guido__redo-button",
31
32
  mobileViewButtonSelector: ".guido__view-option-selection-mobile",
32
33
  desktopViewButtonSelector: ".guido__view-option-selection-desktop",
33
34
  codeEditorButtonSelector: "#guido__code-button",
34
- customAppearanceMergetags: !u("liquidSyntax"),
35
+ customAppearanceMergetags: !m("liquidSyntax"),
35
36
  customAppearanceMergetagsBorderColor: "#f1f3fe",
36
37
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
37
- customViewStyles: J,
38
- conditionsEnabled: f,
39
- customConditionsEnabled: f,
38
+ customViewStyles: K,
39
+ conditionsEnabled: g,
40
+ customConditionsEnabled: g,
40
41
  enableXSSSecurity: !0,
41
- modulesDisabled: M,
42
+ modulesDisabled: P,
42
43
  syncModulesEnabled: r,
43
44
  messageSettingsEnabled: !0,
44
45
  displayGmailAnnotations: !0,
@@ -48,7 +49,7 @@ const fo = (C, l) => {
48
49
  selectElementAfterDrop: !0,
49
50
  sameFontSizeForOutlook: !0,
50
51
  allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
51
- ...t ? { baseBlocks: t } : {},
52
+ ...o ? { baseBlocks: o } : {},
52
53
  editorFonts: {
53
54
  showDefaultStandardFonts: !0,
54
55
  showDefaultNotStandardFonts: !0,
@@ -56,43 +57,45 @@ const fo = (C, l) => {
56
57
  },
57
58
  mergeTags: [
58
59
  {
59
- entries: X(
60
+ entries: Q(
60
61
  l.preselectedDynamicContentList,
61
- u("liquidSyntax")
62
+ W((C = u.value) == null ? void 0 : C.dynamicContentList),
63
+ m("liquidSyntax")
62
64
  )
63
65
  }
64
66
  ],
65
- async onTokenRefreshRequest(e) {
67
+ async onTokenRefreshRequest(t) {
66
68
  try {
67
- const n = await T();
68
- e(n);
69
- } catch (n) {
70
- m(n, "Failed to refresh token");
69
+ const s = await T();
70
+ t(s);
71
+ } catch (s) {
72
+ p(s, "Failed to refresh token");
71
73
  }
72
74
  },
73
75
  onTemplateLoaded() {
74
76
  try {
75
- const { importCss: e } = O(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: D } = U(), { injectFullStory: I } = q();
76
- e(), n(), I(), D(), l.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
77
- o.hasChanges = !1;
77
+ const { importCss: t } = H(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: R } = x(), { injectFullStory: U } = L();
78
+ t(), s(), U(), R(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
79
+ e.hasChanges = !1;
78
80
  }, 1e3);
79
- } catch (e) {
80
- m(e, "Failed to load custom interface appearance");
81
+ } catch (t) {
82
+ p(t, "Failed to load custom interface appearance");
81
83
  }
82
84
  },
83
- onCodeEditorVisibilityChanged(e) {
84
- o.isCodeEditorOpen = e;
85
+ onCodeEditorVisibilityChanged(t) {
86
+ e.isCodeEditorOpen = t;
85
87
  },
86
- onEditorVisualModeChanged(e) {
87
- o.editorVisualMode = e.toLowerCase();
88
+ onEditorVisualModeChanged(t) {
89
+ e.editorVisualMode = t.toLowerCase();
88
90
  },
89
- onVersionHistoryVisibilityChanged(e) {
90
- o.isVersionHistoryOpen = e;
91
+ onVersionHistoryVisibilityChanged(t) {
92
+ e.isVersionHistoryOpen = t;
91
93
  },
92
94
  onDataChanged() {
93
- o.hasChanges = !0;
95
+ e.hasChanges = !0;
94
96
  },
95
97
  onEvent: F,
98
+ onModuleAdd: M,
96
99
  notifications: V(),
97
100
  ignoreClickOutsideSelectors: [
98
101
  "#guido-dynamic-content-modal",
@@ -100,38 +103,38 @@ const fo = (C, l) => {
100
103
  ".in-drawer__container"
101
104
  ],
102
105
  extensions: d,
103
- localePatch: L
106
+ localePatch: J
104
107
  }
105
108
  );
106
- }, A = (s) => new Promise((i, r) => {
109
+ }, D = (n) => new Promise((i, r) => {
107
110
  var d;
108
111
  if (document.getElementById("UiEditorScript")) {
109
- Promise.resolve(s()).then(i, r);
112
+ Promise.resolve(n()).then(i, r);
110
113
  return;
111
114
  }
112
- const o = j.guido, a = `https://email-static.useinsider.com/guido/${(d = o == null ? void 0 : o.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
113
- t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
114
- Promise.resolve(s()).then(i, r);
115
- }, t.onerror = () => {
115
+ const e = Y.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
116
+ o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
117
+ Promise.resolve(n()).then(i, r);
118
+ }, o.onerror = () => {
116
119
  r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
117
- }, document.body.appendChild(t);
120
+ }, document.body.appendChild(o);
118
121
  });
119
- return { initPlugin: async (s) => {
120
- const i = E();
122
+ return { initPlugin: async (n) => {
123
+ const i = w();
121
124
  try {
122
- await A(async () => {
123
- const [r, o] = await Promise.all([
124
- k(),
125
+ await D(async () => {
126
+ const [r, e] = await Promise.all([
127
+ v(),
125
128
  B()
126
129
  ]);
127
- i.syncModulesEnabled = o, await _(s, r, o);
130
+ i.syncModulesEnabled = e, await _(n, r, e);
128
131
  });
129
132
  } catch {
130
- i.loadingStatus = !1, b({
131
- type: $.Error,
132
- message: h["An error has occurred. Please report the error code to support."],
133
+ i.loadingStatus = !1, k({
134
+ type: X.Error,
135
+ message: E["An error has occurred. Please report the error code to support."],
133
136
  actionButton: {
134
- text: h["Reload page"],
137
+ text: E["Reload page"],
135
138
  onClick: () => window.location.reload()
136
139
  }
137
140
  });
@@ -139,5 +142,5 @@ const fo = (C, l) => {
139
142
  } };
140
143
  };
141
144
  export {
142
- fo as useStripo
145
+ he as useStripo
143
146
  };
@@ -1,4 +1,4 @@
1
- const c = `
1
+ const r = `
2
2
  <!--[if gte mso 9]>
3
3
  <xml>
4
4
  <o:OfficeDocumentSettings>
@@ -6,15 +6,21 @@ const c = `
6
6
  <o:PixelsPerInch>96</o:PixelsPerInch>
7
7
  </o:OfficeDocumentSettings>
8
8
  </xml>
9
- <![endif]-->`, s = {
9
+ <![endif]-->`, n = {
10
10
  xmlns: "http://www.w3.org/1999/xhtml",
11
11
  "xmlns:o": "urn:schemas-microsoft-com:office:office"
12
- }, r = [
12
+ }, p = `
13
+ <style type="text/css">
14
+ ul, ol { padding: 0px 0px 0px 40px; }
15
+ li p { mso-margin-bottom-alt: 15px; }
16
+ .es-text-ltr ul, .es-text-ltr ol { padding: 0px 0px 0px 40px; }
17
+ .es-text-rtl ol, .es-text-rtl ul { padding: 0px 40px 0px 0px; }
18
+ </style>`, l = [
13
19
  {
14
20
  id: "append-office-xml",
15
21
  description: "Appending office XML into the head if it does not exist.",
16
22
  type: "custom",
17
- processor: (e) => e.includes("<o:OfficeDocumentSettings>") ? e : e.replace("</head>", `${c}</head>`),
23
+ processor: (e) => e.includes("<o:OfficeDocumentSettings>") ? e : e.replace("</head>", `${r}</head>`),
18
24
  priority: 70
19
25
  },
20
26
  {
@@ -23,14 +29,21 @@ const c = `
23
29
  type: "custom",
24
30
  processor: (e) => {
25
31
  let t = e;
26
- return Object.entries(s).forEach(([o, i]) => {
27
- const n = new RegExp(`${o}="[^"]*"`);
28
- t.search(n) === -1 && (t = t.replace("<html", `<html ${o}="${i}"`));
32
+ return Object.entries(n).forEach(([o, i]) => {
33
+ const s = new RegExp(`${o}="[^"]*"`);
34
+ t.search(s) === -1 && (t = t.replace("<html", `<html ${o}="${i}"`));
29
35
  }), t;
30
36
  },
31
37
  priority: 71
38
+ },
39
+ {
40
+ id: "append-outlook-list-css",
41
+ description: "Appending Outlook list rules into the head if the base CSS does not already carry them.",
42
+ type: "custom",
43
+ processor: (e) => e.includes("mso-margin-bottom-alt") ? e : e.replace("</head>", `${p}</head>`),
44
+ priority: 73
32
45
  }
33
46
  ];
34
47
  export {
35
- r as outlookCompilerRules
48
+ l as outlookCompilerRules
36
49
  };
@@ -1,13 +1,14 @@
1
- import { migrateCheckbox as o } from "./checkboxMigrator.js";
1
+ import { migrateCheckbox as t } from "./checkboxMigrator.js";
2
2
  import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
3
3
  import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
4
4
  import { migrateRadioButton as a } from "./radioButtonMigrator.js";
5
- import { migrateRecommendation as g } from "./recommendationMigrator.js";
5
+ import { migrateRecommendation as c } from "./recommendationMigrator.js";
6
+ import { migrateSocialIcons as g } from "./socialIconMigrator.js";
6
7
  import { migrateUnsubscribe as n } from "./unsubscribeMigrator.js";
7
- const b = async (r, t = {}) => {
8
- let m = r;
9
- return m = o(m), m = a(m), m = await n(m), m = i(m), m = g(m, t), m = e(m), m;
8
+ const k = async (o, r = {}) => {
9
+ let m = o;
10
+ return m = t(m), m = a(m), m = await n(m), m = i(m), m = c(m, r), m = e(m), m = g(m), m;
10
11
  };
11
12
  export {
12
- b as migrate
13
+ k as migrate
13
14
  };
@@ -0,0 +1,29 @@
1
+ var u = Object.defineProperty;
2
+ var T = (e, t, r) => t in e ? u(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var s = (e, t, r) => T(e, typeof t != "symbol" ? t + "" : t, r);
4
+ const i = "twitter", E = "xcom", o = "esd-tmp-icon-type", p = new RegExp(i, "i");
5
+ class g {
6
+ constructor() {
7
+ s(this, "parser");
8
+ this.parser = new DOMParser();
9
+ }
10
+ migrate(t) {
11
+ try {
12
+ if (!p.test(t))
13
+ return t;
14
+ const r = this.parser.parseFromString(t, "text/html"), a = r.querySelectorAll(`[${o}]`);
15
+ let n = !1;
16
+ return a.forEach((c) => {
17
+ String(c.getAttribute(o)).toLowerCase() === i && (c.setAttribute(o, E), n = !0);
18
+ }), n ? r.documentElement.outerHTML : t;
19
+ } catch (r) {
20
+ return console.error("SocialIconMigrator failed:", r), t;
21
+ }
22
+ }
23
+ }
24
+ function _(e) {
25
+ return new g().migrate(e);
26
+ }
27
+ export {
28
+ _ as migrateSocialIcons
29
+ };
@@ -1,4 +1,4 @@
1
- const e = "https://academy.insiderone.com/", o = {
1
+ const e = "https://academy.insiderone.com", o = {
2
2
  EMAIL_EDITOR: `${e}/docs/email-drag-and-drop-editor`,
3
3
  GLOBAL_UNSUBSCRIBE: `${e}/docs/global-unsubscribe-preference-center`,
4
4
  AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`
@@ -1,6 +1,5 @@
1
- const t = "tr-TR", T = "default", L = "UTC";
1
+ const t = "tr-TR", L = "default";
2
2
  export {
3
- T as DEFAULT,
4
- t as DEFAULT_LOCALE,
5
- L as DEFAULT_TZ
3
+ L as DEFAULT,
4
+ t as DEFAULT_LOCALE
6
5
  };
@@ -1,14 +1,14 @@
1
- import { ModificationDescription as L, UIElementType as P, UEAttr as D } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as h } from "../../../common-control.js";
3
- import { ItemsBlockControlId as R, ItemsBlockId as _ } from "../../enums/controlEnums.js";
4
- import { productPairs as I } from "../../enums/productEnums.js";
5
- import { getItemsBlockConfig as d, setItemsBlockConfig as u, escapeReplacement as O } from "../../utils/nodeConfigUtils.js";
6
- const g = R.PRICE_FORMATTED_PRICE, s = {
1
+ import { ModificationDescription as C, UIElementType as _, UEAttr as L } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as D } from "../../../common-control.js";
3
+ import { ItemsBlockControlId as R, ItemsBlockId as I } from "../../enums/controlEnums.js";
4
+ import { productPairs as p } from "../../enums/productEnums.js";
5
+ import { getItemsBlockConfig as l, setItemsBlockConfig as h, escapeReplacement as g } from "../../utils/nodeConfigUtils.js";
6
+ const O = R.PRICE_FORMATTED_PRICE, a = {
7
7
  FORMATTED_PRICE: "formattedPrice"
8
8
  };
9
- class k extends h {
9
+ class k extends D {
10
10
  getId() {
11
- return g;
11
+ return O;
12
12
  }
13
13
  getTemplate() {
14
14
  return `
@@ -18,56 +18,58 @@ class k extends h {
18
18
  `;
19
19
  }
20
20
  onRender() {
21
- const t = d(this.currentNode);
22
- this.api.updateValues({ [s.FORMATTED_PRICE]: (t == null ? void 0 : t.priceFormatted) ?? !0 }), this.api.onValueChanged(s.FORMATTED_PRICE, (e) => {
23
- this._onFormattedPriceChange(e);
21
+ const e = l(this.currentNode);
22
+ this.api.updateValues({ [a.FORMATTED_PRICE]: (e == null ? void 0 : e.priceFormatted) ?? !0 }), this.api.onValueChanged(a.FORMATTED_PRICE, (t) => {
23
+ this._onFormattedPriceChange(t);
24
24
  });
25
25
  }
26
- onTemplateNodeUpdated(t) {
27
- super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(() => {
28
- const e = d(this.currentNode);
29
- this.api.updateValues({ [s.FORMATTED_PRICE]: (e == null ? void 0 : e.priceFormatted) ?? !0 });
26
+ onTemplateNodeUpdated(e) {
27
+ super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
+ const t = l(this.currentNode);
29
+ this.api.updateValues({ [a.FORMATTED_PRICE]: (t == null ? void 0 : t.priceFormatted) ?? !0 });
30
30
  });
31
31
  }
32
- _onFormattedPriceChange(t) {
33
- if (console.debug("Formatted price changed to: ", t), u(this.currentNode, this.api, { priceFormatted: t }), !this.currentNode)
32
+ _onFormattedPriceChange(e) {
33
+ if (console.debug("Formatted price changed to: ", e), !this.currentNode)
34
34
  return;
35
- const e = d(this.currentNode), n = (e == null ? void 0 : e.type) ?? "CART_ITEMS", i = (e == null ? void 0 : e.priceSinglePrice) ?? !1, r = I.PAIRS_FOR_EXTENSION.price[n], c = I.PAIRS_FOR_EXTENSION.originalPrice[n], [p, m] = t ? [
36
- i ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE,
37
- i ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED
35
+ const t = l(this.currentNode), n = (t == null ? void 0 : t.type) ?? "CART_ITEMS", o = (t == null ? void 0 : t.priceSinglePrice) ?? !1, r = p.PAIRS_FOR_EXTENSION.price[n], i = p.PAIRS_FOR_EXTENSION.originalPrice[n], [E, m] = e ? [
36
+ o ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE,
37
+ o ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED
38
38
  ] : [
39
- i ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED,
40
- i ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE
41
- ], l = i ? c.DEFAULT_SINGLE_PRICE : c.DEFAULT_PRICE, T = i ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_PRICE_FORMATTED, [F, A] = t ? [l, T] : [T, l], o = this.currentNode.closest(".items-block"), C = (o == null ? void 0 : o.querySelectorAll(
42
- `[esd-extension-block-id="${_.PRICE}"]`
43
- )) || [], E = this.api.getDocumentModifier();
44
- C.forEach((a) => {
45
- this._updatePriceBlock(E, a, p, m);
46
- }), ((o == null ? void 0 : o.querySelectorAll(
47
- `[esd-extension-block-id="${_.ORIGINAL_PRICE}"]`
48
- )) || []).forEach((a) => {
49
- this._updatePriceBlock(E, a, F, A);
50
- }), E.apply(new L(
51
- `Updated price to ${t ? "formatted" : "unformatted"}`
39
+ o ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED,
40
+ o ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE
41
+ ], T = o ? i.DEFAULT_SINGLE_PRICE : i.DEFAULT_PRICE, P = o ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_PRICE_FORMATTED, [F, A] = e ? [T, P] : [P, T], s = this.api.getDocumentModifier();
42
+ h(this.currentNode, this.api, { priceFormatted: e }, s);
43
+ const c = this.currentNode.closest(".items-block");
44
+ ((c == null ? void 0 : c.querySelectorAll(
45
+ `[esd-extension-block-id="${I.PRICE}"]`
46
+ )) || []).forEach((d) => {
47
+ this._updatePriceBlock(s, d, E, m, e);
48
+ }), ((c == null ? void 0 : c.querySelectorAll(
49
+ `[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
50
+ )) || []).forEach((d) => {
51
+ this._updatePriceBlock(s, d, F, A, e);
52
+ }), s.apply(new C(
53
+ `Updated price to ${e ? "formatted" : "unformatted"}`
52
54
  ));
53
55
  }
54
- _updatePriceBlock(t, e, n, i) {
55
- const r = e.getInnerHTML().trim().replace(n, O(i));
56
- t.modifyHtml(e).setInnerHtml(r);
56
+ _updatePriceBlock(e, t, n, o, r) {
57
+ const i = `data-formated="${r ? "true" : "false"}"`, E = t.getInnerHTML().trim().replace(n, g(o)).replace(/data-formated=(?:"[^"]*"|'[^']*')/g, i);
58
+ e.modifyHtml(t).setInnerHtml(E);
57
59
  }
58
60
  _getFormattedPrice() {
59
61
  return `
60
62
  <div class="display-flex align-items-center justify-content-between">
61
- <${P.LABEL}
62
- ${D.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
63
+ <${_.LABEL}
64
+ ${L.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
63
65
  >
64
- </${P.LABEL}>
65
- ${this._GuToggle(s.FORMATTED_PRICE)}
66
+ </${_.LABEL}>
67
+ ${this._GuToggle(a.FORMATTED_PRICE)}
66
68
  </div>
67
69
  `;
68
70
  }
69
71
  }
70
72
  export {
71
- g as CONTROL_BLOCK_ID,
73
+ O as CONTROL_BLOCK_ID,
72
74
  k as PriceFormattedPriceControl
73
75
  };
@@ -1,4 +1,4 @@
1
- var o = /* @__PURE__ */ ((c) => (c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c.CUSTOM_ATTR_ALIGN = "recommendation-block-custom-attr-align-control", c.CUSTOM_ATTR_BACKGROUND = "recommendation-block-custom-attr-background-control", c.CUSTOM_ATTR_COLOR = "recommendation-block-custom-attr-color-control", c.CUSTOM_ATTR_FONT_FAMILY = "recommendation-block-custom-attr-font-family-control", c.CUSTOM_ATTR_PADDINGS = "recommendation-block-custom-attr-paddings-control", c.CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control", c.CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control", c.CUSTOM_ATTR_TEXT_TRIM = "recommendation-block-custom-attr-text-trim-control", c.SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message", c))(o || {});
1
+ var o = /* @__PURE__ */ ((c) => (c.BLOCK_BACKGROUND = "recommendation-block-background-color-control", c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c.CUSTOM_ATTR_ALIGN = "recommendation-block-custom-attr-align-control", c.CUSTOM_ATTR_BACKGROUND = "recommendation-block-custom-attr-background-control", c.CUSTOM_ATTR_COLOR = "recommendation-block-custom-attr-color-control", c.CUSTOM_ATTR_FONT_FAMILY = "recommendation-block-custom-attr-font-family-control", c.CUSTOM_ATTR_PADDINGS = "recommendation-block-custom-attr-paddings-control", c.CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control", c.CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control", c.CUSTOM_ATTR_TEXT_TRIM = "recommendation-block-custom-attr-text-trim-control", c.SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message", c))(o || {});
2
2
  export {
3
3
  o as RecommendationControlId
4
4
  };
@@ -0,0 +1,10 @@
1
+ import { createBlockBackgroundColorControl as o } from "../../../controlFactories.js";
2
+ import { RecommendationControlId as r } from "../../constants/controlIds.js";
3
+ import { BLOCK_ROOT_SELECTOR as t } from "../../constants/selectors.js";
4
+ const c = o(
5
+ r.BLOCK_BACKGROUND,
6
+ t
7
+ );
8
+ export {
9
+ c as BlockBackgroundColorControl
10
+ };
@@ -1,4 +1,4 @@
1
- import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { ExtensionBuilder as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RecommendationBlock as m } from "./block.js";
3
3
  import n from "./canvasPreview.css.js";
4
4
  import { RecommendationBlockControl as i } from "./controls/main/index.js";
@@ -6,42 +6,44 @@ import "./constants/selectors.js";
6
6
  import "./store/recommendation.js";
7
7
  import "./utils/captureStyleTemplates.js";
8
8
  import { NameControls as e } from "./controls/name/index.js";
9
- import { PriceControls as s } from "./controls/price/index.js";
10
- import { OldPriceControls as l } from "./controls/oldPrice/index.js";
9
+ import { PriceControls as l } from "./controls/price/index.js";
10
+ import { OldPriceControls as s } from "./controls/oldPrice/index.js";
11
11
  import { OmnibusPriceControls as p } from "./controls/omnibusPrice/index.js";
12
12
  import { OmnibusDiscountControls as a } from "./controls/omnibusDiscount/index.js";
13
13
  import { ButtonControls as c } from "./controls/button/index.js";
14
- import { ImageControls as f } from "./controls/image/index.js";
15
- import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
14
+ import { ImageControls as C } from "./controls/image/index.js";
15
+ import { CustomAttributeControls as f } from "./controls/customAttribute/index.js";
16
16
  import { SpacingControl as d } from "./controls/spacing/index.js";
17
- import { CardBackgroundColorControl as u } from "./controls/cardBackground/index.js";
18
- import { RecommendationCardCompositionControl as g } from "./controls/cardComposition/index.js";
19
- import { SyncInfoMessageControl as y } from "./controls/syncInfoMessage.js";
17
+ import { BlockBackgroundColorControl as u } from "./controls/blockBackground/index.js";
18
+ import { CardBackgroundColorControl as g } from "./controls/cardBackground/index.js";
19
+ import { RecommendationCardCompositionControl as y } from "./controls/cardComposition/index.js";
20
+ import { SyncInfoMessageControl as B } from "./controls/syncInfoMessage.js";
20
21
  import { RecommendationIconsRegistry as P } from "./iconsRegistry.js";
21
22
  import R from "./recommendation.css.js";
22
23
  import { SettingsPanel as S } from "./settingsPanel.js";
23
- const w = [
24
+ const k = [
24
25
  e,
25
- s,
26
26
  l,
27
+ s,
27
28
  p,
28
29
  a,
29
30
  c,
30
- f,
31
- C
32
- ], B = [
31
+ C,
32
+ f
33
+ ], w = [
33
34
  i,
34
35
  u,
35
- d,
36
36
  g,
37
- y
37
+ d,
38
+ y,
39
+ B
38
40
  ], b = [
39
- ...B,
40
- ...w.flatMap((o) => Object.values(o))
41
- ], U = b.reduce(
42
- (o, t) => o.addControl(t),
43
- new r().addBlock(m).withSettingsPanelRegistry(S)
41
+ ...w,
42
+ ...k.flatMap((o) => Object.values(o))
43
+ ], W = b.reduce(
44
+ (o, r) => o.addControl(r),
45
+ new t().addBlock(m).withSettingsPanelRegistry(S)
44
46
  ).addStyles(R).withPreviewStyles(n).withIconsRegistry(P).build();
45
47
  export {
46
- U as default
48
+ W as default
47
49
  };