@useinsider/guido 3.18.2-beta.9be830c → 3.18.2-beta.a5a0a11
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/@types/config/schemas.js +13 -15
- package/dist/components/Guido.vue.js +7 -7
- package/dist/components/Guido.vue2.js +30 -30
- package/dist/components/organisms/AutoSaveController.vue2.js +8 -10
- package/dist/components/organisms/base/Toaster.vue2.js +13 -12
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +74 -57
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +23 -37
- 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/EditorActions.vue.js +13 -13
- package/dist/components/organisms/header/EditorActions.vue2.js +52 -36
- package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
- package/dist/components/organisms/header/HeaderWrapper.vue2.js +17 -9
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +23 -28
- package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
- package/dist/components/organisms/header/MiddleSlot.vue2.js +7 -8
- package/dist/components/organisms/header/RightSlot.vue.js +8 -9
- package/dist/components/organisms/header/RightSlot.vue2.js +18 -13
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +12 -12
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +38 -54
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
- package/dist/composables/useCustomInterfaceAppearance.js +52 -45
- package/dist/composables/useHtmlValidator.js +87 -82
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useStripo.js +30 -30
- package/dist/composables/useToaster.js +14 -20
- package/dist/config/i18n/en/labels.json.js +4 -36
- package/dist/config/i18n/en/tooltips.json.js +1 -2
- package/dist/enums/extensions/recommendationBlock.js +38 -31
- package/dist/extensions/Blocks/Recommendation/block.js +61 -42
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +40 -35
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +84 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +260 -140
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
- package/dist/guido.css +1 -1
- package/dist/node_modules/@vueuse/shared/index.js +28 -40
- package/dist/sprite.svg +0 -6
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/components/organisms/AutoSaveController.vue.d.ts +1 -3
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +3 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +3 -1
- package/dist/src/composables/useActionsApi.d.ts +2 -2
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +86 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
- package/dist/src/stores/config.d.ts +0 -18
- package/dist/src/stores/editor.d.ts +0 -107
- package/dist/src/stores/onboarding.d.ts +21 -195
- package/dist/src/stores/version-history.d.ts +1 -1
- package/dist/src/utils/timeUtil.d.ts +0 -10
- package/dist/static/styles/components/recommendation-strategy.css.js +34 -4
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/static/styles/variables.css.js +0 -2
- package/dist/stores/editor.js +4 -13
- package/dist/stores/onboarding.js +50 -66
- package/dist/utils/templatePreparation.js +55 -55
- package/dist/utils/timeUtil.js +17 -7
- package/package.json +5 -5
- package/dist/components/organisms/header/AutoSaveStatus.vue.js +0 -17
- package/dist/components/organisms/header/AutoSaveStatus.vue2.js +0 -27
- package/dist/components/organisms/header/EditorActionsMenu.vue.js +0 -20
- package/dist/components/organisms/header/EditorActionsMenu.vue2.js +0 -48
- package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +0 -18
- package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +0 -37
- package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +0 -24
- package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +0 -48
- package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +0 -19
- package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +0 -82
- package/dist/composables/useAccessibilityApi.js +0 -35
- package/dist/node_modules/@vueuse/core/index.js +0 -102
- package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +0 -2
- package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +0 -2
- package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +0 -2
- package/dist/src/composables/useAccessibilityApi.d.ts +0 -15
- package/dist/static/styles/components/accessibility.css.js +0 -282
- /package/dist/src/components/organisms/header/{AutoSaveStatus.vue.d.ts → AutoSaveToggle.vue.d.ts} +0 -0
- /package/dist/src/components/organisms/{header/EditorActionsMenu.vue.d.ts → onboarding/RecommendationStrategyOnboarding.vue.d.ts} +0 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
1
|
+
import { useActionsApi as O } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as q } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as H } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as w } from "./useCustomInterfaceAppearance.js";
|
|
5
5
|
import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
|
|
6
6
|
import { useModuleRepair as j } from "./useModuleRepair.js";
|
|
7
7
|
import { useStripoEventHandler as z } from "./useStripoEventHandler.js";
|
|
8
8
|
import { useStripoNotifications as $ } from "./useStripoNotifications.js";
|
|
9
9
|
import { useToaster as G } from "./useToaster.js";
|
|
10
10
|
import { localePatch as J } from "../config/i18n/index.js";
|
|
11
|
-
import { en as
|
|
11
|
+
import { en as b } from "../config/i18n/en/index.js";
|
|
12
12
|
import { ToasterTypeOptions as X } from "../enums/toaster.js";
|
|
13
13
|
import { useStripoApi as K } from "../services/stripoApi.js";
|
|
14
14
|
import Q from "../static/styles/customEditorStyle.css.js";
|
|
15
|
-
import { useEditorStore as
|
|
15
|
+
import { useEditorStore as k } from "../stores/editor.js";
|
|
16
16
|
import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
|
|
17
17
|
import Z from "../package.json.js";
|
|
18
18
|
let n = null;
|
|
19
|
-
const
|
|
20
|
-
const { features: c, template: u, isFeatureEnabled: m } =
|
|
19
|
+
const he = () => {
|
|
20
|
+
const { features: c, template: u, isFeatureEnabled: m } = H(), { handleError: p, showToaster: B } = G(), { getToken: M, getCustomFonts: T, getSyncModulesStatus: v } = K(), { handleEvent: F } = z(), { handleModuleAdd: A } = j(), { getStripoBlocksConfig: V } = q(), { getStripoNotifications: _ } = $(), f = () => n || (n = new Promise((i, s) => {
|
|
21
21
|
var d;
|
|
22
22
|
if (document.getElementById("UiEditorScript")) {
|
|
23
23
|
i();
|
|
@@ -29,16 +29,16 @@ const Ce = () => {
|
|
|
29
29
|
}, document.body.appendChild(e);
|
|
30
30
|
}), n.catch(() => {
|
|
31
31
|
n = null;
|
|
32
|
-
}), n),
|
|
32
|
+
}), n), D = async (i, s, o, a = [], r = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const e =
|
|
35
|
-
await window.UIEditor.initEditor(
|
|
34
|
+
const e = k(), { html: d, css: R } = i, { baseBlocks: g, extensions: P } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), x = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
|
|
35
|
+
w().importCss(), await window.UIEditor.initEditor(
|
|
36
36
|
document.querySelector("#guido-editor"),
|
|
37
37
|
{
|
|
38
38
|
metadata: s,
|
|
39
39
|
html: d,
|
|
40
|
-
css:
|
|
41
|
-
forceRecreate:
|
|
40
|
+
css: R,
|
|
41
|
+
forceRecreate: I,
|
|
42
42
|
locale: "en",
|
|
43
43
|
undoButtonSelector: "#guido__undo-button",
|
|
44
44
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -52,7 +52,7 @@ const Ce = () => {
|
|
|
52
52
|
conditionsEnabled: S,
|
|
53
53
|
customConditionsEnabled: S,
|
|
54
54
|
enableXSSSecurity: !0,
|
|
55
|
-
modulesDisabled:
|
|
55
|
+
modulesDisabled: U,
|
|
56
56
|
syncModulesEnabled: r,
|
|
57
57
|
messageSettingsEnabled: !0,
|
|
58
58
|
displayGmailAnnotations: !0,
|
|
@@ -62,7 +62,7 @@ const Ce = () => {
|
|
|
62
62
|
displayUTM: !1,
|
|
63
63
|
selectElementAfterDrop: !0,
|
|
64
64
|
sameFontSizeForOutlook: !0,
|
|
65
|
-
allowedScriptSourceDomains:
|
|
65
|
+
allowedScriptSourceDomains: x,
|
|
66
66
|
...g ? { baseBlocks: g } : {},
|
|
67
67
|
editorFonts: {
|
|
68
68
|
showDefaultStandardFonts: !0,
|
|
@@ -80,7 +80,7 @@ const Ce = () => {
|
|
|
80
80
|
],
|
|
81
81
|
async onTokenRefreshRequest(t) {
|
|
82
82
|
try {
|
|
83
|
-
const l = await
|
|
83
|
+
const l = await M();
|
|
84
84
|
t(l);
|
|
85
85
|
} catch (l) {
|
|
86
86
|
p(l, "Failed to refresh token");
|
|
@@ -88,8 +88,8 @@ const Ce = () => {
|
|
|
88
88
|
},
|
|
89
89
|
onTemplateLoaded() {
|
|
90
90
|
try {
|
|
91
|
-
const {
|
|
92
|
-
|
|
91
|
+
const { activateCustomViewStyles: t, updateTimerInClonedTemplate: l } = O(), { injectFullStory: L } = N();
|
|
92
|
+
w().importCss(), t(), L(), l(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
93
93
|
e.hasChanges = !1;
|
|
94
94
|
}, 1e3);
|
|
95
95
|
} catch (t) {
|
|
@@ -108,34 +108,34 @@ const Ce = () => {
|
|
|
108
108
|
onDataChanged() {
|
|
109
109
|
e.hasChanges = !0;
|
|
110
110
|
},
|
|
111
|
-
onEvent:
|
|
112
|
-
onModuleAdd:
|
|
113
|
-
notifications:
|
|
111
|
+
onEvent: F,
|
|
112
|
+
onModuleAdd: A,
|
|
113
|
+
notifications: _(),
|
|
114
114
|
ignoreClickOutsideSelectors: [
|
|
115
115
|
"#guido-dynamic-content-modal",
|
|
116
116
|
".in-on-board-wrapper",
|
|
117
117
|
".in-drawer__container"
|
|
118
118
|
],
|
|
119
|
-
extensions:
|
|
119
|
+
extensions: P,
|
|
120
120
|
localePatch: J
|
|
121
121
|
}
|
|
122
122
|
);
|
|
123
123
|
};
|
|
124
124
|
return { initPlugin: async (i, s, o) => {
|
|
125
|
-
const a =
|
|
125
|
+
const a = k();
|
|
126
126
|
try {
|
|
127
127
|
await f();
|
|
128
128
|
const [r, e] = await Promise.all([
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
T(),
|
|
130
|
+
v()
|
|
131
131
|
]);
|
|
132
|
-
a.syncModulesEnabled = e, await
|
|
132
|
+
a.syncModulesEnabled = e, await D(i, s, o, r, e);
|
|
133
133
|
} catch {
|
|
134
|
-
a.loadingStatus = !1,
|
|
134
|
+
a.loadingStatus = !1, B({
|
|
135
135
|
type: X.Error,
|
|
136
|
-
message:
|
|
136
|
+
message: b["An error has occurred. Please report the error code to support."],
|
|
137
137
|
actionButton: {
|
|
138
|
-
text:
|
|
138
|
+
text: b["Reload page"],
|
|
139
139
|
onClick: () => window.location.reload()
|
|
140
140
|
}
|
|
141
141
|
});
|
|
@@ -146,5 +146,5 @@ const Ce = () => {
|
|
|
146
146
|
} };
|
|
147
147
|
};
|
|
148
148
|
export {
|
|
149
|
-
|
|
149
|
+
he as useStripo
|
|
150
150
|
};
|
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
2
2
|
import { useToasterStore as c } from "../stores/toaster.js";
|
|
3
|
-
import {
|
|
4
|
-
const p = () => {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
t && (clearTimeout(t), t = null);
|
|
3
|
+
import { nextTick as u } from "vue";
|
|
4
|
+
const s = /* @__PURE__ */ new WeakMap(), p = () => {
|
|
5
|
+
const e = c(), o = () => {
|
|
6
|
+
const t = s.get(e);
|
|
7
|
+
t && (clearTimeout(t), s.delete(e));
|
|
9
8
|
};
|
|
10
|
-
function r(
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
function r(t = { message: "" }) {
|
|
10
|
+
o(), e.hideToaster(), u(() => {
|
|
11
|
+
e.showToaster(t), e.shouldAutoHide && s.set(e, setTimeout(() => {
|
|
12
|
+
e.hideToaster(), o();
|
|
13
|
+
}, 6e3));
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
16
|
function i() {
|
|
16
|
-
|
|
17
|
+
o(), e.hideToaster();
|
|
17
18
|
}
|
|
18
|
-
function n(
|
|
19
|
-
const m =
|
|
19
|
+
function n(t, a) {
|
|
20
|
+
const m = t instanceof Error ? t.message : String(t);
|
|
20
21
|
r({ type: T.Error, message: `${a}: ${m}` });
|
|
21
22
|
}
|
|
22
|
-
return
|
|
23
|
-
() => o.shouldAutoHide,
|
|
24
|
-
(e) => {
|
|
25
|
-
s(), e && (t = setTimeout(() => {
|
|
26
|
-
o.hideToaster(), s();
|
|
27
|
-
}, 6e3));
|
|
28
|
-
}
|
|
29
|
-
), { showToaster: r, hideToaster: i, handleError: n };
|
|
23
|
+
return { showToaster: r, hideToaster: i, handleError: n };
|
|
30
24
|
};
|
|
31
25
|
export {
|
|
32
26
|
p as useToaster
|
|
@@ -1,51 +1,19 @@
|
|
|
1
|
-
const e = "Items", o = "Default",
|
|
1
|
+
const e = "Items", o = "Default", t = "Custom", s = {
|
|
2
2
|
"Global Styles & Layout": "Global Styles and Layout",
|
|
3
3
|
"Structures & Modules": "Structures and Modules",
|
|
4
4
|
"Recommendation Block": "Recommendation Block",
|
|
5
5
|
Items: e,
|
|
6
6
|
"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.": "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.",
|
|
7
7
|
"This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.",
|
|
8
|
-
"email-editor.a11y-hide-images": "Hide images",
|
|
9
|
-
"email-editor.a11y-show-images": "Show images",
|
|
10
|
-
"email-editor.cvd-none": "No Color Deficiency",
|
|
11
|
-
"email-editor.cvd-protanopia": "Protanopia",
|
|
12
|
-
"email-editor.cvd-protanopia-description": "Causes red-green confusion and makes reds appear darker.",
|
|
13
|
-
"email-editor.cvd-deuteranopia": "Deuteranopia",
|
|
14
|
-
"email-editor.cvd-deuteranopia-description": "Causes red-green confusion.",
|
|
15
|
-
"email-editor.cvd-tritanopia": "Tritanopia",
|
|
16
|
-
"email-editor.cvd-tritanopia-description": "Causes blue-yellow confusion.",
|
|
17
|
-
"email-editor.cvd-achromatopsia": "Achromatopsia",
|
|
18
|
-
"email-editor.cvd-achromatopsia-description": "Causes complete color blindness.",
|
|
19
|
-
"email-editor.more-actions": "More actions",
|
|
20
|
-
"email-editor.preferences": "Preferences",
|
|
21
|
-
"email-editor.actions": "Actions",
|
|
22
|
-
"email-editor.accessibility-test": "Accessibility Test",
|
|
23
|
-
"email-editor.autosaved-at-today": "{boldStart}Autosaved{boldEnd} at {time}, Today",
|
|
24
|
-
"email-editor.autosaved-at-date": "{boldStart}Autosaved{boldEnd} at {date}",
|
|
25
|
-
"email-editor.export-html": "Export HTML",
|
|
26
|
-
"email-editor.onboarding-kebab-title": "Discover Preferences and Actions",
|
|
27
|
-
"email-editor.onboarding-kebab-description": "You can now access your Preferences and Actions easily such as Autosave, Export HTML, Version History, Accessibility Test and Save As Template.",
|
|
28
|
-
"email-editor.onboarding-autosave-title": "Autosave Your Design",
|
|
29
|
-
"email-editor.onboarding-autosave-description": "You can save your design automatically by enabling Autosave without losing your work.",
|
|
30
|
-
"email-editor.onboarding-accessibility-title": "Test Accessibility of Your Design",
|
|
31
|
-
"email-editor.onboarding-accessibility-description": "You can test the accessibility of your design to see the Failed, Passed items and update the Failed ones accordingly.",
|
|
32
8
|
"Pixel Tracking Opt-in": "Pixel Tracking Opt-in",
|
|
33
9
|
"OPT-IN SELECTION": "OPT-IN SELECTION",
|
|
34
10
|
"UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS",
|
|
35
11
|
Default: o,
|
|
36
|
-
Custom:
|
|
37
|
-
"Foreground color": "Foreground Color",
|
|
38
|
-
"Contrast ratio": "Contrast Ratio",
|
|
39
|
-
"You’ve fixed all issues!": `No Failed Items
|
|
40
|
-
You have no failed items.`,
|
|
41
|
-
"No accessibility issues found": `No Failed Items
|
|
42
|
-
You have no failed items.`,
|
|
43
|
-
"You have no ignored issues yet": `No Ignored Items
|
|
44
|
-
You have no ignored items.`
|
|
12
|
+
Custom: t
|
|
45
13
|
};
|
|
46
14
|
export {
|
|
47
|
-
|
|
15
|
+
t as Custom,
|
|
48
16
|
o as Default,
|
|
49
17
|
e as Items,
|
|
50
|
-
|
|
18
|
+
s as default
|
|
51
19
|
};
|
|
@@ -76,8 +76,7 @@ const e = {
|
|
|
76
76
|
"The data source link is unavailable. Please, make sure there is an access to the data source.": "Enter an accessible Data Source Link to contiue.",
|
|
77
77
|
"The file should not exceed the maximum resolution of {maxImageResolution}px.": "Upload files up to 1024x512 pixels to continue.",
|
|
78
78
|
"The option is disabled because was overridden in the Code editor": "The option is disabled because it was overridden in the Code Editor.",
|
|
79
|
-
"Dropdown with a list of available data services, preliminarily created in the Data section → Services tab of the Account.": "Service for Data Collection lets you enter a form submission URL for the recipients to submit."
|
|
80
|
-
'Read more about the issue on <a target="_blank" rel="noopener noreferrer" href="{url}">ACT Rules Community Group forum</a>': 'Read more about the issue on <a target="_blank" rel="noopener noreferrer" href="{url}">ACT Rules Community Group forum.</a>'
|
|
79
|
+
"Dropdown with a list of available data services, preliminarily created in the Data section → Services tab of the Account.": "Service for Data Collection lets you enter a form submission URL for the recipients to submit."
|
|
81
80
|
};
|
|
82
81
|
export {
|
|
83
82
|
e as default
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { useTranslations as
|
|
2
|
-
const
|
|
1
|
+
import { useTranslations as n } from "../../composables/useTranslations.js";
|
|
2
|
+
const o = {
|
|
3
3
|
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
|
|
4
4
|
// Relative path → same-origin as the embedding inone dashboard.
|
|
5
5
|
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
|
|
6
6
|
RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
|
|
7
|
-
RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
|
|
8
|
-
|
|
7
|
+
RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies",
|
|
8
|
+
// Smart Recommender hides the Email channel unless the URL asks for it, so a strategy created
|
|
9
|
+
// without this flag can never be Email-suitable and would never reach the editor's list.
|
|
10
|
+
RECOMMENDATION_STRATEGY_CREATE_PATH: "/discovery/recommendation-strategies/create?isEmail=true"
|
|
11
|
+
}, d = (e) => {
|
|
12
|
+
const { RECOMMENDATION_STRATEGIES_PANEL_PATH: r } = o;
|
|
13
|
+
return `${r}/${e}/edit?isEmail=true`;
|
|
14
|
+
}, m = {
|
|
9
15
|
CLIENT_ID: "clientId"
|
|
10
|
-
},
|
|
11
|
-
const e =
|
|
16
|
+
}, p = () => {
|
|
17
|
+
const e = n();
|
|
12
18
|
return [
|
|
13
19
|
{
|
|
14
20
|
id: 11,
|
|
@@ -71,14 +77,14 @@ const l = {
|
|
|
71
77
|
path: "top-sellers"
|
|
72
78
|
}
|
|
73
79
|
];
|
|
74
|
-
},
|
|
80
|
+
}, v = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], h = [
|
|
75
81
|
{ text: "before the amount", value: "0" },
|
|
76
82
|
{ text: "after the amount", value: "1" }
|
|
77
|
-
],
|
|
83
|
+
], x = [
|
|
78
84
|
{ text: "dot(.)", value: "." },
|
|
79
85
|
{ text: "comma(,)", value: "," },
|
|
80
86
|
{ text: "space( )", value: " " }
|
|
81
|
-
],
|
|
87
|
+
], E = [
|
|
82
88
|
{ text: "0", value: "0" },
|
|
83
89
|
{ text: "1", value: "1" },
|
|
84
90
|
{ text: "2", value: "2" },
|
|
@@ -90,54 +96,55 @@ const l = {
|
|
|
90
96
|
{ text: "contains", value: "~" },
|
|
91
97
|
{ text: "does not contain", value: "!~" },
|
|
92
98
|
{ text: "any of", value: a }
|
|
93
|
-
],
|
|
99
|
+
], s = [
|
|
94
100
|
{ text: "is exactly", value: "=" },
|
|
95
101
|
{ text: "is not exactly", value: "!==" },
|
|
96
102
|
{ text: "contains", value: "~" },
|
|
97
103
|
{ text: "does not contain", value: "!~" },
|
|
98
104
|
{ text: "any of", value: a }
|
|
99
|
-
],
|
|
105
|
+
], i = [
|
|
100
106
|
{ text: "is equal to", value: "=" },
|
|
101
107
|
{ text: "is greater than", value: ">" },
|
|
102
108
|
{ text: "is less than", value: "<" }
|
|
103
|
-
],
|
|
109
|
+
], u = [
|
|
104
110
|
{ text: "is equal to", value: "=" },
|
|
105
111
|
{ text: "after", value: ">" },
|
|
106
112
|
{ text: "before", value: "<" }
|
|
107
|
-
],
|
|
113
|
+
], c = [
|
|
108
114
|
{ text: "true", value: "==" },
|
|
109
115
|
{ text: "false", value: "!=" }
|
|
110
|
-
],
|
|
116
|
+
], b = (e) => {
|
|
111
117
|
if (!e)
|
|
112
118
|
return t;
|
|
113
119
|
switch (e) {
|
|
114
120
|
case "Boolean":
|
|
115
|
-
return
|
|
121
|
+
return c;
|
|
116
122
|
case "Date":
|
|
117
|
-
return
|
|
123
|
+
return u;
|
|
118
124
|
case "Number":
|
|
119
|
-
return
|
|
125
|
+
return i;
|
|
120
126
|
case "String":
|
|
121
127
|
return t;
|
|
122
128
|
case "Strings":
|
|
123
|
-
return
|
|
129
|
+
return s;
|
|
124
130
|
default:
|
|
125
131
|
return t;
|
|
126
132
|
}
|
|
127
133
|
};
|
|
128
134
|
export {
|
|
129
135
|
a as OP_ANY_OF,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
t as operatorOptionsForStrings
|
|
136
|
+
v as PriceAttributes,
|
|
137
|
+
m as QUERY_PARAMS,
|
|
138
|
+
o as URLS,
|
|
139
|
+
E as currencyDecimalCounts,
|
|
140
|
+
h as currencyLocationMaps,
|
|
141
|
+
x as currencyOperators,
|
|
142
|
+
b as getOperatorOptions,
|
|
143
|
+
p as getRecommendationFeedSourceMaps,
|
|
144
|
+
s as operatorOptionsForArrayOfStrings,
|
|
145
|
+
c as operatorOptionsForBooleans,
|
|
146
|
+
u as operatorOptionsForDates,
|
|
147
|
+
i as operatorOptionsForNumbers,
|
|
148
|
+
t as operatorOptionsForStrings,
|
|
149
|
+
d as strategyEditPath
|
|
143
150
|
};
|
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useConfig as
|
|
5
|
-
import { BlockId as
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var A = (l, c, t) => c in l ? y(l, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[c] = t;
|
|
3
|
+
var g = (l, c, t) => A(l, typeof c != "symbol" ? c + "" : c, t);
|
|
4
|
+
import { useConfig as h } from "../../../composables/useConfig.js";
|
|
5
|
+
import { BlockId as D } from "../../../enums/block.js";
|
|
6
6
|
import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
|
|
7
|
-
import { Block as
|
|
8
|
-
import { CURRENT_CONFIG_VERSION as
|
|
7
|
+
import { Block as E, BlockCompositionType as S, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
8
|
+
import { CURRENT_CONFIG_VERSION as N, PRE_RRS_CONFIG_VERSION as O } from "./constants/defaultConfig.js";
|
|
9
9
|
import { RECOMMENDATION_ID_ATTR as m } from "./constants/selectors.js";
|
|
10
|
-
import { regenerateMobileProductRows as
|
|
11
|
-
import { ensureMobileCssRulesExist as
|
|
10
|
+
import { regenerateMobileProductRows as M } from "./controls/main/utils.js";
|
|
11
|
+
import { ensureMobileCssRulesExist as I, setMobileLayoutOptOut as R, hasMobileLayoutOptOut as w } from "./controls/mobileLayout/cssRules.js";
|
|
12
12
|
import { RecommendationConfigService as s } from "./services/configService.js";
|
|
13
13
|
import { useRecommendationExtensionStore as d } from "./store/recommendation.js";
|
|
14
|
-
import { getDefaultTemplate as
|
|
15
|
-
import { useRecommendationBlockWarning as
|
|
16
|
-
const
|
|
17
|
-
let
|
|
18
|
-
class
|
|
14
|
+
import { getDefaultTemplate as T } from "./templates/grid/template.js";
|
|
15
|
+
import { useRecommendationBlockWarning as x } from "./useRecommendationBlockWarning.js";
|
|
16
|
+
const k = D.Recommendation, u = "recommendation-block-v2", B = "hide-price";
|
|
17
|
+
let b = !1;
|
|
18
|
+
class j extends E {
|
|
19
19
|
constructor() {
|
|
20
20
|
super();
|
|
21
21
|
/**
|
|
22
22
|
* Stores the ID generated in getTemplate() so onCreated() can reuse it.
|
|
23
23
|
* This avoids generating a new (different) ID in onCreated().
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
g(this, "_pendingBlockId", null);
|
|
26
|
+
/** Ids already reset under their new name, so the deferred pass skips their stale snapshot. */
|
|
27
|
+
g(this, "_resetSourceIds", /* @__PURE__ */ new Set());
|
|
26
28
|
}
|
|
27
29
|
getId() {
|
|
28
|
-
return
|
|
30
|
+
return k;
|
|
29
31
|
}
|
|
30
32
|
getIcon() {
|
|
31
33
|
return "recommendation-icon";
|
|
32
34
|
}
|
|
33
35
|
getBlockCompositionType() {
|
|
34
|
-
return
|
|
36
|
+
return S.CONTAINER;
|
|
35
37
|
}
|
|
36
38
|
getName() {
|
|
37
39
|
return this.api.translate("Recommendation Block");
|
|
@@ -43,7 +45,7 @@ class W extends b {
|
|
|
43
45
|
}
|
|
44
46
|
getSettingsPanelTitleHtml() {
|
|
45
47
|
return C(
|
|
46
|
-
|
|
48
|
+
k,
|
|
47
49
|
this.api.translate("Recommendation Block"),
|
|
48
50
|
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.")
|
|
49
51
|
);
|
|
@@ -66,7 +68,7 @@ class W extends b {
|
|
|
66
68
|
*/
|
|
67
69
|
getTemplate() {
|
|
68
70
|
const t = this._generateNextId();
|
|
69
|
-
return this._pendingBlockId = t,
|
|
71
|
+
return this._pendingBlockId = t, T(t);
|
|
70
72
|
}
|
|
71
73
|
/**
|
|
72
74
|
* Called when a new block is dropped into the template
|
|
@@ -79,33 +81,37 @@ class W extends b {
|
|
|
79
81
|
const e = this._getRecommendationId(t);
|
|
80
82
|
if (e !== null && e > 0) {
|
|
81
83
|
if (this._detectDuplicate(e)) {
|
|
82
|
-
this._handleDuplicate(t, e);
|
|
84
|
+
this._handleDuplicate(t, e), this._scheduleArrivalReset(t);
|
|
83
85
|
return;
|
|
84
86
|
}
|
|
85
87
|
this._pendingBlockId === null && setTimeout(() => {
|
|
86
88
|
this._getBlockElement(t) && this._detectDuplicate(e) && this._handleDuplicate(t, e);
|
|
87
|
-
}, 0);
|
|
89
|
+
}, 0), this._scheduleArrivalReset(t);
|
|
88
90
|
return;
|
|
89
91
|
}
|
|
90
92
|
const i = this._pendingBlockId ?? this._generateNextId();
|
|
91
93
|
this._pendingBlockId = null, this._assignRecommendationId(t, i);
|
|
92
|
-
const { config:
|
|
94
|
+
const n = h().isFeatureEnabled("reusableRecommendationStrategy"), o = n && !s.hasConfig(t), { config: r, wasFreshDrop: a } = s.initializeConfig(
|
|
93
95
|
this.api,
|
|
94
96
|
t,
|
|
95
97
|
{
|
|
96
98
|
recommendationId: i,
|
|
97
|
-
configVersion:
|
|
99
|
+
configVersion: n ? N : O,
|
|
100
|
+
// An RRS block picks a strategy, not an algorithm, and its algorithm control is
|
|
101
|
+
// hidden. Keeping the `mostPopular` default would bake a most-popular feed URL
|
|
102
|
+
// at save for a block the user never configured.
|
|
103
|
+
...o ? { strategy: "" } : {}
|
|
98
104
|
}
|
|
99
|
-
),
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
105
|
+
), f = d();
|
|
106
|
+
if (f.setCurrentBlock(i), this._stampHidePrice(t, r.priceHideIfSameAsDiscounted), a) {
|
|
107
|
+
I(this.api);
|
|
108
|
+
const _ = this._getBlockElement(t);
|
|
109
|
+
_ && (R(this.api, _, !0), M({
|
|
104
110
|
currentNode: t,
|
|
105
111
|
documentModifier: this.api.getDocumentModifier()
|
|
106
112
|
}));
|
|
107
113
|
}
|
|
108
|
-
|
|
114
|
+
f.patchCurrentBlockConfig({ language: r.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
|
|
109
115
|
}
|
|
110
116
|
/**
|
|
111
117
|
* Called when the document changes or template is loaded
|
|
@@ -127,11 +133,11 @@ class W extends b {
|
|
|
127
133
|
}
|
|
128
134
|
this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t);
|
|
129
135
|
try {
|
|
130
|
-
|
|
136
|
+
b || (I(this.api), b = !0);
|
|
131
137
|
const e = s.getConfig(t), i = this._getBlockElement(t);
|
|
132
138
|
if (i) {
|
|
133
139
|
const n = !e.mobileLayoutEnabled;
|
|
134
|
-
|
|
140
|
+
w(i) !== n && R(this.api, i, n);
|
|
135
141
|
}
|
|
136
142
|
} catch {
|
|
137
143
|
}
|
|
@@ -161,7 +167,7 @@ class W extends b {
|
|
|
161
167
|
*/
|
|
162
168
|
_warnIfMultipleBlocks() {
|
|
163
169
|
try {
|
|
164
|
-
|
|
170
|
+
x().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
|
|
165
171
|
} catch {
|
|
166
172
|
}
|
|
167
173
|
}
|
|
@@ -183,6 +189,19 @@ class W extends b {
|
|
|
183
189
|
}
|
|
184
190
|
return t + 1;
|
|
185
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Drops the "already fetched" claims of a block that arrived holding a baked id
|
|
194
|
+
* (saved module, paste, duplicate), so the settings panel reads its strategy again.
|
|
195
|
+
*
|
|
196
|
+
* Deferred a tick: the collision handlers rename a sibling first, and either sibling can be
|
|
197
|
+
* the renamed one depending on where the module was dropped (SD-149916).
|
|
198
|
+
*/
|
|
199
|
+
_scheduleArrivalReset(t) {
|
|
200
|
+
h().isFeatureEnabled("reusableRecommendationStrategy") && setTimeout(() => {
|
|
201
|
+
const e = this._getRecommendationId(t);
|
|
202
|
+
e !== null && e > 0 && !this._resetSourceIds.delete(e) && d().resetArrivedBlock(e);
|
|
203
|
+
}, 0);
|
|
204
|
+
}
|
|
186
205
|
/**
|
|
187
206
|
* Heals a duplicate that slipped past the create-time `_detectDuplicate`
|
|
188
207
|
* scan (or that was persisted by an older template before SD-142352).
|
|
@@ -211,9 +230,9 @@ class W extends b {
|
|
|
211
230
|
if (!o)
|
|
212
231
|
return;
|
|
213
232
|
let r = -1;
|
|
214
|
-
for (let
|
|
215
|
-
if (n[
|
|
216
|
-
r =
|
|
233
|
+
for (let a = 0; a < n.length; a++)
|
|
234
|
+
if (n[a] === o) {
|
|
235
|
+
r = a;
|
|
217
236
|
break;
|
|
218
237
|
}
|
|
219
238
|
if (r <= 0)
|
|
@@ -237,7 +256,7 @@ class W extends b {
|
|
|
237
256
|
/** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
|
|
238
257
|
_handleDuplicate(t, e) {
|
|
239
258
|
const i = this._reassignDuplicateId(t, e), n = d();
|
|
240
|
-
n.cloneBlockState(e, i), n.setCurrentBlock(i), this._warnIfMultipleBlocks();
|
|
259
|
+
n.cloneBlockState(e, i), n.setCurrentBlock(i), h().isFeatureEnabled("reusableRecommendationStrategy") && (this._resetSourceIds.add(e), n.resetArrivedBlock(i)), this._warnIfMultipleBlocks();
|
|
241
260
|
}
|
|
242
261
|
/**
|
|
243
262
|
* Core id-reassignment for a duplicated block: rewrites the DOM
|
|
@@ -270,7 +289,7 @@ class W extends b {
|
|
|
270
289
|
if (!("getAttribute" in t))
|
|
271
290
|
return;
|
|
272
291
|
const n = `ins-recommendation-v3-block-${e}`, o = `ins-recommendation-v3-block-${i}`, r = this.api.getDocumentModifier();
|
|
273
|
-
r.modifyHtml(t).removeClass(n).setClass(o), r.apply(new
|
|
292
|
+
r.modifyHtml(t).removeClass(n).setClass(o), r.apply(new p(
|
|
274
293
|
`Reassign recommendation instance class ${n} -> ${o}`
|
|
275
294
|
));
|
|
276
295
|
}
|
|
@@ -285,7 +304,7 @@ class W extends b {
|
|
|
285
304
|
if (!i)
|
|
286
305
|
return;
|
|
287
306
|
const n = this.api.getDocumentModifier();
|
|
288
|
-
n.modifyHtml(i).setAttribute(m, e.toString()), n.apply(new
|
|
307
|
+
n.modifyHtml(i).setAttribute(m, e.toString()), n.apply(new p(`Assign recommendation ID ${e}`));
|
|
289
308
|
}
|
|
290
309
|
/**
|
|
291
310
|
* Stamps the `hide-price` attribute (read by email-service at send time) on
|
|
@@ -293,7 +312,7 @@ class W extends b {
|
|
|
293
312
|
*/
|
|
294
313
|
_stampHidePrice(t, e) {
|
|
295
314
|
const i = this._getBlockElement(t);
|
|
296
|
-
i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(
|
|
315
|
+
i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(B, String(e)).apply(new p("Stamp hide-price"));
|
|
297
316
|
}
|
|
298
317
|
/**
|
|
299
318
|
* Stamps `hide-price` from config only when the block lacks the attribute —
|
|
@@ -301,7 +320,7 @@ class W extends b {
|
|
|
301
320
|
*/
|
|
302
321
|
_healHidePriceAttr(t) {
|
|
303
322
|
const e = this._getBlockElement(t);
|
|
304
|
-
if (!e || !("getAttribute" in e) || e.getAttribute(
|
|
323
|
+
if (!e || !("getAttribute" in e) || e.getAttribute(B) !== null)
|
|
305
324
|
return;
|
|
306
325
|
const { priceHideIfSameAsDiscounted: i } = s.getConfig(t);
|
|
307
326
|
this._stampHidePrice(t, i);
|
|
@@ -338,6 +357,6 @@ class W extends b {
|
|
|
338
357
|
}
|
|
339
358
|
}
|
|
340
359
|
export {
|
|
341
|
-
|
|
342
|
-
|
|
360
|
+
k as BLOCK_ID,
|
|
361
|
+
j as RecommendationBlock
|
|
343
362
|
};
|