@useinsider/guido 3.13.1-beta.a1e3c5f → 3.13.1-beta.de07673

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,5 +1,5 @@
1
- import { ModuleFolderDefaults as f } from "../../enums/defaults.js";
2
- import { object as a, number as n, optional as e, string as t, picklist as r, pipe as p, minLength as b, custom as h, boolean as o, array as c, record as k, fallback as C, literal as i, looseObject as g, variant as R, union as y, unknown as s, lazy as T } from "../../node_modules/valibot/dist/index.js";
1
+ import { ModuleFolderDefaults as y } from "../../enums/defaults.js";
2
+ import { object as a, number as n, optional as e, string as t, picklist as r, pipe as p, minLength as b, custom as h, boolean as o, array as c, record as k, fallback as C, literal as i, looseObject as g, variant as R, union as f, unknown as s, lazy as T } from "../../node_modules/valibot/dist/index.js";
3
3
  const d = {
4
4
  /** Promotional/marketing emails */
5
5
  PROMOTIONAL: 1,
@@ -12,7 +12,7 @@ const d = {
12
12
  ARCHITECT: 49,
13
13
  /** Unsubscribe page builder */
14
14
  UNSUBSCRIBE_PAGES: 97
15
- }, I = a({
15
+ }, A = a({
16
16
  /** Unique identifier for the template being edited */
17
17
  templateId: p(
18
18
  t(),
@@ -25,7 +25,7 @@ const d = {
25
25
  ),
26
26
  /** Optional variation ID for A/B testing */
27
27
  variationId: e(t())
28
- }), A = a({
28
+ }), I = a({
29
29
  /** Fallback font name (e.g., "Georgia") */
30
30
  name: t(),
31
31
  /** Fallback font family (e.g., "serif" or "sans-serif") */
@@ -53,7 +53,7 @@ const d = {
53
53
  /** Display name for the current user */
54
54
  username: e(t(), "Guido User"),
55
55
  /** Fallback font settings from partner settings — used to match backend size calculation */
56
- fallbackFont: e(A)
56
+ fallbackFont: e(I)
57
57
  }), v = a({
58
58
  /** Display text for the dynamic content */
59
59
  text: t(),
@@ -83,7 +83,7 @@ const d = {
83
83
  /** Block ID (matches the dictionary key and the legacy HTML element id) */
84
84
  id: e(n()),
85
85
  /** Decimal places for price display (legacy data may use string or number) */
86
- decimalCount: e(y([t(), n()])),
86
+ decimalCount: e(f([t(), n()])),
87
87
  /** Pinned product IDs (empty array when filter-driven) */
88
88
  productIds: e(c(s())),
89
89
  /** Whether the block requested live products at send time */
@@ -117,7 +117,7 @@ const d = {
117
117
  /** Block type marker used by some legacy variants */
118
118
  blockType: e(t()),
119
119
  /** Size variant marker (legacy data may use string or number) */
120
- size: e(y([t(), n()])),
120
+ size: e(f([t(), n()])),
121
121
  /** Vertical responsiveness flag (legacy size=1 variants) */
122
122
  verticalResponsiveness: e(o()),
123
123
  /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
@@ -175,9 +175,9 @@ const d = {
175
175
  /** Email header settings */
176
176
  emailHeader: e(N, { senderName: "", subject: "" }),
177
177
  /** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
178
- savedModulesFolderName: e(t(), f.SAVED_MODULES),
178
+ savedModulesFolderName: e(t(), y.SAVED_MODULES),
179
179
  /** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
180
- defaultModulesFolderName: e(t(), f.DEFAULT_MODULES)
180
+ defaultModulesFolderName: e(t(), y.DEFAULT_MODULES)
181
181
  }), x = a({
182
182
  /** Whether to show the header bar */
183
183
  showHeader: e(o(), !0),
@@ -203,9 +203,7 @@ const d = {
203
203
  /** Enable autosave (3-min interval + tab-hide). User toggles on/off from the header. */
204
204
  autosave: e(o(), !1),
205
205
  /** Enable pre-save domain-allowlist validation (opt-in; Guido self-serves the block toaster) */
206
- allowlistEnabled: e(o(), !1),
207
- /** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
208
- linkTrackingIds: e(o(), !1)
206
+ allowlistEnabled: e(o(), !1)
209
207
  }), U = r([
210
208
  "amp-accordion",
211
209
  "amp-carousel",
@@ -301,7 +299,7 @@ const d = {
301
299
  }), K = a({
302
300
  // Required sections
303
301
  /** Identity configuration (required) */
304
- identity: I,
302
+ identity: A,
305
303
  /** Partner configuration (required) */
306
304
  partner: L,
307
305
  // Optional sections (with defaults)
@@ -333,10 +331,10 @@ export {
333
331
  v as DynamicContentSchema,
334
332
  O as EditorSchema,
335
333
  N as EmailHeaderSchema,
336
- A as FallbackFontSchema,
334
+ I as FallbackFontSchema,
337
335
  F as FeaturesSchema,
338
336
  K as GuidoConfigSchema,
339
- I as IdentitySchema,
337
+ A as IdentitySchema,
340
338
  P as LegacyRecommendationConfigSchema,
341
339
  d as MessageType,
342
340
  L as PartnerSchema,
@@ -12,7 +12,7 @@ var t = function() {
12
12
  n,
13
13
  !1,
14
14
  null,
15
- "81958b3d"
15
+ "5079a1c8"
16
16
  );
17
17
  const l = s.exports;
18
18
  export {
@@ -1,50 +1,49 @@
1
- import { defineComponent as K, defineAsyncComponent as M, ref as O, computed as U, watch as _, onMounted as V, onUnmounted as j } from "vue";
2
- import { useCortexBlueprintBridge as J } from "../composables/useCortexBlueprintBridge.js";
3
- import { provideGuidoActions as Q } from "../composables/useGuidoActions.js";
4
- import { useGuidoStateBridge as X } from "../composables/useGuidoStateBridge.js";
5
- import { usePartner as Y } from "../composables/usePartner.js";
6
- import { useStripo as Z } from "../composables/useStripo.js";
7
- import { useTimerClone as ee } from "../composables/useTimerClone.js";
8
- import { migrate as B } from "../config/migrator/index.js";
1
+ import { defineComponent as q, defineAsyncComponent as M, ref as U, computed as _, watch as B, onMounted as K, onUnmounted as V } from "vue";
2
+ import { useCortexBlueprintBridge as j } from "../composables/useCortexBlueprintBridge.js";
3
+ import { provideGuidoActions as J } from "../composables/useGuidoActions.js";
4
+ import { useGuidoStateBridge as Q } from "../composables/useGuidoStateBridge.js";
5
+ import { usePartner as X } from "../composables/usePartner.js";
6
+ import { useStripo as Y } from "../composables/useStripo.js";
7
+ import { useTimerClone as Z } from "../composables/useTimerClone.js";
8
+ import { migrate as I } from "../config/migrator/index.js";
9
9
  import { ModuleFolderDefaults as N } from "../enums/defaults.js";
10
- import { RIBBON_SELECTOR as te } from "../enums/onboarding.js";
11
- import { useRecommendationExtensionStore as oe } from "../extensions/Blocks/Recommendation/store/recommendation.js";
12
- import ne from "./organisms/AutoSaveController.vue.js";
13
- import re from "./organisms/base/Toaster.vue.js";
14
- import se from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
- import ie from "./organisms/header/HeaderWrapper.vue.js";
16
- import ae from "./organisms/LoadingWrapper.vue.js";
17
- import ce from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
- import de from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
- import { useStripoApi as me } from "../services/stripoApi.js";
20
- import { useConfigStore as le } from "../stores/config.js";
21
- import { useDynamicContentStore as ue } from "../stores/dynamic-content.js";
22
- import { useEditorStore as P } from "../stores/editor.js";
23
- import { usePreviewStore as pe } from "../stores/preview.js";
24
- import { useTemplateStore as fe } from "../stores/template.js";
25
- import { useUnsubscribeStore as ye } from "../stores/unsubscribe.js";
26
- import { readTrackSeq as ve } from "../utils/linkTrackingIds.js";
27
- const $e = /* @__PURE__ */ K({
10
+ import { RIBBON_SELECTOR as ee } from "../enums/onboarding.js";
11
+ import { useRecommendationExtensionStore as te } from "../extensions/Blocks/Recommendation/store/recommendation.js";
12
+ import oe from "./organisms/AutoSaveController.vue.js";
13
+ import ne from "./organisms/base/Toaster.vue.js";
14
+ import re from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
+ import se from "./organisms/header/HeaderWrapper.vue.js";
16
+ import ie from "./organisms/LoadingWrapper.vue.js";
17
+ import ae from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
+ import ce from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
+ import { useStripoApi as de } from "../services/stripoApi.js";
20
+ import { useConfigStore as me } from "../stores/config.js";
21
+ import { useDynamicContentStore as le } from "../stores/dynamic-content.js";
22
+ import { useEditorStore as O } from "../stores/editor.js";
23
+ import { usePreviewStore as ue } from "../stores/preview.js";
24
+ import { useTemplateStore as pe } from "../stores/template.js";
25
+ import { useUnsubscribeStore as fe } from "../stores/unsubscribe.js";
26
+ const xe = /* @__PURE__ */ q({
28
27
  __name: "Guido",
29
28
  props: {
30
29
  config: null,
31
30
  ready: { type: Boolean, default: !0 }
32
31
  },
33
32
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
34
- setup(A, { expose: W, emit: r }) {
35
- const i = A, x = M(
33
+ setup(P, { expose: A, emit: n }) {
34
+ const i = P, W = M(
36
35
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
37
- ), G = M(
36
+ ), x = M(
38
37
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
39
- ), g = O(), l = O(), u = ue(), S = ye(), o = le();
38
+ ), g = U(), l = U(), u = le(), S = fe(), o = me();
40
39
  i.ready && o.init(i.config);
41
- const c = P(), H = pe(), m = U(() => c.hasChanges), { isTestPartner: $ } = Y(), h = () => {
40
+ const d = O(), G = ue(), m = _(() => d.hasChanges), { isTestPartner: H } = X(), h = () => {
42
41
  var t;
43
42
  return (t = g.value) == null ? void 0 : t.handleSave(!0);
44
43
  }, b = (t) => {
45
- c.loadingStatus = t;
44
+ d.loadingStatus = t;
46
45
  };
47
- J(), X();
46
+ j(), Q();
48
47
  const p = () => {
49
48
  var t, e;
50
49
  return {
@@ -55,78 +54,78 @@ const $e = /* @__PURE__ */ K({
55
54
  savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || N.SAVED_MODULES,
56
55
  defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || N.DEFAULT_MODULES
57
56
  };
58
- }, { initPlugin: E, preloadRuntime: w } = Z(), { getDefaultTemplate: C } = me(), { cloneTimersOnSave: D, hasTimerBlocks: k } = ee(), z = U(() => {
57
+ }, { initPlugin: E, preloadRuntime: w } = Y(), { getDefaultTemplate: C } = de(), { cloneTimersOnSave: D, hasTimerBlocks: T } = Z(), $ = _(() => {
59
58
  var t;
60
59
  return !((t = o.ui) != null && t.showHeader);
61
60
  });
62
- Q({
61
+ J({
63
62
  onBack: () => {
64
- console.debug("guido:back"), r("back");
63
+ console.debug("guido:back"), n("back");
65
64
  },
66
65
  onSaveStart: () => {
67
- console.debug("guido:save:start"), r("save:start");
66
+ console.debug("guido:save:start"), n("save:start");
68
67
  },
69
68
  onSaveComplete: (t) => {
70
69
  const e = { ...t, metadata: p() };
71
- console.debug("guido:save:complete", e), r("save:complete", e);
70
+ console.debug("guido:save:complete", e), n("save:complete", e);
72
71
  },
73
72
  onTestEmailClick: () => {
74
- console.debug("guido:test-email:click"), r("test-email:click");
73
+ console.debug("guido:test-email:click"), n("test-email:click");
75
74
  }
76
75
  });
77
- const T = (t) => {
76
+ const L = (t) => {
78
77
  console.debug("dynamic-content:close", t), u.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
79
- }, F = () => {
78
+ }, R = () => {
80
79
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
81
80
  };
82
- _(() => m.value, () => {
83
- r("on-change", m.value);
81
+ B(() => m.value, () => {
82
+ n("on-change", m.value);
84
83
  });
85
84
  const f = (t) => {
86
- const e = t, { attribute: s, position: d } = e.detail;
87
- console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", s, d);
85
+ const e = t, { attribute: s, position: c } = e.detail;
86
+ console.debug("dynamic-content:open", e.detail), n("dynamic-content:open", s, c);
88
87
  };
89
88
  let a = null;
90
89
  const y = () => {
91
90
  var e;
92
- const t = document.querySelector(te);
91
+ const t = document.querySelector(ee);
93
92
  (e = l.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
94
93
  }, v = async () => {
95
94
  var t;
96
95
  try {
97
- o.initialized || o.init(i.config), c.templateId = o.templateId;
98
- const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", I = (e == null ? void 0 : e.preselectedDynamicContent) || [];
96
+ o.initialized || o.init(i.config), d.templateId = o.templateId;
97
+ const e = o.template, s = (e == null ? void 0 : e.html) || "", c = (e == null ? void 0 : e.css) || "", k = (e == null ? void 0 : e.preselectedDynamicContent) || [];
99
98
  S.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
100
- const L = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, R = { linkTrackingIds: o.isFeatureEnabled("linkTrackingIds") };
101
- let n = {
102
- html: s && await B(s, L, R),
103
- css: d
99
+ const F = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {};
100
+ let r = {
101
+ html: s && await I(s, F),
102
+ css: c
104
103
  };
105
- n.html || (n = await C(), n.html = await B(n.html, L, R)), k(n.html) && (n.html = await D(n.html)), c.trackIdSessionFloor = ve(n.html);
106
- const q = {
107
- preselectedDynamicContentList: I,
104
+ r.html || (r = await C(), r.html = await I(r.html, F)), T(r.html) && (r.html = await D(r.html));
105
+ const z = {
106
+ preselectedDynamicContentList: k,
108
107
  onReady: () => {
109
- console.debug("guido:ready"), r("ready");
108
+ console.debug("guido:ready"), n("ready");
110
109
  }
111
110
  };
112
- await E(n, p(), q), u.selectedDynamicContentList = I;
111
+ await E(r, p(), z), u.selectedDynamicContentList = k;
113
112
  } catch (e) {
114
113
  console.error("Failed to initialize Stripo editor:", e);
115
114
  }
116
115
  };
117
- return V(async () => {
116
+ return K(async () => {
118
117
  var e;
119
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), oe().$reset(), P().$reset(), fe().$reset(), y();
118
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), te().$reset(), O().$reset(), pe().$reset(), y();
120
119
  const t = (e = l.value) == null ? void 0 : e.parentElement;
121
120
  if (t && (a = new ResizeObserver(y), a.observe(t)), w(), i.ready)
122
121
  await v();
123
122
  else {
124
- const s = _(() => i.ready, (d) => {
125
- d && (s(), v());
123
+ const s = B(() => i.ready, (c) => {
124
+ c && (s(), v());
126
125
  });
127
126
  }
128
127
  document.addEventListener("dynamic-content:open", f);
129
- }), j(() => {
128
+ }), V(() => {
130
129
  a == null || a.disconnect(), document.removeEventListener("dynamic-content:open", f);
131
130
  try {
132
131
  window.UIEditor.removeEditor();
@@ -134,17 +133,17 @@ const $e = /* @__PURE__ */ K({
134
133
  console.debug("Failed to remove Stripo editor: No editor found");
135
134
  }
136
135
  o.reset();
137
- }), W({
136
+ }), A({
138
137
  dynamicContent: {
139
- insert: T,
140
- close: F
138
+ insert: L,
139
+ close: R
141
140
  },
142
141
  hasChanges: m,
143
142
  saveSilent: h,
144
143
  setLoading: b
145
- }), { __sfc: !0, PreviewContainer: x, OnboardingWrapper: G, headerWrapperRef: g, wrapperRef: l, dynamicContentStore: u, unsubscribeStore: S, props: i, configStore: o, editorStore: c, previewStore: H, hasChanges: m, isTestPartner: $, saveSilent: h, setLoading: b, emit: r, buildMetadata: p, initPlugin: E, preloadRuntime: w, getDefaultTemplate: C, cloneTimersOnSave: D, hasTimerBlocks: k, noHeader: z, insertDynamicContent: T, closeDynamicContent: F, handleDynamicContentOpen: f, ribbonObserver: a, updateRibbonOffset: y, startEditor: v, AutoSaveController: ne, Toaster: re, FilterSelectionDrawer: se, HeaderWrapper: ie, LoadingWrapper: ae, SaveAsTemplateDrawer: ce, UnsubscribeWrapper: de };
144
+ }), { __sfc: !0, PreviewContainer: W, OnboardingWrapper: x, headerWrapperRef: g, wrapperRef: l, dynamicContentStore: u, unsubscribeStore: S, props: i, configStore: o, editorStore: d, previewStore: G, hasChanges: m, isTestPartner: H, saveSilent: h, setLoading: b, emit: n, buildMetadata: p, initPlugin: E, preloadRuntime: w, getDefaultTemplate: C, cloneTimersOnSave: D, hasTimerBlocks: T, noHeader: $, insertDynamicContent: L, closeDynamicContent: R, handleDynamicContentOpen: f, ribbonObserver: a, updateRibbonOffset: y, startEditor: v, AutoSaveController: oe, Toaster: ne, FilterSelectionDrawer: re, HeaderWrapper: se, LoadingWrapper: ie, SaveAsTemplateDrawer: ae, UnsubscribeWrapper: ce };
146
145
  }
147
146
  });
148
147
  export {
149
- $e as default
148
+ xe as default
150
149
  };
@@ -1,14 +1,14 @@
1
- import { migrateCheckbox as i } from "./checkboxMigrator.js";
2
- import { migrateCouponBlock as a } from "./couponBlockMigrator.js";
1
+ import { migrateCheckbox as t } from "./checkboxMigrator.js";
2
+ import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
3
3
  import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
4
+ import { migrateProductNameLink as a } from "./productNameLinkMigrator.js";
4
5
  import { migrateRadioButton as c } from "./radioButtonMigrator.js";
5
6
  import { migrateRecommendation as g } from "./recommendationMigrator.js";
6
7
  import { migrateSocialIcons as n } from "./socialIconMigrator.js";
7
- import { migrateTrackIds as p } from "./trackIdMigrator.js";
8
- import { migrateUnsubscribe as f } from "./unsubscribeMigrator.js";
9
- const x = async (m, o = {}, t = {}) => {
10
- let r = m;
11
- return r = i(r), r = c(r), r = await f(r), r = a(r), r = g(r, o), r = e(r), r = n(r), t.linkTrackingIds && (r = p(r)), r;
8
+ import { migrateUnsubscribe as p } from "./unsubscribeMigrator.js";
9
+ const x = async (r, o = {}) => {
10
+ let m = r;
11
+ return m = t(m), m = c(m), m = await p(m), m = i(m), m = g(m, o), m = e(m), m = a(m), m = n(m), m;
12
12
  };
13
13
  export {
14
14
  x as migrate
@@ -0,0 +1,27 @@
1
+ var n = Object.defineProperty;
2
+ var a = (e, r, t) => r in e ? n(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var o = (e, r, t) => a(e, typeof r != "symbol" ? r + "" : r, t);
4
+ import { unwrapProductNameLinks as i } from "../../utils/unwrapProductNameLink.js";
5
+ const c = /<a[^>]*product-attr="name"/i;
6
+ class s {
7
+ constructor() {
8
+ o(this, "parser");
9
+ this.parser = new DOMParser();
10
+ }
11
+ migrate(r) {
12
+ try {
13
+ if (!r.includes("items-block-v2") || !c.test(r))
14
+ return r;
15
+ const t = this.parser.parseFromString(r, "text/html");
16
+ return i(t), t.documentElement.outerHTML;
17
+ } catch (t) {
18
+ return console.error("ProductNameLinkMigrator failed:", t), r;
19
+ }
20
+ }
21
+ }
22
+ function d(e) {
23
+ return new s().migrate(e);
24
+ }
25
+ export {
26
+ d as migrateProductNameLink
27
+ };
@@ -1,30 +1,31 @@
1
- import { ModificationDescription as d, UIElementType as a, UEAttr as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as T } from "../../../common-control.js";
3
- import { ItemsBlockControlId as l } from "../../enums/controlEnums.js";
4
- import { getItemsBlockConfig as o, setItemsBlockConfig as c } from "../../utils/nodeConfigUtils.js";
5
- const g = l.NAME_TRIMMING, i = {
1
+ import { ModificationDescription as l, UIElementType as s, UEAttr as d } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as p } from "../../../common-control.js";
3
+ import { ItemsBlockControlId as a } from "../../enums/controlEnums.js";
4
+ import { findNameTextNode as T } from "../../utils/nameNode.js";
5
+ import { getItemsBlockConfig as r, setItemsBlockConfig as c } from "../../utils/nodeConfigUtils.js";
6
+ const g = a.NAME_TRIMMING, i = {
6
7
  TRIMMING: "trimming"
7
8
  };
8
- class y extends T {
9
+ class y extends p {
9
10
  getId() {
10
11
  return g;
11
12
  }
12
13
  getTemplate() {
13
14
  return `
14
- <div class="container ${l.NAME_TRIMMING}">
15
+ <div class="container ${a.NAME_TRIMMING}">
15
16
  ${this._getTextTrimming()}
16
17
  </div>
17
18
  `;
18
19
  }
19
20
  onRender() {
20
- const e = o(this.currentNode);
21
+ const e = r(this.currentNode);
21
22
  this.api.updateValues({ [i.TRIMMING]: (e == null ? void 0 : e.nameTrimming) ?? !0 }), this.api.onValueChanged(i.TRIMMING, (t) => {
22
23
  this._onTrimmingChange(t);
23
24
  });
24
25
  }
25
26
  onTemplateNodeUpdated(e) {
26
27
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
27
- const t = o(this.currentNode);
28
+ const t = r(this.currentNode);
28
29
  this.api.updateValues({ [i.TRIMMING]: (t == null ? void 0 : t.nameTrimming) ?? !0 });
29
30
  });
30
31
  }
@@ -32,20 +33,19 @@ class y extends T {
32
33
  c(this.currentNode, this.api, { nameTrimming: e }), this.api.updateValues({ [i.TRIMMING]: e }), this._applyTrimmingStyles(e);
33
34
  }
34
35
  _applyTrimmingStyles(e) {
35
- var m;
36
- const t = (m = this.currentNode) == null ? void 0 : m.querySelector("p > a");
36
+ const t = T(this.currentNode);
37
37
  if (!t)
38
38
  return;
39
- const n = o(this.currentNode), s = e !== void 0 ? e : (n == null ? void 0 : n.nameTrimming) ?? !0, r = this.api.getDocumentModifier().modifyHtml(t);
40
- s ? r.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : r.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), r.setStyle("max-width", "100%").apply(new d(`Text Trimming ${s ? "Enabled" : "Disabled"}`));
39
+ const n = r(this.currentNode), m = e !== void 0 ? e : (n == null ? void 0 : n.nameTrimming) ?? !0, o = this.api.getDocumentModifier().modifyHtml(t);
40
+ m ? o.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : o.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), o.setStyle("max-width", "100%").apply(new l(`Text Trimming ${m ? "Enabled" : "Disabled"}`));
41
41
  }
42
42
  _getTextTrimming() {
43
43
  return `
44
44
  <div class="display-flex align-items-center justify-content-between">
45
- <${a.LABEL}
46
- ${p.LABEL.text}="${this.api.translate("Text Trimming")}"
45
+ <${s.LABEL}
46
+ ${d.LABEL.text}="${this.api.translate("Text Trimming")}"
47
47
  >
48
- </${a.LABEL}>
48
+ </${s.LABEL}>
49
49
  ${this._GuToggle(i.TRIMMING)}
50
50
  </div>
51
51
  `;
@@ -1,20 +1,21 @@
1
- import { ModificationDescription as y, UEAttr as L } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { ModificationDescription as S, UEAttr as L } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { CommonControl as k } from "../../common-control.js";
3
3
  import { ItemsBlockId as I } from "../enums/controlEnums.js";
4
- import { productPairs as N, templateFirstLine as D } from "../enums/productEnums.js";
4
+ import { productPairs as y, templateFirstLine as D } from "../enums/productEnums.js";
5
5
  import { SETTINGS_ENUMS as d, ItemTypeOptions as x, OrientationOptions as F, ItemInCartOptions as O, DefaultConfigValues as H } from "../enums/settingsEnums.js";
6
6
  import $ from "../layouts/horizontal.html.js";
7
- import q from "../layouts/vertical.html.js";
8
- import { getDefaultTemplate as w, wrapInTableRow as C } from "../template.js";
9
- import { getItemsBlockConfig as _, setItemsBlockConfig as M, escapeReplacement as g, deriveItemNumber as V } from "../utils/nodeConfigUtils.js";
10
- const B = "ui-elements-items-block", m = {
7
+ import w from "../layouts/vertical.html.js";
8
+ import { getDefaultTemplate as q, wrapInTableRow as C } from "../template.js";
9
+ import { findNameTextNode as V } from "../utils/nameNode.js";
10
+ import { getItemsBlockConfig as _, setItemsBlockConfig as M, escapeReplacement as g, deriveItemNumber as B } from "../utils/nodeConfigUtils.js";
11
+ const G = "ui-elements-items-block", m = {
11
12
  ITEMS_TYPE: "itemsType",
12
13
  ORIENTATION: "orientation",
13
14
  ITEM_IDS: "itemIds"
14
15
  };
15
- class Z extends k {
16
+ class te extends k {
16
17
  getId() {
17
- return B;
18
+ return G;
18
19
  }
19
20
  getTemplate() {
20
21
  return `
@@ -86,7 +87,7 @@ class Z extends k {
86
87
  M(this.currentNode, this.api, {
87
88
  orientation: e,
88
89
  priceOrientation: "horizontal"
89
- }, r), r.apply(new y("Changed orientation")), this._reOrderTemplate(), setTimeout(() => {
90
+ }, r), r.apply(new S("Changed orientation")), this._reOrderTemplate(), setTimeout(() => {
90
91
  this._recalculateTrimming();
91
92
  }, 50);
92
93
  }
@@ -103,7 +104,7 @@ class Z extends k {
103
104
  buttonLink: n
104
105
  }, o), this._updateDataTypeAttributes(r, o), this._initializeSelectItems();
105
106
  const c = this._getTemplateData(r, i.value);
106
- this._updateImageSrc(c.imageSrc, o), this._updateName(c.name, o), this._updatePrice(c.price, o), this._updateOriginalPrice(c.originalPrice, o), this._updateQuantity(c.quantity, r, o), o.apply(new y("Updated items type"));
107
+ this._updateImageSrc(c.imageSrc, o), this._updateName(c.name, o), this._updatePrice(c.price, o), this._updateOriginalPrice(c.originalPrice, o), this._updateQuantity(c.quantity, r, o), o.apply(new S("Updated items type"));
107
108
  }
108
109
  _onItemIdsChange(e) {
109
110
  this.api.updateValues({ [m.ITEM_IDS]: e });
@@ -114,7 +115,7 @@ class Z extends k {
114
115
  buttonLink: r
115
116
  }, i), this._updateDataNumberAttributes(e, i);
116
117
  const n = this._getTemplateData(void 0, e);
117
- this._updateImageSrc(n.imageSrc, i), this._updateName(n.name, i), this._updatePrice(n.price, i), this._updateOriginalPrice(n.originalPrice, i), this._updateQuantity(n.quantity, void 0, i), i.apply(new y("Updated item selection"));
118
+ this._updateImageSrc(n.imageSrc, i), this._updateName(n.name, i), this._updatePrice(n.price, i), this._updateOriginalPrice(n.originalPrice, i), this._updateQuantity(n.quantity, void 0, i), i.apply(new S("Updated item selection"));
118
119
  }
119
120
  _initializeSelectItems() {
120
121
  this.api.setUIEAttribute(
@@ -149,25 +150,25 @@ class Z extends k {
149
150
  }
150
151
  _renderTemplate() {
151
152
  const e = _(this.currentNode), r = (e == null ? void 0 : e.orientation) ?? d.ORIENTATION.VERTICAL, t = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, i = (e == null ? void 0 : e.itemsSelectValue) ?? "", n = (e == null ? void 0 : e.priceCurrencySymbol) ?? "", s = (e == null ? void 0 : e.priceCurrencyLocation) ?? "0", o = (e == null ? void 0 : e.priceFormatted) ?? !1;
152
- this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(w({
153
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(q({
153
154
  orientation: r,
154
155
  itemsType: t,
155
156
  itemId: i,
156
157
  currencySymbol: n,
157
158
  currencyLocation: s,
158
159
  formattedPrice: o
159
- })).apply(new y("Updated template"));
160
+ })).apply(new S("Updated template"));
160
161
  }
161
162
  _getTemplateData(e, r) {
162
- const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = r ?? (t == null ? void 0 : t.itemsSelectValue) ?? "", s = (t == null ? void 0 : t.priceFormatted) ?? !1, o = (t == null ? void 0 : t.priceSinglePrice) ?? !1, c = O[i].findIndex((h) => h.value === n), a = c > -1 ? c : 0, l = N.PAIRS_FOR_EXTENSION.price[i], T = N.PAIRS_FOR_EXTENSION.originalPrice[i];
163
+ const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = r ?? (t == null ? void 0 : t.itemsSelectValue) ?? "", s = (t == null ? void 0 : t.priceFormatted) ?? !1, o = (t == null ? void 0 : t.priceSinglePrice) ?? !1, c = O[i].findIndex((h) => h.value === n), a = c > -1 ? c : 0, l = y.PAIRS_FOR_EXTENSION.price[i], T = y.PAIRS_FOR_EXTENSION.originalPrice[i];
163
164
  let u, p;
164
165
  return o ? (u = s ? l.DEFAULT_SINGLE_PRICE_FORMATTED : l.DEFAULT_SINGLE_PRICE, p = s ? T.DEFAULT_SINGLE_PRICE_FORMATTED : T.DEFAULT_SINGLE_PRICE) : (u = s ? l.DEFAULT_PRICE_FORMATTED : l.DEFAULT_PRICE, p = s ? T.DEFAULT_PRICE_FORMATTED : T.DEFAULT_PRICE), {
165
- imageSrc: N.PAIRS_FOR_EXTENSION.imageSrc[i].DEFAULT[a],
166
- name: N.PAIRS_FOR_EXTENSION.name[i].DEFAULT[a],
166
+ imageSrc: y.PAIRS_FOR_EXTENSION.imageSrc[i].DEFAULT[a],
167
+ name: y.PAIRS_FOR_EXTENSION.name[i].DEFAULT[a],
167
168
  price: u,
168
169
  originalPrice: p,
169
- quantity: N.PAIRS_FOR_EXTENSION.quantity[i].DEFAULT,
170
- button: N.PAIRS_FOR_EXTENSION.button[i].DEFAULT_LABEL
170
+ quantity: y.PAIRS_FOR_EXTENSION.quantity[i].DEFAULT,
171
+ button: y.PAIRS_FOR_EXTENSION.button[i].DEFAULT_LABEL
171
172
  };
172
173
  }
173
174
  _updateImageSrc(e, r) {
@@ -193,8 +194,8 @@ class Z extends k {
193
194
  const a = this._getParagraphFromBlock(c);
194
195
  if (!a)
195
196
  return;
196
- const l = a.getInnerHTML().trim() || "", T = a.getInnerText().trim() || "", u = (n == null ? void 0 : n.trim()) || "", p = this._removeCurrencySymbol(T, u), h = this._replacePriceNumber(p, e), E = this._buildPriceContent(h, u, s), S = l.replace(T, g(E));
197
- r.modifyHtml(a).setInnerHtml(S);
197
+ const l = a.getInnerHTML().trim() || "", T = a.getInnerText().trim() || "", u = (n == null ? void 0 : n.trim()) || "", p = this._removeCurrencySymbol(T, u), h = this._replacePriceNumber(p, e), E = this._buildPriceContent(h, u, s), N = l.replace(T, g(E));
198
+ r.modifyHtml(a).setInnerHtml(N);
198
199
  });
199
200
  }
200
201
  _updateOriginalPrice(e, r) {
@@ -209,7 +210,7 @@ class Z extends k {
209
210
  const l = a.querySelector("s");
210
211
  if (!l)
211
212
  return;
212
- const T = l.getInnerHTML().trim() || "", u = l.getInnerText().trim() || "", p = (n == null ? void 0 : n.trim()) || "", h = this._removeCurrencySymbol(u, p), E = this._replacePriceNumber(h, e), S = this._buildPriceContent(E, p, s), R = `<s>${T.replace(u, g(S))}</s>`;
213
+ const T = l.getInnerHTML().trim() || "", u = l.getInnerText().trim() || "", p = (n == null ? void 0 : n.trim()) || "", h = this._removeCurrencySymbol(u, p), E = this._replacePriceNumber(h, e), N = this._buildPriceContent(E, p, s), R = `<s>${T.replace(u, g(N))}</s>`;
213
214
  r.modifyHtml(a).setInnerHtml(R);
214
215
  });
215
216
  }
@@ -223,17 +224,17 @@ class Z extends k {
223
224
  return;
224
225
  const T = l.getInnerText().trim();
225
226
  let u = l.getInnerHTML().trim();
226
- function p(E, S, A) {
227
+ function p(E, N, A) {
227
228
  return E.replace(
228
- new RegExp(`(>\\s*)?${S}(\\s*<)?`, "g"),
229
+ new RegExp(`(>\\s*)?${N}(\\s*<)?`, "g"),
229
230
  `$1${A}$2`
230
231
  );
231
232
  }
232
233
  u = p(u, T, e), t.modifyHtml(l).setInnerHtml(u), t.modifyHtml(a).setStyle("display", c ? "table-cell" : "none");
233
234
  }
234
235
  _reOrderTemplate(e) {
235
- var h, E, S, A, R, b;
236
- const r = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.IMAGE}"]`), t = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${I.NAME}"]`), i = ((S = this.currentNode) == null ? void 0 : S.querySelectorAll(
236
+ var h, E, N, A, R, b;
237
+ const r = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.IMAGE}"]`), t = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${I.NAME}"]`), i = ((N = this.currentNode) == null ? void 0 : N.querySelectorAll(
237
238
  `[esd-extension-block-id="${I.PRICE}"]`
238
239
  )) || [], n = ((A = this.currentNode) == null ? void 0 : A.querySelectorAll(
239
240
  `[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
@@ -241,12 +242,12 @@ class Z extends k {
241
242
  if (!r || !t || !s || !o || !c || !a)
242
243
  return;
243
244
  const l = _(this.currentNode), u = ((l == null ? void 0 : l.orientation) ?? d.ORIENTATION.VERTICAL) === d.ORIENTATION.VERTICAL;
244
- let p = u ? q : $;
245
+ let p = u ? w : $;
245
246
  setTimeout(() => {
246
- const U = g(s.getOuterHTML()), f = g(o.getOuterHTML());
247
- p = p.replace("{-{-TEMPLATE_FIRST_LINE-}-}", u ? D : "").replace("{-{-PRODUCT_IMAGE-}-}", C(r.getOuterHTML())).replace("{-{-PRODUCT_NAME-}-}", C(t.getOuterHTML())).replaceAll("{-{-PRODUCT_PRICE-}-}", C(U)).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", C(f)).replace("{-{-PRODUCT_QUANTITY-}-}", C(c.getOuterHTML())).replace("{-{-PRODUCT_BUTTON-}-}", C(a.getOuterHTML())), p = p.trim().replace(D, "").slice(0, -5);
247
+ const f = g(s.getOuterHTML()), U = g(o.getOuterHTML());
248
+ p = p.replace("{-{-TEMPLATE_FIRST_LINE-}-}", u ? D : "").replace("{-{-PRODUCT_IMAGE-}-}", C(r.getOuterHTML())).replace("{-{-PRODUCT_NAME-}-}", C(t.getOuterHTML())).replaceAll("{-{-PRODUCT_PRICE-}-}", C(f)).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", C(U)).replace("{-{-PRODUCT_QUANTITY-}-}", C(c.getOuterHTML())).replace("{-{-PRODUCT_BUTTON-}-}", C(a.getOuterHTML())), p = p.trim().replace(D, "").slice(0, -5);
248
249
  const P = e ?? this.api.getDocumentModifier();
249
- P.modifyHtml(r.querySelector("img")).setAttribute("width", H.productImageWidth).setAttribute("height", H.productImageWidth), P.modifyHtml(this.currentNode).setInnerHtml(p), e || P.apply(new y("Reordered template"));
250
+ P.modifyHtml(r.querySelector("img")).setAttribute("width", H.productImageWidth).setAttribute("height", H.productImageWidth), P.modifyHtml(this.currentNode).setInnerHtml(p), e || P.apply(new S("Reordered template"));
250
251
  }, 50);
251
252
  }
252
253
  _updateDataTypeAttributes(e, r) {
@@ -261,7 +262,7 @@ class Z extends k {
261
262
  _updateDataNumberAttributes(e, r) {
262
263
  if (!this.currentNode)
263
264
  return;
264
- const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = V(e, i), s = this.currentNode.closest(".ins-product-td");
265
+ const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = B(e, i), s = this.currentNode.closest(".ins-product-td");
265
266
  s && r.modifyHtml(s).setAttribute("data-number", n), this.currentNode.querySelectorAll("[data-number]").forEach((c) => {
266
267
  const a = c;
267
268
  r.modifyHtml(a).setAttribute("data-number", n);
@@ -269,7 +270,7 @@ class Z extends k {
269
270
  }
270
271
  _reFillTemplate(e) {
271
272
  const r = this._getTemplateData(e), t = this.api.getDocumentModifier();
272
- this._updateImageSrc(r.imageSrc, t), this._updateName(r.name, t), this._updatePrice(r.price, t), this._updateOriginalPrice(r.originalPrice, t), this._updateQuantity(r.quantity, e, t), t.apply(new y("Refilled template"));
273
+ this._updateImageSrc(r.imageSrc, t), this._updateName(r.name, t), this._updatePrice(r.price, t), this._updateOriginalPrice(r.originalPrice, t), this._updateQuantity(r.quantity, e, t), t.apply(new S("Refilled template"));
273
274
  }
274
275
  _recalculateTrimming() {
275
276
  var n;
@@ -278,11 +279,11 @@ class Z extends k {
278
279
  const e = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
279
280
  if (!e)
280
281
  return;
281
- const r = e.querySelector("p > a");
282
+ const r = V(e);
282
283
  if (!r)
283
284
  return;
284
285
  const t = _(this.currentNode), i = (t == null ? void 0 : t.nameTrimming) ?? !0;
285
- this.api.getDocumentModifier().modifyHtml(r).setStyle("overflow", "hidden").setStyle("white-space", i ? "nowrap" : "normal").setStyle("text-overflow", i ? "ellipsis" : "unset").setStyle("max-width", "100%").setStyle("width", "100%").apply(new y("Recalculated trimming after orientation change"));
286
+ this.api.getDocumentModifier().modifyHtml(r).setStyle("overflow", "hidden").setStyle("white-space", i ? "nowrap" : "normal").setStyle("text-overflow", i ? "ellipsis" : "unset").setStyle("max-width", "100%").setStyle("width", "100%").apply(new S("Recalculated trimming after orientation change"));
286
287
  }
287
288
  _getParagraphFromBlock(e) {
288
289
  return e.querySelector("p");
@@ -314,6 +315,6 @@ class Z extends k {
314
315
  }
315
316
  }
316
317
  export {
317
- B as CONTROL_BLOCK_ID,
318
- Z as ItemsBlockControl
318
+ G as CONTROL_BLOCK_ID,
319
+ te as ItemsBlockControl
319
320
  };