@useinsider/guido 3.12.0-beta.d2745e7 → 3.12.0-beta.d77b0d2
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.
- package/dist/@types/config/schemas.js +9 -4
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +50 -49
- package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.js +38 -0
- package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue2.js +271 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue2.js +42 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.js +20 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue2.js +18 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.js +20 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue2.js +60 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.js +19 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue2.js +19 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.js +22 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue2.js +29 -0
- package/dist/composables/useHtmlValidator.js +68 -60
- package/dist/composables/useHttp.js +61 -52
- package/dist/composables/useRecommendation.js +56 -40
- package/dist/composables/useSave.js +22 -22
- package/dist/composables/useStrategyFilters.js +16 -0
- package/dist/config/migrator/recommendationMigrator.js +7 -4
- package/dist/enums/date.js +4 -3
- package/dist/enums/extensions/filteringV2.js +1024 -0
- package/dist/enums/extensions/recommendationBlock.js +45 -24
- package/dist/enums/extensions/strategyDetail.js +149 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +12 -11
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +141 -123
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +297 -0
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +16 -2
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +137 -0
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +549 -165
- package/dist/extensions/Blocks/Recommendation/utils/strategyHumanizer.js +97 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategyNavigation.js +8 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategySummary.js +95 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategyUrl.js +43 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +24 -10
- package/dist/extensions/Blocks/common-control.js +37 -35
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +127 -33
- package/dist/services/stripoApi.js +18 -18
- package/dist/src/@types/config/schemas.d.ts +10 -0
- package/dist/src/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.d.ts +43 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.d.ts +29 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.d.ts +40 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.d.ts +38 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.d.ts +51 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useHtmlValidator.d.ts +2 -0
- package/dist/src/composables/useRecommendation.d.ts +2 -0
- package/dist/src/composables/useStrategyFilters.d.ts +24 -0
- package/dist/src/enums/extensions/filteringV2.d.ts +72 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +33 -0
- package/dist/src/enums/extensions/strategyDetail.d.ts +90 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +10 -4
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +118 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +958 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyHumanizer.d.ts +50 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyNavigation.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategySummary.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyUrl.d.ts +51 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +8 -1
- package/dist/src/extensions/Blocks/common-control.d.ts +5 -2
- package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
- package/dist/src/services/recommendationApi.d.ts +9 -1
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/utils/genericUtil.d.ts +9 -0
- package/dist/static/styles/components/base-input.css.js +6 -7
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +10 -1
- package/dist/utils/templatePreparation.js +70 -57
- package/package.json +1 -1
package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue2.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineComponent as a } from "vue";
|
|
2
|
+
import { useStrategyFilters as p } from "../../../../../composables/useStrategyFilters.js";
|
|
3
|
+
import { useTranslations as f } from "../../../../../composables/useTranslations.js";
|
|
4
|
+
import { InButtonV2 as l } from "@useinsider/design-system-vue";
|
|
5
|
+
import u from "./HumanizerGroup.vue.js";
|
|
6
|
+
const F = /* @__PURE__ */ a({
|
|
7
|
+
__name: "FilterHumanizer",
|
|
8
|
+
props: {
|
|
9
|
+
filters: { default: "{}" }
|
|
10
|
+
},
|
|
11
|
+
setup(t) {
|
|
12
|
+
const r = t, e = f(), { filterQuery: o, hasAnyFilter: s, canToggle: n, isCollapsed: i, toggleMore: m } = p(() => r.filters);
|
|
13
|
+
return { __sfc: !0, trans: e, props: r, filterQuery: o, hasAnyFilter: s, canToggle: n, isCollapsed: i, toggleMore: m, InButtonV2: l, HumanizerGroup: u };
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
F as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import a from "./HumanizerCondition.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import e from "../../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var o = function() {
|
|
5
|
+
var t = this, s = t._self._c, i = t._self._setupProxy;
|
|
6
|
+
return s("div", { class: { "pb-0 pt-1": t.isLast, "py-1": !t.isLast } }, [s("div", { staticClass: "d-f a-i-b j-c-s-b" }, [s("div", { staticClass: "attribute-type" }, [t._v(" " + t._s(i.headingText) + " ")]), s("div", { staticClass: "spaced-dot-sep f-g-1 h-1-s mx-2 w-7-s" }), s(i.InTooltipV2, { attrs: { id: `strategy-condition-${i.conditionId}-${t.index}`, "static-position": "top right", "dynamic-position": !1, text: i.tooltipText }, scopedSlots: t._u([{ key: "triggerElement", fn: function() {
|
|
7
|
+
return [s("div", { staticClass: "d-f condition-data" }, [s("div", { staticClass: "attribute" }, [t._v(" " + t._s(i.capitalizeFirstLetter(i.attributeText)) + " ")]), s("div", { staticClass: "operator f-w-600" }, [t._v(" " + t._s(i.displayOperator) + " ")]), i.totalValueLength < i.MAX_CHARACTER_SIZE ? s("div", { staticClass: "value f-w-600" }, [t._v(" " + t._s(i.suitableValue) + " ")]) : t._e()])];
|
|
8
|
+
}, proxy: !0 }]) })], 1), t.isLast ? t._e() : s("div", { staticClass: "pt-2" }, [s(i.InStatusText, { attrs: { id: `strategy-condition-logic-${i.conditionId}-${t.index}`, size: "small", status: "draft", text: t.condition.conditionLogic || "" } })], 1)]);
|
|
9
|
+
}, n = [], r = /* @__PURE__ */ e(
|
|
10
|
+
a,
|
|
11
|
+
o,
|
|
12
|
+
n,
|
|
13
|
+
!1,
|
|
14
|
+
null,
|
|
15
|
+
"2685bc55"
|
|
16
|
+
);
|
|
17
|
+
const p = r.exports;
|
|
18
|
+
export {
|
|
19
|
+
p as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { defineComponent as R, computed as e } from "vue";
|
|
2
|
+
import { useTranslations as V } from "../../../../../composables/useTranslations.js";
|
|
3
|
+
import { TimeAbbreviations as m } from "../../../../../enums/extensions/filteringV2.js";
|
|
4
|
+
import { FilterTypeNames as L, Operators as D, DataTypes as _, MultiSelectDataTypes as $, OperatorNames as u, OperatorAbbreviations as N } from "../../../../../enums/extensions/strategyDetail.js";
|
|
5
|
+
import { capitalizeFirstLetter as s, getSuitableValue as F } from "../../../../../extensions/Blocks/Recommendation/utils/strategyHumanizer.js";
|
|
6
|
+
import { InTooltipV2 as M, InStatusText as U } from "@useinsider/design-system-vue";
|
|
7
|
+
const j = /* @__PURE__ */ R({
|
|
8
|
+
__name: "HumanizerCondition",
|
|
9
|
+
props: {
|
|
10
|
+
condition: null,
|
|
11
|
+
index: null,
|
|
12
|
+
isLast: { type: Boolean, default: !1 }
|
|
13
|
+
},
|
|
14
|
+
setup(b) {
|
|
15
|
+
const n = b, c = 40, d = "_dynamic", i = V(), l = e(() => n.condition.type || ""), p = e(() => {
|
|
16
|
+
var t;
|
|
17
|
+
return ((t = n.condition.attribute) == null ? void 0 : t.text) || "";
|
|
18
|
+
}), r = e(() => {
|
|
19
|
+
var t;
|
|
20
|
+
return ((t = n.condition.attribute) == null ? void 0 : t.attributeType) || "";
|
|
21
|
+
}), o = e(() => n.condition.selectedOperator || ""), g = e(() => n.condition.id ?? n.index), f = e(() => {
|
|
22
|
+
const { value: t } = n.condition;
|
|
23
|
+
return Array.isArray(t) ? t.join(",") : t || "";
|
|
24
|
+
}), O = e(() => [
|
|
25
|
+
{ text: s(i("journey-builder.weeks")), value: m.WEEK },
|
|
26
|
+
{ text: s(i("settings.day-s")), value: m.DAY },
|
|
27
|
+
{ text: s(i("settings.hour-s")), value: m.HOUR }
|
|
28
|
+
]), a = e(() => {
|
|
29
|
+
let t = o.value;
|
|
30
|
+
l.value === L.DYNAMIC_FILTER && !t.includes(d) && (t = `${t}${d}`);
|
|
31
|
+
const T = (D[r.value] || []).find((h) => h.value === t);
|
|
32
|
+
return T ? i(T.text) : "";
|
|
33
|
+
}), y = () => r.value === _.DATE, A = () => {
|
|
34
|
+
if (!$.includes(r.value) || [u.CONTAINS, u.NOT_CONTAINS].includes(o.value))
|
|
35
|
+
return !1;
|
|
36
|
+
const t = [u.IS_EXACTLY, u.IS_NOT_EXACTLY].includes(o.value);
|
|
37
|
+
return !((n.condition.isHierarchyCategory || r.value === _.STRING) && t);
|
|
38
|
+
}, I = () => [
|
|
39
|
+
N.OPERATOR.IN,
|
|
40
|
+
N.OPERATOR.NOT_IN
|
|
41
|
+
].includes(o.value), v = e(() => F({
|
|
42
|
+
condition: n.condition,
|
|
43
|
+
selectedOperator: o.value,
|
|
44
|
+
filterValue: f.value,
|
|
45
|
+
timeUnit: n.condition.timeUnit ?? "",
|
|
46
|
+
inBetweenValues: n.condition.inBetweenValues ?? [],
|
|
47
|
+
timeUnitOptions: O.value,
|
|
48
|
+
isDateAttribute: y,
|
|
49
|
+
isMultiSelect: A,
|
|
50
|
+
isInOrNotInOperator: I,
|
|
51
|
+
trans: i
|
|
52
|
+
})), x = e(() => v.value.length + a.value.length), S = e(() => a.value.length > c ? `${a.value.substring(0, c)}...` : a.value), C = e(
|
|
53
|
+
() => `${s(p.value)} ${a.value} ${v.value}`
|
|
54
|
+
), E = e(() => l.value ? i(`discovery-strategy.${l.value.toLowerCase()}-humanized`) : s(p.value));
|
|
55
|
+
return { __sfc: !0, MAX_CHARACTER_SIZE: c, DYNAMIC_FILTER_SUFFIX: d, trans: i, props: n, filterType: l, attributeText: p, attributeType: r, selectedOperator: o, conditionId: g, filterValue: f, timeUnitOptions: O, operatorTranslated: a, isDateAttribute: y, isMultiSelect: A, isInOrNotInOperator: I, suitableValue: v, totalValueLength: x, displayOperator: S, tooltipText: C, headingText: E, capitalizeFirstLetter: s, InStatusText: U, InTooltipV2: M };
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
export {
|
|
59
|
+
j as default
|
|
60
|
+
};
|
package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import e from "./HumanizerGroup.vue2.js";
|
|
2
|
+
import o from "../../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
+
var a = function() {
|
|
4
|
+
var t = this, s = t._self._c, r = t._self._setupProxy;
|
|
5
|
+
return s("div", [s("div", { staticClass: "py-3 b-c-5 px-5" }, t._l(t.conditionList, function(n, i) {
|
|
6
|
+
return s(r.HumanizerCondition, { key: `${n.id}-${t.groupIndex}-${i}`, staticClass: "condition", attrs: { condition: n, index: i, "is-last": t.conditionList.length - 1 === i } });
|
|
7
|
+
}), 1), r.isLastGroup ? t._e() : s("div", { staticClass: "my-3 d-f j-c-c" }, [s(r.InStatusText, { attrs: { id: `strategy-filter-group-${t.groupIndex}`, size: "small", status: "draft", text: t.groupLogic } })], 1)]);
|
|
8
|
+
}, c = [], u = /* @__PURE__ */ o(
|
|
9
|
+
e,
|
|
10
|
+
a,
|
|
11
|
+
c,
|
|
12
|
+
!1,
|
|
13
|
+
null,
|
|
14
|
+
null
|
|
15
|
+
);
|
|
16
|
+
const p = u.exports;
|
|
17
|
+
export {
|
|
18
|
+
p as default
|
|
19
|
+
};
|
package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue2.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineComponent as n, computed as r } from "vue";
|
|
2
|
+
import { InStatusText as u } from "@useinsider/design-system-vue";
|
|
3
|
+
import i from "./HumanizerCondition.vue.js";
|
|
4
|
+
const l = /* @__PURE__ */ n({
|
|
5
|
+
__name: "HumanizerGroup",
|
|
6
|
+
props: {
|
|
7
|
+
filters: null,
|
|
8
|
+
conditionList: null,
|
|
9
|
+
groupIndex: null,
|
|
10
|
+
groupLogic: { default: "" }
|
|
11
|
+
},
|
|
12
|
+
setup(t) {
|
|
13
|
+
const o = t, e = r(() => Object.keys(o.filters).length === Number(o.groupIndex));
|
|
14
|
+
return { __sfc: !0, props: o, isLastGroup: e, InStatusText: u, HumanizerCondition: i };
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
l as default
|
|
19
|
+
};
|
package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import a from "./InfoDisplayValue.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import e from "../../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var n = function() {
|
|
5
|
+
var s = this, t = s._self._c, i = s._self._setupProxy;
|
|
6
|
+
return t("div", { staticClass: "d-f a-i-b l-h-2 mt-2" }, [t("div", { staticClass: "t-c-3 w-s-n-w" }, [s._v(" " + s._s(i.trans(s.title)) + " ")]), t("div", { staticClass: "spaced-dot-sep f-g-1 h-1-s mx-2 w-7-s" }), t("div", { staticClass: "d-f a-i-c" }, [t("div", [s._v(s._s(i.displayValues))]), i.showMore ? t("div", { staticClass: "d-f a-i-c" }, [t("div", { staticClass: "mx-1" }, [s._v(" ... ")]), t(i.InTooltipV2, { attrs: { id: `strategy-detail-show-more-${s.index}`, "static-position": "top right", "dynamic-position": !1, text: i.hiddenDisplayValues, "with-icon": !1 }, scopedSlots: s._u([{ key: "triggerElement", fn: function() {
|
|
7
|
+
return [t("span", { staticClass: "f-w-600" }, [s._v("+" + s._s(i.hiddenValues.length))])];
|
|
8
|
+
}, proxy: !0 }], null, !1, 3725664940) })], 1) : s._e(), s.icon ? t("div", { staticClass: "ml-2" }, [t(i.InTooltipV2, { staticClass: "d-f a-i-c", attrs: { id: `strategy-detail-icon-action-${s.index}`, "static-position": "top right", "dynamic-position": !1, "icon-status": !1, status: !s.disabled, text: i.trans(i.iconTooltipText) }, scopedSlots: s._u([{ key: "triggerElement", fn: function() {
|
|
9
|
+
return [t(i.InIcons, { staticClass: "d-f a-i-c", class: { "i-c-7": !s.disabled, "i-c-2": s.disabled }, attrs: { size: "24", name: s.icon }, on: { click: i.clickOnIcon } })];
|
|
10
|
+
}, proxy: !0 }], null, !1, 4084358903) })], 1) : s._e()])]);
|
|
11
|
+
}, o = [], l = /* @__PURE__ */ e(
|
|
12
|
+
a,
|
|
13
|
+
n,
|
|
14
|
+
o,
|
|
15
|
+
!1,
|
|
16
|
+
null,
|
|
17
|
+
"6e572ff5"
|
|
18
|
+
);
|
|
19
|
+
const p = l.exports;
|
|
20
|
+
export {
|
|
21
|
+
p as default
|
|
22
|
+
};
|
package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue2.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineComponent as _, computed as o, ref as v } from "vue";
|
|
2
|
+
import { useTranslations as I } from "../../../../../composables/useTranslations.js";
|
|
3
|
+
import { InTooltipV2 as V, InIcons as k } from "@useinsider/design-system-vue";
|
|
4
|
+
const h = /* @__PURE__ */ _({
|
|
5
|
+
__name: "InfoDisplayValue",
|
|
6
|
+
props: {
|
|
7
|
+
index: null,
|
|
8
|
+
title: null,
|
|
9
|
+
value: null,
|
|
10
|
+
translateValue: { type: Boolean, default: !1 },
|
|
11
|
+
icon: { default: "" },
|
|
12
|
+
iconTooltip: { default: "" },
|
|
13
|
+
iconTooltipAfterClicked: { default: "" },
|
|
14
|
+
disabled: { type: Boolean, default: !1 }
|
|
15
|
+
},
|
|
16
|
+
emits: ["iconClick"],
|
|
17
|
+
setup(d, { emit: c }) {
|
|
18
|
+
const e = d, l = 3, u = 2e3, r = I(), t = o(() => String(e.value ?? "").split(",").map((n) => n.trim())), i = (n) => e.translateValue ? r(n) : n, f = o(() => t.value.length > l), m = o(() => t.value.slice(0, l).map(i).join(", ")), p = o(() => t.value.slice(l).map(i)), T = o(() => p.value.join(", ")), a = v(e.iconTooltip);
|
|
19
|
+
let s;
|
|
20
|
+
return { __sfc: !0, MAX_INLINE_VALUES: l, TOOLTIP_REVERT_DELAY_MS: u, trans: r, props: e, emit: c, values: t, render: i, showMore: f, displayValues: m, hiddenValues: p, hiddenDisplayValues: T, iconTooltipText: a, revertTimer: s, clickOnIcon: () => {
|
|
21
|
+
e.iconTooltipAfterClicked && (a.value = e.iconTooltipAfterClicked, clearTimeout(s), s = setTimeout(() => {
|
|
22
|
+
a.value = e.iconTooltip;
|
|
23
|
+
}, u)), c("iconClick");
|
|
24
|
+
}, InIcons: k, InTooltipV2: V };
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
export {
|
|
28
|
+
h as default
|
|
29
|
+
};
|
|
@@ -2,7 +2,7 @@ import { useConfig as W } from "./useConfig.js";
|
|
|
2
2
|
import { getIgnoredRecommendationBlockIds as G } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
3
3
|
import { TemplateTypes as H } from "../enums/defaults.js";
|
|
4
4
|
import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as X, CampaignCouldNotBeSavedKey as $, CanNotMakeAnyChangesForRunningKey as Y, DATA_ATTRIBUTE_REGEX as U, DYNAMIC_CONTENT_TAG_REGEX as j, ALLOWED_DYNAMIC_SYSTEM_TOKENS as q, VALID_DYNAMIC_VARIABLE_REGEX as K } from "../enums/html-validator.js";
|
|
5
|
-
import { ToasterTypeOptions as
|
|
5
|
+
import { ToasterTypeOptions as l } from "../enums/toaster.js";
|
|
6
6
|
import { itemsBlockDynamicVariables as z } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
7
|
import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Z } from "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
8
8
|
import { useRecommendationExtensionStore as J } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
@@ -57,8 +57,8 @@ function fe(t) {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
const xe = () => {
|
|
60
|
-
var
|
|
61
|
-
const { showToaster: t } = re(), { post: m } = se(), { config: f } = W(), o = oe(), d = te(), u = J(), p = ((
|
|
60
|
+
var A, T;
|
|
61
|
+
const { showToaster: t } = re(), { post: m } = se(), { config: f } = W(), o = oe(), d = te(), u = J(), p = ((T = (A = f.value) == null ? void 0 : A.partner) == null ? void 0 : T.messageType) === H.transactional, E = async (e) => {
|
|
62
62
|
if (e.size === 0)
|
|
63
63
|
return /* @__PURE__ */ new Set();
|
|
64
64
|
try {
|
|
@@ -68,136 +68,144 @@ const xe = () => {
|
|
|
68
68
|
}
|
|
69
69
|
return ue(u.filterList);
|
|
70
70
|
}, h = async (e) => {
|
|
71
|
-
const
|
|
71
|
+
const r = (await m(
|
|
72
72
|
"/newsletter/template-library/check-template-html-body",
|
|
73
73
|
{ html: ne(e) }
|
|
74
|
-
), {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
)).data ?? {}, { message: c } = r, i = r.status === !0;
|
|
75
|
+
if (!i) {
|
|
76
|
+
const a = o("newsletter.invalid-url-link-for-toaster");
|
|
77
|
+
t({
|
|
78
|
+
type: l.Error,
|
|
79
|
+
// `status: false` is a business rejection and keeps our own copy. Any
|
|
80
|
+
// other shape means the answer was unreadable — show what came back,
|
|
81
|
+
// and fall back to the same copy when nothing did, so the toast is
|
|
82
|
+
// never blank while the save is silently cancelled.
|
|
83
|
+
message: r.status === !1 ? a : c || a
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return o($), c === o(Y) && t({
|
|
87
|
+
type: l.Error,
|
|
80
88
|
message: o("newsletter.already-in-progress")
|
|
81
|
-
}),
|
|
82
|
-
}, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()),
|
|
89
|
+
}), i;
|
|
90
|
+
}, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), R = (e, s) => {
|
|
83
91
|
const n = e.match(/({%(.*?)%})/g);
|
|
84
92
|
let r = !0;
|
|
85
|
-
return n !== null && !p && n.forEach((
|
|
86
|
-
const i =
|
|
93
|
+
return n !== null && !p && n.forEach((c) => {
|
|
94
|
+
const i = c.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
87
95
|
if (i && i.length > 0) {
|
|
88
|
-
const [
|
|
89
|
-
g(
|
|
90
|
-
type:
|
|
96
|
+
const [a] = i;
|
|
97
|
+
g(a) && !s.includes(a) && (t({
|
|
98
|
+
type: l.Warning,
|
|
91
99
|
message: o("custom-fields.invalid-custom-fields")
|
|
92
100
|
}), r = !1);
|
|
93
101
|
}
|
|
94
102
|
}), r;
|
|
95
|
-
},
|
|
103
|
+
}, _ = async (e, s, n) => {
|
|
96
104
|
const r = n ? await h(e) : !0;
|
|
97
|
-
return
|
|
98
|
-
},
|
|
99
|
-
type:
|
|
105
|
+
return R(e, s) && r;
|
|
106
|
+
}, N = (e) => e.length > 0 ? !0 : (t({
|
|
107
|
+
type: l.Warning,
|
|
100
108
|
message: o("newsletter.html-content-is-empty")
|
|
101
|
-
}), !1),
|
|
109
|
+
}), !1), x = (e) => {
|
|
102
110
|
const s = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
|
|
103
111
|
return s > n && t({
|
|
104
|
-
type:
|
|
112
|
+
type: l.Warning,
|
|
105
113
|
message: o("custom-fields.missing-closing-braces")
|
|
106
114
|
}), s < n && t({
|
|
107
|
-
type:
|
|
115
|
+
type: l.Warning,
|
|
108
116
|
message: o("custom-fields.missing-opening-braces")
|
|
109
117
|
}), s === n;
|
|
110
|
-
},
|
|
118
|
+
}, k = (e) => {
|
|
111
119
|
const s = fe(e).length === 0;
|
|
112
120
|
return s || t({
|
|
113
|
-
type:
|
|
121
|
+
type: l.Warning,
|
|
114
122
|
message: o("custom-fields.invalid-custom-fields")
|
|
115
123
|
}), s;
|
|
116
|
-
},
|
|
124
|
+
}, O = (e, s, n, r) => {
|
|
117
125
|
if (p)
|
|
118
126
|
return !0;
|
|
119
|
-
const
|
|
127
|
+
const c = de(
|
|
120
128
|
e,
|
|
121
129
|
s,
|
|
122
130
|
ae(e),
|
|
123
131
|
n,
|
|
124
132
|
r
|
|
125
133
|
);
|
|
126
|
-
if (
|
|
134
|
+
if (c.length > 0) {
|
|
127
135
|
const i = `
|
|
128
136
|
<ul>
|
|
129
|
-
${
|
|
137
|
+
${c.map((a) => `<li>${a}</li>`).join("")}
|
|
130
138
|
</ul>
|
|
131
139
|
`;
|
|
132
140
|
return t({
|
|
133
|
-
type:
|
|
141
|
+
type: l.Error,
|
|
134
142
|
message: o("custom-fields.invalid-custom-fields") + i
|
|
135
143
|
}), !1;
|
|
136
144
|
}
|
|
137
145
|
return !0;
|
|
138
|
-
},
|
|
146
|
+
}, B = (e) => {
|
|
139
147
|
const s = e.match(/{%(.*?)%}/g), n = [];
|
|
140
148
|
let r = !0;
|
|
141
|
-
if (s && s.forEach((
|
|
142
|
-
const i =
|
|
143
|
-
(!i ||
|
|
144
|
-
type:
|
|
149
|
+
if (s && s.forEach((c) => {
|
|
150
|
+
const i = c.match(P), a = c.match(X), v = (i == null ? void 0 : i.join("")) || "";
|
|
151
|
+
(!i || c !== v) && !a && (t({
|
|
152
|
+
type: l.Error,
|
|
145
153
|
message: o("newsletter.display-conditions-invalid-syntax")
|
|
146
154
|
}), r = !1), i && i.forEach((C) => {
|
|
147
155
|
C.trim() === "=" && (t({
|
|
148
|
-
type:
|
|
156
|
+
type: l.Error,
|
|
149
157
|
message: o("custom-conditions.wrong-equality-operators")
|
|
150
158
|
}), r = !1);
|
|
151
159
|
const I = C.match(/^[a-zA-Z]*$/g);
|
|
152
|
-
I && I.forEach((
|
|
153
|
-
y(
|
|
160
|
+
I && I.forEach((w) => {
|
|
161
|
+
y(w) && n.push(w);
|
|
154
162
|
});
|
|
155
163
|
});
|
|
156
164
|
}), n.length) {
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
type:
|
|
165
|
+
const c = n.filter((a) => a === "if"), i = n.filter((a) => a === "endif");
|
|
166
|
+
c.length !== i.length && (t({
|
|
167
|
+
type: l.Error,
|
|
160
168
|
message: o("custom-conditions.missing-if-endif-tag")
|
|
161
169
|
}), r = !1);
|
|
162
170
|
}
|
|
163
171
|
return r;
|
|
164
|
-
},
|
|
172
|
+
}, D = (e) => {
|
|
165
173
|
const s = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = s === n;
|
|
166
174
|
return r || t({
|
|
167
|
-
type:
|
|
175
|
+
type: l.Warning,
|
|
168
176
|
message: o("custom-conditions.no-space-after-braces")
|
|
169
177
|
}), r;
|
|
170
|
-
},
|
|
171
|
-
type:
|
|
178
|
+
}, F = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (t({
|
|
179
|
+
type: l.Warning,
|
|
172
180
|
message: o("custom-conditions.no-braces-inside-if-tag")
|
|
173
|
-
}), !1) : !0,
|
|
174
|
-
type:
|
|
181
|
+
}), !1) : !0, b = () => u.hasInvalidBlock() ? (t({
|
|
182
|
+
type: l.Error,
|
|
175
183
|
message: o(ee)
|
|
176
|
-
}), !1) : !0,
|
|
177
|
-
type:
|
|
184
|
+
}), !1) : !0, S = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((n) => n.value === "")) !== void 0 ? (t({
|
|
185
|
+
type: l.Error,
|
|
178
186
|
message: o("newsletter.fill-all-necessary-fields")
|
|
179
187
|
}), !1) : !0, L = (e) => {
|
|
180
188
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
181
189
|
return e.match(s) === null ? !0 : (t({
|
|
182
|
-
type:
|
|
190
|
+
type: l.Error,
|
|
183
191
|
message: o("newsletter.invalid-image-type")
|
|
184
192
|
}), !1);
|
|
185
193
|
}, V = (e) => {
|
|
186
194
|
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
|
|
187
195
|
return Array.from(r).find((i) => {
|
|
188
|
-
var
|
|
189
|
-
return !((
|
|
196
|
+
var a;
|
|
197
|
+
return !((a = i.id) != null && a.trim());
|
|
190
198
|
}) ? (t({
|
|
191
|
-
type:
|
|
199
|
+
type: l.Error,
|
|
192
200
|
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
193
201
|
}), !1) : !0;
|
|
194
202
|
}, M = (e) => {
|
|
195
203
|
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
|
|
196
204
|
return Array.from(r).find((i) => {
|
|
197
|
-
var
|
|
198
|
-
return !((
|
|
205
|
+
var a;
|
|
206
|
+
return !((a = i.id) != null && a.trim());
|
|
199
207
|
}) ? (t({
|
|
200
|
-
type:
|
|
208
|
+
type: l.Error,
|
|
201
209
|
message: o("unsubscribe-templates.select-radio-button-groups")
|
|
202
210
|
}), !1) : !0;
|
|
203
211
|
};
|
|
@@ -207,9 +215,9 @@ const xe = () => {
|
|
|
207
215
|
...s.map((I) => I.value),
|
|
208
216
|
...z,
|
|
209
217
|
...((C = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : C.customFieldAttributes) ?? []
|
|
210
|
-
],
|
|
211
|
-
return await
|
|
212
|
-
} };
|
|
218
|
+
], c = G(e), i = await E(c);
|
|
219
|
+
return await _(e, r, n) && N(e) && x(e) && k(e) && O(e, r, c, i) && B(e) && D(e) && F(e) && b() && S() && L(e) && V(e) && M(e);
|
|
220
|
+
}, validateRecommendationBlocks: b, validateRecommendationFilters: S };
|
|
213
221
|
};
|
|
214
222
|
export {
|
|
215
223
|
ue as buildPartnerAttributeNameSet,
|
|
@@ -1,84 +1,93 @@
|
|
|
1
|
-
import { getCsrfToken as
|
|
2
|
-
import { ref as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
import { getCsrfToken as S } from "../utils/genericUtil.js";
|
|
2
|
+
import { ref as T, computed as v } from "vue";
|
|
3
|
+
const H = (c) => {
|
|
4
|
+
const a = c.trim();
|
|
5
|
+
if (!a.startsWith("{") && !a.startsWith("["))
|
|
6
|
+
return c;
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(a);
|
|
9
|
+
} catch {
|
|
10
|
+
return c;
|
|
11
|
+
}
|
|
12
|
+
}, k = (c = {}) => {
|
|
13
|
+
const a = T(!1), n = T(null), f = T(null), b = v(() => a.value), g = v(() => n.value !== null), y = {
|
|
5
14
|
baseURL: "",
|
|
6
15
|
timeout: 1e4,
|
|
7
16
|
retry: 0,
|
|
8
17
|
retryDelay: 1e3,
|
|
9
18
|
headers: {
|
|
10
19
|
"Content-Type": "application/json",
|
|
11
|
-
"X-CSRF-TOKEN":
|
|
20
|
+
"X-CSRF-TOKEN": S()
|
|
12
21
|
},
|
|
13
|
-
...
|
|
14
|
-
}, w = (
|
|
15
|
-
if (
|
|
16
|
-
return
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
}, P = (
|
|
22
|
+
...c
|
|
23
|
+
}, w = (t, s) => {
|
|
24
|
+
if (t.startsWith("http://") || t.startsWith("https://"))
|
|
25
|
+
return t;
|
|
26
|
+
const e = s || y.baseURL || "";
|
|
27
|
+
return e.endsWith("/") && t.startsWith("/") ? `${e}${t.slice(1)}` : e.endsWith("/") || t.startsWith("/") ? `${e}${t}` : `${e}/${t}`;
|
|
28
|
+
}, P = (t) => new Promise((s, e) => {
|
|
20
29
|
setTimeout(() => {
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
}),
|
|
24
|
-
setTimeout(s,
|
|
25
|
-
}),
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
method:
|
|
29
|
-
headers: { ...
|
|
30
|
-
signal:
|
|
31
|
-
...
|
|
30
|
+
e(new Error("Request timeout"));
|
|
31
|
+
}, t);
|
|
32
|
+
}), C = (t) => new Promise((s) => {
|
|
33
|
+
setTimeout(s, t);
|
|
34
|
+
}), l = async (t, s, e, q = {}) => {
|
|
35
|
+
n.value = null, a.value = !0, f.value = new AbortController();
|
|
36
|
+
const i = { ...y, ...q }, D = w(s, i.baseURL), d = {
|
|
37
|
+
method: t,
|
|
38
|
+
headers: { ...i.headers },
|
|
39
|
+
signal: f.value.signal,
|
|
40
|
+
...i
|
|
32
41
|
};
|
|
33
|
-
|
|
34
|
-
const E = async (
|
|
42
|
+
e && ["POST", "PUT", "PATCH"].includes(t) && (e instanceof FormData ? (delete d.headers["Content-Type"], d.body = e) : d.body = JSON.stringify(e));
|
|
43
|
+
const E = async (p = 0) => {
|
|
35
44
|
try {
|
|
36
|
-
const o = [fetch(
|
|
37
|
-
|
|
45
|
+
const o = [fetch(D, d)];
|
|
46
|
+
i.timeout && o.push(P(i.timeout));
|
|
38
47
|
const r = await Promise.race(o);
|
|
39
48
|
if (!r.ok) {
|
|
40
|
-
const
|
|
41
|
-
throw
|
|
49
|
+
const L = `HTTP Error: ${r.status} ${r.statusText}`, m = new Error(L);
|
|
50
|
+
throw m.status = r.status, m.statusText = r.statusText, m.response = r, m;
|
|
42
51
|
}
|
|
43
|
-
let
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
data:
|
|
52
|
+
let h;
|
|
53
|
+
const u = r.headers.get("content-type");
|
|
54
|
+
return u != null && u.includes("application/json") ? h = await r.json() : u != null && u.includes("text/") ? h = H(await r.text()) : h = await r.blob(), {
|
|
55
|
+
data: h,
|
|
47
56
|
status: r.status,
|
|
48
57
|
statusText: r.statusText,
|
|
49
58
|
headers: r.headers
|
|
50
59
|
};
|
|
51
60
|
} catch (o) {
|
|
52
61
|
const r = o instanceof Error && o.name === "AbortError";
|
|
53
|
-
if (
|
|
54
|
-
return await
|
|
55
|
-
throw o instanceof Error ? o.name === "AbortError" ?
|
|
62
|
+
if (p < (i.retry || 0) && !r)
|
|
63
|
+
return await C(i.retryDelay || 1e3), E(p + 1);
|
|
64
|
+
throw o instanceof Error ? o.name === "AbortError" ? n.value = { message: "Request was cancelled" } : n.value = { message: o.message } : n.value = o, o;
|
|
56
65
|
}
|
|
57
66
|
};
|
|
58
67
|
try {
|
|
59
68
|
return await E();
|
|
60
69
|
} finally {
|
|
61
|
-
|
|
70
|
+
a.value = !1, f.value = null;
|
|
62
71
|
}
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
|
|
72
|
+
}, x = (t, s) => l("GET", t, void 0, s), W = (t, s, e) => l("POST", t, s, e), $ = (t, s, e) => l("PUT", t, s, e), R = (t, s, e) => l("PATCH", t, s, e), U = (t, s) => l("DELETE", t, void 0, s), A = (t) => {
|
|
73
|
+
f.value && f.value.abort(t);
|
|
74
|
+
}, O = () => {
|
|
75
|
+
n.value = null;
|
|
67
76
|
};
|
|
68
77
|
return {
|
|
69
78
|
// State
|
|
70
|
-
loading:
|
|
71
|
-
error:
|
|
72
|
-
hasError:
|
|
79
|
+
loading: b,
|
|
80
|
+
error: v(() => n.value),
|
|
81
|
+
hasError: g,
|
|
73
82
|
// Methods
|
|
74
|
-
request:
|
|
75
|
-
get:
|
|
76
|
-
post:
|
|
77
|
-
put:
|
|
78
|
-
patch:
|
|
79
|
-
delete:
|
|
80
|
-
cancel:
|
|
81
|
-
clearError:
|
|
83
|
+
request: l,
|
|
84
|
+
get: x,
|
|
85
|
+
post: W,
|
|
86
|
+
put: $,
|
|
87
|
+
patch: R,
|
|
88
|
+
delete: U,
|
|
89
|
+
cancel: A,
|
|
90
|
+
clearError: O
|
|
82
91
|
};
|
|
83
92
|
};
|
|
84
93
|
export {
|