@useinsider/guido 3.2.0-beta.b397787 → 3.2.0-beta.bbb580a

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 (41) hide show
  1. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +8 -10
  2. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +71 -35
  3. package/dist/composables/useActionsApi.js +4 -4
  4. package/dist/composables/useFullStoryBridge.js +9 -12
  5. package/dist/composables/useSave.js +1 -1
  6. package/dist/composables/useStripo.js +21 -20
  7. package/dist/config/compiler/recommendationCompilerRules.js +72 -67
  8. package/dist/config/compiler/utils/recommendationCompilerUtils.js +33 -30
  9. package/dist/config/migrator/recommendationMigrator.js +1 -1
  10. package/dist/enums/date.js +3 -3
  11. package/dist/enums/extensions/recommendationBlock.js +28 -27
  12. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
  13. package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
  14. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  15. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
  16. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
  17. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +6 -6
  18. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
  19. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
  20. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
  21. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
  22. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +29 -25
  23. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +11 -11
  24. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +20 -16
  25. package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
  26. package/dist/guido.css +1 -1
  27. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +324 -218
  28. package/dist/package.json.js +1 -1
  29. package/dist/src/composables/useActionsApi.d.ts +1 -1
  30. package/dist/src/composables/useFullStoryBridge.d.ts +5 -4
  31. package/dist/src/enums/date.d.ts +1 -1
  32. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -0
  33. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  34. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
  35. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
  36. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
  37. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
  38. package/dist/static/styles/components/button.css.js +16 -9
  39. package/dist/static/styles/components/loader.css.js +4 -0
  40. package/dist/static/styles/components/narrow-panel.css.js +52 -0
  41. package/package.json +3 -3
@@ -1,26 +1,24 @@
1
- import r from "./FilterItem.vue2.js";
1
+ import l from "./FilterItem.vue2.js";
2
2
  /* empty css */
