@useinsider/guido 2.1.0-beta.bc229b1 → 2.1.0-beta.bcfc012

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 (27) hide show
  1. package/dist/components/organisms/header/EditorActions.vue.js +12 -10
  2. package/dist/components/organisms/header/EditorActions.vue2.js +41 -31
  3. package/dist/components/organisms/header/MigrationConfirmModal.vue.js +21 -0
  4. package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +38 -0
  5. package/dist/config/i18n/en/labels.json.js +8 -3
  6. package/dist/config/migrator/itemsBlockMigrator.js +136 -134
  7. package/dist/config/migrator/recommendationMigrator.js +42 -40
  8. package/dist/extensions/Blocks/Items/block.js +45 -25
  9. package/dist/extensions/Blocks/Items/iconsRegistry.js +40 -5
  10. package/dist/extensions/Blocks/Items/items.css.js +48 -0
  11. package/dist/extensions/Blocks/Recommendation/block.js +49 -29
  12. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +37 -2
  13. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +48 -0
  14. package/dist/extensions/Blocks/common-control.js +12 -4
  15. package/dist/guido.css +1 -1
  16. package/dist/src/components/Guido.vue.d.ts +1 -1
  17. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  18. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  19. package/dist/src/components/organisms/header/MigrationConfirmModal.vue.d.ts +5 -0
  20. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  21. package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
  22. package/dist/src/extensions/Blocks/Items/block.d.ts +1 -0
  23. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
  24. package/dist/src/extensions/Blocks/common-control.d.ts +5 -0
  25. package/dist/src/stores/template.d.ts +3 -0
  26. package/dist/stores/template.js +9 -0
  27. package/package.json +1 -1
@@ -1,24 +1,26 @@
1
1
  var h = Object.defineProperty;
