@useinsider/guido 1.0.3-beta.c890701 → 1.0.3-beta.cafee45

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.
@@ -1,6 +1,6 @@
1
- import { useToaster as g } from "./useToaster.js";
1
+ import { useToaster as w } from "./useToaster.js";
2
2
  const A = () => {
3
- const { handleError: l } = g(), n = (t = {}) => new Promise((e, a) => {
3
+ const { handleError: l } = w(), s = (e = {}) => new Promise((t, a) => {
4
4
  const i = { ...{
5
5
  minimize: !0,
6
6
  utmEntity: {
@@ -20,13 +20,13 @@ const A = () => {
20
20
  forceAmp: !1,
21
21
  resetDataSavedFlag: !1,
22
22
  disableLineHeightsReplace: !0
23
- }, ...t }, m = {
24
- callback: (s, c, p, u, d) => {
25
- s ? a(s) : e({
26
- html: c,
27
- ampHtml: p,
28
- ampErrors: u,
29
- displayConditions: d
23
+ }, ...e }, m = {
24
+ callback: (n, p, c, d, u) => {
25
+ n ? a(n) : t({
26
+ html: p,
27
+ ampHtml: c,
28
+ ampErrors: d,
29
+ displayConditions: u
30
30
  });
31
31
  },
32
32
  ...i
@@ -34,44 +34,53 @@ const A = () => {
34
34
  window.StripoEditorApi.actionsApi.compileEmail(m);
35
35
  });
36
36
  return {
37
- getCompiledEmail: n,
38
- getTemplateData: () => new Promise((t) => {
39
- const e = ({ html: a, css: o, width: i, height: r, utmParams: m, syncModulesIds: s }) => t({
37
+ getCompiledEmail: s,
38
+ getTemplateData: () => new Promise((e) => {
39
+ const t = ({ html: a, css: o, width: i, height: r, utmParams: m, syncModulesIds: n }) => e({
40
40
  html: a,
41
41
  css: o,
42
42
  width: i,
43
43
  height: r,
44
44
  utmParams: m,
45
- syncModulesIds: s
45
+ syncModulesIds: n
46
46
  });
47
- window.StripoEditorApi.actionsApi.getTemplateData(e);
47
+ window.StripoEditorApi.actionsApi.getTemplateData(t);
48
48
  }),
49
- activateCustomViewStyles: (t = !0) => {
50
- window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
49
+ activateCustomViewStyles: (e = !0) => {
50
+ window.StripoEditorApi.actionsApi.activateCustomViewStyles(e);
51
51
  },
52
- getPreviewData: async (t) => {
52
+ getPreviewData: async (e) => {
53
53
  try {
54
54
  const {
55
- html: e,
55
+ html: t,
56
56
  displayConditions: a,
57
57
  ampHtml: o = "",
58
58
  ampErrors: i = []
59
- } = await n({ minimize: !1, resetDataSavedFlag: !1, ...t });
59
+ } = await s({ minimize: !1, resetDataSavedFlag: !1, ...e });
60
60
  return {
61
- html: e,
61
+ html: t,
62
62
  ampHtml: o,
63
63
  ampErrors: i,
64
64
  displayConditions: a
65
65
  };
66
- } catch (e) {
67
- return l(e, "Error loading preview"), {
66
+ } catch (t) {
67
+ return l(t, "Error loading preview"), {
68
68
  html: "",
69
69
  ampHtml: "",
70
70
  ampErrors: [],
71
71
  displayConditions: []
72
72
  };
73
73
  }
74
- }
74
+ },
75
+ updateTimerInClonedTemplate: () => new Promise((e) => {
76
+ try {
77
+ window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((t, a) => {
78
+ t ? (l(t, "Failed to update timer in cloned template"), e(null)) : e(a || null);
79
+ });
80
+ } catch (t) {
81
+ l(t, "Failed to call updateTimerInClonedTemplate"), e(null);
82
+ }
83
+ })
75
84
  };
76
85
  };
77
86
  export {
@@ -1,25 +1,26 @@
1
- import { useActionsApi as h } from "./useActionsApi.js";
2
- import { useBlocksConfig as b } from "./useBlocksConfig.js";
3
- import { useConfig as k } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as V } from "./useCustomInterfaceAppearance.js";
5
- import { useStripoEventHandler as _ } from "./useStripoEventHandler.js";
6
- import { useToaster as B } from "./useToaster.js";
7
- import { displayConditions as A } from "../enums/displayConditions.js";
8
- import { useStripoApi as F } from "../services/stripoApi.js";
9
- import T from "../static/styles/customEditorStyle.css.js";
10
- import { useEditorStore as v } from "../stores/editor.js";
11
- import { dynamicContentToMergeTags as I } from "../utils/genericUtil.js";
12
- import M from "../package.json.js";
13
- const N = (d) => {
14
- const { config: u } = k(), { handleError: l } = B(), { getToken: f, getCustomFonts: S } = F(), { handleEvent: C } = _(), { getStripoBlocksConfig: y } = b(), E = async (i, r = []) => {
15
- var m, g;
16
- const t = v(), { html: n, css: p, forceRecreate: a } = i, { baseBlocks: e, extensions: c } = await y();
1
+ import { useActionsApi as V } from "./useActionsApi.js";
2
+ import { useBlocksConfig as _ } from "./useBlocksConfig.js";
3
+ import { useConfig as A } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
5
+ import { useStripoEventHandler as v } from "./useStripoEventHandler.js";
6
+ import { useTimerClone as F } from "./useTimerClone.js";
7
+ import { useToaster as I } from "./useToaster.js";
8
+ import { displayConditions as M } from "../enums/displayConditions.js";
9
+ import { useStripoApi as U } from "../services/stripoApi.js";
10
+ import D from "../static/styles/customEditorStyle.css.js";
11
+ import { useEditorStore as P } from "../stores/editor.js";
12
+ import { dynamicContentToMergeTags as H } from "../utils/genericUtil.js";
13
+ import O from "../package.json.js";
14
+ const Y = (c) => {
15
+ const { config: u } = A(), { handleError: p } = I(), { getToken: m, getCustomFonts: C } = U(), { handleEvent: S } = v(), { getStripoBlocksConfig: E } = _(), w = async (i, r = []) => {
16
+ var g, y;
17
+ const e = P(), { html: s, css: f, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await E();
17
18
  window.UIEditor.initEditor(
18
19
  document.querySelector("#guido-editor"),
19
20
  {
20
- metadata: d,
21
- html: n,
22
- css: p,
21
+ metadata: c,
22
+ html: s,
23
+ css: f,
23
24
  forceRecreate: a,
24
25
  locale: "en",
25
26
  undoButtonSelector: "#guido__undo-button",
@@ -30,14 +31,18 @@ const N = (d) => {
30
31
  customAppearanceMergetags: !0,
31
32
  customAppearanceMergetagsBorderColor: "#f1f3fe",
32
33
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
33
- customViewStyles: T,
34
- conditionsEnabled: ((m = u.features) == null ? void 0 : m.displayConditions) ?? !0,
35
- customConditionsEnabled: ((g = u.features) == null ? void 0 : g.displayConditions) ?? !0,
36
- conditionCategories: A,
34
+ customViewStyles: D,
35
+ conditionsEnabled: ((g = u.features) == null ? void 0 : g.displayConditions) ?? !0,
36
+ customConditionsEnabled: ((y = u.features) == null ? void 0 : y.displayConditions) ?? !0,
37
+ conditionCategories: M,
37
38
  enableXSSSecurity: !0,
38
- messageSettingsEnabled: !1,
39
+ messageSettingsEnabled: !0,
40
+ displayGmailAnnotations: !0,
41
+ displayHiddenPreheader: !1,
42
+ displayTitle: !1,
43
+ displayUTM: !1,
39
44
  selectElementAfterDrop: !0,
40
- ...e ? { baseBlocks: e } : {},
45
+ ...t ? { baseBlocks: t } : {},
41
46
  editorFonts: {
42
47
  showDefaultStandardFonts: !0,
43
48
  showDefaultNotStandardFonts: !0,
@@ -45,68 +50,69 @@ const N = (d) => {
45
50
  },
46
51
  mergeTags: [
47
52
  {
48
- entries: I(d.preselectedDynamicContentList)
53
+ entries: H(c.preselectedDynamicContentList)
49
54
  }
50
55
  ],
51
56
  async onTokenRefreshRequest(o) {
52
57
  try {
53
- const s = await f();
54
- o(s);
55
- } catch (s) {
56
- l(s, "Failed to refresh token");
58
+ const n = await m();
59
+ o(n);
60
+ } catch (n) {
61
+ p(n, "Failed to refresh token");
57
62
  }
58
63
  },
59
64
  onTemplateLoaded() {
65
+ var o, n;
60
66
  try {
61
- const { importCss: o } = V(), { activateCustomViewStyles: s } = h();
62
- o(), s(), d.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
63
- t.hasChanges = !1;
67
+ const { importCss: l } = B(), { activateCustomViewStyles: T, updateTimerInClonedTemplate: b } = V(), { updateTimersOnLoad: k } = F();
68
+ l(), T(), typeof ((n = (o = window.StripoEditorApi) == null ? void 0 : o.actionsApi) == null ? void 0 : n.updateTimerInClonedTemplate) == "function" ? b() : k(m), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
69
+ e.hasChanges = !1;
64
70
  }, 1e3);
65
- } catch (o) {
66
- l(o, "Failed to load custom interface appearance");
71
+ } catch (l) {
72
+ p(l, "Failed to load custom interface appearance");
67
73
  }
68
74
  },
69
75
  onCodeEditorVisibilityChanged(o) {
70
- t.isCodeEditorOpen = o;
76
+ e.isCodeEditorOpen = o;
71
77
  },
72
78
  onEditorVisualModeChanged(o) {
73
- t.editorVisualMode = o.toLowerCase();
79
+ e.editorVisualMode = o.toLowerCase();
74
80
  },
75
81
  onVersionHistoryVisibilityChanged(o) {
76
- t.isVersionHistoryOpen = o;
82
+ e.isVersionHistoryOpen = o;
77
83
  },
78
84
  onDataChanged() {
79
- t.hasChanges = !0;
85
+ e.hasChanges = !0;
80
86
  },
81
- onEvent: C,
87
+ onEvent: S,
82
88
  ignoreClickOutsideSelectors: [
83
89
  "#guido-dynamic-content-modal",
84
90
  ".in-on-board-wrapper",
85
91
  ".in-drawer__container"
86
92
  ],
87
- extensions: c
93
+ extensions: d
88
94
  }
89
95
  );
90
- }, w = (i) => new Promise((r, t) => {
91
- var c;
96
+ }, h = (i) => new Promise((r, e) => {
97
+ var d;
92
98
  if (document.getElementById("UiEditorScript")) {
93
99
  i(), r();
94
100
  return;
95
101
  }
96
- const n = M.guido, a = `https://email-static.useinsider.com/guido/${(c = n == null ? void 0 : n.stripo) == null ? void 0 : c.version}/UIEditor.js`, e = document.createElement("script");
97
- e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
102
+ const s = O.guido, a = `https://email-static.useinsider.com/guido/${(d = s == null ? void 0 : s.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
103
+ t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
98
104
  i(), r();
99
- }, e.onerror = () => {
100
- t(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
101
- }, document.body.appendChild(e);
105
+ }, t.onerror = () => {
106
+ e(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
107
+ }, document.body.appendChild(t);
102
108
  });
103
109
  return { initPlugin: async (i) => {
104
- await w(async () => {
105
- const r = await S();
106
- await E(i, r);
110
+ await h(async () => {
111
+ const r = await C();
112
+ await w(i, r);
107
113
  });
108
114
  } };
109
115
  };
110
116
  export {
111
- N as useStripo
117
+ Y as useStripo
112
118
  };
@@ -0,0 +1,67 @@
1
+ import { useToaster as g } from "./useToaster.js";
2
+ const M = () => {
3
+ const { handleError: l } = g(), a = (r) => /esd-timer-id="(\d+)"/.test(r), c = async (r, n) => {
4
+ try {
5
+ console.log("[TIMER CLONE] Calling Stripo API to clone timers...");
6
+ const e = await fetch("https://plugins.stripo.email/api/v1/timers/clone", {
7
+ method: "POST",
8
+ headers: {
9
+ "ES-PLUGIN-AUTH": `Bearer ${n}`,
10
+ "Content-Type": "application/json"
11
+ },
12
+ body: JSON.stringify({ html: r })
13
+ });
14
+ if (console.log("[TIMER CLONE] API response status:", e.status), !e.ok) {
15
+ const s = await e.text();
16
+ throw console.error("[TIMER CLONE] API error:", s), new Error(`Stripo API error: ${e.status} ${e.statusText}`);
17
+ }
18
+ const t = await e.json();
19
+ return console.log("[TIMER CLONE] Timers cloned successfully. Map:", t.timersMap), console.log("[TIMER CLONE] Old HTML length:", r.length), console.log("[TIMER CLONE] New HTML length:", t.html.length), t.html;
20
+ } catch (e) {
21
+ return console.error("[TIMER CLONE] Error:", e), l(e, "Failed to clone timer IDs"), null;
22
+ }
23
+ };
24
+ return {
25
+ hasTimerBlocks: a,
26
+ cloneTimersInHtml: c,
27
+ updateTimersOnLoad: async (r) => {
28
+ var n, e, t, s, d, E;
29
+ try {
30
+ console.log("[TIMER CLONE] Starting timer update on template load...");
31
+ const o = (e = (n = window.UIEditor) == null ? void 0 : n.getHtml) == null ? void 0 : e.call(n);
32
+ if (!o) {
33
+ console.log("[TIMER CLONE] No HTML found, skipping timer update");
34
+ return;
35
+ }
36
+ const u = a(o);
37
+ if (console.log("[TIMER CLONE] Has timer blocks?", u), !u)
38
+ return;
39
+ const T = o.match(/esd-timer-id="(\d+)"/g);
40
+ console.log("[TIMER CLONE] Current timer IDs:", T), console.log("[TIMER CLONE] Getting auth token...");
41
+ const p = await r();
42
+ if (!p) {
43
+ console.warn("[TIMER CLONE] No auth token available, skipping timer update");
44
+ return;
45
+ }
46
+ const i = await c(o, p);
47
+ if (!i) {
48
+ console.warn("[TIMER CLONE] API returned no updated HTML");
49
+ return;
50
+ }
51
+ if (i === o) {
52
+ console.log("[TIMER CLONE] HTML unchanged, no update needed");
53
+ return;
54
+ }
55
+ const m = i.match(/esd-timer-id="(\d+)"/g);
56
+ console.log("[TIMER CLONE] New timer IDs:", m);
57
+ const I = ((s = (t = window.UIEditor) == null ? void 0 : t.getCss) == null ? void 0 : s.call(t)) || "";
58
+ console.log("[TIMER CLONE] Updating editor with new HTML..."), (E = (d = window.StripoEditorApi) == null ? void 0 : d.actionsApi) != null && E.updateHtmlAndCss ? (window.StripoEditorApi.actionsApi.updateHtmlAndCss(i, I), console.log("[TIMER CLONE] ✅ Editor updated successfully!")) : console.warn("[TIMER CLONE] updateHtmlAndCss method not available");
59
+ } catch (o) {
60
+ console.error("[TIMER CLONE] Error updating timers:", o), l(o, "Failed to update timer blocks");
61
+ }
62
+ }
63
+ };
64
+ };
65
+ export {
66
+ M as useTimerClone
67
+ };
@@ -2,9 +2,9 @@ var d = Object.defineProperty;
2
2
  var l = (r, n, e) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
3
3
  var o = (r, n, e) => l(r, typeof n != "symbol" ? n + "" : n, e);
4
4
  import { useHttp as L } from "../../../composables/useHttp.js";
5
- import { DEFAULT_UNSUBSCRIBE_GROUP as u } from "../../../enums/unsubscribe.js";
5
+ import { DEFAULT_UNSUBSCRIBE_GROUP as c } from "../../../enums/unsubscribe.js";
6
6
  import { Control as h, UIElementType as i, UEAttr as t, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const m = "ui-elements-checkbox", a = "select", { get: C } = L();
7
+ const m = "ui-elements-checkbox", u = "select", { get: C } = L();
8
8
  class S extends h {
9
9
  constructor() {
10
10
  super(...arguments);
@@ -16,15 +16,16 @@ class S extends h {
16
16
  return m;
17
17
  }
18
18
  _setFormValues() {
19
- if (this.currentNode && "getAttribute" in this.currentNode) {
19
+ if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
20
20
  const e = this.currentNode.getAttribute("id");
21
21
  if (e) {
22
- const s = e === u.sendGridId ? e : Number(e);
23
- s && (this.selectedUnsubGroup = s, this.api.updateValues({
24
- [a]: this.selectedUnsubGroup
25
- }));
22
+ const s = e === c.sendGridId ? e : Number(e);
23
+ s && (this.selectedUnsubGroup = s);
26
24
  }
27
25
  }
26
+ this.api.updateValues({
27
+ [u]: this.selectedUnsubGroup
28
+ });
28
29
  }
29
30
  _getLabel(e, s = `${Math.random()}`) {
30
31
  return `
@@ -54,7 +55,7 @@ class S extends h {
54
55
  </${i.LABEL}>
55
56
 
56
57
  <${i.SELECTPICKER}
57
- ${t.SELECTPICKER.name}="${a}"
58
+ ${t.SELECTPICKER.name}="${u}"
58
59
  ${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
59
60
  ${this._getSelect()}
60
61
  </${i.SELECTPICKER}>
@@ -66,21 +67,21 @@ class S extends h {
66
67
  this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
67
68
  }
68
69
  _listenToFormUpdates() {
69
- this.api.onValueChanged(a, (e) => this._onSelectChange(e));
70
+ this.api.onValueChanged(u, (e) => this._onSelectChange(e));
70
71
  }
71
72
  onTemplateNodeUpdated(e) {
72
- this.currentNode = e;
73
+ this.currentNode = e, this._setFormValues();
73
74
  }
74
75
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
75
76
  async onRender() {
76
77
  const e = await C(
77
78
  "/unsubscribe-groups/unsubscribe-list"
78
- ), s = [u, ...e.data], E = s.map((c) => ({
79
- [t.SELECT_ITEM.text]: c.name,
80
- [t.SELECT_ITEM.value]: c.sendGridId
79
+ ), s = [c, ...e.data], E = s.map((a) => ({
80
+ [t.SELECT_ITEM.text]: a.name,
81
+ [t.SELECT_ITEM.value]: a.sendGridId
81
82
  }));
82
83
  this.unsubList = s, this.api.setUIEAttribute(
83
- a,
84
+ u,
84
85
  t.SELECTPICKER.items,
85
86
  E
86
87
  ), this._setFormValues(), this._listenToFormUpdates();
@@ -3,7 +3,7 @@ const e = {
3
3
  TITLE: "Unsubscribe From All Email Lists",
4
4
  DESCRIPTION: "You will still receive important transactional and billing-related emails."
5
5
  }, l = `
6
- <td align="left" class="checkbox-block-v2 esd-block-checkbox es-p20">
6
+ <td align="left" class="checkbox-block checkbox-block-v2 esd-block-checkbox es-p20">
7
7
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
8
8
  <tbody>
9
9
  <tr>
@@ -26,11 +26,16 @@ const e = {
26
26
  </tbody>
27
27
  </table>
28
28
  </td>
29
- `, i = `
30
- <td
31
- align="left"
32
- esd-extension-block-id="checkbox-block"
33
- class="checkbox-block-v2 esd-block-checkbox esd-checkbox-block esd-extension-block es-p20"
29
+ `, o = `
30
+ <td
31
+ align="left"
32
+ esd-extension-block-id="checkbox-block"
33
+ class="
34
+ checkbox-block
35
+ checkbox-block-v2
36
+ esd-block-checkbox
37
+ esd-checkbox-block
38
+ esd-extension-block es-p20"
34
39
  >
35
40
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
36
41
  <tbody>
@@ -55,10 +60,10 @@ const e = {
55
60
  </table>
56
61
  </td>
57
62
  `;
58
- function c() {
63
+ function a() {
59
64
  return l.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`);
60
65
  }
61
66
  export {
62
- i as default,
63
- c as getDefaultTemplate
67
+ o as default,
68
+ a as getDefaultTemplate
64
69
  };
@@ -1,19 +1,20 @@
1
- import { useOnboardingStore as R } from "../../../stores/onboarding.js";
2
- import { Block as L, BlockCompositionType as V, ModificationDescription as a } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
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
3
  import { configAttributes as t } from "./enums/productEnums.js";
4
4
  import { DefaultConfigValues as e, SETTINGS_ENUMS as l } from "./enums/settingsEnums.js";
5
5
  import { useItemsBlockStore as S } from "./store/items-block.js";
6
- import { getDefaultTemplate as y } from "./template.js";
7
- const B = "items-block";
8
- class z extends L {
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 {
9
10
  getId() {
10
- return B;
11
+ return M;
11
12
  }
12
13
  getIcon() {
13
14
  return "items-icon";
14
15
  }
15
16
  getBlockCompositionType() {
16
- return V.CONTAINER;
17
+ return L.CONTAINER;
17
18
  }
18
19
  getName() {
19
20
  return this.api.translate("Items");
@@ -22,7 +23,7 @@ class z extends L {
22
23
  return this.api.translate("Items lets you display personalized products based on user behavior.");
23
24
  }
24
25
  getTemplate() {
25
- return y({
26
+ return V({
26
27
  orientation: l.ORIENTATION.HORIZONTAL,
27
28
  itemsType: l.ITEMS_TYPE.CART_ITEMS,
28
29
  itemId: "{{Abandoned Cart Item (1) Url}}",
@@ -34,33 +35,33 @@ class z extends L {
34
35
  allowInnerBlocksDND() {
35
36
  return !1;
36
37
  }
37
- onCreated(c) {
38
- const r = c.querySelector("esd-config-block");
39
- if (!r)
38
+ onCreated(r) {
39
+ const n = r.querySelector("esd-config-block");
40
+ if (!n)
40
41
  return;
41
- const o = r, n = o.getAttribute("data-initialized") || "0", u = o.getAttribute(t.BLOCK_INSTANCE_ID), s = () => String(Date.now() + Math.floor(Math.random() * 1e3));
42
- if (Number(n)) {
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)) {
43
44
  if (!u) {
44
- const i = s();
45
+ const i = c();
45
46
  this.api.getDocumentModifier().modifyHtml(o).setAttribute(t.BLOCK_INSTANCE_ID, i).apply(new a("Assign block instance ID to legacy block"));
46
47
  }
47
48
  } else {
48
- const i = e.itemsType, d = e.cartItemsSelectControlValue, I = e.cardOrientationControlValue, m = e.productNameTrimmingControlValue, C = e.productPriceHideDiscountControlValue, T = e.productPriceFormattedControlValue, b = e.productPriceCurrencySymbolControlValue, E = e.productPriceCurrencyLocationControlValue, O = e.productButtonLinkControlValue, A = e.productImageLinkControlValue, _ = e.productImageVisible, p = e.productNameVisible, N = e.productQuantityVisible, f = e.productPriceVisible, g = e.productOriginalPriceVisible, D = e.productButtonVisible, P = s();
49
- this.api.getDocumentModifier().modifyHtml(o).setAttribute("data-source", i).setAttribute(t.TYPE, i).setAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE, d).setAttribute(t.ORIENTATION, I).setAttribute(t.PRODUCT_NAME_TRIMMING, m).setAttribute(t.PRODUCT_PRICE_HIDE_DISCOUNT, C).setAttribute(t.PRODUCT_PRICE_FORMATTED, T).setAttribute(t.PRODUCT_PRICE_CURRENCY_SYMBOL, b).setAttribute(t.PRODUCT_PRICE_CURRENCY_LOCATION, E).setAttribute(t.PRODUCT_BUTTON_LINK, O).setAttribute(t.PRODUCT_IMAGE_LINK, A).setAttribute(t.BLOCK_INSTANCE_ID, P).setAttribute("data-initialized", "1").setAttribute(t.NAME_CONTROL_ENABLED, e.productNameControlEnabled).setAttribute(
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(
50
51
  t.QUANTITY_CONTROL_ENABLED,
51
52
  e.productQuantityControlEnabled
52
- ).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")), R().startOnboarding("itemsOnboarding");
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");
53
54
  }
54
55
  }
55
- onSelect(c) {
56
- const r = c.querySelector("esd-config-block"), o = S();
57
- if (!r)
56
+ onSelect(r) {
57
+ const n = r.querySelector("esd-config-block"), o = S();
58
+ if (!n)
58
59
  return;
59
- const n = r, u = n.getAttribute(t.TYPE) || e.itemsType, s = n.getAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE) || e.cartItemsSelectControlValue, i = n.getAttribute(t.ORIENTATION) || e.cardOrientationControlValue;
60
- o.setItemsType(u), o.setItemIds(s), o.setOrientation(i);
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
- z as ItemsBlock
65
+ M as BLOCK_ID,
66
+ x as ItemsBlock
66
67
  };
@@ -44,11 +44,11 @@ class R extends c {
44
44
  }
45
45
  _applyTrimmingStyles(e) {
46
46
  var m;
47
- const o = (m = this.currentNode) == null ? void 0 : m.querySelector("p");
47
+ const o = (m = this.currentNode) == null ? void 0 : m.querySelector("p > a");
48
48
  if (!o)
49
49
  return;
50
50
  const p = e !== void 0 ? e : this.store.nameTrimming, T = this.store.orientation === I.ORIENTATION.VERTICAL;
51
- p ? this.api.getDocumentModifier().modifyHtml(o).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", T ? "130px" : "100%").apply(new n("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(o).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").apply(new n("Text Trimming Disabled"));
51
+ p ? this.api.getDocumentModifier().modifyHtml(o).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", T ? "130px" : "550px").apply(new n("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(o).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").apply(new n("Text Trimming Disabled"));
52
52
  }
53
53
  _getTextTrimming() {
54
54
  return `