@useinsider/guido 3.26.0 → 3.27.0-beta.13ad95b

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 (96) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +91 -89
  3. package/dist/@types/display-condition.js +25 -0
  4. package/dist/components/Guido.vue.js +5 -5
  5. package/dist/components/Guido.vue2.js +104 -98
  6. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +17 -0
  7. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +41 -0
  8. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
  9. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +81 -0
  10. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +17 -0
  11. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +45 -0
  12. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +36 -0
  13. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +63 -0
  14. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
  15. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
  16. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +9 -10
  17. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +42 -41
  18. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +5 -5
  19. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +15 -15
  20. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +6 -6
  21. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +28 -27
  22. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +3 -3
  23. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +42 -27
  24. package/dist/composables/useBlocksConfig.js +29 -20
  25. package/dist/composables/useCustomInterfaceAppearance.js +50 -50
  26. package/dist/composables/useDisplayConditions.js +116 -0
  27. package/dist/composables/useFullStoryBridge.js +10 -9
  28. package/dist/composables/useTranslations.js +2 -1
  29. package/dist/config/compiler/utils/itemsCompilerUtils.js +43 -42
  30. package/dist/config/compiler/utils/recommendationCompilerUtils.js +67 -64
  31. package/dist/enums/academy.js +1 -0
  32. package/dist/enums/display-condition.js +12 -0
  33. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +14 -14
  34. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +52 -40
  35. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +15 -15
  36. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +17 -15
  37. package/dist/extensions/Blocks/common-control.js +25 -25
  38. package/dist/extensions/DisplayConditions/bridge.js +25 -0
  39. package/dist/extensions/DisplayConditions/constants.js +26 -0
  40. package/dist/extensions/DisplayConditions/control.js +215 -0
  41. package/dist/extensions/DisplayConditions/display-conditions.css.js +226 -0
  42. package/dist/extensions/DisplayConditions/extension.js +28 -0
  43. package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
  44. package/dist/extensions/DisplayConditions/library.js +30 -0
  45. package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
  46. package/dist/extensions/DynamicContent/dynamic-content.js +15 -17
  47. package/dist/guido.css +1 -1
  48. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
  49. package/dist/node_modules/valibot/dist/index.js +297 -261
  50. package/dist/package.json.js +2 -2
  51. package/dist/services/displayConditionApi.js +39 -0
  52. package/dist/src/@types/config/schemas.d.ts +4 -0
  53. package/dist/src/@types/display-condition.d.ts +61 -0
  54. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
  55. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +2 -0
  56. package/dist/src/components/organisms/display-conditions/DisplayConditionListState.vue.d.ts +18 -0
  57. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
  58. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
  59. package/dist/src/composables/useConfig.d.ts +2 -0
  60. package/dist/src/composables/useDisplayConditions.d.ts +18 -0
  61. package/dist/src/enums/academy.d.ts +1 -0
  62. package/dist/src/enums/display-condition.d.ts +15 -0
  63. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +2 -0
  64. package/dist/src/extensions/Blocks/common-control.d.ts +1 -1
  65. package/dist/src/extensions/DisplayConditions/bridge.d.ts +7 -0
  66. package/dist/src/extensions/DisplayConditions/constants.d.ts +23 -0
  67. package/dist/src/extensions/DisplayConditions/control.d.ts +25 -0
  68. package/dist/src/extensions/{Blocks/_Boilerplate → DisplayConditions}/iconsRegistry.d.ts +1 -1
  69. package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
  70. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
  71. package/dist/src/mock/api/display-conditions.d.ts +2 -0
  72. package/dist/src/services/displayConditionApi.d.ts +8 -0
  73. package/dist/src/stores/config.d.ts +170 -0
  74. package/dist/src/stores/display-condition.d.ts +86 -0
  75. package/dist/src/stores/onboarding.d.ts +1 -0
  76. package/dist/src/utils/displayCondition.d.ts +11 -0
  77. package/dist/src/utils/editorShadowRoot.d.ts +1 -0
  78. package/dist/src/utils/protectTableText.d.ts +2 -0
  79. package/dist/static/styles/variables.css.js +1 -0
  80. package/dist/stores/config.js +13 -6
  81. package/dist/stores/display-condition.js +29 -0
  82. package/dist/stores/onboarding.js +4 -1
  83. package/dist/utils/displayCondition.js +29 -0
  84. package/dist/utils/editorShadowRoot.js +8 -0
  85. package/dist/utils/pairProductVariables.js +29 -28
  86. package/dist/utils/protectTableText.js +22 -0
  87. package/package.json +11 -3
  88. package/dist/src/extensions/Blocks/_Boilerplate/block.d.ts +0 -11
  89. package/dist/src/extensions/Blocks/_Boilerplate/constants/controlIds.d.ts +0 -7
  90. package/dist/src/extensions/Blocks/_Boilerplate/constants/index.d.ts +0 -10
  91. package/dist/src/extensions/Blocks/_Boilerplate/constants/selectors.d.ts +0 -16
  92. package/dist/src/extensions/Blocks/_Boilerplate/control.d.ts +0 -17
  93. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -15
  94. package/dist/src/extensions/Blocks/_Boilerplate/settingsPanel.d.ts +0 -4
  95. package/dist/src/extensions/Blocks/_Boilerplate/template.d.ts +0 -6
  96. /package/dist/src/extensions/{Blocks/_Boilerplate → DisplayConditions}/extension.d.ts +0 -0
