@useinsider/guido 3.2.0-beta.847c949 → 3.2.0-beta.8513411
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/composables/useRecommendation.js +2 -2
- package/dist/composables/useStripo.js +5 -5
- package/dist/enums/displayConditions.js +82 -78
- package/dist/enums/extensions/recommendationBlock.js +95 -41
- package/dist/enums/unsubscribe.js +25 -24
- 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 +38 -41
- package/dist/extensions/Blocks/Recommendation/services/configService.js +2 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +8 -8
- package/dist/services/templateLibraryApi.js +5 -4
- package/dist/src/enums/displayConditions.d.ts +5 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +5 -1
- package/dist/src/enums/unsubscribe.d.ts +8 -3
- package/dist/utils/pairProductVariables.js +89 -88
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getRecommendationFeedSourceMaps as g, URLS as p } from "../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { MinDeviceViewport as R, DefaultPadding as b } from "../enums/recommendation.js";
|
|
3
3
|
import { useRecommendationExtensionStore as u } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
4
|
import { generateCompleteFilterQuery as x } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
@@ -47,7 +47,7 @@ const N = () => ({
|
|
|
47
47
|
const n = u(), o = I(), a = Number(i), r = n.blockStates[a];
|
|
48
48
|
if (!r)
|
|
49
49
|
return "";
|
|
50
|
-
const { recommendationConfigs: e } = r, l = ((m = g.find((s) => s.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
50
|
+
const { recommendationConfigs: e } = r, l = ((m = g().find((s) => s.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
51
51
|
t.set("locale", e.language), t.set("currency", e.currencySettings.value), t.set("partnerName", o.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", o.variationId), e.strategy === "manualMerchandising" ? t.set("productId", e.productIds.join(",")) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
|
|
52
52
|
const f = e.filters.filter((s) => s.isValid), c = x(f);
|
|
53
53
|
c && t.set("filter", c), e.shuffleProducts && t.set("shuffle", "true");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
1
|
+
import { useActionsApi as A } from "./useActionsApi.js";
|
|
2
2
|
import { useBlocksConfig as I } from "./useBlocksConfig.js";
|
|
3
3
|
import { useConfig as P } from "./useConfig.js";
|
|
4
4
|
import { useCustomInterfaceAppearance as U } from "./useCustomInterfaceAppearance.js";
|
|
@@ -6,7 +6,7 @@ import { useFullStoryBridge as R } from "./useFullStoryBridge.js";
|
|
|
6
6
|
import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
|
|
7
7
|
import { useToaster as x } from "./useToaster.js";
|
|
8
8
|
import { localePatch as H } from "../config/i18n/index.js";
|
|
9
|
-
import {
|
|
9
|
+
import { getDisplayConditions as O } from "../enums/displayConditions.js";
|
|
10
10
|
import { useStripoApi as j } from "../services/stripoApi.js";
|
|
11
11
|
import L from "../static/styles/customEditorStyle.css.js";
|
|
12
12
|
import { useEditorStore as C } from "../stores/editor.js";
|
|
@@ -35,7 +35,7 @@ const ae = (E, l) => {
|
|
|
35
35
|
customViewStyles: L,
|
|
36
36
|
conditionsEnabled: f,
|
|
37
37
|
customConditionsEnabled: f,
|
|
38
|
-
conditionCategories: O,
|
|
38
|
+
conditionCategories: O(),
|
|
39
39
|
enableXSSSecurity: !0,
|
|
40
40
|
modulesDisabled: F,
|
|
41
41
|
syncModulesEnabled: s,
|
|
@@ -70,8 +70,8 @@ const ae = (E, l) => {
|
|
|
70
70
|
},
|
|
71
71
|
onTemplateLoaded() {
|
|
72
72
|
try {
|
|
73
|
-
const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate:
|
|
74
|
-
t(), n(),
|
|
73
|
+
const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: D } = A(), { injectFullStory: M } = R();
|
|
74
|
+
t(), n(), M(), D(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
75
75
|
e.hasChanges = !1;
|
|
76
76
|
}, 1e3);
|
|
77
77
|
} catch (t) {
|
|
@@ -1,80 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
1
|
+
import { useTranslations as i } from "../composables/useTranslations.js";
|
|
2
|
+
const t = () => {
|
|
3
|
+
const e = i();
|
|
4
|
+
return [
|
|
5
|
+
{
|
|
6
|
+
category: e("journey-builder.demographics"),
|
|
7
|
+
conditions: [
|
|
8
|
+
{
|
|
9
|
+
id: 1,
|
|
10
|
+
name: e("condition.language"),
|
|
11
|
+
description: e("journey-builder.display-condition-language-description"),
|
|
12
|
+
beforeScript: '{% if language == "en_US" %}',
|
|
13
|
+
afterScript: "{% endif %}"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: 2,
|
|
17
|
+
name: e("condition.country"),
|
|
18
|
+
description: e("journey-builder.display-condition-country-description"),
|
|
19
|
+
beforeScript: '{% if country == "Australia" %}',
|
|
20
|
+
afterScript: "{% endif %}"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 3,
|
|
24
|
+
name: e("stripo-editor.country-and-city"),
|
|
25
|
+
description: e("journey-builder.display-condition-country-city-description"),
|
|
26
|
+
beforeScript: '{% if country == "United Kingdom" and city == "London" %}',
|
|
27
|
+
afterScript: "{% endif %}"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 4,
|
|
31
|
+
name: e("stripo-editor.age-less-than-operator"),
|
|
32
|
+
description: e("journey-builder.display-condition-age-less-than"),
|
|
33
|
+
beforeScript: "{% if age < 18 %}",
|
|
34
|
+
afterScript: "{% endif %}"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 5,
|
|
38
|
+
name: e("stripo-editor.age-equal-greater-operator"),
|
|
39
|
+
description: e("journey-builder.display-condition-age-equal-greater"),
|
|
40
|
+
beforeScript: "{% if age >= 25 %}",
|
|
41
|
+
afterScript: "{% endif %}"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 6,
|
|
45
|
+
name: e("stripo-editor.age-greater-less-operators"),
|
|
46
|
+
description: e("journey-builder.display-condition-age-between"),
|
|
47
|
+
beforeScript: "{% if age > 18 and age < 25 %}",
|
|
48
|
+
afterScript: "{% endif %}"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 7,
|
|
52
|
+
name: e("condition.gender"),
|
|
53
|
+
description: e("journey-builder.display-condition-gender-female"),
|
|
54
|
+
beforeScript: '{% if gender == "Female" %}',
|
|
55
|
+
afterScript: "{% endif %}"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 8,
|
|
59
|
+
name: e("journey-builder.state"),
|
|
60
|
+
description: e("stripo-editor.state-description"),
|
|
61
|
+
beforeScript: '{% if c_state == "VIC" or c_state == "NSW" or c_state == "QLD" %}',
|
|
62
|
+
afterScript: "{% endif %}"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 9,
|
|
66
|
+
name: e("journey-builder.vip-user"),
|
|
67
|
+
description: e("stripo-editor.vip-user-description"),
|
|
68
|
+
beforeScript: "{% if c_is_vip_user %}",
|
|
69
|
+
afterScript: "{% endif %}"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 10,
|
|
73
|
+
name: e("journey-builder.membership-type"),
|
|
74
|
+
description: e("stripo-editor.membership-type-description"),
|
|
75
|
+
beforeScript: "{% if c_is_gold_member or c_is_silver_member %}",
|
|
76
|
+
afterScript: "{% endif %}"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
};
|
|
78
82
|
export {
|
|
79
|
-
|
|
83
|
+
t as getDisplayConditions
|
|
80
84
|
};
|
|
@@ -1,43 +1,97 @@
|
|
|
1
|
-
|
|
1
|
+
import { useTranslations as a } from "../../composables/useTranslations.js";
|
|
2
|
+
const u = {
|
|
2
3
|
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
|
|
3
|
-
},
|
|
4
|
+
}, l = {
|
|
4
5
|
CLIENT_ID: "clientId"
|
|
5
|
-
},
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
}, c = () => {
|
|
7
|
+
const e = a();
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
id: 11,
|
|
11
|
+
key: "similarViewed",
|
|
12
|
+
name: e("action-builder.similar-viewed"),
|
|
13
|
+
path: "viewed-together"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: 12,
|
|
17
|
+
key: "similarBought",
|
|
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 = [
|
|
17
71
|
{ text: "before the amount", value: "0" },
|
|
18
72
|
{ text: "after the amount", value: "1" }
|
|
19
|
-
],
|
|
73
|
+
], p = [
|
|
20
74
|
{ text: "dot(.)", value: "." },
|
|
21
75
|
{ text: "comma(,)", value: "," }
|
|
22
|
-
],
|
|
76
|
+
], v = [
|
|
23
77
|
{ text: "0", value: "0" },
|
|
24
78
|
{ text: "1", value: "1" },
|
|
25
79
|
{ text: "2", value: "2" },
|
|
26
80
|
{ text: "3", value: "3" },
|
|
27
81
|
{ text: "4", value: "4" },
|
|
28
82
|
{ text: "5", value: "5" }
|
|
29
|
-
],
|
|
83
|
+
], t = [
|
|
30
84
|
{ text: "is exactly", value: "=" },
|
|
31
85
|
{ text: "contains", value: "~" },
|
|
32
86
|
{ text: "does not contain", value: "!~" },
|
|
33
87
|
{ text: "any of", value: "||" }
|
|
34
|
-
],
|
|
88
|
+
], r = [
|
|
35
89
|
{ text: "is exactly", value: "=" },
|
|
36
90
|
{ text: "is not exactly", value: "!==" },
|
|
37
91
|
{ text: "contains", value: "~" },
|
|
38
92
|
{ text: "does not contain", value: "!~" },
|
|
39
93
|
{ text: "any of", value: "||" }
|
|
40
|
-
],
|
|
94
|
+
], n = [
|
|
41
95
|
{ text: "is equal to", value: "=" },
|
|
42
96
|
{ text: "is greater than", value: ">" },
|
|
43
97
|
{ text: "is less than", value: "<" }
|
|
@@ -45,39 +99,39 @@ const s = {
|
|
|
45
99
|
{ text: "is equal to", value: "=" },
|
|
46
100
|
{ text: "after", value: ">" },
|
|
47
101
|
{ text: "before", value: "<" }
|
|
48
|
-
],
|
|
102
|
+
], s = [
|
|
49
103
|
{ text: "true", value: "==" },
|
|
50
104
|
{ text: "false", value: "!=" }
|
|
51
|
-
],
|
|
52
|
-
if (!
|
|
53
|
-
return
|
|
54
|
-
switch (
|
|
105
|
+
], h = (e) => {
|
|
106
|
+
if (!e)
|
|
107
|
+
return t;
|
|
108
|
+
switch (e) {
|
|
55
109
|
case "Boolean":
|
|
56
|
-
return
|
|
110
|
+
return s;
|
|
57
111
|
case "Date":
|
|
58
112
|
return o;
|
|
59
113
|
case "Number":
|
|
60
|
-
return
|
|
114
|
+
return n;
|
|
61
115
|
case "String":
|
|
62
|
-
return
|
|
116
|
+
return t;
|
|
63
117
|
case "Strings":
|
|
64
|
-
return
|
|
118
|
+
return r;
|
|
65
119
|
default:
|
|
66
|
-
return
|
|
120
|
+
return t;
|
|
67
121
|
}
|
|
68
122
|
};
|
|
69
123
|
export {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
u as
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
124
|
+
d as PriceAttributes,
|
|
125
|
+
l as QUERY_PARAMS,
|
|
126
|
+
u as URLS,
|
|
127
|
+
v as currencyDecimalCounts,
|
|
128
|
+
m as currencyLocationMaps,
|
|
129
|
+
p as currencyOperators,
|
|
130
|
+
h as getOperatorOptions,
|
|
131
|
+
c as getRecommendationFeedSourceMaps,
|
|
132
|
+
r as operatorOptionsForArrayOfStrings,
|
|
133
|
+
s as operatorOptionsForBooleans,
|
|
80
134
|
o as operatorOptionsForDates,
|
|
81
|
-
|
|
82
|
-
|
|
135
|
+
n as operatorOptionsForNumbers,
|
|
136
|
+
t as operatorOptionsForStrings
|
|
83
137
|
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { useTranslations as R } from "../composables/useTranslations.js";
|
|
2
|
-
import { ProductType as
|
|
2
|
+
import { ProductType as n } 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 i = {
|
|
6
6
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
7
7
|
PREFERENCES_LINK_TYPE: 3
|
|
8
|
-
},
|
|
8
|
+
}, B = {
|
|
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
|
+
}, s = S(), C = {
|
|
14
|
+
UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
|
|
15
|
+
PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
|
|
16
16
|
}, U = {
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
},
|
|
21
|
-
name: "
|
|
22
|
-
sendGridId:
|
|
23
|
-
},
|
|
17
|
+
[n.EMAIL]: "email",
|
|
18
|
+
[n.ARCHITECT]: "journey",
|
|
19
|
+
[n.UNSUBSCRIBE_PAGES]: "email"
|
|
20
|
+
}, o = "iid", r = "G", c = () => ({
|
|
21
|
+
name: R()("onboarding-center.email-subscribers-global-unsub-card-title"),
|
|
22
|
+
sendGridId: r
|
|
23
|
+
}), u = "/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
|
+
}, b = {
|
|
30
30
|
[E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
|
|
31
31
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
|
|
32
32
|
}, T = {
|
|
@@ -39,7 +39,7 @@ const B = {
|
|
|
39
39
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
40
40
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
41
41
|
]
|
|
42
|
-
},
|
|
42
|
+
}, P = () => {
|
|
43
43
|
const e = R();
|
|
44
44
|
return {
|
|
45
45
|
[E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
|
|
@@ -48,22 +48,23 @@ const B = {
|
|
|
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
|
+
}, O = {
|
|
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
|
+
r as DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID,
|
|
58
|
+
o as INSIDER_ID,
|
|
59
|
+
B as LINK_REGEXES,
|
|
60
|
+
i as LINK_TYPES,
|
|
61
|
+
O 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
|
+
u as UNSUBSCRIBE_PAGES_LINK,
|
|
66
|
+
b as UNSUBSCRIBE_SYNC_MODULE_TYPES,
|
|
67
67
|
C as URLS,
|
|
68
|
-
|
|
68
|
+
c as getDefaultUnsubscribeGroup,
|
|
69
|
+
P as getTypeTranslations
|
|
69
70
|
};
|
|
@@ -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 E = Object.defineProperty;
|
|
2
|
+
var d = (i, n, e) => n in i ? E(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
|
|
3
|
+
var o = (i, n, e) => d(i, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
import { useHttp as l } from "../../../composables/useHttp.js";
|
|
5
|
+
import { getDefaultUnsubscribeGroup as L, DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID as h } from "../../../enums/unsubscribe.js";
|
|
6
|
+
import { Control as p, UIElementType as r, UEAttr as t, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
+
const b = "ui-elements-checkbox", u = "select", { get: C } = l();
|
|
8
|
+
class I extends p {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
o(this, "currentNode");
|
|
@@ -13,13 +13,13 @@ class S extends h {
|
|
|
13
13
|
o(this, "unsubList", []);
|
|
14
14
|
}
|
|
15
15
|
getId() {
|
|
16
|
-
return
|
|
16
|
+
return b;
|
|
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 === h ? e : Number(e);
|
|
23
23
|
s && (this.selectedUnsubGroup = s);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -29,18 +29,18 @@ class S extends h {
|
|
|
29
29
|
}
|
|
30
30
|
_getLabel(e, s = `${Math.random()}`) {
|
|
31
31
|
return `
|
|
32
|
-
<${
|
|
32
|
+
<${r.LABEL}
|
|
33
33
|
${t.LABEL.text}="${e}"
|
|
34
34
|
${t.LABEL.name}="${s}">
|
|
35
|
-
</${
|
|
35
|
+
</${r.LABEL}>
|
|
36
36
|
`;
|
|
37
37
|
}
|
|
38
38
|
_getSelectItem(e, s) {
|
|
39
39
|
return `
|
|
40
|
-
<${
|
|
40
|
+
<${r.SELECT_ITEM}
|
|
41
41
|
${t.SELECT_ITEM.text}="${e}"
|
|
42
42
|
${t.SELECT_ITEM.value}="${s}">
|
|
43
|
-
</${
|
|
43
|
+
</${r.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 S extends h {
|
|
|
49
49
|
return `
|
|
50
50
|
<div class="checkbox-controls-container">
|
|
51
51
|
<div class="checkbox-select-container container two-columns stretch">
|
|
52
|
-
<${
|
|
52
|
+
<${r.LABEL}
|
|
53
53
|
${t.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
|
|
54
54
|
${t.LABEL.name}="${Math.random()}">
|
|
55
|
-
</${
|
|
55
|
+
</${r.LABEL}>
|
|
56
56
|
|
|
57
|
-
<${
|
|
57
|
+
<${r.SELECTPICKER}
|
|
58
58
|
${t.SELECTPICKER.name}="${u}"
|
|
59
59
|
${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
|
|
60
60
|
${this._getSelect()}
|
|
61
|
-
</${
|
|
61
|
+
</${r.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 m(`Updated text to ${e}`));
|
|
68
68
|
}
|
|
69
69
|
_listenToFormUpdates() {
|
|
70
70
|
this.api.onValueChanged(u, (e) => this._onSelectChange(e));
|
|
@@ -76,18 +76,18 @@ class S extends h {
|
|
|
76
76
|
async onRender() {
|
|
77
77
|
const e = await C(
|
|
78
78
|
"/unsubscribe-groups/unsubscribe-list"
|
|
79
|
-
), s = [
|
|
79
|
+
), s = [L(), ...e.data], c = 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
|
+
c
|
|
87
87
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
export {
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
b as CHECKBOX_CONTROL_BLOCK_ID,
|
|
92
|
+
I 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 E = Object.defineProperty;
|
|
2
|
+
var d = (r, n, t) => n in r ? E(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
|
|
3
|
+
var o = (r, n, t) => d(r, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { useHttp as l } from "../../../composables/useHttp.js";
|
|
5
|
+
import { getDefaultUnsubscribeGroup as L, DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID as p } from "../../../enums/unsubscribe.js";
|
|
6
|
+
import { Control as h, UIElementType as i, UEAttr as e, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
+
const b = "ui-elements-radio-button", u = "select", { get: $ } = l();
|
|
8
|
+
class I extends h {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
o(this, "currentNode");
|
|
@@ -13,13 +13,13 @@ class S extends p {
|
|
|
13
13
|
o(this, "unsubList", []);
|
|
14
14
|
}
|
|
15
15
|
getId() {
|
|
16
|
-
return
|
|
16
|
+
return b;
|
|
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 === p ? t : Number(t);
|
|
23
23
|
s && (this.selectedUnsubGroup = s);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -64,7 +64,7 @@ class S extends p {
|
|
|
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 m(`Updated text to ${t}`));
|
|
68
68
|
}
|
|
69
69
|
_listenToFormUpdates() {
|
|
70
70
|
this.api.onValueChanged(u, (t) => this._onSelectChange(t));
|
|
@@ -76,18 +76,18 @@ class S extends p {
|
|
|
76
76
|
async onRender() {
|
|
77
77
|
const t = await $(
|
|
78
78
|
"/unsubscribe-groups/unsubscribe-list"
|
|
79
|
-
), s = [
|
|
79
|
+
), s = [L(), ...t.data], c = 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
|
+
c
|
|
87
87
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
export {
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
b as CONTROL_BLOCK_ID,
|
|
92
|
+
I as RadioButtonControl
|
|
93
93
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var k = Object.defineProperty;
|
|
2
|
-
var I = (
|
|
3
|
-
var u = (
|
|
2
|
+
var I = (r, n, t) => n in r ? k(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
|
|
3
|
+
var u = (r, n, t) => I(r, typeof n != "symbol" ? n + "" : n, t);
|
|
4
4
|
import { BlockId as B } from "../../../enums/block.js";
|
|
5
5
|
import { getMigrationBannerHtml as _ } from "../../../utils/migrationBannerHtml.js";
|
|
6
|
-
import { Block as b, BlockCompositionType as R, ModificationDescription as
|
|
7
|
-
import { regenerateMobileProductRows as
|
|
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
8
|
import { ensureMobileCssRulesExist as g, setMobileLayoutOptOut as d, hasMobileLayoutOptOut as A } from "./controls/mobileLayout/cssRules.js";
|
|
9
|
-
import { RecommendationConfigService as
|
|
9
|
+
import { RecommendationConfigService as c } from "./services/configService.js";
|
|
10
10
|
import { useRecommendationExtensionStore as p } from "./store/recommendation.js";
|
|
11
|
-
import { getDefaultTemplate as
|
|
12
|
-
const f = B.Recommendation,
|
|
11
|
+
import { getDefaultTemplate as E } from "./templates/grid/template.js";
|
|
12
|
+
const f = B.Recommendation, a = "recommendation-block-v2", l = "recommendation-id";
|
|
13
13
|
let h = !1;
|
|
14
14
|
class q extends b {
|
|
15
15
|
constructor() {
|
|
@@ -56,7 +56,7 @@ class q extends b {
|
|
|
56
56
|
*/
|
|
57
57
|
getTemplate() {
|
|
58
58
|
const t = this._generateNextId();
|
|
59
|
-
return this._pendingBlockId = t,
|
|
59
|
+
return this._pendingBlockId = t, E(t);
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Called when a new block is dropped into the template
|
|
@@ -66,18 +66,15 @@ class q extends b {
|
|
|
66
66
|
* @param node - The newly created block node
|
|
67
67
|
*/
|
|
68
68
|
onCreated(t) {
|
|
69
|
-
const e =
|
|
70
|
-
this._pendingBlockId = null, this._assignRecommendationId(t,
|
|
71
|
-
const o =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
c.patchCurrentBlockConfig({ language: o.language }, { triggerRefetch: !1 });
|
|
69
|
+
const e = this._pendingBlockId ?? this._generateNextId();
|
|
70
|
+
this._pendingBlockId = null, this._assignRecommendationId(t, e);
|
|
71
|
+
const o = c.initializeConfig(this.api, t, { recommendationId: e }), i = p();
|
|
72
|
+
i.setCurrentBlock(e), g(this.api);
|
|
73
|
+
const s = this._getBlockElement(t);
|
|
74
|
+
s && (d(this.api, s, !0), C({
|
|
75
|
+
currentNode: t,
|
|
76
|
+
documentModifier: this.api.getDocumentModifier()
|
|
77
|
+
})), i.patchCurrentBlockConfig({ language: o.language }, { triggerRefetch: !1 });
|
|
81
78
|
}
|
|
82
79
|
/**
|
|
83
80
|
* Called when the document changes or template is loaded
|
|
@@ -90,20 +87,20 @@ class q extends b {
|
|
|
90
87
|
if (!(!t || !("getNodeConfig" in t))) {
|
|
91
88
|
if (!this._getRecommendationId(t)) {
|
|
92
89
|
const e = this._generateNextId();
|
|
93
|
-
this._assignRecommendationId(t, e),
|
|
90
|
+
this._assignRecommendationId(t, e), c.hasConfig(t) && c.updateConfig(
|
|
94
91
|
this.api,
|
|
95
92
|
t,
|
|
96
93
|
{ recommendationId: e },
|
|
97
94
|
"Assign recommendation ID to legacy block"
|
|
98
95
|
);
|
|
99
96
|
}
|
|
100
|
-
|
|
97
|
+
c.needsMigration(t) && this._migrateFromLegacy(t);
|
|
101
98
|
try {
|
|
102
99
|
h || (g(this.api), h = !0);
|
|
103
|
-
const e =
|
|
104
|
-
if (
|
|
105
|
-
const
|
|
106
|
-
A(
|
|
100
|
+
const e = c.getConfig(t), o = this._getBlockElement(t);
|
|
101
|
+
if (o) {
|
|
102
|
+
const i = !e.mobileLayoutEnabled;
|
|
103
|
+
A(o) !== i && d(this.api, o, i);
|
|
107
104
|
}
|
|
108
105
|
} catch {
|
|
109
106
|
}
|
|
@@ -127,10 +124,10 @@ class q extends b {
|
|
|
127
124
|
let t = 0;
|
|
128
125
|
try {
|
|
129
126
|
const e = this.api.getDocumentRoot();
|
|
130
|
-
e && "querySelectorAll" in e && e.querySelectorAll(`.${
|
|
131
|
-
if ("getAttribute" in
|
|
132
|
-
const
|
|
133
|
-
|
|
127
|
+
e && "querySelectorAll" in e && e.querySelectorAll(`.${a}`).forEach((i) => {
|
|
128
|
+
if ("getAttribute" in i) {
|
|
129
|
+
const s = i.getAttribute(l), m = s ? parseInt(s) : 0;
|
|
130
|
+
m > t && (t = m);
|
|
134
131
|
}
|
|
135
132
|
});
|
|
136
133
|
} catch {
|
|
@@ -144,11 +141,11 @@ class q extends b {
|
|
|
144
141
|
* added classes via setAttribute.
|
|
145
142
|
*/
|
|
146
143
|
_assignRecommendationId(t, e) {
|
|
147
|
-
const
|
|
148
|
-
if (!
|
|
144
|
+
const o = this._getBlockElement(t);
|
|
145
|
+
if (!o)
|
|
149
146
|
return;
|
|
150
|
-
const
|
|
151
|
-
|
|
147
|
+
const i = this.api.getDocumentModifier();
|
|
148
|
+
i.modifyHtml(o).setAttribute(l, e.toString()), i.apply(new y(`Assign recommendation ID ${e}`));
|
|
152
149
|
}
|
|
153
150
|
/**
|
|
154
151
|
* Gets the recommendation-id from a block node
|
|
@@ -157,11 +154,11 @@ class q extends b {
|
|
|
157
154
|
const e = this._getBlockElement(t);
|
|
158
155
|
if (!e || !("getAttribute" in e))
|
|
159
156
|
return null;
|
|
160
|
-
const
|
|
161
|
-
if (!
|
|
157
|
+
const o = e.getAttribute(l);
|
|
158
|
+
if (!o)
|
|
162
159
|
return null;
|
|
163
|
-
const
|
|
164
|
-
return Number.isNaN(
|
|
160
|
+
const i = parseInt(o);
|
|
161
|
+
return Number.isNaN(i) ? null : i;
|
|
165
162
|
}
|
|
166
163
|
/**
|
|
167
164
|
* Gets the block element (the element with BLOCK_CLASS)
|
|
@@ -169,16 +166,16 @@ class q extends b {
|
|
|
169
166
|
_getBlockElement(t) {
|
|
170
167
|
if ("getAttribute" in t) {
|
|
171
168
|
const e = t.getAttribute("class");
|
|
172
|
-
if (e && e.includes(
|
|
169
|
+
if (e && e.includes(a))
|
|
173
170
|
return t;
|
|
174
171
|
}
|
|
175
|
-
return "querySelector" in t ? t.querySelector(`.${
|
|
172
|
+
return "querySelector" in t ? t.querySelector(`.${a}`) ?? null : null;
|
|
176
173
|
}
|
|
177
174
|
/**
|
|
178
175
|
* Migrate configuration from legacy format
|
|
179
176
|
*/
|
|
180
177
|
_migrateFromLegacy(t) {
|
|
181
|
-
|
|
178
|
+
c.migrateFromDataAttributes(this.api, t);
|
|
182
179
|
}
|
|
183
180
|
}
|
|
184
181
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModificationDescription as f } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { CURRENT_CONFIG_VERSION as u, DEFAULT_NODE_CONFIG as e } from "../constants/defaultConfig.js";
|
|
3
3
|
import { setCurrencyAttributes as g } from "../controls/main/utils.js";
|
|
4
|
-
import { hasMinimalConfig as
|
|
4
|
+
import { hasMinimalConfig as a } from "../types/nodeConfig.js";
|
|
5
5
|
class C {
|
|
6
6
|
// ========================================================================
|
|
7
7
|
// Read Operations
|
|
@@ -42,7 +42,7 @@ class C {
|
|
|
42
42
|
return !1;
|
|
43
43
|
try {
|
|
44
44
|
const t = i.getNodeConfig();
|
|
45
|
-
return
|
|
45
|
+
return a(t);
|
|
46
46
|
} catch {
|
|
47
47
|
return !1;
|
|
48
48
|
}
|
|
@@ -94,8 +94,6 @@ class C {
|
|
|
94
94
|
* @returns The initialized configuration
|
|
95
95
|
*/
|
|
96
96
|
static initializeConfig(i, t, o) {
|
|
97
|
-
if (this.hasConfig(t))
|
|
98
|
-
return o ? this.updateConfig(i, t, o, "Initialize recommendation block") : this.getConfig(t);
|
|
99
97
|
const n = o ? this.mergeWithDefaults(o) : this.cloneDefaults();
|
|
100
98
|
return this.saveConfig(i, t, n, "Initialize recommendation block"), g({
|
|
101
99
|
currentNode: t,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as k } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { useRecommendationApi as C } from "../../../../services/recommendationApi.js";
|
|
3
3
|
import { useConfigStore as y } from "../../../../stores/config.js";
|
|
4
4
|
import { defineStore as G } from "pinia";
|
|
@@ -113,12 +113,12 @@ const v = () => ({
|
|
|
113
113
|
return [...new Set(t.map((r) => r.filterGroup))].sort((r, e) => r - e);
|
|
114
114
|
},
|
|
115
115
|
getActivePredictiveAlgorithms: (t) => {
|
|
116
|
-
const r = [];
|
|
117
|
-
return t.activePredictiveAlgorithms.filter((
|
|
118
|
-
|
|
119
|
-
}),
|
|
120
|
-
text:
|
|
121
|
-
value:
|
|
116
|
+
const r = g(), e = [];
|
|
117
|
+
return t.activePredictiveAlgorithms.filter((n) => !w.includes(n)).forEach((n) => {
|
|
118
|
+
e.push(...r.filter((c) => c.id === n));
|
|
119
|
+
}), e.map((n) => ({
|
|
120
|
+
text: n.name,
|
|
121
|
+
value: n.key
|
|
122
122
|
}));
|
|
123
123
|
},
|
|
124
124
|
getLanguages: (t) => Object.entries(t.languages).map(([r, e]) => ({
|
|
@@ -379,7 +379,7 @@ const v = () => ({
|
|
|
379
379
|
},
|
|
380
380
|
async _doFetchProducts() {
|
|
381
381
|
var p;
|
|
382
|
-
const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((a) => a.isValid), c = b(n), i = ((p = g.find((a) => a.key === e.strategy)) == null ? void 0 : p.path) || "", o = y(), s = {
|
|
382
|
+
const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((a) => a.isValid), c = b(n), i = ((p = g().find((a) => a.key === e.strategy)) == null ? void 0 : p.path) || "", o = y(), s = {
|
|
383
383
|
locale: e.language,
|
|
384
384
|
currency: e.currencySettings.value,
|
|
385
385
|
partnerName: o.partnerName,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useConfig as w } from "../composables/useConfig.js";
|
|
2
2
|
import { useHttp as b } from "../composables/useHttp.js";
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { useTranslations as
|
|
3
|
+
import { useToaster as C } from "../composables/useToaster.js";
|
|
4
|
+
import { useTranslations as h } from "../composables/useTranslations.js";
|
|
5
5
|
import { useLiquidValidator as S } from "../composables/validators/useLiquidValidator.js";
|
|
6
6
|
import { EditorType as v } from "../enums/defaults.js";
|
|
7
7
|
import { useRecommendationExtensionStore as N } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
@@ -9,7 +9,7 @@ import { useSaveAsTemplateStore as x } from "../stores/save-as-template.js";
|
|
|
9
9
|
import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
|
|
10
10
|
import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
|
|
11
11
|
const $ = () => {
|
|
12
|
-
const { get: n, post: m } = b(), { handleError: o, showToaster: l } =
|
|
12
|
+
const { get: n, post: m } = b(), { handleError: o, showToaster: l } = C(), { config: c, isFeatureEnabled: p } = w(), { validateLiquidSyntax: g } = S(), u = h();
|
|
13
13
|
return {
|
|
14
14
|
getCategories: async () => {
|
|
15
15
|
try {
|
|
@@ -62,7 +62,8 @@ const $ = () => {
|
|
|
62
62
|
stripoConfig: r({
|
|
63
63
|
editor: "stripo",
|
|
64
64
|
html: a.rawHtml,
|
|
65
|
-
css: a.css
|
|
65
|
+
css: a.css,
|
|
66
|
+
dynamicContentList: a.dynamicContentList
|
|
66
67
|
})
|
|
67
68
|
}, { data: { type: T } } = await m(
|
|
68
69
|
"/newsletter/template-library/create-template",
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { ConditionCategories } from '@@/Types/condition-categories';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Get display conditions lazily so translations resolve at access time.
|
|
4
|
+
* Must be called within a Vue component context or after Pinia is initialized.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getDisplayConditions: () => ConditionCategories;
|
|
@@ -6,7 +6,11 @@ export declare const URLS: {
|
|
|
6
6
|
export declare const QUERY_PARAMS: {
|
|
7
7
|
CLIENT_ID: string;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Get recommendation feed source maps lazily so translated names resolve at access time.
|
|
11
|
+
* Must be called within a Vue component context or after Pinia is initialized.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getRecommendationFeedSourceMaps: () => RecommendationFeedItem[];
|
|
10
14
|
export declare const PriceAttributes: string[];
|
|
11
15
|
export declare const currencyLocationMaps: TextValueObject[];
|
|
12
16
|
export declare const currencyOperators: TextValueObject[];
|
|
@@ -18,9 +18,14 @@ export declare const PRODUCT_TYPE_URL_SEGMENTS: {
|
|
|
18
18
|
readonly 97: "email";
|
|
19
19
|
};
|
|
20
20
|
export declare const INSIDER_ID = "iid";
|
|
21
|
-
export declare const
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
export declare const DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID = "G";
|
|
22
|
+
/**
|
|
23
|
+
* Get the default unsubscribe group lazily so the translated name resolves at access time.
|
|
24
|
+
* Must be called within a Vue component context or after Pinia is initialized.
|
|
25
|
+
*/
|
|
26
|
+
export declare const getDefaultUnsubscribeGroup: () => {
|
|
27
|
+
name: string;
|
|
28
|
+
sendGridId: string;
|
|
24
29
|
};
|
|
25
30
|
export declare const UNSUBSCRIBE_PAGES_LINK = "/email/unsubscribe-pages";
|
|
26
31
|
export declare const PAGE_TYPES: {
|
|
@@ -1,84 +1,85 @@
|
|
|
1
|
-
import { productPairs as
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
Object.entries(
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
switch (
|
|
1
|
+
import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
2
|
+
function q(w) {
|
|
3
|
+
const y = w.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), T = new DOMParser().parseFromString(y, "text/html"), C = L.PAIRS_FOR_EXTENSION;
|
|
4
|
+
Object.entries(C).forEach(([r, f]) => {
|
|
5
|
+
T.querySelectorAll(".ins-product-td").forEach((o) => {
|
|
6
|
+
const A = o.getAttribute("data-number") || "1", b = o.getAttribute("data-type") || "CART_ITEMS";
|
|
7
|
+
o.querySelectorAll(`[product-attr="${r}"]`).forEach((e) => {
|
|
8
|
+
var k, F, I;
|
|
9
|
+
const $ = e.getAttribute("data-type") || b, d = e.getAttribute("data-number") || A, u = f[$];
|
|
10
|
+
if (u)
|
|
11
|
+
switch (r) {
|
|
12
12
|
case "imageSrc": {
|
|
13
|
-
let t = null,
|
|
14
|
-
if (e.tagName === "IMG" ? (t = e,
|
|
13
|
+
let t = null, i = null;
|
|
14
|
+
if (e.tagName === "IMG" ? (t = e, i = t.closest("a")) : (t = e.querySelector("img"), i = e.querySelector("a") || e.closest("a")), !t)
|
|
15
15
|
break;
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
}) && (t.src = `{{${
|
|
16
|
+
const a = u.DEFAULT, s = u.ATTR;
|
|
17
|
+
if (a && t.src) {
|
|
18
|
+
const c = t.src;
|
|
19
|
+
a.some((h) => {
|
|
20
|
+
const l = h.split("/").pop() || "", g = c.split("/").pop() || "";
|
|
21
|
+
return c.includes(h) || c.includes(l) || g === l;
|
|
22
|
+
}) && (t.src = `{{${s}_${d}}}`);
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
const n = (F = (k = C.name) == null ? void 0 : k[$]) == null ? void 0 : F.ATTR;
|
|
25
|
+
if (n && t.setAttribute("alt", `{{${n}_${d}}}`), i) {
|
|
26
|
+
const c = (I = C.itemLink) == null ? void 0 : I[$];
|
|
27
|
+
if (c) {
|
|
28
|
+
const E = c.HREF, h = c.DEFAULT_HREF || "#!", l = i.href;
|
|
29
|
+
(l === "#" || l === "" || l.endsWith("#!") || l.endsWith(h) || l === `${window.location.href}${h}` || !l || l === window.location.href) && (i.href = `{{${E}_${d}}}`);
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
break;
|
|
32
33
|
}
|
|
33
34
|
case "name": {
|
|
34
|
-
const t =
|
|
35
|
-
e.textContent && (e.textContent = `{{${
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
(
|
|
35
|
+
const t = u, i = t.ATTR, a = t.DEFAULT_HREF || "#!", s = t.HREF;
|
|
36
|
+
e.textContent && (e.textContent = `{{${i}_${d}}}`);
|
|
37
|
+
const n = e.closest("a") || (e.tagName === "A" ? e : null);
|
|
38
|
+
if (n && s) {
|
|
39
|
+
const c = n.href, E = `${window.location.href}${a}`;
|
|
40
|
+
(c === E || c.endsWith(a)) && (n.href = `{{${s}_${d}}}`);
|
|
40
41
|
}
|
|
41
42
|
break;
|
|
42
43
|
}
|
|
43
44
|
case "price":
|
|
44
45
|
case "originalPrice": {
|
|
45
|
-
const t =
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
let
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
|
|
46
|
+
const t = u, i = e.getAttribute("data-formated"), a = e.getAttribute("data-single_price"), s = i === "true", n = a === "true", c = e.getAttribute("data-curency") || "before";
|
|
47
|
+
let E;
|
|
48
|
+
n ? E = s ? t.SINGLE_PRICE_FORMATTED : t.SINGLE_PRICE : E = s ? t.PRICE_FORMATTED : t.PRICE;
|
|
49
|
+
const h = t.CURRENCY;
|
|
50
|
+
let l = `{{${E}_${d}}}`;
|
|
51
|
+
if (h) {
|
|
52
|
+
const g = `{{${h}_${d}}}`;
|
|
53
|
+
l = c === "after" ? `${l} ${g}` : `${g} ${l}`;
|
|
53
54
|
}
|
|
54
|
-
e.textContent =
|
|
55
|
+
e.textContent = l;
|
|
55
56
|
break;
|
|
56
57
|
}
|
|
57
58
|
case "quantity": {
|
|
58
|
-
const t =
|
|
59
|
-
e.textContent && e.textContent.trim() ===
|
|
59
|
+
const t = u, i = t.ATTR, a = t.DEFAULT;
|
|
60
|
+
e.textContent && e.textContent.trim() === a && (e.textContent = `{{${i}_${d}}}`);
|
|
60
61
|
break;
|
|
61
62
|
}
|
|
62
63
|
case "button": {
|
|
63
|
-
const t =
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
(
|
|
64
|
+
const t = u, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e.tagName === "A" ? e : e.querySelector("a");
|
|
65
|
+
if (s) {
|
|
66
|
+
const n = s.href || "", c = `${window.location.href}${a}`;
|
|
67
|
+
(n === "" || n === "#" || n === c || n.endsWith(a) || n.endsWith("#!") || n === window.location.href) && (s.href = `{{${i}_${d}}}`);
|
|
67
68
|
}
|
|
68
69
|
break;
|
|
69
70
|
}
|
|
70
71
|
case "itemLink": {
|
|
71
|
-
const t =
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
(
|
|
72
|
+
const t = u, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e;
|
|
73
|
+
if (s.href) {
|
|
74
|
+
const n = s.href, c = `${window.location.href}${a}`;
|
|
75
|
+
(n === c || n.endsWith(a)) && (s.href = `{{${i}_${d}}}`);
|
|
75
76
|
}
|
|
76
77
|
break;
|
|
77
78
|
}
|
|
78
79
|
default: {
|
|
79
|
-
if ("ATTR" in
|
|
80
|
-
const t =
|
|
81
|
-
e.textContent && (e.textContent = `{{${t}_${
|
|
80
|
+
if ("ATTR" in u) {
|
|
81
|
+
const t = u.ATTR;
|
|
82
|
+
e.textContent && (e.textContent = `{{${t}_${d}}}`);
|
|
82
83
|
}
|
|
83
84
|
break;
|
|
84
85
|
}
|
|
@@ -86,55 +87,55 @@ function L(F) {
|
|
|
86
87
|
});
|
|
87
88
|
});
|
|
88
89
|
});
|
|
89
|
-
const S =
|
|
90
|
-
` : "",
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
element:
|
|
95
|
-
outerHtml:
|
|
96
|
-
type:
|
|
97
|
-
number:
|
|
98
|
-
nodup:
|
|
90
|
+
const S = y.match(/<!DOCTYPE[^>]*>/i), M = S ? `${S[0]}
|
|
91
|
+
` : "", P = T.querySelectorAll(".ins-product-td"), H = [];
|
|
92
|
+
P.forEach((r) => {
|
|
93
|
+
const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", o = r.getAttribute("data-nodup"), A = r.outerHTML;
|
|
94
|
+
H.push({
|
|
95
|
+
element: r,
|
|
96
|
+
outerHtml: A,
|
|
97
|
+
type: f,
|
|
98
|
+
number: p,
|
|
99
|
+
nodup: o || void 0
|
|
99
100
|
});
|
|
100
101
|
});
|
|
101
|
-
let
|
|
102
|
-
|
|
103
|
-
let
|
|
104
|
-
switch (
|
|
102
|
+
let _ = M + T.documentElement.outerHTML;
|
|
103
|
+
H.reverse().forEach(({ outerHtml: r, type: f, number: p }) => {
|
|
104
|
+
let o = "";
|
|
105
|
+
switch (f) {
|
|
105
106
|
case "CART_ITEMS":
|
|
106
|
-
|
|
107
|
+
o = "ins_apr_total_product_kind";
|
|
107
108
|
break;
|
|
108
109
|
case "BROWSED_ITEMS":
|
|
109
|
-
|
|
110
|
+
o = "browsed_item_total_product_kind";
|
|
110
111
|
break;
|
|
111
112
|
case "PURCHASED_ITEMS":
|
|
112
|
-
|
|
113
|
+
o = "purchased_item_total_product_kind";
|
|
113
114
|
break;
|
|
114
115
|
}
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
117
|
-
|
|
116
|
+
if (o) {
|
|
117
|
+
const b = parseInt(p) - 1, $ = `${`{% if ${o} > ${b} %}`}${r}{% endif %}`;
|
|
118
|
+
_ = _.replace(r, $);
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
|
-
const
|
|
121
|
-
return
|
|
122
|
-
const
|
|
123
|
-
if (!
|
|
121
|
+
const D = T.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), R = [];
|
|
122
|
+
return D.forEach((r) => {
|
|
123
|
+
const f = r.getAttribute("data-number"), p = r.getAttribute("data-type");
|
|
124
|
+
if (!f || p !== "CART_ITEMS")
|
|
124
125
|
return;
|
|
125
|
-
const
|
|
126
|
-
if (
|
|
127
|
-
const
|
|
128
|
-
|
|
126
|
+
const o = r.closest(".product-original-price-class");
|
|
127
|
+
if (o) {
|
|
128
|
+
const A = o.outerHTML;
|
|
129
|
+
R.some((m) => m.tdOuterHtml === A) || R.push({ tdOuterHtml: A, number: f });
|
|
129
130
|
}
|
|
130
|
-
}),
|
|
131
|
-
const
|
|
132
|
-
if (!
|
|
133
|
-
const
|
|
134
|
-
|
|
131
|
+
}), R.reverse().forEach(({ tdOuterHtml: r, number: f }) => {
|
|
132
|
+
const p = `{% if ins_apr_price_${f} != ins_apr_originalprice_${f} %}`;
|
|
133
|
+
if (!_.includes(p) && !r.includes("{% if")) {
|
|
134
|
+
const A = `${p}${r}{% endif %}`;
|
|
135
|
+
_ = _.replace(r, A);
|
|
135
136
|
}
|
|
136
|
-
}),
|
|
137
|
+
}), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
137
138
|
}
|
|
138
139
|
export {
|
|
139
|
-
|
|
140
|
+
q as pairProductVariables
|
|
140
141
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.2.0-beta.
|
|
3
|
+
"version": "3.2.0-beta.8513411",
|
|
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",
|