@useinsider/guido 3.24.0-beta.adaba3e → 3.24.0-beta.e2e5de9

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 (78) hide show
  1. package/README.md +6 -2
  2. package/dist/@types/config/schemas.js +37 -39
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +92 -98
  5. package/dist/composables/useActionsApi.js +2 -2
  6. package/dist/composables/useBlocksConfig.js +20 -31
  7. package/dist/composables/useEditorTrackingIds.js +49 -0
  8. package/dist/composables/useHtmlCompiler.js +2 -0
  9. package/dist/composables/useStripo.js +70 -70
  10. package/dist/composables/useTranslations.js +1 -2
  11. package/dist/config/compiler/htmlCompilerRules.js +14 -6
  12. package/dist/config/compiler/utils/itemsCompilerUtils.js +42 -43
  13. package/dist/config/compiler/utils/recommendationCompilerUtils.js +64 -67
  14. package/dist/enums/academy.js +0 -1
  15. package/dist/guido.css +1 -1
  16. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
  17. package/dist/node_modules/valibot/dist/index.js +261 -297
  18. package/dist/package.json.js +5 -5
  19. package/dist/src/@types/config/schemas.d.ts +0 -4
  20. package/dist/src/composables/useConfig.d.ts +0 -2
  21. package/dist/src/composables/useEditorTrackingIds.d.ts +7 -0
  22. package/dist/src/composables/useStripo.d.ts +1 -1
  23. package/dist/src/enums/academy.d.ts +0 -1
  24. package/dist/src/stores/config.d.ts +0 -167
  25. package/dist/src/utils/linkTrackingIds.d.ts +24 -22
  26. package/dist/src/utils/trimHrefWhitespace.d.ts +5 -0
  27. package/dist/stores/config.js +6 -13
  28. package/dist/utils/linkTrackingIds.js +72 -72
  29. package/dist/utils/pairProductVariables.js +29 -30
  30. package/dist/utils/templatePreparation.js +59 -72
  31. package/dist/utils/trimHrefWhitespace.js +10 -0
  32. package/package.json +1 -1
  33. package/dist/@types/display-condition.js +0 -25
  34. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -18
  35. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -41
  36. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
  37. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -81
  38. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -34
  39. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -63
  40. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
  41. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
  42. package/dist/composables/useDisplayConditions.js +0 -117
  43. package/dist/enums/display-condition.js +0 -12
  44. package/dist/extensions/DisplayConditions/bridge.js +0 -25
  45. package/dist/extensions/DisplayConditions/constants.js +0 -17
  46. package/dist/extensions/DisplayConditions/control.js +0 -200
  47. package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -201
  48. package/dist/extensions/DisplayConditions/extension.js +0 -28
  49. package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
  50. package/dist/extensions/DisplayConditions/library.js +0 -30
  51. package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
  52. package/dist/extensions/LinkTracking/extension.js +0 -17
  53. package/dist/extensions/LinkTracking/writer.js +0 -41
  54. package/dist/services/displayConditionApi.js +0 -39
  55. package/dist/src/@types/display-condition.d.ts +0 -59
  56. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
  57. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +0 -2
  58. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
  59. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
  60. package/dist/src/composables/useDisplayConditions.d.ts +0 -18
  61. package/dist/src/enums/display-condition.d.ts +0 -15
  62. package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -7
  63. package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -14
  64. package/dist/src/extensions/DisplayConditions/control.d.ts +0 -25
  65. package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
  66. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
  67. package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
  68. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
  69. package/dist/src/extensions/LinkTracking/extension.d.ts +0 -2
  70. package/dist/src/extensions/LinkTracking/writer.d.ts +0 -13
  71. package/dist/src/mock/api/display-conditions.d.ts +0 -2
  72. package/dist/src/services/displayConditionApi.d.ts +0 -8
  73. package/dist/src/stores/display-condition.d.ts +0 -84
  74. package/dist/src/utils/displayCondition.d.ts +0 -11
  75. package/dist/src/utils/protectTableText.d.ts +0 -2
  76. package/dist/stores/display-condition.js +0 -29
  77. package/dist/utils/displayCondition.js +0 -26
  78. package/dist/utils/protectTableText.js +0 -22
