@useinsider/guido 3.7.0-beta.830822b → 3.7.0-beta.a1aaf44
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/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +37 -34
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +54 -51
- package/dist/enums/extensions/recommendationBlock.js +1 -3
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +5 -5
- package/dist/extensions/Blocks/Unsubscribe/block.js +74 -60
- package/dist/extensions/Blocks/Unsubscribe/control.js +33 -24
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +19 -31
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -1
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +6 -0
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/src/stores/unsubscribe.d.ts +11 -1
- package/dist/stores/unsubscribe.js +8 -7
- package/package.json +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useToaster as
|
|
1
|
+
import { defineComponent as y, ref as S, computed as a, watch as T } from "vue";
|
|
2
|
+
import v from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import { useToaster as w } from "../../../composables/useToaster.js";
|
|
4
4
|
import { useTranslations as B } from "../../../composables/useTranslations.js";
|
|
5
5
|
import { ToasterTypeOptions as C } from "../../../enums/toaster.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import U from "
|
|
9
|
-
|
|
6
|
+
import { useEditorStore as P } from "../../../stores/editor.js";
|
|
7
|
+
import { useUnsubscribeStore as h } from "../../../stores/unsubscribe.js";
|
|
8
|
+
import { InContainer as U } from "@useinsider/design-system-vue";
|
|
9
|
+
import _ from "./UnsubscribeBreadcrumb.vue.js";
|
|
10
|
+
const G = /* @__PURE__ */ y({
|
|
10
11
|
__name: "UnsubscribePageSelection",
|
|
11
|
-
setup(
|
|
12
|
-
const s = B(), e =
|
|
12
|
+
setup(x) {
|
|
13
|
+
const s = B(), e = h(), r = P(), { showToaster: i } = w(), o = S(!1), c = a(() => e.isActiveTypeLastInCollection ? o.value ? s("unsubscription-preference.applying-changes") : s("statistics.apply") : s("products.select-and-continue")), l = a(() => e.pageSelectionUpdateStatus && e.isActiveTypeFirstInCollection ? s("products.cancel") : s("newsletter.back")), p = a(() => ({
|
|
13
14
|
primaryButton: {
|
|
14
15
|
styling: "solid",
|
|
15
16
|
type: "primary",
|
|
@@ -20,45 +21,47 @@ const F = /* @__PURE__ */ g({
|
|
|
20
21
|
cancelOrBackButton: {
|
|
21
22
|
styling: "ghost",
|
|
22
23
|
type: "secondary",
|
|
23
|
-
labelText:
|
|
24
|
+
labelText: l.value,
|
|
24
25
|
disabledStatus: o.value
|
|
25
26
|
}
|
|
26
|
-
})),
|
|
27
|
+
})), d = (t) => e.getSelectedTemplateByActiveType === t ? "bor-w-3 bor-s-s bor-c-7" : "bor-w-1 bor-s-s bor-c-6", n = (t) => {
|
|
27
28
|
e.pageSelectionDrawerStatus = !1, t && setTimeout(() => {
|
|
28
29
|
t();
|
|
29
30
|
}, 500);
|
|
30
|
-
},
|
|
31
|
+
}, m = () => {
|
|
31
32
|
if (e.isActiveTypeFirstInCollection) {
|
|
32
|
-
|
|
33
|
+
n(), e.pageSelectionUpdateStatus || (e.typeSelectionDrawerStatus = !0);
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
36
|
e.setPreviousType();
|
|
36
|
-
},
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
}, b = () => {
|
|
38
|
+
if (!r.isPreviewModeOpen) {
|
|
39
|
+
if (e.isActiveTypeLastInCollection) {
|
|
40
|
+
o.value = !0;
|
|
41
|
+
const t = e.selectedCollectionType, u = e.getSelectedTemplatesByCollection(t), g = e.getSelectedUnsubscribePagesByCollection(t);
|
|
42
|
+
e.removeUnsubscribePages(g), e.addUnsubscribePages(u), document.dispatchEvent(new CustomEvent("unsubscribe:select", {
|
|
43
|
+
detail: {
|
|
44
|
+
collectionType: t,
|
|
45
|
+
selectedPages: u
|
|
46
|
+
}
|
|
47
|
+
})), n(() => {
|
|
48
|
+
o.value = !1, i({
|
|
49
|
+
type: C.Success,
|
|
50
|
+
message: s("global-unsubscribe.pages-were-attached")
|
|
51
|
+
});
|
|
49
52
|
});
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
e.setNextType();
|
|
52
56
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
e.setSelectedTemplate(t);
|
|
57
|
+
}, f = (t) => {
|
|
58
|
+
r.isPreviewModeOpen || e.setSelectedTemplate(t);
|
|
56
59
|
};
|
|
57
|
-
return
|
|
60
|
+
return T(() => e.pageSelectionDrawerStatus, (t) => {
|
|
58
61
|
t && e.pageSelectionUpdateStatus && e.fetchTemplates();
|
|
59
|
-
}), { __sfc: !0, trans: s, unsubscribeStore: e, showToaster:
|
|
62
|
+
}), { __sfc: !0, trans: s, unsubscribeStore: e, editorStore: r, showToaster: i, isApplying: o, getPrimaryButtonText: c, getCancelOrBackButtonText: l, footerButtonGroupOptions: p, getBorderClass: d, closeModal: n, handleBack: m, handleSave: b, selectTemplate: f, WpDrawer: v, InContainer: U, UnsubscribeBreadcrumb: _ };
|
|
60
63
|
}
|
|
61
64
|
});
|
|
62
65
|
export {
|
|
63
|
-
|
|
66
|
+
G as default
|
|
64
67
|
};
|
|
@@ -1,106 +1,109 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as _, ref as b, computed as m, watch as h } from "vue";
|
|
2
2
|
import v from "../../wrappers/WpDrawer.vue.js";
|
|
3
3
|
import { useToaster as U } from "../../../composables/useToaster.js";
|
|
4
|
-
import { useTranslations as
|
|
5
|
-
import { ACADEMY_LINKS as
|
|
6
|
-
import { ToasterTypeOptions as
|
|
7
|
-
import { PAGE_TYPES as l, getTypeTranslations as
|
|
8
|
-
import { useUnsubscribeStore as
|
|
9
|
-
import { InSegments as
|
|
10
|
-
const V = /* @__PURE__ */
|
|
4
|
+
import { useTranslations as w } from "../../../composables/useTranslations.js";
|
|
5
|
+
import { ACADEMY_LINKS as N } from "../../../enums/academy.js";
|
|
6
|
+
import { ToasterTypeOptions as I } from "../../../enums/toaster.js";
|
|
7
|
+
import { PAGE_TYPES as l, getTypeTranslations as R, UNSUBSCRIBE_PAGES_LINK as D } from "../../../enums/unsubscribe.js";
|
|
8
|
+
import { useUnsubscribeStore as L } from "../../../stores/unsubscribe.js";
|
|
9
|
+
import { InSegments as P } from "@useinsider/design-system-vue";
|
|
10
|
+
const V = /* @__PURE__ */ _({
|
|
11
11
|
__name: "UnsubscribeTypeSelection",
|
|
12
|
-
setup(
|
|
13
|
-
const
|
|
12
|
+
setup(G) {
|
|
13
|
+
const t = w(), { showToaster: f } = U(), e = L(), n = b(!1), o = b(!0), r = b(l.GLOBAL_UNSUBSCRIBE), S = t(
|
|
14
14
|
"unsubscription-preference.select-unsubscribe-page-description",
|
|
15
|
-
{ action: `<a href="${
|
|
16
|
-
), T =
|
|
15
|
+
{ action: `<a href="${N.GLOBAL_UNSUBSCRIBE}" target="_blank">${t("ds-rules.visit-academy")}</a>` }
|
|
16
|
+
), T = m(() => [
|
|
17
17
|
{
|
|
18
|
-
description:
|
|
18
|
+
description: t("unsubscription-preference.type-global-unsubscribe-description"),
|
|
19
19
|
icon: "line-contact-global-unsub-page",
|
|
20
|
-
text:
|
|
20
|
+
text: t("unsubscription-preference.type-global-unsubscribe"),
|
|
21
21
|
value: l.GLOBAL_UNSUBSCRIBE,
|
|
22
|
-
disable:
|
|
22
|
+
disable: e.isGlobalUnsubscribeDisabled,
|
|
23
23
|
position: "bottom",
|
|
24
|
-
tooltipText:
|
|
24
|
+
tooltipText: e.isGlobalUnsubscribeDisabled ? t("unsubscription-preference.global-unsub-added") : ""
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
description:
|
|
27
|
+
description: t("unsubscription-preference.type-subscription-preferences-center-description"),
|
|
28
28
|
icon: "line-contact-sub-pref-center-page",
|
|
29
|
-
text:
|
|
29
|
+
text: t("unsubscription-preference.type-subscription-preferences-center"),
|
|
30
30
|
value: l.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
31
|
-
disable:
|
|
32
|
-
tooltipText:
|
|
31
|
+
disable: e.isSubscriptionPreferencesCenterDisabled,
|
|
32
|
+
tooltipText: e.isSubscriptionPreferencesCenterDisabled ? t("unsubscription-preference.pref-center-added") : ""
|
|
33
33
|
}
|
|
34
|
-
]), y =
|
|
34
|
+
]), y = m(() => ({
|
|
35
35
|
primaryButton: {
|
|
36
36
|
styling: "solid",
|
|
37
37
|
type: "primary",
|
|
38
|
-
labelText:
|
|
38
|
+
labelText: t(
|
|
39
39
|
n.value ? "unsubscription-preference.selecting-type" : "products.select-and-continue"
|
|
40
40
|
),
|
|
41
41
|
loadingStatus: n.value,
|
|
42
42
|
disabledStatus: !1,
|
|
43
|
-
skeletonStatus:
|
|
43
|
+
skeletonStatus: o.value,
|
|
44
44
|
skeletonSizing: { width: 168, height: 40 }
|
|
45
45
|
},
|
|
46
46
|
cancelOrBackButton: {
|
|
47
47
|
styling: "ghost",
|
|
48
48
|
type: "secondary",
|
|
49
|
-
labelText:
|
|
49
|
+
labelText: t("products.cancel"),
|
|
50
50
|
disabledStatus: n.value,
|
|
51
|
-
skeletonStatus:
|
|
51
|
+
skeletonStatus: o.value,
|
|
52
52
|
skeletonSizing: { width: 78, height: 40 }
|
|
53
53
|
}
|
|
54
54
|
})), d = (s) => {
|
|
55
|
-
|
|
55
|
+
e.typeSelectionDrawerStatus = !1, document.dispatchEvent(new CustomEvent("unsubscribe:cancel", {
|
|
56
|
+
detail: { blockId: e.pendingBlockId }
|
|
57
|
+
})), s && setTimeout(() => {
|
|
56
58
|
s();
|
|
57
59
|
}, 500);
|
|
58
60
|
}, E = (s) => {
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
const s =
|
|
62
|
-
if (Object.entries(s).forEach(([
|
|
63
|
-
p ||
|
|
64
|
-
}),
|
|
61
|
+
r.value = s;
|
|
62
|
+
}, g = () => {
|
|
63
|
+
const s = e.hasTemplatesByCollectionType, a = [];
|
|
64
|
+
if (Object.entries(s).forEach(([i, p]) => {
|
|
65
|
+
p || a.push(Number(i));
|
|
66
|
+
}), a.length === 0)
|
|
65
67
|
return !0;
|
|
66
|
-
const
|
|
68
|
+
const C = R(), c = a.map((i) => C[i]);
|
|
67
69
|
let u = "";
|
|
68
|
-
if (
|
|
69
|
-
u =
|
|
70
|
-
page:
|
|
70
|
+
if (a.length === 1)
|
|
71
|
+
u = t("unsubscription-preference.create-page-to-continue", {
|
|
72
|
+
page: c[0]
|
|
71
73
|
});
|
|
72
|
-
else if (
|
|
73
|
-
u =
|
|
74
|
-
page1:
|
|
75
|
-
page2:
|
|
74
|
+
else if (a.length === 2)
|
|
75
|
+
u = t("unsubscription-preference.create-pages-to-continue", {
|
|
76
|
+
page1: c[0],
|
|
77
|
+
page2: c[1]
|
|
76
78
|
});
|
|
77
79
|
else {
|
|
78
|
-
const
|
|
79
|
-
u =
|
|
80
|
+
const i = c.pop() ?? "", p = c.join(", ");
|
|
81
|
+
u = t("unsubscription-preference.create-multiple-pages-to-continue", {
|
|
80
82
|
pages: p,
|
|
81
|
-
lastPage:
|
|
83
|
+
lastPage: i
|
|
82
84
|
});
|
|
83
85
|
}
|
|
84
86
|
return f({
|
|
85
|
-
type:
|
|
87
|
+
type: I.Warning,
|
|
86
88
|
message: u,
|
|
87
89
|
actionButton: {
|
|
88
90
|
text: "Go to Unsubscribe Pages",
|
|
89
91
|
onClick: () => {
|
|
90
|
-
window.location.href
|
|
92
|
+
const i = new URL(D, window.location.origin).href;
|
|
93
|
+
window.open(i, "_blank", "noopener");
|
|
91
94
|
}
|
|
92
95
|
}
|
|
93
96
|
}), !1;
|
|
94
|
-
},
|
|
95
|
-
if (n.value = !0, await
|
|
97
|
+
}, B = async () => {
|
|
98
|
+
if (n.value = !0, await e.fetchTemplates(!0), e.setCollection(r.value), !g()) {
|
|
96
99
|
n.value = !1, d();
|
|
97
100
|
return;
|
|
98
101
|
}
|
|
99
|
-
n.value = !1,
|
|
102
|
+
n.value = !1, e.typeSelectionDrawerStatus = !1, e.pageSelectionDrawerStatus = !0;
|
|
100
103
|
};
|
|
101
|
-
return
|
|
102
|
-
s && (
|
|
103
|
-
}), { __sfc: !0, trans:
|
|
104
|
+
return h(() => e.typeSelectionDrawerStatus, (s) => {
|
|
105
|
+
s && (o.value = !0, r.value = l.GLOBAL_UNSUBSCRIBE, e.isGlobalUnsubscribeDisabled && (r.value = e.isSubscriptionPreferencesCenterDisabled ? 0 : l.SUBSCRIPTION_PREFERENCE_CENTER), o.value = !1);
|
|
106
|
+
}), { __sfc: !0, trans: t, showToaster: f, unsubscribeStore: e, isSelecting: n, skeletonStatus: o, selectedCollection: r, descriptionText: S, segmentList: T, footerButtonGroupOptions: y, closeModal: d, changeCollection: E, validateTemplates: g, selectCollection: B, WpDrawer: v, InSegments: P };
|
|
104
107
|
}
|
|
105
108
|
});
|
|
106
109
|
export {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useTranslations as r } from "../../composables/useTranslations.js";
|
|
2
2
|
const l = {
|
|
3
|
-
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
|
|
4
|
-
// Relative path → same-origin as the embedding inone dashboard (Dataforce).
|
|
5
|
-
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes"
|
|
3
|
+
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
|
|
6
4
|
}, c = {
|
|
7
5
|
CLIENT_ID: "clientId"
|
|
8
6
|
}, d = () => {
|
|
@@ -6,8 +6,8 @@ import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
|
6
6
|
import { EXCLUDED_ALGORITHM_IDS as D } from "../constants/defaultConfig.js";
|
|
7
7
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
8
8
|
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
9
|
-
import { getPartnerRecommendationParams as
|
|
10
|
-
import { isFilterValid as
|
|
9
|
+
import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
|
|
10
|
+
import { isFilterValid as w } from "../validation/filterSchema.js";
|
|
11
11
|
import { isConfigValid as N } from "../validation/requiredFields.js";
|
|
12
12
|
const h = y();
|
|
13
13
|
let m = null, u = null, d = null;
|
|
@@ -132,7 +132,7 @@ const x = () => ({
|
|
|
132
132
|
value: e.text
|
|
133
133
|
})),
|
|
134
134
|
getFilterList() {
|
|
135
|
-
return Object.values(this.filterList).
|
|
135
|
+
return Object.values(this.filterList).map((t) => {
|
|
136
136
|
let e;
|
|
137
137
|
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : C.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
|
|
138
138
|
text: t.displayName,
|
|
@@ -379,7 +379,7 @@ const x = () => ({
|
|
|
379
379
|
const n = [...e.recommendationConfigs.filters];
|
|
380
380
|
n[r] = {
|
|
381
381
|
...t,
|
|
382
|
-
isValid:
|
|
382
|
+
isValid: w(t)
|
|
383
383
|
}, e.recommendationConfigs.filters = n;
|
|
384
384
|
}
|
|
385
385
|
},
|
|
@@ -456,7 +456,7 @@ const x = () => ({
|
|
|
456
456
|
};
|
|
457
457
|
r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
|
|
458
458
|
a,
|
|
459
|
-
|
|
459
|
+
v(o.partnerName, r.strategy)
|
|
460
460
|
);
|
|
461
461
|
let f;
|
|
462
462
|
try {
|
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
var
|
|
2
|
-
var k = (c, n, e) => n in c ?
|
|
3
|
-
var
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var k = (c, n, e) => n in c ? m(c, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[n] = e;
|
|
3
|
+
var a = (c, n, e) => k(c, typeof n != "symbol" ? n + "" : n, e);
|
|
4
4
|
import { useToaster as B } from "../../../composables/useToaster.js";
|
|
5
5
|
import { ToasterTypeOptions as S } from "../../../enums/toaster.js";
|
|
6
6
|
import { PAGE_TYPES as E } from "../../../enums/unsubscribe.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { useEditorStore as f } from "../../../stores/editor.js";
|
|
8
|
+
import { useUnsubscribeStore as l } from "../../../stores/unsubscribe.js";
|
|
9
|
+
import { Block as L, BlockCompositionType as A, ContextActionType as h, ModificationDescription as b, BlockType as v } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
10
|
+
import { getDefaultTemplate as I } from "./template.js";
|
|
10
11
|
import { DATA_ATTRIBUTES as i, UNSUBSCRIBE_EVENTS as d } from "./utils/constants.js";
|
|
11
12
|
import { parsePageList as p } from "./utils/utils.js";
|
|
12
|
-
const
|
|
13
|
+
const T = "unsubscribe-block", g = 'a[data-unsubscribe-link="true"]', _ = ".unsubscribe-block-v2", y = "{{ins-unsubscribe-link}}", C = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", N = "Removing the unsubscribe text leaves an empty block, but an active unsubscribe link is required. Undo your last action to restore the text, or delete the unsubscribe block entirely.", U = {
|
|
13
14
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
14
15
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
15
16
|
};
|
|
16
|
-
class
|
|
17
|
+
class K extends L {
|
|
17
18
|
constructor() {
|
|
18
19
|
super();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
a(this, "selectEventListener", null);
|
|
21
|
+
a(this, "cancelEventListener", null);
|
|
22
|
+
a(this, "currentNode");
|
|
22
23
|
// Per-block "did this instance have a link last time we saw it?" tracking.
|
|
23
24
|
// Keyed by the stable `data-unsubscribe-block-id` we assign, because
|
|
24
25
|
// ImmutableHtmlNode instances are recreated on every document mutation and
|
|
25
26
|
// can't be used as Map keys directly. A singleton boolean here would be
|
|
26
27
|
// polluted across blocks since Stripo fires onDocumentChanged per-instance.
|
|
27
|
-
|
|
28
|
+
a(this, "linkStateByBlockId", /* @__PURE__ */ new Map());
|
|
28
29
|
}
|
|
29
30
|
getId() {
|
|
30
|
-
return
|
|
31
|
+
return T;
|
|
31
32
|
}
|
|
32
33
|
getIcon() {
|
|
33
34
|
return "unsubscribe-icon";
|
|
34
35
|
}
|
|
35
36
|
getBlockCompositionType() {
|
|
36
|
-
return
|
|
37
|
+
return A.BLOCK;
|
|
37
38
|
}
|
|
38
39
|
getName() {
|
|
39
40
|
return this.api.translate("Unsubscribe Block");
|
|
@@ -42,37 +43,49 @@ class F extends L {
|
|
|
42
43
|
return this.api.translate("Unsubscribe Block Description");
|
|
43
44
|
}
|
|
44
45
|
getTemplate() {
|
|
45
|
-
return
|
|
46
|
+
return I();
|
|
46
47
|
}
|
|
47
48
|
getContextActionsIds() {
|
|
48
49
|
return [h.MOVE, h.REMOVE];
|
|
49
50
|
}
|
|
50
51
|
onSelect(e) {
|
|
51
|
-
this.currentNode = e
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
if (this.currentNode = e, f().isPreviewModeOpen)
|
|
53
|
+
return;
|
|
54
|
+
const r = this._readBlockId(e) !== null, t = this._getOrAssignBlockId(e);
|
|
55
|
+
t && this.linkStateByBlockId.set(t, this._hasUnsubscribeLink(e)), !("getAttribute" in e && e.getAttribute("data-migration")) && (r && !this._hasPageSelection(e) || (this._resetStoreState(), t && (l().pendingBlockId = t), this._loadBlockState(e), this._setupSelectEventListener(), this._setupCancelEventListener(t), this._checkExistingBlocks(), this._openDrawer()));
|
|
54
56
|
}
|
|
55
57
|
onDocumentChanged(e) {
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
58
|
+
const r = this._getOrAssignBlockId(e);
|
|
59
|
+
if (!r)
|
|
58
60
|
return;
|
|
59
|
-
const
|
|
60
|
-
this.linkStateByBlockId.get(
|
|
61
|
+
const t = this._hasUnsubscribeLink(e);
|
|
62
|
+
this.linkStateByBlockId.get(r) === !0 && !t && this._warnLinkRemoved(), this.linkStateByBlockId.set(r, t);
|
|
61
63
|
}
|
|
62
64
|
onDelete(e) {
|
|
63
65
|
this._removeEventListeners(), this._removeBlockTemplatesFromStore(e), this._resetStoreState();
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
+
const r = this._readBlockId(e);
|
|
67
|
+
r && this.linkStateByBlockId.delete(r);
|
|
66
68
|
}
|
|
67
69
|
onDestroy() {
|
|
68
70
|
this._removeEventListeners(), this.currentNode = void 0, this.linkStateByBlockId.clear();
|
|
69
71
|
}
|
|
70
72
|
_hasUnsubscribeLink(e) {
|
|
71
|
-
return "querySelector" in e ? !!e.querySelector(
|
|
73
|
+
return "querySelector" in e ? !!e.querySelector(g) : !1;
|
|
72
74
|
}
|
|
73
75
|
_readBlockId(e) {
|
|
74
76
|
return "getAttribute" in e ? e.getAttribute(i.BLOCK_ID) : null;
|
|
75
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* True when the block has a page type and a page list — i.e. a template was
|
|
80
|
+
* applied. A block with neither, combined with an already-present block id,
|
|
81
|
+
* is an undo-restored orphan of a cancelled block.
|
|
82
|
+
*/
|
|
83
|
+
_hasPageSelection(e) {
|
|
84
|
+
if (!("getAttribute" in e))
|
|
85
|
+
return !1;
|
|
86
|
+
const r = e.getAttribute(i.PAGE_TYPE), t = e.getAttribute(i.PAGE_LIST);
|
|
87
|
+
return !!r && !!t;
|
|
88
|
+
}
|
|
76
89
|
/**
|
|
77
90
|
* Returns the block's stable id, assigning one via the document modifier if
|
|
78
91
|
* the node has not been tagged yet. Idempotent: subsequent calls during
|
|
@@ -80,18 +93,18 @@ class F extends L {
|
|
|
80
93
|
* `apply()`) short-circuit on the existing attribute.
|
|
81
94
|
*/
|
|
82
95
|
_getOrAssignBlockId(e) {
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
return
|
|
96
|
+
const r = this._readBlockId(e);
|
|
97
|
+
if (r)
|
|
98
|
+
return r;
|
|
86
99
|
if (!("getAttribute" in e))
|
|
87
100
|
return null;
|
|
88
|
-
const
|
|
101
|
+
const t = this._generateNextBlockId();
|
|
89
102
|
try {
|
|
90
|
-
this.api.getDocumentModifier().modifyHtml(e).setAttribute(i.BLOCK_ID,
|
|
103
|
+
this.api.getDocumentModifier().modifyHtml(e).setAttribute(i.BLOCK_ID, t).apply(new b(`Assign unsubscribe block id ${t}`));
|
|
91
104
|
} catch (s) {
|
|
92
105
|
return console.warn("[UnsubscribeBlock] Failed to assign block id:", s), null;
|
|
93
106
|
}
|
|
94
|
-
return
|
|
107
|
+
return t;
|
|
95
108
|
}
|
|
96
109
|
/**
|
|
97
110
|
* Generates a unique id by scanning the document for the highest existing
|
|
@@ -101,8 +114,8 @@ class F extends L {
|
|
|
101
114
|
_generateNextBlockId() {
|
|
102
115
|
let e = 0;
|
|
103
116
|
try {
|
|
104
|
-
const
|
|
105
|
-
|
|
117
|
+
const r = this.api.getDocumentRoot();
|
|
118
|
+
r && "querySelectorAll" in r && r.querySelectorAll(_).forEach((s) => {
|
|
106
119
|
if ("getAttribute" in s) {
|
|
107
120
|
const o = s.getAttribute(i.BLOCK_ID), u = o ? parseInt(o) : 0;
|
|
108
121
|
u > e && (e = u);
|
|
@@ -117,11 +130,11 @@ class F extends L {
|
|
|
117
130
|
const { showToaster: e } = B();
|
|
118
131
|
e({
|
|
119
132
|
type: S.Warning,
|
|
120
|
-
message: this.api.translate(
|
|
133
|
+
message: this.api.translate(N),
|
|
121
134
|
actionButton: {
|
|
122
135
|
text: this.api.translate("Visit Academy"),
|
|
123
136
|
onClick: () => {
|
|
124
|
-
window.open(
|
|
137
|
+
window.open(C, "_blank", "noopener,noreferrer");
|
|
125
138
|
}
|
|
126
139
|
}
|
|
127
140
|
});
|
|
@@ -131,16 +144,17 @@ class F extends L {
|
|
|
131
144
|
}
|
|
132
145
|
_setupSelectEventListener() {
|
|
133
146
|
this._removeSelectEventListener(), this.selectEventListener = (e) => {
|
|
134
|
-
const
|
|
135
|
-
this._updateBlock(
|
|
147
|
+
const r = e, { collectionType: t, selectedPages: s } = r.detail;
|
|
148
|
+
this._updateBlock(t, s.join(","));
|
|
136
149
|
}, document.addEventListener(d.SELECT, this.selectEventListener);
|
|
137
150
|
}
|
|
138
151
|
_removeSelectEventListener() {
|
|
139
152
|
this.selectEventListener && (document.removeEventListener(d.SELECT, this.selectEventListener), this.selectEventListener = null);
|
|
140
153
|
}
|
|
141
|
-
_setupCancelEventListener() {
|
|
142
|
-
this._removeCancelEventListener(), this.cancelEventListener = () => {
|
|
143
|
-
|
|
154
|
+
_setupCancelEventListener(e) {
|
|
155
|
+
this._removeCancelEventListener(), this.cancelEventListener = (r) => {
|
|
156
|
+
const { detail: t } = r, s = (t == null ? void 0 : t.blockId) ?? null;
|
|
157
|
+
s !== null && s !== e || this._handleCancel();
|
|
144
158
|
}, document.addEventListener(d.CANCEL, this.cancelEventListener);
|
|
145
159
|
}
|
|
146
160
|
_removeCancelEventListener() {
|
|
@@ -158,32 +172,32 @@ class F extends L {
|
|
|
158
172
|
_removeEventListeners() {
|
|
159
173
|
this._removeSelectEventListener(), this._removeCancelEventListener();
|
|
160
174
|
}
|
|
161
|
-
_updateBlock(e,
|
|
175
|
+
_updateBlock(e, r) {
|
|
162
176
|
if (!this.currentNode || !("querySelector" in this.currentNode))
|
|
163
177
|
return;
|
|
164
|
-
const
|
|
165
|
-
if (!
|
|
178
|
+
const t = this.currentNode.querySelector(g);
|
|
179
|
+
if (!t)
|
|
166
180
|
return;
|
|
167
181
|
const s = this._getMergeTag(e);
|
|
168
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
182
|
+
this.api.getDocumentModifier().modifyHtml(t).setAttribute("href", s).apply(new b(`Updated unsubscribe link to ${s}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(i.PAGE_TYPE, e.toString()).setAttribute(i.PAGE_LIST, r).apply(new b("Updated unsubscribe block metadata"));
|
|
169
183
|
}
|
|
170
184
|
_getMergeTag(e) {
|
|
171
|
-
return
|
|
185
|
+
return U[e] ?? y;
|
|
172
186
|
}
|
|
173
187
|
_openDrawer() {
|
|
174
188
|
if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
|
|
175
189
|
try {
|
|
176
|
-
const e =
|
|
190
|
+
const e = l();
|
|
177
191
|
e.typeSelectionDrawerStatus = !0;
|
|
178
192
|
} catch (e) {
|
|
179
193
|
console.error("[UnsubscribeBlock] Failed to open drawer:", e);
|
|
180
194
|
}
|
|
181
195
|
}
|
|
182
196
|
_checkExistingBlocks() {
|
|
183
|
-
const e =
|
|
184
|
-
e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(_).forEach((
|
|
185
|
-
if ("getAttribute" in
|
|
186
|
-
const s =
|
|
197
|
+
const e = l();
|
|
198
|
+
e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(_).forEach((t) => {
|
|
199
|
+
if ("getAttribute" in t) {
|
|
200
|
+
const s = t.getAttribute(i.PAGE_TYPE);
|
|
187
201
|
if (s) {
|
|
188
202
|
const o = Number(s);
|
|
189
203
|
o === E.GLOBAL_UNSUBSCRIBE ? e.isGlobalUnsubscribeDisabled = !0 : o === E.SUBSCRIPTION_PREFERENCE_CENTER && (e.isSubscriptionPreferencesCenterDisabled = !0);
|
|
@@ -194,26 +208,26 @@ class F extends L {
|
|
|
194
208
|
async _loadBlockState(e) {
|
|
195
209
|
if (!("getAttribute" in e))
|
|
196
210
|
return;
|
|
197
|
-
const
|
|
198
|
-
if (!
|
|
211
|
+
const r = e.getAttribute(i.PAGE_TYPE), t = e.getAttribute(i.PAGE_LIST);
|
|
212
|
+
if (!r || !t)
|
|
199
213
|
return;
|
|
200
|
-
const s =
|
|
214
|
+
const s = l(), o = Number(r), u = p(t);
|
|
201
215
|
await s.fetchTemplates(), s.setCollectionWithoutAutoSelection(o), s.loadSelectedTemplates(u);
|
|
202
216
|
}
|
|
203
217
|
_resetStoreState() {
|
|
204
|
-
|
|
218
|
+
l().$reset();
|
|
205
219
|
}
|
|
206
220
|
_removeBlockTemplatesFromStore(e) {
|
|
207
221
|
if (!("getAttribute" in e))
|
|
208
222
|
return;
|
|
209
|
-
const
|
|
210
|
-
if (!
|
|
223
|
+
const r = e.getAttribute(i.PAGE_LIST);
|
|
224
|
+
if (!r)
|
|
211
225
|
return;
|
|
212
|
-
const
|
|
213
|
-
|
|
226
|
+
const t = l(), s = p(r);
|
|
227
|
+
t.removeUnsubscribePages(s);
|
|
214
228
|
}
|
|
215
229
|
}
|
|
216
230
|
export {
|
|
217
|
-
|
|
218
|
-
|
|
231
|
+
T as UNSUBSCRIBE_BLOCK_ID,
|
|
232
|
+
K as UnsubscribeBlock
|
|
219
233
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var T = Object.defineProperty;
|
|
2
|
+
var p = (a, s, e) => s in a ? T(a, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[s] = e;
|
|
3
|
+
var c = (a, s, e) => p(a, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
+
import { useEditorStore as _ } from "../../../stores/editor.js";
|
|
4
5
|
import { useUnsubscribeStore as l } from "../../../stores/unsubscribe.js";
|
|
5
|
-
import { Control as
|
|
6
|
-
import { DATA_ATTRIBUTES as
|
|
7
|
-
import { parsePageList as
|
|
6
|
+
import { Control as g, UEAttr as i, UIElementType as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
+
import { DATA_ATTRIBUTES as d } from "./utils/constants.js";
|
|
8
|
+
import { parsePageList as h } from "./utils/utils.js";
|
|
8
9
|
const v = "ui-elements-unsubscribe", r = {
|
|
9
10
|
SELECT_BUTTON: "selectTemplateButton",
|
|
10
11
|
PREV_BUTTON: "prevButton",
|
|
@@ -12,14 +13,14 @@ const v = "ui-elements-unsubscribe", r = {
|
|
|
12
13
|
COUNTER_TEXT: "counterText",
|
|
13
14
|
PREVIEW_IMAGE: "previewImage"
|
|
14
15
|
};
|
|
15
|
-
class
|
|
16
|
+
class w extends g {
|
|
16
17
|
constructor() {
|
|
17
18
|
super(...arguments);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
c(this, "currentPreviewIndex", 0);
|
|
20
|
+
c(this, "currentNode");
|
|
21
|
+
c(this, "currentPages");
|
|
22
|
+
c(this, "valueChangeHandlers", []);
|
|
23
|
+
c(this, "lastParsedAttribute");
|
|
23
24
|
}
|
|
24
25
|
getId() {
|
|
25
26
|
return v;
|
|
@@ -34,8 +35,8 @@ class B extends T {
|
|
|
34
35
|
}
|
|
35
36
|
onTemplateNodeUpdated(e) {
|
|
36
37
|
if (this.currentNode = e, "getAttribute" in this.currentNode) {
|
|
37
|
-
const t = this.currentNode.getAttribute(
|
|
38
|
-
t && (t !== this.lastParsedAttribute && (this.currentPages =
|
|
38
|
+
const t = this.currentNode.getAttribute(d.PAGE_LIST);
|
|
39
|
+
t && (t !== this.lastParsedAttribute && (this.currentPages = h(t), this.lastParsedAttribute = t, this.currentPreviewIndex = 0), this._updateCounter(), this._loadAndUpdatePreview());
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
onRender() {
|
|
@@ -61,12 +62,20 @@ class B extends T {
|
|
|
61
62
|
}
|
|
62
63
|
_onButtonClick() {
|
|
63
64
|
try {
|
|
65
|
+
if (_().isPreviewModeOpen)
|
|
66
|
+
return;
|
|
64
67
|
const e = l();
|
|
65
|
-
e.activeType = e.getSelectedCollection[this.currentPreviewIndex], e.pageSelectionUpdateStatus = !0, e.pageSelectionDrawerStatus = !0;
|
|
68
|
+
this._reseedSelectionFromBlock(e), e.activeType = e.getSelectedCollection[this.currentPreviewIndex], e.pageSelectionUpdateStatus = !0, e.pageSelectionDrawerStatus = !0;
|
|
66
69
|
} catch (e) {
|
|
67
70
|
console.error("[UnsubscribeControl] Failed to open drawer:", e);
|
|
68
71
|
}
|
|
69
72
|
}
|
|
73
|
+
_reseedSelectionFromBlock(e) {
|
|
74
|
+
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
75
|
+
return;
|
|
76
|
+
const t = this.currentNode.getAttribute(d.PAGE_TYPE), o = this.currentNode.getAttribute(d.PAGE_LIST);
|
|
77
|
+
!t || !o || (e.$reset(), e.setCollectionWithoutAutoSelection(Number(t)), e.loadSelectedTemplates(h(o)));
|
|
78
|
+
}
|
|
70
79
|
_onPrevClick() {
|
|
71
80
|
this.currentPreviewIndex > 0 && (this.currentPreviewIndex--, this._updatePreview(), this._updateCounter());
|
|
72
81
|
}
|
|
@@ -80,21 +89,21 @@ class B extends T {
|
|
|
80
89
|
var e;
|
|
81
90
|
if ((e = this.currentPages) != null && e.length)
|
|
82
91
|
try {
|
|
83
|
-
const t = this.currentPages[this.currentPreviewIndex],
|
|
84
|
-
if (!
|
|
92
|
+
const t = this.currentPages[this.currentPreviewIndex], u = l().getThumbnailByTemplateId(t);
|
|
93
|
+
if (!u) {
|
|
85
94
|
console.warn("[UnsubscribeControl] No thumbnail found for page:", t);
|
|
86
95
|
return;
|
|
87
96
|
}
|
|
88
97
|
this.api.updateValues({
|
|
89
|
-
[r.PREVIEW_IMAGE]:
|
|
98
|
+
[r.PREVIEW_IMAGE]: u
|
|
90
99
|
});
|
|
91
100
|
} catch (t) {
|
|
92
101
|
console.error("[UnsubscribeControl] Failed to update preview:", t);
|
|
93
102
|
}
|
|
94
103
|
}
|
|
95
104
|
_updateCounter() {
|
|
96
|
-
const e = this.currentPreviewIndex + 1, t = this.totalTemplates,
|
|
97
|
-
this.api.setUIEAttribute(r.PREV_BUTTON, i.BUTTON.disabled,
|
|
105
|
+
const e = this.currentPreviewIndex + 1, t = this.totalTemplates, o = this.currentPreviewIndex === 0, u = this.currentPreviewIndex >= t - 1;
|
|
106
|
+
this.api.setUIEAttribute(r.PREV_BUTTON, i.BUTTON.disabled, o), this.api.setUIEAttribute(r.NEXT_BUTTON, i.BUTTON.disabled, u), this.api.setUIEAttribute(
|
|
98
107
|
r.COUNTER_TEXT,
|
|
99
108
|
i.LABEL.text,
|
|
100
109
|
`${this.api.translate("Showing")} ${e} ${this.api.translate("of")} ${t}`
|
|
@@ -135,14 +144,14 @@ class B extends T {
|
|
|
135
144
|
</${n.LABEL}>
|
|
136
145
|
`;
|
|
137
146
|
}
|
|
138
|
-
_getIconButton(e, t,
|
|
139
|
-
const
|
|
147
|
+
_getIconButton(e, t, o) {
|
|
148
|
+
const u = o ? `${i.BUTTON.disabled}="true"` : "";
|
|
140
149
|
return `
|
|
141
150
|
<${n.BUTTON}
|
|
142
151
|
id="${e}"
|
|
143
152
|
class="flat-inline flat-white"
|
|
144
153
|
${i.BUTTON.name}="${e}"
|
|
145
|
-
${
|
|
154
|
+
${u}
|
|
146
155
|
>
|
|
147
156
|
<${n.ICON}
|
|
148
157
|
src="${t}"
|
|
@@ -166,5 +175,5 @@ class B extends T {
|
|
|
166
175
|
}
|
|
167
176
|
export {
|
|
168
177
|
v as UNSUBSCRIBE_CONTROL_ID,
|
|
169
|
-
|
|
178
|
+
w as UnsubscribeControl
|
|
170
179
|
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-82128f7d]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-50dac6de]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-50dac6de]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-50dac6de]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-
|
|
1
|
+
.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-82128f7d]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-50dac6de]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-50dac6de]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-50dac6de]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-1b31027d]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-1b31027d]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-1b31027d]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-1b31027d]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-1b31027d]{object-fit:cover;transform:scale(1)}[data-v-811cff80] .guido__verion-history-view-option-selection-desktop svg,[data-v-811cff80] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-811cff80] .in-segments-wrapper__button_selected,[data-v-811cff80] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
|
|
@@ -1,52 +1,40 @@
|
|
|
1
|
-
import { useHttp as
|
|
2
|
-
import { QUERY_PARAMS as
|
|
3
|
-
const
|
|
4
|
-
(
|
|
5
|
-
attributeName: t.attributeName,
|
|
6
|
-
attributeJs: t.attributeJs,
|
|
7
|
-
attributeType: t.attributeType,
|
|
8
|
-
type: t.type,
|
|
9
|
-
displayName: t.displayName,
|
|
10
|
-
isFilterable: t.isFilterable
|
|
11
|
-
}, a),
|
|
12
|
-
{}
|
|
13
|
-
), f = () => {
|
|
14
|
-
const { get: o } = d(), { get: a } = d({ headers: {} }), t = "6KcLM9TwheVB1mgK";
|
|
1
|
+
import { useHttp as a } from "../composables/useHttp.js";
|
|
2
|
+
import { QUERY_PARAMS as d, URLS as h } from "../enums/extensions/recommendationBlock.js";
|
|
3
|
+
const y = () => {
|
|
4
|
+
const { get: r } = a(), { get: s } = a({ headers: {} }), m = "6KcLM9TwheVB1mgK";
|
|
15
5
|
return {
|
|
16
6
|
fetchRecommendationCreateData: async () => {
|
|
17
7
|
try {
|
|
18
|
-
return (await
|
|
8
|
+
return (await r("/newsletter/recommendations/create-data")).data;
|
|
19
9
|
} catch (e) {
|
|
20
10
|
throw console.error("fetchUserModalState error:", e), e;
|
|
21
11
|
}
|
|
22
12
|
},
|
|
23
13
|
fetchRecommendationFilters: async () => {
|
|
24
14
|
try {
|
|
25
|
-
const { data: e } = await
|
|
26
|
-
|
|
27
|
-
), n = Array.isArray(e) ? e : (e == null ? void 0 : e.data) ?? [];
|
|
28
|
-
return R(n);
|
|
15
|
+
const { data: e } = await r("/stripo/email-recommendation-attributes");
|
|
16
|
+
return e;
|
|
29
17
|
} catch (e) {
|
|
30
18
|
throw console.error("fetchRecommendationFilters error:", e), e;
|
|
31
19
|
}
|
|
32
20
|
},
|
|
33
|
-
fetchRecommendationProducts: async (e,
|
|
34
|
-
var
|
|
21
|
+
fetchRecommendationProducts: async (e, i) => {
|
|
22
|
+
var n;
|
|
35
23
|
try {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
console.debug("🏁 Recommendation API Query:",
|
|
40
|
-
const
|
|
41
|
-
`${
|
|
24
|
+
const t = new URLSearchParams(Object.entries(i));
|
|
25
|
+
t.set(d.CLIENT_ID, m);
|
|
26
|
+
const c = decodeURIComponent(t.toString());
|
|
27
|
+
console.debug("🏁 Recommendation API Query:", c);
|
|
28
|
+
const o = await s(
|
|
29
|
+
`${h.RECOMMENDATION_API_URL}/v2/${e}?${c}`
|
|
42
30
|
);
|
|
43
|
-
return ((
|
|
44
|
-
} catch (
|
|
45
|
-
throw console.error("fetchRecommendationProducts error:",
|
|
31
|
+
return ((n = o == null ? void 0 : o.data) == null ? void 0 : n.data) ?? [];
|
|
32
|
+
} catch (t) {
|
|
33
|
+
throw console.error("fetchRecommendationProducts error:", t), t;
|
|
46
34
|
}
|
|
47
35
|
}
|
|
48
36
|
};
|
|
49
37
|
};
|
|
50
38
|
export {
|
|
51
|
-
|
|
39
|
+
y as useRecommendationApi
|
|
52
40
|
};
|
|
@@ -2,7 +2,6 @@ import type { TextValueObject } from '@@/Types/generic';
|
|
|
2
2
|
import type { RecommendationFeedItem } from '@@/Types/recommendation';
|
|
3
3
|
export declare const URLS: {
|
|
4
4
|
RECOMMENDATION_API_URL: string;
|
|
5
|
-
PRODUCT_ATTRIBUTES_PATH: string;
|
|
6
5
|
};
|
|
7
6
|
export declare const QUERY_PARAMS: {
|
|
8
7
|
CLIENT_ID: string;
|
|
@@ -20,6 +20,12 @@ export declare class UnsubscribeBlock extends Block {
|
|
|
20
20
|
onDestroy(): void;
|
|
21
21
|
private _hasUnsubscribeLink;
|
|
22
22
|
private _readBlockId;
|
|
23
|
+
/**
|
|
24
|
+
* True when the block has a page type and a page list — i.e. a template was
|
|
25
|
+
* applied. A block with neither, combined with an already-present block id,
|
|
26
|
+
* is an undo-restored orphan of a cancelled block.
|
|
27
|
+
*/
|
|
28
|
+
private _hasPageSelection;
|
|
23
29
|
/**
|
|
24
30
|
* Returns the block's stable id, assigning one via the document modifier if
|
|
25
31
|
* the node has not been tagged yet. Idempotent: subsequent calls during
|
|
@@ -15,6 +15,7 @@ export declare class UnsubscribeControl extends Control {
|
|
|
15
15
|
private get totalTemplates();
|
|
16
16
|
private _listenToFormUpdates;
|
|
17
17
|
private _onButtonClick;
|
|
18
|
+
private _reseedSelectionFromBlock;
|
|
18
19
|
private _onPrevClick;
|
|
19
20
|
private _onNextClick;
|
|
20
21
|
private _loadAndUpdatePreview;
|
|
@@ -10,6 +10,7 @@ interface StoreState {
|
|
|
10
10
|
typeSelectionDrawerStatus: boolean;
|
|
11
11
|
isGlobalUnsubscribeDisabled: boolean;
|
|
12
12
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
13
|
+
pendingBlockId: string | null;
|
|
13
14
|
}
|
|
14
15
|
export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guidoUnsubscribe", StoreState, {
|
|
15
16
|
getSelectedCollection: (state: {
|
|
@@ -35,6 +36,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
35
36
|
typeSelectionDrawerStatus: boolean;
|
|
36
37
|
isGlobalUnsubscribeDisabled: boolean;
|
|
37
38
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
39
|
+
pendingBlockId: string | null;
|
|
38
40
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => number[];
|
|
39
41
|
getSelectedTemplateByActiveType: (state: {
|
|
40
42
|
templates: {
|
|
@@ -59,6 +61,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
59
61
|
typeSelectionDrawerStatus: boolean;
|
|
60
62
|
isGlobalUnsubscribeDisabled: boolean;
|
|
61
63
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
64
|
+
pendingBlockId: string | null;
|
|
62
65
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => number;
|
|
63
66
|
getTemplatesByActiveType: (state: {
|
|
64
67
|
templates: {
|
|
@@ -83,6 +86,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
83
86
|
typeSelectionDrawerStatus: boolean;
|
|
84
87
|
isGlobalUnsubscribeDisabled: boolean;
|
|
85
88
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
89
|
+
pendingBlockId: string | null;
|
|
86
90
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => {
|
|
87
91
|
id: number;
|
|
88
92
|
name: string;
|
|
@@ -119,6 +123,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
119
123
|
typeSelectionDrawerStatus: boolean;
|
|
120
124
|
isGlobalUnsubscribeDisabled: boolean;
|
|
121
125
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
126
|
+
pendingBlockId: string | null;
|
|
122
127
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => (id: number) => string;
|
|
123
128
|
getSelectedUnsubscribePagesByCollection: (state: {
|
|
124
129
|
templates: {
|
|
@@ -143,6 +148,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
143
148
|
typeSelectionDrawerStatus: boolean;
|
|
144
149
|
isGlobalUnsubscribeDisabled: boolean;
|
|
145
150
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
151
|
+
pendingBlockId: string | null;
|
|
146
152
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => (collectionType: number) => number[];
|
|
147
153
|
isActiveTypeFirstInCollection: (state: {
|
|
148
154
|
templates: {
|
|
@@ -167,6 +173,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
167
173
|
typeSelectionDrawerStatus: boolean;
|
|
168
174
|
isGlobalUnsubscribeDisabled: boolean;
|
|
169
175
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
176
|
+
pendingBlockId: string | null;
|
|
170
177
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
|
|
171
178
|
isActiveTypeLastInCollection: (state: {
|
|
172
179
|
templates: {
|
|
@@ -191,6 +198,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
191
198
|
typeSelectionDrawerStatus: boolean;
|
|
192
199
|
isGlobalUnsubscribeDisabled: boolean;
|
|
193
200
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
201
|
+
pendingBlockId: string | null;
|
|
194
202
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
|
|
195
203
|
hasTemplatesByCollectionType: (state: {
|
|
196
204
|
templates: {
|
|
@@ -215,6 +223,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
215
223
|
typeSelectionDrawerStatus: boolean;
|
|
216
224
|
isGlobalUnsubscribeDisabled: boolean;
|
|
217
225
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
226
|
+
pendingBlockId: string | null;
|
|
218
227
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => Record<number, boolean>;
|
|
219
228
|
unsubscribePagesStatus: (state: {
|
|
220
229
|
templates: {
|
|
@@ -239,10 +248,11 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
239
248
|
typeSelectionDrawerStatus: boolean;
|
|
240
249
|
isGlobalUnsubscribeDisabled: boolean;
|
|
241
250
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
251
|
+
pendingBlockId: string | null;
|
|
242
252
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
|
|
243
253
|
}, {
|
|
244
254
|
$reset(): void;
|
|
245
|
-
fetchTemplates(): Promise<void>;
|
|
255
|
+
fetchTemplates(force?: boolean): Promise<void>;
|
|
246
256
|
setCollection(collectionType: number): void;
|
|
247
257
|
setCollectionWithoutAutoSelection(collectionType: number): void;
|
|
248
258
|
setSelectedTemplate(template: number): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TYPE_COLLECTIONS as i, PAGE_TYPES as p } from "../enums/unsubscribe.js";
|
|
2
2
|
import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
|
|
3
|
-
import { defineStore as
|
|
3
|
+
import { defineStore as u } from "pinia";
|
|
4
4
|
let o = null;
|
|
5
5
|
const r = () => ({
|
|
6
6
|
templates: [],
|
|
@@ -12,8 +12,9 @@ const r = () => ({
|
|
|
12
12
|
pageSelectionDrawerStatus: !1,
|
|
13
13
|
typeSelectionDrawerStatus: !1,
|
|
14
14
|
isGlobalUnsubscribeDisabled: !1,
|
|
15
|
-
isSubscriptionPreferencesCenterDisabled: !1
|
|
16
|
-
|
|
15
|
+
isSubscriptionPreferencesCenterDisabled: !1,
|
|
16
|
+
pendingBlockId: null
|
|
17
|
+
}), b = u("guidoUnsubscribe", {
|
|
17
18
|
state: () => r(),
|
|
18
19
|
getters: {
|
|
19
20
|
getSelectedCollection: (e) => i[e.selectedCollectionType],
|
|
@@ -62,10 +63,10 @@ const r = () => ({
|
|
|
62
63
|
selectedUnsubscribePages: t
|
|
63
64
|
});
|
|
64
65
|
},
|
|
65
|
-
async fetchTemplates() {
|
|
66
|
-
this.templates.length || (
|
|
67
|
-
const { getUnsubscribePages:
|
|
68
|
-
this.templates = await
|
|
66
|
+
async fetchTemplates(e = !1) {
|
|
67
|
+
!e && this.templates.length || ((e || !o) && (o = (async () => {
|
|
68
|
+
const { getUnsubscribePages: t } = d();
|
|
69
|
+
this.templates = await t();
|
|
69
70
|
})().finally(() => {
|
|
70
71
|
o = null;
|
|
71
72
|
})), await o);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.7.0-beta.
|
|
3
|
+
"version": "3.7.0-beta.a1aaf44",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|