@useinsider/guido 3.20.1-beta.f34075e → 3.20.1-beta.f69c15d
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/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +58 -57
- package/dist/components/organisms/AutoSaveController.vue2.js +9 -10
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +51 -53
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +22 -23
- package/dist/composables/useAutoSave.js +44 -46
- package/dist/composables/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useSave.js +23 -26
- package/dist/composables/useSaveValidation.js +114 -113
- package/dist/composables/useSaveValidationRollout.js +6 -17
- package/dist/composables/useStripo.js +3 -4
- package/dist/extensions/Blocks/Items/block.js +42 -43
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +223 -296
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +205 -219
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +36 -51
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +35 -31
- package/dist/extensions/Blocks/Unsubscribe/block.js +70 -75
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +192 -271
- package/dist/package.json.js +1 -1
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/composables/useAutoSave.d.ts +1 -4
- package/dist/src/composables/useSaveValidationRollout.d.ts +0 -1
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +0 -8
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +0 -40
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -11
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -18
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -8
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +0 -7
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +1 -6
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -22
- package/dist/static/styles/components/button.css.js +0 -5
- package/package.json +3 -3
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +0 -19
- package/dist/services/settingsApi.js +0 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +0 -17
- package/dist/src/services/settingsApi.d.ts +0 -6
- package/dist/src/stores/setup-settings.d.ts +0 -4
- package/dist/stores/setup-settings.js +0 -10
|
@@ -1,78 +1,76 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useEditorLock as
|
|
3
|
-
import { useAutosaveStore as
|
|
4
|
-
import { useEditorStore as
|
|
5
|
-
import { computed as
|
|
6
|
-
const
|
|
7
|
-
const { isFeatureEnabled:
|
|
8
|
-
let
|
|
9
|
-
const
|
|
10
|
-
() =>
|
|
11
|
-
),
|
|
12
|
-
hasChanges:
|
|
13
|
-
isInSaveableState:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (!d.value) {
|
|
1
|
+
import { useConfig as E } from "./useConfig.js";
|
|
2
|
+
import { useEditorLock as f } from "./useEditorLock.js";
|
|
3
|
+
import { useAutosaveStore as p, AUTOSAVE_STATUS as s } from "../stores/autosave.js";
|
|
4
|
+
import { useEditorStore as A } from "../stores/editor.js";
|
|
5
|
+
import { computed as y, watch as I, onUnmounted as L } from "vue";
|
|
6
|
+
const w = 18e4, v = 6e4, R = (b) => {
|
|
7
|
+
const { isFeatureEnabled: S } = E(), o = A(), t = p(), { isEditorBusy: g } = f();
|
|
8
|
+
let i = null, c = 0;
|
|
9
|
+
const u = y(
|
|
10
|
+
() => S("autosave") && t.isOn
|
|
11
|
+
), m = () => o.hasChanges && o.isInSaveableState, h = () => ({
|
|
12
|
+
hasChanges: o.hasChanges,
|
|
13
|
+
isInSaveableState: o.isInSaveableState
|
|
14
|
+
}), l = async (e) => {
|
|
15
|
+
if (!u.value) {
|
|
17
16
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
|
|
18
17
|
return;
|
|
19
18
|
}
|
|
20
|
-
if (!
|
|
21
|
-
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates:
|
|
19
|
+
if (!m()) {
|
|
20
|
+
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: h() });
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
24
|
-
if (t.status ===
|
|
23
|
+
if (t.status === s.SAVING) {
|
|
25
24
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
|
|
26
25
|
return;
|
|
27
26
|
}
|
|
28
|
-
if (
|
|
27
|
+
if (g()) {
|
|
29
28
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
|
|
30
29
|
return;
|
|
31
30
|
}
|
|
32
|
-
e === "visibility" && (
|
|
33
|
-
const n = s.changeSeq;
|
|
31
|
+
e === "visibility" && (c = Date.now()), console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
|
|
34
32
|
try {
|
|
35
|
-
if (await
|
|
36
|
-
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status =
|
|
33
|
+
if (await b() === void 0) {
|
|
34
|
+
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = s.ERROR;
|
|
37
35
|
return;
|
|
38
36
|
}
|
|
39
|
-
|
|
40
|
-
} catch (
|
|
41
|
-
console.debug("guido:autosave:error", { trigger: e, error:
|
|
37
|
+
o.hasChanges = !1, t.status = s.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
|
|
38
|
+
} catch (a) {
|
|
39
|
+
console.debug("guido:autosave:error", { trigger: e, error: a }), t.status = s.ERROR;
|
|
42
40
|
}
|
|
43
|
-
},
|
|
41
|
+
}, n = () => {
|
|
44
42
|
const { visibilityState: e } = document;
|
|
45
43
|
if (console.debug("guido:autosave:visibility-change", {
|
|
46
44
|
visibilityState: e,
|
|
47
|
-
isActive:
|
|
45
|
+
isActive: u.value
|
|
48
46
|
}), e !== "hidden")
|
|
49
47
|
return;
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
48
|
+
const a = Date.now() - c;
|
|
49
|
+
if (a < v) {
|
|
52
50
|
console.debug("guido:autosave:visibility-debounced", {
|
|
53
|
-
sinceLastMs:
|
|
54
|
-
debounceMs:
|
|
51
|
+
sinceLastMs: a,
|
|
52
|
+
debounceMs: v
|
|
55
53
|
});
|
|
56
54
|
return;
|
|
57
55
|
}
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
document.removeEventListener("visibilitychange",
|
|
56
|
+
l("visibility");
|
|
57
|
+
}, d = () => {
|
|
58
|
+
i && (clearInterval(i), i = null);
|
|
59
|
+
}, r = () => {
|
|
60
|
+
document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
|
|
63
61
|
};
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
I(
|
|
63
|
+
u,
|
|
66
64
|
(e) => {
|
|
67
|
-
console.debug("guido:autosave:active-changed", { active: e }), e ? (
|
|
68
|
-
console.debug("guido:autosave:interval-tick"),
|
|
69
|
-
},
|
|
65
|
+
console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), i = setInterval(() => {
|
|
66
|
+
console.debug("guido:autosave:interval-tick"), l("interval");
|
|
67
|
+
}, w), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), r(), t.status = s.IDLE);
|
|
70
68
|
},
|
|
71
69
|
{ immediate: !0 }
|
|
72
|
-
),
|
|
73
|
-
|
|
70
|
+
), L(() => {
|
|
71
|
+
d(), r(), t.status = s.IDLE, t.lastSavedAt = null;
|
|
74
72
|
});
|
|
75
73
|
};
|
|
76
74
|
export {
|
|
77
|
-
|
|
75
|
+
R as useAutoSave
|
|
78
76
|
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
1
|
+
import { useRecommendation as C } from "./useRecommendation.js";
|
|
2
2
|
import { useToaster as I } from "./useToaster.js";
|
|
3
3
|
import { useTranslations as v } from "./useTranslations.js";
|
|
4
4
|
import { ToasterTypeOptions as g } from "../enums/toaster.js";
|
|
5
5
|
import "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
6
6
|
import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
7
|
-
import { useRecommendationExtensionStore as
|
|
8
|
-
import { resolveMigrationTarget as
|
|
7
|
+
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
8
|
+
import { resolveMigrationTarget as k, buildLegacyMigrationPayload as R } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
|
|
9
9
|
import { commitBlockChangeOutsidePanel as T } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
|
|
10
10
|
import { useConfigStore as h } from "../stores/config.js";
|
|
11
11
|
const F = () => {
|
|
12
|
-
const e =
|
|
12
|
+
const e = b(), r = h(), { buildCampaignUrl: m } = C(), { showToaster: c } = I(), a = v();
|
|
13
13
|
return { convertLegacyStrategy: async () => {
|
|
14
14
|
const t = e.currentRecommendationId;
|
|
15
15
|
if (t === null || !e.isLegacyStrategyBlock || e.legacyConversionLoading)
|
|
16
16
|
return "";
|
|
17
|
-
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s =
|
|
18
|
-
campaignId:
|
|
19
|
-
templateLibraryId:
|
|
20
|
-
}),
|
|
17
|
+
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = k({
|
|
18
|
+
campaignId: r.campaignId,
|
|
19
|
+
templateLibraryId: r.templateLibraryId
|
|
20
|
+
}), S = R({
|
|
21
21
|
blockId: t,
|
|
22
22
|
url: m(String(t)),
|
|
23
|
-
campaignId:
|
|
24
|
-
variationId:
|
|
23
|
+
campaignId: r.campaignId,
|
|
24
|
+
variationId: r.variationId,
|
|
25
25
|
strategy: d,
|
|
26
26
|
productIds: y,
|
|
27
27
|
target: s
|
|
28
28
|
});
|
|
29
|
-
let
|
|
29
|
+
let o;
|
|
30
30
|
try {
|
|
31
|
-
|
|
31
|
+
o = await e.convertLegacyStrategy(S, s);
|
|
32
32
|
} catch (i) {
|
|
33
33
|
return console.error("[useLegacyStrategyConversion] migration failed", i), c({
|
|
34
34
|
type: g.Error,
|
|
@@ -40,7 +40,7 @@ const F = () => {
|
|
|
40
40
|
}), "";
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
43
|
-
await e.
|
|
43
|
+
await e.fetchStrategyProductsForBlock(t);
|
|
44
44
|
} catch (i) {
|
|
45
45
|
console.error("[useLegacyStrategyConversion] product refetch failed", i);
|
|
46
46
|
}
|
|
@@ -48,16 +48,16 @@ const F = () => {
|
|
|
48
48
|
return n ? T(
|
|
49
49
|
t,
|
|
50
50
|
{
|
|
51
|
-
strategyId:
|
|
51
|
+
strategyId: o,
|
|
52
52
|
size: n.recommendationConfigs.size,
|
|
53
53
|
configVersion: L
|
|
54
54
|
},
|
|
55
55
|
n.recommendationProducts,
|
|
56
56
|
"Converted legacy recommendation strategy"
|
|
57
|
-
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(),
|
|
57
|
+
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), c({
|
|
58
58
|
type: g.Error,
|
|
59
59
|
message: a("email-editor.legacy-strategy-update-failed")
|
|
60
|
-
}), "") :
|
|
60
|
+
}), "") : o;
|
|
61
61
|
} };
|
|
62
62
|
};
|
|
63
63
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
1
|
+
import { useActionsApi as W } from "./useActionsApi.js";
|
|
2
2
|
import { useConfig as q } from "./useConfig.js";
|
|
3
3
|
import { useEditorLock as O } from "./useEditorLock.js";
|
|
4
4
|
import { useSaveStart as D, useSaveComplete as F } from "./useGuidoActions.js";
|
|
@@ -19,37 +19,37 @@ import { useLiquidValidator as et } from "./validators/useLiquidValidator.js";
|
|
|
19
19
|
import { useSyncModuleBlockValidator as ot } from "./validators/useSyncModuleBlockValidator.js";
|
|
20
20
|
import { useUnsubscribeBlockValidator as st } from "./validators/useUnsubscribeBlockValidator.js";
|
|
21
21
|
const Bt = () => {
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
22
|
+
const r = D(), f = F(), { validateHtml: p } = _(), { validateLiquidSyntax: v } = et(), { validateCouponBlockTags: y } = tt(), { validateUnsubscribeBlockUniqueness: S, validateUnsubscribeBlockHasTemplate: w } = st(), { validateSyncModuleBlocks: n } = ot(), { callbacks: a, isFeatureEnabled: m } = q(), { extractSyncModuleData: b } = G(), { setSyncModuleUnsubscriptionPages: g } = J(), { editorSave: E, getTemplateData: H } = W(), { showToaster: V } = $(), { getBlockedDomains: x, resolveToast: k } = Z(), { prepareTemplateDetails: d } = X(), { collectSaveValidationErrors: C } = j(), { isEnabled: B } = z(), T = Q(), h = N(), P = K(), { runExclusive: l } = O(), c = async (t, e, o) => {
|
|
23
|
+
if (!m("allowlistEnabled"))
|
|
24
24
|
return !1;
|
|
25
|
-
const i = await
|
|
25
|
+
const i = await x(t, e);
|
|
26
26
|
if (!i.length)
|
|
27
27
|
return !1;
|
|
28
28
|
if (!o) {
|
|
29
|
-
const s = await
|
|
30
|
-
s != null && s.message &&
|
|
29
|
+
const s = await k(i);
|
|
30
|
+
s != null && s.message && V({
|
|
31
31
|
type: I.Warning,
|
|
32
32
|
message: s.message,
|
|
33
33
|
actionButton: s.actionButton
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
return !0;
|
|
37
|
-
}, L = async (t) => !y(t.compiledHtml) || !
|
|
38
|
-
if (!await
|
|
37
|
+
}, L = async (t) => !y(t.compiledHtml) || !S(t.compiledHtml) || !w(t.compiledHtml) ? !1 : m("liquidSyntax") ? v(t.compiledHtml) : p(t.compiledHtml, t.dynamicContentList, !0), u = async (t, e) => {
|
|
38
|
+
if (!await E())
|
|
39
39
|
return;
|
|
40
40
|
const { unsubscribePayload: i, stripoModules: s } = b(t.rawHtml);
|
|
41
41
|
if (await g(i), t.modules = s, !e.suppress) {
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
const R = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
43
|
+
f({ ...t, ...R, silent: e.silent });
|
|
44
44
|
}
|
|
45
45
|
return t;
|
|
46
46
|
}, U = async (t, e) => {
|
|
47
47
|
var i;
|
|
48
|
-
|
|
49
|
-
const o = await
|
|
48
|
+
r();
|
|
49
|
+
const o = await d();
|
|
50
50
|
if (n(o.rawHtml, e)) {
|
|
51
|
-
if (
|
|
52
|
-
const s = await
|
|
51
|
+
if (B.value && !e) {
|
|
52
|
+
const s = await C(
|
|
53
53
|
o.compiledHtml,
|
|
54
54
|
o.dynamicContentList
|
|
55
55
|
);
|
|
@@ -59,34 +59,31 @@ const Bt = () => {
|
|
|
59
59
|
}
|
|
60
60
|
} else if (!await L(o))
|
|
61
61
|
return;
|
|
62
|
-
if (!((i =
|
|
62
|
+
if (!((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(o)) && !await c(o.compiledHtml, o.css, e))
|
|
63
63
|
return u(o, { silent: e, suppress: t });
|
|
64
64
|
}
|
|
65
65
|
}, A = async () => {
|
|
66
66
|
var e;
|
|
67
|
-
if (!
|
|
67
|
+
if (!P.allowSaveWithErrors)
|
|
68
68
|
return;
|
|
69
|
-
|
|
70
|
-
const t = await
|
|
71
|
-
if (n(t.rawHtml, !1) && !((e =
|
|
69
|
+
r();
|
|
70
|
+
const t = await d();
|
|
71
|
+
if (n(t.rawHtml, !1) && !((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)) && !await c(t.compiledHtml, t.css, !1))
|
|
72
72
|
return u(t, { silent: !1, blankCompiled: !0 });
|
|
73
73
|
}, M = async () => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
a();
|
|
77
|
-
const { html: t, css: e } = await V();
|
|
74
|
+
r();
|
|
75
|
+
const { html: t, css: e } = await H();
|
|
78
76
|
if (!n(t, !0) || await c(t, e, !0))
|
|
79
77
|
return;
|
|
80
78
|
const o = Y(t), i = {
|
|
81
|
-
dynamicContentList:
|
|
79
|
+
dynamicContentList: h.getSelectedDynamicContentList,
|
|
82
80
|
compiledHtml: "",
|
|
83
81
|
rawHtml: t,
|
|
84
82
|
css: e,
|
|
85
83
|
ampHtml: "",
|
|
86
84
|
ampErrors: [],
|
|
87
85
|
modules: [],
|
|
88
|
-
|
|
89
|
-
recommendation: { configs: {} },
|
|
86
|
+
recommendation: { campaignUrls: {}, configs: {} },
|
|
90
87
|
unsubscribe: {
|
|
91
88
|
status: o.length > 0,
|
|
92
89
|
config: o
|