@@ -1,6 +1,6 @@
1
- import r from "../extensions/ModulesTabIcons/extension.js";
2
- import { useConfigStore as l } from "../stores/config.js";
3
- const a = {
1
+ import l from "../extensions/ModulesTabIcons/extension.js";
2
+ import { useConfigStore as r } from "../stores/config.js";
3
+ const i = {
4
4
  "amp-accordion": "ampAccordionEnabled",
5
5
  "amp-carousel": "ampCarouselEnabled",
6
6
  "amp-form-controls": "ampFormControlsEnabled",
@@ -14,7 +14,7 @@ const a = {
14
14
  "text-block": "textEnabled",
15
15
  "timer-block": "timerEnabled",
16
16
  "video-block": "videoEnabled"
17
- }, s = {
17
+ }, c = {
18
18
  "dynamic-content": () => import("../extensions/DynamicContent/extension.js"),
19
19
  "checkbox-block": () => import("../extensions/Blocks/Checkbox/extension.js"),
20
20
  "radio-button-block": () => import("../extensions/Blocks/RadioButton/extension.js"),
@@ -22,40 +22,49 @@ const a = {
22
22
  "unsubscribe-block": () => import("../extensions/Blocks/Unsubscribe/extension.js"),
23
23
  "coupon-block": () => import("../extensions/Blocks/CouponBlock/extension.js"),
24
24
  "items-block": () => import("../extensions/Blocks/Items/extension.js")
25
- }, i = (n) => {
25
+ }, b = (n) => {
26
26
  if (!n || !n.length)
27
27
  return {};
28
28
  const t = {};
29
29
  return n.forEach((o) => {
30
- const e = a[o];
30
+ const e = i[o];
31
31
  e && (t[e] = !1);
32
32
  }), t;
33
- }, b = () => [r], m = async (n) => {
34
- const t = b();
33
+ }, m = async ({ externalDisplayConditions: n }) => {
34
+ const t = [l];
35
+ if (n) {
36
+ const o = await import("../extensions/DisplayConditions/extension.js");
37
+ t.push(o.default);
38
+ }
39
+ return t;
40
+ }, d = async (n, t = { externalDisplayConditions: !1 }) => {
41
+ const o = await m(t);
35
42
  if (!n || !n.length)
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;
43
+ return o;
44
+ const e = await Promise.all(
45
+ n.map(async (a) => {
46
+ const s = c[a];
47
+ return s ? (await s()).default : null;
41
48
  })
42
49
  );
43
50
  return [
44
- ...t,
45
- ...o.filter((e) => e !== null)
51
+ ...o,
52
+ ...e.filter((a) => a !== null)
46
53
  ];
47
- }, E = () => {
48
- const n = l();
54
+ }, k = () => {
55
+ const n = r();
49
56
  return {
50
57
  getStripoBlocksConfig: async () => {
51
58
  const o = n.blocks;
52
59
  return {
53
- baseBlocks: i(o == null ? void 0 : o.excludeDefaults),
54
- extensions: await m(o == null ? void 0 : o.includeCustoms)
60
+ baseBlocks: b(o == null ? void 0 : o.excludeDefaults),
61
+ extensions: await d(o == null ? void 0 : o.includeCustoms, {
62
+ externalDisplayConditions: n.externalDisplayConditions
63
+ })
55
64
  };
56
65
  }
57
66
  };
58
67
  };
59
68
  export {
60
- E as useBlocksConfig
69
+ k as useBlocksConfig
61
70
  };
@@ -1,44 +1,46 @@
1
- import p from "../static/assets/icons/filled-arrow-rising.svg.js";
2
- import s from "../static/assets/icons/line-change.svg.js";
3
- import f from "../static/assets/icons/line-delete.svg.js";
4
- import a from "../static/assets/icons/line-info.svg.js";
5
- import c from "../static/assets/icons/line-plus.svg.js";
6
- import l from "../static/styles/base.css.js";
7
- import C from "../static/styles/components/accessibility.css.js";
8
- import d from "../static/styles/components/alert-message.css.js";
9
- import u from "../static/styles/components/amp-block.css.js";
10
- import h from "../static/styles/components/base-input.css.js";
11
- import I from "../static/styles/components/button-group.css.js";
12
- import g from "../static/styles/components/button.css.js";
13
- import w from "../static/styles/components/combobox.css.js";
14
- import y from "../static/styles/components/counter.css.js";
15
- import A from "../static/styles/components/dropdown-menu.css.js";
16
- import $ from "../static/styles/components/loader.css.js";
17
- import b from "../static/styles/components/narrow-panel.css.js";
18
- import B from "../static/styles/components/popup.css.js";
19
- import D from "../static/styles/components/recommendation-strategy.css.js";
20
- import R from "../static/styles/components/skeleton.css.js";
21
- import P from "../static/styles/components/switcher.css.js";
22
- import T from "../static/styles/components/tabs.css.js";
23
- import x from "../static/styles/components/tools.css.js";
24
- import M from "../static/styles/components/version-history.css.js";
25
- import O from "../static/styles/components/wide-panel.css.js";
26
- import V from "../static/styles/variables.css.js";
1
+ import S from "../static/assets/icons/filled-arrow-rising.svg.js";
2
+ import p from "../static/assets/icons/line-change.svg.js";
3
+ import s from "../static/assets/icons/line-delete.svg.js";
4
+ import f from "../static/assets/icons/line-info.svg.js";
5
+ import a from "../static/assets/icons/line-plus.svg.js";
6
+ import c from "../static/styles/base.css.js";
7
+ import l from "../static/styles/components/accessibility.css.js";
8
+ import C from "../static/styles/components/alert-message.css.js";
9
+ import d from "../static/styles/components/amp-block.css.js";
10
+ import u from "../static/styles/components/base-input.css.js";
11
+ import h from "../static/styles/components/button-group.css.js";
12
+ import I from "../static/styles/components/button.css.js";
13
+ import g from "../static/styles/components/combobox.css.js";
14
+ import w from "../static/styles/components/counter.css.js";
15
+ import y from "../static/styles/components/dropdown-menu.css.js";
16
+ import A from "../static/styles/components/loader.css.js";
17
+ import $ from "../static/styles/components/narrow-panel.css.js";
18
+ import b from "../static/styles/components/popup.css.js";
19
+ import B from "../static/styles/components/recommendation-strategy.css.js";
20
+ import D from "../static/styles/components/skeleton.css.js";
21
+ import R from "../static/styles/components/switcher.css.js";
22
+ import P from "../static/styles/components/tabs.css.js";
23
+ import T from "../static/styles/components/tools.css.js";
24
+ import x from "../static/styles/components/version-history.css.js";
25
+ import E from "../static/styles/components/wide-panel.css.js";
26
+ import M from "../static/styles/variables.css.js";
27
+ import { findEditorShadowRoot as O } from "../utils/editorShadowRoot.js";
27
28
  function o(i, r) {
28
29
  return `--guido-icon-${i}: url("data:image/svg+xml,${encodeURIComponent(r.trim())}");`;
29
30
  }
30
- const W = `:host {
31
- ${o("line-change", s)}
32
- ${o("line-delete", f)}
33
- ${o("filled-arrow-rising", p)}
34
- ${o("line-info", a)}
35
- ${o("line-plus", c)}
36
- }`, _ = [
37
- V,
31
+ const V = `:host {
32
+ ${o("line-change", p)}
33
+ ${o("line-delete", s)}
34
+ ${o("filled-arrow-rising", S)}
35
+ ${o("line-info", f)}
36
+ ${o("line-plus", a)}
37
+ }`, W = [
38
+ M,
38
39
  // Must be on top
39
- W,
40
- l,
40
+ V,
41
+ c,
41
42
  // Must be on top
43
+ C,
42
44
  d,
43
45
  u,
44
46
  h,
@@ -49,34 +51,32 @@ const W = `:host {
49
51
  A,
50
52
  $,
51
53
  b,
52
- B,
54
+ D,
53
55
  R,
54
56
  P,
55
57
  T,
56
58
  x,
57
- M,
58
- O,
59
- D,
60
- C
59
+ E,
60
+ B,
61
+ l
61
62
  ].join(`
62
63
 
63
- `), k = 3e4;
64
+ `), _ = 3e4;
64
65
  let e = null;
65
- function q() {
66
- return e || (e = new CSSStyleSheet(), e.replaceSync(_)), e;
66
+ function k() {
67
+ return e || (e = new CSSStyleSheet(), e.replaceSync(W)), e;
67
68
  }
68
- const fo = () => ({ importCss: () => {
69
- const r = q(), S = Date.now() + k, m = () => {
70
- var n;
71
- const t = (n = document.querySelector("ui-editor")) == null ? void 0 : n.shadowRoot;
69
+ const ao = () => ({ importCss: () => {
70
+ const r = k(), n = Date.now() + _, m = () => {
71
+ const t = O();
72
72
  if (t) {
73
73
  t.adoptedStyleSheets.includes(r) || (t.adoptedStyleSheets = [...t.adoptedStyleSheets, r]);
74
74
  return;
75
75
  }
76
- Date.now() < S && requestAnimationFrame(m);
76
+ Date.now() < n && requestAnimationFrame(m);
77
77
  };
78
78
  m();
79
79
  } });
80
80
  export {
81
- fo as useCustomInterfaceAppearance
81
+ ao as useCustomInterfaceAppearance
82
82
  };
@@ -0,0 +1,116 @@
1
+ import { useToaster as M } from "./useToaster.js";
2
+ import { useTranslations as x } from "./useTranslations.js";
3
+ import { ACADEMY_LINKS as L } from "../enums/academy.js";
4
+ import { DisplayConditionSourceType as y, DISPLAY_CONDITION_LIMITS as s, DisplayConditionEvent as I } from "../enums/display-condition.js";
5
+ import { ToasterTypeOptions as l } from "../enums/toaster.js";
6
+ import { useDisplayConditionApi as O } from "../services/displayConditionApi.js";
7
+ import { useConfigStore as q } from "../stores/config.js";
8
+ import { useDisplayConditionStore as P } from "../stores/display-condition.js";
9
+ import { findInvalidCodeFields as Y, nextConditionId as w } from "../utils/displayCondition.js";
10
+ import { escapeHtml as R } from "../utils/htmlEscape.js";
11
+ import { computed as b } from "vue";
12
+ const B = "email-editor.display-conditions", i = B, F = 409, S = (n, m, r) => ({
13
+ id: w(),
14
+ name: n.name.trim(),
15
+ description: n.description.trim(),
16
+ beforeScript: n.codeBefore,
17
+ afterScript: n.codeAfter,
18
+ extraData: JSON.stringify(r === void 0 ? { source: m } : { source: m, savedId: r })
19
+ }), v = (n) => ({
20
+ name: n.name,
21
+ description: n.description,
22
+ codeBefore: n.codeBefore,
23
+ codeAfter: n.codeAfter
24
+ }), ne = () => {
25
+ const n = P(), m = q(), r = O(), o = x(), { showToaster: p } = M(), u = b(
26
+ () => m.isFeatureEnabled("liquidSyntax") ? "liquid" : "pongo"
27
+ ), f = (e) => {
28
+ const t = { condition: e };
29
+ return document.dispatchEvent(new CustomEvent(I.APPLY, { detail: t })), n.close(), t.applied === !0;
30
+ }, D = () => {
31
+ n.view !== "none" && (document.dispatchEvent(new CustomEvent(I.CANCEL)), n.close());
32
+ }, N = (e) => {
33
+ if (e.mode === "select") {
34
+ n.openSelect();
35
+ return;
36
+ }
37
+ n.openCreate(e.mode === "edit" ? e.current : null);
38
+ }, $ = async () => {
39
+ const e = ++n.listRequest;
40
+ n.listStatus = "loading";
41
+ try {
42
+ const t = await r.list(u.value);
43
+ e === n.listRequest && (n.list = t, n.listStatus = "loaded");
44
+ } catch (t) {
45
+ console.warn("Display conditions could not be loaded.", t), e === n.listRequest && (n.listStatus = "error");
46
+ }
47
+ }, h = (e) => {
48
+ const t = {}, d = e.name.trim();
49
+ d ? d.length < s.NAME_MIN ? t.name = o(`${i}.error-name-min`, { min: s.NAME_MIN }) : d.length > s.NAME_MAX && (t.name = o(`${i}.error-name-max`, { max: s.NAME_MAX })) : t.name = o(`${i}.error-name-required`);
50
+ const { DESCRIPTION_MAX: C } = s;
51
+ e.description.trim().length > C && (t.description = o(`${i}.error-description-max`, { max: C }));
52
+ const g = Y(e.codeBefore, e.codeAfter, u.value);
53
+ return ["codeBefore", "codeAfter"].forEach((a) => {
54
+ e[a].trim() ? g.includes(a) ? t[a] = o(`${i}.error-code-invalid`) : e[a].length > s.CODE_MAX && (t[a] = o(`${i}.error-code-max`, { max: s.CODE_MAX })) : t[a] = o(`${i}.error-code-required`);
55
+ }), t;
56
+ }, A = (e, t) => {
57
+ p(e ? { type: l.Success, message: t } : { type: l.Error, message: o("products.something-went-wrong") });
58
+ }, T = (e) => o(
59
+ `${i}.${e}`,
60
+ {
61
+ academyLink: `<a href="${L.EMAIL_DISPLAY_CONDITIONS}" target="_blank" style="color: #0A2ECC; text-decoration: underline;">${o(`${i}.academy`)}</a>`
62
+ }
63
+ ), _ = () => {
64
+ p({ type: l.Error, message: o(`${i}.validation-failed`) });
65
+ }, c = (e) => ({ name: R(e) }), E = (e, t) => {
66
+ e != null && e.authReported || (console.warn(t, e), p({ type: l.Error, message: t }));
67
+ };
68
+ return {
69
+ syntax: u,
70
+ handleOpen: N,
71
+ cancel: D,
72
+ loadList: $,
73
+ validate: h,
74
+ notifyInvalid: _,
75
+ describeWithAcademyLink: T,
76
+ createInline: (e) => {
77
+ A(
78
+ f(S(e, y.INLINE)),
79
+ o(`${i}.created`, c(e.name.trim()))
80
+ );
81
+ },
82
+ createAndSave: async (e) => {
83
+ try {
84
+ const t = await r.create(e, u.value);
85
+ return n.list = [t, ...n.list.filter((d) => d.id !== t.id)], A(
86
+ f(S(v(t), y.SAVED, t.id)),
87
+ o(`${i}.created-and-saved`, c(t.name))
88
+ ), {};
89
+ } catch (t) {
90
+ return (t == null ? void 0 : t.status) === F ? { name: o(`${i}.error-name-exists`) } : (E(t, o(`${i}.save-failed`, c(e.name.trim()))), null);
91
+ }
92
+ },
93
+ select: (e) => {
94
+ A(
95
+ f(S(v(e), y.SAVED, e.id)),
96
+ o(`${i}.applied`, c(e.name))
97
+ );
98
+ },
99
+ deleteSaved: async (e) => {
100
+ try {
101
+ await r.remove(e.id), n.list = n.list.filter((t) => t.id !== e.id), p({
102
+ type: l.Success,
103
+ message: o(`${i}.deleted`, c(e.name))
104
+ });
105
+ } catch (t) {
106
+ E(t, o(`${i}.delete-failed`));
107
+ } finally {
108
+ n.pendingDelete = null;
109
+ }
110
+ }
111
+ };
112
+ };
113
+ export {
114
+ B as DISPLAY_CONDITIONS_TRANS_KEY,
115
+ ne as useDisplayConditions
116
+ };
@@ -1,15 +1,16 @@
1
+ import { findEditorShadowRoot as i } from "../utils/editorShadowRoot.js";
1
2
  import { FULLSTORY_BRIDGE_SCRIPT_URL as s } from "../utils/fullStoryScripts.js";
2
- const l = () => ({ injectFullStory: () => {
3
- var c;
4
- const n = window;
5
- if (typeof n._fs_org != "string" || !n._fs_org)
3
+ const d = () => ({ injectFullStory: () => {
4
+ var n;
5
+ const e = window;
6
+ if (typeof e._fs_org != "string" || !e._fs_org)
6
7
  return;
7
- const e = document.querySelector("ui-editor"), o = (c = e == null ? void 0 : e.shadowRoot) == null ? void 0 : c.querySelector("iframe"), r = o == null ? void 0 : o.contentDocument;
8
- if (!r || r.querySelector('script[data-fullstory-bridge="true"]'))
8
+ const o = (n = i()) == null ? void 0 : n.querySelector("iframe"), t = o == null ? void 0 : o.contentDocument;
9
+ if (!t || t.querySelector('script[data-fullstory-bridge="true"]'))
9
10
  return;
10
- const t = r.createElement("script");
11
- t.src = s, t.async = !0, t.crossOrigin = "anonymous", t.dataset.fullstoryBridge = "true", r.head.appendChild(t);
11
+ const r = t.createElement("script");
12
+ r.src = s, r.async = !0, r.crossOrigin = "anonymous", r.dataset.fullstoryBridge = "true", t.head.appendChild(r);
12
13
  } });
13
14
  export {
14
- l as useFullStoryBridge
15
+ d as useFullStoryBridge
15
16
  };
@@ -9,7 +9,8 @@ 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
- (i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), String(l)),
12
+ // A function replacer keeps `$&`, `$$` and `$1` in the value literal.
13
+ (i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), () => String(l)),
13
14
  r
14
15
  ) : r : (console.warn(`Translation key not found: ${t}`), t);
15
16
  };
@@ -1,75 +1,76 @@
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) {
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) {
6
7
  if (!t.includes("vertical-price") || !t.includes("ins-product-cart"))
7
8
  return t;
8
- const s = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), o = new DOMParser().parseFromString(s, "text/html");
9
+ const s = E(t).replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), o = new DOMParser().parseFromString(s, "text/html");
9
10
  let n = !1;
10
- if (o.querySelectorAll(I).forEach((e) => {
11
+ if (o.querySelectorAll(O).forEach((e) => {
11
12
  var d, u;
12
- const r = e.getAttribute("style") || "";
13
- if (!/display\s*:\s*none/i.test(r))
13
+ const i = e.getAttribute("style") || "";
14
+ if (!/display\s*:\s*none/i.test(i))
14
15
  return;
15
16
  const l = e.previousSibling;
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}`);
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}`);
19
20
  }
20
21
  n = !0;
21
22
  }), !n)
22
23
  return t;
23
- const c = s.match(/<!DOCTYPE[^>]*>/i);
24
- return ((c ? `${c[0]}
25
- ` : "") + o.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
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;", "%}"));
26
27
  }
27
- function N(t) {
28
+ function R(t) {
28
29
  if (!t.includes("ins-product-wrapper") && !t.includes("ins-product-td"))
29
30
  return t;
30
- const s = new DOMParser().parseFromString(p(t), "text/html");
31
+ const s = new DOMParser().parseFromString(h(E(t)), "text/html");
31
32
  let o = !1;
32
- if (s.querySelectorAll(h).forEach((i) => {
33
- const e = i.getAttribute("style") || "";
34
- if (!E(e) && !f(i.getAttribute("width")))
33
+ if (s.querySelectorAll(_).forEach((r) => {
34
+ const e = r.getAttribute("style") || "";
35
+ if (!p(e) && !f(r.getAttribute("width")))
35
36
  return;
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;
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;
43
44
  }
44
- f(i.getAttribute("width")) && (i.removeAttribute("width"), o = !0);
45
+ f(r.getAttribute("width")) && (r.removeAttribute("width"), o = !0);
45
46
  }), !o)
46
47
  return t;
47
48
  const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
48
49
  ` : "";
49
- return A(c + s.documentElement.outerHTML);
50
+ return m(T(c + s.documentElement.outerHTML));
50
51
  }
51
- function L(t) {
52
+ function x(t) {
52
53
  if (!t.includes("product-image-class"))
53
54
  return t;
54
- const s = new DOMParser().parseFromString(p(t), "text/html");
55
+ const s = new DOMParser().parseFromString(h(E(t)), "text/html");
55
56
  let o = !1;
56
- if (s.querySelectorAll(O).forEach((i) => {
57
+ if (s.querySelectorAll(g).forEach((r) => {
57
58
  var u, a;
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))
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))
60
61
  return;
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;
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;
63
64
  }), !o)
64
65
  return t;
65
66
  const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
66
67
  ` : "";
67
- return A(c + s.documentElement.outerHTML);
68
+ return m(T(c + s.documentElement.outerHTML));
68
69
  }
69
70
  export {
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
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
75
76
  };