@useinsider/guido 3.18.0 → 3.18.1-beta.74a13e4
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 +85 -81
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +54 -41
- package/dist/composables/useActionsApi.js +82 -67
- package/dist/composables/useAutoSave.js +31 -26
- package/dist/composables/useEditorLock.js +20 -0
- package/dist/composables/useGuidoStateBridge.js +37 -31
- package/dist/composables/useSave.js +42 -39
- package/dist/config/migrator/itemsBlockMigrator.js +197 -137
- package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
- package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
- package/dist/extensions/Blocks/Items/template.js +224 -215
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useEditorLock.d.ts +10 -0
- package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
- package/dist/utils/pairProductVariables.js +71 -71
- package/package.json +2 -2
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { useConfig as
|
|
1
|
+
import { useConfig as E } from "./useConfig.js";
|
|
2
|
+
import { useEditorLock as p } from "./useEditorLock.js";
|
|
2
3
|
import { useAutosaveStore as A, AUTOSAVE_STATUS as s } from "../stores/autosave.js";
|
|
3
|
-
import { useEditorStore as
|
|
4
|
-
import { computed as
|
|
5
|
-
const
|
|
6
|
-
const { isFeatureEnabled: S } =
|
|
4
|
+
import { useEditorStore as f } 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 = f(), t = A(), { isEditorBusy: g } = p();
|
|
7
8
|
let i = null, c = 0;
|
|
8
|
-
const u =
|
|
9
|
+
const u = y(
|
|
9
10
|
() => S("autosave") && t.isOn
|
|
10
|
-
),
|
|
11
|
-
hasChanges:
|
|
12
|
-
isInSaveableState:
|
|
13
|
-
}),
|
|
11
|
+
), m = () => o.hasChanges && o.isInSaveableState, h = () => ({
|
|
12
|
+
hasChanges: o.hasChanges,
|
|
13
|
+
isInSaveableState: o.isInSaveableState
|
|
14
|
+
}), r = async (e) => {
|
|
14
15
|
if (!u.value) {
|
|
15
16
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
|
-
if (!
|
|
19
|
+
if (!m()) {
|
|
19
20
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: h() });
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
@@ -23,15 +24,19 @@ const I = 18e4, r = 6e4, T = (b) => {
|
|
|
23
24
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
27
|
+
if (g()) {
|
|
28
|
+
console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
26
31
|
console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
|
|
27
32
|
try {
|
|
28
33
|
if (await b() === void 0) {
|
|
29
34
|
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = s.ERROR;
|
|
30
35
|
return;
|
|
31
36
|
}
|
|
32
|
-
|
|
33
|
-
} catch (
|
|
34
|
-
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;
|
|
35
40
|
}
|
|
36
41
|
}, n = () => {
|
|
37
42
|
const { visibilityState: e } = document;
|
|
@@ -40,32 +45,32 @@ const I = 18e4, r = 6e4, T = (b) => {
|
|
|
40
45
|
isActive: u.value
|
|
41
46
|
}), e !== "hidden")
|
|
42
47
|
return;
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
48
|
+
const a = Date.now() - c;
|
|
49
|
+
if (a < v) {
|
|
45
50
|
console.debug("guido:autosave:visibility-debounced", {
|
|
46
|
-
sinceLastMs:
|
|
47
|
-
debounceMs:
|
|
51
|
+
sinceLastMs: a,
|
|
52
|
+
debounceMs: v
|
|
48
53
|
});
|
|
49
54
|
return;
|
|
50
55
|
}
|
|
51
|
-
c = Date.now(),
|
|
56
|
+
c = Date.now(), r("visibility");
|
|
52
57
|
}, d = () => {
|
|
53
58
|
i && (clearInterval(i), i = null);
|
|
54
|
-
},
|
|
59
|
+
}, l = () => {
|
|
55
60
|
document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
|
|
56
61
|
};
|
|
57
|
-
|
|
62
|
+
I(
|
|
58
63
|
u,
|
|
59
64
|
(e) => {
|
|
60
65
|
console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), i = setInterval(() => {
|
|
61
|
-
console.debug("guido:autosave:interval-tick"),
|
|
62
|
-
},
|
|
66
|
+
console.debug("guido:autosave:interval-tick"), r("interval");
|
|
67
|
+
}, w), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), l(), t.status = s.IDLE);
|
|
63
68
|
},
|
|
64
69
|
{ immediate: !0 }
|
|
65
|
-
),
|
|
66
|
-
d(),
|
|
70
|
+
), L(() => {
|
|
71
|
+
d(), l(), t.status = s.IDLE, t.lastSavedAt = null;
|
|
67
72
|
});
|
|
68
73
|
};
|
|
69
74
|
export {
|
|
70
|
-
|
|
75
|
+
R as useAutoSave
|
|
71
76
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
let o = Promise.resolve(), n = 0, e = 0;
|
|
2
|
+
const s = () => n > 0, c = () => (e += 1, e), u = (t) => t > 0 && t === e, i = (t) => {
|
|
3
|
+
const r = o.then(async () => {
|
|
4
|
+
n += 1;
|
|
5
|
+
try {
|
|
6
|
+
return await t();
|
|
7
|
+
} finally {
|
|
8
|
+
n -= 1;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
return o = r.catch(() => {
|
|
12
|
+
}), r;
|
|
13
|
+
}, a = () => ({ runExclusive: i, isEditorBusy: s, beginMount: c, isCurrentMount: u });
|
|
14
|
+
export {
|
|
15
|
+
c as beginMount,
|
|
16
|
+
u as isCurrentMount,
|
|
17
|
+
s as isEditorBusy,
|
|
18
|
+
i as runExclusive,
|
|
19
|
+
a as useEditorLock
|
|
20
|
+
};
|
|
@@ -1,48 +1,54 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { useActionsApi as b } from "./useActionsApi.js";
|
|
2
|
+
import { useEditorLock as v } from "./useEditorLock.js";
|
|
3
|
+
import { useConfigStore as T } from "../stores/config.js";
|
|
4
|
+
import { useEditorStore as w } from "../stores/editor.js";
|
|
5
|
+
import { useGuidoEmailEditorStore as y } from "../stores/guido-email-editor.js";
|
|
6
|
+
import { watch as a, onUnmounted as B } from "vue";
|
|
7
|
+
const C = 500, L = () => {
|
|
8
|
+
const i = w(), u = y(), l = T(), { getTemplateData: d } = b(), { runExclusive: m, isEditorBusy: p } = v();
|
|
9
|
+
let o = null, s = !1;
|
|
10
|
+
const n = () => {
|
|
11
|
+
o && (clearTimeout(o), o = null);
|
|
12
|
+
}, c = (t) => {
|
|
13
|
+
n(), o = setTimeout(() => {
|
|
14
|
+
o = null, t();
|
|
15
|
+
}, C);
|
|
16
|
+
}, e = async () => {
|
|
17
|
+
var t, r;
|
|
18
|
+
if (!(s || !i.isStripoInitialized)) {
|
|
19
|
+
if (p()) {
|
|
20
|
+
c(() => void e());
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
14
23
|
try {
|
|
15
|
-
const { html:
|
|
16
|
-
if (
|
|
24
|
+
const { html: E, css: g } = await m(d), I = ((r = (t = l.config) == null ? void 0 : t.identity) == null ? void 0 : r.templateId) ?? "";
|
|
25
|
+
if (s)
|
|
17
26
|
return;
|
|
18
|
-
|
|
19
|
-
html:
|
|
20
|
-
css:
|
|
21
|
-
templateId:
|
|
27
|
+
u.$patch({
|
|
28
|
+
html: E ?? "",
|
|
29
|
+
css: g ?? "",
|
|
30
|
+
templateId: I,
|
|
22
31
|
lastUpdatedAt: Date.now()
|
|
23
32
|
});
|
|
24
33
|
} catch {
|
|
25
34
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
e = null, s();
|
|
29
|
-
}, w);
|
|
30
|
-
}, d = c(
|
|
35
|
+
}
|
|
36
|
+
}, f = () => c(() => void e()), h = a(
|
|
31
37
|
() => i.isStripoInitialized,
|
|
32
38
|
(t) => {
|
|
33
|
-
t &&
|
|
39
|
+
t && e();
|
|
34
40
|
},
|
|
35
41
|
{ immediate: !0 }
|
|
36
|
-
),
|
|
42
|
+
), S = a(
|
|
37
43
|
() => i.hasChanges,
|
|
38
|
-
(t,
|
|
39
|
-
i.isStripoInitialized && (t ?
|
|
44
|
+
(t, r) => {
|
|
45
|
+
i.isStripoInitialized && (t ? f() : r && (n(), e()));
|
|
40
46
|
}
|
|
41
47
|
);
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
B(() => {
|
|
49
|
+
s = !0, n(), h(), S();
|
|
44
50
|
});
|
|
45
51
|
};
|
|
46
52
|
export {
|
|
47
|
-
|
|
53
|
+
L as useGuidoStateBridge
|
|
48
54
|
};
|
|
@@ -1,52 +1,55 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
const { prepareTemplateDetails:
|
|
21
|
-
if (!
|
|
1
|
+
import { useActionsApi as T } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as q } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as C } from "./useEditorLock.js";
|
|
4
|
+
import { useSaveStart as L, useSaveComplete as M } from "./useGuidoActions.js";
|
|
5
|
+
import { useSyncModuleExtractor as D } from "./useSyncModuleExtractor.js";
|
|
6
|
+
import { ToasterTypeOptions as P } from "../enums/toaster.js";
|
|
7
|
+
import { useStripoApi as U } from "../services/stripoApi.js";
|
|
8
|
+
import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
|
|
9
|
+
import { useAllowlist as h } from "./useAllowlist.js";
|
|
10
|
+
import { useHtmlValidator as F } from "./useHtmlValidator.js";
|
|
11
|
+
import { useToaster as O } from "./useToaster.js";
|
|
12
|
+
import { useCouponBlockValidator as W } from "./validators/useCouponBlockValidator.js";
|
|
13
|
+
import { useLiquidValidator as j } from "./validators/useLiquidValidator.js";
|
|
14
|
+
import { useSyncModuleBlockValidator as z } from "./validators/useSyncModuleBlockValidator.js";
|
|
15
|
+
import { useUnsubscribeBlockValidator as G } from "./validators/useUnsubscribeBlockValidator.js";
|
|
16
|
+
const rt = () => {
|
|
17
|
+
const n = L(), c = M(), { validateHtml: d } = F(), { validateLiquidSyntax: m } = j(), { validateCouponBlockTags: u } = W(), { validateUnsubscribeBlockUniqueness: p, validateUnsubscribeBlockHasTemplate: f } = G(), { validateSyncModuleBlocks: v } = z(), { callbacks: s, isFeatureEnabled: r } = q(), { extractSyncModuleData: S } = D(), { setSyncModuleUnsubscriptionPages: b } = U(), { editorSave: w } = T(), { showToaster: V } = O(), { getBlockedDomains: y, resolveToast: k } = h(), { runExclusive: x } = C(), H = async (a, o) => {
|
|
18
|
+
var l;
|
|
19
|
+
n();
|
|
20
|
+
const { prepareTemplateDetails: B } = A(), t = await B();
|
|
21
|
+
if (!v(t.rawHtml, o) || !u(t.compiledHtml) || !p(t.compiledHtml) || !f(t.compiledHtml))
|
|
22
22
|
return;
|
|
23
|
-
if (
|
|
24
|
-
if (!await
|
|
23
|
+
if (r("liquidSyntax")) {
|
|
24
|
+
if (!await m(t.compiledHtml))
|
|
25
25
|
return;
|
|
26
|
-
} else if (!await
|
|
26
|
+
} else if (!await d(t.compiledHtml, t.dynamicContentList, !0))
|
|
27
27
|
return;
|
|
28
|
-
if ((
|
|
28
|
+
if ((l = s.value) != null && l.externalValidation && !await s.value.externalValidation(t))
|
|
29
29
|
return;
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
if (!
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
type:
|
|
37
|
-
message:
|
|
38
|
-
actionButton:
|
|
30
|
+
if (r("allowlistEnabled")) {
|
|
31
|
+
const i = await y(t.compiledHtml, t.css);
|
|
32
|
+
if (i.length) {
|
|
33
|
+
if (!o) {
|
|
34
|
+
const e = await k(i);
|
|
35
|
+
e != null && e.message && V({
|
|
36
|
+
type: P.Warning,
|
|
37
|
+
message: e.message,
|
|
38
|
+
actionButton: e.actionButton
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
if (!await
|
|
44
|
+
if (!await w())
|
|
45
45
|
return;
|
|
46
|
-
const { unsubscribePayload:
|
|
47
|
-
return await
|
|
48
|
-
}
|
|
46
|
+
const { unsubscribePayload: E, stripoModules: g } = S(t.rawHtml);
|
|
47
|
+
return await b(E), t.modules = g, a || c({ ...t, silent: o }), t;
|
|
48
|
+
};
|
|
49
|
+
return { save: (a = !1, o = !1) => x(
|
|
50
|
+
() => H(a, o)
|
|
51
|
+
) };
|
|
49
52
|
};
|
|
50
53
|
export {
|
|
51
|
-
|
|
54
|
+
rt as useSave
|
|
52
55
|
};
|