@useinsider/guido 2.0.0-beta.6e688eb → 2.0.0-beta.782343a
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 +2 -0
- package/dist/@types/config/schemas.js +3 -1
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +15 -17
- package/dist/composables/useStripo.js +40 -40
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +13 -4
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +11 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
- package/dist/extensions/Blocks/Recommendation/controls/{cardBackgroundColorControl.js → cardBackground/index.js} +2 -2
- package/dist/extensions/Blocks/Recommendation/{cardCompositionControl.js → controls/cardComposition/index.js} +18 -26
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
- package/dist/extensions/Blocks/Recommendation/{control.js → controls/main/index.js} +44 -25
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +76 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.js → omnibusDiscount/textAfter.js} +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.js → omnibusPrice/textAfter.js} +16 -14
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.js → omnibusPrice/textBefore.js} +14 -12
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/{spacingControl.js → spacing/index.js} +57 -62
- package/dist/extensions/Blocks/Recommendation/extension.js +37 -17
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -10
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +20 -20
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +17 -16
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +62 -87
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +364 -286
- package/dist/package.json.js +1 -1
- package/dist/services/stripoApi.js +6 -10
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +0 -24
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{cardBackgroundColorControl.d.ts → cardBackground/index.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +19 -589
- package/dist/src/extensions/Blocks/Recommendation/{control.d.ts → controls/main/index.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{nameTextTrimControl.d.ts → name/textTrim.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.d.ts → omnibusDiscount/textAfter.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.d.ts → omnibusDiscount/textBefore.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.d.ts → omnibusPrice/textAfter.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.d.ts → omnibusPrice/textBefore.d.ts} +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/{spacingControl.d.ts → spacing/index.d.ts} +2 -5
- package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
- package/dist/src/stores/config.d.ts +17 -0
- package/package.json +3 -3
- package/dist/extensions/Blocks/Recommendation/constants.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -245
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
package/README.md
CHANGED
|
@@ -110,6 +110,7 @@ const config: GuidoConfigInput = {
|
|
|
110
110
|
css?: string,
|
|
111
111
|
preselectedDynamicContent?: DynamicContent[],
|
|
112
112
|
selectedUnsubscribePages?: number[],
|
|
113
|
+
forceRecreate?: boolean, // Default: false - Force recreate template in Stripo storage
|
|
113
114
|
},
|
|
114
115
|
|
|
115
116
|
// Optional: Editor settings
|
|
@@ -137,6 +138,7 @@ const config: GuidoConfigInput = {
|
|
|
137
138
|
testMessage?: boolean, // Default: true
|
|
138
139
|
displayConditions?: boolean, // Default: true
|
|
139
140
|
unsubscribe?: boolean, // Default: true
|
|
141
|
+
modulesDisabled?: boolean, // Default: false - Disable modules panel
|
|
140
142
|
},
|
|
141
143
|
|
|
142
144
|
// Optional: Block configuration
|
|
@@ -71,7 +71,9 @@ const i = {
|
|
|
71
71
|
[]
|
|
72
72
|
),
|
|
73
73
|
/** Selected unsubscribe page IDs */
|
|
74
|
-
selectedUnsubscribePages: e(a(p()), [])
|
|
74
|
+
selectedUnsubscribePages: e(a(p()), []),
|
|
75
|
+
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
76
|
+
forceRecreate: e(c(), !1)
|
|
75
77
|
}), C = o({
|
|
76
78
|
/** Sender display name */
|
|
77
79
|
senderName: e(t(), ""),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as B, defineAsyncComponent as P, ref as N, computed as U, watch as R, onMounted as z, onUnmounted as K } from "vue";
|
|
2
2
|
import { provideGuidoActions as M } from "../composables/useGuidoActions.js";
|
|
3
3
|
import { usePartner as j } from "../composables/usePartner.js";
|
|
4
4
|
import { useStripo as q } from "../composables/useStripo.js";
|
|
@@ -15,8 +15,8 @@ import { useConfigStore as oe } from "../stores/config.js";
|
|
|
15
15
|
import { useDynamicContentStore as te } from "../stores/dynamic-content.js";
|
|
16
16
|
import { useEditorStore as ne } from "../stores/editor.js";
|
|
17
17
|
import { usePreviewStore as re } from "../stores/preview.js";
|
|
18
|
-
import { useUnsubscribeStore as
|
|
19
|
-
const Ee = /* @__PURE__ */
|
|
18
|
+
import { useUnsubscribeStore as se } from "../stores/unsubscribe.js";
|
|
19
|
+
const Ee = /* @__PURE__ */ B({
|
|
20
20
|
__name: "Guido",
|
|
21
21
|
props: {
|
|
22
22
|
config: null
|
|
@@ -27,19 +27,19 @@ const Ee = /* @__PURE__ */ x({
|
|
|
27
27
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
28
28
|
), A = P(
|
|
29
29
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
30
|
-
), p =
|
|
30
|
+
), p = N(), c = te(), u = se(), n = oe();
|
|
31
31
|
n.init(l.config);
|
|
32
32
|
const i = ne(), F = re(), r = U(() => i.hasChanges), { isTestPartner: G } = j(), v = () => {
|
|
33
33
|
var e;
|
|
34
34
|
return (e = p.value) == null ? void 0 : e.handleSave(!0);
|
|
35
|
-
}, { templateId: a, userId: y, partnerName: h, productType:
|
|
35
|
+
}, { templateId: a, userId: y, partnerName: h, productType: b, username: f, template: o } = n, s = (o == null ? void 0 : o.html) || "", g = (o == null ? void 0 : o.css) || "", m = (o == null ? void 0 : o.preselectedDynamicContent) || [];
|
|
36
36
|
i.templateId = a;
|
|
37
37
|
const { initPlugin: S } = q({
|
|
38
38
|
emailId: a,
|
|
39
39
|
userId: y,
|
|
40
|
-
username:
|
|
40
|
+
username: f,
|
|
41
41
|
partnerName: h,
|
|
42
|
-
productType:
|
|
42
|
+
productType: b,
|
|
43
43
|
preselectedDynamicContentList: m,
|
|
44
44
|
onReady: () => {
|
|
45
45
|
console.debug("guido:ready"), t("ready");
|
|
@@ -63,28 +63,26 @@ const Ee = /* @__PURE__ */ x({
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
const E = (e) => {
|
|
66
|
-
console.debug("dynamic-content:close", e),
|
|
66
|
+
console.debug("dynamic-content:close", e), c.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
67
67
|
}, k = () => {
|
|
68
68
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
69
69
|
};
|
|
70
|
-
|
|
70
|
+
R(() => r.value, () => {
|
|
71
71
|
t("on-change", r.value);
|
|
72
72
|
});
|
|
73
73
|
const d = (e) => {
|
|
74
|
-
const T = e, { attribute: O, position:
|
|
75
|
-
console.debug("dynamic-content:open", T.detail), t("dynamic-content:open", O,
|
|
74
|
+
const T = e, { attribute: O, position: x } = T.detail;
|
|
75
|
+
console.debug("dynamic-content:open", T.detail), t("dynamic-content:open", O, x);
|
|
76
76
|
};
|
|
77
77
|
return z(async () => {
|
|
78
78
|
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
|
|
79
79
|
try {
|
|
80
80
|
u.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
|
|
81
81
|
let e = {
|
|
82
|
-
html:
|
|
83
|
-
css: g
|
|
84
|
-
forceRecreate: !0
|
|
85
|
-
// TODO: It should be false for old templates. We will communicate with Stripo
|
|
82
|
+
html: s && await W(s),
|
|
83
|
+
css: g
|
|
86
84
|
};
|
|
87
|
-
e.html || (e = await w(), e.html = await W(e.html)), D(e.html) && (e.html = await C(e.html)), await S(e),
|
|
85
|
+
e.html || (e = await w(), e.html = await W(e.html)), D(e.html) && (e.html = await C(e.html)), await S(e), c.selectedDynamicContentList = m;
|
|
88
86
|
} catch (e) {
|
|
89
87
|
console.error("Failed to initialize Stripo editor:", e);
|
|
90
88
|
}
|
|
@@ -104,7 +102,7 @@ const Ee = /* @__PURE__ */ x({
|
|
|
104
102
|
},
|
|
105
103
|
hasChanges: r,
|
|
106
104
|
saveSilent: v
|
|
107
|
-
}), { __sfc: !0, PreviewContainer: L, OnboardingWrapper: A, headerWrapperRef: p, dynamicContentStore:
|
|
105
|
+
}), { __sfc: !0, PreviewContainer: L, OnboardingWrapper: A, headerWrapperRef: p, dynamicContentStore: c, unsubscribeStore: u, props: l, configStore: n, editorStore: i, previewStore: F, hasChanges: r, isTestPartner: G, saveSilent: v, templateId: a, userId: y, partnerName: h, productType: b, username: f, templateConfig: o, html: s, css: g, preselectedDynamicContentList: m, emit: t, initPlugin: S, getDefaultTemplate: w, cloneTimersOnSave: C, hasTimerBlocks: D, noHeader: H, insertDynamicContent: E, closeDynamicContent: k, handleDynamicContentOpen: d, Toaster: Q, FilterSelectionDrawer: V, HeaderWrapper: X, LoadingWrapper: Y, SaveAsTemplateDrawer: Z, UnsubscribeWrapper: $ };
|
|
108
106
|
}
|
|
109
107
|
});
|
|
110
108
|
export {
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useStripoEventHandler as
|
|
6
|
-
import { useToaster as
|
|
7
|
-
import { displayConditions as
|
|
8
|
-
import { useStripoApi as
|
|
9
|
-
import
|
|
10
|
-
import { useEditorStore as
|
|
11
|
-
import { dynamicContentToMergeTags as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
14
|
-
const { features: l } =
|
|
15
|
-
var g, f;
|
|
16
|
-
const o =
|
|
1
|
+
import { useActionsApi as _ } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as B } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as v } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as A } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as F } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as D } from "./useToaster.js";
|
|
7
|
+
import { displayConditions as I } from "../enums/displayConditions.js";
|
|
8
|
+
import { useStripoApi as M } from "../services/stripoApi.js";
|
|
9
|
+
import U from "../static/styles/customEditorStyle.css.js";
|
|
10
|
+
import { useEditorStore as P } from "../stores/editor.js";
|
|
11
|
+
import { dynamicContentToMergeTags as R } from "../utils/genericUtil.js";
|
|
12
|
+
import H from "../package.json.js";
|
|
13
|
+
const W = (c) => {
|
|
14
|
+
const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = M(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, n = []) => {
|
|
15
|
+
var m, g, f;
|
|
16
|
+
const o = P(), { html: r, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, T = ((f = y.value) == null ? void 0 : f.forceRecreate) ?? !1;
|
|
17
17
|
window.UIEditor.initEditor(
|
|
18
18
|
document.querySelector("#guido-editor"),
|
|
19
19
|
{
|
|
20
20
|
metadata: c,
|
|
21
21
|
html: r,
|
|
22
22
|
css: p,
|
|
23
|
-
forceRecreate:
|
|
23
|
+
forceRecreate: T,
|
|
24
24
|
locale: "en",
|
|
25
25
|
undoButtonSelector: "#guido__undo-button",
|
|
26
26
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -30,19 +30,19 @@ const K = (c) => {
|
|
|
30
30
|
customAppearanceMergetags: !0,
|
|
31
31
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
32
32
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
33
|
-
customViewStyles:
|
|
34
|
-
conditionsEnabled:
|
|
35
|
-
customConditionsEnabled:
|
|
36
|
-
conditionCategories:
|
|
33
|
+
customViewStyles: U,
|
|
34
|
+
conditionsEnabled: a,
|
|
35
|
+
customConditionsEnabled: a,
|
|
36
|
+
conditionCategories: I,
|
|
37
37
|
enableXSSSecurity: !0,
|
|
38
|
-
modulesDisabled:
|
|
38
|
+
modulesDisabled: k,
|
|
39
39
|
messageSettingsEnabled: !0,
|
|
40
40
|
displayGmailAnnotations: !0,
|
|
41
41
|
displayHiddenPreheader: !1,
|
|
42
42
|
displayTitle: !1,
|
|
43
43
|
displayUTM: !1,
|
|
44
44
|
selectElementAfterDrop: !0,
|
|
45
|
-
...
|
|
45
|
+
...s ? { baseBlocks: s } : {},
|
|
46
46
|
editorFonts: {
|
|
47
47
|
showDefaultStandardFonts: !0,
|
|
48
48
|
showDefaultNotStandardFonts: !0,
|
|
@@ -50,21 +50,21 @@ const K = (c) => {
|
|
|
50
50
|
},
|
|
51
51
|
mergeTags: [
|
|
52
52
|
{
|
|
53
|
-
entries:
|
|
53
|
+
entries: R(c.preselectedDynamicContentList)
|
|
54
54
|
}
|
|
55
55
|
],
|
|
56
56
|
async onTokenRefreshRequest(e) {
|
|
57
57
|
try {
|
|
58
|
-
const
|
|
59
|
-
e(
|
|
60
|
-
} catch (
|
|
61
|
-
u(
|
|
58
|
+
const d = await C();
|
|
59
|
+
e(d);
|
|
60
|
+
} catch (d) {
|
|
61
|
+
u(d, "Failed to refresh token");
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
onTemplateLoaded() {
|
|
65
65
|
try {
|
|
66
|
-
const { importCss: e } =
|
|
67
|
-
e(),
|
|
66
|
+
const { importCss: e } = A(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: V } = _();
|
|
67
|
+
e(), d(), V(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
|
|
68
68
|
o.hasChanges = !1;
|
|
69
69
|
}, 1e3);
|
|
70
70
|
} catch (e) {
|
|
@@ -83,35 +83,35 @@ const K = (c) => {
|
|
|
83
83
|
onDataChanged() {
|
|
84
84
|
o.hasChanges = !0;
|
|
85
85
|
},
|
|
86
|
-
onEvent:
|
|
86
|
+
onEvent: E,
|
|
87
87
|
ignoreClickOutsideSelectors: [
|
|
88
88
|
"#guido-dynamic-content-modal",
|
|
89
89
|
".in-on-board-wrapper",
|
|
90
90
|
".in-drawer__container"
|
|
91
91
|
],
|
|
92
|
-
extensions:
|
|
92
|
+
extensions: t
|
|
93
93
|
}
|
|
94
94
|
);
|
|
95
|
-
},
|
|
96
|
-
var
|
|
95
|
+
}, b = (i) => new Promise((n, o) => {
|
|
96
|
+
var a;
|
|
97
97
|
if (document.getElementById("UiEditorScript")) {
|
|
98
98
|
i(), n();
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
const r =
|
|
102
|
-
t.id = "UiEditorScript", t.type = "module", t.src =
|
|
101
|
+
const r = H.guido, s = `https://email-static.useinsider.com/guido/${(a = r == null ? void 0 : r.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
|
|
102
|
+
t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
|
|
103
103
|
i(), n();
|
|
104
104
|
}, t.onerror = () => {
|
|
105
|
-
o(new Error(`Failed to load Stripo UIEditor script from S3: ${
|
|
105
|
+
o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
|
|
106
106
|
}, document.body.appendChild(t);
|
|
107
107
|
});
|
|
108
108
|
return { initPlugin: async (i) => {
|
|
109
|
-
await
|
|
109
|
+
await b(async () => {
|
|
110
110
|
const n = await S();
|
|
111
|
-
await
|
|
111
|
+
await w(i, n);
|
|
112
112
|
});
|
|
113
113
|
} };
|
|
114
114
|
};
|
|
115
115
|
export {
|
|
116
|
-
|
|
116
|
+
W as useStripo
|
|
117
117
|
};
|
|
@@ -145,10 +145,19 @@ class g extends R {
|
|
|
145
145
|
T && this.api.getDocumentModifier().modifyHtml(o).setAttribute(C[T], e ? "1" : "0").apply(new l(`Updated ${t} visibility attribute`));
|
|
146
146
|
}
|
|
147
147
|
_listenToFormUpdates() {
|
|
148
|
-
this.api.onValueChanged(i.PRODUCT_IMAGE, (t) =>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
this.api.onValueChanged(i.PRODUCT_IMAGE, (t) => {
|
|
149
|
+
this._onProductImageChange(t);
|
|
150
|
+
}), this.api.onValueChanged(i.PRODUCT_NAME, (t) => {
|
|
151
|
+
this._onProductNameChange(t);
|
|
152
|
+
}), this.api.onValueChanged(i.PRODUCT_QUANTITY, (t) => {
|
|
153
|
+
this._onProductQuantityChange(t);
|
|
154
|
+
}), this.api.onValueChanged(i.PRODUCT_PRICE, (t) => {
|
|
155
|
+
this._onProductPriceChange(t);
|
|
156
|
+
}), this.api.onValueChanged(i.PRODUCT_ORIGINAL_PRICE, (t) => {
|
|
157
|
+
this._onProductOriginalPriceChange(t);
|
|
158
|
+
}), this.api.onValueChanged(i.PRODUCT_BUTTON, (t) => {
|
|
159
|
+
this._onProductButtonChange(t);
|
|
160
|
+
});
|
|
152
161
|
}
|
|
153
162
|
_onProductImageChange(t) {
|
|
154
163
|
var o;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var b = /* @__PURE__ */ ((r) => (r.BUTTON = "recommendation-block-button", r.NAME = "recommendation-block-name", r.PRICE = "recommendation-block-price", r.OLD_PRICE = "recommendation-block-old-price", r.OMNIBUS_PRICE = "recommendation-block-omnibus-price", r.OMNIBUS_DISCOUNT = "recommendation-block-omnibus-discount", r.IMAGE = "recommendation-block-image", r))(b || {});
|
|
2
|
+
export {
|
|
3
|
+
b as RecommendationBlockId
|
|
4
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var o = /* @__PURE__ */ ((c) => (c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c))(o || {});
|
|
2
|
+
export {
|
|
3
|
+
o as RecommendationControlId
|
|
4
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const T = ".ins-recommendation-product-container", c = "productImage", o = "productName", t = "productPrice", R = "productOldPrice", _ = "productOmnibusPrice", n = "productOmnibusDiscount", O = "productButton";
|
|
2
|
+
export {
|
|
3
|
+
O as ATTR_PRODUCT_BUTTON,
|
|
4
|
+
c as ATTR_PRODUCT_IMAGE,
|
|
5
|
+
o as ATTR_PRODUCT_NAME,
|
|
6
|
+
R as ATTR_PRODUCT_OLD_PRICE,
|
|
7
|
+
n as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
|
|
8
|
+
_ as ATTR_PRODUCT_OMNIBUS_PRICE,
|
|
9
|
+
t as ATTR_PRODUCT_PRICE,
|
|
10
|
+
T as CONTAINER_SELECTOR
|
|
11
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createButtonFitToContainerControl as T, createButtonTextStyleAndFontColorControl as r, createButtonTextSizeControl as e, createButtonTextControl as B, createButtonPaddingsControl as l, createButtonMarginsControl as C, createButtonFontFamilyControl as O, createButtonColorControl as N, createButtonBorderRadiusControl as i, createButtonBorderControl as a, createButtonAlignControl as c } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
+
import { CONTAINER_SELECTOR as n } from "../../constants/selectors.js";
|
|
5
|
+
const U = c(
|
|
6
|
+
t.BUTTON_ALIGN,
|
|
7
|
+
o.BUTTON,
|
|
8
|
+
n
|
|
9
|
+
), d = a(
|
|
10
|
+
t.BUTTON_BORDER,
|
|
11
|
+
o.BUTTON,
|
|
12
|
+
n
|
|
13
|
+
), s = i(
|
|
14
|
+
t.BUTTON_BORDER_RADIUS,
|
|
15
|
+
o.BUTTON,
|
|
16
|
+
n
|
|
17
|
+
), _ = N(
|
|
18
|
+
t.BUTTON_COLOR,
|
|
19
|
+
o.BUTTON,
|
|
20
|
+
n
|
|
21
|
+
), m = O(
|
|
22
|
+
t.BUTTON_FONT_FAMILY,
|
|
23
|
+
o.BUTTON,
|
|
24
|
+
n
|
|
25
|
+
), u = C(
|
|
26
|
+
t.BUTTON_MARGINS,
|
|
27
|
+
o.BUTTON,
|
|
28
|
+
n
|
|
29
|
+
), R = l(
|
|
30
|
+
t.BUTTON_PADDINGS,
|
|
31
|
+
o.BUTTON,
|
|
32
|
+
n
|
|
33
|
+
), F = B(
|
|
34
|
+
t.BUTTON_TEXT,
|
|
35
|
+
o.BUTTON,
|
|
36
|
+
n
|
|
37
|
+
), A = e(
|
|
38
|
+
t.BUTTON_TEXT_SIZE,
|
|
39
|
+
o.BUTTON,
|
|
40
|
+
n
|
|
41
|
+
), S = r(
|
|
42
|
+
t.BUTTON_TEXT_STYLE_AND_FONT_COLOR,
|
|
43
|
+
o.BUTTON,
|
|
44
|
+
n
|
|
45
|
+
), E = T(
|
|
46
|
+
t.BUTTON_FIT_TO_CONTENT,
|
|
47
|
+
o.BUTTON,
|
|
48
|
+
n
|
|
49
|
+
), p = {
|
|
50
|
+
align: U,
|
|
51
|
+
border: d,
|
|
52
|
+
borderRadius: s,
|
|
53
|
+
color: _,
|
|
54
|
+
fontFamily: m,
|
|
55
|
+
margins: u,
|
|
56
|
+
paddings: R,
|
|
57
|
+
text: F,
|
|
58
|
+
textSize: A,
|
|
59
|
+
textStyleAndFontColor: S,
|
|
60
|
+
fitToContent: E
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
p as ButtonControls
|
|
64
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModificationDescription as a } from "
|
|
2
|
-
import { CommonControl as d } from "
|
|
1
|
+
import { ModificationDescription as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as d } from "../../../common-control.js";
|
|
3
3
|
const c = "recommendation-card-background-color-control", o = {
|
|
4
4
|
CARD_BACKGROUND_COLOR: "cardBackgroundColor"
|
|
5
5
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { ModificationDescription as n } from "
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import { ATTR_PRODUCT_IMAGE as
|
|
4
|
-
const
|
|
5
|
-
{ key:
|
|
1
|
+
import { ModificationDescription as n } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as m } from "../../../common-control.js";
|
|
3
|
+
import { ATTR_PRODUCT_IMAGE as b, ATTR_PRODUCT_NAME as y, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OLD_PRICE as h, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as f, ATTR_PRODUCT_BUTTON as A } from "../../constants/selectors.js";
|
|
4
|
+
const O = "ui-elements-recommendation-card-composition", l = ".recommendation-attribute-row", R = "tr.recommendation-product-row", c = "data-card-composition", a = "data-attribute-type", d = "data-visibility", s = [
|
|
5
|
+
{ key: b, label: "Product Image", visible: !0 },
|
|
6
6
|
{ key: y, label: "Product Name", visible: !0 },
|
|
7
7
|
{ key: T, label: "Product Price", visible: !0 },
|
|
8
8
|
{ key: h, label: "Product Original Price", visible: !0 },
|
|
9
9
|
{ key: C, label: "Omnibus Price", visible: !1 },
|
|
10
10
|
{ key: f, label: "Omnibus Discount", visible: !1 },
|
|
11
|
-
{ key:
|
|
11
|
+
{ key: A, label: "Product Button", visible: !0 }
|
|
12
12
|
];
|
|
13
|
-
class
|
|
13
|
+
class V extends m {
|
|
14
14
|
getId() {
|
|
15
|
-
return
|
|
15
|
+
return O;
|
|
16
16
|
}
|
|
17
17
|
getTemplate() {
|
|
18
18
|
const t = s.map((i) => ({
|
|
@@ -90,9 +90,7 @@ class N extends _ {
|
|
|
90
90
|
_readVisibilityFromRows() {
|
|
91
91
|
if (!this.currentNode)
|
|
92
92
|
return this._getDefaultVisibilities();
|
|
93
|
-
const t = Array.from(this.currentNode.querySelectorAll(l));
|
|
94
|
-
console.debug("_readVisibilityFromRows - found attribute rows:", t.length);
|
|
95
|
-
const i = this._extractVisibilityFromRows(t);
|
|
93
|
+
const t = Array.from(this.currentNode.querySelectorAll(l)), i = this._extractVisibilityFromRows(t);
|
|
96
94
|
return this._mergeWithDefaults(i);
|
|
97
95
|
}
|
|
98
96
|
/**
|
|
@@ -110,9 +108,7 @@ class N extends _ {
|
|
|
110
108
|
if (!("getAttribute" in e))
|
|
111
109
|
return;
|
|
112
110
|
const o = e.getAttribute(a), r = e.getAttribute(d);
|
|
113
|
-
o && r !== null && (i[o] = this._parseVisibilityValue(r)
|
|
114
|
-
`_readVisibilityFromRows - ${o}: ${i[o]} (raw: ${r})`
|
|
115
|
-
));
|
|
111
|
+
o && r !== null && (i[o] = this._parseVisibilityValue(r));
|
|
116
112
|
}), i;
|
|
117
113
|
}
|
|
118
114
|
/**
|
|
@@ -127,7 +123,7 @@ class N extends _ {
|
|
|
127
123
|
*/
|
|
128
124
|
_mergeWithDefaults(t) {
|
|
129
125
|
return s.forEach((i) => {
|
|
130
|
-
i.key in t || (t[i.key] = i.visible
|
|
126
|
+
i.key in t || (t[i.key] = i.visible);
|
|
131
127
|
}), t;
|
|
132
128
|
}
|
|
133
129
|
/**
|
|
@@ -135,11 +131,7 @@ class N extends _ {
|
|
|
135
131
|
* Updates the data-card-composition attribute and reorders product attributes
|
|
136
132
|
*/
|
|
137
133
|
_applyCompositionToBlock(t) {
|
|
138
|
-
|
|
139
|
-
console.debug("_applyCompositionToBlock - no current node");
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(c, t.join(",")).apply(new n("Update card composition")), this._reorderProductAttributes(t);
|
|
134
|
+
this.currentNode && (this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(c, t.join(",")).apply(new n("Update card composition")), this._reorderProductAttributes(t));
|
|
143
135
|
}
|
|
144
136
|
/**
|
|
145
137
|
* Reorders attribute rows within each product row based on composition order
|
|
@@ -147,7 +139,7 @@ class N extends _ {
|
|
|
147
139
|
_reorderProductAttributes(t) {
|
|
148
140
|
if (!this.currentNode)
|
|
149
141
|
return;
|
|
150
|
-
const i = this.currentNode.querySelectorAll(
|
|
142
|
+
const i = this.currentNode.querySelectorAll(R);
|
|
151
143
|
if (!(i != null && i.length))
|
|
152
144
|
return;
|
|
153
145
|
const e = this.api.getDocumentModifier();
|
|
@@ -170,18 +162,18 @@ class N extends _ {
|
|
|
170
162
|
* Updates display style and data-visibility attribute for all matching rows
|
|
171
163
|
*/
|
|
172
164
|
_applyVisibilityToBlock(t, i) {
|
|
173
|
-
if (
|
|
165
|
+
if (!this.currentNode)
|
|
174
166
|
return;
|
|
175
167
|
const e = this.currentNode.querySelectorAll(`${l}[${a}="${t}"]`);
|
|
176
168
|
if (!(e != null && e.length))
|
|
177
169
|
return;
|
|
178
170
|
const o = i ? "table-row" : "none", r = i ? "1" : "0", p = `Set ${t} visibility to ${i ? "visible" : "hidden"}`, u = this.api.getDocumentModifier();
|
|
179
|
-
e.forEach((
|
|
180
|
-
u.modifyHtml(
|
|
171
|
+
e.forEach((_) => {
|
|
172
|
+
u.modifyHtml(_).setStyle("display", o).setAttribute(d, r);
|
|
181
173
|
}), u.apply(new n(p));
|
|
182
174
|
}
|
|
183
175
|
}
|
|
184
176
|
export {
|
|
185
|
-
|
|
186
|
-
|
|
177
|
+
O as COMPOSITION_CONTROL_BLOCK_ID,
|
|
178
|
+
V as RecommendationCardCompositionControl
|
|
187
179
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createImageMarginsControl as m, createImageSizeControl as n } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as r } from "../../constants/controlIds.js";
|
|
4
|
+
import { CONTAINER_SELECTOR as t } from "../../constants/selectors.js";
|
|
5
|
+
const e = n(
|
|
6
|
+
r.IMAGE_SIZE,
|
|
7
|
+
o.IMAGE,
|
|
8
|
+
t
|
|
9
|
+
), i = m(
|
|
10
|
+
r.IMAGE_MARGINS,
|
|
11
|
+
o.IMAGE,
|
|
12
|
+
t
|
|
13
|
+
), C = {
|
|
14
|
+
size: e,
|
|
15
|
+
margins: i
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
C as ImageControls
|
|
19
|
+
};
|