@useinsider/guido 3.30.2 → 3.31.0-beta.4319b57
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 +1 -0
- package/dist/@types/config/schemas.js +13 -11
- package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.js +3 -3
- package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue2.js +20 -18
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +32 -30
- package/dist/components/organisms/header/EditorActionsMenu.vue.js +2 -2
- package/dist/components/organisms/header/EditorActionsMenu.vue2.js +68 -68
- package/dist/components/organisms/header/EditorToolbar.vue.js +2 -2
- package/dist/components/organisms/header/EditorToolbar.vue2.js +13 -12
- package/dist/composables/useAutoSave.js +13 -13
- package/dist/composables/useCodeEditorApi.js +11 -10
- package/dist/composables/useSave.js +51 -51
- package/dist/composables/useStripo.js +49 -47
- package/dist/guido.css +1 -1
- package/dist/package.json.js +2 -2
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/stores/config.d.ts +21 -0
- package/package.json +12 -6
package/README.md
CHANGED
|
@@ -174,6 +174,7 @@ const config: GuidoConfigInput = {
|
|
|
174
174
|
allowSaveWithErrors?: boolean, // Default: true - Allow the validation drawer's "Save and Continue" soft-save. Set false to hard-block invalid saves (transactional + unsubscribe pages).
|
|
175
175
|
reusableRecommendationStrategy?: boolean, // Default: false - Assign an RRS strategy to recommendation blocks instead of per-block algorithm/filters/shuffle/product-count settings.
|
|
176
176
|
legacyUnsubscribeConversion?: boolean, // Default: false - Convert legacy unsubscribe blocks that have no unsubscribe link into text blocks (on load and on module drop/copy) and show a warning modal.
|
|
177
|
+
readonly?: boolean, // Default: false - Opens the design with Save, Save as template, Test, Undo, Redo, HTML editor (including the AMP error modal's fix action), Version history, Accessibility test and the autosave toggle disabled (Stripo still undoes on Ctrl/Cmd+Z): no save path persists (toolbar Save, "Save and Continue", autosave, saveSilent() resolves undefined), no save:start / save:complete, and edits never emit on-change, so the host shows no leave-page warning. Read at mount; to change it, remount Guido.
|
|
177
178
|
accessibilityTesting?: boolean, // Default: false - Show the Accessibility Test entry in the header kebab menu (Stripo's checker: contrast, image alternatives, colour-vision simulation) and the tab-bar onboarding tour that points at it.
|
|
178
179
|
itemsPriceFormatting?: boolean, // Default: false - Items block price formatting: thousand/decimal separator + decimal count on the block root, raw price tags in the export (formatted at send time).
|
|
179
180
|
blockUnsubscribeLinks?: boolean, // Default: false - Warn on save when the design carries an Insider unsubscribe link or code ({{ins-*-unsubscribe-link}}, <%asm_*_raw_url%>, <%unsub%>): the legacy save is rejected with a warning toaster; with the validation drawer on it is a warning row that "Save and Continue" can skip. Launch blocking is up to the host. It also converts every unsubscribe block (v2 or legacy, linked or not) into a text block on template load and on module drop/copy, removes the Insider unsubscribe/preferences links inside it (their text stays), and shows an SFMC info modal. Set true for accounts whose unsubscribes are managed outside Insider (SFMC).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModuleFolderDefaults as y } from "../../enums/defaults.js";
|
|
2
|
-
import { object as o, number as c, optional as e, string as t, picklist as m, pipe as
|
|
2
|
+
import { object as o, number as c, optional as e, string as t, picklist as m, pipe as i, minLength as p, custom as k, boolean as a, array as n, transform as S, unknown as r, record as g, fallback as R, literal as u, lazy as T, looseObject as C, variant as I, union as h } from "../../node_modules/valibot/dist/index.js";
|
|
3
3
|
const b = {
|
|
4
4
|
/** Promotional/marketing emails */
|
|
5
5
|
PROMOTIONAL: 1,
|
|
@@ -14,12 +14,12 @@ const b = {
|
|
|
14
14
|
UNSUBSCRIBE_PAGES: 97
|
|
15
15
|
}, A = o({
|
|
16
16
|
/** Unique identifier for the template being edited */
|
|
17
|
-
templateId:
|
|
17
|
+
templateId: i(
|
|
18
18
|
t(),
|
|
19
19
|
p(1, "templateId is required")
|
|
20
20
|
),
|
|
21
21
|
/** Unique identifier for the user editing the template */
|
|
22
|
-
userId:
|
|
22
|
+
userId: i(
|
|
23
23
|
t(),
|
|
24
24
|
p(1, "userId is required")
|
|
25
25
|
),
|
|
@@ -40,7 +40,7 @@ const b = {
|
|
|
40
40
|
family: t()
|
|
41
41
|
}), E = o({
|
|
42
42
|
/** Partner/organization name (required) */
|
|
43
|
-
name:
|
|
43
|
+
name: i(
|
|
44
44
|
t(),
|
|
45
45
|
p(1, "partner.name is required")
|
|
46
46
|
),
|
|
@@ -93,23 +93,23 @@ const b = {
|
|
|
93
93
|
/** Decimal places for price display (legacy data may use string or number) */
|
|
94
94
|
decimalCount: e(h([t(), c()])),
|
|
95
95
|
/** Pinned product IDs (empty array when filter-driven) */
|
|
96
|
-
productIds: e(n(
|
|
96
|
+
productIds: e(n(r())),
|
|
97
97
|
/** Whether the block requested live products at send time */
|
|
98
98
|
sendProductRequestFlag: e(a()),
|
|
99
99
|
/** Whether to randomize product order */
|
|
100
100
|
shuffleProducts: e(a()),
|
|
101
101
|
/** Filter rules driving product selection */
|
|
102
|
-
filters: e(n(
|
|
102
|
+
filters: e(n(r())),
|
|
103
103
|
/** Currency code (e.g. 'EUR') — sometimes absent in legacy data */
|
|
104
104
|
currency: e(t()),
|
|
105
105
|
/** Currency display settings (separators, alignment, decimals) */
|
|
106
|
-
currencySettings: e(
|
|
106
|
+
currencySettings: e(r()),
|
|
107
107
|
/** Locale (e.g. 'nl_NL') */
|
|
108
108
|
language: e(t()),
|
|
109
109
|
/** Recommendation strategy key (e.g. 'newArrivals') */
|
|
110
110
|
strategy: e(t()),
|
|
111
111
|
/** Snapshot of products as rendered by the legacy block */
|
|
112
|
-
recommendedProducts: e(n(
|
|
112
|
+
recommendedProducts: e(n(r())),
|
|
113
113
|
/** Number of product cards per row */
|
|
114
114
|
cardsInRow: e(c()),
|
|
115
115
|
/** Mobile-only padding (right) */
|
|
@@ -174,7 +174,7 @@ const b = {
|
|
|
174
174
|
* mount. Non-numbers still fail, like every other field in this schema.
|
|
175
175
|
*/
|
|
176
176
|
trackIdCounter: e(
|
|
177
|
-
|
|
177
|
+
i(
|
|
178
178
|
c(),
|
|
179
179
|
S((s) => Number.isFinite(s) ? Math.max(0, Math.floor(s)) : 0)
|
|
180
180
|
),
|
|
@@ -188,8 +188,8 @@ const b = {
|
|
|
188
188
|
* cannot be undone. Hosts send `[]` for an empty map.
|
|
189
189
|
*/
|
|
190
190
|
recommendationCampaignUrls: e(
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
i(
|
|
192
|
+
r(),
|
|
193
193
|
S((s) => s && typeof s == "object" ? { ...s } : void 0)
|
|
194
194
|
)
|
|
195
195
|
),
|
|
@@ -249,6 +249,8 @@ const b = {
|
|
|
249
249
|
reusableRecommendationStrategy: e(a(), !1),
|
|
250
250
|
/** Convert linkless legacy unsubscribe blocks into text blocks and warn with a modal (opt-in) */
|
|
251
251
|
legacyUnsubscribeConversion: e(a(), !1),
|
|
252
|
+
/** Disable every save path and the unsaved-changes signal; read at mount only. */
|
|
253
|
+
readonly: e(a(), !1),
|
|
252
254
|
/** Items block: Recommendation-style price formatting (root currency-* attrs, raw price tags). Released dark. */
|
|
253
255
|
itemsPriceFormatting: e(a(), !1),
|
|
254
256
|
/** Warn on save when the design carries an Insider unsubscribe link or code (host sets true for SFMC accounts) */
|
|
@@ -8,15 +8,15 @@ var n = function() {
|
|
|
8
8
|
}, "primary-action": t.handleFixInCodeEditor } }, [r("div", { staticClass: "d-f f-d-c" }, [r("div", { staticClass: "mb-3" }, [r("div", { staticClass: "l-s-5 f-s-1 f-w-600 t-c-55 t-t-u" }, [e._v(" " + e._s(t.errorCountText) + " ")])]), r("div", { staticClass: "d-f f-d-c g-13 error-list" }, e._l(t.previewStore.ampErrors, function(o, s) {
|
|
9
9
|
return r(t.InOnPageMessage, { key: s, attrs: { icon: "filled-error-box", size: "small", type: "alert", text: o } });
|
|
10
10
|
}), 1)])]);
|
|
11
|
-
}, l = [],
|
|
11
|
+
}, l = [], c = /* @__PURE__ */ a(
|
|
12
12
|
i,
|
|
13
13
|
n,
|
|
14
14
|
l,
|
|
15
15
|
!1,
|
|
16
16
|
null,
|
|
17
|
-
"
|
|
17
|
+
"84679e30"
|
|
18
18
|
);
|
|
19
|
-
const _ =
|
|
19
|
+
const _ = c.exports;
|
|
20
20
|
export {
|
|
21
21
|
_ as default
|
|
22
22
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as l, computed as r } from "vue";
|
|
2
|
+
import u from "../../../wrappers/WpModal.vue.js";
|
|
3
3
|
import { useCodeEditorApi as f } from "../../../../composables/useCodeEditorApi.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
4
|
+
import { useConfig as _ } from "../../../../composables/useConfig.js";
|
|
5
|
+
import { usePreviewMode as y } from "../../../../composables/usePreviewMode.js";
|
|
6
|
+
import { useTranslations as v } from "../../../../composables/useTranslations.js";
|
|
7
|
+
import { ACADEMY_LINKS as E } from "../../../../enums/academy.js";
|
|
8
|
+
import { usePreviewStore as M } from "../../../../stores/preview.js";
|
|
9
|
+
import { InOnPageMessage as g } from "@useinsider/design-system-vue";
|
|
10
|
+
const T = /* @__PURE__ */ l({
|
|
10
11
|
__name: "AmpErrorModal",
|
|
11
12
|
emits: ["close"],
|
|
12
|
-
setup(
|
|
13
|
-
const o =
|
|
13
|
+
setup(C, { emit: t }) {
|
|
14
|
+
const o = v(), { closePreviewMode: i } = y(), { openCodeEditor: n } = f(), a = M(), { isFeatureEnabled: s } = _(), e = r(() => s("readonly")), m = r(() => ({
|
|
14
15
|
cancelOrBackButton: {
|
|
15
16
|
type: "secondary",
|
|
16
17
|
labelText: o("campaign-builder.cancel"),
|
|
@@ -18,17 +19,18 @@ const O = /* @__PURE__ */ m({
|
|
|
18
19
|
},
|
|
19
20
|
primaryButton: {
|
|
20
21
|
type: "primary",
|
|
21
|
-
labelText: o("email-editor.amp-validation-fix")
|
|
22
|
+
labelText: o("email-editor.amp-validation-fix"),
|
|
23
|
+
disabledStatus: e.value
|
|
22
24
|
}
|
|
23
|
-
}),
|
|
24
|
-
e("close"),
|
|
25
|
-
},
|
|
25
|
+
})), p = () => {
|
|
26
|
+
e.value || (t("close"), i(), n());
|
|
27
|
+
}, d = o(
|
|
26
28
|
"email-editor.amp-validation-description",
|
|
27
|
-
{ academyLink:
|
|
28
|
-
),
|
|
29
|
-
return { __sfc: !0, emit:
|
|
29
|
+
{ academyLink: E.AMP_FOR_EMAILS }
|
|
30
|
+
), c = r(() => `${o("products.errors")} (${a.ampErrors.length})`);
|
|
31
|
+
return { __sfc: !0, emit: t, trans: o, closePreviewMode: i, openCodeEditor: n, previewStore: a, isFeatureEnabled: s, isReadonly: e, footerButtonOptions: m, handleFixInCodeEditor: p, ampValidationDescription: d, errorCountText: c, WpModal: u, InOnPageMessage: g };
|
|
30
32
|
}
|
|
31
33
|
});
|
|
32
34
|
export {
|
|
33
|
-
|
|
35
|
+
T as default
|
|
34
36
|
};
|
|
@@ -4,7 +4,7 @@ import r from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
|
4
4
|
var d = function() {
|
|
5
5
|
var o, s;
|
|
6
6
|
var i = this, e = i._self._c, t = i._self._setupProxy;
|
|
7
|
-
return e("div", { staticClass: "d-f a-i-c editor-actions" }, [!t.editorStore.isPreviewModeOpen && t.hasContentOnTheLeft ? e("div", { staticClass: "editor-actions__divider" }) : i._e(), (s = (o = t.config) == null ? void 0 : o.features) != null && s.testMessage ? e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isTestButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button", { staticPosition: "bottom right" }), "tooltip-text": t.trans("newsletter.test-email") }, on: { click: t.handleTestEmail } }) : i._e(), e(t.EditorActionsMenu), t.editorStore.isPreviewModeOpen ? i._e() : e("div", { staticClass: "editor-actions__divider" }), t.editorStore.isPreviewModeOpen ? i._e() : e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "disabled-status": !t.isSaving && t.editorStore.isSaveButtonDisabled, "label-text": t.saveLabel, "loading-status": t.isSaving }, on: { click: function(n) {
|
|
7
|
+
return e("div", { staticClass: "d-f a-i-c editor-actions" }, [!t.editorStore.isPreviewModeOpen && t.hasContentOnTheLeft ? e("div", { staticClass: "editor-actions__divider" }) : i._e(), (s = (o = t.config) == null ? void 0 : o.features) != null && s.testMessage ? e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.isFeatureEnabled("readonly") || t.editorStore.isTestButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button", { staticPosition: "bottom right" }), "tooltip-text": t.trans("newsletter.test-email") }, on: { click: t.handleTestEmail } }) : i._e(), e(t.EditorActionsMenu), t.editorStore.isPreviewModeOpen ? i._e() : e("div", { staticClass: "editor-actions__divider" }), t.editorStore.isPreviewModeOpen ? i._e() : e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "disabled-status": t.isFeatureEnabled("readonly") || !t.isSaving && t.editorStore.isSaveButtonDisabled, "label-text": t.saveLabel, "loading-status": t.isSaving }, on: { click: function(n) {
|
|
8
8
|
return t.handleSave(!1);
|
|
9
9
|
} } }), e(t.MigrationConfirmModal, { ref: "migrationModalRef", on: { confirm: function(n) {
|
|
10
10
|
return t.executeSave(!1);
|
|
@@ -15,7 +15,7 @@ var d = function() {
|
|
|
15
15
|
l,
|
|
16
16
|
!1,
|
|
17
17
|
null,
|
|
18
|
-
"
|
|
18
|
+
"8da8cf86"
|
|
19
19
|
);
|
|
20
20
|
const p = c.exports;
|
|
21
21
|
export {
|
|
@@ -53,41 +53,43 @@ const Ct = /* @__PURE__ */ q({
|
|
|
53
53
|
const t = await m();
|
|
54
54
|
t != null && t.length ? g.open(t, "test") : t && d();
|
|
55
55
|
}, k = async () => {
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
if (!a("readonly")) {
|
|
57
|
+
if (s.value) {
|
|
58
|
+
const t = await m();
|
|
59
|
+
if (!t)
|
|
60
|
+
return;
|
|
61
|
+
if (t.length) {
|
|
62
|
+
f({
|
|
63
|
+
type: K.Error,
|
|
64
|
+
message: i("email-editor.validation-errors-found"),
|
|
65
|
+
actionButton: {
|
|
66
|
+
text: i("email-editor.check-errors"),
|
|
67
|
+
onClick: () => {
|
|
68
|
+
_();
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
autoHide: !1
|
|
72
|
+
});
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
l();
|
|
72
76
|
return;
|
|
73
77
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
if (a("liquidSyntax")) {
|
|
79
|
+
o.loadingStatus = !0;
|
|
80
|
+
try {
|
|
81
|
+
const { html: t } = await p({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: e } = v(t);
|
|
82
|
+
if (!await S(e))
|
|
83
|
+
return;
|
|
84
|
+
} catch (t) {
|
|
85
|
+
r(t, "Failed to prepare test email");
|
|
82
86
|
return;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
} finally {
|
|
87
|
-
o.loadingStatus = !1;
|
|
87
|
+
} finally {
|
|
88
|
+
o.loadingStatus = !1;
|
|
89
|
+
}
|
|
88
90
|
}
|
|
91
|
+
l();
|
|
89
92
|
}
|
|
90
|
-
l();
|
|
91
93
|
};
|
|
92
94
|
return F({
|
|
93
95
|
handleSave: V
|
|
@@ -3,7 +3,7 @@ import i from "./EditorActionsMenu.vue2.js";
|
|
|
3
3
|
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
4
|
var n = function() {
|
|
5
5
|
var e = this, o = e._self._c, t = e._self._setupProxy;
|
|
6
|
-
return o("div", { staticClass: "editor-actions-menu p-r" }, [o(t.InButtonV2, { attrs: { id: "guido__kebab-button", "data-testid": "Editor Actions Menu", "left-icon": "line-more-vertical", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.loadingStatus, "label-text-status": !1, "selected-status": t.isPanelOpen, "tooltip-options": t.getTooltipOptions("guido__kebab-button"), "tooltip-text": t.trans("email-editor.more-actions") }, on: { click: function(
|
|
6
|
+
return o("div", { staticClass: "editor-actions-menu p-r" }, [o(t.InButtonV2, { attrs: { id: "guido__kebab-button", "data-testid": "Editor Actions Menu", "left-icon": "line-more-vertical", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.loadingStatus, "label-text-status": !1, "selected-status": t.isPanelOpen, "tooltip-options": t.getTooltipOptions("guido__kebab-button"), "tooltip-text": t.trans("email-editor.more-actions") }, on: { click: function(c) {
|
|
7
7
|
t.isOpen = !t.isOpen;
|
|
8
8
|
} } }), o(t.InDropdownMenu, { staticClass: "editor-actions-menu__dropdown", attrs: { id: "guido__kebab-menu", "box-width": "basedOnLongestItem", "static-position": "bottom right", "dynamic-position": !1, "max-height": 400, options: t.options, "select-all-option-status": !1, status: t.isPanelOpen }, on: { clickOutside: t.close, optionClick: t.handleOptionClick } })], 1);
|
|
9
9
|
}, a = [], r = /* @__PURE__ */ s(
|
|
@@ -12,7 +12,7 @@ var n = function() {
|
|
|
12
12
|
a,
|
|
13
13
|
!1,
|
|
14
14
|
null,
|
|
15
|
-
"
|
|
15
|
+
"00096ce2"
|
|
16
16
|
);
|
|
17
17
|
const _ = r.exports;
|
|
18
18
|
export {
|
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useAccessibilityApi as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useExport as
|
|
5
|
-
import { useTranslations as
|
|
6
|
-
import { useVersionHistoryApi as
|
|
7
|
-
import { useAutosaveStore as
|
|
8
|
-
import { useEditorStore as
|
|
9
|
-
import { useOnboardingStore as
|
|
10
|
-
import { getTooltipOptions as
|
|
11
|
-
import { InToggle as
|
|
12
|
-
const
|
|
1
|
+
import { defineComponent as L, ref as M, computed as s, watch as R } from "vue";
|
|
2
|
+
import { useAccessibilityApi as Y } from "../../../composables/useAccessibilityApi.js";
|
|
3
|
+
import { useConfig as F } from "../../../composables/useConfig.js";
|
|
4
|
+
import { useExport as N } from "../../../composables/useExport.js";
|
|
5
|
+
import { useTranslations as U } from "../../../composables/useTranslations.js";
|
|
6
|
+
import { useVersionHistoryApi as X } from "../../../composables/useVersionHistoryApi.js";
|
|
7
|
+
import { useAutosaveStore as j } from "../../../stores/autosave.js";
|
|
8
|
+
import { useEditorStore as q } from "../../../stores/editor.js";
|
|
9
|
+
import { useOnboardingStore as z } from "../../../stores/onboarding.js";
|
|
10
|
+
import { getTooltipOptions as G } from "../../../utils/tooltipUtils.js";
|
|
11
|
+
import { InToggle as J, InDropdownMenu as K, InButtonV2 as Q } from "@useinsider/design-system-vue";
|
|
12
|
+
const ue = /* @__PURE__ */ L({
|
|
13
13
|
__name: "EditorActionsMenu",
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
14
|
+
setup(W) {
|
|
15
|
+
const d = "guido__kebab-autosave", p = "guido__kebab-version-history", v = "guido__kebab-accessibility", m = "guido__kebab-save-as", b = "guido__kebab-export", { config: f, isFeatureEnabled: r } = F(), { exportHtml: A } = N(), { openVersionHistory: S, closeVersionHistory: _ } = X(), { toggleAccessibilityTestingMode: O } = Y(), e = q(), l = j(), g = z(), i = U(), y = M(!1), t = s(() => r("readonly")), P = s(() => y.value || g.isEditorActionsMenuPinned), c = M(!1), x = s(() => r("autosave")), h = s(
|
|
16
16
|
() => {
|
|
17
|
-
var
|
|
18
|
-
return !!((
|
|
17
|
+
var o, n;
|
|
18
|
+
return !!((n = (o = f.value) == null ? void 0 : o.features) != null && n.versionHistory) && !e.isPreviewModeOpen;
|
|
19
19
|
}
|
|
20
|
-
),
|
|
21
|
-
() =>
|
|
22
|
-
),
|
|
23
|
-
var
|
|
24
|
-
return !!((
|
|
25
|
-
}),
|
|
26
|
-
{ categoryText:
|
|
20
|
+
), V = s(
|
|
21
|
+
() => r("accessibilityTesting") && !e.isPreviewModeOpen
|
|
22
|
+
), E = s(() => {
|
|
23
|
+
var o, n;
|
|
24
|
+
return !!((n = (o = f.value) == null ? void 0 : o.features) != null && n.saveAsTemplate);
|
|
25
|
+
}), T = s(() => x.value ? [
|
|
26
|
+
{ categoryText: i("email-editor.preferences") },
|
|
27
27
|
{
|
|
28
|
-
text:
|
|
29
|
-
value:
|
|
30
|
-
disable: e.loadingStatus,
|
|
31
|
-
rightSlotComponent:
|
|
28
|
+
text: i("email-editor.auto-save"),
|
|
29
|
+
value: d,
|
|
30
|
+
disable: t.value || e.loadingStatus,
|
|
31
|
+
rightSlotComponent: J,
|
|
32
32
|
rightSlotProps: {
|
|
33
33
|
// InDropdownMenu fills attrs.id with its own positional test id, and v-bind
|
|
34
34
|
// skips a key already there — only `name` survives as a stable hook.
|
|
35
35
|
name: "guido-kebab-autosave-toggle",
|
|
36
36
|
class: "p-e-n",
|
|
37
|
-
checked:
|
|
38
|
-
disable: e.loadingStatus
|
|
37
|
+
checked: l.isOn,
|
|
38
|
+
disable: t.value || e.loadingStatus
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
{ divider: "solid" }
|
|
42
|
-
] : []),
|
|
43
|
-
{ categoryText:
|
|
44
|
-
...x.value ? [{
|
|
45
|
-
text: o("newsletter.version-history"),
|
|
46
|
-
value: u,
|
|
47
|
-
iconLeft: "line-architect-version-history",
|
|
48
|
-
disable: e.isVersionHistoryButtonDisabled
|
|
49
|
-
}] : [],
|
|
42
|
+
] : []), k = s(() => [
|
|
43
|
+
{ categoryText: i("email-editor.actions") },
|
|
50
44
|
...h.value ? [{
|
|
51
|
-
text:
|
|
45
|
+
text: i("newsletter.version-history"),
|
|
52
46
|
value: p,
|
|
53
|
-
iconLeft: "line-
|
|
54
|
-
disable: e.
|
|
47
|
+
iconLeft: "line-architect-version-history",
|
|
48
|
+
disable: t.value || e.isVersionHistoryButtonDisabled
|
|
55
49
|
}] : [],
|
|
56
50
|
...V.value ? [{
|
|
57
|
-
text:
|
|
58
|
-
value:
|
|
51
|
+
text: i("email-editor.accessibility-test"),
|
|
52
|
+
value: v,
|
|
53
|
+
iconLeft: "line-accessibility",
|
|
54
|
+
disable: t.value || e.loadingStatus
|
|
55
|
+
}] : [],
|
|
56
|
+
...E.value ? [{
|
|
57
|
+
text: i("newsletter.save-templates"),
|
|
58
|
+
value: m,
|
|
59
59
|
iconLeft: "line-newsletter-save-as-template",
|
|
60
|
-
disable: e.isSaveAsButtonDisabled
|
|
60
|
+
disable: t.value || e.isSaveAsButtonDisabled
|
|
61
61
|
}] : [],
|
|
62
62
|
{
|
|
63
|
-
text:
|
|
64
|
-
value:
|
|
63
|
+
text: i("email-editor.export-html"),
|
|
64
|
+
value: b,
|
|
65
65
|
iconLeft: "line-export",
|
|
66
|
-
disable:
|
|
66
|
+
disable: c.value || e.isExportButtonDisabled
|
|
67
67
|
}
|
|
68
|
-
]),
|
|
69
|
-
|
|
68
|
+
]), D = s(() => [...T.value, ...k.value]), a = () => {
|
|
69
|
+
y.value = !1;
|
|
70
70
|
};
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
R(() => g.isEditorActionsMenuPinned, (o) => {
|
|
72
|
+
o || a();
|
|
73
73
|
});
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
}, w = () => {
|
|
77
|
-
e.isVersionHistoryOpen ? S() : A(), n();
|
|
74
|
+
const w = () => {
|
|
75
|
+
t.value || (l.isOn = !l.isOn);
|
|
78
76
|
}, H = () => {
|
|
79
|
-
_(),
|
|
77
|
+
t.value || (e.isVersionHistoryOpen ? _() : S(), a());
|
|
80
78
|
}, I = () => {
|
|
81
|
-
|
|
82
|
-
}, B =
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
t.value || (O(), a());
|
|
80
|
+
}, B = () => {
|
|
81
|
+
t.value || (e.isSaveAsTemplateDrawerOpen = !0, a());
|
|
82
|
+
}, C = async () => {
|
|
83
|
+
c.value = !0, await A(), c.value = !1, a();
|
|
84
|
+
}, u = {
|
|
85
|
+
[d]: w,
|
|
87
86
|
[p]: H,
|
|
88
|
-
[
|
|
89
|
-
[
|
|
87
|
+
[v]: I,
|
|
88
|
+
[m]: B,
|
|
89
|
+
[b]: C
|
|
90
90
|
};
|
|
91
|
-
return { __sfc: !0, AUTOSAVE:
|
|
92
|
-
var
|
|
93
|
-
return (
|
|
94
|
-
}, getTooltipOptions:
|
|
91
|
+
return { __sfc: !0, AUTOSAVE: d, VERSION_HISTORY: p, ACCESSIBILITY: v, SAVE_AS: m, EXPORT: b, config: f, isFeatureEnabled: r, exportHtml: A, openVersionHistory: S, closeVersionHistory: _, toggleAccessibilityTestingMode: O, editorStore: e, autosaveStore: l, onboardingStore: g, trans: i, isOpen: y, isReadonly: t, isPanelOpen: P, isExporting: c, isAutosaveVisible: x, isVersionHistoryVisible: h, isAccessibilityVisible: V, isSaveAsVisible: E, preferenceOptions: T, actionOptions: k, options: D, close: a, toggleAutosave: w, handleVersionHistory: H, handleAccessibility: I, handleSaveAs: B, handleExport: C, optionHandlers: u, handleOptionClick: ({ value: o }) => {
|
|
92
|
+
var n;
|
|
93
|
+
return (n = u[o]) == null ? void 0 : n.call(u);
|
|
94
|
+
}, getTooltipOptions: G, InButtonV2: Q, InDropdownMenu: K };
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
export {
|
|
98
|
-
|
|
98
|
+
ue as default
|
|
99
99
|
};
|
|
@@ -3,14 +3,14 @@ import i from "./EditorToolbar.vue2.js";
|
|
|
3
3
|
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
4
|
var n = function() {
|
|
5
5
|
var e = this, o = e._self._c, t = e._self._setupProxy;
|
|
6
|
-
return o("div", { staticClass: "d-f editor-toolbar" }, [o(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isUndoButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__undo-button"), "tooltip-text": t.trans("action-builder.undo") } }), o(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isRedoButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__redo-button"), "tooltip-text": t.trans("action-builder.redo") } }), o(t.InButtonV2, { attrs: { id: "guido__code-button", "data-testid": "Code Editor", "left-icon": "line-code", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isCodeEditorButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button"), "tooltip-text": t.codeEditorTooltipText } }), o(t.InButtonV2, { attrs: { id: "guido__preview-button", "left-icon": "line-show-on", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isPreviewButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isPreviewModeOpen, "tooltip-options": t.getTooltipOptions("guido__preview-button"), "tooltip-text": t.previewTooltipText }, on: { click: t.handlePreviewToggle } }), o(t.ViewOptions, { staticClass: "ml-2" })], 1);
|
|
6
|
+
return o("div", { staticClass: "d-f editor-toolbar" }, [o(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "disabled-status": t.isReadonly || t.editorStore.isUndoButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__undo-button"), "tooltip-text": t.trans("action-builder.undo") } }), o(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "disabled-status": t.isReadonly || t.editorStore.isRedoButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__redo-button"), "tooltip-text": t.trans("action-builder.redo") } }), o(t.InButtonV2, { attrs: { id: "guido__code-button", "data-testid": "Code Editor", "left-icon": "line-code", styling: "ghost", type: "secondary", "disabled-status": t.isReadonly || t.editorStore.isCodeEditorButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button"), "tooltip-text": t.codeEditorTooltipText } }), o(t.InButtonV2, { attrs: { id: "guido__preview-button", "left-icon": "line-show-on", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isPreviewButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isPreviewModeOpen, "tooltip-options": t.getTooltipOptions("guido__preview-button"), "tooltip-text": t.previewTooltipText }, on: { click: t.handlePreviewToggle } }), o(t.ViewOptions, { staticClass: "ml-2" })], 1);
|
|
7
7
|
}, d = [], l = /* @__PURE__ */ s(
|
|
8
8
|
i,
|
|
9
9
|
n,
|
|
10
10
|
d,
|
|
11
11
|
!1,
|
|
12
12
|
null,
|
|
13
|
-
"
|
|
13
|
+
"804d79cf"
|
|
14
14
|
);
|
|
15
15
|
const _ = l.exports;
|
|
16
16
|
export {
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
import { defineComponent as m, computed as t } from "vue";
|
|
2
|
+
import { useConfig as d } from "../../../composables/useConfig.js";
|
|
3
|
+
import { usePreviewMode as a } from "../../../composables/usePreviewMode.js";
|
|
4
|
+
import { useTranslations as c } from "../../../composables/useTranslations.js";
|
|
5
|
+
import { useEditorStore as w } from "../../../stores/editor.js";
|
|
6
|
+
import { getTooltipOptions as f } from "../../../utils/tooltipUtils.js";
|
|
7
|
+
import { InButtonV2 as u } from "@useinsider/design-system-vue";
|
|
8
|
+
import v from "./ViewOptions.vue.js";
|
|
9
|
+
const b = /* @__PURE__ */ m({
|
|
9
10
|
__name: "EditorToolbar",
|
|
10
|
-
setup(
|
|
11
|
-
const o = d(), e =
|
|
12
|
-
return { __sfc: !0, editorStore: o, trans: e, openPreviewMode:
|
|
11
|
+
setup(T) {
|
|
12
|
+
const o = w(), { isFeatureEnabled: r } = d(), e = c(), { openPreviewMode: i, closePreviewMode: n } = a(), s = t(() => o.isPreviewModeOpen ? e("newsletter.close-email-preview") : e("newsletter.email-preview")), p = t(() => o.isCodeEditorOpen ? e("newsletter.close-html-editor") : e("newsletter.html-editor")), l = t(() => r("readonly"));
|
|
13
|
+
return { __sfc: !0, editorStore: o, isFeatureEnabled: r, trans: e, openPreviewMode: i, closePreviewMode: n, previewTooltipText: s, codeEditorTooltipText: p, isReadonly: l, handlePreviewToggle: () => o.isPreviewModeOpen ? n() : i(), getTooltipOptions: f, InButtonV2: u, ViewOptions: v };
|
|
13
14
|
}
|
|
14
15
|
});
|
|
15
16
|
export {
|
|
16
|
-
|
|
17
|
+
b as default
|
|
17
18
|
};
|
|
@@ -3,9 +3,9 @@ import { useEditorLock as y } from "./useEditorLock.js";
|
|
|
3
3
|
import { useAutosaveStore as I, AUTOSAVE_STATUS as a } from "../stores/autosave.js";
|
|
4
4
|
import { useEditorStore as L } from "../stores/editor.js";
|
|
5
5
|
import { computed as w, watch as V, onUnmounted as k } from "vue";
|
|
6
|
-
const D = 18e4, b = 6e4,
|
|
6
|
+
const D = 18e4, b = 6e4, U = (g, { clearsChanges: h = () => !0 } = {}) => {
|
|
7
7
|
const { isFeatureEnabled: m } = p(), s = L(), t = I(), { isEditorBusy: f } = y();
|
|
8
|
-
let
|
|
8
|
+
let i = null, l = 0, u = -1;
|
|
9
9
|
const d = w(
|
|
10
10
|
() => m("autosave") && t.isOn
|
|
11
11
|
), A = () => s.hasChanges && s.isInSaveableState && s.changeSeq !== u, E = () => ({
|
|
@@ -30,43 +30,43 @@ const D = 18e4, b = 6e4, _ = (g, { clearsChanges: h = () => !0 } = {}) => {
|
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
e === "visibility" && (l = Date.now()), console.debug("guido:autosave:save-start", { trigger: e }), t.status = a.SAVING;
|
|
33
|
-
const
|
|
33
|
+
const o = s.changeSeq;
|
|
34
34
|
try {
|
|
35
35
|
if (await g() === void 0) {
|
|
36
36
|
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = a.ERROR;
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
u =
|
|
39
|
+
u = o, h() && s.changeSeq === o && (s.hasChanges = !1), t.status = a.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
|
|
40
40
|
} catch (S) {
|
|
41
41
|
console.debug("guido:autosave:error", { trigger: e, error: S }), t.status = a.ERROR;
|
|
42
42
|
}
|
|
43
|
-
},
|
|
43
|
+
}, n = () => {
|
|
44
44
|
const { visibilityState: e } = document;
|
|
45
45
|
if (console.debug("guido:autosave:visibility-change", {
|
|
46
46
|
visibilityState: e,
|
|
47
47
|
isActive: d.value
|
|
48
48
|
}), e !== "hidden")
|
|
49
49
|
return;
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
50
|
+
const o = Date.now() - l;
|
|
51
|
+
if (o < b) {
|
|
52
52
|
console.debug("guido:autosave:visibility-debounced", {
|
|
53
|
-
sinceLastMs:
|
|
53
|
+
sinceLastMs: o,
|
|
54
54
|
debounceMs: b
|
|
55
55
|
});
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
r("visibility");
|
|
59
59
|
}, c = () => {
|
|
60
|
-
|
|
60
|
+
i && (clearInterval(i), i = null);
|
|
61
61
|
}, v = () => {
|
|
62
|
-
document.removeEventListener("visibilitychange",
|
|
62
|
+
document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
|
|
63
63
|
};
|
|
64
64
|
V(
|
|
65
65
|
d,
|
|
66
66
|
(e) => {
|
|
67
|
-
console.debug("guido:autosave:active-changed", { active: e }), e ? (c(),
|
|
67
|
+
console.debug("guido:autosave:active-changed", { active: e }), e ? (c(), i = setInterval(() => {
|
|
68
68
|
console.debug("guido:autosave:interval-tick"), r("interval");
|
|
69
|
-
}, D), document.addEventListener("visibilitychange",
|
|
69
|
+
}, D), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (c(), v(), t.status = a.IDLE);
|
|
70
70
|
},
|
|
71
71
|
{ immediate: !0 }
|
|
72
72
|
), k(() => {
|
|
@@ -74,5 +74,5 @@ const D = 18e4, b = 6e4, _ = (g, { clearsChanges: h = () => !0 } = {}) => {
|
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
export {
|
|
77
|
-
|
|
77
|
+
U as useAutoSave
|
|
78
78
|
};
|