@useinsider/guido 3.2.0-beta.caa22bf → 3.2.0-beta.ccaf9f5
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 +0 -92
- package/dist/@types/config/schemas.js +94 -150
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +75 -75
- package/dist/composables/useCortexBlueprintBridge.js +38 -0
- package/dist/composables/useEmailTemplateApplier.js +41 -0
- package/dist/composables/useRecommendation.js +26 -46
- package/dist/composables/useSave.js +18 -21
- package/dist/composables/useStripo.js +16 -14
- package/dist/config/compiler/recommendationCompilerRules.js +27 -27
- package/dist/config/migrator/index.js +9 -9
- package/dist/config/migrator/radioButtonMigrator.js +44 -64
- package/dist/config/migrator/recommendationMigrator.js +290 -74
- package/dist/enums/displayConditions.js +80 -0
- package/dist/enums/extensions/recommendationBlock.js +1 -2
- package/dist/extensions/Blocks/RadioButton/template.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +32 -35
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +24 -25
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +181 -228
- package/dist/extensions/Blocks/Recommendation/services/configService.js +29 -65
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +90 -130
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +251 -0
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +22 -13
- package/dist/guido.css +1 -1
- package/dist/node_modules/valibot/dist/index.js +235 -450
- package/dist/src/@types/config/defaults.d.ts +1 -5
- package/dist/src/@types/config/index.d.ts +3 -3
- package/dist/src/@types/config/schemas.d.ts +0 -213
- package/dist/src/@types/config/types.d.ts +1 -9
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +0 -56
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +17 -0
- package/dist/src/composables/useEmailTemplateApplier.d.ts +21 -0
- package/dist/src/composables/useRecommendation.d.ts +1 -10
- package/dist/src/config/migrator/index.d.ts +1 -2
- package/dist/src/config/migrator/recommendationMigrator.d.ts +1 -13
- package/dist/src/enums/displayConditions.d.ts +2 -0
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -34
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +3 -0
- package/dist/src/library.d.ts +1 -1
- package/dist/src/stores/config.d.ts +0 -504
- package/dist/utils/templatePreparation.js +32 -72
- package/package.json +1 -5
- package/dist/composables/validators/useCouponBlockValidator.js +0 -24
- package/dist/config/migrator/recommendation/compositionMapper.js +0 -98
- package/dist/config/migrator/recommendation/extractors.js +0 -27
- package/dist/config/migrator/recommendation/htmlBuilder.js +0 -496
- package/dist/config/migrator/recommendation/parseLegacyConfig.js +0 -33
- package/dist/config/migrator/recommendation/settingsMapper.js +0 -70
- package/dist/config/migrator/recommendation/themeMapper.js +0 -93
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +0 -21
- package/dist/src/composables/useRecommendation.test.d.ts +0 -1
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +0 -2
- package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +0 -1
- package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -7
- package/dist/src/config/migrator/recommendation/extractors.test.d.ts +0 -1
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +0 -11
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +0 -15
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +0 -1
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +0 -7
- package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +0 -1
- package/dist/src/config/migrator/recommendation/themeMapper.d.ts +0 -5
- package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +0 -1
- package/dist/src/config/migrator/recommendation/types.d.ts +0 -205
- package/dist/src/config/migrator/recommendationMigrator.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +0 -21
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +0 -1
- package/dist/src/utils/htmlEscape.d.ts +0 -5
- package/dist/src/utils/htmlEscape.test.d.ts +0 -1
- package/dist/utils/htmlEscape.js +0 -13
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as j, defineAsyncComponent as R, ref as A, computed as B, watch as J, onMounted as Q, onUnmounted as X } from "vue";
|
|
2
|
+
import { useCortexBlueprintBridge as Y } from "../composables/useCortexBlueprintBridge.js";
|
|
2
3
|
import { provideGuidoActions as Z } from "../composables/useGuidoActions.js";
|
|
3
4
|
import { usePartner as ee } from "../composables/usePartner.js";
|
|
4
|
-
import { useStripo as
|
|
5
|
-
import { useTimerClone as
|
|
6
|
-
import { migrate as
|
|
7
|
-
import { ModuleFolderDefaults as
|
|
5
|
+
import { useStripo as te } from "../composables/useStripo.js";
|
|
6
|
+
import { useTimerClone as oe } from "../composables/useTimerClone.js";
|
|
7
|
+
import { migrate as I } from "../config/migrator/index.js";
|
|
8
|
+
import { ModuleFolderDefaults as W } from "../enums/defaults.js";
|
|
8
9
|
import { RIBBON_SELECTOR as ne } from "../enums/onboarding.js";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
10
|
+
import re from "./organisms/base/Toaster.vue.js";
|
|
11
|
+
import se from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
11
12
|
import ce from "./organisms/header/HeaderWrapper.vue.js";
|
|
12
13
|
import ae from "./organisms/LoadingWrapper.vue.js";
|
|
13
14
|
import ie from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
@@ -18,115 +19,114 @@ import { useDynamicContentStore as ue } from "../stores/dynamic-content.js";
|
|
|
18
19
|
import { useEditorStore as pe } from "../stores/editor.js";
|
|
19
20
|
import { usePreviewStore as fe } from "../stores/preview.js";
|
|
20
21
|
import { useUnsubscribeStore as ve } from "../stores/unsubscribe.js";
|
|
21
|
-
const
|
|
22
|
+
const Be = /* @__PURE__ */ j({
|
|
22
23
|
__name: "Guido",
|
|
23
24
|
props: {
|
|
24
25
|
config: null
|
|
25
26
|
},
|
|
26
27
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
27
|
-
setup(
|
|
28
|
-
const
|
|
28
|
+
setup(x, { expose: H, emit: r }) {
|
|
29
|
+
const b = x, G = R(
|
|
29
30
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
30
|
-
),
|
|
31
|
+
), z = R(
|
|
31
32
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
32
|
-
),
|
|
33
|
-
|
|
34
|
-
const
|
|
33
|
+
), S = A(), d = A(), l = ue(), g = ve(), a = le();
|
|
34
|
+
a.init(b.config);
|
|
35
|
+
const u = pe(), q = fe(), i = B(() => u.hasChanges), { isTestPartner: K } = ee(), w = () => {
|
|
35
36
|
var e;
|
|
36
|
-
return (e =
|
|
37
|
+
return (e = S.value) == null ? void 0 : e.handleSave(!0);
|
|
37
38
|
}, {
|
|
38
|
-
templateId:
|
|
39
|
-
userId:
|
|
40
|
-
partnerName:
|
|
41
|
-
username:
|
|
42
|
-
template:
|
|
43
|
-
editor:
|
|
44
|
-
} =
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
emailId:
|
|
48
|
-
userId:
|
|
49
|
-
username:
|
|
50
|
-
partnerName:
|
|
51
|
-
savedModulesFolderName:
|
|
52
|
-
defaultModulesFolderName:
|
|
53
|
-
},
|
|
54
|
-
preselectedDynamicContentList:
|
|
39
|
+
templateId: p,
|
|
40
|
+
userId: E,
|
|
41
|
+
partnerName: D,
|
|
42
|
+
username: C,
|
|
43
|
+
template: t,
|
|
44
|
+
editor: s
|
|
45
|
+
} = a, m = (t == null ? void 0 : t.html) || "", T = (t == null ? void 0 : t.css) || "", f = (t == null ? void 0 : t.preselectedDynamicContent) || [], k = (s == null ? void 0 : s.savedModulesFolderName) || W.SAVED_MODULES, F = (s == null ? void 0 : s.defaultModulesFolderName) || W.DEFAULT_MODULES;
|
|
46
|
+
u.templateId = p, Y();
|
|
47
|
+
const v = {
|
|
48
|
+
emailId: p,
|
|
49
|
+
userId: E,
|
|
50
|
+
username: C,
|
|
51
|
+
partnerName: D,
|
|
52
|
+
savedModulesFolderName: k,
|
|
53
|
+
defaultModulesFolderName: F
|
|
54
|
+
}, L = {
|
|
55
|
+
preselectedDynamicContentList: f,
|
|
55
56
|
onReady: () => {
|
|
56
|
-
console.debug("guido:ready"),
|
|
57
|
+
console.debug("guido:ready"), r("ready");
|
|
57
58
|
}
|
|
58
|
-
}, { initPlugin:
|
|
59
|
+
}, { initPlugin: U } = te(v, L), { getDefaultTemplate: _ } = de(), { cloneTimersOnSave: M, hasTimerBlocks: O } = oe(), V = B(() => {
|
|
59
60
|
var e;
|
|
60
|
-
return !((e =
|
|
61
|
+
return !((e = a.ui) != null && e.showHeader);
|
|
61
62
|
});
|
|
62
63
|
Z({
|
|
63
64
|
onBack: () => {
|
|
64
|
-
console.debug("guido:back"),
|
|
65
|
+
console.debug("guido:back"), r("back");
|
|
65
66
|
},
|
|
66
67
|
onSaveStart: () => {
|
|
67
|
-
console.debug("guido:save:start"),
|
|
68
|
+
console.debug("guido:save:start"), r("save:start");
|
|
68
69
|
},
|
|
69
70
|
onSaveComplete: (e) => {
|
|
70
|
-
const
|
|
71
|
-
console.debug("guido:save:complete",
|
|
71
|
+
const n = { ...e, metadata: v };
|
|
72
|
+
console.debug("guido:save:complete", n), r("save:complete", n);
|
|
72
73
|
},
|
|
73
74
|
onTestEmailClick: () => {
|
|
74
|
-
console.debug("guido:test-email:click"),
|
|
75
|
+
console.debug("guido:test-email:click"), r("test-email:click");
|
|
75
76
|
}
|
|
76
77
|
});
|
|
77
|
-
const
|
|
78
|
-
console.debug("dynamic-content:close", e),
|
|
79
|
-
},
|
|
78
|
+
const P = (e) => {
|
|
79
|
+
console.debug("dynamic-content:close", e), l.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
80
|
+
}, N = () => {
|
|
80
81
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
81
82
|
};
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
J(() => i.value, () => {
|
|
84
|
+
r("on-change", i.value);
|
|
84
85
|
});
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
console.debug("dynamic-content:open",
|
|
86
|
+
const y = (e) => {
|
|
87
|
+
const n = e, { attribute: o, position: $ } = n.detail;
|
|
88
|
+
console.debug("dynamic-content:open", n.detail), r("dynamic-content:open", o, $);
|
|
88
89
|
};
|
|
89
90
|
let c = null;
|
|
90
|
-
const
|
|
91
|
-
var
|
|
91
|
+
const h = () => {
|
|
92
|
+
var n;
|
|
92
93
|
const e = document.querySelector(ne);
|
|
93
|
-
(
|
|
94
|
+
(n = d.value) == null || n.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
|
|
94
95
|
};
|
|
95
|
-
return
|
|
96
|
-
var
|
|
97
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"),
|
|
98
|
-
const e = (
|
|
99
|
-
e && (c = new ResizeObserver(
|
|
96
|
+
return Q(async () => {
|
|
97
|
+
var n;
|
|
98
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), h();
|
|
99
|
+
const e = (n = d.value) == null ? void 0 : n.parentElement;
|
|
100
|
+
e && (c = new ResizeObserver(h), c.observe(e));
|
|
100
101
|
try {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
css: F
|
|
102
|
+
g.selectedUnsubscribePages = (t == null ? void 0 : t.selectedUnsubscribePages) || [];
|
|
103
|
+
let o = {
|
|
104
|
+
html: m && await I(m),
|
|
105
|
+
css: T
|
|
106
106
|
};
|
|
107
|
-
|
|
108
|
-
} catch (
|
|
109
|
-
console.error("Failed to initialize Stripo editor:",
|
|
107
|
+
o.html || (o = await _(), o.html = await I(o.html)), O(o.html) && (o.html = await M(o.html)), await U(o), l.selectedDynamicContentList = f;
|
|
108
|
+
} catch (o) {
|
|
109
|
+
console.error("Failed to initialize Stripo editor:", o);
|
|
110
110
|
}
|
|
111
|
-
document.addEventListener("dynamic-content:open",
|
|
112
|
-
}),
|
|
113
|
-
c == null || c.disconnect(), document.removeEventListener("dynamic-content:open",
|
|
111
|
+
document.addEventListener("dynamic-content:open", y);
|
|
112
|
+
}), X(() => {
|
|
113
|
+
c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", y);
|
|
114
114
|
try {
|
|
115
115
|
window.UIEditor.removeEditor();
|
|
116
116
|
} catch {
|
|
117
117
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
118
118
|
}
|
|
119
|
-
|
|
120
|
-
}),
|
|
119
|
+
a.reset();
|
|
120
|
+
}), H({
|
|
121
121
|
dynamicContent: {
|
|
122
|
-
insert:
|
|
123
|
-
close:
|
|
122
|
+
insert: P,
|
|
123
|
+
close: N
|
|
124
124
|
},
|
|
125
|
-
hasChanges:
|
|
126
|
-
saveSilent:
|
|
127
|
-
}), { __sfc: !0, PreviewContainer:
|
|
125
|
+
hasChanges: i,
|
|
126
|
+
saveSilent: w
|
|
127
|
+
}), { __sfc: !0, PreviewContainer: G, OnboardingWrapper: z, headerWrapperRef: S, wrapperRef: d, dynamicContentStore: l, unsubscribeStore: g, props: b, configStore: a, editorStore: u, previewStore: q, hasChanges: i, isTestPartner: K, saveSilent: w, templateId: p, userId: E, partnerName: D, username: C, templateConfig: t, editorConfig: s, html: m, css: T, preselectedDynamicContentList: f, savedModulesFolderName: k, defaultModulesFolderName: F, emit: r, metadata: v, options: L, initPlugin: U, getDefaultTemplate: _, cloneTimersOnSave: M, hasTimerBlocks: O, noHeader: V, insertDynamicContent: P, closeDynamicContent: N, handleDynamicContentOpen: y, ribbonObserver: c, updateRibbonOffset: h, Toaster: re, FilterSelectionDrawer: se, HeaderWrapper: ce, LoadingWrapper: ae, SaveAsTemplateDrawer: ie, UnsubscribeWrapper: me };
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
export {
|
|
131
|
-
|
|
131
|
+
Be as default
|
|
132
132
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useEmailTemplateApplier as T, resetEmailTemplateApplier as E } from "./useEmailTemplateApplier.js";
|
|
2
|
+
import { getActivePinia as h } from "pinia";
|
|
3
|
+
import { watch as d, onUnmounted as y } from "vue";
|
|
4
|
+
const _ = "email_template", b = "chat", B = () => {
|
|
5
|
+
const l = h();
|
|
6
|
+
if (!l)
|
|
7
|
+
return;
|
|
8
|
+
const p = l._s, c = p == null ? void 0 : p.get(b);
|
|
9
|
+
if (!c)
|
|
10
|
+
return;
|
|
11
|
+
const { applyTemplate: m, applyTemplateDebounced: f } = T(), e = /* @__PURE__ */ new Map(), A = d(
|
|
12
|
+
() => c.messages,
|
|
13
|
+
(a) => {
|
|
14
|
+
Array.isArray(a) && a.forEach((n) => {
|
|
15
|
+
const u = n == null ? void 0 : n.segments;
|
|
16
|
+
Array.isArray(u) && u.forEach((i) => {
|
|
17
|
+
if ((i == null ? void 0 : i.type) !== "blueprint")
|
|
18
|
+
return;
|
|
19
|
+
const o = i;
|
|
20
|
+
if (o.blueprintType !== _)
|
|
21
|
+
return;
|
|
22
|
+
const r = o.blueprintId, t = o.blueprintData;
|
|
23
|
+
if (!r || !(t != null && t.html))
|
|
24
|
+
return;
|
|
25
|
+
const s = e.get(r);
|
|
26
|
+
s === void 0 ? (e.set(r, t.html), m(r, t)) : s !== t.html && (e.set(r, t.html), f(r, t));
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
{ deep: !0, immediate: !0 }
|
|
31
|
+
);
|
|
32
|
+
y(() => {
|
|
33
|
+
A(), e.clear(), E();
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
B as useCortexBlueprintBridge
|
|
38
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useActionsApi as u } from "./useActionsApi.js";
|
|
2
|
+
import { useToaster as T } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as f } from "./useTranslations.js";
|
|
4
|
+
import { ToasterTypeOptions as n } from "../enums/toaster.js";
|
|
5
|
+
import { ref as y } from "vue";
|
|
6
|
+
const h = 250, s = y({}), o = {}, j = () => {
|
|
7
|
+
const { updateHtmlAndCss: l } = u(), { showToaster: r } = T(), i = f(), c = (e, t, p) => {
|
|
8
|
+
s.value = { ...s.value, [e]: "applying" };
|
|
9
|
+
try {
|
|
10
|
+
l(t, p), s.value = { ...s.value, [e]: "applied" }, r({
|
|
11
|
+
type: n.Success,
|
|
12
|
+
message: i("newsletter.ai-template-applied")
|
|
13
|
+
});
|
|
14
|
+
} catch (a) {
|
|
15
|
+
s.value = { ...s.value, [e]: "failed" }, r({
|
|
16
|
+
type: n.Alert,
|
|
17
|
+
message: a instanceof Error ? a.message : "Failed to apply template"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}, m = (e) => {
|
|
21
|
+
const t = o[e];
|
|
22
|
+
t && (clearTimeout(t), delete o[e]);
|
|
23
|
+
};
|
|
24
|
+
return { applyStatus: s, applyTemplate: (e, t) => {
|
|
25
|
+
t.html && (m(e), c(e, t.html, t.css ?? ""));
|
|
26
|
+
}, applyTemplateDebounced: (e, t) => {
|
|
27
|
+
if (!t.html)
|
|
28
|
+
return;
|
|
29
|
+
m(e);
|
|
30
|
+
const { html: p } = t, a = t.css ?? "";
|
|
31
|
+
o[e] = setTimeout(() => {
|
|
32
|
+
delete o[e], c(e, p, a);
|
|
33
|
+
}, h);
|
|
34
|
+
} };
|
|
35
|
+
}, w = () => {
|
|
36
|
+
Object.values(o).forEach(clearTimeout), Object.keys(o).forEach((l) => delete o[l]), s.value = {};
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
w as resetEmailTemplateApplier,
|
|
40
|
+
j as useEmailTemplateApplier
|
|
41
|
+
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { RecommendationFeedSourceMaps as
|
|
1
|
+
import { RecommendationFeedSourceMaps as g, URLS as p } from "../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { MinDeviceViewport as R, DefaultPadding as b } from "../enums/recommendation.js";
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
4
|
-
import { generateCompleteFilterQuery as
|
|
5
|
-
import { useConfigStore as
|
|
6
|
-
const
|
|
3
|
+
import { useRecommendationExtensionStore as u } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
|
+
import { generateCompleteFilterQuery as x } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
|
+
import { useConfigStore as I } from "../stores/config.js";
|
|
6
|
+
const N = () => ({
|
|
7
7
|
calculateCardWidth: ({
|
|
8
|
-
mobileLeftPadding:
|
|
9
|
-
mobileRightPadding:
|
|
10
|
-
cardsInRow:
|
|
11
|
-
unresponsive:
|
|
8
|
+
mobileLeftPadding: i,
|
|
9
|
+
mobileRightPadding: n,
|
|
10
|
+
cardsInRow: o,
|
|
11
|
+
unresponsive: a
|
|
12
12
|
}) => {
|
|
13
|
-
const r =
|
|
13
|
+
const r = a ? o : 1, e = i + n + (r - 1) * b;
|
|
14
14
|
return (R - e) / r;
|
|
15
15
|
},
|
|
16
|
-
getRecommendationCampaignData: (
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
16
|
+
getRecommendationCampaignData: (i) => {
|
|
17
|
+
const n = u(), o = Number(i), a = n.blockStates[o];
|
|
18
|
+
if (!a)
|
|
19
19
|
return {
|
|
20
20
|
textTrimming: !1,
|
|
21
21
|
orientation: "vertical",
|
|
@@ -28,7 +28,7 @@ const w = () => ({
|
|
|
28
28
|
discountBeforeTextValue: "",
|
|
29
29
|
discountAfterTextValue: ""
|
|
30
30
|
};
|
|
31
|
-
const { recommendationConfigs: r } =
|
|
31
|
+
const { recommendationConfigs: r } = a, e = r.orientation === "grid" ? "vertical" : "horizontal";
|
|
32
32
|
return {
|
|
33
33
|
textTrimming: r.textTrimming,
|
|
34
34
|
orientation: e,
|
|
@@ -42,39 +42,19 @@ const w = () => ({
|
|
|
42
42
|
discountAfterTextValue: ""
|
|
43
43
|
};
|
|
44
44
|
},
|
|
45
|
-
buildCampaignUrl: (
|
|
46
|
-
var
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
e = {
|
|
57
|
-
strategy: o.strategy,
|
|
58
|
-
language: o.language,
|
|
59
|
-
currencyCode: o.currencySettings.value,
|
|
60
|
-
size: o.size,
|
|
61
|
-
productIds: o.productIds,
|
|
62
|
-
filters: o.filters,
|
|
63
|
-
shuffleProducts: o.shuffleProducts
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
const f = ((l = I.find((i) => i.key === e.strategy)) == null ? void 0 : l.path) || "", t = new URLSearchParams();
|
|
67
|
-
if (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") {
|
|
68
|
-
const i = parseInt(e.size) || 6;
|
|
69
|
-
t.set("productId", e.productIds.slice(0, i).join(","));
|
|
70
|
-
} else e.strategy === "similarViewed" && t.set("productId", "{itemId}");
|
|
71
|
-
e.strategy === "userBased" && t.set("userId", "{user_id}");
|
|
72
|
-
const g = e.filters.filter((i) => i.isValid), d = h(g);
|
|
73
|
-
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true");
|
|
74
|
-
const p = decodeURIComponent(t.toString()), u = `${C.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
|
|
75
|
-
return c.recommendationCampaignUrls[s] = u, u;
|
|
45
|
+
buildCampaignUrl: (i) => {
|
|
46
|
+
var m;
|
|
47
|
+
const n = u(), o = I(), a = Number(i), r = n.blockStates[a];
|
|
48
|
+
if (!r)
|
|
49
|
+
return "";
|
|
50
|
+
const { recommendationConfigs: e } = r, l = ((m = g.find((s) => s.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
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
|
+
const f = e.filters.filter((s) => s.isValid), c = x(f);
|
|
53
|
+
c && t.set("filter", c), e.shuffleProducts && t.set("shuffle", "true");
|
|
54
|
+
const d = `${p.RECOMMENDATION_API_URL}/v2/${l}?${t.toString()}`;
|
|
55
|
+
return n.recommendationCampaignUrls[i] = d, d;
|
|
76
56
|
}
|
|
77
57
|
});
|
|
78
58
|
export {
|
|
79
|
-
|
|
59
|
+
N as useRecommendation
|
|
80
60
|
};
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useSaveStart as
|
|
4
|
-
import { useSyncModuleExtractor as
|
|
5
|
-
import { useStripoApi as
|
|
6
|
-
import { useTemplatePreparation as
|
|
7
|
-
import { useHtmlValidator as
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
return { save: async (p = !1) => {
|
|
1
|
+
import { useActionsApi as S } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as V } from "./useConfig.js";
|
|
3
|
+
import { useSaveStart as x, useSaveComplete as y } from "./useGuidoActions.js";
|
|
4
|
+
import { useSyncModuleExtractor as w } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { useStripoApi as b } from "../services/stripoApi.js";
|
|
6
|
+
import { useTemplatePreparation as q } from "../utils/templatePreparation.js";
|
|
7
|
+
import { useHtmlValidator as H } from "./useHtmlValidator.js";
|
|
8
|
+
import { useLiquidValidator as L } from "./validators/useLiquidValidator.js";
|
|
9
|
+
const F = () => {
|
|
10
|
+
const o = x(), s = y(), { validateHtml: r } = H(), { validateLiquidSyntax: n } = L(), { callbacks: a, isFeatureEnabled: l } = V(), { extractSyncModuleData: d } = w(), { setSyncModuleUnsubscriptionPages: u } = b(), { editorSave: c } = S();
|
|
11
|
+
return { save: async (m = !1) => {
|
|
13
12
|
var i;
|
|
14
13
|
o();
|
|
15
|
-
const { prepareTemplateDetails:
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
if (d("liquidSyntax")) {
|
|
19
|
-
if (!await l(t.compiledHtml))
|
|
14
|
+
const { prepareTemplateDetails: p } = q(), t = await p();
|
|
15
|
+
if (l("liquidSyntax")) {
|
|
16
|
+
if (!await n(t.compiledHtml))
|
|
20
17
|
return;
|
|
21
18
|
} else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
|
|
22
19
|
return;
|
|
23
20
|
if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
|
|
24
21
|
return;
|
|
25
|
-
await
|
|
26
|
-
const { unsubscribePayload:
|
|
27
|
-
return await
|
|
22
|
+
await c();
|
|
23
|
+
const { unsubscribePayload: f, stripoModules: v } = d(t.rawHtml);
|
|
24
|
+
return await u(f), t.modules = v, m || s(t), t;
|
|
28
25
|
} };
|
|
29
26
|
};
|
|
30
27
|
export {
|
|
31
|
-
|
|
28
|
+
F as useSave
|
|
32
29
|
};
|
|
@@ -6,19 +6,20 @@ 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 {
|
|
10
|
-
import j from "../
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import $ from "../
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
import { displayConditions as O } from "../enums/displayConditions.js";
|
|
10
|
+
import { useStripoApi as j } from "../services/stripoApi.js";
|
|
11
|
+
import L from "../static/styles/customEditorStyle.css.js";
|
|
12
|
+
import { useEditorStore as C } from "../stores/editor.js";
|
|
13
|
+
import { dynamicContentToMergeTags as $ } from "../utils/genericUtil.js";
|
|
14
|
+
import z from "../package.json.js";
|
|
15
|
+
const ae = (E, l) => {
|
|
16
|
+
const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = j(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, r = [], s = !1) => {
|
|
16
17
|
var g, S, y;
|
|
17
|
-
const e =
|
|
18
|
+
const e = C(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await T(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, F = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, v = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
18
19
|
window.UIEditor.initEditor(
|
|
19
20
|
document.querySelector("#guido-editor"),
|
|
20
21
|
{
|
|
21
|
-
metadata:
|
|
22
|
+
metadata: E,
|
|
22
23
|
html: p,
|
|
23
24
|
css: a,
|
|
24
25
|
forceRecreate: v,
|
|
@@ -31,9 +32,10 @@ const se = (C, l) => {
|
|
|
31
32
|
customAppearanceMergetags: !u("liquidSyntax"),
|
|
32
33
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
33
34
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
34
|
-
customViewStyles:
|
|
35
|
+
customViewStyles: L,
|
|
35
36
|
conditionsEnabled: f,
|
|
36
37
|
customConditionsEnabled: f,
|
|
38
|
+
conditionCategories: O,
|
|
37
39
|
enableXSSSecurity: !0,
|
|
38
40
|
modulesDisabled: F,
|
|
39
41
|
syncModulesEnabled: s,
|
|
@@ -52,7 +54,7 @@ const se = (C, l) => {
|
|
|
52
54
|
},
|
|
53
55
|
mergeTags: [
|
|
54
56
|
{
|
|
55
|
-
entries:
|
|
57
|
+
entries: $(
|
|
56
58
|
l.preselectedDynamicContentList,
|
|
57
59
|
u("liquidSyntax")
|
|
58
60
|
)
|
|
@@ -104,7 +106,7 @@ const se = (C, l) => {
|
|
|
104
106
|
i(), r();
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
107
|
-
const e =
|
|
109
|
+
const e = z.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
|
|
108
110
|
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
109
111
|
i(), r();
|
|
110
112
|
}, o.onerror = () => {
|
|
@@ -113,7 +115,7 @@ const se = (C, l) => {
|
|
|
113
115
|
});
|
|
114
116
|
return { initPlugin: async (i) => {
|
|
115
117
|
await _(async () => {
|
|
116
|
-
const r =
|
|
118
|
+
const r = C(), [s, e] = await Promise.all([
|
|
117
119
|
b(),
|
|
118
120
|
k()
|
|
119
121
|
]);
|
|
@@ -122,5 +124,5 @@ const se = (C, l) => {
|
|
|
122
124
|
} };
|
|
123
125
|
};
|
|
124
126
|
export {
|
|
125
|
-
|
|
127
|
+
ae as useStripo
|
|
126
128
|
};
|