2
- var T = (A, e, t) => e in A ? h(A, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : A[e] = t;
3
- var m = (A, e, t) => T(A, typeof e != "symbol" ? e + "" : e, t);
4
- import P, { prepareProductRows as S } from "../../extensions/Blocks/Recommendation/templates/grid/migration.js";
5
- import { getDefaultProducts as q } from "../../extensions/Blocks/Recommendation/templates/utils.js";
6
- class w {
2
+ var T = (d, e, t) => e in d ? h(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
3
+ var A = (d, e, t) => T(d, typeof e != "symbol" ? e + "" : e, t);
4
+ import { BLOCK_ID as S } from "../../extensions/Blocks/Recommendation/block.js";
5
+ import P, { prepareProductRows as q } from "../../extensions/Blocks/Recommendation/templates/grid/migration.js";
6
+ import { useTemplateStore as w } from "../../stores/template.js";
7
+ import { getDefaultProducts as B } from "../../extensions/Blocks/Recommendation/templates/utils.js";
8
+ class $ {
7
9
  constructor() {
8
- m(this, "parser");
10
+ A(this, "parser");
9
11
  this.parser = new DOMParser();
10
12
  }
11
13
  migrate(e) {
12
14
  try {
13
15
  const t = this.parser.parseFromString(e, "text/html"), s = t.querySelectorAll(
14
16
  'td.ins-recommendation-v3-block-1, td.product-block[esd-handler-name*="EmailRecommendationV3"]'
15
- );
16
- return s.length === 0 ? e : (s.forEach((o) => {
17
- const l = o.getAttribute("id"), r = this.extractBgColor(o), i = this.extractTitle(o), u = this.extractProductRows(o), c = P.replace("{-{-TITLE-}-}", i).replace("{-{-PRODUCT_ROWS-}-}", u), a = this.parser.parseFromString(
18
- `<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
17
+ ), o = w();
18
+ return o.migrations[S] = s.length, s.length === 0 ? e : (s.forEach((n) => {
19
+ const r = n.getAttribute("id"), i = this.extractBgColor(n), u = this.extractTitle(n), c = this.extractProductRows(n), l = P.replace("{-{-TITLE-}-}", u).replace("{-{-PRODUCT_ROWS-}-}", c), a = this.parser.parseFromString(
20
+ `<table id="tempDoc"><tbody><tr>${l}</tr></tbody></table>`,
19
21
  "text/html"
20
22
  ).querySelector(".ins-recommendation-v3-block-v2");
21
- a && o.parentNode && (l && a.setAttribute("id", l), r && a.setAttribute("bgcolor", r), o.parentNode.replaceChild(a, o));
23
+ a && n.parentNode && (r && a.setAttribute("id", r), i && a.setAttribute("bgcolor", i), n.parentNode.replaceChild(a, n));
22
24
  }), t.documentElement.outerHTML);
23
25
  } catch (t) {
24
26
  return console.error("RecommendationMigrator failed:", t), e;
@@ -64,7 +66,7 @@ class w {
64
66
  * @returns HTML string for the title block
65
67
  */
66
68
  extractTitle(e) {
67
- var a, g;
69
+ var g, a;
68
70
  const t = e.querySelector(".ext-recommendation-title");
69
71
  if (!t)
70
72
  return this.buildTitleBlock({
@@ -76,7 +78,7 @@ class w {
76
78
  });
77
79
  const s = t.querySelector("p");
78
80
  if (!s) {
79
- const p = ((a = t.textContent) == null ? void 0 : a.trim()) || "You May Also Like!", b = t.getAttribute("align") || "center";
81
+ const p = ((g = t.textContent) == null ? void 0 : g.trim()) || "You May Also Like!", b = t.getAttribute("align") || "center";
80
82
  return this.buildTitleBlock({
81
83
  text: p,
82
84
  isBold: !0,
@@ -85,13 +87,13 @@ class w {
85
87
  styles: "font-size: 28px; color: #333333;"
86
88
  });
87
89
  }
88
- const o = ((g = s.textContent) == null ? void 0 : g.trim()) || "You May Also Like!", l = t.getAttribute("align") || s.getAttribute("align") || "center", r = s.getAttribute("style") || "", i = /font-weight\s*:\s*bold/i.test(r) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(r) || !!s.querySelector("i, em"), c = this.removeStyleProperties(r, ["font-weight", "font-style"]), n = this.convertInlineToBlock(c);
90
+ const o = ((a = s.textContent) == null ? void 0 : a.trim()) || "You May Also Like!", n = t.getAttribute("align") || s.getAttribute("align") || "center", r = s.getAttribute("style") || "", i = /font-weight\s*:\s*bold/i.test(r) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(r) || !!s.querySelector("i, em"), c = this.removeStyleProperties(r, ["font-weight", "font-style"]), l = this.convertInlineToBlock(c);
89
91
  return this.buildTitleBlock({
90
92
  text: o,
91
93
  isBold: i,
92
94
  isItalic: u,
93
- align: l,
94
- styles: n
95
+ align: n,
96
+ styles: l
95
97
  });
96
98
  }
97
99
  /**
@@ -103,8 +105,8 @@ class w {
103
105
  const t = this.extractProductConfig(e);
104
106
  if (!t)
105
107
  return console.warn("[RecommendationMigrator] No product config found, using defaults"), this.generateProductRows(6, 3, {});
106
- const { totalCount: s, productsPerRow: o } = t, l = this.extractProductStyles(e);
107
- return this.generateProductRows(s, o, l);
108
+ const { totalCount: s, productsPerRow: o } = t, n = this.extractProductStyles(e);
109
+ return this.generateProductRows(s, o, n);
108
110
  }
109
111
  /**
110
112
  * Extracts Stripo padding/margin utility classes from a class string
@@ -152,12 +154,12 @@ class w {
152
154
  * @returns HTML string for product rows with applied styles
153
155
  */
154
156
  generateProductRows(e, t, s) {
155
- const o = q(), l = [];
157
+ const o = B(), n = [];
156
158
  for (let i = 0; i < e; i++) {
157
159
  const u = o[i % o.length];
158
- l.push({ ...u });
160
+ n.push({ ...u });
159
161
  }
160
- let r = S(l, t);
162
+ let r = q(n, t);
161
163
  return r = this.applyExtractedStyles(r, s), r;
162
164
  }
163
165
  /**
@@ -171,30 +173,30 @@ class w {
171
173
  return console.warn("[RecommendationMigrator] No product card found, using default styles"), t;
172
174
  const o = this.extractCardBgColor(s);
173
175
  o && (t.cardBgColor = o);
174
- const l = s.querySelector(".ext-product-image");
175
- if (l) {
176
- const n = l.querySelector("img"), a = n == null ? void 0 : n.getAttribute("width"), g = l.getAttribute("style") || "", p = l.getAttribute("align") || "center", b = l.getAttribute("class") || "", d = this.extractStripoClasses(b);
177
- t.imageWidth = a || "120", t.imageAlign = p, t.imageTdStyle = g, t.imageClasses = d;
176
+ const n = s.querySelector(".ext-product-image");
177
+ if (n) {
178
+ const l = n.querySelector("img"), g = l == null ? void 0 : l.getAttribute("width"), a = n.getAttribute("style") || "", p = n.getAttribute("align") || "center", b = n.getAttribute("class") || "", m = this.extractStripoClasses(b);
179
+ t.imageWidth = g || "120", t.imageAlign = p, t.imageTdStyle = a, t.imageClasses = m;
178
180
  }
179
181
  const r = s.querySelector(".ext-product-name");
180
182
  if (r) {
181
- const n = r.querySelector("p"), a = (n == null ? void 0 : n.getAttribute("style")) || "", g = r.getAttribute("align") || "center", p = r.getAttribute("style") || "", b = r.getAttribute("class") || "", d = this.extractStripoClasses(b);
182
- t.nameStyle = a, t.nameAlign = g, t.nameTdStyle = p, t.nameClasses = d;
183
+ const l = r.querySelector("p"), g = (l == null ? void 0 : l.getAttribute("style")) || "", a = r.getAttribute("align") || "center", p = r.getAttribute("style") || "", b = r.getAttribute("class") || "", m = this.extractStripoClasses(b);
184
+ t.nameStyle = g, t.nameAlign = a, t.nameTdStyle = p, t.nameClasses = m;
183
185
  }
184
186
  const i = s.querySelector(".ext-product-price");
185
187
  if (i) {
186
- const n = i.querySelector("p"), a = (n == null ? void 0 : n.getAttribute("style")) || "", g = i.getAttribute("align") || "center", p = i.getAttribute("style") || "", b = i.getAttribute("class") || "", d = this.extractStripoClasses(b);
187
- t.priceStyle = a, t.priceAlign = g, t.priceTdStyle = p, t.priceClasses = d;
188
+ const l = i.querySelector("p"), g = (l == null ? void 0 : l.getAttribute("style")) || "", a = i.getAttribute("align") || "center", p = i.getAttribute("style") || "", b = i.getAttribute("class") || "", m = this.extractStripoClasses(b);
189
+ t.priceStyle = g, t.priceAlign = a, t.priceTdStyle = p, t.priceClasses = m;
188
190
  }
189
191
  const u = s.querySelector(".ext-product-original-price");
190
192
  if (u) {
191
- const n = u.querySelector("p"), a = (n == null ? void 0 : n.getAttribute("style")) || "", g = u.getAttribute("align") || "center", p = u.getAttribute("style") || "", b = u.getAttribute("class") || "", d = this.extractStripoClasses(b);
192
- t.oldPriceStyle = a, t.oldPriceAlign = g, t.oldPriceTdStyle = p, t.oldPriceClasses = d;
193
+ const l = u.querySelector("p"), g = (l == null ? void 0 : l.getAttribute("style")) || "", a = u.getAttribute("align") || "center", p = u.getAttribute("style") || "", b = u.getAttribute("class") || "", m = this.extractStripoClasses(b);
194
+ t.oldPriceStyle = g, t.oldPriceAlign = a, t.oldPriceTdStyle = p, t.oldPriceClasses = m;
193
195
  }
194
196
  const c = s.querySelector(".ext-product-button");
195
197
  if (c) {
196
- const n = c.querySelector(".es-button-border"), a = c.querySelector("a.es-button"), g = (n == null ? void 0 : n.getAttribute("style")) || "", p = (a == null ? void 0 : a.getAttribute("style")) || "", b = c.getAttribute("align") || "center", d = c.getAttribute("style") || "", f = c.getAttribute("class") || "", C = this.extractStripoClasses(f), y = ((c == null ? void 0 : c.textContent) || "").trim();
197
- t.buttonBorderStyle = g, t.buttonLinkStyle = p, t.buttonAlign = b, t.buttonTdStyle = d, t.buttonClasses = C, t.buttonText = y;
198
+ const l = c.querySelector(".es-button-border"), g = c.querySelector("a.es-button"), a = (l == null ? void 0 : l.getAttribute("style")) || "", p = (g == null ? void 0 : g.getAttribute("style")) || "", b = c.getAttribute("align") || "center", m = c.getAttribute("style") || "", f = c.getAttribute("class") || "", C = this.extractStripoClasses(f), y = ((c == null ? void 0 : c.textContent) || "").trim();
199
+ t.buttonBorderStyle = a, t.buttonLinkStyle = p, t.buttonAlign = b, t.buttonTdStyle = m, t.buttonClasses = C, t.buttonText = y;
198
200
  }
199
201
  return t;
200
202
  }
@@ -240,8 +242,8 @@ class w {
240
242
  i && t.oldPriceStyle && i.setAttribute("style", t.oldPriceStyle);
241
243
  }), (t.buttonBorderStyle || t.buttonLinkStyle || t.buttonAlign || t.buttonTdStyle || t.buttonClasses) && s.querySelectorAll(".product-button").forEach((r) => {
242
244
  if (t.buttonAlign && r.setAttribute("align", t.buttonAlign), t.buttonTdStyle && r.setAttribute("style", t.buttonTdStyle), t.buttonClasses) {
243
- const n = `${r.getAttribute("class") || ""} ${t.buttonClasses}`.trim();
244
- r.setAttribute("class", n);
245
+ const l = `${r.getAttribute("class") || ""} ${t.buttonClasses}`.trim();
246
+ r.setAttribute("class", l);
245
247
  }
246
248
  const i = r.querySelector(".es-button-border");
247
249
  i && t.buttonBorderStyle && i.setAttribute("style", t.buttonBorderStyle);
@@ -270,8 +272,8 @@ class w {
270
272
  * Removes specified style properties from a style string
271
273
  */
272
274
  removeStyleProperties(e, t) {
273
- return e ? t.reduce((o, l) => {
274
- const r = new RegExp(`${l}\\s*:\\s*[^;]*;?`, "gi");
275
+ return e ? t.reduce((o, n) => {
276
+ const r = new RegExp(`${n}\\s*:\\s*[^;]*;?`, "gi");
275
277
  return o.replace(r, "");
276
278
  }, e).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
277
279
  }
@@ -285,9 +287,9 @@ class w {
285
287
  return /display\s*:/i.test(t) || (t = t ? `${t}; display: block` : "display: block"), t.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").replace(/"/g, "'").trim();
286
288
  }
287
289
  }
288
- function k(A) {
289
- return new w().migrate(A);
290
+ function v(d) {
291
+ return new $().migrate(d);
290
292
  }
291
293
  export {
292
- k as migrateRecommendation
294
+ v as migrateRecommendation
293
295
  };
@@ -1,18 +1,19 @@
1
- import { useOnboardingStore as d } from "../../../stores/onboarding.js";
2
- import { Block as g, BlockCompositionType as f, ModificationDescription as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
- import { SETTINGS_ENUMS as c, DefaultConfigValues as i } from "./enums/settingsEnums.js";
4
- import { getDefaultTemplate as p } from "./template.js";
5
- import { getItemsBlockContainer as u, getItemsBlockConfig as C, getDefaultItemsBlockConfig as I } from "./utils/nodeConfigUtils.js";
6
- const y = "items-block";
7
- class B extends g {
1
+ import { useOnboardingStore as g } from "../../../stores/onboarding.js";
2
+ import { useTemplateStore as f } from "../../../stores/template.js";
3
+ import { Block as u, BlockCompositionType as I, UIElementType as c, UEAttr as C, ModificationDescription as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
4
+ import { SETTINGS_ENUMS as l, DefaultConfigValues as s } from "./enums/settingsEnums.js";
5
+ import { getDefaultTemplate as y } from "./template.js";
6
+ import { getItemsBlockContainer as b, getItemsBlockConfig as k, getDefaultItemsBlockConfig as N } from "./utils/nodeConfigUtils.js";
7
+ const m = "items-block";
8
+ class M extends u {
8
9
  getId() {
9
- return y;
10
+ return m;
10
11
  }
11
12
  getIcon() {
12
13
  return "items-icon";
13
14
  }
14
15
  getBlockCompositionType() {
15
- return f.CONTAINER;
16
+ return I.CONTAINER;
16
17
  }
17
18
  getName() {
18
19
  return this.api.translate("Items");
@@ -20,35 +21,54 @@ class B extends g {
20
21
  getDescription() {
21
22
  return this.api.translate("Items lets you display personalized products based on user behavior.");
22
23
  }
24
+ getSettingsPanelTitleHtml() {
25
+ if (f().migrations[m] === 0)
26
+ return "";
27
+ const n = this.api.translate("Items"), o = this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.");
28
+ return `<div>
29
+ <div style="display: flex; align-items: center;">
30
+ <span>${n}</span>
31
+ </div>
32
+ <div class="items-migration-info">
33
+ <${c.ICON}
34
+ ${C.ICON.src}="migration-info-icon"
35
+ class="items-migration-info__icon">
36
+ </${c.ICON}>
37
+ <p class="items-migration-info__text">
38
+ ${o}
39
+ </p>
40
+ </div>
41
+ </div>`;
42
+ }
23
43
  getTemplate() {
24
- return p({
25
- orientation: c.ORIENTATION.VERTICAL,
26
- itemsType: c.ITEMS_TYPE.CART_ITEMS,
44
+ return y({
45
+ orientation: l.ORIENTATION.VERTICAL,
46
+ itemsType: l.ITEMS_TYPE.CART_ITEMS,
27
47
  itemId: "{{Abandoned Cart Item (1) Url}}",
28
- currencySymbol: i.productPriceCurrencySymbolControlValue,
29
- currencyLocation: i.productPriceCurrencyLocationControlValue,
30
- formattedPrice: i.productPriceFormattedControlValue === "1"
48
+ currencySymbol: s.productPriceCurrencySymbolControlValue,
49
+ currencyLocation: s.productPriceCurrencyLocationControlValue,
50
+ formattedPrice: s.productPriceFormattedControlValue === "1"
31
51
  });
32
52
  }
33
53
  allowInnerBlocksDND() {
34
54
  return !1;
35
55
  }
36
- onCreated(n) {
37
- const s = this.api.getDocumentModifier(), r = this.api.getDocumentRootCssNode();
38
- r.querySelector('[product-attr="imageSrc"] img') || s.modifyCss(r).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
39
- const e = u(n);
56
+ onCreated(i) {
57
+ const n = this.api.getDocumentModifier(), o = this.api.getDocumentRootCssNode();
58
+ o.querySelector('[product-attr="imageSrc"] img') || n.modifyCss(o).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
59
+ const e = b(i);
40
60
  if (!e)
41
61
  return;
42
- const a = e.getNodeConfig(), l = a && Object.keys(a).length > 0, t = C(n);
62
+ const a = e.getNodeConfig(), d = a && Object.keys(a).length > 0, t = k(i);
43
63
  if (t != null && t.initialized)
44
- l ? t.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...t, blockInstanceId: String(Date.now()) }).apply(new o("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(t).apply(new o("Migrate legacy config to nodeConfig"));
64
+ d ? t.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...t, blockInstanceId: String(Date.now()) }).apply(new r("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(t).apply(new r("Migrate legacy config to nodeConfig"));
45
65
  else {
46
- const m = I();
47
- this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(m).apply(new o("Initialize Items block with default configuration")), d().startOnboarding("itemsOnboarding");
66
+ const p = N();
67
+ this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(p).apply(new r("Initialize Items block with default configuration")), g().startOnboarding("itemsOnboarding");
48
68
  }
49
69
  }
50
70
  }
51
71
  export {
52
- y as BLOCK_ID,
53
- B as ItemsBlock
72
+ m as BLOCK_ID,
73
+ M as ItemsBlock
54
74
  };
@@ -1,5 +1,5 @@
1
- import { IconsRegistry as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- class i extends o {
1
+ import { IconsRegistry as C } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ class e extends C {
3
3
  registerIconsSvg(t) {
4
4
  t["items-icon"] = `
5
5
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -19,14 +19,49 @@ class i extends o {
19
19
  </svg>
20
20
  `, t["horizontal-orientation"] = `
21
21
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
22
- <path d="M10 19H4C3.44772 19 3 18.5523 3 18V2C3 1.44772 3.44772 1 4 1H10V19Z" stroke="currentColor"
22
+ <path d="M10 19H4C3.44772 19 3 18.5523 3 18V2C3 1.44772 3.44772 1 4 1H10V19Z" stroke="currentColor"
23
23
  stroke-width="2" fill="none"/>
24
- <path d="M17 2V18C17 18.5523 16.5523 19 16 19H10V1H16C16.5523 1 17 1.44772 17 2Z" stroke="currentColor"
24
+ <path d="M17 2V18C17 18.5523 16.5523 19 16 19H10V1H16C16.5523 1 17 1.44772 17 2Z" stroke="currentColor"
25
25
  stroke-width="2" fill="none"/>
26
26
  </svg>
27
+ `, t["migration-info-icon"] = `
28
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
29
+ <g transform="translate(3, 2.5)">
30
+ <path d="M6.87812 0.141942C10.7873 -0.580665 14.6797 1.51065 16.201 5.16436C17.7344
31
+ 8.84685 16.432 13.0909 13.0906 15.3015C9.77511 17.4946 5.36819 17.08 2.52785
32
+ 14.3193L2.46105 14.2536C0.882709 12.6854 -0.00259777 10.5591 5.72603e-06
33
+ 8.34301L0.000643642 8.24974C0.0491816 4.30543 2.87651 0.926565 6.78576
34
+ 0.159555L6.87812 0.141942ZM14.5911 5.82406C13.3749 2.90345 10.2486 1.24158 7.12372
35
+ 1.85468C3.99888 2.46779 1.74568 5.18516 1.74194 8.34505C1.73988 10.1027 2.44203
36
+ 11.789 3.69379 13.0328C5.94435 15.269 9.4739 15.617 12.1241 13.8638C14.7742 12.1106
37
+ 15.8071 8.74458 14.5911 5.82406Z" fill="#258DDE"/>
38
+ <path d="M12.5195 13.5806C12.8537 13.2479 13.3933 13.2417 13.7351 13.5628L13.7512
39
+ 13.5783L17.7437 17.5239C18.0845 17.8607 18.0856 18.4077 17.7461 18.7458C17.4066
40
+ 19.0838 16.8551 19.0849 16.5143 18.7481L12.5218 14.8025L12.5061 14.7866C12.1811
41
+ 14.4487 12.1853 13.9134 12.5195 13.5806Z" fill="#258DDE"/>
42
+ <path d="M6.71262 5.42913C6.37248 5.09172 5.82105 5.09172 5.48092 5.42913C5.14079
43
+ 5.76655 5.14079 6.3136 5.48092 6.65104L6.71262 5.42913ZM7.80353 8.95504C8.14367
44
+ 9.29246 8.69506 9.29246 9.0352 8.95504C9.37534 8.61762 9.37534 8.07053 9.0352
45
+ 7.73311L7.80353 8.95504ZM9.0352 7.73311C8.69506 7.39569 8.14367 7.39569 7.80353
46
+ 7.73311C7.46339 8.07053 7.46339 8.61762 7.80353 8.95504L9.0352 7.73311ZM10.1261
47
+ 11.259C10.4663 11.5965 11.0176 11.5965 11.3578 11.259C11.6979 10.9216 11.6979
48
+ 10.3745 11.3578 10.0371L10.1261 11.259ZM9.0352 8.95504C9.37534 8.61762 9.37534
49
+ 8.07053 9.0352 7.73311C8.69506 7.39569 8.14367 7.39569 7.80353 7.73311L9.0352
50
+ 8.95504ZM5.48092 10.0371C5.14079 10.3745 5.14079 10.9216 5.48092 11.259C5.82105
51
+ 11.5965 6.37248 11.5965 6.71262 11.259L5.48092 10.0371ZM7.80353 7.73311C7.46339
52
+ 8.07053 7.46339 8.61762 7.80353 8.95504C8.14367 9.29246 8.69506 9.29246 9.0352
53
+ 8.95504L7.80353 7.73311ZM11.3578 6.65104C11.6979 6.3136 11.6979 5.76655 11.3578
54
+ 5.42913C11.0176 5.09172 10.4663 5.09172 10.1261 5.42913L11.3578 6.65104ZM5.48092
55
+ 6.65104L7.80353 8.95504L9.0352 7.73311L6.71262 5.42913L5.48092 6.65104ZM7.80353
56
+ 8.95504L10.1261 11.259L11.3578 10.0371L9.0352 7.73311L7.80353 8.95504ZM7.80353
57
+ 7.73311L5.48092 10.0371L6.71262 11.259L9.0352 8.95504L7.80353 7.73311ZM9.0352
58
+ 8.95504L11.3578 6.65104L10.1261 5.42913L7.80353 7.73311L9.0352 8.95504Z"
59
+ fill="#258DDE"/>
60
+ </g>
61
+ </svg>
27
62
  `;
28
63
  }
29
64
  }
30
65
  export {
31
- i as ItemsIconsRegistry
66
+ e as ItemsIconsRegistry
32
67
  };
@@ -17,6 +17,54 @@ const n = `/* Utils */
17
17
  .container:has(.items-controls-container) {
18
18
  padding: 0
19
19
  }
20
+
21
+ /* ─── Migration Info Box ─────────────────────────────────────────────── */
22
+ /* Shown in the settings panel title when a block was migrated from legacy */
23
+
24
+ /* Layout variables for positioning the absolutely-placed info box */
25
+ :host {
26
+ --items-migration-padding: 16px;
27
+ --items-migration-title-height: 61px;
28
+ --items-migration-box-height: 98px;
29
+ }
30
+
31
+ /* Push tabs down when info box is present inside the control panel header */
32
+ .control-panel-header:has(.items-migration-info) {
33
+ position: relative;
34
+ margin-bottom: calc(2 * var(--items-migration-padding) + var(--items-migration-box-height));
35
+ }
36
+
37
+ /* Info box container */
38
+ .items-migration-info {
39
+ display: flex;
40
+ align-items: flex-start;
41
+ gap: 8px;
42
+ padding: 12px;
43
+ background: var(--guido-color-background-onpage-message-info);
44
+ border: 1px solid var(--guido-color-border-onpage-message-info);
45
+ border-radius: 4px;
46
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
47
+ position: absolute;
48
+ left: var(--items-migration-padding);
49
+ right: var(--items-migration-padding);
50
+ top: calc(var(--items-migration-padding) + var(--items-migration-title-height));
51
+ }
52
+
53
+ /* Icon — 18x19 icon inside a 24x24 bounding box (matches Figma) */
54
+ .items-migration-info__icon {
55
+ flex-shrink: 0;
56
+ width: 24px;
57
+ height: 24px;
58
+ }
59
+
60
+ /* Text content */
61
+ .items-migration-info__text {
62
+ margin: 4px 0;
63
+ white-space: normal;
64
+ font-size: 13px;
65
+ font-weight: 400;
66
+ line-height: 16px;
67
+ }
20
68
  `;
21
69
  export {
22
70
  n as default
@@ -1,13 +1,14 @@
1
- var p = Object.defineProperty;
2
- var f = (r, o, t) => o in r ? p(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
3
- var g = (r, o, t) => f(r, typeof o != "symbol" ? o + "" : o, t);
4
- import { Block as h, BlockCompositionType as I, ModificationDescription as _ } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { ensureMobileCssRulesExist as d } from "./controls/mobileLayout/cssRules.js";
1
+ var h = Object.defineProperty;
2
+ var I = (r, o, t) => o in r ? h(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
3
+ var g = (r, o, t) => I(r, typeof o != "symbol" ? o + "" : o, t);
4
+ import { useTemplateStore as k } from "../../../stores/template.js";
5
+ import { Block as _, BlockCompositionType as B, UIElementType as d, UEAttr as C, ModificationDescription as A } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
+ import { ensureMobileCssRulesExist as u } from "./controls/mobileLayout/cssRules.js";
6
7
  import { RecommendationConfigService as s } from "./services/configService.js";
7
- import { useRecommendationExtensionStore as u } from "./store/recommendation.js";
8
- import { getDefaultTemplate as k } from "./templates/grid/template.js";
9
- const B = "recommendation-block", c = "ins-recommendation-v3-block-v2", a = "recommendation-id";
10
- class y extends h {
8
+ import { useRecommendationExtensionStore as p } from "./store/recommendation.js";
9
+ import { getDefaultTemplate as R } from "./templates/grid/template.js";
10
+ const f = "recommendation-block", c = "ins-recommendation-v3-block-v2", a = "recommendation-id";
11
+ class E extends _ {
11
12
  constructor() {
12
13
  super();
13
14
  /**
@@ -17,13 +18,13 @@ class y extends h {
17
18
  g(this, "_pendingBlockId", null);
18
19
  }
19
20
  getId() {
20
- return B;
21
+ return f;
21
22
  }
22
23
  getIcon() {
23
24
  return "recommendation-icon";
24
25
  }
25
26
  getBlockCompositionType() {
26
- return I.CONTAINER;
27
+ return B.CONTAINER;
27
28
  }
28
29
  getName() {
29
30
  return this.api.translate("Recommendation Block");
@@ -31,6 +32,25 @@ class y extends h {
31
32
  getDescription() {
32
33
  return this.api.translate("Recommendation Block Title Description");
33
34
  }
35
+ getSettingsPanelTitleHtml() {
36
+ if (k().migrations[f] === 0)
37
+ return "";
38
+ const e = this.api.translate("Recommendation Block"), i = this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.");
39
+ return `<div>
40
+ <div style="display: flex; align-items: center;">
41
+ <span>${e}</span>
42
+ </div>
43
+ <div class="recommendation-migration-info">
44
+ <${d.ICON}
45
+ ${C.ICON.src}="migration-info-icon"
46
+ class="recommendation-migration-info__icon">
47
+ </${d.ICON}>
48
+ <p class="recommendation-migration-info__text">
49
+ ${i}
50
+ </p>
51
+ </div>
52
+ </div>`;
53
+ }
34
54
  /**
35
55
  * Returns the template HTML for a new recommendation block.
36
56
  * Generates a unique recommendation ID and embeds the instance class
@@ -40,7 +60,7 @@ class y extends h {
40
60
  */
41
61
  getTemplate() {
42
62
  const t = this._generateNextId();
43
- return this._pendingBlockId = t, k(t);
63
+ return this._pendingBlockId = t, R(t);
44
64
  }
45
65
  /**
46
66
  * Called when a new block is dropped into the template
@@ -52,8 +72,8 @@ class y extends h {
52
72
  onCreated(t) {
53
73
  const e = this._pendingBlockId ?? this._generateNextId();
54
74
  this._pendingBlockId = null, this._assignRecommendationId(t, e);
55
- const n = s.initializeConfig(this.api, t, { recommendationId: e }), i = u();
56
- i.setCurrentBlock(e), d(this.api), i.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 });
75
+ const i = s.initializeConfig(this.api, t, { recommendationId: e }), n = p();
76
+ n.setCurrentBlock(e), u(this.api), n.patchCurrentBlockConfig({ language: i.language }, { triggerRefetch: !1 });
57
77
  }
58
78
  /**
59
79
  * Called when the document changes or template is loaded
@@ -73,7 +93,7 @@ class y extends h {
73
93
  "Assign recommendation ID to legacy block"
74
94
  );
75
95
  }
76
- s.needsMigration(t) && this._migrateFromLegacy(t), d(this.api);
96
+ s.needsMigration(t) && this._migrateFromLegacy(t), u(this.api);
77
97
  }
78
98
  }
79
99
  /**
@@ -84,7 +104,7 @@ class y extends h {
84
104
  */
85
105
  onDelete(t) {
86
106
  const e = this._getRecommendationId(t);
87
- e && u().removeBlockState(e);
107
+ e && p().removeBlockState(e);
88
108
  }
89
109
  /**
90
110
  * Generates the next unique recommendation ID by scanning all existing blocks
@@ -94,9 +114,9 @@ class y extends h {
94
114
  let t = 0;
95
115
  try {
96
116
  const e = this.api.getDocumentRoot();
97
- e && "querySelectorAll" in e && e.querySelectorAll(`.${c}`).forEach((i) => {
98
- if ("getAttribute" in i) {
99
- const m = i.getAttribute(a), l = m ? parseInt(m) : 0;
117
+ e && "querySelectorAll" in e && e.querySelectorAll(`.${c}`).forEach((n) => {
118
+ if ("getAttribute" in n) {
119
+ const m = n.getAttribute(a), l = m ? parseInt(m) : 0;
100
120
  l > t && (t = l);
101
121
  }
102
122
  });
@@ -111,11 +131,11 @@ class y extends h {
111
131
  * added classes via setAttribute.
112
132
  */
113
133
  _assignRecommendationId(t, e) {
114
- const n = this._getBlockElement(t);
115
- if (!n)
134
+ const i = this._getBlockElement(t);
135
+ if (!i)
116
136
  return;
117
- const i = this.api.getDocumentModifier();
118
- i.modifyHtml(n).setAttribute(a, e.toString()), i.apply(new _(`Assign recommendation ID ${e}`));
137
+ const n = this.api.getDocumentModifier();
138
+ n.modifyHtml(i).setAttribute(a, e.toString()), n.apply(new A(`Assign recommendation ID ${e}`));
119
139
  }
120
140
  /**
121
141
  * Gets the recommendation-id from a block node
@@ -124,11 +144,11 @@ class y extends h {
124
144
  const e = this._getBlockElement(t);
125
145
  if (!e || !("getAttribute" in e))
126
146
  return null;
127
- const n = e.getAttribute(a);
128
- if (!n)
147
+ const i = e.getAttribute(a);
148
+ if (!i)
129
149
  return null;
130
- const i = parseInt(n);
131
- return Number.isNaN(i) ? null : i;
150
+ const n = parseInt(i);
151
+ return Number.isNaN(n) ? null : n;
132
152
  }
133
153
  /**
134
154
  * Gets the block element (the element with BLOCK_CLASS)
@@ -149,6 +169,6 @@ class y extends h {
149
169
  }
150
170
  }
151
171
  export {
152
- B as BLOCK_ID,
153
- y as RecommendationBlock
172
+ f as BLOCK_ID,
173
+ E as RecommendationBlock
154
174
  };
@@ -1,5 +1,5 @@
1
- import { IconsRegistry as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- class o extends r {
1
+ import { IconsRegistry as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ class o extends t {
3
3
  registerIconsSvg(C) {
4
4
  C["recommendation-icon"] = `
5
5
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
@@ -59,6 +59,41 @@ class o extends r {
59
59
  <circle cx="3" cy="16" r="1" stroke="currentColor" stroke-width="1"/>
60
60
  <rect x="7" y="15" width="11" height="2" rx="1"/>
61
61
  </svg>
62
+ `, C["migration-info-icon"] = `
63
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
64
+ <g transform="translate(3, 2.5)">
65
+ <path d="M6.87812 0.141942C10.7873 -0.580665 14.6797 1.51065 16.201 5.16436C17.7344
66
+ 8.84685 16.432 13.0909 13.0906 15.3015C9.77511 17.4946 5.36819 17.08 2.52785
67
+ 14.3193L2.46105 14.2536C0.882709 12.6854 -0.00259777 10.5591 5.72603e-06
68
+ 8.34301L0.000643642 8.24974C0.0491816 4.30543 2.87651 0.926565 6.78576
69
+ 0.159555L6.87812 0.141942ZM14.5911 5.82406C13.3749 2.90345 10.2486 1.24158 7.12372
70
+ 1.85468C3.99888 2.46779 1.74568 5.18516 1.74194 8.34505C1.73988 10.1027 2.44203
71
+ 11.789 3.69379 13.0328C5.94435 15.269 9.4739 15.617 12.1241 13.8638C14.7742 12.1106
72
+ 15.8071 8.74458 14.5911 5.82406Z" fill="#258DDE"/>
73
+ <path d="M12.5195 13.5806C12.8537 13.2479 13.3933 13.2417 13.7351 13.5628L13.7512
74
+ 13.5783L17.7437 17.5239C18.0845 17.8607 18.0856 18.4077 17.7461 18.7458C17.4066
75
+ 19.0838 16.8551 19.0849 16.5143 18.7481L12.5218 14.8025L12.5061 14.7866C12.1811
76
+ 14.4487 12.1853 13.9134 12.5195 13.5806Z" fill="#258DDE"/>
77
+ <path d="M6.71262 5.42913C6.37248 5.09172 5.82105 5.09172 5.48092 5.42913C5.14079
78
+ 5.76655 5.14079 6.3136 5.48092 6.65104L6.71262 5.42913ZM7.80353 8.95504C8.14367
79
+ 9.29246 8.69506 9.29246 9.0352 8.95504C9.37534 8.61762 9.37534 8.07053 9.0352
80
+ 7.73311L7.80353 8.95504ZM9.0352 7.73311C8.69506 7.39569 8.14367 7.39569 7.80353
81
+ 7.73311C7.46339 8.07053 7.46339 8.61762 7.80353 8.95504L9.0352 7.73311ZM10.1261
82
+ 11.259C10.4663 11.5965 11.0176 11.5965 11.3578 11.259C11.6979 10.9216 11.6979
83
+ 10.3745 11.3578 10.0371L10.1261 11.259ZM9.0352 8.95504C9.37534 8.61762 9.37534
84
+ 8.07053 9.0352 7.73311C8.69506 7.39569 8.14367 7.39569 7.80353 7.73311L9.0352
85
+ 8.95504ZM5.48092 10.0371C5.14079 10.3745 5.14079 10.9216 5.48092 11.259C5.82105
86
+ 11.5965 6.37248 11.5965 6.71262 11.259L5.48092 10.0371ZM7.80353 7.73311C7.46339
87
+ 8.07053 7.46339 8.61762 7.80353 8.95504C8.14367 9.29246 8.69506 9.29246 9.0352
88
+ 8.95504L7.80353 7.73311ZM11.3578 6.65104C11.6979 6.3136 11.6979 5.76655 11.3578
89
+ 5.42913C11.0176 5.09172 10.4663 5.09172 10.1261 5.42913L11.3578 6.65104ZM5.48092
90
+ 6.65104L7.80353 8.95504L9.0352 7.73311L6.71262 5.42913L5.48092 6.65104ZM7.80353
91
+ 8.95504L10.1261 11.259L11.3578 10.0371L9.0352 7.73311L7.80353 8.95504ZM7.80353
92
+ 7.73311L5.48092 10.0371L6.71262 11.259L9.0352 8.95504L7.80353 7.73311ZM9.0352
93
+ 8.95504L11.3578 6.65104L10.1261 5.42913L7.80353 7.73311L9.0352 8.95504Z"
94
+ fill="#258DDE"/>
95
+ </g>
96
+ </svg>
62
97
  `;
63
98
  }
64
99
  }