@useinsider/guido 3.4.2-beta.6886b92 → 3.5.0-beta.70f8c74
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/README.md +2 -0
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +50 -48
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +2 -2
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +49 -49
- package/dist/composables/useActionsApi.js +9 -5
- package/dist/composables/useSave.js +13 -14
- package/dist/config/migrator/checkboxMigrator.js +20 -69
- package/dist/config/migrator/radioButtonMigrator.js +36 -91
- package/dist/config/migrator/textBlockMigration.js +65 -0
- package/dist/extensions/Blocks/Recommendation/block.js +90 -45
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +33 -14
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +24 -16
- package/dist/extensions/Blocks/Unsubscribe/block.js +133 -49
- package/dist/extensions/Blocks/Unsubscribe/template.js +8 -8
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +2 -1
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +145 -144
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/config/migrator/textBlockMigration.d.ts +24 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/filterUtil.d.ts +2 -0
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +20 -1
- package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
- package/dist/src/stores/config.test.d.ts +1 -0
- package/dist/src/vitest.setup.d.ts +0 -0
- package/dist/static/styles/components/wide-panel.css.js +5 -0
- package/dist/stores/config.js +24 -23
- package/dist/utils/templatePreparation.js +51 -43
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
# @useinsider/guido
|
|
10
10
|
|
|
11
|
+
[](http://coverus.internal.dataforce/app/project/github/useinsider/guido)
|
|
12
|
+
|
|
11
13
|
Guido is a Vue 2 + TypeScript wrapper for the Stripo Email Editor plugin. Easily embed the professional email editor in your Vue applications with a clean, type-safe configuration.
|
|
12
14
|
|
|
13
15
|
## Installation
|
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCortexBlueprintBridge as
|
|
3
|
-
import { provideGuidoActions as
|
|
4
|
-
import { useGuidoStateBridge as
|
|
5
|
-
import { usePartner as
|
|
6
|
-
import { useStripo as
|
|
7
|
-
import { useTimerClone as
|
|
1
|
+
import { defineComponent as Q, defineAsyncComponent as N, ref as I, computed as W, watch as X, onMounted as Y, onUnmounted as Z } from "vue";
|
|
2
|
+
import { useCortexBlueprintBridge as ee } from "../composables/useCortexBlueprintBridge.js";
|
|
3
|
+
import { provideGuidoActions as oe } from "../composables/useGuidoActions.js";
|
|
4
|
+
import { useGuidoStateBridge as te } from "../composables/useGuidoStateBridge.js";
|
|
5
|
+
import { usePartner as ne } from "../composables/usePartner.js";
|
|
6
|
+
import { useStripo as re } from "../composables/useStripo.js";
|
|
7
|
+
import { useTimerClone as se } from "../composables/useTimerClone.js";
|
|
8
8
|
import { migrate as x } from "../config/migrator/index.js";
|
|
9
9
|
import { ModuleFolderDefaults as G } from "../enums/defaults.js";
|
|
10
|
-
import { RIBBON_SELECTOR as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
10
|
+
import { RIBBON_SELECTOR as ce } from "../enums/onboarding.js";
|
|
11
|
+
import { useRecommendationExtensionStore as ae } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
12
|
+
import ie from "./organisms/AutoSaveController.vue.js";
|
|
13
|
+
import me from "./organisms/base/Toaster.vue.js";
|
|
14
|
+
import de from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
15
|
+
import le from "./organisms/header/HeaderWrapper.vue.js";
|
|
16
|
+
import ue from "./organisms/LoadingWrapper.vue.js";
|
|
17
|
+
import pe from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
18
|
+
import fe from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
19
|
+
import { useStripoApi as ve } from "../services/stripoApi.js";
|
|
20
|
+
import { useConfigStore as ye } from "../stores/config.js";
|
|
21
|
+
import { useDynamicContentStore as Se } from "../stores/dynamic-content.js";
|
|
22
|
+
import { useEditorStore as H } from "../stores/editor.js";
|
|
22
23
|
import { usePreviewStore as he } from "../stores/preview.js";
|
|
23
|
-
import {
|
|
24
|
-
|
|
24
|
+
import { useTemplateStore as be } from "../stores/template.js";
|
|
25
|
+
import { useUnsubscribeStore as ge } from "../stores/unsubscribe.js";
|
|
26
|
+
const Ke = /* @__PURE__ */ Q({
|
|
25
27
|
__name: "Guido",
|
|
26
28
|
props: {
|
|
27
29
|
config: null
|
|
28
30
|
},
|
|
29
31
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
30
|
-
setup(
|
|
31
|
-
const g =
|
|
32
|
+
setup($, { expose: z, emit: n }) {
|
|
33
|
+
const g = $, q = N(
|
|
32
34
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
33
|
-
), K =
|
|
35
|
+
), K = N(
|
|
34
36
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
35
|
-
),
|
|
37
|
+
), E = I(), u = I(), p = Se(), w = ge(), i = ye();
|
|
36
38
|
i.init(g.config);
|
|
37
|
-
const f =
|
|
39
|
+
const f = H(), V = he(), m = W(() => f.hasChanges), { isTestPartner: j } = ne(), D = () => {
|
|
38
40
|
var e;
|
|
39
|
-
return (e =
|
|
41
|
+
return (e = E.value) == null ? void 0 : e.handleSave(!0);
|
|
40
42
|
}, {
|
|
41
43
|
templateId: v,
|
|
42
44
|
userId: C,
|
|
@@ -45,8 +47,8 @@ const He = /* @__PURE__ */ J({
|
|
|
45
47
|
template: o,
|
|
46
48
|
editor: s
|
|
47
49
|
} = i, d = (o == null ? void 0 : o.html) || "", F = (o == null ? void 0 : o.css) || "", y = (o == null ? void 0 : o.preselectedDynamicContent) || [], L = (s == null ? void 0 : s.savedModulesFolderName) || G.SAVED_MODULES, U = (s == null ? void 0 : s.defaultModulesFolderName) || G.DEFAULT_MODULES;
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
+
ee(), te();
|
|
51
|
+
const S = {
|
|
50
52
|
emailId: v,
|
|
51
53
|
userId: C,
|
|
52
54
|
username: k,
|
|
@@ -58,11 +60,11 @@ const He = /* @__PURE__ */ J({
|
|
|
58
60
|
onReady: () => {
|
|
59
61
|
console.debug("guido:ready"), n("ready");
|
|
60
62
|
}
|
|
61
|
-
}, { initPlugin: M } =
|
|
63
|
+
}, { initPlugin: M } = re(S, _), { getDefaultTemplate: O } = ve(), { cloneTimersOnSave: P, hasTimerBlocks: R } = se(), J = W(() => {
|
|
62
64
|
var e;
|
|
63
65
|
return !((e = i.ui) != null && e.showHeader);
|
|
64
66
|
});
|
|
65
|
-
|
|
67
|
+
oe({
|
|
66
68
|
onBack: () => {
|
|
67
69
|
console.debug("guido:back"), n("back");
|
|
68
70
|
},
|
|
@@ -70,50 +72,50 @@ const He = /* @__PURE__ */ J({
|
|
|
70
72
|
console.debug("guido:save:start"), n("save:start");
|
|
71
73
|
},
|
|
72
74
|
onSaveComplete: (e) => {
|
|
73
|
-
const t = { ...e, metadata:
|
|
75
|
+
const t = { ...e, metadata: S };
|
|
74
76
|
console.debug("guido:save:complete", t), n("save:complete", t);
|
|
75
77
|
},
|
|
76
78
|
onTestEmailClick: () => {
|
|
77
79
|
console.debug("guido:test-email:click"), n("test-email:click");
|
|
78
80
|
}
|
|
79
81
|
});
|
|
80
|
-
const
|
|
82
|
+
const A = (e) => {
|
|
81
83
|
console.debug("dynamic-content:close", e), p.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
82
|
-
},
|
|
84
|
+
}, B = () => {
|
|
83
85
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
84
86
|
};
|
|
85
|
-
|
|
87
|
+
X(() => m.value, () => {
|
|
86
88
|
n("on-change", m.value);
|
|
87
89
|
});
|
|
88
|
-
const
|
|
90
|
+
const h = (e) => {
|
|
89
91
|
const t = e, { attribute: l, position: a } = t.detail;
|
|
90
92
|
console.debug("dynamic-content:open", t.detail), n("dynamic-content:open", l, a);
|
|
91
93
|
};
|
|
92
94
|
let c = null;
|
|
93
95
|
const b = () => {
|
|
94
96
|
var t;
|
|
95
|
-
const e = document.querySelector(
|
|
97
|
+
const e = document.querySelector(ce);
|
|
96
98
|
(t = u.value) == null || t.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
|
|
97
99
|
};
|
|
98
|
-
return
|
|
100
|
+
return Y(async () => {
|
|
99
101
|
var t, l;
|
|
100
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), b();
|
|
102
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), ae().$reset(), H().$reset(), f.templateId = v, be().$reset(), b();
|
|
101
103
|
const e = (t = u.value) == null ? void 0 : t.parentElement;
|
|
102
104
|
e && (c = new ResizeObserver(b), c.observe(e));
|
|
103
105
|
try {
|
|
104
|
-
|
|
106
|
+
w.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
|
|
105
107
|
const a = ((l = o == null ? void 0 : o.migration) == null ? void 0 : l.recommendationConfigs) ?? {};
|
|
106
108
|
let r = {
|
|
107
109
|
html: d && await x(d, a),
|
|
108
110
|
css: F
|
|
109
111
|
};
|
|
110
|
-
r.html || (r = await O(), r.html = await x(r.html, a)),
|
|
112
|
+
r.html || (r = await O(), r.html = await x(r.html, a)), R(r.html) && (r.html = await P(r.html)), await M(r), p.selectedDynamicContentList = y;
|
|
111
113
|
} catch (a) {
|
|
112
114
|
console.error("Failed to initialize Stripo editor:", a);
|
|
113
115
|
}
|
|
114
|
-
document.addEventListener("dynamic-content:open",
|
|
115
|
-
}),
|
|
116
|
-
c == null || c.disconnect(), document.removeEventListener("dynamic-content:open",
|
|
116
|
+
document.addEventListener("dynamic-content:open", h);
|
|
117
|
+
}), Z(() => {
|
|
118
|
+
c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", h);
|
|
117
119
|
try {
|
|
118
120
|
window.UIEditor.removeEditor();
|
|
119
121
|
} catch {
|
|
@@ -122,14 +124,14 @@ const He = /* @__PURE__ */ J({
|
|
|
122
124
|
i.reset();
|
|
123
125
|
}), z({
|
|
124
126
|
dynamicContent: {
|
|
125
|
-
insert:
|
|
126
|
-
close:
|
|
127
|
+
insert: A,
|
|
128
|
+
close: B
|
|
127
129
|
},
|
|
128
130
|
hasChanges: m,
|
|
129
131
|
saveSilent: D
|
|
130
|
-
}), { __sfc: !0, PreviewContainer: q, OnboardingWrapper: K, headerWrapperRef:
|
|
132
|
+
}), { __sfc: !0, PreviewContainer: q, OnboardingWrapper: K, headerWrapperRef: E, wrapperRef: u, dynamicContentStore: p, unsubscribeStore: w, props: g, configStore: i, editorStore: f, previewStore: V, hasChanges: m, isTestPartner: j, saveSilent: D, templateId: v, userId: C, partnerName: T, username: k, templateConfig: o, editorConfig: s, html: d, css: F, preselectedDynamicContentList: y, savedModulesFolderName: L, defaultModulesFolderName: U, emit: n, metadata: S, options: _, initPlugin: M, getDefaultTemplate: O, cloneTimersOnSave: P, hasTimerBlocks: R, noHeader: J, insertDynamicContent: A, closeDynamicContent: B, handleDynamicContentOpen: h, ribbonObserver: c, updateRibbonOffset: b, AutoSaveController: ie, Toaster: me, FilterSelectionDrawer: de, HeaderWrapper: le, LoadingWrapper: ue, SaveAsTemplateDrawer: pe, UnsubscribeWrapper: fe };
|
|
131
133
|
}
|
|
132
134
|
});
|
|
133
135
|
export {
|
|
134
|
-
|
|
136
|
+
Ke as default
|
|
135
137
|
};
|
|
@@ -5,7 +5,7 @@ var r = 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: t.handleOperatorChange } }), t.isAnyOfOperator ? e(t.InTags, { staticClass: "w-2", attrs: { "allow-bulk-paste": "",
|
|
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": "", "allow-duplicates": !1, invalid: t.invalidFields.has("value"), "invalid-message": t.valueErrorMessage, label: t.trans("condition.value"), placeholder: t.trans("condition.enter-value-placeholder"), validate: t.isValidFilterTag, value: t.tagValues }, on: { input: t.onTagsInput } }) : t.isDateAttribute ? e(t.InDatePickerV2, { staticClass: "w-2", attrs: { id: `filter-item-input--value-${a.index}`, "single-date-picker-status": "", "label-text": t.trans("condition.value"), locale: t.datePickerLocale, name: `filter-item-input--value-${a.index}`, "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-${a.index}`, 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: t.safeDecodeURIComponent(t.props.filter.value) }, on: { input: function(s) {
|
|
9
9
|
t.updateFilter({ text: "value", value: encodeURIComponent(s) });
|
|
10
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) {
|
|
11
11
|
return t.updateFilter({ text: "innerGroupOperator", value: s });
|
|
@@ -16,7 +16,7 @@ var r = function() {
|
|
|
16
16
|
n,
|
|
17
17
|
!1,
|
|
18
18
|
null,
|
|
19
|
-
"
|
|
19
|
+
"5553d071"
|
|
20
20
|
);
|
|
21
21
|
const f = o.exports;
|
|
22
22
|
export {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTranslations as
|
|
3
|
-
import { getOperatorOptions as
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
5
|
-
import { parseTagList as
|
|
6
|
-
import { getInvalidFilterFields as
|
|
7
|
-
import { locale as
|
|
8
|
-
import { InTags as
|
|
9
|
-
import
|
|
10
|
-
import { useDebounceFn as
|
|
11
|
-
const
|
|
1
|
+
import { defineComponent as R, computed as a } from "vue";
|
|
2
|
+
import { useTranslations as E } from "../../../../composables/useTranslations.js";
|
|
3
|
+
import { getOperatorOptions as d, OP_ANY_OF as f } from "../../../../enums/extensions/recommendationBlock.js";
|
|
4
|
+
import { useRecommendationExtensionStore as U } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { parseTagList as w, safeDecodeURIComponent as F, isValidFilterTag as M, encodeTagList as Y } from "../../../../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
6
|
+
import { getInvalidFilterFields as j } from "../../../../extensions/Blocks/Recommendation/validation/filterSchema.js";
|
|
7
|
+
import { locale as q } from "../../../../utils/dateUtil.js";
|
|
8
|
+
import { InTags as z, InButtonV2 as G, InSelect as H, InDatePickerV2 as J, InBasicTextInput as K } from "@useinsider/design-system-vue";
|
|
9
|
+
import Q from "./LogicAdapter.vue.js";
|
|
10
|
+
import { useDebounceFn as W } from "../../../../node_modules/@vueuse/shared/index.js";
|
|
11
|
+
const pe = /* @__PURE__ */ R({
|
|
12
12
|
__name: "FilterItem",
|
|
13
13
|
props: {
|
|
14
14
|
filter: null,
|
|
@@ -17,8 +17,8 @@ const se = /* @__PURE__ */ N({
|
|
|
17
17
|
submitted: { type: Boolean }
|
|
18
18
|
},
|
|
19
19
|
emits: ["delete-filter"],
|
|
20
|
-
setup(
|
|
21
|
-
const t =
|
|
20
|
+
setup(T, { emit: I }) {
|
|
21
|
+
const t = T, s = E(), l = U(), O = [
|
|
22
22
|
{
|
|
23
23
|
text: s("email-editor.standard-filter"),
|
|
24
24
|
value: "standardFilter"
|
|
@@ -26,79 +26,79 @@ const se = /* @__PURE__ */ N({
|
|
|
26
26
|
], u = [
|
|
27
27
|
{ text: "True", value: "true" },
|
|
28
28
|
{ text: "False", value: "false" }
|
|
29
|
-
], m =
|
|
29
|
+
], m = a(() => t.filter.attribute || ""), i = a(() => l.getFilterList.find((e) => e.value === m.value) || { text: "", value: "", type: "" }), h = a(
|
|
30
30
|
() => {
|
|
31
31
|
var e;
|
|
32
32
|
return ((e = i.value) == null ? void 0 : e.type) === "Boolean";
|
|
33
33
|
}
|
|
34
|
-
), b =
|
|
34
|
+
), b = a(() => {
|
|
35
35
|
var e;
|
|
36
|
-
return
|
|
37
|
-
}), A =
|
|
36
|
+
return d((e = i.value) == null ? void 0 : e.type).find((r) => r.value === t.filter.operator);
|
|
37
|
+
}), A = a(
|
|
38
38
|
() => u.find((e) => e.value === t.filter.value) || u[0]
|
|
39
|
-
), p =
|
|
39
|
+
), p = a(() => t.submitted ? j(t.filter) : /* @__PURE__ */ new Set()), x = (e) => p.value.has(e) ? "error" : "default", B = a(
|
|
40
40
|
() => p.value.has("value") ? s("action-builder.filter-empty-value-error") : ""
|
|
41
|
-
), v =
|
|
41
|
+
), v = a(
|
|
42
42
|
() => {
|
|
43
43
|
var e;
|
|
44
44
|
return ((e = i.value) == null ? void 0 : e.type) === "Number";
|
|
45
45
|
}
|
|
46
|
-
), D =
|
|
46
|
+
), D = a(() => v.value ? "number" : "text"), V = a(
|
|
47
47
|
() => {
|
|
48
48
|
var e;
|
|
49
49
|
return ((e = i.value) == null ? void 0 : e.type) === "Date";
|
|
50
50
|
}
|
|
51
|
-
), _ =
|
|
52
|
-
|
|
51
|
+
), _ = a(() => t.filter.operator === f), k = a(() => w(t.filter.value)), C = W((e) => {
|
|
52
|
+
l.updateFilter({
|
|
53
53
|
...t.filter,
|
|
54
54
|
[e.text]: e.value
|
|
55
55
|
});
|
|
56
|
-
}, 500),
|
|
57
|
-
const
|
|
58
|
-
|
|
56
|
+
}, 500), L = (e) => {
|
|
57
|
+
const r = l.getFilterList.find((c) => c.value === e.value), n = (r == null ? void 0 : r.type) === "Boolean", [o] = d(r == null ? void 0 : r.type);
|
|
58
|
+
l.updateFilter({
|
|
59
59
|
...t.filter,
|
|
60
60
|
attribute: e.value,
|
|
61
|
-
operator:
|
|
62
|
-
value:
|
|
61
|
+
operator: n ? "=" : (o == null ? void 0 : o.value) ?? "",
|
|
62
|
+
value: n ? "true" : ""
|
|
63
63
|
});
|
|
64
|
-
},
|
|
65
|
-
|
|
64
|
+
}, P = (e) => {
|
|
65
|
+
l.updateFilter({
|
|
66
66
|
...t.filter,
|
|
67
67
|
operator: "=",
|
|
68
68
|
value: e.value
|
|
69
69
|
});
|
|
70
70
|
}, S = (e) => {
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
71
|
+
const r = e.value;
|
|
72
|
+
if (r === t.filter.operator)
|
|
73
73
|
return;
|
|
74
|
-
const c = t.filter.operator ===
|
|
75
|
-
|
|
74
|
+
const c = t.filter.operator === f !== (r === f);
|
|
75
|
+
l.updateFilter({
|
|
76
76
|
...t.filter,
|
|
77
|
-
operator:
|
|
77
|
+
operator: r,
|
|
78
78
|
value: c ? "" : t.filter.value
|
|
79
79
|
});
|
|
80
|
-
}, $ =
|
|
81
|
-
const [
|
|
82
|
-
return !
|
|
83
|
-
},
|
|
84
|
-
const [
|
|
85
|
-
return !
|
|
86
|
-
},
|
|
87
|
-
() => y(
|
|
80
|
+
}, $ = q(), y = (e) => {
|
|
81
|
+
const [r, n, o] = e.split("-");
|
|
82
|
+
return !r || !n || !o ? "" : `${n}/${o}/${r}`;
|
|
83
|
+
}, g = (e) => {
|
|
84
|
+
const [r, n, o] = e.split("/");
|
|
85
|
+
return !o || !r || !n ? "" : `${o}-${r.padStart(2, "0")}-${n.padStart(2, "0")}`;
|
|
86
|
+
}, N = a(
|
|
87
|
+
() => y(F(t.filter.value))
|
|
88
88
|
);
|
|
89
|
-
return { __sfc: !0, trans: s, store:
|
|
90
|
-
|
|
89
|
+
return { __sfc: !0, trans: s, store: l, props: t, filterTypeOptions: O, booleanValueOptions: u, attributeType: m, selectedAttributeType: i, isBooleanAttribute: h, selectedOperatorType: b, selectedBooleanValue: A, emit: I, invalidFields: p, getFieldState: x, valueErrorMessage: B, isNumericAttribute: v, valueInputType: D, isDateAttribute: V, isAnyOfOperator: _, tagValues: k, updateFilter: C, handleAttributeChange: L, handleBooleanValueChange: P, handleOperatorChange: S, datePickerLocale: $, isoToPickerDate: y, pickerDateToIso: g, datePickerValue: N, onDatePickerApply: (e) => {
|
|
90
|
+
l.updateFilter({
|
|
91
91
|
...t.filter,
|
|
92
|
-
value: encodeURIComponent(
|
|
92
|
+
value: encodeURIComponent(g(e))
|
|
93
93
|
});
|
|
94
94
|
}, onTagsInput: (e) => {
|
|
95
|
-
|
|
95
|
+
l.updateFilter({
|
|
96
96
|
...t.filter,
|
|
97
|
-
value: e
|
|
97
|
+
value: Y(e)
|
|
98
98
|
});
|
|
99
|
-
}, getOperatorOptions:
|
|
99
|
+
}, getOperatorOptions: d, isValidFilterTag: M, safeDecodeURIComponent: F, InBasicTextInput: K, InDatePickerV2: J, InSelect: H, InButtonV2: G, InTags: z, LogicAdapter: Q };
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
export {
|
|
103
|
-
|
|
103
|
+
pe as default
|
|
104
104
|
};
|
|
@@ -21,9 +21,9 @@ const v = () => {
|
|
|
21
21
|
resetDataSavedFlag: !1,
|
|
22
22
|
disableLineHeightsReplace: !0
|
|
23
23
|
}, ...t }, s = {
|
|
24
|
-
callback: (l,
|
|
24
|
+
callback: (l, p, d, c, u) => {
|
|
25
25
|
l ? a(l) : e({
|
|
26
|
-
html:
|
|
26
|
+
html: p,
|
|
27
27
|
ampHtml: d,
|
|
28
28
|
ampErrors: c,
|
|
29
29
|
displayConditions: u
|
|
@@ -36,11 +36,11 @@ const v = () => {
|
|
|
36
36
|
return {
|
|
37
37
|
getCompiledEmail: m,
|
|
38
38
|
getTemplateData: () => new Promise((t) => {
|
|
39
|
-
const e = ({ html: a, css: i, width: o, height:
|
|
39
|
+
const e = ({ html: a, css: i, width: o, height: r, utmParams: s, syncModulesIds: l }) => t({
|
|
40
40
|
html: a,
|
|
41
41
|
css: i,
|
|
42
42
|
width: o,
|
|
43
|
-
height:
|
|
43
|
+
height: r,
|
|
44
44
|
utmParams: s,
|
|
45
45
|
syncModulesIds: l
|
|
46
46
|
});
|
|
@@ -91,7 +91,11 @@ const v = () => {
|
|
|
91
91
|
},
|
|
92
92
|
editorSave: () => new Promise((t) => {
|
|
93
93
|
window.StripoEditorApi.actionsApi.save((e) => {
|
|
94
|
-
|
|
94
|
+
if (e) {
|
|
95
|
+
n(e, "Failed to save template"), t(!1);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
t(!0);
|
|
95
99
|
});
|
|
96
100
|
})
|
|
97
101
|
};
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
import { useActionsApi as x } from "./useActionsApi.js";
|
|
2
2
|
import { useConfig as y } from "./useConfig.js";
|
|
3
3
|
import { useSaveStart as w, useSaveComplete as C } from "./useGuidoActions.js";
|
|
4
|
-
import { useSyncModuleExtractor as
|
|
5
|
-
import { useStripoApi as
|
|
6
|
-
import { useTemplatePreparation as
|
|
7
|
-
import { useHtmlValidator as
|
|
8
|
-
import { useCouponBlockValidator as
|
|
9
|
-
import { useLiquidValidator as
|
|
10
|
-
const
|
|
11
|
-
const o = w(), s = C(), { validateHtml: r } =
|
|
4
|
+
import { useSyncModuleExtractor as E } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { useStripoApi as H } from "../services/stripoApi.js";
|
|
6
|
+
import { useTemplatePreparation as b } from "../utils/templatePreparation.js";
|
|
7
|
+
import { useHtmlValidator as q } from "./useHtmlValidator.js";
|
|
8
|
+
import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
|
|
9
|
+
import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
|
|
10
|
+
const z = () => {
|
|
11
|
+
const o = w(), s = C(), { validateHtml: r } = q(), { validateLiquidSyntax: n } = P(), { validateCouponBlockTags: l } = L(), { callbacks: a, isFeatureEnabled: d } = y(), { extractSyncModuleData: u } = E(), { setSyncModuleUnsubscriptionPages: c } = H(), { editorSave: m } = x();
|
|
12
12
|
return { save: async (p = !1, f = !1) => {
|
|
13
13
|
var i;
|
|
14
14
|
o();
|
|
15
|
-
const { prepareTemplateDetails: v } =
|
|
16
|
-
if (!
|
|
15
|
+
const { prepareTemplateDetails: v } = b(), t = await v();
|
|
16
|
+
if (!l(t.compiledHtml))
|
|
17
17
|
return;
|
|
18
18
|
if (d("liquidSyntax")) {
|
|
19
|
-
if (!await
|
|
19
|
+
if (!await n(t.compiledHtml))
|
|
20
20
|
return;
|
|
21
21
|
} else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
|
|
22
22
|
return;
|
|
23
|
-
if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
|
|
23
|
+
if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t) || !await m())
|
|
24
24
|
return;
|
|
25
|
-
await m();
|
|
26
25
|
const { unsubscribePayload: S, stripoModules: V } = u(t.rawHtml);
|
|
27
26
|
return await c(S), t.modules = V, p || s({ ...t, silent: f }), t;
|
|
28
27
|
} };
|
|
29
28
|
};
|
|
30
29
|
export {
|
|
31
|
-
|
|
30
|
+
z as useSave
|
|
32
31
|
};
|
|
@@ -1,85 +1,36 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var g = (r, t, e) => t in r ? h(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var l = (r, t, e) => g(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import f from "../../extensions/Blocks/Checkbox/template.js";
|
|
5
|
+
import { extractTextFromElement as m, buildTextBlock as p } from "./textBlockMigration.js";
|
|
6
|
+
class C {
|
|
6
7
|
constructor() {
|
|
7
|
-
|
|
8
|
+
l(this, "parser");
|
|
8
9
|
this.parser = new DOMParser();
|
|
9
10
|
}
|
|
10
11
|
migrate(t) {
|
|
11
12
|
try {
|
|
12
|
-
const e = this.parser.parseFromString(t, "text/html"),
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const e = this.parser.parseFromString(t, "text/html"), n = e.querySelectorAll("td.checkbox-block");
|
|
14
|
+
if (n.length === 0)
|
|
15
|
+
return t;
|
|
16
|
+
let i = !1;
|
|
17
|
+
return n.forEach((o) => {
|
|
18
|
+
if (o.classList.contains("checkbox-block-v2"))
|
|
15
19
|
return;
|
|
16
|
-
const
|
|
17
|
-
`<table id="tempDoc"><tbody><tr>${
|
|
20
|
+
const b = o.getAttribute("id"), s = m(o, "ins-title"), a = m(o, "ins-description"), u = p(s, s.containerClass), x = p(a, a.containerClass), d = f.replace("{-{-TITLE-}-}", u).replace("{-{-DESCRIPTION-}-}", x), c = this.parser.parseFromString(
|
|
21
|
+
`<table id="tempDoc"><tbody><tr>${d}</tr></tbody></table>`,
|
|
18
22
|
"text/html"
|
|
19
23
|
).querySelector(".checkbox-block-v2");
|
|
20
|
-
|
|
21
|
-
}), e.documentElement.outerHTML
|
|
24
|
+
c && o.parentNode && (c.setAttribute("id", b || ""), o.parentNode.replaceChild(c, o), i = !0);
|
|
25
|
+
}), i ? e.documentElement.outerHTML : t;
|
|
22
26
|
} catch (e) {
|
|
23
27
|
return console.error("CheckboxMigrator failed:", e), t;
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
|
-
extractTextFromElement(t, e) {
|
|
27
|
-
var o, d;
|
|
28
|
-
const i = t.querySelector(`.${e}`);
|
|
29
|
-
if (!i)
|
|
30
|
-
return {
|
|
31
|
-
text: e === "ins-title" ? "Title" : "Description",
|
|
32
|
-
isBold: !1,
|
|
33
|
-
isItalic: !1,
|
|
34
|
-
align: "left",
|
|
35
|
-
styles: ""
|
|
36
|
-
};
|
|
37
|
-
const r = i.querySelector("p");
|
|
38
|
-
if (!r)
|
|
39
|
-
return {
|
|
40
|
-
text: ((o = i.textContent) == null ? void 0 : o.trim()) || (e === "ins-title" ? "Title" : "Description"),
|
|
41
|
-
isBold: !1,
|
|
42
|
-
isItalic: !1,
|
|
43
|
-
align: i.getAttribute("align") || "left",
|
|
44
|
-
styles: ""
|
|
45
|
-
};
|
|
46
|
-
const n = ((d = r.textContent) == null ? void 0 : d.trim()) || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", c = i.getAttribute("align") || r.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), p = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), u = this.convertInlineToBlock(g);
|
|
47
|
-
return {
|
|
48
|
-
text: n,
|
|
49
|
-
isBold: a,
|
|
50
|
-
isItalic: p,
|
|
51
|
-
align: c,
|
|
52
|
-
styles: u
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
buildTextBlock(t) {
|
|
56
|
-
let e = t.text;
|
|
57
|
-
t.isBold && t.isItalic ? e = `<strong path="1,0"><em path="1,0,0">${e}</em></strong>` : t.isBold ? e = `<strong path="1,0">${e}</strong>` : t.isItalic && (e = `<em path="1,0">${e}</em>`);
|
|
58
|
-
const i = t.align ? ` align="${t.align}"` : "", r = t.styles ? ` style="${t.styles}"` : "";
|
|
59
|
-
return `
|
|
60
|
-
<td class="esd-block-text" ${i}>
|
|
61
|
-
<p path="1" ${r}>
|
|
62
|
-
${e}
|
|
63
|
-
</p>
|
|
64
|
-
</td>
|
|
65
|
-
`;
|
|
66
|
-
}
|
|
67
|
-
removeStyleProperties(t, e) {
|
|
68
|
-
return t ? e.reduce((r, n) => {
|
|
69
|
-
const l = new RegExp(`${n}\\s*:\\s*[^;]*;?`, "gi");
|
|
70
|
-
return r.replace(l, "");
|
|
71
|
-
}, t).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
|
|
72
|
-
}
|
|
73
|
-
convertInlineToBlock(t) {
|
|
74
|
-
if (!t)
|
|
75
|
-
return "";
|
|
76
|
-
let e = t.replace(/display\s*:\s*inline/gi, "display: block");
|
|
77
|
-
return /display\s*:/i.test(e) || (e = e ? `${e}; display: block` : "display: block"), e.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
|
|
78
|
-
}
|
|
79
30
|
}
|
|
80
|
-
function
|
|
81
|
-
return new
|
|
31
|
+
function E(r) {
|
|
32
|
+
return new C().migrate(r);
|
|
82
33
|
}
|
|
83
34
|
export {
|
|
84
|
-
|
|
35
|
+
E as migrateCheckbox
|
|
85
36
|
};
|