@useinsider/guido 3.8.0-beta.910d4af → 3.8.0-beta.eb4074b
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/email-preview/desktop-preview/DesktopPreview.vue.js +8 -8
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +12 -15
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +15 -16
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +37 -42
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +37 -40
- package/dist/composables/useHtmlValidator.js +180 -133
- package/dist/composables/useSave.js +14 -14
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +17 -26
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +64 -69
- package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
- package/dist/config/migrator/recommendation/extractors.js +44 -22
- package/dist/config/migrator/recommendation/htmlBuilder.js +175 -169
- package/dist/config/migrator/recommendationMigrator.js +30 -31
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +22 -15
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +55 -41
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +42 -43
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +48 -45
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +64 -60
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +294 -335
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
- package/dist/extensions/Blocks/Recommendation/extension.js +7 -5
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -2
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +142 -173
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +56 -29
- package/dist/extensions/Blocks/Recommendation/templates/index.js +30 -8
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +132 -105
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +44 -23
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +112 -64
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +219 -0
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +30 -22
- package/dist/extensions/Blocks/Unsubscribe/block.js +37 -40
- package/dist/extensions/Blocks/Unsubscribe/control.js +16 -19
- package/dist/extensions/Blocks/controlFactories.js +159 -133
- package/dist/guido.css +1 -1
- package/dist/src/composables/useHtmlValidator.d.ts +27 -0
- package/dist/src/composables/useHtmlValidator.test.d.ts +1 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -1
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +23 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +7 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +29 -47
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +165 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +78 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +29 -9
- package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
- package/dist/src/stores/unsubscribe.d.ts +1 -11
- package/dist/stores/unsubscribe.js +7 -8
- package/package.json +1 -1
- package/dist/composables/usePreviewInteractionGuard.js +0 -17
- package/dist/src/composables/usePreviewInteractionGuard.d.ts +0 -3
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
var S = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var a = (c, o, e) =>
|
|
4
|
-
import { useToaster as
|
|
2
|
+
var L = (c, o, e) => o in c ? S(c, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[o] = e;
|
|
3
|
+
var a = (c, o, e) => L(c, typeof o != "symbol" ? o + "" : o, e);
|
|
4
|
+
import { useToaster as f } from "../../../composables/useToaster.js";
|
|
5
5
|
import { ToasterTypeOptions as A } from "../../../enums/toaster.js";
|
|
6
6
|
import { PAGE_TYPES as h } from "../../../enums/unsubscribe.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { getDefaultTemplate as C } from "./template.js";
|
|
7
|
+
import { useUnsubscribeStore as u } from "../../../stores/unsubscribe.js";
|
|
8
|
+
import { Block as y, BlockCompositionType as T, ContextActionType as k, ModificationDescription as d, BlockType as I } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
9
|
+
import { getDefaultTemplate as v } from "./template.js";
|
|
11
10
|
import { UNSUBSCRIBE_BLOCK_SELECTOR as m, DATA_ATTRIBUTES as n, UNSUBSCRIBE_EVENTS as b } from "./utils/constants.js";
|
|
12
|
-
import { parsePageList as
|
|
13
|
-
const
|
|
11
|
+
import { parsePageList as B } from "./utils/utils.js";
|
|
12
|
+
const C = "unsubscribe-block", E = 'a[data-unsubscribe-link="true"]', N = "{{ins-unsubscribe-link}}", U = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", R = "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.", D = {
|
|
14
13
|
[h.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
15
14
|
[h.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
16
|
-
},
|
|
17
|
-
class
|
|
15
|
+
}, w = 3;
|
|
16
|
+
class H extends y {
|
|
18
17
|
constructor() {
|
|
19
18
|
super();
|
|
20
19
|
a(this, "selectEventListener", null);
|
|
@@ -30,13 +29,13 @@ class W extends T {
|
|
|
30
29
|
a(this, "guardAttemptsByBlockId", /* @__PURE__ */ new Map());
|
|
31
30
|
}
|
|
32
31
|
getId() {
|
|
33
|
-
return
|
|
32
|
+
return C;
|
|
34
33
|
}
|
|
35
34
|
getIcon() {
|
|
36
35
|
return "unsubscribe-icon";
|
|
37
36
|
}
|
|
38
37
|
getBlockCompositionType() {
|
|
39
|
-
return
|
|
38
|
+
return T.BLOCK;
|
|
40
39
|
}
|
|
41
40
|
getName() {
|
|
42
41
|
return this.api.translate("Unsubscribe Block");
|
|
@@ -45,16 +44,15 @@ class W extends T {
|
|
|
45
44
|
return this.api.translate("Unsubscribe Block Description");
|
|
46
45
|
}
|
|
47
46
|
getTemplate() {
|
|
48
|
-
return
|
|
47
|
+
return v();
|
|
49
48
|
}
|
|
50
49
|
getContextActionsIds() {
|
|
51
|
-
return [
|
|
50
|
+
return [k.MOVE, k.REMOVE];
|
|
52
51
|
}
|
|
53
52
|
onSelect(e) {
|
|
54
|
-
|
|
55
|
-
return;
|
|
53
|
+
this.currentNode = e;
|
|
56
54
|
const t = this._getOrAssignBlockId(e);
|
|
57
|
-
t && this.linkStateByBlockId.set(t, this._hasUnsubscribeLink(e)), !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(),
|
|
55
|
+
t && this.linkStateByBlockId.set(t, this._hasUnsubscribeLink(e)), this._setupSelectEventListener(), this._setupCancelEventListener(), !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._checkExistingBlocks(), this._openDrawer());
|
|
58
56
|
}
|
|
59
57
|
onCreated(e) {
|
|
60
58
|
this._ensureLeadingTextGuard(e);
|
|
@@ -109,9 +107,9 @@ class W extends T {
|
|
|
109
107
|
const g = this._getOrAssignBlockId(e);
|
|
110
108
|
if (!g)
|
|
111
109
|
return;
|
|
112
|
-
const
|
|
113
|
-
if (!(
|
|
114
|
-
this.guardAttemptsByBlockId.set(g,
|
|
110
|
+
const _ = this.guardAttemptsByBlockId.get(g) ?? 0;
|
|
111
|
+
if (!(_ >= w)) {
|
|
112
|
+
this.guardAttemptsByBlockId.set(g, _ + 1);
|
|
115
113
|
try {
|
|
116
114
|
this.api.getDocumentModifier().modifyHtml(r).prepend(" ").apply(new d("Ensure unsubscribe link text guard"));
|
|
117
115
|
} catch (p) {
|
|
@@ -156,8 +154,8 @@ class W extends T {
|
|
|
156
154
|
const t = this.api.getDocumentRoot();
|
|
157
155
|
t && "querySelectorAll" in t && t.querySelectorAll(m).forEach((r) => {
|
|
158
156
|
if ("getAttribute" in r) {
|
|
159
|
-
const i = r.getAttribute(n.BLOCK_ID),
|
|
160
|
-
|
|
157
|
+
const i = r.getAttribute(n.BLOCK_ID), l = i ? parseInt(i) : 0;
|
|
158
|
+
l > e && (e = l);
|
|
161
159
|
}
|
|
162
160
|
});
|
|
163
161
|
} catch {
|
|
@@ -166,14 +164,14 @@ class W extends T {
|
|
|
166
164
|
}
|
|
167
165
|
_warnLinkRemoved() {
|
|
168
166
|
try {
|
|
169
|
-
const { showToaster: e } =
|
|
167
|
+
const { showToaster: e } = f();
|
|
170
168
|
e({
|
|
171
169
|
type: A.Warning,
|
|
172
|
-
message: this.api.translate(
|
|
170
|
+
message: this.api.translate(R),
|
|
173
171
|
actionButton: {
|
|
174
172
|
text: this.api.translate("Visit Academy"),
|
|
175
173
|
onClick: () => {
|
|
176
|
-
window.open(
|
|
174
|
+
window.open(U, "_blank", "noopener,noreferrer");
|
|
177
175
|
}
|
|
178
176
|
}
|
|
179
177
|
});
|
|
@@ -190,10 +188,9 @@ class W extends T {
|
|
|
190
188
|
_removeSelectEventListener() {
|
|
191
189
|
this.selectEventListener && (document.removeEventListener(b.SELECT, this.selectEventListener), this.selectEventListener = null);
|
|
192
190
|
}
|
|
193
|
-
_setupCancelEventListener(
|
|
194
|
-
this._removeCancelEventListener(), this.cancelEventListener = (
|
|
195
|
-
|
|
196
|
-
((s == null ? void 0 : s.blockId) ?? null) === e && this._handleCancel();
|
|
191
|
+
_setupCancelEventListener() {
|
|
192
|
+
this._removeCancelEventListener(), this.cancelEventListener = () => {
|
|
193
|
+
this._handleCancel();
|
|
197
194
|
}, document.addEventListener(b.CANCEL, this.cancelEventListener);
|
|
198
195
|
}
|
|
199
196
|
_removeCancelEventListener() {
|
|
@@ -203,7 +200,7 @@ class W extends T {
|
|
|
203
200
|
try {
|
|
204
201
|
if (!this.currentNode)
|
|
205
202
|
return;
|
|
206
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${
|
|
203
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${I.EMPTY_CONTAINER}/>`).apply(new d("Removed unsubscribe block due to cancel"));
|
|
207
204
|
} catch (e) {
|
|
208
205
|
console.warn("[UnsubscribeBlock] Failed to remove unsubscribe block:", e);
|
|
209
206
|
}
|
|
@@ -221,19 +218,19 @@ class W extends T {
|
|
|
221
218
|
this.api.getDocumentModifier().modifyHtml(s).setAttribute("href", r).apply(new d(`Updated unsubscribe link to ${r}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(n.PAGE_TYPE, e.toString()).setAttribute(n.PAGE_LIST, t).apply(new d("Updated unsubscribe block metadata"));
|
|
222
219
|
}
|
|
223
220
|
_getMergeTag(e) {
|
|
224
|
-
return
|
|
221
|
+
return D[e] ?? N;
|
|
225
222
|
}
|
|
226
223
|
_openDrawer() {
|
|
227
224
|
if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
|
|
228
225
|
try {
|
|
229
|
-
const e =
|
|
226
|
+
const e = u();
|
|
230
227
|
e.typeSelectionDrawerStatus = !0;
|
|
231
228
|
} catch (e) {
|
|
232
229
|
console.error("[UnsubscribeBlock] Failed to open drawer:", e);
|
|
233
230
|
}
|
|
234
231
|
}
|
|
235
232
|
_checkExistingBlocks() {
|
|
236
|
-
const e =
|
|
233
|
+
const e = u();
|
|
237
234
|
e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(m).forEach((s) => {
|
|
238
235
|
if ("getAttribute" in s) {
|
|
239
236
|
const r = s.getAttribute(n.PAGE_TYPE);
|
|
@@ -250,11 +247,11 @@ class W extends T {
|
|
|
250
247
|
const t = e.getAttribute(n.PAGE_TYPE), s = e.getAttribute(n.PAGE_LIST);
|
|
251
248
|
if (!t || !s)
|
|
252
249
|
return;
|
|
253
|
-
const r =
|
|
254
|
-
await r.fetchTemplates(), r.setCollectionWithoutAutoSelection(i), r.loadSelectedTemplates(
|
|
250
|
+
const r = u(), i = Number(t), l = B(s);
|
|
251
|
+
await r.fetchTemplates(), r.setCollectionWithoutAutoSelection(i), r.loadSelectedTemplates(l);
|
|
255
252
|
}
|
|
256
253
|
_resetStoreState() {
|
|
257
|
-
|
|
254
|
+
u().$reset();
|
|
258
255
|
}
|
|
259
256
|
_removeBlockTemplatesFromStore(e) {
|
|
260
257
|
if (!("getAttribute" in e))
|
|
@@ -262,11 +259,11 @@ class W extends T {
|
|
|
262
259
|
const t = e.getAttribute(n.PAGE_LIST);
|
|
263
260
|
if (!t)
|
|
264
261
|
return;
|
|
265
|
-
const s =
|
|
262
|
+
const s = u(), r = B(t);
|
|
266
263
|
s.removeUnsubscribePages(r);
|
|
267
264
|
}
|
|
268
265
|
}
|
|
269
266
|
export {
|
|
270
|
-
|
|
271
|
-
|
|
267
|
+
C as UNSUBSCRIBE_BLOCK_ID,
|
|
268
|
+
H as UnsubscribeBlock
|
|
272
269
|
};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
var T = Object.defineProperty;
|
|
2
|
-
var p = (
|
|
3
|
-
var c = (
|
|
4
|
-
import { useEditorStore as _ } from "../../../stores/editor.js";
|
|
2
|
+
var p = (o, s, e) => s in o ? T(o, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[s] = e;
|
|
3
|
+
var c = (o, s, e) => p(o, typeof s != "symbol" ? s + "" : s, e);
|
|
5
4
|
import { useUnsubscribeStore as l } from "../../../stores/unsubscribe.js";
|
|
6
|
-
import { Control as
|
|
5
|
+
import { Control as _, UEAttr as i, UIElementType as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
6
|
import { DATA_ATTRIBUTES as d } from "./utils/constants.js";
|
|
8
7
|
import { parsePageList as h } from "./utils/utils.js";
|
|
9
|
-
const
|
|
8
|
+
const g = "ui-elements-unsubscribe", r = {
|
|
10
9
|
SELECT_BUTTON: "selectTemplateButton",
|
|
11
10
|
PREV_BUTTON: "prevButton",
|
|
12
11
|
NEXT_BUTTON: "nextButton",
|
|
13
12
|
COUNTER_TEXT: "counterText",
|
|
14
13
|
PREVIEW_IMAGE: "previewImage"
|
|
15
14
|
};
|
|
16
|
-
class
|
|
15
|
+
class B extends _ {
|
|
17
16
|
constructor() {
|
|
18
17
|
super(...arguments);
|
|
19
18
|
c(this, "currentPreviewIndex", 0);
|
|
@@ -23,7 +22,7 @@ class w extends g {
|
|
|
23
22
|
c(this, "lastParsedAttribute");
|
|
24
23
|
}
|
|
25
24
|
getId() {
|
|
26
|
-
return
|
|
25
|
+
return g;
|
|
27
26
|
}
|
|
28
27
|
getTemplate() {
|
|
29
28
|
return `
|
|
@@ -60,12 +59,10 @@ class w extends g {
|
|
|
60
59
|
this.api.onValueChanged(r.NEXT_BUTTON, () => this._onNextClick())
|
|
61
60
|
);
|
|
62
61
|
}
|
|
63
|
-
|
|
62
|
+
_onButtonClick() {
|
|
64
63
|
try {
|
|
65
|
-
if (_().isPreviewModeOpen)
|
|
66
|
-
return;
|
|
67
64
|
const e = l();
|
|
68
|
-
|
|
65
|
+
this._reseedSelectionFromBlock(), e.activeType = e.getSelectedCollection[this.currentPreviewIndex], e.pageSelectionUpdateStatus = !0, e.pageSelectionDrawerStatus = !0;
|
|
69
66
|
} catch (e) {
|
|
70
67
|
console.error("[UnsubscribeControl] Failed to open drawer:", e);
|
|
71
68
|
}
|
|
@@ -74,8 +71,8 @@ class w extends g {
|
|
|
74
71
|
const e = l();
|
|
75
72
|
if (e.$reset(), !this.currentNode || !("getAttribute" in this.currentNode))
|
|
76
73
|
return;
|
|
77
|
-
const t = this.currentNode.getAttribute(d.PAGE_TYPE),
|
|
78
|
-
!t || !
|
|
74
|
+
const t = this.currentNode.getAttribute(d.PAGE_TYPE), a = this.currentNode.getAttribute(d.PAGE_LIST);
|
|
75
|
+
!t || !a || (e.setCollectionWithoutAutoSelection(Number(t)), e.loadSelectedTemplates(h(a)));
|
|
79
76
|
}
|
|
80
77
|
_onPrevClick() {
|
|
81
78
|
this.currentPreviewIndex > 0 && (this.currentPreviewIndex--, this._updatePreview(), this._updateCounter());
|
|
@@ -103,8 +100,8 @@ class w extends g {
|
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
102
|
_updateCounter() {
|
|
106
|
-
const e = this.currentPreviewIndex + 1, t = this.totalTemplates,
|
|
107
|
-
this.api.setUIEAttribute(r.PREV_BUTTON, i.BUTTON.disabled,
|
|
103
|
+
const e = this.currentPreviewIndex + 1, t = this.totalTemplates, a = this.currentPreviewIndex === 0, u = this.currentPreviewIndex >= t - 1;
|
|
104
|
+
this.api.setUIEAttribute(r.PREV_BUTTON, i.BUTTON.disabled, a), this.api.setUIEAttribute(r.NEXT_BUTTON, i.BUTTON.disabled, u), this.api.setUIEAttribute(
|
|
108
105
|
r.COUNTER_TEXT,
|
|
109
106
|
i.LABEL.text,
|
|
110
107
|
`${this.api.translate("Showing")} ${e} ${this.api.translate("of")} ${t}`
|
|
@@ -145,8 +142,8 @@ class w extends g {
|
|
|
145
142
|
</${n.LABEL}>
|
|
146
143
|
`;
|
|
147
144
|
}
|
|
148
|
-
_getIconButton(e, t,
|
|
149
|
-
const u =
|
|
145
|
+
_getIconButton(e, t, a) {
|
|
146
|
+
const u = a ? `${i.BUTTON.disabled}="true"` : "";
|
|
150
147
|
return `
|
|
151
148
|
<${n.BUTTON}
|
|
152
149
|
id="${e}"
|
|
@@ -175,6 +172,6 @@ class w extends g {
|
|
|
175
172
|
}
|
|
176
173
|
}
|
|
177
174
|
export {
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
g as UNSUBSCRIBE_CONTROL_ID,
|
|
176
|
+
B as UnsubscribeControl
|
|
180
177
|
};
|