@useinsider/guido 3.17.0-beta.668ca65 → 3.17.0-beta.a18fbda
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 +5 -6
- package/dist/@types/config/schemas.js +6 -7
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +83 -83
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +54 -41
- package/dist/composables/useActionsApi.js +82 -67
- package/dist/composables/useAutoSave.js +31 -26
- package/dist/composables/useCustomInterfaceAppearance.js +38 -52
- package/dist/composables/useEditorLock.js +20 -0
- package/dist/composables/useGuidoStateBridge.js +37 -31
- package/dist/composables/useRecommendation.js +34 -41
- package/dist/composables/useSave.js +39 -36
- package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
- package/dist/config/migrator/recommendationMigrator.js +4 -5
- package/dist/enums/academy.js +1 -2
- package/dist/enums/date.js +3 -5
- package/dist/enums/extensions/recommendationBlock.js +1 -3
- package/dist/extensions/Blocks/Recommendation/block.js +21 -26
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +34 -34
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +95 -96
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +166 -162
- package/dist/extensions/Blocks/Recommendation/services/configService.js +35 -35
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +79 -165
- package/dist/extensions/Blocks/common-control.js +19 -22
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +30 -69
- package/dist/src/@types/config/schemas.d.ts +0 -2
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useEditorLock.d.ts +10 -0
- package/dist/src/composables/useRecommendation.d.ts +0 -1
- package/dist/src/enums/academy.d.ts +0 -1
- package/dist/src/enums/date.d.ts +0 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +4 -10
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +10 -150
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -1
- package/dist/src/extensions/Blocks/common-control.d.ts +1 -4
- package/dist/src/services/recommendationApi.d.ts +1 -4
- package/dist/src/stores/config.d.ts +0 -18
- package/dist/src/stores/save-as-template.d.ts +3 -4
- package/dist/utils/dateUtil.js +10 -23
- package/dist/utils/templatePreparation.js +34 -35
- package/package.json +2 -3
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +0 -21
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +0 -105
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +0 -19
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +0 -62
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -124
- package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +0 -3
- package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -16
- package/dist/src/mock/api/recommendation-strategies.d.ts +0 -2
- package/dist/static/assets/icons/line-change.svg.js +0 -5
- package/dist/static/assets/icons/line-delete.svg.js +0 -5
- package/dist/static/assets/icons/line-plus.svg.js +0 -5
- package/dist/static/styles/components/recommendation-strategy.css.js +0 -155
|
@@ -1,52 +1,68 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
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
|
-
|
|
1
|
+
import { filterAmpErrors as v } from "../utils/ampErrorFilter.js";
|
|
2
|
+
import { useToaster as y } from "./useToaster.js";
|
|
3
|
+
const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
|
|
4
|
+
const w = setTimeout(
|
|
5
|
+
() => m(new Error(`${n} did not report completion within ${l}ms`)),
|
|
6
|
+
l
|
|
7
|
+
), p = (A) => (t) => {
|
|
8
|
+
clearTimeout(w), A(t);
|
|
9
|
+
};
|
|
10
|
+
u(p(T), p(m));
|
|
11
|
+
}), I = () => {
|
|
12
|
+
const { handleError: n } = y(), l = (t = {}) => s(
|
|
13
|
+
"compileEmail",
|
|
14
|
+
d,
|
|
15
|
+
(e, a) => {
|
|
16
|
+
const o = { ...{
|
|
17
|
+
minimize: !0,
|
|
18
|
+
utmEntity: {
|
|
19
|
+
utmSource: "",
|
|
20
|
+
utmMedium: "",
|
|
21
|
+
utmCampaign: "",
|
|
22
|
+
utmContent: "",
|
|
23
|
+
utmTerm: "",
|
|
24
|
+
customUtms: [
|
|
25
|
+
{
|
|
26
|
+
name1: "val1",
|
|
27
|
+
name2: "val2"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
mergeTags: ["Tag1", "Tag2"],
|
|
32
|
+
forceAmp: !1,
|
|
33
|
+
resetDataSavedFlag: !1,
|
|
34
|
+
disableLineHeightsReplace: !0
|
|
35
|
+
}, ...t }, c = {
|
|
36
|
+
callback: (r, C, f, S, g) => {
|
|
37
|
+
r ? a(r) : e({
|
|
38
|
+
html: C,
|
|
39
|
+
ampHtml: f,
|
|
40
|
+
ampErrors: v(S ?? []),
|
|
41
|
+
displayConditions: g
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
...o
|
|
45
|
+
};
|
|
46
|
+
window.StripoEditorApi.actionsApi.compileEmail(c);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
37
49
|
return {
|
|
38
50
|
getCompiledEmail: l,
|
|
39
|
-
getTemplateData: () =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
width: o,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
getTemplateData: () => s(
|
|
52
|
+
"getTemplateData",
|
|
53
|
+
d,
|
|
54
|
+
(t) => {
|
|
55
|
+
const e = ({ html: a, css: i, width: o, height: E, utmParams: c, syncModulesIds: r }) => t({
|
|
56
|
+
html: a,
|
|
57
|
+
css: i,
|
|
58
|
+
width: o,
|
|
59
|
+
height: E,
|
|
60
|
+
utmParams: c,
|
|
61
|
+
syncModulesIds: r
|
|
62
|
+
});
|
|
63
|
+
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
64
|
+
}
|
|
65
|
+
),
|
|
50
66
|
activateCustomViewStyles: (t = !0) => {
|
|
51
67
|
window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
|
|
52
68
|
},
|
|
@@ -65,7 +81,7 @@ const p = 1e4, D = () => {
|
|
|
65
81
|
displayConditions: a
|
|
66
82
|
};
|
|
67
83
|
} catch (e) {
|
|
68
|
-
return
|
|
84
|
+
return n(e, "Error loading preview"), {
|
|
69
85
|
html: "",
|
|
70
86
|
ampHtml: "",
|
|
71
87
|
ampErrors: [],
|
|
@@ -81,34 +97,33 @@ const p = 1e4, D = () => {
|
|
|
81
97
|
}
|
|
82
98
|
try {
|
|
83
99
|
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((i, o) => {
|
|
84
|
-
i ? (
|
|
100
|
+
i ? (n(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
|
|
85
101
|
});
|
|
86
102
|
} catch (i) {
|
|
87
|
-
|
|
103
|
+
n(i, "Failed to call updateTimerInClonedTemplate"), t(null);
|
|
88
104
|
}
|
|
89
105
|
}),
|
|
90
106
|
updateHtmlAndCss: (t, e) => {
|
|
91
107
|
const { actionsApi: a } = window.StripoEditorApi;
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
`updateHtmlAndCss did not report completion within ${p}ms`
|
|
95
|
-
), n = setTimeout(() => o(s), p);
|
|
96
|
-
a.updateHtmlAndCss(t, e, () => {
|
|
97
|
-
clearTimeout(n), i();
|
|
98
|
-
});
|
|
108
|
+
return s("updateHtmlAndCss", D, (i) => {
|
|
109
|
+
a.updateHtmlAndCss(t, e, () => i());
|
|
99
110
|
});
|
|
100
111
|
},
|
|
101
|
-
editorSave: () =>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
editorSave: () => s(
|
|
113
|
+
"save",
|
|
114
|
+
d,
|
|
115
|
+
(t) => {
|
|
116
|
+
window.StripoEditorApi.actionsApi.save((e) => {
|
|
117
|
+
if (e) {
|
|
118
|
+
n(e, "Failed to save template"), t(!1);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
t(!0);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
)
|
|
110
125
|
};
|
|
111
126
|
};
|
|
112
127
|
export {
|
|
113
|
-
|
|
128
|
+
I as useActionsApi
|
|
114
129
|
};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { useConfig as
|
|
1
|
+
import { useConfig as E } from "./useConfig.js";
|
|
2
|
+
import { useEditorLock as p } from "./useEditorLock.js";
|
|
2
3
|
import { useAutosaveStore as A, AUTOSAVE_STATUS as s } from "../stores/autosave.js";
|
|
3
|
-
import { useEditorStore as
|
|
4
|
-
import { computed as
|
|
5
|
-
const
|
|
6
|
-
const { isFeatureEnabled: S } =
|
|
4
|
+
import { useEditorStore as f } from "../stores/editor.js";
|
|
5
|
+
import { computed as y, watch as I, onUnmounted as L } from "vue";
|
|
6
|
+
const w = 18e4, v = 6e4, R = (b) => {
|
|
7
|
+
const { isFeatureEnabled: S } = E(), o = f(), t = A(), { isEditorBusy: g } = p();
|
|
7
8
|
let i = null, c = 0;
|
|
8
|
-
const u =
|
|
9
|
+
const u = y(
|
|
9
10
|
() => S("autosave") && t.isOn
|
|
10
|
-
),
|
|
11
|
-
hasChanges:
|
|
12
|
-
isInSaveableState:
|
|
13
|
-
}),
|
|
11
|
+
), m = () => o.hasChanges && o.isInSaveableState, h = () => ({
|
|
12
|
+
hasChanges: o.hasChanges,
|
|
13
|
+
isInSaveableState: o.isInSaveableState
|
|
14
|
+
}), r = async (e) => {
|
|
14
15
|
if (!u.value) {
|
|
15
16
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
|
-
if (!
|
|
19
|
+
if (!m()) {
|
|
19
20
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: h() });
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
@@ -23,15 +24,19 @@ const I = 18e4, r = 6e4, T = (b) => {
|
|
|
23
24
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
27
|
+
if (g()) {
|
|
28
|
+
console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
26
31
|
console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
|
|
27
32
|
try {
|
|
28
33
|
if (await b() === void 0) {
|
|
29
34
|
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = s.ERROR;
|
|
30
35
|
return;
|
|
31
36
|
}
|
|
32
|
-
|
|
33
|
-
} catch (
|
|
34
|
-
console.debug("guido:autosave:error", { trigger: e, error:
|
|
37
|
+
o.hasChanges = !1, t.status = s.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
|
|
38
|
+
} catch (a) {
|
|
39
|
+
console.debug("guido:autosave:error", { trigger: e, error: a }), t.status = s.ERROR;
|
|
35
40
|
}
|
|
36
41
|
}, n = () => {
|
|
37
42
|
const { visibilityState: e } = document;
|
|
@@ -40,32 +45,32 @@ const I = 18e4, r = 6e4, T = (b) => {
|
|
|
40
45
|
isActive: u.value
|
|
41
46
|
}), e !== "hidden")
|
|
42
47
|
return;
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
48
|
+
const a = Date.now() - c;
|
|
49
|
+
if (a < v) {
|
|
45
50
|
console.debug("guido:autosave:visibility-debounced", {
|
|
46
|
-
sinceLastMs:
|
|
47
|
-
debounceMs:
|
|
51
|
+
sinceLastMs: a,
|
|
52
|
+
debounceMs: v
|
|
48
53
|
});
|
|
49
54
|
return;
|
|
50
55
|
}
|
|
51
|
-
c = Date.now(),
|
|
56
|
+
c = Date.now(), r("visibility");
|
|
52
57
|
}, d = () => {
|
|
53
58
|
i && (clearInterval(i), i = null);
|
|
54
|
-
},
|
|
59
|
+
}, l = () => {
|
|
55
60
|
document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
|
|
56
61
|
};
|
|
57
|
-
|
|
62
|
+
I(
|
|
58
63
|
u,
|
|
59
64
|
(e) => {
|
|
60
65
|
console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), i = setInterval(() => {
|
|
61
|
-
console.debug("guido:autosave:interval-tick"),
|
|
62
|
-
},
|
|
66
|
+
console.debug("guido:autosave:interval-tick"), r("interval");
|
|
67
|
+
}, w), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), l(), t.status = s.IDLE);
|
|
63
68
|
},
|
|
64
69
|
{ immediate: !0 }
|
|
65
|
-
),
|
|
66
|
-
d(),
|
|
70
|
+
), L(() => {
|
|
71
|
+
d(), l(), t.status = s.IDLE, t.lastSavedAt = null;
|
|
67
72
|
});
|
|
68
73
|
};
|
|
69
74
|
export {
|
|
70
|
-
|
|
75
|
+
R as useAutoSave
|
|
71
76
|
};
|
|
@@ -1,67 +1,53 @@
|
|
|
1
|
-
import S from "../static/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import w from "../static/styles/components/
|
|
17
|
-
import y from "../static/styles/components/
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import P from "../static/styles/components/wide-panel.css.js";
|
|
22
|
-
import x from "../static/styles/variables.css.js";
|
|
23
|
-
function r(t, o) {
|
|
24
|
-
return `--guido-icon-${t}: url("data:image/svg+xml,${encodeURIComponent(o.trim())}");`;
|
|
25
|
-
}
|
|
26
|
-
const A = `:host {
|
|
27
|
-
${r("line-change", S)}
|
|
28
|
-
${r("line-delete", i)}
|
|
29
|
-
${r("line-plus", n)}
|
|
30
|
-
}`, R = [
|
|
31
|
-
x,
|
|
1
|
+
import S from "../static/styles/base.css.js";
|
|
2
|
+
import m from "../static/styles/components/alert-message.css.js";
|
|
3
|
+
import e from "../static/styles/components/amp-block.css.js";
|
|
4
|
+
import i from "../static/styles/components/base-input.css.js";
|
|
5
|
+
import p from "../static/styles/components/button-group.css.js";
|
|
6
|
+
import n from "../static/styles/components/button.css.js";
|
|
7
|
+
import s from "../static/styles/components/combobox.css.js";
|
|
8
|
+
import C from "../static/styles/components/counter.css.js";
|
|
9
|
+
import f from "../static/styles/components/dropdown-menu.css.js";
|
|
10
|
+
import a from "../static/styles/components/loader.css.js";
|
|
11
|
+
import u from "../static/styles/components/narrow-panel.css.js";
|
|
12
|
+
import c from "../static/styles/components/popup.css.js";
|
|
13
|
+
import d from "../static/styles/components/switcher.css.js";
|
|
14
|
+
import l from "../static/styles/components/tabs.css.js";
|
|
15
|
+
import h from "../static/styles/components/tools.css.js";
|
|
16
|
+
import w from "../static/styles/components/version-history.css.js";
|
|
17
|
+
import y from "../static/styles/components/wide-panel.css.js";
|
|
18
|
+
import B from "../static/styles/variables.css.js";
|
|
19
|
+
const b = [
|
|
20
|
+
B,
|
|
32
21
|
// Must be on top
|
|
33
|
-
|
|
34
|
-
p,
|
|
22
|
+
S,
|
|
35
23
|
// Must be on top
|
|
24
|
+
m,
|
|
25
|
+
e,
|
|
26
|
+
i,
|
|
27
|
+
p,
|
|
28
|
+
n,
|
|
36
29
|
s,
|
|
37
30
|
C,
|
|
38
|
-
a,
|
|
39
31
|
f,
|
|
40
|
-
|
|
32
|
+
a,
|
|
41
33
|
u,
|
|
42
|
-
|
|
34
|
+
c,
|
|
43
35
|
d,
|
|
36
|
+
l,
|
|
44
37
|
h,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
y,
|
|
48
|
-
b,
|
|
49
|
-
B,
|
|
50
|
-
$,
|
|
51
|
-
P,
|
|
52
|
-
w
|
|
53
|
-
// Last: overrides button.css / wide-panel.css defaults
|
|
38
|
+
w,
|
|
39
|
+
y
|
|
54
40
|
].join(`
|
|
55
41
|
|
|
56
|
-
`),
|
|
42
|
+
`), v = () => ({ importCss: () => {
|
|
57
43
|
const o = new CSSStyleSheet();
|
|
58
|
-
o.replaceSync(
|
|
59
|
-
const
|
|
60
|
-
if (!
|
|
44
|
+
o.replaceSync(b);
|
|
45
|
+
const r = document.querySelector("ui-editor");
|
|
46
|
+
if (!r)
|
|
61
47
|
return;
|
|
62
|
-
const
|
|
63
|
-
|
|
48
|
+
const t = r.shadowRoot;
|
|
49
|
+
t && (t.adoptedStyleSheets = [o]);
|
|
64
50
|
} });
|
|
65
51
|
export {
|
|
66
|
-
|
|
52
|
+
v as useCustomInterfaceAppearance
|
|
67
53
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
let o = Promise.resolve(), n = 0, e = 0;
|
|
2
|
+
const s = () => n > 0, c = () => (e += 1, e), u = (t) => t > 0 && t === e, i = (t) => {
|
|
3
|
+
const r = o.then(async () => {
|
|
4
|
+
n += 1;
|
|
5
|
+
try {
|
|
6
|
+
return await t();
|
|
7
|
+
} finally {
|
|
8
|
+
n -= 1;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
return o = r.catch(() => {
|
|
12
|
+
}), r;
|
|
13
|
+
}, a = () => ({ runExclusive: i, isEditorBusy: s, beginMount: c, isCurrentMount: u });
|
|
14
|
+
export {
|
|
15
|
+
c as beginMount,
|
|
16
|
+
u as isCurrentMount,
|
|
17
|
+
s as isEditorBusy,
|
|
18
|
+
i as runExclusive,
|
|
19
|
+
a as useEditorLock
|
|
20
|
+
};
|
|
@@ -1,48 +1,54 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { useActionsApi as b } from "./useActionsApi.js";
|
|
2
|
+
import { useEditorLock as v } from "./useEditorLock.js";
|
|
3
|
+
import { useConfigStore as T } from "../stores/config.js";
|
|
4
|
+
import { useEditorStore as w } from "../stores/editor.js";
|
|
5
|
+
import { useGuidoEmailEditorStore as y } from "../stores/guido-email-editor.js";
|
|
6
|
+
import { watch as a, onUnmounted as B } from "vue";
|
|
7
|
+
const C = 500, L = () => {
|
|
8
|
+
const i = w(), u = y(), l = T(), { getTemplateData: d } = b(), { runExclusive: m, isEditorBusy: p } = v();
|
|
9
|
+
let o = null, s = !1;
|
|
10
|
+
const n = () => {
|
|
11
|
+
o && (clearTimeout(o), o = null);
|
|
12
|
+
}, c = (t) => {
|
|
13
|
+
n(), o = setTimeout(() => {
|
|
14
|
+
o = null, t();
|
|
15
|
+
}, C);
|
|
16
|
+
}, e = async () => {
|
|
17
|
+
var t, r;
|
|
18
|
+
if (!(s || !i.isStripoInitialized)) {
|
|
19
|
+
if (p()) {
|
|
20
|
+
c(() => void e());
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
14
23
|
try {
|
|
15
|
-
const { html:
|
|
16
|
-
if (
|
|
24
|
+
const { html: E, css: g } = await m(d), I = ((r = (t = l.config) == null ? void 0 : t.identity) == null ? void 0 : r.templateId) ?? "";
|
|
25
|
+
if (s)
|
|
17
26
|
return;
|
|
18
|
-
|
|
19
|
-
html:
|
|
20
|
-
css:
|
|
21
|
-
templateId:
|
|
27
|
+
u.$patch({
|
|
28
|
+
html: E ?? "",
|
|
29
|
+
css: g ?? "",
|
|
30
|
+
templateId: I,
|
|
22
31
|
lastUpdatedAt: Date.now()
|
|
23
32
|
});
|
|
24
33
|
} catch {
|
|
25
34
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
e = null, s();
|
|
29
|
-
}, w);
|
|
30
|
-
}, d = c(
|
|
35
|
+
}
|
|
36
|
+
}, f = () => c(() => void e()), h = a(
|
|
31
37
|
() => i.isStripoInitialized,
|
|
32
38
|
(t) => {
|
|
33
|
-
t &&
|
|
39
|
+
t && e();
|
|
34
40
|
},
|
|
35
41
|
{ immediate: !0 }
|
|
36
|
-
),
|
|
42
|
+
), S = a(
|
|
37
43
|
() => i.hasChanges,
|
|
38
|
-
(t,
|
|
39
|
-
i.isStripoInitialized && (t ?
|
|
44
|
+
(t, r) => {
|
|
45
|
+
i.isStripoInitialized && (t ? f() : r && (n(), e()));
|
|
40
46
|
}
|
|
41
47
|
);
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
B(() => {
|
|
49
|
+
s = !0, n(), h(), S();
|
|
44
50
|
});
|
|
45
51
|
};
|
|
46
52
|
export {
|
|
47
|
-
|
|
53
|
+
L as useGuidoStateBridge
|
|
48
54
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as
|
|
2
|
-
import { MinDeviceViewport as C, DefaultPadding as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as I, URLS as R } from "../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { MinDeviceViewport as C, DefaultPadding as b } from "../enums/recommendation.js";
|
|
3
3
|
import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
|
-
import { generateCompleteFilterQuery as
|
|
5
|
-
import { getPartnerRecommendationParams as
|
|
4
|
+
import { generateCompleteFilterQuery as h } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
|
+
import { getPartnerRecommendationParams as y } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
|
|
6
6
|
import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
|
|
7
7
|
import { useConfigStore as P } from "../stores/config.js";
|
|
8
8
|
const B = () => ({
|
|
9
9
|
calculateCardWidth: ({
|
|
10
|
-
mobileLeftPadding:
|
|
11
|
-
mobileRightPadding:
|
|
12
|
-
cardsInRow:
|
|
10
|
+
mobileLeftPadding: a,
|
|
11
|
+
mobileRightPadding: s,
|
|
12
|
+
cardsInRow: c,
|
|
13
13
|
unresponsive: n
|
|
14
14
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
return (C - e) /
|
|
15
|
+
const r = n ? c : 1, e = a + s + (r - 1) * b;
|
|
16
|
+
return (C - e) / r;
|
|
17
17
|
},
|
|
18
|
-
getRecommendationCampaignData: (
|
|
19
|
-
const
|
|
18
|
+
getRecommendationCampaignData: (a) => {
|
|
19
|
+
const s = l(), c = Number(a), n = s.blockStates[c];
|
|
20
20
|
if (!n)
|
|
21
21
|
return {
|
|
22
22
|
textTrimming: !1,
|
|
@@ -30,54 +30,47 @@ const B = () => ({
|
|
|
30
30
|
discountBeforeTextValue: "",
|
|
31
31
|
discountAfterTextValue: ""
|
|
32
32
|
};
|
|
33
|
-
const { recommendationConfigs:
|
|
33
|
+
const { recommendationConfigs: r } = n, e = r.orientation === "grid" ? "vertical" : "horizontal";
|
|
34
34
|
return {
|
|
35
|
-
textTrimming:
|
|
35
|
+
textTrimming: r.textTrimming,
|
|
36
36
|
orientation: e,
|
|
37
37
|
mobileLeftPadding: 0,
|
|
38
38
|
mobileRightPadding: 0,
|
|
39
|
-
cardsInRow:
|
|
40
|
-
unresponsive:
|
|
39
|
+
cardsInRow: r.cardsInRow,
|
|
40
|
+
unresponsive: r.unresponsive,
|
|
41
41
|
priceBeforeTextValue: "",
|
|
42
42
|
priceAfterTextValue: "",
|
|
43
43
|
discountBeforeTextValue: "",
|
|
44
44
|
discountAfterTextValue: ""
|
|
45
45
|
};
|
|
46
46
|
},
|
|
47
|
-
buildCampaignUrl: (
|
|
47
|
+
buildCampaignUrl: (a, s) => {
|
|
48
48
|
var m;
|
|
49
|
-
const
|
|
49
|
+
const c = l(), n = P(), r = Number(a);
|
|
50
50
|
let e;
|
|
51
|
-
if (
|
|
52
|
-
e =
|
|
51
|
+
if (s)
|
|
52
|
+
e = s;
|
|
53
53
|
else {
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
54
|
+
const i = c.blockStates[r];
|
|
55
|
+
if (!i)
|
|
56
56
|
return "";
|
|
57
|
-
const { recommendationConfigs:
|
|
57
|
+
const { recommendationConfigs: o } = i;
|
|
58
58
|
e = {
|
|
59
|
-
strategy:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
shuffleProducts: r.shuffleProducts
|
|
59
|
+
strategy: o.strategy,
|
|
60
|
+
language: o.language,
|
|
61
|
+
currencyCode: o.currencySettings.value,
|
|
62
|
+
size: o.size,
|
|
63
|
+
productIds: o.productIds,
|
|
64
|
+
filters: o.filters,
|
|
65
|
+
shuffleProducts: o.shuffleProducts
|
|
67
66
|
};
|
|
68
67
|
}
|
|
69
|
-
|
|
70
|
-
return s.recommendationCampaignUrls[i] = {
|
|
71
|
-
strategyId: e.strategyId,
|
|
72
|
-
locale: e.language,
|
|
73
|
-
currency: e.currencyCode
|
|
74
|
-
}, "";
|
|
75
|
-
const g = ((m = y().find((a) => a.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
68
|
+
const f = ((m = I().find((i) => i.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
76
69
|
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", n.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", n.variationId), e.strategy === "manualMerchandising" ? t.set("productId", x(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
|
|
77
|
-
const
|
|
78
|
-
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(
|
|
79
|
-
const p = decodeURIComponent(t.toString()), u = `${
|
|
80
|
-
return
|
|
70
|
+
const g = e.filters.filter((i) => i.isValid), d = h(g);
|
|
71
|
+
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(n.partnerName, e.strategy)).forEach(([i, o]) => t.set(i, o));
|
|
72
|
+
const p = decodeURIComponent(t.toString()), u = `${R.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
|
|
73
|
+
return c.recommendationCampaignUrls[a] = u, u;
|
|
81
74
|
}
|
|
82
75
|
});
|
|
83
76
|
export {
|