@useinsider/guido 3.4.1-beta.aeb242c → 3.4.1-beta.baebb5e
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.
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { BlockId as
|
|
5
|
-
import { getMigrationBannerHtml as
|
|
6
|
-
import { Block as
|
|
7
|
-
import { regenerateMobileProductRows as
|
|
8
|
-
import { ensureMobileCssRulesExist as
|
|
9
|
-
import { RecommendationConfigService as
|
|
1
|
+
var k = Object.defineProperty;
|
|
2
|
+
var y = (a, r, t) => r in a ? k(a, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[r] = t;
|
|
3
|
+
var d = (a, r, t) => y(a, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { BlockId as B } from "../../../enums/block.js";
|
|
5
|
+
import { getMigrationBannerHtml as D } from "../../../utils/migrationBannerHtml.js";
|
|
6
|
+
import { Block as R, BlockCompositionType as C, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
+
import { regenerateMobileProductRows as b } from "./controls/main/utils.js";
|
|
8
|
+
import { ensureMobileCssRulesExist as p, setMobileLayoutOptOut as f, hasMobileLayoutOptOut as A } from "./controls/mobileLayout/cssRules.js";
|
|
9
|
+
import { RecommendationConfigService as c } from "./services/configService.js";
|
|
10
10
|
import { useRecommendationExtensionStore as g } from "./store/recommendation.js";
|
|
11
|
-
import { getDefaultTemplate as
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
class
|
|
11
|
+
import { getDefaultTemplate as E } from "./templates/grid/template.js";
|
|
12
|
+
const _ = B.Recommendation, m = "recommendation-block-v2", u = "recommendation-id";
|
|
13
|
+
let I = !1;
|
|
14
|
+
class q extends R {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
/**
|
|
18
18
|
* Stores the ID generated in getTemplate() so onCreated() can reuse it.
|
|
19
19
|
* This avoids generating a new (different) ID in onCreated().
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
d(this, "_pendingBlockId", null);
|
|
22
22
|
}
|
|
23
23
|
getId() {
|
|
24
|
-
return
|
|
24
|
+
return _;
|
|
25
25
|
}
|
|
26
26
|
getIcon() {
|
|
27
27
|
return "recommendation-icon";
|
|
28
28
|
}
|
|
29
29
|
getBlockCompositionType() {
|
|
30
|
-
return
|
|
30
|
+
return C.CONTAINER;
|
|
31
31
|
}
|
|
32
32
|
getName() {
|
|
33
33
|
return this.api.translate("Recommendation Block");
|
|
@@ -38,8 +38,8 @@ class v extends b {
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
getSettingsPanelTitleHtml() {
|
|
41
|
-
return
|
|
42
|
-
|
|
41
|
+
return D(
|
|
42
|
+
_,
|
|
43
43
|
this.api.translate("Recommendation Block"),
|
|
44
44
|
this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
|
|
45
45
|
);
|
|
@@ -59,7 +59,7 @@ class v extends b {
|
|
|
59
59
|
*/
|
|
60
60
|
getTemplate() {
|
|
61
61
|
const t = this._generateNextId();
|
|
62
|
-
return this._pendingBlockId = t,
|
|
62
|
+
return this._pendingBlockId = t, E(t);
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Called when a new block is dropped into the template
|
|
@@ -82,15 +82,15 @@ class v extends b {
|
|
|
82
82
|
}
|
|
83
83
|
const i = this._pendingBlockId ?? this._generateNextId();
|
|
84
84
|
this._pendingBlockId = null, this._assignRecommendationId(t, i);
|
|
85
|
-
const { config: n, wasFreshDrop: o } =
|
|
85
|
+
const { config: n, wasFreshDrop: o } = c.initializeConfig(
|
|
86
86
|
this.api,
|
|
87
87
|
t,
|
|
88
88
|
{ recommendationId: i }
|
|
89
89
|
), s = g();
|
|
90
90
|
if (s.setCurrentBlock(i), o) {
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
91
|
+
p(this.api);
|
|
92
|
+
const l = this._getBlockElement(t);
|
|
93
|
+
l && (f(this.api, l, !0), b({
|
|
94
94
|
currentNode: t,
|
|
95
95
|
documentModifier: this.api.getDocumentModifier()
|
|
96
96
|
}));
|
|
@@ -108,20 +108,20 @@ class v extends b {
|
|
|
108
108
|
if (!(!t || !("getNodeConfig" in t))) {
|
|
109
109
|
if (!this._getRecommendationId(t)) {
|
|
110
110
|
const e = this._generateNextId();
|
|
111
|
-
this._assignRecommendationId(t, e),
|
|
111
|
+
this._assignRecommendationId(t, e), c.hasConfig(t) && c.updateConfig(
|
|
112
112
|
this.api,
|
|
113
113
|
t,
|
|
114
114
|
{ recommendationId: e },
|
|
115
115
|
"Assign recommendation ID to legacy block"
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
|
-
this._healLingeringDuplicate(t),
|
|
118
|
+
this._healLingeringDuplicate(t), c.needsMigration(t) && this._migrateFromLegacy(t);
|
|
119
119
|
try {
|
|
120
|
-
|
|
121
|
-
const e =
|
|
120
|
+
I || (p(this.api), I = !0);
|
|
121
|
+
const e = c.getConfig(t), i = this._getBlockElement(t);
|
|
122
122
|
if (i) {
|
|
123
123
|
const n = !e.mobileLayoutEnabled;
|
|
124
|
-
|
|
124
|
+
A(i) !== n && f(this.api, i, n);
|
|
125
125
|
}
|
|
126
126
|
} catch {
|
|
127
127
|
}
|
|
@@ -183,9 +183,9 @@ class v extends b {
|
|
|
183
183
|
if (!o)
|
|
184
184
|
return;
|
|
185
185
|
let s = -1;
|
|
186
|
-
for (let
|
|
187
|
-
if (n[
|
|
188
|
-
s =
|
|
186
|
+
for (let l = 0; l < n.length; l++)
|
|
187
|
+
if (n[l] === o) {
|
|
188
|
+
s = l;
|
|
189
189
|
break;
|
|
190
190
|
}
|
|
191
191
|
if (s <= 0)
|
|
@@ -224,7 +224,7 @@ class v extends b {
|
|
|
224
224
|
*/
|
|
225
225
|
_reassignDuplicateId(t, e) {
|
|
226
226
|
const i = this._generateNextId(), n = this._getBlockElement(t);
|
|
227
|
-
return this._assignRecommendationId(t, i), n && this._reassignInstanceClass(n, e, i),
|
|
227
|
+
return this._assignRecommendationId(t, i), n && this._reassignInstanceClass(n, e, i), c.hasConfig(t) && c.updateConfig(
|
|
228
228
|
this.api,
|
|
229
229
|
t,
|
|
230
230
|
{ recommendationId: i },
|
|
@@ -233,18 +233,17 @@ class v extends b {
|
|
|
233
233
|
}
|
|
234
234
|
/**
|
|
235
235
|
* Rewrites `ins-recommendation-v3-block-{id}` on the clone — the instance
|
|
236
|
-
* class scopes per-block CSS rules
|
|
237
|
-
*
|
|
236
|
+
* class scopes per-block CSS rules in the editor and is also the key the
|
|
237
|
+
* mail render service reads to look up per-id campaign config, so leaving
|
|
238
|
+
* the source's class would both leak stylistic edits across blocks and
|
|
239
|
+
* cause the mail render to apply the source block's config to the clone.
|
|
238
240
|
*/
|
|
239
241
|
_reassignInstanceClass(t, e, i) {
|
|
240
242
|
if (!("getAttribute" in t))
|
|
241
243
|
return;
|
|
242
|
-
const n =
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
const o = `ins-recommendation-v3-block-${e}`, s = `ins-recommendation-v3-block-${i}`, r = n.includes(o) ? n.replace(o, s) : `${n} ${s}`, d = this.api.getDocumentModifier();
|
|
246
|
-
d.modifyHtml(t).setAttribute("class", r), d.apply(new p(
|
|
247
|
-
`Reassign recommendation instance class ${o} -> ${s}`
|
|
244
|
+
const n = `ins-recommendation-v3-block-${e}`, o = `ins-recommendation-v3-block-${i}`, s = this.api.getDocumentModifier();
|
|
245
|
+
s.modifyHtml(t).removeClass(n).setClass(o), s.apply(new h(
|
|
246
|
+
`Reassign recommendation instance class ${n} -> ${o}`
|
|
248
247
|
));
|
|
249
248
|
}
|
|
250
249
|
/**
|
|
@@ -258,7 +257,7 @@ class v extends b {
|
|
|
258
257
|
if (!i)
|
|
259
258
|
return;
|
|
260
259
|
const n = this.api.getDocumentModifier();
|
|
261
|
-
n.modifyHtml(i).setAttribute(u, e.toString()), n.apply(new
|
|
260
|
+
n.modifyHtml(i).setAttribute(u, e.toString()), n.apply(new h(`Assign recommendation ID ${e}`));
|
|
262
261
|
}
|
|
263
262
|
/**
|
|
264
263
|
* Gets the recommendation-id from a block node
|
|
@@ -288,10 +287,10 @@ class v extends b {
|
|
|
288
287
|
* Migrate configuration from legacy format
|
|
289
288
|
*/
|
|
290
289
|
_migrateFromLegacy(t) {
|
|
291
|
-
|
|
290
|
+
c.migrateFromDataAttributes(this.api, t);
|
|
292
291
|
}
|
|
293
292
|
}
|
|
294
293
|
export {
|
|
295
|
-
|
|
296
|
-
|
|
294
|
+
_ as BLOCK_ID,
|
|
295
|
+
q as RecommendationBlock
|
|
297
296
|
};
|
|
@@ -91,8 +91,10 @@ export declare class RecommendationBlock extends Block {
|
|
|
91
91
|
private _reassignDuplicateId;
|
|
92
92
|
/**
|
|
93
93
|
* Rewrites `ins-recommendation-v3-block-{id}` on the clone — the instance
|
|
94
|
-
* class scopes per-block CSS rules
|
|
95
|
-
*
|
|
94
|
+
* class scopes per-block CSS rules in the editor and is also the key the
|
|
95
|
+
* mail render service reads to look up per-id campaign config, so leaving
|
|
96
|
+
* the source's class would both leak stylistic edits across blocks and
|
|
97
|
+
* cause the mail render to apply the source block's config to the clone.
|
|
96
98
|
*/
|
|
97
99
|
private _reassignInstanceClass;
|
|
98
100
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.4.1-beta.
|
|
3
|
+
"version": "3.4.1-beta.baebb5e",
|
|
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",
|