@useinsider/guido 3.2.0-beta.ec6228c → 3.2.0-beta.ecc7c6c
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 -24
- package/dist/@types/config/schemas.js +36 -38
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +34 -35
- package/dist/components/organisms/header/RightSlot.vue.js +8 -8
- package/dist/components/organisms/header/RightSlot.vue2.js +8 -9
- package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
- package/dist/composables/useHtmlValidator.js +41 -36
- package/dist/composables/useRibbonOffset.js +21 -0
- package/dist/composables/useSave.js +21 -18
- package/dist/composables/useStripo.js +14 -16
- package/dist/composables/validators/useCouponBlockValidator.js +24 -0
- package/dist/config/compiler/recommendationCompilerRules.js +27 -27
- package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
- package/dist/config/migrator/radioButtonMigrator.js +64 -44
- package/dist/enums/onboarding.js +7 -2
- package/dist/enums/unsubscribe.js +34 -27
- package/dist/extensions/Blocks/RadioButton/template.js +1 -1
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +18 -9
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +33 -0
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +258 -235
- package/dist/package.json.js +1 -1
- package/dist/services/templateLibraryApi.js +5 -4
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useRibbonOffset.d.ts +4 -0
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/enums/onboarding.d.ts +6 -0
- package/dist/src/enums/unsubscribe.d.ts +5 -0
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +7 -1
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +21 -0
- package/dist/src/stores/config.d.ts +0 -18
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/stores/onboarding.js +4 -0
- package/dist/utils/pairProductVariables.js +89 -88
- package/package.json +3 -3
- package/dist/components/organisms/AutoSaveController.vue.js +0 -17
- package/dist/components/organisms/AutoSaveController.vue2.js +0 -13
- package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
- package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
- package/dist/composables/useAutoSave.js +0 -68
- package/dist/enums/displayConditions.js +0 -80
- package/dist/src/components/organisms/AutoSaveController.vue.d.ts +0 -2
- package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +0 -2
- package/dist/src/composables/useAutoSave.d.ts +0 -3
- package/dist/src/enums/displayConditions.d.ts +0 -2
- package/dist/src/stores/autosave.d.ts +0 -6
- package/dist/src/utils/timeUtil.d.ts +0 -8
- package/dist/stores/autosave.js +0 -11
- package/dist/utils/timeUtil.js +0 -19
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { defineComponent as t } from "vue";
|
|
2
|
-
import { useAutoSave as r } from "../../composables/useAutoSave.js";
|
|
3
|
-
import { useSave as s } from "../../composables/useSave.js";
|
|
4
|
-
const f = /* @__PURE__ */ t({
|
|
5
|
-
__name: "AutoSaveController",
|
|
6
|
-
setup(a) {
|
|
7
|
-
const { save: e } = s(), o = () => e(!1);
|
|
8
|
-
return r(o), { __sfc: !0, save: e, backgroundSave: o };
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
export {
|
|
12
|
-
f as default
|
|
13
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import o from "./AutoSaveToggle.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import i from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var n = function() {
|
|
5
|
-
var e = this, a = e._self._c, t = e._self._setupProxy;
|
|
6
|
-
return t.isFeatureEnabled("autosave") ? a("div", { staticClass: "d-f a-i-c mr-3 auto-save-toggle", on: { mouseenter: function(s) {
|
|
7
|
-
t.isHovered = !0;
|
|
8
|
-
}, mouseleave: function(s) {
|
|
9
|
-
t.isHovered = !1;
|
|
10
|
-
} } }, [a(t.InToggle, { attrs: { id: "guido__autosave-toggle", name: "guido-autosave-toggle", checked: t.autosaveStore.isOn, disable: t.editorStore.loadingStatus }, on: { click: t.toggle } }), a("span", { staticClass: "ml-2 auto-save-toggle__label t-c-55" }, [e._v(" " + e._s(t.trans("email-editor.auto-save")) + " ")]), t.autosaveStore.status === "saving" ? a("span", { staticClass: "ml-2 d-f a-i-c f-s-1" }, [a(t.InLoading, { attrs: { "color-class": "i-c-53", size: "16" } }), a("span", { staticClass: "ml-1 t-c-53" }, [e._v(" " + e._s(t.trans("newsletter.saving")) + " ")])], 1) : t.lastSavedLabel ? a("span", { staticClass: "ml-2 f-s-1 t-c-53" }, [e._v(" " + e._s(t.lastSavedLabel) + " ")]) : e._e(), t.isHovered ? a(t.InInfoBox, { staticClass: "auto-save-toggle__info-box", attrs: { id: "guido__autosave-info-box", size: "small", variant: "information", "description-text": t.trans("email-editor.auto-save-description"), "title-text": t.trans("email-editor.auto-save-title") } }) : e._e()], 1) : e._e();
|
|
11
|
-
}, l = [], r = /* @__PURE__ */ i(
|
|
12
|
-
o,
|
|
13
|
-
n,
|
|
14
|
-
l,
|
|
15
|
-
!1,
|
|
16
|
-
null,
|
|
17
|
-
"4cbf0abd"
|
|
18
|
-
);
|
|
19
|
-
const d = r.exports;
|
|
20
|
-
export {
|
|
21
|
-
d as default
|
|
22
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { defineComponent as m, ref as i, computed as f } from "vue";
|
|
2
|
-
import { useConfig as u } from "../../../composables/useConfig.js";
|
|
3
|
-
import { useTranslations as l } from "../../../composables/useTranslations.js";
|
|
4
|
-
import { useAutosaveStore as p } from "../../../stores/autosave.js";
|
|
5
|
-
import { useEditorStore as c } from "../../../stores/editor.js";
|
|
6
|
-
import { formatLocalTime as d } from "../../../utils/timeUtil.js";
|
|
7
|
-
import { InToggle as g, InLoading as v, InInfoBox as S } from "@useinsider/design-system-vue";
|
|
8
|
-
const B = /* @__PURE__ */ m({
|
|
9
|
-
__name: "AutoSaveToggle",
|
|
10
|
-
setup(_) {
|
|
11
|
-
const { isFeatureEnabled: t } = u(), e = c(), o = p(), r = l(), s = i(!1), n = f(() => o.status !== "saved" || !o.lastSavedAt ? "" : d(o.lastSavedAt));
|
|
12
|
-
return { __sfc: !0, isFeatureEnabled: t, editorStore: e, autosaveStore: o, trans: r, isHovered: s, lastSavedLabel: n, toggle: (a) => {
|
|
13
|
-
o.isOn = a;
|
|
14
|
-
}, InInfoBox: S, InLoading: v, InToggle: g };
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
export {
|
|
18
|
-
B as default
|
|
19
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { useConfig as m } from "./useConfig.js";
|
|
2
|
-
import { useAutosaveStore as p } from "../stores/autosave.js";
|
|
3
|
-
import { useEditorStore as S } from "../stores/editor.js";
|
|
4
|
-
import { computed as E, watch as f, onUnmounted as y } from "vue";
|
|
5
|
-
const A = 18e4, c = 6e4, O = (l) => {
|
|
6
|
-
const { isFeatureEnabled: b } = m(), s = S(), t = p();
|
|
7
|
-
let o = null, u = 0;
|
|
8
|
-
const n = E(
|
|
9
|
-
() => b("autosave") && t.isOn
|
|
10
|
-
), g = () => s.hasChanges && !s.isSaveButtonDisabled && !s.isCodeEditorOpen, h = () => ({
|
|
11
|
-
hasChanges: s.hasChanges,
|
|
12
|
-
isSaveButtonDisabled: s.isSaveButtonDisabled,
|
|
13
|
-
isCodeEditorOpen: s.isCodeEditorOpen
|
|
14
|
-
}), r = async (e) => {
|
|
15
|
-
if (!n.value) {
|
|
16
|
-
console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (!g()) {
|
|
20
|
-
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: h() });
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
if (t.status === "saving") {
|
|
24
|
-
console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
console.debug("guido:autosave:save-start", { trigger: e }), t.status = "saving";
|
|
28
|
-
try {
|
|
29
|
-
await l(), s.hasChanges = !1, t.status = "saved", t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
|
|
30
|
-
} catch (i) {
|
|
31
|
-
console.debug("guido:autosave:error", { trigger: e, error: i }), t.status = "error";
|
|
32
|
-
}
|
|
33
|
-
}, a = () => {
|
|
34
|
-
const { visibilityState: e } = document;
|
|
35
|
-
if (console.debug("guido:autosave:visibility-change", {
|
|
36
|
-
visibilityState: e,
|
|
37
|
-
isActive: n.value
|
|
38
|
-
}), e !== "hidden")
|
|
39
|
-
return;
|
|
40
|
-
const i = Date.now() - u;
|
|
41
|
-
if (i < c) {
|
|
42
|
-
console.debug("guido:autosave:visibility-debounced", {
|
|
43
|
-
sinceLastMs: i,
|
|
44
|
-
debounceMs: c
|
|
45
|
-
});
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
u = Date.now(), r("visibility");
|
|
49
|
-
}, d = () => {
|
|
50
|
-
o && (clearInterval(o), o = null);
|
|
51
|
-
}, v = () => {
|
|
52
|
-
document.removeEventListener("visibilitychange", a), window.removeEventListener("pagehide", a);
|
|
53
|
-
};
|
|
54
|
-
f(
|
|
55
|
-
n,
|
|
56
|
-
(e) => {
|
|
57
|
-
console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), o = setInterval(() => {
|
|
58
|
-
console.debug("guido:autosave:interval-tick"), r("interval");
|
|
59
|
-
}, A), document.addEventListener("visibilitychange", a), window.addEventListener("pagehide", a)) : (d(), v(), t.status = "idle");
|
|
60
|
-
},
|
|
61
|
-
{ immediate: !0 }
|
|
62
|
-
), y(() => {
|
|
63
|
-
d(), v();
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
export {
|
|
67
|
-
O as useAutoSave
|
|
68
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
const e = [
|
|
2
|
-
{
|
|
3
|
-
category: "Demographics",
|
|
4
|
-
conditions: [
|
|
5
|
-
{
|
|
6
|
-
id: 1,
|
|
7
|
-
name: "Language",
|
|
8
|
-
description: "Users who are in the English will see the banner",
|
|
9
|
-
beforeScript: '{% if language == "en_US" %}',
|
|
10
|
-
afterScript: "{% endif %}"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
id: 2,
|
|
14
|
-
name: "Country",
|
|
15
|
-
description: "Only people who live in Australia will see the banner",
|
|
16
|
-
beforeScript: '{% if country == "Australia" %}',
|
|
17
|
-
afterScript: "{% endif %}"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
id: 3,
|
|
21
|
-
name: "Country & City",
|
|
22
|
-
description: "Only people who are located in that country and city",
|
|
23
|
-
beforeScript: '{% if country == "United Kingdom" and city == "London" %}',
|
|
24
|
-
afterScript: "{% endif %}"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
id: 4,
|
|
28
|
-
name: "Age (Less than operator)",
|
|
29
|
-
description: "Users whose age is less than 18",
|
|
30
|
-
beforeScript: "{% if age < 18 %}",
|
|
31
|
-
afterScript: "{% endif %}"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: 5,
|
|
35
|
-
name: "Age (Equal and greater than operator)",
|
|
36
|
-
description: "Users whose age is equal or greater than 25",
|
|
37
|
-
beforeScript: "{% if age >= 25 %}",
|
|
38
|
-
afterScript: "{% endif %}"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: 6,
|
|
42
|
-
name: "Age (Greater than & less than operators)",
|
|
43
|
-
description: "Users whose age is between 18 and 25",
|
|
44
|
-
beforeScript: "{% if age > 18 and age < 25 %}",
|
|
45
|
-
afterScript: "{% endif %}"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: 7,
|
|
49
|
-
name: "Gender",
|
|
50
|
-
description: "Users whose gender is Female",
|
|
51
|
-
beforeScript: '{% if gender == "Female" %}',
|
|
52
|
-
afterScript: "{% endif %}"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: 8,
|
|
56
|
-
name: "State",
|
|
57
|
-
description: "Users whose state is one of the followings. c_state is a custom attribute. Use this condition if you have the attribute with the same naming. ",
|
|
58
|
-
beforeScript: '{% if c_state == "VIC" or c_state == "NSW" or c_state == "QLD" %}',
|
|
59
|
-
afterScript: "{% endif %}"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
id: 9,
|
|
63
|
-
name: "VIP User",
|
|
64
|
-
description: "Users who are VIP users for that brand. c_is_vip_user = true. c_is_vip_user is a custom attribute. Use this condition if you have the attribute with the same naming.",
|
|
65
|
-
beforeScript: "{% if c_is_vip_user %}",
|
|
66
|
-
afterScript: "{% endif %}"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: 10,
|
|
70
|
-
name: "Membership Type",
|
|
71
|
-
description: "Users who belong to gold or silver membership type. c_is_gold_member = true, c_is_silver_member = true. These are custom attributes. Use this condition if you have the attribute with the same naming.",
|
|
72
|
-
beforeScript: "{% if c_is_gold_member or c_is_silver_member %}",
|
|
73
|
-
afterScript: "{% endif %}"
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
];
|
|
78
|
-
export {
|
|
79
|
-
e as displayConditions
|
|
80
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
-
export default _default;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
-
export default _default;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats a Date as local time in 24-hour format.
|
|
3
|
-
* Pass `useTimezone = true` to append the UTC offset and city name — useful when the
|
|
4
|
-
* timestamp must clearly communicate the client's timezone.
|
|
5
|
-
* @example formatLocalTime(date) -> 12:20:02
|
|
6
|
-
* @example formatLocalTime(date, true) -> 12:20:02 (UTC+3 Istanbul)
|
|
7
|
-
*/
|
|
8
|
-
export declare const formatLocalTime: (date: Date, useTimezone?: boolean) => string;
|
package/dist/stores/autosave.js
DELETED
package/dist/utils/timeUtil.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const r = (t) => {
|
|
2
|
-
const e = -t.getTimezoneOffset(), o = e >= 0 ? "+" : "-", n = Math.abs(e), s = Math.floor(n / 60), i = n % 60;
|
|
3
|
-
return i === 0 ? `UTC${o}${s}` : `UTC${o}${s}:${String(i).padStart(2, "0")}`;
|
|
4
|
-
}, a = () => {
|
|
5
|
-
var e;
|
|
6
|
-
const { timeZone: t } = new Intl.DateTimeFormat().resolvedOptions();
|
|
7
|
-
return ((e = t.split("/").pop()) == null ? void 0 : e.replace(/_/g, " ")) ?? t;
|
|
8
|
-
}, c = (t, e = !1) => {
|
|
9
|
-
const o = t.toLocaleTimeString([], {
|
|
10
|
-
hour: "2-digit",
|
|
11
|
-
hour12: !1,
|
|
12
|
-
minute: "2-digit",
|
|
13
|
-
second: "2-digit"
|
|
14
|
-
});
|
|
15
|
-
return e ? `${o} (${r(t)} ${a()})` : o;
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
c as formatLocalTime
|
|
19
|
-
};
|