@useinsider/guido 3.20.2-beta.87fb8ae → 3.21.0-beta.1961907
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 +1 -1
- package/dist/components/Guido.vue2.js +65 -64
- package/dist/components/organisms/AutoSaveController.vue2.js +10 -9
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +53 -51
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +23 -22
- package/dist/composables/useAutoSave.js +46 -44
- package/dist/composables/useSave.js +78 -68
- package/dist/composables/useSaveValidation.js +113 -114
- package/dist/composables/useSaveValidationRollout.js +17 -6
- package/dist/composables/useStripo.js +4 -3
- package/dist/composables/validators/useHtmlDocumentCountValidator.js +22 -0
- package/dist/extensions/Blocks/Items/block.js +43 -42
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +9 -5
- 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 +271 -192
- package/dist/package.json.js +1 -1
- package/dist/services/settingsApi.js +11 -0
- package/dist/services/templateLibraryApi.js +36 -31
- 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 +4 -1
- package/dist/src/composables/useSaveValidationRollout.d.ts +1 -0
- package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +3 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +1 -6
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
- package/dist/src/services/settingsApi.d.ts +6 -0
- package/dist/src/stores/setup-settings.d.ts +4 -0
- package/dist/src/utils/templatePreparation.d.ts +2 -1
- package/dist/static/styles/components/button.css.js +5 -0
- package/dist/stores/setup-settings.js +10 -0
- package/dist/utils/templatePreparation.js +30 -30
- package/package.json +4 -4
|
@@ -1,76 +1,78 @@
|
|
|
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
|
-
|
|
1
|
+
import { useConfig as p } from "./useConfig.js";
|
|
2
|
+
import { useEditorLock as y } from "./useEditorLock.js";
|
|
3
|
+
import { useAutosaveStore as I, AUTOSAVE_STATUS as a } from "../stores/autosave.js";
|
|
4
|
+
import { useEditorStore as L } from "../stores/editor.js";
|
|
5
|
+
import { computed as w, watch as V, onUnmounted as k } from "vue";
|
|
6
|
+
const D = 18e4, b = 6e4, _ = (g, { clearsChanges: h = () => !0 } = {}) => {
|
|
7
|
+
const { isFeatureEnabled: m } = p(), s = L(), t = I(), { isEditorBusy: f } = y();
|
|
8
|
+
let o = null, l = 0, u = -1;
|
|
9
|
+
const d = w(
|
|
10
|
+
() => m("autosave") && t.isOn
|
|
11
|
+
), A = () => s.hasChanges && s.isInSaveableState && s.changeSeq !== u, E = () => ({
|
|
12
|
+
hasChanges: s.hasChanges,
|
|
13
|
+
isInSaveableState: s.isInSaveableState,
|
|
14
|
+
isUnchangedSinceLastSave: s.changeSeq === u
|
|
15
|
+
}), r = async (e) => {
|
|
16
|
+
if (!d.value) {
|
|
16
17
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
19
|
-
if (!
|
|
20
|
-
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates:
|
|
20
|
+
if (!A()) {
|
|
21
|
+
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: E() });
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
|
-
if (t.status ===
|
|
24
|
+
if (t.status === a.SAVING) {
|
|
24
25
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
27
|
-
if (
|
|
28
|
+
if (f()) {
|
|
28
29
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
|
-
e === "visibility" && (
|
|
32
|
+
e === "visibility" && (l = Date.now()), console.debug("guido:autosave:save-start", { trigger: e }), t.status = a.SAVING;
|
|
33
|
+
const n = s.changeSeq;
|
|
32
34
|
try {
|
|
33
|
-
if (await
|
|
34
|
-
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status =
|
|
35
|
+
if (await g() === void 0) {
|
|
36
|
+
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = a.ERROR;
|
|
35
37
|
return;
|
|
36
38
|
}
|
|
37
|
-
|
|
38
|
-
} catch (
|
|
39
|
-
console.debug("guido:autosave:error", { trigger: e, error:
|
|
39
|
+
u = n, h() && (s.hasChanges = !1), t.status = a.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
|
|
40
|
+
} catch (S) {
|
|
41
|
+
console.debug("guido:autosave:error", { trigger: e, error: S }), t.status = a.ERROR;
|
|
40
42
|
}
|
|
41
|
-
},
|
|
43
|
+
}, i = () => {
|
|
42
44
|
const { visibilityState: e } = document;
|
|
43
45
|
if (console.debug("guido:autosave:visibility-change", {
|
|
44
46
|
visibilityState: e,
|
|
45
|
-
isActive:
|
|
47
|
+
isActive: d.value
|
|
46
48
|
}), e !== "hidden")
|
|
47
49
|
return;
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
+
const n = Date.now() - l;
|
|
51
|
+
if (n < b) {
|
|
50
52
|
console.debug("guido:autosave:visibility-debounced", {
|
|
51
|
-
sinceLastMs:
|
|
52
|
-
debounceMs:
|
|
53
|
+
sinceLastMs: n,
|
|
54
|
+
debounceMs: b
|
|
53
55
|
});
|
|
54
56
|
return;
|
|
55
57
|
}
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
document.removeEventListener("visibilitychange",
|
|
58
|
+
r("visibility");
|
|
59
|
+
}, c = () => {
|
|
60
|
+
o && (clearInterval(o), o = null);
|
|
61
|
+
}, v = () => {
|
|
62
|
+
document.removeEventListener("visibilitychange", i), window.removeEventListener("pagehide", i);
|
|
61
63
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
V(
|
|
65
|
+
d,
|
|
64
66
|
(e) => {
|
|
65
|
-
console.debug("guido:autosave:active-changed", { active: e }), e ? (
|
|
66
|
-
console.debug("guido:autosave:interval-tick"),
|
|
67
|
-
},
|
|
67
|
+
console.debug("guido:autosave:active-changed", { active: e }), e ? (c(), o = setInterval(() => {
|
|
68
|
+
console.debug("guido:autosave:interval-tick"), r("interval");
|
|
69
|
+
}, D), document.addEventListener("visibilitychange", i), window.addEventListener("pagehide", i)) : (c(), v(), t.status = a.IDLE);
|
|
68
70
|
},
|
|
69
71
|
{ immediate: !0 }
|
|
70
|
-
),
|
|
71
|
-
|
|
72
|
+
), k(() => {
|
|
73
|
+
c(), v(), t.status = a.IDLE, t.lastSavedAt = null;
|
|
72
74
|
});
|
|
73
75
|
};
|
|
74
76
|
export {
|
|
75
|
-
|
|
77
|
+
_ as useAutoSave
|
|
76
78
|
};
|
|
@@ -1,100 +1,110 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useEditorLock as
|
|
4
|
-
import { useSaveStart as
|
|
5
|
-
import { useSaveValidation as
|
|
6
|
-
import { useSaveValidationRollout as
|
|
7
|
-
import { useSyncModuleExtractor as
|
|
8
|
-
import { ToasterTypeOptions as
|
|
9
|
-
import { useStripoApi as
|
|
10
|
-
import { useConfigStore as
|
|
11
|
-
import { useDynamicContentStore as
|
|
12
|
-
import { useSaveValidationStore as
|
|
13
|
-
import { useTemplatePreparation as
|
|
14
|
-
import { useAllowlist as
|
|
15
|
-
import { useHtmlValidator as
|
|
16
|
-
import { useToaster as
|
|
17
|
-
import { useCouponBlockValidator as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { useActionsApi as q } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as O } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as D } from "./useEditorLock.js";
|
|
4
|
+
import { useSaveStart as F, useSaveComplete as j } from "./useGuidoActions.js";
|
|
5
|
+
import { useSaveValidation as z } from "./useSaveValidation.js";
|
|
6
|
+
import { useSaveValidationRollout as G } from "./useSaveValidationRollout.js";
|
|
7
|
+
import { useSyncModuleExtractor as I } from "./useSyncModuleExtractor.js";
|
|
8
|
+
import { ToasterTypeOptions as J } from "../enums/toaster.js";
|
|
9
|
+
import { useStripoApi as K } from "../services/stripoApi.js";
|
|
10
|
+
import { useConfigStore as N } from "../stores/config.js";
|
|
11
|
+
import { useDynamicContentStore as Q } from "../stores/dynamic-content.js";
|
|
12
|
+
import { useSaveValidationStore as X } from "../stores/save-validation.js";
|
|
13
|
+
import { useTemplatePreparation as Y, getHtmlReferencedUnsubscribePages as Z } from "../utils/templatePreparation.js";
|
|
14
|
+
import { useAllowlist as _ } from "./useAllowlist.js";
|
|
15
|
+
import { useHtmlValidator as $ } from "./useHtmlValidator.js";
|
|
16
|
+
import { useToaster as tt } from "./useToaster.js";
|
|
17
|
+
import { useCouponBlockValidator as et } from "./validators/useCouponBlockValidator.js";
|
|
18
|
+
import { useHtmlDocumentCountValidator as ot } from "./validators/useHtmlDocumentCountValidator.js";
|
|
19
|
+
import { useLiquidValidator as it } from "./validators/useLiquidValidator.js";
|
|
20
|
+
import { useSyncModuleBlockValidator as st } from "./validators/useSyncModuleBlockValidator.js";
|
|
21
|
+
import { useUnsubscribeBlockValidator as at } from "./validators/useUnsubscribeBlockValidator.js";
|
|
22
|
+
const Pt = () => {
|
|
23
|
+
const n = F(), w = j(), { validateHtml: y } = $(), { validateLiquidSyntax: E } = it(), { validateCouponBlockTags: b } = et(), { validateUnsubscribeBlockUniqueness: g, validateUnsubscribeBlockHasTemplate: H } = at(), { validateSyncModuleBlocks: l } = st(), { validateSingleHtmlDocument: c } = ot(), { callbacks: r, isFeatureEnabled: v } = O(), { extractSyncModuleData: V } = I(), { setSyncModuleUnsubscriptionPages: x } = K(), { editorSave: C, getTemplateData: u } = q(), { showToaster: k } = tt(), { getBlockedDomains: h, resolveToast: B } = _(), { prepareTemplateDetails: p } = Y(), { collectSaveValidationErrors: T } = z(), { isEnabled: P } = G(), L = X(), U = Q(), S = N(), { runExclusive: m } = D(), d = async (t, e, i) => {
|
|
24
|
+
if (!v("allowlistEnabled"))
|
|
24
25
|
return !1;
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
26
|
+
const o = await h(t, e);
|
|
27
|
+
if (!o.length)
|
|
27
28
|
return !1;
|
|
28
|
-
if (!
|
|
29
|
-
const s = await
|
|
30
|
-
s != null && s.message &&
|
|
31
|
-
type:
|
|
29
|
+
if (!i) {
|
|
30
|
+
const s = await B(o);
|
|
31
|
+
s != null && s.message && k({
|
|
32
|
+
type: J.Warning,
|
|
32
33
|
message: s.message,
|
|
33
34
|
actionButton: s.actionButton
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
return !0;
|
|
37
|
-
},
|
|
38
|
-
if (!await
|
|
38
|
+
}, A = async (t) => !b(t.compiledHtml) || !g(t.compiledHtml) || !H(t.compiledHtml) ? !1 : v("liquidSyntax") ? E(t.compiledHtml) : y(t.compiledHtml, t.dynamicContentList, !0), f = async (t, e) => {
|
|
39
|
+
if (!await C())
|
|
39
40
|
return;
|
|
40
|
-
const { unsubscribePayload:
|
|
41
|
-
if (await
|
|
42
|
-
const
|
|
43
|
-
|
|
41
|
+
const { unsubscribePayload: o, stripoModules: s } = V(t.rawHtml);
|
|
42
|
+
if (await x(o), t.modules = s, !e.suppress) {
|
|
43
|
+
const a = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
44
|
+
w({ ...t, ...a, silent: e.silent });
|
|
44
45
|
}
|
|
45
46
|
return t;
|
|
46
|
-
},
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
}, M = async (t, e) => {
|
|
48
|
+
var s;
|
|
49
|
+
n();
|
|
50
|
+
const i = await u();
|
|
51
|
+
if (!c(i.html, e))
|
|
52
|
+
return;
|
|
53
|
+
const o = await p(i);
|
|
54
|
+
if (l(o.rawHtml, e)) {
|
|
55
|
+
if (P.value && !e) {
|
|
56
|
+
const a = await T(
|
|
53
57
|
o.compiledHtml,
|
|
54
58
|
o.dynamicContentList
|
|
55
59
|
);
|
|
56
|
-
if (
|
|
57
|
-
|
|
60
|
+
if (a.length) {
|
|
61
|
+
L.open(a, "save");
|
|
58
62
|
return;
|
|
59
63
|
}
|
|
60
|
-
} else if (!await
|
|
64
|
+
} else if (!await A(o))
|
|
61
65
|
return;
|
|
62
|
-
if (!((
|
|
63
|
-
return
|
|
66
|
+
if (!((s = r.value) != null && s.externalValidation && !await r.value.externalValidation(o)) && !await d(o.compiledHtml, o.css, e))
|
|
67
|
+
return f(o, { silent: e, suppress: t });
|
|
64
68
|
}
|
|
65
|
-
},
|
|
66
|
-
var
|
|
67
|
-
if (!
|
|
69
|
+
}, W = async () => {
|
|
70
|
+
var i;
|
|
71
|
+
if (!S.allowSaveWithErrors)
|
|
72
|
+
return;
|
|
73
|
+
n();
|
|
74
|
+
const t = await u();
|
|
75
|
+
if (!c(t.html, !1))
|
|
76
|
+
return;
|
|
77
|
+
const e = await p(t);
|
|
78
|
+
if (l(e.rawHtml, !1) && !((i = r.value) != null && i.externalValidation && !await r.value.externalValidation(e)) && !await d(e.compiledHtml, e.css, !1))
|
|
79
|
+
return f(e, { silent: !1, blankCompiled: !0 });
|
|
80
|
+
}, R = async () => {
|
|
81
|
+
if (!S.allowSaveWithErrors)
|
|
68
82
|
return;
|
|
69
|
-
|
|
70
|
-
const t = await
|
|
71
|
-
if (
|
|
72
|
-
return u(t, { silent: !1, blankCompiled: !0 });
|
|
73
|
-
}, M = async () => {
|
|
74
|
-
r();
|
|
75
|
-
const { html: t, css: e } = await H();
|
|
76
|
-
if (!n(t, !0) || await c(t, e, !0))
|
|
83
|
+
n();
|
|
84
|
+
const { html: t, css: e } = await u();
|
|
85
|
+
if (!c(t, !0) || !l(t, !0) || await d(t, e, !0))
|
|
77
86
|
return;
|
|
78
|
-
const
|
|
79
|
-
dynamicContentList:
|
|
87
|
+
const i = Z(t), o = {
|
|
88
|
+
dynamicContentList: U.getSelectedDynamicContentList,
|
|
80
89
|
compiledHtml: "",
|
|
81
90
|
rawHtml: t,
|
|
82
91
|
css: e,
|
|
83
92
|
ampHtml: "",
|
|
84
93
|
ampErrors: [],
|
|
85
94
|
modules: [],
|
|
86
|
-
|
|
95
|
+
// No campaignUrls: hosts overwrite their stored map with any object, and raw HTML can't rebuild it.
|
|
96
|
+
recommendation: { configs: {} },
|
|
87
97
|
unsubscribe: {
|
|
88
|
-
status:
|
|
89
|
-
config:
|
|
98
|
+
status: i.length > 0,
|
|
99
|
+
config: i
|
|
90
100
|
}
|
|
91
101
|
};
|
|
92
|
-
return
|
|
102
|
+
return f(o, { silent: !0 });
|
|
93
103
|
};
|
|
94
|
-
return { save: (t = !1, e = !1) =>
|
|
95
|
-
() =>
|
|
96
|
-
), saveWithErrors: () =>
|
|
104
|
+
return { save: (t = !1, e = !1) => m(
|
|
105
|
+
() => M(t, e)
|
|
106
|
+
), saveWithErrors: () => m(W), saveRawOnly: () => m(R) };
|
|
97
107
|
};
|
|
98
108
|
export {
|
|
99
|
-
|
|
109
|
+
Pt as useSave
|
|
100
110
|
};
|