@useinsider/guido 3.2.0-beta.a49c53c → 3.2.0-beta.a961c72

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 (63) hide show
  1. package/dist/@types/config/schemas.js +150 -94
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +88 -87
  4. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
  5. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  6. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
  7. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
  8. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
  9. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
  10. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
  11. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
  12. package/dist/composables/useRibbonOffset.js +21 -0
  13. package/dist/composables/useStripo.js +39 -37
  14. package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
  15. package/dist/config/migrator/index.js +9 -9
  16. package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
  17. package/dist/config/migrator/recommendation/extractors.js +27 -0
  18. package/dist/config/migrator/recommendation/htmlBuilder.js +478 -0
  19. package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
  20. package/dist/config/migrator/recommendation/settingsMapper.js +78 -0
  21. package/dist/config/migrator/recommendation/themeMapper.js +89 -0
  22. package/dist/config/migrator/recommendationMigrator.js +60 -290
  23. package/dist/enums/extensions/recommendationBlock.js +2 -1
  24. package/dist/enums/onboarding.js +7 -2
  25. package/dist/enums/unsubscribe.js +34 -27
  26. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  27. package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
  28. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
  29. package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
  30. package/dist/guido.css +1 -1
  31. package/dist/node_modules/valibot/dist/index.js +450 -235
  32. package/dist/package.json.js +7 -0
  33. package/dist/src/@types/config/defaults.d.ts +5 -1
  34. package/dist/src/@types/config/index.d.ts +3 -3
  35. package/dist/src/@types/config/schemas.d.ts +213 -0
  36. package/dist/src/@types/config/types.d.ts +9 -1
  37. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  38. package/dist/src/composables/useConfig.d.ts +56 -0
  39. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  40. package/dist/src/config/migrator/index.d.ts +2 -1
  41. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +18 -0
  42. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
  43. package/dist/src/config/migrator/recommendation/extractors.d.ts +23 -0
  44. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +31 -0
  45. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +28 -0
  46. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
  47. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +29 -0
  48. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
  49. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +28 -0
  50. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
  51. package/dist/src/config/migrator/recommendation/types.d.ts +209 -0
  52. package/dist/src/config/migrator/recommendationMigrator.d.ts +28 -1
  53. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
  54. package/dist/src/enums/onboarding.d.ts +6 -0
  55. package/dist/src/enums/unsubscribe.d.ts +5 -0
  56. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
  57. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  58. package/dist/src/stores/config.d.ts +504 -0
  59. package/dist/src/stores/onboarding.d.ts +4 -0
  60. package/dist/static/templates/empty/style.css.js +1 -0
  61. package/dist/stores/onboarding.js +4 -0
  62. package/package.json +6 -2
  63. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
@@ -9,35 +9,36 @@ import { localePatch as H } from "../config/i18n/index.js";
9
9
  import { displayConditions as O } from "../enums/displayConditions.js";
10
10
  import { useStripoApi as j } from "../services/stripoApi.js";
11
11
  import L from "../static/styles/customEditorStyle.css.js";