3
- import l from "../../../../_virtual/_plugin-vue2_normalizer.js";
3
+ import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
4
  var i = function() {
5
5
  var a = this, e = a._self._c, t = a._self._setupProxy;
6
6
  return e("div", { staticClass: "d-f f-d-c w-1 gap-16", attrs: { "data-filter-group": a.filter.filterGroup, "data-filter-number": a.filter.filterNumber } }, [e("div", { staticClass: "d-f a-i-c j-c-s-b pt-4", class: { "bor-t-s-s bor-t-w-1 bor-t-c-50": a.index === 0 } }, [e("p", [a._v(" " + a._s(t.trans("newsletter.filter")) + " " + a._s(a.index + 1) + " ")]), e(t.InButtonV2, { attrs: { id: "guido__delete-filter-group-button", "left-icon": "line-delete", styling: "text", type: "danger", "label-text-status": !1 }, on: { click: function(s) {
7
7
  return t.emit("delete-filter", t.props.filter);
8
- } } })], 1), e("div", { staticClass: "w-1 d-f a-i-s j-c-s-b gap-16" }, [e(t.InSelect, { staticClass: "w-2", attrs: { "disabled-status": "", "search-status": "", "button-status": !1, "label-text": t.trans("action-builder.filter-type"), options: t.filterTypeOptions, value: [t.filterTypeOptions[0]] } }), e(t.InSelect, { staticClass: "w-2", attrs: { id: "filter-item-input--attribute-type", "search-status": "", "static-position": "bottom right", "button-status": !1, "label-text": t.trans("condition.attribute"), options: t.store.getFilterList, state: t.getFieldState("attribute"), value: [t.selectedAttributeType] }, on: { select: t.handleAttributeChange } })], 1), e("div", { staticClass: "w-1 d-f a-i-s j-c-s-b gap-16" }, [t.isBooleanAttribute ? e(t.InSelect, { staticClass: "w-2", attrs: { "button-status": !1, "label-text": t.trans("condition.operator"), options: t.booleanValueOptions, state: t.getFieldState("value"), value: [t.selectedBooleanValue] }, on: { select: t.handleBooleanValueChange } }) : [e(t.InSelect, { staticClass: "w-2", attrs: { "button-status": !1, "label-text": t.trans("condition.operator"), options: t.getOperatorOptions(t.selectedAttributeType.type), state: t.getFieldState("operator"), value: [t.selectedOperatorType] }, on: { select: function(s) {
9
- return t.updateFilter({ text: "operator", value: s.value });
10
- } } }), e(t.InBasicTextInput, { staticClass: "w-2", attrs: { id: "filter-item-input--value", name: "imageUrl", "character-counter-status": !1, "label-text": t.trans("condition.value"), "max-character-length": 25, "placeholder-text": t.trans("condition.enter-value-placeholder"), "state-message": t.valueErrorMessage, states: t.getFieldState("value"), "tooltip-status": !1, type: t.valueInputType, value: decodeURIComponent(t.props.filter.value) }, on: { input: function(s) {
8
+ } } })], 1), e("div", { staticClass: "w-1 d-f a-i-s j-c-s-b gap-16" }, [e(t.InSelect, { staticClass: "w-2", attrs: { "disabled-status": "", "search-status": "", "button-status": !1, "label-text": t.trans("action-builder.filter-type"), options: t.filterTypeOptions, value: [t.filterTypeOptions[0]] } }), e(t.InSelect, { staticClass: "w-2", attrs: { id: "filter-item-input--attribute-type", "search-status": "", "static-position": "bottom right", "button-status": !1, "label-text": t.trans("condition.attribute"), options: t.store.getFilterList, state: t.getFieldState("attribute"), value: [t.selectedAttributeType] }, on: { select: t.handleAttributeChange } })], 1), e("div", { staticClass: "w-1 d-f a-i-s j-c-s-b gap-16" }, [t.isBooleanAttribute ? e(t.InSelect, { staticClass: "w-2", attrs: { "button-status": !1, "label-text": t.trans("condition.operator"), options: t.booleanValueOptions, state: t.getFieldState("value"), value: [t.selectedBooleanValue] }, on: { select: t.handleBooleanValueChange } }) : [e(t.InSelect, { staticClass: "w-2", attrs: { "button-status": !1, "label-text": t.trans("condition.operator"), options: t.getOperatorOptions(t.selectedAttributeType.type), state: t.getFieldState("operator"), value: [t.selectedOperatorType] }, on: { select: t.handleOperatorChange } }), t.isAnyOfOperator ? e(t.InTags, { staticClass: "w-2", attrs: { "allow-bulk-paste": "", validate: "text", "allow-duplicates": !1, invalid: t.invalidFields.has("value"), "invalid-message": t.valueErrorMessage, label: t.trans("condition.value"), placeholder: t.trans("condition.enter-value-placeholder"), value: t.tagValues }, on: { input: t.onTagsInput } }) : t.isDateAttribute ? e(t.InDatePickerV2, { staticClass: "w-2", attrs: { id: "filter-item-input--value", "single-date-picker-status": "", name: "filter-item-input--value", "label-text": t.trans("condition.value"), locale: t.datePickerLocale, "placeholder-text": t.trans("condition.enter-value-placeholder"), state: t.getFieldState("value"), "state-message": t.valueErrorMessage, value: t.datePickerValue }, on: { apply: t.onDatePickerApply } }) : e(t.InBasicTextInput, { staticClass: "w-2", attrs: { id: "filter-item-input--value", name: "imageUrl", "character-counter-status": !1, "label-text": t.trans("condition.value"), "max-character-length": 25, "placeholder-text": t.trans("condition.enter-value-placeholder"), "state-message": t.valueErrorMessage, states: t.getFieldState("value"), "tooltip-status": !1, type: t.valueInputType, value: decodeURIComponent(t.props.filter.value) }, on: { input: function(s) {
11
9
  t.updateFilter({ text: "value", value: encodeURIComponent(s) });
12
10
  } } })]], 2), t.props.hasLogicAdapter ? e("div", { staticClass: "w-1 d-f a-i-c j-c-c p-r bor-b-s-s bor-b-w-1 bor-b-c-50 mt-4" }, [e(t.LogicAdapter, { staticClass: "p-a", attrs: { logic: t.props.filter.innerGroupOperator }, on: { change: function(s) {
13
11
  return t.updateFilter({ text: "innerGroupOperator", value: s });
14
12
  } } })], 1) : a._e()]);
15
- }, o = [], n = /* @__PURE__ */ l(
16
- r,
13
+ }, n = [], o = /* @__PURE__ */ r(
14
+ l,
17
15
  i,
18
- o,
16
+ n,
19
17
  !1,
20
18
  null,
21
- "3b53a736"
19
+ "73d5d4a4"
22
20
  );
23
- const f = n.exports;
21
+ const f = o.exports;
24
22
  export {
25
23
  f as default
26
24
  };
@@ -1,12 +1,13 @@
1
- import { defineComponent as _, computed as l } from "vue";
2
- import { useTranslations as C } from "../../../../composables/useTranslations.js";
3
- import { getOperatorOptions as p } from "../../../../enums/extensions/recommendationBlock.js";
4
- import { useRecommendationExtensionStore as V } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { getInvalidFilterFields as A } from "../../../../extensions/Blocks/Recommendation/validation/filterSchema.js";
6
- import { InButtonV2 as L, InSelect as O, InBasicTextInput as S } from "@useinsider/design-system-vue";
7
- import E from "./LogicAdapter.vue.js";
8
- import { useDebounceFn as N } from "../../../../node_modules/@vueuse/shared/index.js";
9
- const K = /* @__PURE__ */ _({
1
+ import { defineComponent as R, computed as r } from "vue";
2
+ import { useTranslations as U } from "../../../../composables/useTranslations.js";
3
+ import { getOperatorOptions as d, OP_ANY_OF as f } from "../../../../enums/extensions/recommendationBlock.js";
4
+ import { useRecommendationExtensionStore as N } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { getInvalidFilterFields as E } from "../../../../extensions/Blocks/Recommendation/validation/filterSchema.js";
6
+ import { locale as j } from "../../../../utils/dateUtil.js";
7
+ import { InTags as w, InButtonV2 as M, InSelect as Y, InDatePickerV2 as q, InBasicTextInput as z } from "@useinsider/design-system-vue";
8
+ import G from "./LogicAdapter.vue.js";
9
+ import { useDebounceFn as H } from "../../../../node_modules/@vueuse/shared/index.js";
10
+ const ne = /* @__PURE__ */ R({
10
11
  __name: "FilterItem",
11
12
  props: {
12
13
  filter: null,
@@ -15,55 +16,90 @@ const K = /* @__PURE__ */ _({
15
16
  submitted: { type: Boolean }
16
17
  },
17
18
  emits: ["delete-filter"],
18
- setup(f, { emit: v }) {
19
- const t = f, n = C(), a = V(), y = [
19
+ setup(g, { emit: I }) {
20
+ const t = g, s = U(), n = N(), O = [
20
21
  {
21
- text: n("email-editor.standard-filter"),
22
+ text: s("email-editor.standard-filter"),
22
23
  value: "standardFilter"
23
24
  }
24
- ], i = [
25
+ ], u = [
25
26
  { text: "True", value: "true" },
26
27
  { text: "False", value: "false" }
27
- ], d = l(() => t.filter.attribute || ""), r = l(() => a.getFilterList.find((e) => e.value === d.value) || { text: "", value: "", type: "" }), F = l(
28
+ ], m = r(() => t.filter.attribute || ""), i = r(() => n.getFilterList.find((e) => e.value === m.value) || { text: "", value: "", type: "" }), h = r(
28
29
  () => {
29
30
  var e;
30
- return ((e = r.value) == null ? void 0 : e.type) === "Boolean";
31
+ return ((e = i.value) == null ? void 0 : e.type) === "Boolean";
31
32
  }
32
- ), b = l(() => {
33
+ ), T = r(() => {
33
34
  var e;
34
- return p((e = r.value) == null ? void 0 : e.type).find((o) => o.value === t.filter.operator);
35
- }), g = l(
36
- () => i.find((e) => e.value === t.filter.value) || i[0]
37
- ), u = l(() => t.submitted ? A(t.filter) : /* @__PURE__ */ new Set()), h = (e) => u.value.has(e) ? "error" : "default", B = l(
38
- () => u.value.has("value") ? n("action-builder.filter-empty-value-error") : ""
39
- ), c = l(
35
+ return d((e = i.value) == null ? void 0 : e.type).find((o) => o.value === t.filter.operator);
36
+ }), b = r(
37
+ () => u.find((e) => e.value === t.filter.value) || u[0]
38
+ ), p = r(() => t.submitted ? E(t.filter) : /* @__PURE__ */ new Set()), A = (e) => p.value.has(e) ? "error" : "default", B = r(
39
+ () => p.value.has("value") ? s("action-builder.filter-empty-value-error") : ""
40
+ ), v = r(
40
41
  () => {
41
42
  var e;
42
- return ((e = r.value) == null ? void 0 : e.type) === "Number";
43
+ return ((e = i.value) == null ? void 0 : e.type) === "Number";
43
44
  }
44
- ), x = l(() => c.value ? "number" : "text"), T = N((e) => {
45
- a.updateFilter({
45
+ ), x = r(() => v.value ? "number" : "text"), C = r(
46
+ () => {
47
+ var e;
48
+ return ((e = i.value) == null ? void 0 : e.type) === "Date";
49
+ }
50
+ ), D = r(() => t.filter.operator === f), _ = r(
51
+ () => decodeURIComponent(t.filter.value).split(",").filter(Boolean)
52
+ ), k = H((e) => {
53
+ n.updateFilter({
46
54
  ...t.filter,
47
55
  [e.text]: e.value
48
56
  });
49
- }, 500);
50
- return { __sfc: !0, trans: n, store: a, props: t, filterTypeOptions: y, booleanValueOptions: i, attributeType: d, selectedAttributeType: r, isBooleanAttribute: F, selectedOperatorType: b, selectedBooleanValue: g, emit: v, invalidFields: u, getFieldState: h, valueErrorMessage: B, isNumericAttribute: c, valueInputType: x, updateFilter: T, handleAttributeChange: (e) => {
51
- const o = a.getFilterList.find((I) => I.value === e.value), m = (o == null ? void 0 : o.type) === "Boolean", [s] = p(o == null ? void 0 : o.type);
52
- a.updateFilter({
57
+ }, 500), P = (e) => {
58
+ const o = n.getFilterList.find((c) => c.value === e.value), l = (o == null ? void 0 : o.type) === "Boolean", [a] = d(o == null ? void 0 : o.type);
59
+ n.updateFilter({
53
60
  ...t.filter,
54
61
  attribute: e.value,
55
- operator: m ? "=" : (s == null ? void 0 : s.value) ?? "",
56
- value: m ? "true" : ""
62
+ operator: l ? "=" : (a == null ? void 0 : a.value) ?? "",
63
+ value: l ? "true" : ""
57
64
  });
58
- }, handleBooleanValueChange: (e) => {
59
- a.updateFilter({
65
+ }, V = (e) => {
66
+ n.updateFilter({
60
67
  ...t.filter,
61
68
  operator: "=",
62
69
  value: e.value
63
70
  });
64
- }, getOperatorOptions: p, InBasicTextInput: S, InSelect: O, InButtonV2: L, LogicAdapter: E };
71
+ }, S = (e) => {
72
+ const o = e.value;
73
+ if (o === t.filter.operator)
74
+ return;
75
+ const c = t.filter.operator === f !== (o === f);
76
+ n.updateFilter({
77
+ ...t.filter,
78
+ operator: o,
79
+ value: c ? "" : t.filter.value
80
+ });
81
+ }, $ = j(), y = (e) => {
82
+ const [o, l, a] = e.split("-");
83
+ return !o || !l || !a ? "" : `${l}/${a}/${o}`;
84
+ }, F = (e) => {
85
+ const [o, l, a] = e.split("/");
86
+ return !a || !o || !l ? "" : `${a}-${o.padStart(2, "0")}-${l.padStart(2, "0")}`;
87
+ }, L = r(
88
+ () => y(decodeURIComponent(t.filter.value))
89
+ );
90
+ return { __sfc: !0, trans: s, store: n, props: t, filterTypeOptions: O, booleanValueOptions: u, attributeType: m, selectedAttributeType: i, isBooleanAttribute: h, selectedOperatorType: T, selectedBooleanValue: b, emit: I, invalidFields: p, getFieldState: A, valueErrorMessage: B, isNumericAttribute: v, valueInputType: x, isDateAttribute: C, isAnyOfOperator: D, tagValues: _, updateFilter: k, handleAttributeChange: P, handleBooleanValueChange: V, handleOperatorChange: S, datePickerLocale: $, isoToPickerDate: y, pickerDateToIso: F, datePickerValue: L, onDatePickerApply: (e) => {
91
+ n.updateFilter({
92
+ ...t.filter,
93
+ value: encodeURIComponent(F(e))
94
+ });
95
+ }, onTagsInput: (e) => {
96
+ n.updateFilter({
97
+ ...t.filter,
98
+ value: encodeURIComponent(e.join(","))
99
+ });
100
+ }, getOperatorOptions: d, InBasicTextInput: z, InDatePickerV2: q, InSelect: Y, InButtonV2: M, InTags: w, LogicAdapter: G };
65
101
  }
66
102
  });
67
103
  export {
68
- K as default
104
+ ne as default
69
105
  };
@@ -89,11 +89,11 @@ const v = () => {
89
89
  updateHtmlAndCss: (t, e) => {
90
90
  window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e);
91
91
  },
92
- editorSave: () => {
93
- window.StripoEditorApi.actionsApi.save((t) => {
94
- t && n(t, "Failed to save template");
92
+ editorSave: () => new Promise((t) => {
93
+ window.StripoEditorApi.actionsApi.save((e) => {
94
+ e && n(e, "Failed to save template"), t();
95
95
  });
96
- }
96
+ })
97
97
  };
98
98
  };
99
99
  export {
@@ -1,17 +1,14 @@
1
- const o = (s, t) => {
2
- const n = window[s];
3
- return typeof n == "string" ? n : t;
4
- }, f = () => ({ injectFullStory: () => {
5
- var i;
6
- const t = o("_fs_org", "");
7
- if (!t)
1
+ const c = "https://email-static.useinsider.com/guido/guido-fs.js", u = () => ({ injectFullStory: () => {
2
+ var n;
3
+ const s = window;
4
+ if (typeof s._fs_org != "string" || !s._fs_org)
8
5
  return;
9
- const e = document.querySelector("ui-editor"), n = (i = e == null ? void 0 : e.shadowRoot) == null ? void 0 : i.querySelector("iframe");
10
- if (!(n != null && n.contentDocument))
6
+ const r = document.querySelector("ui-editor"), o = (n = r == null ? void 0 : r.shadowRoot) == null ? void 0 : n.querySelector("iframe"), e = o == null ? void 0 : o.contentDocument;
7
+ if (!e || e.querySelector('script[data-fullstory-bridge="true"]'))
11
8
  return;
12
- const r = o("_fs_host", "fullstory.com"), g = o("_fs_script", "edge.fullstory.com/s/fs.js"), u = o("_fs_namespace", "FS"), c = n.contentDocument.createElement("script");
13
- c.textContent = `window['_fs_run_in_iframe']=true;window['_fs_host']='${r}';window['_fs_script']='${g}';window['_fs_org']='${t}';window['_fs_namespace']='${u}';(function(m,n,e,t,l,o,g,y){if(e in m){if(m.console&&m.console.log){m.console.log('FullStory namespace conflict.');}return;}g=m[e]=function(a,b,s){g.q?g.q.push([a,b,s]):g._api(a,b,s);};g.q=[];o=n.createElement(t);o.async=1;o.crossOrigin='anonymous';o.src='https://'+_fs_script;y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y);g.identify=function(i,v,s){g(l,{uid:i},s);if(v)g(l,v,s)};g.setUserVars=function(v,s){g(l,v,s)};g.event=function(i,v,s){g('event',{n:i,p:v},s)};g.anonymize=function(){g.identify(!!0)};g.shutdown=function(){g("rec",!1)};g.restart=function(){g("rec",!0)};g.log=function(a,b){g("log",[a,b])};g.consent=function(a){g("consent",!arguments.length||a)};g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;g(o,v)};g.clearUserCookie=function(){};g.setVars=function(n,p){g('setVars',[n,p])};g._w={};y='XMLHttpRequest';g._w[y]=m[y];y='fetch';g._w[y]=m[y];if(m[y])m[y]=function(){return g._api(y,arguments)};g._v="1.3.0";})(window,document,window['_fs_namespace'],'script','user');`, n.contentDocument.head.appendChild(c);
9
+ const t = e.createElement("script");
10
+ t.src = c, t.async = !0, t.crossOrigin = "anonymous", t.dataset.fullstoryBridge = "true", e.head.appendChild(t);
14
11
  } });
15
12
  export {
16
- f as useFullStoryBridge
13
+ u as useFullStoryBridge
17
14
  };
@@ -19,7 +19,7 @@ const F = () => {
19
19
  return;
20
20
  if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
21
21
  return;
22
- c();
22
+ await c();
23
23
  const { unsubscribePayload: f, stripoModules: v } = d(t.rawHtml);
24
24
  return await u(f), t.modules = v, m || s(t), t;
25
25
  } };
@@ -12,10 +12,10 @@ import L from "../static/styles/customEditorStyle.css.js";
12
12
  import { useEditorStore as C } from "../stores/editor.js";
13
13
  import { dynamicContentToMergeTags as $ } from "../utils/genericUtil.js";
14
14
  import z from "../package.json.js";
15
- const se = (E, l) => {
16
- const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: b, getCustomFonts: w, getSyncModulesStatus: k } = j(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, n = [], r = !1) => {
17
- var g, y, S;
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 = ((y = c.value) == null ? void 0 : y.modulesDisabled) ?? !1, v = ((S = h.value) == null ? void 0 : S.forceRecreate) ?? !1;
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;
19
19
  window.UIEditor.initEditor(
20
20
  document.querySelector("#guido-editor"),
21
21
  {
@@ -38,18 +38,19 @@ const se = (E, l) => {
38
38
  conditionCategories: O,
39
39
  enableXSSSecurity: !0,
40
40
  modulesDisabled: F,
41
- syncModulesEnabled: r,
41
+ syncModulesEnabled: s,
42
42
  messageSettingsEnabled: !0,
43
43
  displayGmailAnnotations: !0,
44
44
  displayHiddenPreheader: !1,
45
45
  displayTitle: !1,
46
46
  displayUTM: !1,
47
47
  selectElementAfterDrop: !0,
48
+ allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
48
49
  ...o ? { baseBlocks: o } : {},
49
50
  editorFonts: {
50
51
  showDefaultStandardFonts: !0,
51
52
  showDefaultNotStandardFonts: !0,
52
- customFonts: n
53
+ customFonts: r
53
54
  },
54
55
  mergeTags: [
55
56
  {
@@ -61,16 +62,16 @@ const se = (E, l) => {
61
62
  ],
62
63
  async onTokenRefreshRequest(t) {
63
64
  try {
64
- const s = await b();
65
- t(s);
66
- } catch (s) {
67
- m(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: M } = D(), { injectFullStory: A } = R();
73
- t(), s(), A(), M(), l.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) {
@@ -99,29 +100,29 @@ const se = (E, l) => {
99
100
  localePatch: H
100
101
  }
101
102
  );
102
- }, _ = (i) => new Promise((n, r) => {
103
+ }, _ = (i) => new Promise((r, s) => {
103
104
  var d;
104
105
  if (document.getElementById("UiEditorScript")) {
105
- i(), n();
106
+ i(), r();
106
107
  return;
107
108
  }
108
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");
109
110
  o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
110
- i(), n();
111
+ i(), r();
111
112
  }, o.onerror = () => {
112
- r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
113
+ s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
113
114
  }, document.body.appendChild(o);
114
115
  });
115
116
  return { initPlugin: async (i) => {
116
117
  await _(async () => {
117
- const n = C(), [r, e] = await Promise.all([
118
- w(),
118
+ const r = C(), [s, e] = await Promise.all([
119
+ b(),
119
120
  k()
120
121
  ]);
121
- n.syncModulesEnabled = e, await V(i, r, e);
122
+ r.syncModulesEnabled = e, await V(i, s, e);
122
123
  });
123
124
  } };
124
125
  };
125
126
  export {
126
- se as useStripo
127
+ ae as useStripo
127
128
  };
@@ -1,16 +1,16 @@
1
- import { useRecommendation as N } from "../../composables/useRecommendation.js";
2
- import { DUMMY_IMAGE_MAPPINGS as C, REGEX as T, VerticalOrientation as M, CSS as E, ATTRIBUTES as R, CONDITIONS as $, HTML as h } from "../../enums/recommendation.js";
1
+ import { useRecommendation as C } from "../../composables/useRecommendation.js";
2
+ import { DUMMY_IMAGE_MAPPINGS as h, REGEX as T, VerticalOrientation as M, CSS as E, ATTRIBUTES as A, CONDITIONS as g, HTML as N } from "../../enums/recommendation.js";
3
3
  import { prepareRecommendationBlocks as x } from "./utils/recommendationCompilerUtils.js";
4
4
  const w = [
5
5
  {
6
6
  id: "replace-images-with-variable-names",
7
7
  description: "Replacing dummy images with variable names in recommendation module",
8
8
  type: "custom",
9
- processor: (i) => {
10
- let e = i;
11
- return Object.entries(C).forEach(([, p]) => {
12
- Object.entries(p).forEach(([c, n]) => {
13
- e = e.replaceAll(n, `{{${c}}}`);
9
+ processor: (c) => {
10
+ let e = c;
11
+ return Object.entries(h).forEach(([, l]) => {
12
+ Object.entries(l).forEach(([n, s]) => {
13
+ e = e.replaceAll(s, `{{${n}}}`);
14
14
  });
15
15
  }), e;
16
16
  },
@@ -29,21 +29,21 @@ const w = [
29
29
  id: "add-recommendation-unresponsive-css",
30
30
  description: "Adding recommendation unresponsive css",
31
31
  type: "custom",
32
- processor: (i) => {
33
- const { calculateCardWidth: e, getRecommendationCampaignData: p } = N();
34
- let c = i;
35
- const n = c.match(T.ID);
36
- if (n) {
32
+ processor: (c) => {
33
+ const { calculateCardWidth: e, getRecommendationCampaignData: l } = C();
34
+ let n = c;
35
+ const s = n.match(T.ID);
36
+ if (s) {
37
37
  const a = [];
38
- if (n.forEach((s) => {
39
- const d = /recommendation-id="(.*?)"/i.exec(s), _ = d ? d[1].trim() : "", A = p(_);
40
- A.textTrimming && A.orientation === M && a.push(e(A));
38
+ if (s.forEach((i) => {
39
+ const d = /recommendation-id="(.*?)"/i.exec(i), _ = d ? d[1].trim() : "", R = l(_);
40
+ R.textTrimming && R.orientation === M && a.push(e(R));
41
41
  }), a.length) {
42
- const s = `width:${Math.min(...a)}px!important;`;
43
- c = c.replace(E.REGULAR_NAME_HEIGHT, `${E.TRIMMED_NAME_HEIGHT} ${s} ${E.ELLIPSIS}`).replace(E.REGULAR_NAME_CONTAINER_HEIGHT, E.TRIMMED_NAME_CONTAINER_CSS).replace(E.RESPONSIVE_NAME_SIZE, `${E.RESPONSIVE_NAME_HEIGHT} ${s} ${E.ELLIPSIS}`).replace(E.RESPONSIVE_NAME_CONTAINER_HEIGHT, E.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
42
+ const i = `width:${Math.min(...a)}px!important;`;
43
+ n = n.replace(E.REGULAR_NAME_HEIGHT, `${E.TRIMMED_NAME_HEIGHT} ${i} ${E.ELLIPSIS}`).replace(E.REGULAR_NAME_CONTAINER_HEIGHT, E.TRIMMED_NAME_CONTAINER_CSS).replace(E.RESPONSIVE_NAME_SIZE, `${E.RESPONSIVE_NAME_HEIGHT} ${i} ${E.ELLIPSIS}`).replace(E.RESPONSIVE_NAME_CONTAINER_HEIGHT, E.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
44
44
  }
45
45
  }
46
- return c;
46
+ return n;
47
47
  },
48
48
  priority: 52
49
49
  },
@@ -51,34 +51,34 @@ const w = [
51
51
  id: "prepare-recommendations",
52
52
  description: "Replacing product data with template variables in recommendation blocks",
53
53
  type: "custom",
54
- processor: (i) => x(i),
54
+ processor: (c) => x(c),
55
55
  priority: 48
56
56
  },
57
57
  {
58
58
  id: "add-discount-conditions",
59
59
  description: "Adding discount conditions to the recommendation block",
60
60
  type: "custom",
61
- processor: (i) => {
62
- let e = i;
63
- const p = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: c } = N();
64
- return p !== null && p.forEach((n) => {
65
- const a = n.match(T.CUSTOM_FIELD);
61
+ processor: (c) => {
62
+ let e = c;
63
+ const l = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } = C();
64
+ return l !== null && l.forEach((s) => {
65
+ const a = s.match(T.CUSTOM_FIELD);
66
66
  if (!a)
67
67
  return;
68
- const [s] = a, d = s.match(T.CUSTOM_FIELD_INDEXES_PART), _ = s.match(T.CUSTOM_FIELD_NAME_PART), A = n.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
69
- if (!d || !_ || !A)
68
+ const [i] = a, d = i.match(T.CUSTOM_FIELD_INDEXES_PART), _ = i.match(T.CUSTOM_FIELD_NAME_PART), R = s.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
69
+ if (!d || !_ || !R)
70
70
  return;
71
- const [I] = d, [S] = _, [m] = A, o = S.substring(1, S.length - 2), r = m.match(T.COMPOSITION) !== null;
72
- let t = s;
71
+ const [S] = d, [b] = _, [m] = R, o = b.substring(1, b.length - 2), r = m.match(T.COMPOSITION) !== null;
72
+ let t = i;
73
73
  if (r) {
74
- const b = I.substring(2, I.length - 3), l = c(b);
75
- o === R.OMNIBUS_PRICE && (l.priceBeforeTextValue && (t = `${l.priceBeforeTextValue}${t}`), l.priceAfterTextValue && (t = `${t}${l.priceAfterTextValue}`)), o === R.OMNIBUS_DISCOUNT && (l.discountBeforeTextValue && (t = `${l.discountBeforeTextValue}${t}`), l.discountAfterTextValue && (t = `${t}${l.discountAfterTextValue}`));
74
+ const I = S.substring(2, S.length - 3), p = n(I);
75
+ o === A.OMNIBUS_PRICE && (p.priceBeforeTextValue && (t = `${p.priceBeforeTextValue}${t}`), p.priceAfterTextValue && (t = `${t}${p.priceAfterTextValue}`)), o === A.OMNIBUS_DISCOUNT && (p.discountBeforeTextValue && (t = `${p.discountBeforeTextValue}${t}`), p.discountAfterTextValue && (t = `${t}${p.discountAfterTextValue}`));
76
76
  }
77
- const u = I.substring(2);
77
+ const u = S.substring(2);
78
78
  let f = "";
79
- o in $.IF && (f = $.IF[o].replaceAll(`{${R.DISCOUNT}}`, `${u}${R.DISCOUNT}`).replaceAll(`{${R.OMNIBUS_DISCOUNT}}`, `${u}${R.OMNIBUS_DISCOUNT}`).replaceAll(`{${R.OMNIBUS_PRICE}}`, `${u}${R.OMNIBUS_PRICE}`));
80
- const g = `${m}${t}${h.PARAGRAPH_END_TAG}`, y = `${f}${r ? g : n}${$.ELSE}${m}${h.PARAGRAPH_END_TAG}${$.END_IF}`;
81
- e = e.replace(n, y);
79
+ o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${u}${A.DISCOUNT}`).replaceAll(`{${A.OMNIBUS_DISCOUNT}}`, `${u}${A.OMNIBUS_DISCOUNT}`).replaceAll(`{${A.OMNIBUS_PRICE}}`, `${u}${A.OMNIBUS_PRICE}`));
80
+ const $ = `${m}${t}${N.PARAGRAPH_END_TAG}`, y = `${f}${r ? $ : s}${g.ELSE}${m}${N.PARAGRAPH_END_TAG}${g.END_IF}`;
81
+ e = e.replace(s, y);
82
82
  }), e;
83
83
  },
84
84
  priority: 53
@@ -95,19 +95,24 @@ const w = [
95
95
  {
96
96
  id: "strip-recommendation-editor-attributes",
97
97
  description: "Strip editor-only attributes from compiled recommendation output",
98
- type: "regex",
99
- // eslint-disable-next-line @stylistic/max-len
100
- pattern: '\\s+(?:esd-extension-block-id|data-attribute-type|data-visibility|data-text-before|data-text-after|product-attr|composition)="[^"]*"',
101
- replacement: "",
102
- flags: "g",
98
+ type: "custom",
99
+ // Scoped to REC_START/REC_END markers so it cannot strip `product-attr`
100
+ // from Items block elements, which the items compiler rule depends on.
101
+ processor: (c) => {
102
+ const e = /\s+(?:esd-extension-block-id|data-attribute-type|data-visibility|data-text-before|data-text-after|product-attr|composition)="[^"]*"/g;
103
+ return c.replace(
104
+ /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
105
+ (l, n) => `<!--REC_START-->${n.replace(e, "")}<!--REC_END-->`
106
+ );
107
+ },
103
108
  priority: 55
104
109
  },
105
110
  {
106
111
  id: "strip-unused-recommendation-classes",
107
112
  description: "Remove CSS classes not referenced by any style rule from recommendation elements",
108
113
  type: "custom",
109
- processor: (i) => {
110
- let e = i.replace(
114
+ processor: (c) => {
115
+ let e = c.replace(
111
116
  / class="(?:product-card-segment|attribute-cell|recommendation-attribute-row|product-image|product-name|product-price|product-old-price|product-omnibus-price|product-omnibus-discount|product-button|recommendation-product-row|product-card-wrapper)"/g,
112
117
  ""
113
118
  );
@@ -119,8 +124,8 @@ const w = [
119
124
  id: "remove-empty-mobile-layout-artifacts",
120
125
  description: "Remove empty mobile container rows and unused mobile layout CSS",
121
126
  type: "custom",
122
- processor: (i) => {
123
- let e = i;
127
+ processor: (c) => {
128
+ let e = c;
124
129
  return e = e.replace(
125
130
  /<tr[^>]*class="ins-recommendation-mobile-row"[^>]*><\/tr>/g,
126
131
  ""
@@ -129,9 +134,9 @@ const w = [
129
134
  ""
130
135
  ), e = e.replace(
131
136
  /@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
132
- (p, c) => {
133
- const n = c.match(/[^{}]+\{[^{}]*\}/g) || [], a = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
134
- return n.every((d) => a.test(d)) ? "" : p;
137
+ (l, n) => {
138
+ const s = n.match(/[^{}]+\{[^{}]*\}/g) || [], a = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
139
+ return s.every((d) => a.test(d)) ? "" : l;
135
140
  }
136
141
  )), e;
137
142
  },
@@ -141,38 +146,38 @@ const w = [
141
146
  id: "deduplicate-inline-styles",
142
147
  description: "Replace repeated inline styles with CSS class references within recommendation blocks",
143
148
  type: "custom",
144
- processor: (i) => {
145
- const e = i.replace(
149
+ processor: (c) => {
150
+ const e = c.replace(
146
151
  /<a\b[^>]*\bes-button\b[^>]*>/g,
147
152
  (o) => o.replace(
148
153
  /([;"]color:)([^;"]+)/g,
149
154
  (r, t, u) => u.includes("!important") ? r : `${t}${u} !important`
150
155
  )
151
- ), p = /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, c = / style="([^"]*)"/g, n = /* @__PURE__ */ new Map();
152
- let a = p.exec(e);
156
+ ), l = /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, n = / style="([^"]*)"/g, s = /* @__PURE__ */ new Map();
157
+ let a = l.exec(e);
153
158
  for (; a !== null; ) {
154
- let o = c.exec(a[1]);
159
+ let o = n.exec(a[1]);
155
160
  for (; o !== null; ) {
156
161
  const [, r] = o;
157
- n.set(r, (n.get(r) || 0) + 1), o = c.exec(a[1]);
162
+ s.set(r, (s.get(r) || 0) + 1), o = n.exec(a[1]);
158
163
  }
159
- c.lastIndex = 0, a = p.exec(e);
164
+ n.lastIndex = 0, a = l.exec(e);
160
165
  }
161
- const s = /* @__PURE__ */ new Map(), d = [];
166
+ const i = /* @__PURE__ */ new Map(), d = [];
162
167
  let _ = 0;
163
- if (n.forEach((o, r) => {
168
+ if (s.forEach((o, r) => {
164
169
  if (o >= 6) {
165
170
  const t = `rc${_++}`;
166
- s.set(r, t), d.push(`.${t}{${r}}`);
171
+ i.set(r, t), d.push(`.${t}{${r}}`);
167
172
  }
168
- }), s.size === 0) {
173
+ }), i.size === 0) {
169
174
  let o = e;
170
175
  return o = o.replaceAll("<!--REC_START-->", ""), o = o.replaceAll("<!--REC_END-->", ""), o;
171
176
  }
172
- const A = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), I = (o, r) => `${o.slice(0, -1)} ${r}"`, S = /* @__PURE__ */ new Map();
173
- s.forEach((o, r) => {
174
- const t = A(r);
175
- S.set(r, {
177
+ const R = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), S = (o, r) => `${o.slice(0, -1)} ${r}"`, b = /* @__PURE__ */ new Map();
178
+ i.forEach((o, r) => {
179
+ const t = R(r);
180
+ b.set(r, {
176
181
  caseA: new RegExp(`(class="[^"]*")((?:[^>]*?)) style="${t}"`, "g"),
177
182
  caseB: new RegExp(` style="${t}"((?:[^>]*?))(class="[^"]*")`, "g")
178
183
  });
@@ -182,14 +187,14 @@ const w = [
182
187
  /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
183
188
  (o, r) => {
184
189
  let t = r;
185
- return s.forEach((u, f) => {
186
- const g = S.get(f);
190
+ return i.forEach((u, f) => {
191
+ const $ = b.get(f);
187
192
  t = t.replace(
188
- g.caseA,
189
- (y, b, l) => I(b, u) + l
193
+ $.caseA,
194
+ (y, I, p) => S(I, u) + p
190
195
  ), t = t.replace(
191
- g.caseB,
192
- (y, b, l) => b + I(l, u)
196
+ $.caseB,
197
+ (y, I, p) => I + S(p, u)
193
198
  ), t = t.replaceAll(` style="${f}"`, ` class="${u}"`);
194
199
  }), t;
195
200
  }