@useinsider/guido 3.2.0-beta.40feab8 → 3.2.0-beta.443f410
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/README.md +117 -1
- package/dist/@types/config/schemas.js +153 -95
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +90 -88
- package/dist/components/organisms/AutoSaveController.vue.js +17 -0
- package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
- package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
- package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
- package/dist/components/organisms/header/RightSlot.vue.js +8 -8
- package/dist/components/organisms/header/RightSlot.vue2.js +9 -8
- package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
- package/dist/composables/useAutoSave.js +71 -0
- package/dist/composables/useRecommendation.js +46 -26
- package/dist/composables/useRibbonOffset.js +21 -0
- package/dist/composables/useSave.js +16 -16
- package/dist/composables/useStripo.js +14 -16
- package/dist/config/compiler/recommendationCompilerRules.js +25 -25
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +104 -71
- package/dist/config/migrator/index.js +9 -9
- package/dist/config/migrator/radioButtonMigrator.js +64 -44
- package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
- package/dist/config/migrator/recommendation/extractors.js +27 -0
- package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
- package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
- package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
- package/dist/config/migrator/recommendation/themeMapper.js +93 -0
- package/dist/config/migrator/recommendationMigrator.js +74 -290
- package/dist/enums/extensions/recommendationBlock.js +97 -42
- package/dist/enums/onboarding.js +7 -2
- 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/RadioButton/template.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +35 -32
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +25 -24
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +228 -181
- package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +130 -90
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +19 -10
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +25 -15
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +258 -235
- package/dist/node_modules/valibot/dist/index.js +450 -235
- package/dist/package.json.js +1 -1
- package/dist/services/templateLibraryApi.js +5 -4
- package/dist/src/@types/config/defaults.d.ts +5 -1
- package/dist/src/@types/config/index.d.ts +3 -3
- package/dist/src/@types/config/schemas.d.ts +217 -0
- package/dist/src/@types/config/types.d.ts +9 -1
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useAutoSave.d.ts +3 -0
- package/dist/src/composables/useConfig.d.ts +58 -0
- package/dist/src/composables/useRecommendation.d.ts +10 -1
- package/dist/src/composables/useRecommendation.test.d.ts +1 -0
- package/dist/src/composables/useRibbonOffset.d.ts +4 -0
- package/dist/src/composables/useSave.d.ts +1 -1
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
- package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
- package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
- package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
- package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +5 -1
- package/dist/src/enums/onboarding.d.ts +6 -0
- package/dist/src/enums/unsubscribe.d.ts +8 -3
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
- package/dist/src/library.d.ts +1 -1
- package/dist/src/stores/autosave.d.ts +12 -0
- package/dist/src/stores/config.d.ts +522 -0
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/src/utils/htmlEscape.d.ts +5 -0
- package/dist/src/utils/htmlEscape.test.d.ts +1 -0
- package/dist/src/utils/timeUtil.d.ts +8 -0
- package/dist/stores/autosave.js +17 -0
- package/dist/stores/editor.js +3 -1
- package/dist/stores/onboarding.js +4 -0
- package/dist/utils/htmlEscape.js +13 -0
- package/dist/utils/pairProductVariables.js +89 -88
- package/dist/utils/templatePreparation.js +72 -32
- package/dist/utils/timeUtil.js +19 -0
- package/package.json +7 -3
- package/dist/enums/displayConditions.js +0 -80
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
- package/dist/src/enums/displayConditions.d.ts +0 -2
package/dist/enums/onboarding.js
CHANGED
|
@@ -2,10 +2,15 @@ const e = [
|
|
|
2
2
|
".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-0.ng-star-inserted",
|
|
3
3
|
".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-1.ng-star-inserted",
|
|
4
4
|
".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-2.ng-star-inserted"
|
|
5
|
-
], t = "ui-editor", n = 'button[role="tab"][aria-label="Card Composition"]', s = 'button[role="tab"][aria-label="Settings"]',
|
|
5
|
+
], t = "ui-editor", n = 'button[role="tab"][aria-label="Card Composition"]', s = 'button[role="tab"][aria-label="Settings"]', E = ".in-ribbons-wrapper", o = ".guido__amp-toggle-html", a = ".in-segments-wrapper", O = '[data-testid="guido-header"]', _ = 158, i = 10;
|
|
6
6
|
export {
|
|
7
|
+
o as AMP_TOGGLE_BUTTON_SELECTOR,
|
|
8
|
+
a as AMP_TOGGLE_WRAPPER_SELECTOR,
|
|
7
9
|
n as CARD_COMPOSITION_TAB_SELECTOR,
|
|
8
|
-
|
|
10
|
+
O as HEADER_SELECTOR,
|
|
11
|
+
_ as POPOVER_LEFT_OFFSET,
|
|
12
|
+
i as POPOVER_TOP_GAP,
|
|
13
|
+
E as RIBBON_SELECTOR,
|
|
9
14
|
e as SERVICE_HOVER_SELECTORS,
|
|
10
15
|
s as SETTINGS_TAB_SELECTOR,
|
|
11
16
|
t as UI_EDITOR_SELECTOR
|
|
@@ -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
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (r, n, t) =>
|
|
4
|
-
import { BlockId as
|
|
5
|
-
import { getMigrationBannerHtml 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
6
|
import { Block as b, BlockCompositionType as R, ModificationDescription as y } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
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
9
|
import { RecommendationConfigService as c } from "./services/configService.js";
|
|
10
10
|
import { useRecommendationExtensionStore as p } from "./store/recommendation.js";
|
|
11
11
|
import { getDefaultTemplate as E } from "./templates/grid/template.js";
|
|
12
|
-
const f =
|
|
12
|
+
const f = _.Recommendation, l = "recommendation-block-v2", m = "recommendation-id";
|
|
13
13
|
let h = !1;
|
|
14
14
|
class q extends b {
|
|
15
15
|
constructor() {
|
|
@@ -38,7 +38,7 @@ class q extends b {
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
getSettingsPanelTitleHtml() {
|
|
41
|
-
return
|
|
41
|
+
return B(
|
|
42
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.")
|
|
@@ -66,15 +66,18 @@ class q extends b {
|
|
|
66
66
|
* @param node - The newly created block node
|
|
67
67
|
*/
|
|
68
68
|
onCreated(t) {
|
|
69
|
-
const e = this.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
i.
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
const e = this._getRecommendationId(t);
|
|
70
|
+
if (e !== null && e > 0)
|
|
71
|
+
return;
|
|
72
|
+
const i = this._pendingBlockId ?? this._generateNextId();
|
|
73
|
+
this._pendingBlockId = null, this._assignRecommendationId(t, i);
|
|
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({
|
|
75
78
|
currentNode: t,
|
|
76
79
|
documentModifier: this.api.getDocumentModifier()
|
|
77
|
-
})),
|
|
80
|
+
})), s.patchCurrentBlockConfig({ language: o.language }, { triggerRefetch: !1 });
|
|
78
81
|
}
|
|
79
82
|
/**
|
|
80
83
|
* Called when the document changes or template is loaded
|
|
@@ -97,10 +100,10 @@ class q extends b {
|
|
|
97
100
|
c.needsMigration(t) && this._migrateFromLegacy(t);
|
|
98
101
|
try {
|
|
99
102
|
h || (g(this.api), h = !0);
|
|
100
|
-
const e = c.getConfig(t),
|
|
101
|
-
if (
|
|
102
|
-
const
|
|
103
|
-
A(
|
|
103
|
+
const e = c.getConfig(t), i = this._getBlockElement(t);
|
|
104
|
+
if (i) {
|
|
105
|
+
const o = !e.mobileLayoutEnabled;
|
|
106
|
+
A(i) !== o && d(this.api, i, o);
|
|
104
107
|
}
|
|
105
108
|
} catch {
|
|
106
109
|
}
|
|
@@ -124,10 +127,10 @@ class q extends b {
|
|
|
124
127
|
let t = 0;
|
|
125
128
|
try {
|
|
126
129
|
const e = this.api.getDocumentRoot();
|
|
127
|
-
e && "querySelectorAll" in e && e.querySelectorAll(`.${
|
|
128
|
-
if ("getAttribute" in
|
|
129
|
-
const s =
|
|
130
|
-
|
|
130
|
+
e && "querySelectorAll" in e && e.querySelectorAll(`.${l}`).forEach((o) => {
|
|
131
|
+
if ("getAttribute" in o) {
|
|
132
|
+
const s = o.getAttribute(m), a = s ? parseInt(s) : 0;
|
|
133
|
+
a > t && (t = a);
|
|
131
134
|
}
|
|
132
135
|
});
|
|
133
136
|
} catch {
|
|
@@ -141,11 +144,11 @@ class q extends b {
|
|
|
141
144
|
* added classes via setAttribute.
|
|
142
145
|
*/
|
|
143
146
|
_assignRecommendationId(t, e) {
|
|
144
|
-
const
|
|
145
|
-
if (!
|
|
147
|
+
const i = this._getBlockElement(t);
|
|
148
|
+
if (!i)
|
|
146
149
|
return;
|
|
147
|
-
const
|
|
148
|
-
|
|
150
|
+
const o = this.api.getDocumentModifier();
|
|
151
|
+
o.modifyHtml(i).setAttribute(m, e.toString()), o.apply(new y(`Assign recommendation ID ${e}`));
|
|
149
152
|
}
|
|
150
153
|
/**
|
|
151
154
|
* Gets the recommendation-id from a block node
|
|
@@ -154,11 +157,11 @@ class q extends b {
|
|
|
154
157
|
const e = this._getBlockElement(t);
|
|
155
158
|
if (!e || !("getAttribute" in e))
|
|
156
159
|
return null;
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
160
|
+
const i = e.getAttribute(m);
|
|
161
|
+
if (!i)
|
|
159
162
|
return null;
|
|
160
|
-
const
|
|
161
|
-
return Number.isNaN(
|
|
163
|
+
const o = parseInt(i);
|
|
164
|
+
return Number.isNaN(o) ? null : o;
|
|
162
165
|
}
|
|
163
166
|
/**
|
|
164
167
|
* Gets the block element (the element with BLOCK_CLASS)
|
|
@@ -166,10 +169,10 @@ class q extends b {
|
|
|
166
169
|
_getBlockElement(t) {
|
|
167
170
|
if ("getAttribute" in t) {
|
|
168
171
|
const e = t.getAttribute("class");
|
|
169
|
-
if (e && e.includes(
|
|
172
|
+
if (e && e.includes(l))
|
|
170
173
|
return t;
|
|
171
174
|
}
|
|
172
|
-
return "querySelector" in t ? t.querySelector(`.${
|
|
175
|
+
return "querySelector" in t ? t.querySelector(`.${l}`) ?? null : null;
|
|
173
176
|
}
|
|
174
177
|
/**
|
|
175
178
|
* Migrate configuration from legacy format
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DEFAULT_COLUMN_SPACING as R, DEFAULT_ROW_SPACING as U, DEFAULT_MOBILE_ROW_SPACING as i, DEFAULT_MOBILE_COLUMN_SPACING as s, DEFAULT_MOBILE_CARDS_IN_ROW as o, DEFAULT_CARDS_IN_ROW as C } from "./layout.js";
|
|
2
2
|
import { ATTR_PRODUCT_IMAGE as _, ATTR_PRODUCT_NAME as e, ATTR_PRODUCT_OLD_PRICE as t, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as r, ATTR_PRODUCT_OMNIBUS_DISCOUNT as I, ATTR_PRODUCT_BUTTON as n } from "./selectors.js";
|
|
3
3
|
const O = {
|
|
4
4
|
code: "USD",
|
|
@@ -44,10 +44,10 @@ const O = {
|
|
|
44
44
|
mobileCardsInRow: o,
|
|
45
45
|
mobileLayoutEnabled: !1,
|
|
46
46
|
previousMobileCardsInRow: o,
|
|
47
|
-
columnSpacing:
|
|
48
|
-
rowSpacing:
|
|
49
|
-
mobileColumnSpacing:
|
|
50
|
-
mobileRowSpacing:
|
|
47
|
+
columnSpacing: R,
|
|
48
|
+
rowSpacing: U,
|
|
49
|
+
mobileColumnSpacing: s,
|
|
50
|
+
mobileRowSpacing: i,
|
|
51
51
|
// Composition
|
|
52
52
|
composition: a,
|
|
53
53
|
visibility: E,
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (s,
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var l = (s, o, t) => o in s ? c(s, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[o] = t;
|
|
3
|
+
var a = (s, o, t) => l(s, typeof o != "symbol" ? o + "" : o, t);
|
|
4
4
|
import { UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as d } from "../../../common-control.js";
|
|
6
6
|
import { RecommendationConfigService as n } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
|
|
8
|
-
|
|
8
|
+
import { mapLegacyStrategy as g } from "../../utils/legacyStrategyMap.js";
|
|
9
|
+
const u = "recommendation-algorithm-control", i = {
|
|
9
10
|
ALGORITHM: "strategy",
|
|
10
11
|
PRODUCT_IDS: "productIds"
|
|
11
12
|
};
|
|
12
|
-
class
|
|
13
|
+
class R extends d {
|
|
13
14
|
constructor() {
|
|
14
15
|
super(...arguments);
|
|
15
16
|
// Store is used ONLY for API-fetched data (algorithms list), not for config
|
|
16
17
|
a(this, "store", m());
|
|
17
18
|
}
|
|
18
19
|
getId() {
|
|
19
|
-
return
|
|
20
|
+
return u;
|
|
20
21
|
}
|
|
21
22
|
getTemplate() {
|
|
22
23
|
return `
|
|
@@ -24,13 +25,13 @@ class T extends d {
|
|
|
24
25
|
${this._GuTwoColumns([
|
|
25
26
|
this._GuLabel({ text: this.api.translate("Recommendation Algorithm") }),
|
|
26
27
|
this._GuSelect({
|
|
27
|
-
name:
|
|
28
|
+
name: i.ALGORITHM,
|
|
28
29
|
placeholder: this.api.translate("Select Recommendation Algorithm"),
|
|
29
30
|
options: this.store.getActivePredictiveAlgorithms
|
|
30
31
|
}),
|
|
31
|
-
this._GuLabel({ text: this.api.translate("Product Ids"), name: `${
|
|
32
|
+
this._GuLabel({ text: this.api.translate("Product Ids"), name: `${i.PRODUCT_IDS}_label` }),
|
|
32
33
|
this._GuTextInput({
|
|
33
|
-
name:
|
|
34
|
+
name: i.PRODUCT_IDS,
|
|
34
35
|
placeholder: this.api.translate("Enter Product Ids"),
|
|
35
36
|
className: "es-180w"
|
|
36
37
|
})
|
|
@@ -45,19 +46,19 @@ class T extends d {
|
|
|
45
46
|
super.onTemplateNodeUpdated(t), this._initializeSelectItems(), this._setFormValues();
|
|
46
47
|
}
|
|
47
48
|
_setFormValues() {
|
|
48
|
-
const t = n.getConfig(this.currentNode);
|
|
49
|
-
this._setProductIdsVisibility(
|
|
50
|
-
[
|
|
51
|
-
[
|
|
49
|
+
const t = n.getConfig(this.currentNode), e = g(t.strategy) ?? t.strategy;
|
|
50
|
+
this._setProductIdsVisibility(e), this.api.updateValues({
|
|
51
|
+
[i.ALGORITHM]: e,
|
|
52
|
+
[i.PRODUCT_IDS]: t.productIds.join(",")
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
_initializeSelectItems() {
|
|
55
|
-
var
|
|
56
|
-
const t = (
|
|
56
|
+
var e;
|
|
57
|
+
const t = (e = this.store) == null ? void 0 : e.getActivePredictiveAlgorithms;
|
|
57
58
|
if (t != null && t.length)
|
|
58
59
|
try {
|
|
59
60
|
this.api.setUIEAttribute(
|
|
60
|
-
|
|
61
|
+
i.ALGORITHM,
|
|
61
62
|
h.SELECTPICKER.items,
|
|
62
63
|
t
|
|
63
64
|
);
|
|
@@ -67,7 +68,7 @@ class T extends d {
|
|
|
67
68
|
}
|
|
68
69
|
_setProductIdsVisibility(t) {
|
|
69
70
|
const r = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
|
|
70
|
-
this.api.setVisibility(
|
|
71
|
+
this.api.setVisibility(i.PRODUCT_IDS, r), this.api.setVisibility(`${i.PRODUCT_IDS}_label`, r);
|
|
71
72
|
}
|
|
72
73
|
_onAlgorithmChange(t) {
|
|
73
74
|
!this.currentNode || n.getConfig(this.currentNode).strategy === t || (n.updateConfig(
|
|
@@ -80,23 +81,23 @@ class T extends d {
|
|
|
80
81
|
_onProductIdsChange(t) {
|
|
81
82
|
if (!this.currentNode)
|
|
82
83
|
return;
|
|
83
|
-
const
|
|
84
|
+
const e = t.split(",").map((r) => r.trim()).filter(Boolean);
|
|
84
85
|
n.updateConfig(
|
|
85
86
|
this.api,
|
|
86
87
|
this.currentNode,
|
|
87
|
-
{ productIds:
|
|
88
|
+
{ productIds: e },
|
|
88
89
|
"Updated product IDs"
|
|
89
|
-
), this.store.patchCurrentBlockConfig({ productIds:
|
|
90
|
+
), this.store.patchCurrentBlockConfig({ productIds: e });
|
|
90
91
|
}
|
|
91
92
|
_listenToFormUpdates() {
|
|
92
|
-
this.api.onValueChanged(
|
|
93
|
+
this.api.onValueChanged(i.ALGORITHM, (t) => {
|
|
93
94
|
this._onAlgorithmChange(t);
|
|
94
|
-
}), this.api.onValueChanged(
|
|
95
|
+
}), this.api.onValueChanged(i.PRODUCT_IDS, (t) => {
|
|
95
96
|
this._onProductIdsChange(t);
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
export {
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
u as ALGORITHM_CONTROL_ID,
|
|
102
|
+
R as AlgorithmControl
|
|
102
103
|
};
|