12
- import { useEditorStore as S } from "../stores/editor.js";
13
- import { dynamicContentToMergeTags as z } from "../utils/genericUtil.js";
14
- const ne = (y, a) => {
15
- const { features: d, template: C, isFeatureEnabled: l } = P(), { handleError: c } = x(), { getToken: E, getCustomFonts: h, getSyncModulesStatus: w } = j(), { handleEvent: b } = q(), { getStripoBlocksConfig: B } = I(), T = async (i, r = [], n = !1) => {
16
- var p, f, g;
17
- const e = S(), { html: o, css: k } = i, { baseBlocks: u, extensions: F } = await B(), m = ((p = d.value) == null ? void 0 : p.displayConditions) ?? !0, M = ((f = d.value) == null ? void 0 : f.modulesDisabled) ?? !1, V = ((g = C.value) == null ? void 0 : g.forceRecreate) ?? !1;
12
+ import { useEditorStore as C } from "../stores/editor.js";
13
+ import { dynamicContentToMergeTags as $ } from "../utils/genericUtil.js";
14
+ import z from "../package.json.js";
15
+ const ae = (E, l) => {
16
+ const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = j(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, r = [], s = !1) => {
17
+ var g, S, y;
18
+ const e = C(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await T(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, F = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, v = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
18
19
  window.UIEditor.initEditor(
19
20
  document.querySelector("#guido-editor"),
20
21
  {
21
- metadata: y,
22
- html: o,
23
- css: k,
24
- forceRecreate: V,
22
+ metadata: E,
23
+ html: p,
24
+ css: a,
25
+ forceRecreate: v,
25
26
  locale: "en",
26
27
  undoButtonSelector: "#guido__undo-button",
27
28
  redoButtonSelector: "#guido__redo-button",
28
29
  mobileViewButtonSelector: ".guido__view-option-selection-mobile",
29
30
  desktopViewButtonSelector: ".guido__view-option-selection-desktop",
30
31
  codeEditorButtonSelector: "#guido__code-button",
31
- customAppearanceMergetags: !l("liquidSyntax"),
32
+ customAppearanceMergetags: !u("liquidSyntax"),
32
33
  customAppearanceMergetagsBorderColor: "#f1f3fe",
33
34
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
34
35
  customViewStyles: L,
35
- conditionsEnabled: m,
36
- customConditionsEnabled: m,
36
+ conditionsEnabled: f,
37
+ customConditionsEnabled: f,
37
38
  conditionCategories: O,
38
39
  enableXSSSecurity: !0,
39
- modulesDisabled: M,
40
- syncModulesEnabled: n,
40
+ modulesDisabled: F,
41
+ syncModulesEnabled: s,
41
42
  messageSettingsEnabled: !0,
42
43
  displayGmailAnnotations: !0,
43
44
  displayHiddenPreheader: !1,
@@ -45,7 +46,7 @@ const ne = (y, a) => {
45
46
  displayUTM: !1,
46
47
  selectElementAfterDrop: !0,
47
48
  allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
48
- ...u ? { baseBlocks: u } : {},
49
+ ...o ? { baseBlocks: o } : {},
49
50
  editorFonts: {
50
51
  showDefaultStandardFonts: !0,
51
52
  showDefaultNotStandardFonts: !0,
@@ -53,28 +54,28 @@ const ne = (y, a) => {
53
54
  },
54
55
  mergeTags: [
55
56
  {
56
- entries: z(
57
- a.preselectedDynamicContentList,
58
- l("liquidSyntax")
57
+ entries: $(
58
+ l.preselectedDynamicContentList,
59
+ u("liquidSyntax")
59
60
  )
60
61
  }
61
62
  ],
62
63
  async onTokenRefreshRequest(t) {
63
64
  try {
64
- const s = await E();
65
- t(s);
66
- } catch (s) {
67
- c(s, "Failed to refresh token");
65
+ const n = await w();
66
+ t(n);
67
+ } catch (n) {
68
+ m(n, "Failed to refresh token");
68
69
  }
69
70
  },
70
71
  onTemplateLoaded() {
71
72
  try {
72
- const { importCss: t } = U(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: v } = D(), { injectFullStory: A } = R();
73
- t(), s(), A(), v(), a.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
73
+ const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: M } = D(), { injectFullStory: A } = R();
74
+ t(), n(), A(), M(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
74
75
  e.hasChanges = !1;
75
76
  }, 1e3);
76
77
  } catch (t) {
77
- c(t, "Failed to load custom interface appearance");
78
+ m(t, "Failed to load custom interface appearance");
78
79
  }
79
80
  },
80
81
  onCodeEditorVisibilityChanged(t) {
@@ -89,38 +90,39 @@ const ne = (y, a) => {
89
90
  onDataChanged() {
90
91
  e.hasChanges = !0;
91
92
  },
92
- onEvent: b,
93
+ onEvent: B,
93
94
  ignoreClickOutsideSelectors: [
94
95
  "#guido-dynamic-content-modal",
95
96
  ".in-on-board-wrapper",
96
97
  ".in-drawer__container"
97
98
  ],
98
- extensions: F,
99
+ extensions: d,
99
100
  localePatch: H
100
101
  }
101
102
  );
102
- }, _ = (i) => new Promise((r, n) => {
103
+ }, _ = (i) => new Promise((r, s) => {
104
+ var d;
103
105
  if (document.getElementById("UiEditorScript")) {
104
106
  i(), r();
105
107
  return;
106
108
  }
107
- const e = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", o = document.createElement("script");
108
- o.id = "UiEditorScript", o.type = "module", o.src = e, o.onload = () => {
109
+ const e = z.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
110
+ o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
109
111
  i(), r();
110
112
  }, o.onerror = () => {
111
- n(new Error(`Failed to load Stripo UIEditor script from S3: ${e}`));
113
+ s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
112
114
  }, document.body.appendChild(o);
113
115
  });
114
116
  return { initPlugin: async (i) => {
115
117
  await _(async () => {
116
- const r = S(), [n, e] = await Promise.all([
117
- h(),
118
- w()
118
+ const r = C(), [s, e] = await Promise.all([
119
+ b(),
120
+ k()
119
121
  ]);
120
- r.syncModulesEnabled = e, await T(i, n, e);
122
+ r.syncModulesEnabled = e, await V(i, s, e);
121
123
  });
122
124
  } };
123
125
  };
124
126
  export {
125
- ne as useStripo
127
+ ae as useStripo
126
128
  };
@@ -1,41 +1,44 @@
1
- import { usePartner as y } from "../../composables/usePartner.js";
2
- import { LINK_REGEXES as p, LINK_TYPES as S, INSIDER_ID as m, URLS as R } from "../../enums/unsubscribe.js";
3
- import { parsePageList as I } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
- import { useConfigStore as N } from "../../stores/config.js";
5
- import { useDynamicContentStore as U } from "../../stores/dynamic-content.js";
6
- import { useUnsubscribeStore as C } from "../../stores/unsubscribe.js";
7
- const G = [
1
+ import { usePartner as U } from "../../composables/usePartner.js";
2
+ import { LINK_REGEXES as p, PRODUCT_TYPE_URL_SEGMENTS as R, LINK_TYPES as _, INSIDER_ID as m, URLS as y } from "../../enums/unsubscribe.js";
3
+ import { parsePageList as N } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
+ import { useConfigStore as C } from "../../stores/config.js";
5
+ import { useDynamicContentStore as L } from "../../stores/dynamic-content.js";
6
+ import { useUnsubscribeStore as P } from "../../stores/unsubscribe.js";
7
+ import { ProductType as B } from "../../@types/config/schemas.js";
8
+ import "../../@types/config/defaults.js";
9
+ const F = [
8
10
  {
9
11
  id: "add-unsubscribe-link-values",
10
12
  description: "Adding unsubscribe link values",
11
13
  type: "custom",
12
- processor: (t) => {
13
- const { getPartnerName: i } = y(), o = N(), s = U(), d = C(), a = o.variationId;
14
- if (!a)
15
- return t;
16
- let e = t;
17
- const r = `/${i()}/email/${a}?user={{iid}}`, E = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]");
18
- let c = !1, l = !1;
19
- return E.forEach((f) => {
20
- var b;
21
- const u = f.getAttribute("data-unsubscribe-page-list");
14
+ processor: (s) => {
15
+ const { getPartnerName: i } = U(), n = C(), t = L(), E = P(), c = n.variationId;
16
+ if (!c)
17
+ return s;
18
+ const r = R[n.productType] ?? R[B.EMAIL];
19
+ let e = s;
20
+ const d = `/${i()}/${r}/${c}?user={{iid}}`, f = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]");
21
+ let a = !1, l = !1;
22
+ return f.forEach((g) => {
23
+ var S;
24
+ const u = g.getAttribute("data-unsubscribe-page-list");
22
25
  if (!u)
23
26
  return;
24
- const _ = I(u), g = ((b = d.templates) == null ? void 0 : b.filter(
25
- (n) => _.includes(n.id)
27
+ const I = N(u), b = ((S = E.templates) == null ? void 0 : S.filter(
28
+ (o) => I.includes(o.id)
26
29
  )) ?? [];
27
- c = c || g.some((n) => n.type === S.UNSUBSCRIBE_LINK_TYPE), l = l || g.some((n) => n.type === S.PREFERENCES_LINK_TYPE);
28
- }), (c || l) && (s.selectedDynamicContentList.some((u) => u.value === m) || s.selectedDynamicContentList.push({
30
+ a = a || b.some((o) => o.type === _.UNSUBSCRIBE_LINK_TYPE), l = l || b.some((o) => o.type === _.PREFERENCES_LINK_TYPE);
31
+ }), (a || l) && (t.selectedDynamicContentList.some((u) => u.value === m) || t.selectedDynamicContentList.push({
29
32
  text: m,
30
33
  value: m,
31
34
  fallback: ""
32
- })), c && (e = e.replace(
35
+ })), a && (e = e.replace(
33
36
  p.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
34
- R.UNSUBSCRIBE_URL + r
37
+ y.UNSUBSCRIBE_URL + d
35
38
  )), l && (e = e.replace(
36
39
  p.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
37
- R.PREFERENCES_URL + r
38
- )), E.length && (e = e.replace(p.UNSUBSCRIBE_LINK_REGEX, "")), e;
40
+ y.PREFERENCES_URL + d
41
+ )), f.length && (e = e.replace(p.UNSUBSCRIBE_LINK_REGEX, "")), e;
39
42
  },
40
43
  priority: 60
41
44
  },
@@ -52,25 +55,25 @@ const G = [
52
55
  id: "format-comment-braces",
53
56
  description: "Adding spaces around comment braces for proper formatting",
54
57
  type: "custom",
55
- processor: (t) => t.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
58
+ processor: (s) => s.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
56
59
  priority: 62
57
60
  },
58
61
  {
59
62
  id: "add-universal-link-flags",
60
63
  description: "Adding universal link flags",
61
64
  type: "custom",
62
- processor: (t) => {
63
- let i = t;
64
- const o = i.match(/<a[^>]+>(.*?)<\/a>/gm);
65
- return o && o.forEach((s) => {
66
- if (s.includes("insEmail=1"))
65
+ processor: (s) => {
66
+ let i = s;
67
+ const n = i.match(/<a[^>]+>(.*?)<\/a>/gm);
68
+ return n && n.forEach((t) => {
69
+ if (t.includes("insEmail=1"))
67
70
  return;
68
- if (s.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
69
- const a = s.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
70
- const r = e.slice(6, e.length - 1).trim();
71
- return e.includes("?") || e.includes("#") ? r.slice(-1) === "&" ? e.replace(r, `${r}insEmail=1`) : e.replace(r, `${r}&insEmail=1`) : e.replace(r, `${r}?insEmail=1`);
71
+ if (t.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
72
+ const c = t.replace(/href=(["'`”])(.*?)\1/gm, (r) => {
73
+ const e = r.slice(6, r.length - 1).trim();
74
+ return r.includes("?") || r.includes("#") ? e.slice(-1) === "&" ? r.replace(e, `${e}insEmail=1`) : r.replace(e, `${e}&insEmail=1`) : r.replace(e, `${e}?insEmail=1`);
72
75
  });
73
- i = i.replace(s, a);
76
+ i = i.replace(t, c);
74
77
  }
75
78
  }), i;
76
79
  },
@@ -78,5 +81,5 @@ const G = [
78
81
  }
79
82
  ];
80
83
  export {
81
- G as unsubscribeCompilerRules
84
+ F as unsubscribeCompilerRules
82
85
  };
@@ -1,13 +1,13 @@
1
- import { migrateCheckbox as t } from "./checkboxMigrator.js";
2
- import { migrateCouponBlock as o } from "./couponBlockMigrator.js";
3
- import { migrateItemsBlock as i } from "./itemsBlockMigrator.js";
4
- import { migrateRadioButton as e } from "./radioButtonMigrator.js";
5
- import { migrateRecommendation as a } from "./recommendationMigrator.js";
6
- import { migrateUnsubscribe as g } from "./unsubscribeMigrator.js";
7
- const u = async (r) => {
1
+ import { migrateCheckbox as o } from "./checkboxMigrator.js";
2
+ import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
3
+ import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
4
+ import { migrateRadioButton as a } from "./radioButtonMigrator.js";
5
+ import { migrateRecommendation as g } from "./recommendationMigrator.js";
6
+ import { migrateUnsubscribe as n } from "./unsubscribeMigrator.js";
7
+ const b = async (r, t = {}) => {
8
8
  let m = r;
9
- return m = t(m), m = e(m), m = await g(m), m = o(m), m = a(m), m = i(m), m;
9
+ return m = o(m), m = a(m), m = await n(m), m = i(m), m = g(m, t), m = e(m), m;
10
10
  };
11
11
  export {
12
- u as migrate
12
+ b as migrate
13
13
  };
@@ -0,0 +1,98 @@
1
+ import { DEFAULT_COMPOSITION as d, DEFAULT_VISIBILITY as I } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
+ import { ATTR_CUSTOM_PREFIX as l, ATTR_PRODUCT_BUTTON as k, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_OMNIBUS_PRICE as x, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as R, ATTR_PRODUCT_NAME as h, ATTR_PRODUCT_IMAGE as y } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
+ import { mapTextTheme as E, mapButtonTheme as O, mapImageTheme as b } from "./themeMapper.js";
4
+ const C = "__title__", a = "product_attribute.";
5
+ function N(r) {
6
+ const t = r.variable ?? "";
7
+ switch (t) {
8
+ case "p_recommendation_title":
9
+ return { key: C, kind: "title" };
10
+ case "p_image":
11
+ return { key: y, kind: "image" };
12
+ case "p_name":
13
+ return { key: h, kind: "text" };
14
+ case "p_price":
15
+ return { key: R, kind: "text" };
16
+ case "p_original_price":
17
+ return { key: f, kind: "text" };
18
+ case "p_omnibus_price":
19
+ return { key: x, kind: "text" };
20
+ case "p_omnibus_discount":
21
+ return { key: A, kind: "text" };
22
+ case "p_button":
23
+ return { key: k, kind: "button" };
24
+ default:
25
+ if (r.variableType === "p_attribute" || t.startsWith("p_attribute_")) {
26
+ const s = r.value ?? "", o = s.startsWith(a) ? s.slice(a.length) : s;
27
+ return o ? {
28
+ key: `${l}${o}`,
29
+ kind: "custom",
30
+ customAttrName: o,
31
+ customAttrValue: s || `${a}${o}`
32
+ } : null;
33
+ }
34
+ return null;
35
+ }
36
+ }
37
+ function p(r) {
38
+ const t = d.indexOf(r);
39
+ return t === -1 ? Number.POSITIVE_INFINITY : t;
40
+ }
41
+ function S(r) {
42
+ const t = {
43
+ composition: [],
44
+ visibility: { ...I },
45
+ customAttributes: [],
46
+ customAttrValues: {},
47
+ perElementStyles: {},
48
+ anyTextTrimming: !1
49
+ };
50
+ if (!r || r.length === 0)
51
+ return t.composition = [...d], t;
52
+ const s = [];
53
+ r.forEach((e, i) => {
54
+ const n = N(e);
55
+ if (n) {
56
+ if (n.kind === "title") {
57
+ t.titleVariable = e;
58
+ return;
59
+ }
60
+ s.push({
61
+ key: n.key,
62
+ kind: n.kind,
63
+ hidden: e.hidden === !0,
64
+ positionIdx: typeof e.positionIdx == "number" ? e.positionIdx : Number.MAX_SAFE_INTEGER,
65
+ legacy: e,
66
+ customAttrName: n.customAttrName,
67
+ customAttrValue: n.customAttrValue,
68
+ originalIndex: i
69
+ });
70
+ }
71
+ }), s.sort((e, i) => {
72
+ if (e.positionIdx !== i.positionIdx)
73
+ return e.positionIdx - i.positionIdx;
74
+ const n = p(e.key), u = p(i.key);
75
+ return n !== u ? n - u : e.originalIndex - i.originalIndex;
76
+ });
77
+ const o = {};
78
+ return s.forEach((e) => {
79
+ const { key: i, kind: n, hidden: u, legacy: m, customAttrName: c, customAttrValue: T } = e;
80
+ switch (t.composition.push(i), t.visibility[i] = !u, n === "custom" && c && T && (t.customAttributes.includes(c) || t.customAttributes.push(c), t.customAttrValues[i] = T), n) {
81
+ case "image":
82
+ o[i] = b(m.theme);
83
+ break;
84
+ case "button":
85
+ o[i] = O(m.theme);
86
+ break;
87
+ case "text":
88
+ case "custom": {
89
+ const _ = E(m.theme);
90
+ o[i] = _, _.textTrimming && (t.anyTextTrimming = !0);
91
+ break;
92
+ }
93
+ }
94
+ }), t.perElementStyles = o, t;
95
+ }
96
+ export {
97
+ S as mapComposition
98
+ };
@@ -0,0 +1,27 @@
1
+ const i = "You May Also Like!";
2
+ function s(r) {
3
+ var e;
4
+ const o = r.querySelector(".ext-recommendation-title");
5
+ if (!o)
6
+ return i;
7
+ const t = (e = o.textContent) == null ? void 0 : e.trim();
8
+ return t && t.length > 0 ? t : i;
9
+ }
10
+ function u(r) {
11
+ const o = [
12
+ r,
13
+ ...Array.from(r.querySelectorAll(".product-card, .ext-recommendation-card"))
14
+ ];
15
+ let t = "";
16
+ return o.some((e) => {
17
+ const n = e.getAttribute("bgcolor");
18
+ if (n && n.trim())
19
+ return t = n.trim(), !0;
20
+ const c = (e.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
21
+ return c && c[1] ? (t = c[1].trim(), !0) : !1;
22
+ }), t;
23
+ }
24
+ export {
25
+ u as extractCardBgColor,
26
+ s as extractTitleText
27
+ };