@useinsider/guido 3.3.0-beta.b7e5793 → 3.3.0-beta.d5c796a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +42 -40
- package/dist/components/organisms/header/AiStatusPill.vue.js +18 -0
- package/dist/components/organisms/header/AiStatusPill.vue2.js +13 -0
- package/dist/components/organisms/header/MiddleSlot.vue.js +7 -7
- package/dist/components/organisms/header/MiddleSlot.vue2.js +8 -7
- package/dist/composables/useCortexBlueprintBridge.js +91 -0
- package/dist/composables/useEmailTemplateApplier.js +41 -0
- package/dist/composables/useGuidoStateBridge.js +48 -0
- package/dist/composables/useHtmlValidator.js +36 -41
- package/dist/composables/useRecommendation.js +2 -2
- package/dist/enums/extensions/recommendationBlock.js +41 -95
- package/dist/enums/unsubscribe.js +24 -25
- package/dist/extensions/Blocks/Checkbox/control.js +23 -23
- package/dist/extensions/Blocks/RadioButton/control.js +15 -15
- package/dist/extensions/Blocks/Recommendation/block.js +36 -43
- package/dist/extensions/Blocks/Recommendation/services/configService.js +26 -33
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +26 -35
- package/dist/guido.css +1 -1
- package/dist/src/components/organisms/header/AiStatusPill.vue.d.ts +2 -0
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +28 -0
- package/dist/src/composables/useEmailTemplateApplier.d.ts +21 -0
- package/dist/src/composables/useGuidoStateBridge.d.ts +22 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -5
- package/dist/src/enums/unsubscribe.d.ts +3 -8
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +3 -11
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -7
- package/dist/src/stores/ai-status.d.ts +41 -0
- package/dist/src/stores/guido-email-editor.d.ts +41 -0
- package/dist/stores/ai-status.js +25 -0
- package/dist/stores/guido-email-editor.js +20 -0
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +0 -33
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +0 -21
|
@@ -1,98 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
const u = {
|
|
1
|
+
const s = {
|
|
3
2
|
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
|
|
4
|
-
},
|
|
3
|
+
}, i = {
|
|
5
4
|
CLIENT_ID: "clientId"
|
|
6
|
-
},
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
name: e("action-builder.similar-bought"),
|
|
19
|
-
path: "purchased-together"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: 13,
|
|
23
|
-
key: "userBased",
|
|
24
|
-
name: e("action-builder.user-based"),
|
|
25
|
-
path: "user-based"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: 36,
|
|
29
|
-
key: "highestDiscounted",
|
|
30
|
-
name: e("journey-builder.highest-discounted-items"),
|
|
31
|
-
path: "highest-discounted"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: 38,
|
|
35
|
-
key: "manualMerchandising",
|
|
36
|
-
name: e("action-builder.manual-merchandising"),
|
|
37
|
-
path: "manual-merchandising"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
id: 39,
|
|
41
|
-
key: "newArrivals",
|
|
42
|
-
name: e("action-builder.new-arrivals"),
|
|
43
|
-
path: "new-arrivals"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
id: 40,
|
|
47
|
-
key: "trendingProducts",
|
|
48
|
-
name: e("journey-builder.trending-products"),
|
|
49
|
-
path: "trending"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
id: 46,
|
|
53
|
-
key: "mostValuableOfPartner",
|
|
54
|
-
name: e("journey-builder.most-valuable-products"),
|
|
55
|
-
path: "most-valuable"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
id: 61,
|
|
59
|
-
key: "mostPopular",
|
|
60
|
-
name: e("journey-builder.most-popular-items"),
|
|
61
|
-
path: "most-popular"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
id: 62,
|
|
65
|
-
key: "mostPurchased",
|
|
66
|
-
name: e("action-builder.most-purchased"),
|
|
67
|
-
path: "top-sellers"
|
|
68
|
-
}
|
|
69
|
-
];
|
|
70
|
-
}, d = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], m = [
|
|
5
|
+
}, u = [
|
|
6
|
+
{ id: 11, key: "similarViewed", name: "Viewed Together", path: "viewed-together" },
|
|
7
|
+
{ id: 12, key: "similarBought", name: "Purchased Together", path: "purchased-together" },
|
|
8
|
+
{ id: 13, key: "userBased", name: "User Based", path: "user-based" },
|
|
9
|
+
{ id: 36, key: "highestDiscounted", name: "Highest Discounted Items", path: "highest-discounted" },
|
|
10
|
+
{ id: 38, key: "manualMerchandising", name: "Manual Merchandising", path: "manual-merchandising" },
|
|
11
|
+
{ id: 39, key: "newArrivals", name: "New Arrivals", path: "new-arrivals" },
|
|
12
|
+
{ id: 40, key: "trendingProducts", name: "Trending Products", path: "trending" },
|
|
13
|
+
{ id: 46, key: "mostValuableOfPartner", name: "Most Valuable Products", path: "most-valuable" },
|
|
14
|
+
{ id: 61, key: "mostPopular", name: "Most Popular Items", path: "most-popular" },
|
|
15
|
+
{ id: 62, key: "mostPurchased", name: "Top Sellers", path: "top-sellers" }
|
|
16
|
+
], l = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], c = [
|
|
71
17
|
{ text: "before the amount", value: "0" },
|
|
72
18
|
{ text: "after the amount", value: "1" }
|
|
73
|
-
],
|
|
19
|
+
], d = [
|
|
74
20
|
{ text: "dot(.)", value: "." },
|
|
75
21
|
{ text: "comma(,)", value: "," },
|
|
76
22
|
{ text: "space( )", value: " " }
|
|
77
|
-
],
|
|
23
|
+
], p = [
|
|
78
24
|
{ text: "0", value: "0" },
|
|
79
25
|
{ text: "1", value: "1" },
|
|
80
26
|
{ text: "2", value: "2" },
|
|
81
27
|
{ text: "3", value: "3" },
|
|
82
28
|
{ text: "4", value: "4" },
|
|
83
29
|
{ text: "5", value: "5" }
|
|
84
|
-
],
|
|
30
|
+
], e = [
|
|
85
31
|
{ text: "is exactly", value: "=" },
|
|
86
32
|
{ text: "contains", value: "~" },
|
|
87
33
|
{ text: "does not contain", value: "!~" },
|
|
88
34
|
{ text: "any of", value: "||" }
|
|
89
|
-
],
|
|
35
|
+
], a = [
|
|
90
36
|
{ text: "is exactly", value: "=" },
|
|
91
37
|
{ text: "is not exactly", value: "!==" },
|
|
92
38
|
{ text: "contains", value: "~" },
|
|
93
39
|
{ text: "does not contain", value: "!~" },
|
|
94
40
|
{ text: "any of", value: "||" }
|
|
95
|
-
],
|
|
41
|
+
], r = [
|
|
96
42
|
{ text: "is equal to", value: "=" },
|
|
97
43
|
{ text: "is greater than", value: ">" },
|
|
98
44
|
{ text: "is less than", value: "<" }
|
|
@@ -100,39 +46,39 @@ const u = {
|
|
|
100
46
|
{ text: "is equal to", value: "=" },
|
|
101
47
|
{ text: "after", value: ">" },
|
|
102
48
|
{ text: "before", value: "<" }
|
|
103
|
-
],
|
|
49
|
+
], n = [
|
|
104
50
|
{ text: "true", value: "==" },
|
|
105
51
|
{ text: "false", value: "!=" }
|
|
106
|
-
],
|
|
107
|
-
if (!
|
|
108
|
-
return
|
|
109
|
-
switch (
|
|
52
|
+
], m = (t) => {
|
|
53
|
+
if (!t)
|
|
54
|
+
return e;
|
|
55
|
+
switch (t) {
|
|
110
56
|
case "Boolean":
|
|
111
|
-
return
|
|
57
|
+
return n;
|
|
112
58
|
case "Date":
|
|
113
59
|
return o;
|
|
114
60
|
case "Number":
|
|
115
|
-
return
|
|
61
|
+
return r;
|
|
116
62
|
case "String":
|
|
117
|
-
return
|
|
63
|
+
return e;
|
|
118
64
|
case "Strings":
|
|
119
|
-
return
|
|
65
|
+
return a;
|
|
120
66
|
default:
|
|
121
|
-
return
|
|
67
|
+
return e;
|
|
122
68
|
}
|
|
123
69
|
};
|
|
124
70
|
export {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
u as
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
71
|
+
l as PriceAttributes,
|
|
72
|
+
i as QUERY_PARAMS,
|
|
73
|
+
u as RecommendationFeedSourceMaps,
|
|
74
|
+
s as URLS,
|
|
75
|
+
p as currencyDecimalCounts,
|
|
76
|
+
c as currencyLocationMaps,
|
|
77
|
+
d as currencyOperators,
|
|
78
|
+
m as getOperatorOptions,
|
|
79
|
+
a as operatorOptionsForArrayOfStrings,
|
|
80
|
+
n as operatorOptionsForBooleans,
|
|
135
81
|
o as operatorOptionsForDates,
|
|
136
|
-
|
|
137
|
-
|
|
82
|
+
r as operatorOptionsForNumbers,
|
|
83
|
+
e as operatorOptionsForStrings
|
|
138
84
|
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { useTranslations as R } from "../composables/useTranslations.js";
|
|
2
|
-
import { ProductType as
|
|
2
|
+
import { ProductType as s } from "../@types/config/schemas.js";
|
|
3
3
|
import "../@types/config/defaults.js";
|
|
4
4
|
import { getEnvironmentPrefix as S } from "../utils/environmentUtil.js";
|
|
5
|
-
const
|
|
5
|
+
const B = {
|
|
6
6
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
7
7
|
PREFERENCES_LINK_TYPE: 3
|
|
8
|
-
},
|
|
8
|
+
}, i = {
|
|
9
9
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
10
10
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
11
11
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
12
12
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
13
|
-
},
|
|
14
|
-
UNSUBSCRIBE_URL: `https://mail.${
|
|
15
|
-
PREFERENCES_URL: `https://mail.${
|
|
13
|
+
}, n = S(), C = {
|
|
14
|
+
UNSUBSCRIBE_URL: `https://mail.${n}.com/user/v1/unsub`,
|
|
15
|
+
PREFERENCES_URL: `https://mail.${n}.com/user/v1/prefs`
|
|
16
16
|
}, U = {
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
},
|
|
21
|
-
name:
|
|
22
|
-
sendGridId:
|
|
23
|
-
}
|
|
17
|
+
[s.EMAIL]: "email",
|
|
18
|
+
[s.ARCHITECT]: "journey",
|
|
19
|
+
[s.UNSUBSCRIBE_PAGES]: "email"
|
|
20
|
+
}, t = "iid", o = {
|
|
21
|
+
name: "Global Unsubscribe",
|
|
22
|
+
sendGridId: "G"
|
|
23
|
+
}, c = "/email/unsubscribe-pages", E = {
|
|
24
24
|
GLOBAL_UNSUBSCRIBE: 1,
|
|
25
25
|
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
|
|
26
26
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
27
27
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
28
28
|
RESUBSCRIBE: 5
|
|
29
|
-
},
|
|
29
|
+
}, u = {
|
|
30
30
|
[E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
|
|
31
31
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
|
|
32
32
|
}, T = {
|
|
@@ -39,7 +39,7 @@ const i = {
|
|
|
39
39
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
40
40
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
41
41
|
]
|
|
42
|
-
},
|
|
42
|
+
}, b = () => {
|
|
43
43
|
const e = R();
|
|
44
44
|
return {
|
|
45
45
|
[E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
|
|
@@ -48,23 +48,22 @@ const i = {
|
|
|
48
48
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
|
|
49
49
|
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
50
50
|
};
|
|
51
|
-
},
|
|
51
|
+
}, P = {
|
|
52
52
|
default: "{{ins-unsubscribe-link}}",
|
|
53
53
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
54
54
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
55
55
|
};
|
|
56
56
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
o as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
58
|
+
t as INSIDER_ID,
|
|
59
|
+
i as LINK_REGEXES,
|
|
60
|
+
B as LINK_TYPES,
|
|
61
|
+
P as MERGE_TAGS,
|
|
62
62
|
E as PAGE_TYPES,
|
|
63
63
|
U as PRODUCT_TYPE_URL_SEGMENTS,
|
|
64
64
|
T as TYPE_COLLECTIONS,
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
c as UNSUBSCRIBE_PAGES_LINK,
|
|
66
|
+
u as UNSUBSCRIBE_SYNC_MODULE_TYPES,
|
|
67
67
|
C as URLS,
|
|
68
|
-
|
|
69
|
-
P as getTypeTranslations
|
|
68
|
+
b as getTypeTranslations
|
|
70
69
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var o = (
|
|
4
|
-
import { useHttp as
|
|
5
|
-
import {
|
|
6
|
-
import { Control as
|
|
7
|
-
const
|
|
8
|
-
class
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var l = (r, n, e) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
|
|
3
|
+
var o = (r, n, e) => l(r, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
import { useHttp as L } from "../../../composables/useHttp.js";
|
|
5
|
+
import { DEFAULT_UNSUBSCRIBE_GROUP as c } from "../../../enums/unsubscribe.js";
|
|
6
|
+
import { Control as h, UIElementType as i, UEAttr as t, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
+
const m = "ui-elements-checkbox", u = "select", { get: C } = L();
|
|
8
|
+
class S extends h {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
o(this, "currentNode");
|
|
@@ -13,13 +13,13 @@ class I extends p {
|
|
|
13
13
|
o(this, "unsubList", []);
|
|
14
14
|
}
|
|
15
15
|
getId() {
|
|
16
|
-
return
|
|
16
|
+
return m;
|
|
17
17
|
}
|
|
18
18
|
_setFormValues() {
|
|
19
19
|
if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
|
|
20
20
|
const e = this.currentNode.getAttribute("id");
|
|
21
21
|
if (e) {
|
|
22
|
-
const s = e ===
|
|
22
|
+
const s = e === c.sendGridId ? e : Number(e);
|
|
23
23
|
s && (this.selectedUnsubGroup = s);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -29,18 +29,18 @@ class I extends p {
|
|
|
29
29
|
}
|
|
30
30
|
_getLabel(e, s = `${Math.random()}`) {
|
|
31
31
|
return `
|
|
32
|
-
<${
|
|
32
|
+
<${i.LABEL}
|
|
33
33
|
${t.LABEL.text}="${e}"
|
|
34
34
|
${t.LABEL.name}="${s}">
|
|
35
|
-
</${
|
|
35
|
+
</${i.LABEL}>
|
|
36
36
|
`;
|
|
37
37
|
}
|
|
38
38
|
_getSelectItem(e, s) {
|
|
39
39
|
return `
|
|
40
|
-
<${
|
|
40
|
+
<${i.SELECT_ITEM}
|
|
41
41
|
${t.SELECT_ITEM.text}="${e}"
|
|
42
42
|
${t.SELECT_ITEM.value}="${s}">
|
|
43
|
-
</${
|
|
43
|
+
</${i.SELECT_ITEM}>`;
|
|
44
44
|
}
|
|
45
45
|
_getSelect() {
|
|
46
46
|
return this.unsubList.map((e) => this._getSelectItem(e.name, e.sendGridId)).join("");
|
|
@@ -49,22 +49,22 @@ class I extends p {
|
|
|
49
49
|
return `
|
|
50
50
|
<div class="checkbox-controls-container">
|
|
51
51
|
<div class="checkbox-select-container container two-columns stretch">
|
|
52
|
-
<${
|
|
52
|
+
<${i.LABEL}
|
|
53
53
|
${t.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
|
|
54
54
|
${t.LABEL.name}="${Math.random()}">
|
|
55
|
-
</${
|
|
55
|
+
</${i.LABEL}>
|
|
56
56
|
|
|
57
|
-
<${
|
|
57
|
+
<${i.SELECTPICKER}
|
|
58
58
|
${t.SELECTPICKER.name}="${u}"
|
|
59
59
|
${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
|
|
60
60
|
${this._getSelect()}
|
|
61
|
-
</${
|
|
61
|
+
</${i.SELECTPICKER}>
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
64
|
`;
|
|
65
65
|
}
|
|
66
66
|
_onSelectChange(e) {
|
|
67
|
-
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new
|
|
67
|
+
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
|
|
68
68
|
}
|
|
69
69
|
_listenToFormUpdates() {
|
|
70
70
|
this.api.onValueChanged(u, (e) => this._onSelectChange(e));
|
|
@@ -76,18 +76,18 @@ class I extends p {
|
|
|
76
76
|
async onRender() {
|
|
77
77
|
const e = await C(
|
|
78
78
|
"/unsubscribe-groups/unsubscribe-list"
|
|
79
|
-
), s = [
|
|
79
|
+
), s = [c, ...e.data], E = s.map((a) => ({
|
|
80
80
|
[t.SELECT_ITEM.text]: a.name,
|
|
81
81
|
[t.SELECT_ITEM.value]: a.sendGridId
|
|
82
82
|
}));
|
|
83
83
|
this.unsubList = s, this.api.setUIEAttribute(
|
|
84
84
|
u,
|
|
85
85
|
t.SELECTPICKER.items,
|
|
86
|
-
|
|
86
|
+
E
|
|
87
87
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
export {
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
m as CHECKBOX_CONTROL_BLOCK_ID,
|
|
92
|
+
S as CheckboxControl
|
|
93
93
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var o = (r, n, t) =>
|
|
4
|
-
import { useHttp as
|
|
5
|
-
import {
|
|
6
|
-
import { Control as
|
|
7
|
-
const
|
|
8
|
-
class
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var l = (r, n, t) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
|
|
3
|
+
var o = (r, n, t) => l(r, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { useHttp as L } from "../../../composables/useHttp.js";
|
|
5
|
+
import { DEFAULT_UNSUBSCRIBE_GROUP as c } from "../../../enums/unsubscribe.js";
|
|
6
|
+
import { Control as p, UIElementType as i, UEAttr as e, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
+
const m = "ui-elements-radio-button", u = "select", { get: $ } = L();
|
|
8
|
+
class S extends p {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
o(this, "currentNode");
|
|
@@ -13,13 +13,13 @@ class I extends h {
|
|
|
13
13
|
o(this, "unsubList", []);
|
|
14
14
|
}
|
|
15
15
|
getId() {
|
|
16
|
-
return
|
|
16
|
+
return m;
|
|
17
17
|
}
|
|
18
18
|
_setFormValues() {
|
|
19
19
|
if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
|
|
20
20
|
const t = this.currentNode.getAttribute("id");
|
|
21
21
|
if (t) {
|
|
22
|
-
const s = t ===
|
|
22
|
+
const s = t === c.sendGridId ? t : Number(t);
|
|
23
23
|
s && (this.selectedUnsubGroup = s);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -64,7 +64,7 @@ class I extends h {
|
|
|
64
64
|
`;
|
|
65
65
|
}
|
|
66
66
|
_onSelectChange(t) {
|
|
67
|
-
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new
|
|
67
|
+
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new h(`Updated text to ${t}`));
|
|
68
68
|
}
|
|
69
69
|
_listenToFormUpdates() {
|
|
70
70
|
this.api.onValueChanged(u, (t) => this._onSelectChange(t));
|
|
@@ -76,18 +76,18 @@ class I extends h {
|
|
|
76
76
|
async onRender() {
|
|
77
77
|
const t = await $(
|
|
78
78
|
"/unsubscribe-groups/unsubscribe-list"
|
|
79
|
-
), s = [
|
|
79
|
+
), s = [c, ...t.data], E = s.map((a) => ({
|
|
80
80
|
[e.SELECT_ITEM.text]: a.name,
|
|
81
81
|
[e.SELECT_ITEM.value]: a.sendGridId
|
|
82
82
|
}));
|
|
83
83
|
this.unsubList = s, this.api.setUIEAttribute(
|
|
84
84
|
u,
|
|
85
85
|
e.SELECTPICKER.items,
|
|
86
|
-
|
|
86
|
+
E
|
|
87
87
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
export {
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
m as CONTROL_BLOCK_ID,
|
|
92
|
+
S as RadioButtonControl
|
|
93
93
|
};
|
|
@@ -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
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var k = (r, n, t) => n in r ? I(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
|
|
3
|
+
var u = (r, n, t) => k(r, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { BlockId as _ } from "../../../enums/block.js";
|
|
5
|
+
import { getMigrationBannerHtml as B } from "../../../utils/migrationBannerHtml.js";
|
|
6
|
+
import { Block as b, BlockCompositionType as R, ModificationDescription as y } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
+
import { regenerateMobileProductRows as C } from "./controls/main/utils.js";
|
|
8
|
+
import { ensureMobileCssRulesExist as g, setMobileLayoutOptOut as d, hasMobileLayoutOptOut as A } from "./controls/mobileLayout/cssRules.js";
|
|
9
|
+
import { RecommendationConfigService as c } from "./services/configService.js";
|
|
10
|
+
import { useRecommendationExtensionStore as p } from "./store/recommendation.js";
|
|
11
11
|
import { getDefaultTemplate as E } from "./templates/grid/template.js";
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
class
|
|
12
|
+
const f = _.Recommendation, l = "recommendation-block-v2", m = "recommendation-id";
|
|
13
|
+
let h = !1;
|
|
14
|
+
class q extends b {
|
|
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
|
+
u(this, "_pendingBlockId", null);
|
|
22
22
|
}
|
|
23
23
|
getId() {
|
|
24
|
-
return
|
|
24
|
+
return f;
|
|
25
25
|
}
|
|
26
26
|
getIcon() {
|
|
27
27
|
return "recommendation-icon";
|
|
28
28
|
}
|
|
29
29
|
getBlockCompositionType() {
|
|
30
|
-
return
|
|
30
|
+
return R.CONTAINER;
|
|
31
31
|
}
|
|
32
32
|
getName() {
|
|
33
33
|
return this.api.translate("Recommendation Block");
|
|
@@ -38,8 +38,8 @@ class v extends R {
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
getSettingsPanelTitleHtml() {
|
|
41
|
-
return
|
|
42
|
-
|
|
41
|
+
return B(
|
|
42
|
+
f,
|
|
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
|
);
|
|
@@ -71,20 +71,13 @@ class v extends R {
|
|
|
71
71
|
return;
|
|
72
72
|
const i = this._pendingBlockId ?? this._generateNextId();
|
|
73
73
|
this._pendingBlockId = null, this._assignRecommendationId(t, i);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const u = this._getBlockElement(t);
|
|
82
|
-
u && (p(this.api, u, !0), A({
|
|
83
|
-
currentNode: t,
|
|
84
|
-
documentModifier: this.api.getDocumentModifier()
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
87
|
-
a.patchCurrentBlockConfig({ language: o.language }, { triggerRefetch: !1 });
|
|
74
|
+
const o = c.initializeConfig(this.api, t, { recommendationId: i }), s = p();
|
|
75
|
+
s.setCurrentBlock(i), g(this.api);
|
|
76
|
+
const a = this._getBlockElement(t);
|
|
77
|
+
a && (d(this.api, a, !0), C({
|
|
78
|
+
currentNode: t,
|
|
79
|
+
documentModifier: this.api.getDocumentModifier()
|
|
80
|
+
})), s.patchCurrentBlockConfig({ language: o.language }, { triggerRefetch: !1 });
|
|
88
81
|
}
|
|
89
82
|
/**
|
|
90
83
|
* Called when the document changes or template is loaded
|
|
@@ -97,20 +90,20 @@ class v extends R {
|
|
|
97
90
|
if (!(!t || !("getNodeConfig" in t))) {
|
|
98
91
|
if (!this._getRecommendationId(t)) {
|
|
99
92
|
const e = this._generateNextId();
|
|
100
|
-
this._assignRecommendationId(t, e),
|
|
93
|
+
this._assignRecommendationId(t, e), c.hasConfig(t) && c.updateConfig(
|
|
101
94
|
this.api,
|
|
102
95
|
t,
|
|
103
96
|
{ recommendationId: e },
|
|
104
97
|
"Assign recommendation ID to legacy block"
|
|
105
98
|
);
|
|
106
99
|
}
|
|
107
|
-
|
|
100
|
+
c.needsMigration(t) && this._migrateFromLegacy(t);
|
|
108
101
|
try {
|
|
109
|
-
|
|
110
|
-
const e =
|
|
102
|
+
h || (g(this.api), h = !0);
|
|
103
|
+
const e = c.getConfig(t), i = this._getBlockElement(t);
|
|
111
104
|
if (i) {
|
|
112
105
|
const o = !e.mobileLayoutEnabled;
|
|
113
|
-
|
|
106
|
+
A(i) !== o && d(this.api, i, o);
|
|
114
107
|
}
|
|
115
108
|
} catch {
|
|
116
109
|
}
|
|
@@ -124,7 +117,7 @@ class v extends R {
|
|
|
124
117
|
*/
|
|
125
118
|
onDelete(t) {
|
|
126
119
|
const e = this._getRecommendationId(t);
|
|
127
|
-
e &&
|
|
120
|
+
e && p().removeBlockState(e);
|
|
128
121
|
}
|
|
129
122
|
/**
|
|
130
123
|
* Generates the next unique recommendation ID by scanning all existing blocks
|
|
@@ -136,7 +129,7 @@ class v extends R {
|
|
|
136
129
|
const e = this.api.getDocumentRoot();
|
|
137
130
|
e && "querySelectorAll" in e && e.querySelectorAll(`.${l}`).forEach((o) => {
|
|
138
131
|
if ("getAttribute" in o) {
|
|
139
|
-
const
|
|
132
|
+
const s = o.getAttribute(m), a = s ? parseInt(s) : 0;
|
|
140
133
|
a > t && (t = a);
|
|
141
134
|
}
|
|
142
135
|
});
|
|
@@ -155,7 +148,7 @@ class v extends R {
|
|
|
155
148
|
if (!i)
|
|
156
149
|
return;
|
|
157
150
|
const o = this.api.getDocumentModifier();
|
|
158
|
-
o.modifyHtml(i).setAttribute(m, e.toString()), o.apply(new
|
|
151
|
+
o.modifyHtml(i).setAttribute(m, e.toString()), o.apply(new y(`Assign recommendation ID ${e}`));
|
|
159
152
|
}
|
|
160
153
|
/**
|
|
161
154
|
* Gets the recommendation-id from a block node
|
|
@@ -185,10 +178,10 @@ class v extends R {
|
|
|
185
178
|
* Migrate configuration from legacy format
|
|
186
179
|
*/
|
|
187
180
|
_migrateFromLegacy(t) {
|
|
188
|
-
|
|
181
|
+
c.migrateFromDataAttributes(this.api, t);
|
|
189
182
|
}
|
|
190
183
|
}
|
|
191
184
|
export {
|
|
192
|
-
|
|
193
|
-
|
|
185
|
+
f as BLOCK_ID,
|
|
186
|
+
q as RecommendationBlock
|
|
194
187
|
};
|