@useinsider/guido 3.30.0-beta.6054a97 → 3.30.0-beta.60cbdf2
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/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +1 -1
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +46 -52
- package/dist/components/organisms/header/EditorActionsMenu.vue.js +4 -4
- package/dist/components/organisms/header/EditorActionsMenu.vue2.js +28 -28
- package/dist/composables/useAutoSave.js +13 -13
- package/dist/composables/useStripo.js +43 -39
- package/dist/config/migrator/itemsBlockMigrator.js +164 -161
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/services/stripoApi.js +21 -18
- package/dist/src/stores/editor.d.ts +6 -0
- package/dist/stores/editor.js +15 -14
- package/dist/utils/pairProductVariables.js +98 -108
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import r from "./AssignStrategyDrawer.vue2.js";
|
|
|
3
3
|
import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
4
|
var a = function() {
|
|
5
5
|
var e = this, s = e._self._c, t = e._self._setupProxy;
|
|
6
|
-
return t.
|
|
6
|
+
return t.store.assignStrategyDrawerStatus ? s(t.OrgStrategyDetailModal, { staticClass: "assign-strategy-drawer", attrs: { "description-status": "", show: "", "description-text": t.drawerDescription, "footer-button-group-options": t.footerButtonGroupOptions, strategy: t.selectedStrategy ?? {}, "title-text": t.trans("gpt-app-builder.assign-recommendation-strategy") }, on: { close: t.closeDrawer, primaryClick: t.assignStrategy }, scopedSlots: e._u([{ key: "contentTop", fn: function() {
|
|
7
7
|
return [s("div", { staticClass: "assign-strategy-drawer-content px-5 py-5" }, [t.strategiesLoading ? s(t.InSkeleton, { staticClass: "assign-strategy-select-skeleton", attrs: { sizing: t.SELECT_SKELETON_SIZING } }) : s(t.OrgStrategyDropdown, { staticClass: "assign-strategy-select w-23-s", attrs: { id: "assign-strategy-select", "create-button-visible": "", "info-box-position": "bottom right", "placeholder-text": t.trans("smart-recommender.select-recommendation-strategy"), "selected-strategy-id": t.selectedStrategyId, state: t.showSelectionError ? "error" : "default", "state-message": t.showSelectionError ? t.trans("ds-steps.select-strategy-tooltip") : "", strategies: t.strategyOptions }, on: { create: function(c) {
|
|
8
8
|
return t.store.openStrategyCreation();
|
|
9
9
|
}, infoBoxButtonClick: t.onInfoBoxButtonClick, select: t.onSelect } })], 1)];
|
|
@@ -1,57 +1,51 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as b, defineAsyncComponent as T, ref as w, computed as o, watch as N } from "vue";
|
|
2
2
|
import "@useinsider/design-system-organisms/style";
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { useTranslations as
|
|
5
|
-
import { DOTTED_DATE_LOCALE as
|
|
6
|
-
import { URLS as
|
|
7
|
-
import { ToasterTypeOptions as
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { commitStrategyChange as
|
|
10
|
-
import
|
|
11
|
-
import { formatShortDate as
|
|
12
|
-
import { asText as
|
|
13
|
-
import { escapeHtml as
|
|
14
|
-
import { InSkeleton as
|
|
15
|
-
const
|
|
3
|
+
import { useToaster as R } from "../../../../composables/useToaster.js";
|
|
4
|
+
import { useTranslations as P } from "../../../../composables/useTranslations.js";
|
|
5
|
+
import { DOTTED_DATE_LOCALE as U } from "../../../../enums/date.js";
|
|
6
|
+
import { URLS as G } from "../../../../enums/extensions/recommendationBlock.js";
|
|
7
|
+
import { ToasterTypeOptions as u } from "../../../../enums/toaster.js";
|
|
8
|
+
import { useRecommendationExtensionStore as M } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
+
import { commitStrategyChange as E } from "../../../../extensions/Blocks/Recommendation/utils/strategyCommit.js";
|
|
10
|
+
import $ from "./StrategyInfoBoxContent.vue.js";
|
|
11
|
+
import { formatShortDate as z } from "../../../../utils/dateUtil.js";
|
|
12
|
+
import { asText as D } from "../../../../utils/genericUtil.js";
|
|
13
|
+
import { escapeHtml as H } from "../../../../utils/htmlEscape.js";
|
|
14
|
+
import { InSkeleton as O } from "@useinsider/design-system-vue";
|
|
15
|
+
const it = /* @__PURE__ */ b({
|
|
16
16
|
__name: "AssignStrategyDrawer",
|
|
17
|
-
setup(
|
|
18
|
-
const g = () => import("@useinsider/design-system-organisms"),
|
|
19
|
-
render: (s) => s(
|
|
20
|
-
}),
|
|
17
|
+
setup(F) {
|
|
18
|
+
const g = () => import("@useinsider/design-system-organisms"), p = (t, r) => ({
|
|
19
|
+
render: (s) => s(O, { props: { sizing: { width: t, height: r } } })
|
|
20
|
+
}), I = T({
|
|
21
21
|
loader: async () => (await g()).OrgStrategyDetailModal,
|
|
22
|
-
loadingComponent:
|
|
22
|
+
loadingComponent: p(480, 240),
|
|
23
23
|
delay: 0
|
|
24
|
-
}),
|
|
24
|
+
}), h = T({
|
|
25
25
|
loader: async () => (await g()).OrgStrategyDropdown
|
|
26
|
-
}), i = "guido-edit-strategy-",
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
));
|
|
30
|
-
R(() => e.assignStrategyDrawerStatus, async (t) => {
|
|
31
|
-
if (!t) {
|
|
32
|
-
await P(), m.value = e.assignStrategyDrawerStatus;
|
|
26
|
+
}), i = "guido-edit-strategy-", x = { width: 480, height: 42 }, a = P(), e = M(), { showToaster: c } = R(), n = w(null), d = "legacy", l = w(!1), A = o(() => e.strategiesLoading || e.legacyConversionLoading), C = o(() => e.assignStrategyDrawerStatus ? a("email-editor.assign-strategy-description", { url: G.RECOMMENDATION_STRATEGIES_PANEL_PATH }) : "");
|
|
27
|
+
N(() => e.assignStrategyDrawerStatus, (t) => {
|
|
28
|
+
if (!t)
|
|
33
29
|
return;
|
|
34
|
-
}
|
|
35
|
-
m.value = !0;
|
|
36
30
|
const { strategyId: r } = e.recommendationConfigs;
|
|
37
31
|
n.value = r || (e.isLegacyStrategyBlock ? d : null), l.value = !1, e.invalidateStrategies(), e.fetchStrategies().catch(() => {
|
|
38
32
|
c({
|
|
39
|
-
type:
|
|
33
|
+
type: u.Error,
|
|
40
34
|
message: a("discovery-strategy.error-description")
|
|
41
35
|
});
|
|
42
36
|
});
|
|
43
|
-
}
|
|
44
|
-
const
|
|
45
|
-
const r =
|
|
37
|
+
});
|
|
38
|
+
const f = (t) => {
|
|
39
|
+
const r = D(t.updated_at || t.created_at);
|
|
46
40
|
if (!r)
|
|
47
41
|
return "";
|
|
48
|
-
const s =
|
|
42
|
+
const s = z(r, U);
|
|
49
43
|
return a("recommendation-strategy.last-updated-on", { value: s });
|
|
50
|
-
},
|
|
44
|
+
}, S = o(() => ({
|
|
51
45
|
text: a("ds-steps.legacy-strategy"),
|
|
52
46
|
value: d,
|
|
53
47
|
hidden: !0
|
|
54
|
-
})),
|
|
48
|
+
})), m = o(() => e.strategies.map((t) => ({
|
|
55
49
|
text: t.name,
|
|
56
50
|
value: t.strategy_id,
|
|
57
51
|
infoBoxProps: {
|
|
@@ -60,10 +54,10 @@ const lt = /* @__PURE__ */ N({
|
|
|
60
54
|
variant: "information",
|
|
61
55
|
size: "small",
|
|
62
56
|
class: "assign-strategy-info-box",
|
|
63
|
-
titleText:
|
|
57
|
+
titleText: H(D(t.name)),
|
|
64
58
|
descriptionStatus: !0,
|
|
65
|
-
descriptionText:
|
|
66
|
-
slot:
|
|
59
|
+
descriptionText: f(t),
|
|
60
|
+
slot: $,
|
|
67
61
|
slotProps: { strategy: t },
|
|
68
62
|
// The info box drops the option's value/text, so the id is the only channel
|
|
69
63
|
// that can carry the strategy back to the click handler.
|
|
@@ -76,17 +70,17 @@ const lt = /* @__PURE__ */ N({
|
|
|
76
70
|
icon: "line-open-website"
|
|
77
71
|
}]
|
|
78
72
|
}
|
|
79
|
-
}))),
|
|
80
|
-
var
|
|
81
|
-
const r = (
|
|
73
|
+
}))), L = o(() => e.isLegacyStrategyBlock ? [S.value, ...m.value] : m.value), B = (t) => {
|
|
74
|
+
var _;
|
|
75
|
+
const r = (_ = t == null ? void 0 : t.id) != null && _.startsWith(i) ? t.id.slice(i.length) : "";
|
|
82
76
|
if (!r)
|
|
83
77
|
return;
|
|
84
78
|
const s = e.currentRecommendationId, y = e.recommendationConfigs.strategyId === r;
|
|
85
|
-
e.openStrategyEdit(r) && (String(n.value ?? "") === r && (n.value = null), y && (e.removeStrategy(), s !== null &&
|
|
86
|
-
},
|
|
79
|
+
e.openStrategyEdit(r) && (String(n.value ?? "") === r && (n.value = null), y && (e.removeStrategy(), s !== null && E(s, "Removed recommendation strategy")));
|
|
80
|
+
}, v = o(() => {
|
|
87
81
|
const t = e.strategies.find((r) => String(r.strategy_id) === String(n.value ?? ""));
|
|
88
82
|
return t ? { ...t, fallback_config: null } : null;
|
|
89
|
-
}),
|
|
83
|
+
}), k = o(() => ({
|
|
90
84
|
primaryButton: {
|
|
91
85
|
styling: "solid",
|
|
92
86
|
type: "primary",
|
|
@@ -98,10 +92,10 @@ const lt = /* @__PURE__ */ N({
|
|
|
98
92
|
labelText: a("products.cancel")
|
|
99
93
|
}
|
|
100
94
|
}));
|
|
101
|
-
return { __sfc: !0, loadOrganisms: g, skeleton:
|
|
95
|
+
return { __sfc: !0, loadOrganisms: g, skeleton: p, OrgStrategyDetailModal: I, OrgStrategyDropdown: h, EDIT_BUTTON_ID_PREFIX: i, SELECT_SKELETON_SIZING: x, trans: a, store: e, showToaster: c, selectedStrategyId: n, LEGACY_OPTION_VALUE: d, showSelectionError: l, strategiesLoading: A, drawerDescription: C, lastUpdatedText: f, legacyStrategyOption: S, remoteStrategyOptions: m, strategyOptions: L, onInfoBoxButtonClick: B, selectedStrategy: v, footerButtonGroupOptions: k, closeDrawer: () => {
|
|
102
96
|
e.closeAssignStrategyDrawer();
|
|
103
97
|
}, assignStrategy: async () => {
|
|
104
|
-
const t =
|
|
98
|
+
const t = v.value;
|
|
105
99
|
if (!t) {
|
|
106
100
|
l.value = !0;
|
|
107
101
|
return;
|
|
@@ -114,21 +108,21 @@ const lt = /* @__PURE__ */ N({
|
|
|
114
108
|
}
|
|
115
109
|
if (!r) {
|
|
116
110
|
c({
|
|
117
|
-
type:
|
|
111
|
+
type: u.Error,
|
|
118
112
|
message: a("email-editor.strategy-assign-failed", { strategyName: t.name })
|
|
119
113
|
});
|
|
120
114
|
return;
|
|
121
115
|
}
|
|
122
116
|
const s = e.currentRecommendationId;
|
|
123
117
|
e.assignStrategy(t), c({
|
|
124
|
-
type:
|
|
118
|
+
type: u.Success,
|
|
125
119
|
message: a("email-editor.strategy-assigned-success", { strategyName: t.name })
|
|
126
|
-
}), e.closeAssignStrategyDrawer(), s !== null && await
|
|
120
|
+
}), e.closeAssignStrategyDrawer(), s !== null && await E(s, "Assigned recommendation strategy");
|
|
127
121
|
}, onSelect: (t) => {
|
|
128
122
|
n.value = t.value, l.value = !1;
|
|
129
|
-
}, InSkeleton:
|
|
123
|
+
}, InSkeleton: O };
|
|
130
124
|
}
|
|
131
125
|
});
|
|
132
126
|
export {
|
|
133
|
-
|
|
127
|
+
it as default
|
|
134
128
|
};
|
|
@@ -2,17 +2,17 @@ import i from "./EditorActionsMenu.vue2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
4
|
var n = function() {
|
|
5
|
-
var
|
|
6
|
-
return
|
|
5
|
+
var o = this, e = o._self._c, t = o._self._setupProxy;
|
|
6
|
+
return e("div", { staticClass: "editor-actions-menu p-r" }, [e(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.isEditorUnavailable, "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
|
+
} } }), e(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(
|
|
10
10
|
i,
|
|
11
11
|
n,
|
|
12
12
|
a,
|
|
13
13
|
!1,
|
|
14
14
|
null,
|
|
15
|
-
"
|
|
15
|
+
"0e63ebe1"
|
|
16
16
|
);
|
|
17
17
|
const _ = r.exports;
|
|
18
18
|
export {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as D, ref as C, computed as
|
|
2
|
-
import { useAccessibilityApi as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useExport as
|
|
5
|
-
import { useTranslations as
|
|
6
|
-
import { useVersionHistoryApi as
|
|
1
|
+
import { defineComponent as D, ref as C, computed as s, watch as L } from "vue";
|
|
2
|
+
import { useAccessibilityApi as U } from "../../../composables/useAccessibilityApi.js";
|
|
3
|
+
import { useConfig as R } from "../../../composables/useConfig.js";
|
|
4
|
+
import { useExport as Y } from "../../../composables/useExport.js";
|
|
5
|
+
import { useTranslations as F } from "../../../composables/useTranslations.js";
|
|
6
|
+
import { useVersionHistoryApi as N } from "../../../composables/useVersionHistoryApi.js";
|
|
7
7
|
import { useAutosaveStore as X } from "../../../stores/autosave.js";
|
|
8
8
|
import { useEditorStore as j } from "../../../stores/editor.js";
|
|
9
9
|
import { useOnboardingStore as q } from "../../../stores/onboarding.js";
|
|
@@ -12,22 +12,22 @@ import { InToggle as G, InDropdownMenu as J, InButtonV2 as K } from "@useinsider
|
|
|
12
12
|
const ce = /* @__PURE__ */ D({
|
|
13
13
|
__name: "EditorActionsMenu",
|
|
14
14
|
setup(Q) {
|
|
15
|
-
const c = "guido__kebab-autosave", u = "guido__kebab-version-history", p = "guido__kebab-accessibility", d = "guido__kebab-save-as", v = "guido__kebab-export", { config:
|
|
15
|
+
const c = "guido__kebab-autosave", u = "guido__kebab-version-history", p = "guido__kebab-accessibility", d = "guido__kebab-save-as", v = "guido__kebab-export", { config: b, isFeatureEnabled: m } = R(), { exportHtml: y } = Y(), { openVersionHistory: A, closeVersionHistory: _ } = N(), { toggleAccessibilityTestingMode: O } = U(), e = j(), a = X(), f = q(), o = F(), g = C(!1), M = s(() => g.value || f.isEditorActionsMenuPinned), r = C(!1), S = s(() => m("autosave")), E = s(
|
|
16
16
|
() => {
|
|
17
|
-
var t,
|
|
18
|
-
return !!((
|
|
17
|
+
var t, i;
|
|
18
|
+
return !!((i = (t = b.value) == null ? void 0 : t.features) != null && i.versionHistory) && !e.isPreviewModeOpen;
|
|
19
19
|
}
|
|
20
|
-
),
|
|
21
|
-
() =>
|
|
22
|
-
),
|
|
23
|
-
var t,
|
|
24
|
-
return !!((
|
|
25
|
-
}),
|
|
20
|
+
), x = s(
|
|
21
|
+
() => m("accessibilityTesting") && !e.isPreviewModeOpen
|
|
22
|
+
), h = s(() => {
|
|
23
|
+
var t, i;
|
|
24
|
+
return !!((i = (t = b.value) == null ? void 0 : t.features) != null && i.saveAsTemplate);
|
|
25
|
+
}), V = s(() => S.value ? [
|
|
26
26
|
{ categoryText: o("email-editor.preferences") },
|
|
27
27
|
{
|
|
28
28
|
text: o("email-editor.auto-save"),
|
|
29
29
|
value: c,
|
|
30
|
-
disable: e.
|
|
30
|
+
disable: e.isEditorUnavailable,
|
|
31
31
|
rightSlotComponent: G,
|
|
32
32
|
rightSlotProps: {
|
|
33
33
|
// InDropdownMenu fills attrs.id with its own positional test id, and v-bind
|
|
@@ -35,25 +35,25 @@ const ce = /* @__PURE__ */ D({
|
|
|
35
35
|
name: "guido-kebab-autosave-toggle",
|
|
36
36
|
class: "p-e-n",
|
|
37
37
|
checked: a.isOn,
|
|
38
|
-
disable: e.
|
|
38
|
+
disable: e.isEditorUnavailable
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
{ divider: "solid" }
|
|
42
|
-
] : []), T =
|
|
42
|
+
] : []), T = s(() => [
|
|
43
43
|
{ categoryText: o("email-editor.actions") },
|
|
44
|
-
...
|
|
44
|
+
...E.value ? [{
|
|
45
45
|
text: o("newsletter.version-history"),
|
|
46
46
|
value: u,
|
|
47
47
|
iconLeft: "line-architect-version-history",
|
|
48
48
|
disable: e.isVersionHistoryButtonDisabled
|
|
49
49
|
}] : [],
|
|
50
|
-
...
|
|
50
|
+
...x.value ? [{
|
|
51
51
|
text: o("email-editor.accessibility-test"),
|
|
52
52
|
value: p,
|
|
53
53
|
iconLeft: "line-accessibility",
|
|
54
|
-
disable: e.
|
|
54
|
+
disable: e.isEditorUnavailable
|
|
55
55
|
}] : [],
|
|
56
|
-
...
|
|
56
|
+
...h.value ? [{
|
|
57
57
|
text: o("newsletter.save-templates"),
|
|
58
58
|
value: d,
|
|
59
59
|
iconLeft: "line-newsletter-save-as-template",
|
|
@@ -65,7 +65,7 @@ const ce = /* @__PURE__ */ D({
|
|
|
65
65
|
iconLeft: "line-export",
|
|
66
66
|
disable: r.value || e.isExportButtonDisabled
|
|
67
67
|
}
|
|
68
|
-
]), P =
|
|
68
|
+
]), P = s(() => [...V.value, ...T.value]), n = () => {
|
|
69
69
|
g.value = !1;
|
|
70
70
|
};
|
|
71
71
|
L(() => f.isEditorActionsMenuPinned, (t) => {
|
|
@@ -74,9 +74,9 @@ const ce = /* @__PURE__ */ D({
|
|
|
74
74
|
const k = () => {
|
|
75
75
|
a.isOn = !a.isOn;
|
|
76
76
|
}, w = () => {
|
|
77
|
-
e.isVersionHistoryOpen ?
|
|
77
|
+
e.isVersionHistoryOpen ? _() : A(), n();
|
|
78
78
|
}, H = () => {
|
|
79
|
-
|
|
79
|
+
O(), n();
|
|
80
80
|
}, I = () => {
|
|
81
81
|
e.isSaveAsTemplateDrawerOpen = !0, n();
|
|
82
82
|
}, B = async () => {
|
|
@@ -88,9 +88,9 @@ const ce = /* @__PURE__ */ D({
|
|
|
88
88
|
[d]: I,
|
|
89
89
|
[v]: B
|
|
90
90
|
};
|
|
91
|
-
return { __sfc: !0, AUTOSAVE: c, VERSION_HISTORY: u, ACCESSIBILITY: p, SAVE_AS: d, EXPORT: v, config:
|
|
92
|
-
var
|
|
93
|
-
return (
|
|
91
|
+
return { __sfc: !0, AUTOSAVE: c, VERSION_HISTORY: u, ACCESSIBILITY: p, SAVE_AS: d, EXPORT: v, config: b, isFeatureEnabled: m, exportHtml: y, openVersionHistory: A, closeVersionHistory: _, toggleAccessibilityTestingMode: O, editorStore: e, autosaveStore: a, onboardingStore: f, trans: o, isOpen: g, isPanelOpen: M, isExporting: r, isAutosaveVisible: S, isVersionHistoryVisible: E, isAccessibilityVisible: x, isSaveAsVisible: h, preferenceOptions: V, actionOptions: T, options: P, close: n, toggleAutosave: k, handleVersionHistory: w, handleAccessibility: H, handleSaveAs: I, handleExport: B, optionHandlers: l, handleOptionClick: ({ value: t }) => {
|
|
92
|
+
var i;
|
|
93
|
+
return (i = l[t]) == null ? void 0 : i.call(l);
|
|
94
94
|
}, getTooltipOptions: z, InButtonV2: K, InDropdownMenu: J };
|
|
95
95
|
}
|
|
96
96
|
});
|
|
@@ -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
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useAmbiguousDynamicContent as
|
|
1
|
+
import { useActionsApi as N } from "./useActionsApi.js";
|
|
2
|
+
import { useAmbiguousDynamicContent as j } from "./useAmbiguousDynamicContent.js";
|
|
3
3
|
import { useBlocksConfig as $ } from "./useBlocksConfig.js";
|
|
4
4
|
import { useConfig as G } from "./useConfig.js";
|
|
5
5
|
import { useCustomInterfaceAppearance as v } from "./useCustomInterfaceAppearance.js";
|
|
@@ -13,40 +13,40 @@ import { en as B } from "../config/i18n/en/index.js";
|
|
|
13
13
|
import { ToasterTypeOptions as Z } from "../enums/toaster.js";
|
|
14
14
|
import { useStripoApi as ee } from "../services/stripoApi.js";
|
|
15
15
|
import te from "../static/styles/customEditorStyle.css.js";
|
|
16
|
-
import { useEditorStore as
|
|
16
|
+
import { useEditorStore as F } from "../stores/editor.js";
|
|
17
17
|
import { buildMergeTagEntries as oe, flattenDynamicContentList as re } from "../utils/genericUtil.js";
|
|
18
18
|
import { getStripoRuntimeBaseUrl as ie } from "../utils/stripoRuntime.js";
|
|
19
|
-
let
|
|
19
|
+
let l = null, T = !1;
|
|
20
20
|
const ve = (t) => {
|
|
21
|
-
const { features: u, template: m, isFeatureEnabled: p } = G(), { handleError: f, showToaster: A } = W(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: D } = ee(), { handleEvent: U } = K(), { handleModuleAdd: V } = J(), { restorePending: I } =
|
|
21
|
+
const { features: u, template: m, isFeatureEnabled: p } = G(), { handleError: f, showToaster: A } = W(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: D } = ee(), { handleEvent: U } = K(), { handleModuleAdd: V } = J(), { restorePending: I } = j(), { getStripoBlocksConfig: L } = $(), { getStripoNotifications: q } = Q(), g = () => l || (l = new Promise((n, a) => {
|
|
22
22
|
if (document.getElementById("UiEditorScript")) {
|
|
23
23
|
n();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
const i = ie();
|
|
27
27
|
if (!i) {
|
|
28
|
-
|
|
28
|
+
a(
|
|
29
29
|
new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
|
|
30
30
|
);
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
}, document.body.appendChild(
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
}),
|
|
42
|
-
var
|
|
43
|
-
const
|
|
33
|
+
const s = `${i}UIEditor.js`, o = document.createElement("script");
|
|
34
|
+
o.id = "UiEditorScript", o.type = "module", o.src = s, o.onload = () => {
|
|
35
|
+
T = !0, n();
|
|
36
|
+
}, o.onerror = () => {
|
|
37
|
+
o.remove(), a(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
|
|
38
|
+
}, document.body.appendChild(o);
|
|
39
|
+
}), l.catch(() => {
|
|
40
|
+
l = null;
|
|
41
|
+
}), l), x = async (n, a, i, s = [], o = !1, c = !1) => {
|
|
42
|
+
var k, w, b, _;
|
|
43
|
+
const e = F(), { html: S, css: y } = n, { baseBlocks: E, extensions: O } = await L();
|
|
44
44
|
t.mark("blocks_config_ready");
|
|
45
|
-
const h = ((
|
|
45
|
+
const h = ((k = u.value) == null ? void 0 : k.displayConditions) ?? !0, H = ((w = u.value) == null ? void 0 : w.modulesDisabled) ?? !1, C = c || (((b = m.value) == null ? void 0 : b.forceRecreate) ?? !1), z = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
|
|
46
46
|
t.setTemplate({ html: S, css: y, forceRecreate: C }), v().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
|
|
47
47
|
document.querySelector("#guido-editor"),
|
|
48
48
|
{
|
|
49
|
-
metadata:
|
|
49
|
+
metadata: a,
|
|
50
50
|
html: S,
|
|
51
51
|
css: y,
|
|
52
52
|
forceRecreate: C,
|
|
@@ -64,7 +64,7 @@ const ve = (t) => {
|
|
|
64
64
|
customConditionsEnabled: h,
|
|
65
65
|
enableXSSSecurity: !0,
|
|
66
66
|
modulesDisabled: H,
|
|
67
|
-
syncModulesEnabled:
|
|
67
|
+
syncModulesEnabled: o,
|
|
68
68
|
messageSettingsEnabled: !0,
|
|
69
69
|
displayGmailAnnotations: !0,
|
|
70
70
|
displayHiddenPreheader: !1,
|
|
@@ -74,12 +74,12 @@ const ve = (t) => {
|
|
|
74
74
|
copyPasteEnabled: !1,
|
|
75
75
|
selectElementAfterDrop: !0,
|
|
76
76
|
sameFontSizeForOutlook: !0,
|
|
77
|
-
allowedScriptSourceDomains:
|
|
77
|
+
allowedScriptSourceDomains: z,
|
|
78
78
|
...E ? { baseBlocks: E } : {},
|
|
79
79
|
editorFonts: {
|
|
80
80
|
showDefaultStandardFonts: !0,
|
|
81
81
|
showDefaultNotStandardFonts: !0,
|
|
82
|
-
customFonts:
|
|
82
|
+
customFonts: s
|
|
83
83
|
},
|
|
84
84
|
mergeTags: [
|
|
85
85
|
{
|
|
@@ -93,33 +93,37 @@ const ve = (t) => {
|
|
|
93
93
|
async onTokenRefreshRequest(r) {
|
|
94
94
|
try {
|
|
95
95
|
t.mark("token_start");
|
|
96
|
-
const
|
|
97
|
-
t.mark("token_end"),
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
const d = await P();
|
|
97
|
+
if (t.mark("token_end"), !d && !e.isStripoInitialized) {
|
|
98
|
+
e.loadingStatus = !1, t.markFailed();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
r(d);
|
|
102
|
+
} catch (d) {
|
|
103
|
+
f(d, "Failed to refresh token");
|
|
100
104
|
}
|
|
101
105
|
},
|
|
102
106
|
onTemplateLoaded() {
|
|
103
107
|
try {
|
|
104
|
-
const { activateCustomViewStyles: r, updateTimerInClonedTemplate:
|
|
105
|
-
v().importCss(), r(),
|
|
106
|
-
|
|
108
|
+
const { activateCustomViewStyles: r, updateTimerInClonedTemplate: d } = N(), { injectFullStory: M } = X();
|
|
109
|
+
v().importCss(), r(), M(), I(), d(), i.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
110
|
+
e.hasChanges = !1;
|
|
107
111
|
}, 1e3), t.markReady();
|
|
108
112
|
} catch (r) {
|
|
109
113
|
f(r, "Failed to load custom interface appearance");
|
|
110
114
|
}
|
|
111
115
|
},
|
|
112
116
|
onCodeEditorVisibilityChanged(r) {
|
|
113
|
-
|
|
117
|
+
e.isCodeEditorOpen = r;
|
|
114
118
|
},
|
|
115
119
|
onEditorVisualModeChanged(r) {
|
|
116
|
-
|
|
120
|
+
e.editorVisualMode = r.toLowerCase();
|
|
117
121
|
},
|
|
118
122
|
onVersionHistoryVisibilityChanged(r) {
|
|
119
|
-
|
|
123
|
+
e.isVersionHistoryOpen = r;
|
|
120
124
|
},
|
|
121
125
|
onDataChanged() {
|
|
122
|
-
|
|
126
|
+
e.hasChanges = !0, e.changeSeq += 1;
|
|
123
127
|
},
|
|
124
128
|
onEvent: U,
|
|
125
129
|
onModuleAdd: V,
|
|
@@ -138,17 +142,17 @@ const ve = (t) => {
|
|
|
138
142
|
}
|
|
139
143
|
);
|
|
140
144
|
};
|
|
141
|
-
return { initPlugin: async (n,
|
|
142
|
-
const
|
|
145
|
+
return { initPlugin: async (n, a, i, s = !1) => {
|
|
146
|
+
const o = F();
|
|
143
147
|
try {
|
|
144
|
-
t.mark("plugin_start"), t.setScriptPreloaded(
|
|
145
|
-
const [c,
|
|
148
|
+
t.mark("plugin_start"), t.setScriptPreloaded(T), await g(), t.mark("script_ready");
|
|
149
|
+
const [c, e] = await Promise.all([
|
|
146
150
|
R(),
|
|
147
151
|
D()
|
|
148
152
|
]);
|
|
149
|
-
t.mark("fonts_sync_ready"),
|
|
153
|
+
t.mark("fonts_sync_ready"), o.syncModulesEnabled = e, await x(n, a, i, c, e, s);
|
|
150
154
|
} catch {
|
|
151
|
-
|
|
155
|
+
o.loadingStatus = !1, A({
|
|
152
156
|
type: Z.Error,
|
|
153
157
|
message: B["An error has occurred. Please report the error code to support."],
|
|
154
158
|
actionButton: {
|