@@ -1,7 +1,6 @@
1
- import s from "../extensions/LinkTracking/extension.js";
2
- import l from "../extensions/ModulesTabIcons/extension.js";
3
- import { useConfigStore as r } from "../stores/config.js";
4
- const c = {
1
+ import r from "../extensions/ModulesTabIcons/extension.js";
2
+ import { useConfigStore as l } from "../stores/config.js";
3
+ const a = {
5
4
  "amp-accordion": "ampAccordionEnabled",
6
5
  "amp-carousel": "ampCarouselEnabled",
7
6
  "amp-form-controls": "ampFormControlsEnabled",
@@ -15,7 +14,7 @@ const c = {
15
14
  "text-block": "textEnabled",
16
15
  "timer-block": "timerEnabled",
17
16
  "video-block": "videoEnabled"
18
- }, b = {
17
+ }, s = {
19
18
  "dynamic-content": () => import("../extensions/DynamicContent/extension.js"),
20
19
  "checkbox-block": () => import("../extensions/Blocks/Checkbox/extension.js"),
21
20
  "radio-button-block": () => import("../extensions/Blocks/RadioButton/extension.js"),
@@ -23,50 +22,40 @@ const c = {
23
22
  "unsubscribe-block": () => import("../extensions/Blocks/Unsubscribe/extension.js"),
24
23
  "coupon-block": () => import("../extensions/Blocks/CouponBlock/extension.js"),
25
24
  "items-block": () => import("../extensions/Blocks/Items/extension.js")
26
- }, m = (n) => {
25
+ }, i = (n) => {
27
26
  if (!n || !n.length)
28
27
  return {};
29
28
  const t = {};
30
29
  return n.forEach((o) => {
31
- const e = c[o];
30
+ const e = a[o];
32
31
  e && (t[e] = !1);
33
32
  }), t;
34
- }, d = async ({ externalDisplayConditions: n, linkTrackingIds: t }) => {
35
- const o = [l];
36
- if (n) {
37
- const e = await import("../extensions/DisplayConditions/extension.js");
38
- o.push(e.default);
39
- }
40
- return t && o.push(s), o;
41
- }, p = async (n, t = { externalDisplayConditions: !1, linkTrackingIds: !1 }) => {
42
- const o = await d(t);
33
+ }, b = () => [r], m = async (n) => {
34
+ const t = b();
43
35
  if (!n || !n.length)
44
- return o;
45
- const e = await Promise.all(
46
- n.map(async (i) => {
47
- const a = b[i];
48
- return a ? (await a()).default : null;
36
+ return t;
37
+ const o = await Promise.all(
38
+ n.map(async (e) => {
39
+ const c = s[e];
40
+ return c ? (await c()).default : null;
49
41
  })
50
42
  );
51
43
  return [
52
- ...o,
53
- ...e.filter((i) => i !== null)
44
+ ...t,
45
+ ...o.filter((e) => e !== null)
54
46
  ];
55
- }, g = () => {
56
- const n = r();
47
+ }, E = () => {
48
+ const n = l();
57
49
  return {
58
50
  getStripoBlocksConfig: async () => {
59
51
  const o = n.blocks;
60
52
  return {
61
- baseBlocks: m(o == null ? void 0 : o.excludeDefaults),
62
- extensions: await p(o == null ? void 0 : o.includeCustoms, {
63
- externalDisplayConditions: n.externalDisplayConditions,
64
- linkTrackingIds: n.isFeatureEnabled("linkTrackingIds")
65
- })
53
+ baseBlocks: i(o == null ? void 0 : o.excludeDefaults),
54
+ extensions: await m(o == null ? void 0 : o.includeCustoms)
66
55
  };
67
56
  }
68
57
  };
69
58
  };
70
59
  export {
71
- g as useBlocksConfig
60
+ E as useBlocksConfig
72
61
  };
@@ -0,0 +1,49 @@
1
+ import { TRACK_ID_ATTRIBUTE as u, writeAnchorTrackIds as I, TRACK_SEQ_ATTRIBUTE as f, planTrackingIds as h, parseTrackSeq as w, readAnchorTrackIds as k } from "../utils/linkTrackingIds.js";
2
+ import { getEditorApi as A } from "../utils/stripoEditorApi.js";
3
+ import { ModificationDescription as x } from "../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
4
+ function T(t, r = []) {
5
+ const o = t.getType();
6
+ if (o === "comment") {
7
+ const e = t.getTextContent() ?? "", i = k(e);
8
+ return i.length && r.push({ kind: "comment", node: t, text: e, rawIds: i }), r;
9
+ }
10
+ if (o === "element") {
11
+ const e = t;
12
+ e.getTagName().toLowerCase() === "a" && r.push({ kind: "element", node: e, rawIds: [e.getAttribute(u) ?? ""] });
13
+ }
14
+ return t.childNodes().forEach((e) => T(e, r)), r;
15
+ }
16
+ function y(t, r) {
17
+ if (!t)
18
+ throw new Error("The editor exposes no editorCopilotApi.");
19
+ const o = t.getDocumentRootHtmlNode(), e = o.querySelector("body");
20
+ if (!e)
21
+ throw new Error("The editor document has no <body> to record tracking ids on.");
22
+ const i = T(o), s = h(
23
+ i.flatMap((d) => d.rawIds),
24
+ w(e.getAttribute(f)),
25
+ r
26
+ );
27
+ return { api: t, seqHost: e, hosts: i, plan: s };
28
+ }
29
+ const H = () => ({ writeTrackingIds: (r) => {
30
+ const { editorCopilotApi: o } = A();
31
+ let e;
32
+ try {
33
+ e = y(o, r);
34
+ } catch (n) {
35
+ return console.warn("Tracking ids skipped for this save:", n), { changed: !1, nextSeq: r };
36
+ }
37
+ const { api: i, seqHost: s, hosts: d, plan: c } = e;
38
+ if (!c.changed)
39
+ return { changed: !1, nextSeq: c.nextSeq };
40
+ const a = i.getTemplateModifier();
41
+ let l = 0;
42
+ return d.forEach((n) => {
43
+ const m = n.rawIds.map((p, g) => c.reassigned[l + g] ? c.ids[l + g] : null);
44
+ l += n.rawIds.length, !m.every((p) => p === null) && (n.kind === "element" ? a.modifyHtml(n.node).setAttribute(u, String(m[0])) : a.modifyHtml(n.node).replaceWith(`<!--${I(n.text, m)}-->`));
45
+ }), a.modifyHtml(s).setAttribute(f, String(c.nextSeq)), a.apply(new x("Updated Insider tracking IDs").asHidden()), { changed: !0, nextSeq: c.nextSeq };
46
+ } });
47
+ export {
48
+ H as useEditorTrackingIds
49
+ };
@@ -16,6 +16,8 @@ const x = /* @__PURE__ */ new Set([
16
16
  "fix-tags-end",
17
17
  // Unwrap translate-injected <font dir="auto"> tags — pure removal, never emits AMP-forbidden output.
18
18
  "strip-font-tags",
19
+ // Trim whitespace inside href values — attribute-value edit only, emits nothing new.
20
+ "trim-href-whitespace",
19
21
  // Image domain corrections — plain string replacement.
20
22
  "replace-old-image-domain",
21
23
  "replace-old-v2-image-domain",
@@ -1,54 +1,54 @@
1
- import { useActionsApi as M } from "./useActionsApi.js";
2
- import { useBlocksConfig as N } from "./useBlocksConfig.js";
3
- import { useConfig as j } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as _ } from "./useCustomInterfaceAppearance.js";
5
- import { useFullStoryBridge as z } from "./useFullStoryBridge.js";
6
- import { useModuleRepair as $ } from "./useModuleRepair.js";
7
- import { useStripoEventHandler as G } from "./useStripoEventHandler.js";
8
- import { useStripoNotifications as X } from "./useStripoNotifications.js";
9
- import { useToaster as J } from "./useToaster.js";
10
- import { localePatch as K } from "../config/i18n/index.js";
1
+ import { useActionsApi as N } from "./useActionsApi.js";
2
+ import { useBlocksConfig as j } from "./useBlocksConfig.js";
3
+ import { useConfig as z } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as v } from "./useCustomInterfaceAppearance.js";
5
+ import { useFullStoryBridge as $ } from "./useFullStoryBridge.js";
6
+ import { useModuleRepair as G } from "./useModuleRepair.js";
7
+ import { useStripoEventHandler as X } from "./useStripoEventHandler.js";
8
+ import { useStripoNotifications as J } from "./useStripoNotifications.js";
9
+ import { useToaster as K } from "./useToaster.js";
10
+ import { localePatch as Q } from "../config/i18n/index.js";
11
11
  import { en as B } from "../config/i18n/en/index.js";
12
- import { ToasterTypeOptions as Q } from "../enums/toaster.js";
13
- import { useStripoApi as W } from "../services/stripoApi.js";
14
- import Y from "../static/styles/customEditorStyle.css.js";
15
- import { useEditorStore as v } from "../stores/editor.js";
16
- import { buildMergeTagEntries as Z, flattenDynamicContentList as ee } from "../utils/genericUtil.js";
17
- import { getStripoRuntimeBaseUrl as te } from "../utils/stripoRuntime.js";
18
- let d = null, T = !1;
19
- const we = (e) => {
20
- const { features: u, template: m, isFeatureEnabled: p } = j(), { handleError: f, showToaster: F } = J(), { getToken: A, getCustomFonts: P, getSyncModulesStatus: R } = W(), { handleEvent: U } = G(), { handleModuleAdd: V } = $(), { getStripoBlocksConfig: D } = N(), { getStripoNotifications: I } = X(), g = () => d || (d = new Promise((a, s) => {
12
+ import { ToasterTypeOptions as W } from "../enums/toaster.js";
13
+ import { useStripoApi as Y } from "../services/stripoApi.js";
14
+ import Z from "../static/styles/customEditorStyle.css.js";
15
+ import { useEditorStore as T } from "../stores/editor.js";
16
+ import { buildMergeTagEntries as ee, flattenDynamicContentList as te } from "../utils/genericUtil.js";
17
+ import { getStripoRuntimeBaseUrl as oe } from "../utils/stripoRuntime.js";
18
+ let d = null, F = !1;
19
+ const ke = (t) => {
20
+ const { features: u, template: m, isFeatureEnabled: p } = z(), { handleError: f, showToaster: A } = K(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: U } = Y(), { handleEvent: V } = X(), { handleModuleAdd: D } = G(), { getStripoBlocksConfig: I } = j(), { getStripoNotifications: L } = J(), g = () => d || (d = new Promise((n, a) => {
21
21
  if (document.getElementById("UiEditorScript")) {
22
- a();
22
+ n();
23
23
  return;
24
24
  }
25
- const i = te();
25
+ const i = oe();
26
26
  if (!i) {
27
- s(
27
+ a(
28
28
  new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
29
29
  );
30
30
  return;
31
31
  }
32
- const n = `${i}UIEditor.js`, t = document.createElement("script");
33
- t.id = "UiEditorScript", t.type = "module", t.src = n, t.onload = () => {
34
- T = !0, a();
35
- }, t.onerror = () => {
36
- t.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${n}`));
37
- }, document.body.appendChild(t);
32
+ const s = `${i}UIEditor.js`, e = document.createElement("script");
33
+ e.id = "UiEditorScript", e.type = "module", e.src = s, e.onload = () => {
34
+ F = !0, n();
35
+ }, e.onerror = () => {
36
+ e.remove(), a(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
37
+ }, document.body.appendChild(e);
38
38
  }), d.catch(() => {
39
39
  d = null;
40
- }), d), L = async (a, s, i, n = [], t = !1) => {
41
- var C, w, k, b;
42
- const o = v(), { html: c, css: S } = a, { baseBlocks: y, extensions: q } = await D();
43
- e.mark("blocks_config_ready");
44
- const E = ((C = u.value) == null ? void 0 : C.displayConditions) ?? !0, x = ((w = u.value) == null ? void 0 : w.modulesDisabled) ?? !1, h = !!c || (((k = m.value) == null ? void 0 : k.forceRecreate) ?? !1), O = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
45
- e.setTemplate({ html: c, css: S, forceRecreate: h }), _().importCss(), e.mark("init_editor"), await window.UIEditor.initEditor(
40
+ }), d), q = async (n, a, i, s = [], e = !1, c = !1) => {
41
+ var w, k, b, _;
42
+ const o = T(), { html: S, css: y } = n, { baseBlocks: E, extensions: x } = await I();
43
+ t.mark("blocks_config_ready");
44
+ const h = ((w = u.value) == null ? void 0 : w.displayConditions) ?? !0, O = ((k = u.value) == null ? void 0 : k.modulesDisabled) ?? !1, C = c || (((b = m.value) == null ? void 0 : b.forceRecreate) ?? !1), H = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
45
+ t.setTemplate({ html: S, css: y, forceRecreate: C }), v().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
46
46
  document.querySelector("#guido-editor"),
47
47
  {
48
- metadata: s,
49
- html: c,
50
- css: S,
51
- forceRecreate: h,
48
+ metadata: a,
49
+ html: S,
50
+ css: y,
51
+ forceRecreate: C,
52
52
  locale: "en",
53
53
  undoButtonSelector: "#guido__undo-button",
54
54
  redoButtonSelector: "#guido__redo-button",
@@ -58,12 +58,12 @@ const we = (e) => {
58
58
  customAppearanceMergetags: !p("liquidSyntax"),
59
59
  customAppearanceMergetagsBorderColor: "#f1f3fe",
60
60
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
61
- customViewStyles: Y,
62
- conditionsEnabled: E,
63
- customConditionsEnabled: E,
61
+ customViewStyles: Z,
62
+ conditionsEnabled: h,
63
+ customConditionsEnabled: h,
64
64
  enableXSSSecurity: !0,
65
- modulesDisabled: x,
66
- syncModulesEnabled: t,
65
+ modulesDisabled: O,
66
+ syncModulesEnabled: e,
67
67
  messageSettingsEnabled: !0,
68
68
  displayGmailAnnotations: !0,
69
69
  displayHiddenPreheader: !1,
@@ -73,37 +73,37 @@ const we = (e) => {
73
73
  copyPasteEnabled: !1,
74
74
  selectElementAfterDrop: !0,
75
75
  sameFontSizeForOutlook: !0,
76
- allowedScriptSourceDomains: O,
77
- ...y ? { baseBlocks: y } : {},
76
+ allowedScriptSourceDomains: H,
77
+ ...E ? { baseBlocks: E } : {},
78
78
  editorFonts: {
79
79
  showDefaultStandardFonts: !0,
80
80
  showDefaultNotStandardFonts: !0,
81
- customFonts: n
81
+ customFonts: s
82
82
  },
83
83
  mergeTags: [
84
84
  {
85
- entries: Z(
85
+ entries: ee(
86
86
  i.preselectedDynamicContentList,
87
- ee((b = m.value) == null ? void 0 : b.dynamicContentList),
87
+ te((_ = m.value) == null ? void 0 : _.dynamicContentList),
88
88
  p("liquidSyntax")
89
89
  )
90
90
  }
91
91
  ],
92
92
  async onTokenRefreshRequest(r) {
93
93
  try {
94
- e.mark("token_start");
95
- const l = await A();
96
- e.mark("token_end"), r(l);
94
+ t.mark("token_start");
95
+ const l = await P();
96
+ t.mark("token_end"), r(l);
97
97
  } catch (l) {
98
98
  f(l, "Failed to refresh token");
99
99
  }
100
100
  },
101
101
  onTemplateLoaded() {
102
102
  try {
103
- const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = M(), { injectFullStory: H } = z();
104
- _().importCss(), r(), H(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
103
+ const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = N(), { injectFullStory: M } = $();
104
+ v().importCss(), r(), M(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
105
105
  o.hasChanges = !1;
106
- }, 1e3), e.markReady();
106
+ }, 1e3), t.markReady();
107
107
  } catch (r) {
108
108
  f(r, "Failed to load custom interface appearance");
109
109
  }
@@ -120,9 +120,9 @@ const we = (e) => {
120
120
  onDataChanged() {
121
121
  o.hasChanges = !0, o.changeSeq += 1;
122
122
  },
123
- onEvent: U,
124
- onModuleAdd: V,
125
- notifications: I(),
123
+ onEvent: V,
124
+ onModuleAdd: D,
125
+ notifications: L(),
126
126
  // Stripo deselects the block on any click outside the canvas, so every surface
127
127
  // that belongs to the block's own flow has to be listed here (SD-153273).
128
128
  ignoreClickOutsideSelectors: [
@@ -132,29 +132,29 @@ const we = (e) => {
132
132
  ".in-modal-v2-wrapper",
133
133
  ".in-toasts-wrapper"
134
134
  ],
135
- extensions: q,
136
- localePatch: K
135
+ extensions: x,
136
+ localePatch: Q
137
137
  }
138
138
  );
139
139
  };
140
- return { initPlugin: async (a, s, i) => {
141
- const n = v();
140
+ return { initPlugin: async (n, a, i, s = !1) => {
141
+ const e = T();
142
142
  try {
143
- e.mark("plugin_start"), e.setScriptPreloaded(T), await g(), e.mark("script_ready");
144
- const [t, o] = await Promise.all([
145
- P(),
146
- R()
143
+ t.mark("plugin_start"), t.setScriptPreloaded(F), await g(), t.mark("script_ready");
144
+ const [c, o] = await Promise.all([
145
+ R(),
146
+ U()
147
147
  ]);
148
- e.mark("fonts_sync_ready"), n.syncModulesEnabled = o, await L(a, s, i, t, o);
148
+ t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await q(n, a, i, c, o, s);
149
149
  } catch {
150
- n.loadingStatus = !1, F({
151
- type: Q.Error,
150
+ e.loadingStatus = !1, A({
151
+ type: W.Error,
152
152
  message: B["An error has occurred. Please report the error code to support."],
153
153
  actionButton: {
154
154
  text: B["Reload page"],
155
155
  onClick: () => window.location.reload()
156
156
  }
157
- }), e.markFailed();
157
+ }), t.markFailed();
158
158
  }
159
159
  }, preloadRuntime: () => {
160
160
  g().catch(() => {
@@ -162,5 +162,5 @@ const we = (e) => {
162
162
  } };
163
163
  };
164
164
  export {
165
- we as useStripo
165
+ ke as useStripo
166
166
  };
@@ -9,8 +9,7 @@ const useTranslations = () => {
9
9
  var s;
10
10
  const r = (s = translations.value) == null ? void 0 : s[t];
11
11
  return r ? n ? Object.entries(n).reduce(
12
- // A function replacer keeps `$&`, `$$` and `$1` in the value literal.
13
- (i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), () => String(l)),
12
+ (i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), String(l)),
14
13
  r
15
14
  ) : r : (console.warn(`Translation key not found: ${t}`), t);
16
15
  };
@@ -1,5 +1,6 @@
1
- import { stripFontTags as p } from "../../utils/stripFontTags.js";
2
- const d = [
1
+ import { stripFontTags as c } from "../../utils/stripFontTags.js";
2
+ import { trimHrefWhitespace as l } from "../../utils/trimHrefWhitespace.js";
3
+ const f = [
3
4
  {
4
5
  id: "fix-url-encoding-start",
5
6
  description: "Replace {%22 with %7B%22 to fix URL encoding",
@@ -58,9 +59,16 @@ const d = [
58
59
  id: "strip-font-tags",
59
60
  description: 'Unwrap browser-translate-injected <font dir="auto"> tags, keeping inner content; other <font> elements are left intact.',
60
61
  type: "custom",
61
- processor: (e) => p(e),
62
+ processor: (e) => c(e),
62
63
  priority: 15
63
64
  },
65
+ {
66
+ id: "trim-href-whitespace",
67
+ description: "Trim leading/trailing whitespace and &nbsp; from every href value",
68
+ type: "custom",
69
+ processor: (e) => l(e),
70
+ priority: 16
71
+ },
64
72
  {
65
73
  id: "remove-apty-iframe",
66
74
  description: "Cleanup Apty Iframe Code",
@@ -157,8 +165,8 @@ const d = [
157
165
  processor: (e) => {
158
166
  const t = (i) => i.toString(16).padStart(2, "0");
159
167
  return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, n, r) => {
160
- const [s, a, c] = [Number(o), Number(n), Number(r)];
161
- return s > 255 || a > 255 || c > 255 ? i : `#${t(s)}${t(a)}${t(c)}`;
168
+ const [s, a, p] = [Number(o), Number(n), Number(r)];
169
+ return s > 255 || a > 255 || p > 255 ? i : `#${t(s)}${t(a)}${t(p)}`;
162
170
  }).replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3\b/gi, "#$1$2$3");
163
171
  },
164
172
  priority: 44
@@ -200,5 +208,5 @@ const d = [
200
208
  }
201
209
  ];
202
210
  export {
203
- d as defaultHtmlCompilerRules
211
+ f as defaultHtmlCompilerRules
204
212
  };
@@ -1,76 +1,75 @@
1
- import { PRODUCT_WRAPPER_SELECTOR as _, hasZeroWidthDeclaration as p, isZeroWidthValue as f, withWidthPin as y, PRODUCT_TD_SELECTOR as D, withoutZeroWidth as S } from "../../../extensions/Blocks/Items/constants/cardWidth.js";
2
- import { DefaultConfigValues as M } from "../../../extensions/Blocks/Items/enums/settingsEnums.js";
3
- import { protectLiquid as h, restoreLiquid as T } from "../../../utils/liquidProtection.js";
4
- import { protectTableText as E, restoreTableText as m } from "../../../utils/protectTableText.js";
5
- const A = "MSO_ITEMS_HIDE_START", b = "MSO_ITEMS_HIDE_END", I = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", O = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price", g = ".ins-product-td td.product-image-class img[width]", H = Number(M.productImageWidth);
6
- function P(t) {
1
+ import { PRODUCT_WRAPPER_SELECTOR as h, hasZeroWidthDeclaration as E, isZeroWidthValue as f, withWidthPin as T, PRODUCT_TD_SELECTOR as _, withoutZeroWidth as y } from "../../../extensions/Blocks/Items/constants/cardWidth.js";
2
+ import { DefaultConfigValues as D } from "../../../extensions/Blocks/Items/enums/settingsEnums.js";
3
+ import { protectLiquid as p, restoreLiquid as A } from "../../../utils/liquidProtection.js";
4
+ const m = "MSO_ITEMS_HIDE_START", S = "MSO_ITEMS_HIDE_END", M = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", I = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price", O = ".ins-product-td td.product-image-class img[width]", g = Number(D.productImageWidth);
5
+ function C(t) {
7
6
  if (!t.includes("vertical-price") || !t.includes("ins-product-cart"))
8
7
  return t;
9
- const s = E(t).replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), o = new DOMParser().parseFromString(s, "text/html");
8
+ const s = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), o = new DOMParser().parseFromString(s, "text/html");
10
9
  let n = !1;
11
- if (o.querySelectorAll(O).forEach((e) => {
10
+ if (o.querySelectorAll(I).forEach((e) => {
12
11
  var d, u;
13
- const i = e.getAttribute("style") || "";
14
- if (!/display\s*:\s*none/i.test(i))
12
+ const r = e.getAttribute("style") || "";
13
+ if (!/display\s*:\s*none/i.test(r))
15
14
  return;
16
15
  const l = e.previousSibling;
17
- if (((l == null ? void 0 : l.nodeType) !== Node.COMMENT_NODE || l.data !== A) && ((d = e.parentNode) == null || d.insertBefore(o.createComment(A), e), (u = e.parentNode) == null || u.insertBefore(o.createComment(b), e.nextSibling)), !/mso-hide/i.test(i)) {
18
- const a = i.trim().endsWith(";") ? " " : "; ";
19
- e.setAttribute("style", `${i}${a}${I}`);
16
+ if (((l == null ? void 0 : l.nodeType) !== Node.COMMENT_NODE || l.data !== m) && ((d = e.parentNode) == null || d.insertBefore(o.createComment(m), e), (u = e.parentNode) == null || u.insertBefore(o.createComment(S), e.nextSibling)), !/mso-hide/i.test(r)) {
17
+ const a = r.trim().endsWith(";") ? " " : "; ";
18
+ e.setAttribute("style", `${r}${a}${M}`);
20
19
  }
21
20
  n = !0;
22
21
  }), !n)
23
22
  return t;
24
- const c = s.match(/<!DOCTYPE[^>]*>/i), r = c ? `${c[0]}
25
- ` : "";
26
- return m((r + o.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
23
+ const c = s.match(/<!DOCTYPE[^>]*>/i);
24
+ return ((c ? `${c[0]}
25
+ ` : "") + o.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
27
26
  }
28
- function R(t) {
27
+ function N(t) {
29
28
  if (!t.includes("ins-product-wrapper") && !t.includes("ins-product-td"))
30
29
  return t;
31
- const s = new DOMParser().parseFromString(h(E(t)), "text/html");
30
+ const s = new DOMParser().parseFromString(p(t), "text/html");
32
31
  let o = !1;
33
- if (s.querySelectorAll(_).forEach((r) => {
34
- const e = r.getAttribute("style") || "";
35
- if (!p(e) && !f(r.getAttribute("width")))
32
+ if (s.querySelectorAll(h).forEach((i) => {
33
+ const e = i.getAttribute("style") || "";
34
+ if (!E(e) && !f(i.getAttribute("width")))
36
35
  return;
37
- const i = y(e);
38
- i !== e && (r.setAttribute("style", i), o = !0), f(r.getAttribute("width")) && (r.setAttribute("width", "100%"), o = !0);
39
- }), s.querySelectorAll(D).forEach((r) => {
40
- const e = r.getAttribute("style") || "";
41
- if (p(e)) {
42
- const i = S(e);
43
- i ? r.setAttribute("style", i) : r.removeAttribute("style"), o = !0;
36
+ const r = T(e);
37
+ r !== e && (i.setAttribute("style", r), o = !0), f(i.getAttribute("width")) && (i.setAttribute("width", "100%"), o = !0);
38
+ }), s.querySelectorAll(_).forEach((i) => {
39
+ const e = i.getAttribute("style") || "";
40
+ if (E(e)) {
41
+ const r = y(e);
42
+ r ? i.setAttribute("style", r) : i.removeAttribute("style"), o = !0;
44
43
  }
45
- f(r.getAttribute("width")) && (r.removeAttribute("width"), o = !0);
44
+ f(i.getAttribute("width")) && (i.removeAttribute("width"), o = !0);
46
45
  }), !o)
47
46
  return t;
48
47
  const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
49
48
  ` : "";
50
- return m(T(c + s.documentElement.outerHTML));
49
+ return A(c + s.documentElement.outerHTML);
51
50
  }
52
- function x(t) {
51
+ function L(t) {
53
52
  if (!t.includes("product-image-class"))
54
53
  return t;
55
- const s = new DOMParser().parseFromString(h(E(t)), "text/html");
54
+ const s = new DOMParser().parseFromString(p(t), "text/html");
56
55
  let o = !1;
57
- if (s.querySelectorAll(g).forEach((r) => {
56
+ if (s.querySelectorAll(O).forEach((i) => {
58
57
  var u, a;
59
- const e = ((u = r.getAttribute("width")) == null ? void 0 : u.trim()) ?? "", i = ((a = r.getAttribute("style")) == null ? void 0 : a.trim()) ?? "";
60
- if (!/^\d+$/.test(e) || /(^|;)\s*min-width\s*:/i.test(i))
58
+ const e = ((u = i.getAttribute("width")) == null ? void 0 : u.trim()) ?? "", r = ((a = i.getAttribute("style")) == null ? void 0 : a.trim()) ?? "";
59
+ if (!/^\d+$/.test(e) || /(^|;)\s*min-width\s*:/i.test(r))
61
60
  return;
62
- const l = i && !i.endsWith(";") ? ";" : "", d = Math.min(Number(e), H);
63
- r.setAttribute("style", `${i}${l}min-width:${d}px;max-width:${e}px`), o = !0;
61
+ const l = r && !r.endsWith(";") ? ";" : "", d = Math.min(Number(e), g);
62
+ i.setAttribute("style", `${r}${l}min-width:${d}px;max-width:${e}px`), o = !0;
64
63
  }), !o)
65
64
  return t;
66
65
  const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
67
66
  ` : "";
68
- return m(T(c + s.documentElement.outerHTML));
67
+ return A(c + s.documentElement.outerHTML);
69
68
  }
70
69
  export {
71
- b as MSO_ITEMS_HIDE_END,
72
- A as MSO_ITEMS_HIDE_START,
73
- x as lockHorizontalItemImageWidths,
74
- R as normalizeItemsBlockWidths,
75
- P as wrapHiddenPriceTdsForOutlook
70
+ S as MSO_ITEMS_HIDE_END,
71
+ m as MSO_ITEMS_HIDE_START,
72
+ L as lockHorizontalItemImageWidths,
73
+ N as normalizeItemsBlockWidths,
74
+ C as wrapHiddenPriceTdsForOutlook
76
75
  };