@useinsider/guido 2.0.0-beta.e73ba15 → 2.0.0-beta.fb0f99d
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 +53 -39
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +2 -2
- package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
- package/dist/composables/useConfig.js +29 -27
- package/dist/composables/useSave.js +13 -11
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +9 -4
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +21 -41
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +37 -48
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +78 -50
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +72 -70
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +60 -80
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +16 -14
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +27 -16
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +46 -0
- package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
- package/dist/extensions/Blocks/common-control.js +6 -7
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/index.d.ts +2 -2
- package/dist/src/@types/config/schemas.d.ts +26 -0
- package/dist/src/@types/config/types.d.ts +7 -1
- package/dist/src/composables/useConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +6 -17
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +77 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +1 -1
- package/dist/src/stores/config.d.ts +147 -1
- package/dist/static/styles/components/button.css.js +1 -1
- package/dist/stores/config.js +7 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { object as o, number as
|
|
2
|
-
const
|
|
1
|
+
import { object as o, number as b, optional as e, string as t, pipe as u, picklist as n, custom as d, boolean as c, array as a, minLength as p, literal as r, variant as S } from "../../node_modules/valibot/dist/index.js";
|
|
2
|
+
const m = {
|
|
3
3
|
/** Promotional/marketing emails */
|
|
4
4
|
PROMOTIONAL: 1,
|
|
5
5
|
/** Transactional/system emails */
|
|
@@ -13,22 +13,22 @@ const i = {
|
|
|
13
13
|
UNSUBSCRIBE_PAGES: 97
|
|
14
14
|
}, h = o({
|
|
15
15
|
/** Unique identifier for the template being edited */
|
|
16
|
-
templateId:
|
|
16
|
+
templateId: u(
|
|
17
17
|
t(),
|
|
18
|
-
|
|
18
|
+
p(1, "templateId is required")
|
|
19
19
|
),
|
|
20
20
|
/** Unique identifier for the user editing the template */
|
|
21
|
-
userId:
|
|
21
|
+
userId: u(
|
|
22
22
|
t(),
|
|
23
|
-
|
|
23
|
+
p(1, "userId is required")
|
|
24
24
|
),
|
|
25
25
|
/** Optional variation ID for A/B testing */
|
|
26
26
|
variationId: e(t())
|
|
27
27
|
}), k = o({
|
|
28
28
|
/** Partner/organization name (required) */
|
|
29
|
-
name:
|
|
29
|
+
name: u(
|
|
30
30
|
t(),
|
|
31
|
-
|
|
31
|
+
p(1, "partner.name is required")
|
|
32
32
|
),
|
|
33
33
|
/** Product type identifier */
|
|
34
34
|
productType: e(
|
|
@@ -41,8 +41,8 @@ const i = {
|
|
|
41
41
|
),
|
|
42
42
|
/** Message type (promotional or transactional) */
|
|
43
43
|
messageType: e(
|
|
44
|
-
n([
|
|
45
|
-
|
|
44
|
+
n([m.PROMOTIONAL, m.TRANSACTIONAL]),
|
|
45
|
+
m.PROMOTIONAL
|
|
46
46
|
),
|
|
47
47
|
/** Display name for the current user */
|
|
48
48
|
username: e(t(), "Guido User")
|
|
@@ -71,29 +71,29 @@ const i = {
|
|
|
71
71
|
[]
|
|
72
72
|
),
|
|
73
73
|
/** Selected unsubscribe page IDs */
|
|
74
|
-
selectedUnsubscribePages: e(a(
|
|
74
|
+
selectedUnsubscribePages: e(a(b()), []),
|
|
75
75
|
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
76
76
|
forceRecreate: e(c(), !1)
|
|
77
|
-
}),
|
|
77
|
+
}), f = o({
|
|
78
78
|
/** Sender display name */
|
|
79
79
|
senderName: e(t(), ""),
|
|
80
80
|
/** Email subject line */
|
|
81
81
|
subject: e(t(), "")
|
|
82
|
-
}),
|
|
82
|
+
}), C = o({
|
|
83
83
|
/** Locale for the editor UI */
|
|
84
84
|
locale: e(t(), "en"),
|
|
85
85
|
/** Path to translations object */
|
|
86
86
|
translationsPath: e(t(), "window.trans.en"),
|
|
87
87
|
/** Migration date for template compatibility */
|
|
88
|
-
migrationDate: e(
|
|
88
|
+
migrationDate: e(b(), 1759696858),
|
|
89
89
|
/** Email header settings */
|
|
90
|
-
emailHeader: e(
|
|
91
|
-
}),
|
|
90
|
+
emailHeader: e(f, { senderName: "", subject: "" })
|
|
91
|
+
}), I = o({
|
|
92
92
|
/** Whether to show the header bar */
|
|
93
93
|
showHeader: e(c(), !0),
|
|
94
94
|
/** Custom label for back button (if shown) */
|
|
95
95
|
backButtonLabel: e(t())
|
|
96
|
-
}),
|
|
96
|
+
}), T = o({
|
|
97
97
|
/** Enable dynamic content insertion */
|
|
98
98
|
dynamicContent: e(c(), !0),
|
|
99
99
|
/** Enable save as template functionality */
|
|
@@ -108,7 +108,7 @@ const i = {
|
|
|
108
108
|
unsubscribe: e(c(), !0),
|
|
109
109
|
/** Disable modules panel in the editor */
|
|
110
110
|
modulesDisabled: e(c(), !1)
|
|
111
|
-
}),
|
|
111
|
+
}), A = n([
|
|
112
112
|
"amp-accordion",
|
|
113
113
|
"amp-carousel",
|
|
114
114
|
"amp-form-controls",
|
|
@@ -133,7 +133,7 @@ const i = {
|
|
|
133
133
|
]), E = o({
|
|
134
134
|
/** Default blocks to exclude from the editor */
|
|
135
135
|
excludeDefaults: e(
|
|
136
|
-
a(
|
|
136
|
+
a(A),
|
|
137
137
|
[]
|
|
138
138
|
),
|
|
139
139
|
/** Custom blocks to include in the editor */
|
|
@@ -147,7 +147,7 @@ const i = {
|
|
|
147
147
|
/** Human-readable description */
|
|
148
148
|
description: e(t()),
|
|
149
149
|
/** Priority for rule ordering (lower = earlier) */
|
|
150
|
-
priority:
|
|
150
|
+
priority: b()
|
|
151
151
|
}), N = o({
|
|
152
152
|
...l.entries,
|
|
153
153
|
type: r("replace"),
|
|
@@ -175,21 +175,32 @@ const i = {
|
|
|
175
175
|
...l.entries,
|
|
176
176
|
type: r("custom"),
|
|
177
177
|
/** Custom processor function */
|
|
178
|
-
processor:
|
|
179
|
-
(
|
|
178
|
+
processor: d(
|
|
179
|
+
(i) => typeof i == "function",
|
|
180
180
|
"processor must be a function"
|
|
181
181
|
)
|
|
182
|
-
}),
|
|
182
|
+
}), x = S("type", [
|
|
183
183
|
N,
|
|
184
184
|
O,
|
|
185
185
|
L,
|
|
186
186
|
v
|
|
187
|
-
]),
|
|
187
|
+
]), B = o({
|
|
188
188
|
/** Custom compiler rules to apply */
|
|
189
|
-
customRules: e(a(
|
|
189
|
+
customRules: e(a(x), []),
|
|
190
190
|
/** Skip default compiler rules */
|
|
191
191
|
ignoreDefaultRules: e(c(), !1)
|
|
192
|
-
}),
|
|
192
|
+
}), P = o({
|
|
193
|
+
/**
|
|
194
|
+
* External validation handler called before save completes.
|
|
195
|
+
* Return false to cancel the save operation.
|
|
196
|
+
*/
|
|
197
|
+
externalValidation: e(
|
|
198
|
+
d(
|
|
199
|
+
(i) => typeof i == "function",
|
|
200
|
+
"externalValidation must be a function"
|
|
201
|
+
)
|
|
202
|
+
)
|
|
203
|
+
}), D = o({
|
|
193
204
|
// Required sections
|
|
194
205
|
/** Identity configuration (required) */
|
|
195
206
|
identity: h,
|
|
@@ -199,35 +210,38 @@ const i = {
|
|
|
199
210
|
/** Template content and presets */
|
|
200
211
|
template: e(R, {}),
|
|
201
212
|
/** Editor settings */
|
|
202
|
-
editor: e(
|
|
213
|
+
editor: e(C, {}),
|
|
203
214
|
/** UI configuration */
|
|
204
|
-
ui: e(
|
|
215
|
+
ui: e(I, {}),
|
|
205
216
|
/** Feature toggles */
|
|
206
|
-
features: e(
|
|
217
|
+
features: e(T, {}),
|
|
207
218
|
/** Block configuration */
|
|
208
219
|
blocks: e(E, {}),
|
|
209
220
|
/** Compiler configuration */
|
|
210
|
-
compiler: e(
|
|
221
|
+
compiler: e(B, {}),
|
|
222
|
+
/** Callbacks and event handlers */
|
|
223
|
+
callbacks: e(P, {})
|
|
211
224
|
});
|
|
212
225
|
export {
|
|
213
226
|
E as BlocksSchema,
|
|
214
|
-
|
|
215
|
-
|
|
227
|
+
P as CallbacksSchema,
|
|
228
|
+
x as CompilerRuleSchema,
|
|
229
|
+
B as CompilerSchema,
|
|
216
230
|
g as CustomBlockTypeSchema,
|
|
217
231
|
v as CustomRuleSchema,
|
|
218
|
-
|
|
232
|
+
A as DefaultBlockTypeSchema,
|
|
219
233
|
y as DynamicContentSchema,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
234
|
+
C as EditorSchema,
|
|
235
|
+
f as EmailHeaderSchema,
|
|
236
|
+
T as FeaturesSchema,
|
|
237
|
+
D as GuidoConfigSchema,
|
|
224
238
|
h as IdentitySchema,
|
|
225
|
-
|
|
239
|
+
m as MessageType,
|
|
226
240
|
k as PartnerSchema,
|
|
227
241
|
s as ProductType,
|
|
228
242
|
O as RegexRuleSchema,
|
|
229
243
|
L as RemoveRuleSchema,
|
|
230
244
|
N as ReplaceRuleSchema,
|
|
231
245
|
R as TemplateSchema,
|
|
232
|
-
|
|
246
|
+
I as UISchema
|
|
233
247
|
};
|
|
@@ -3,7 +3,7 @@ import o from "./AmpToggle.vue2.js";
|
|
|
3
3
|
import n from "../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
4
|
var s = function() {
|
|
5
5
|
var r = this, t = r._self._c, e = r._self._setupProxy;
|
|
6
|
-
return t("div", [t("div", { staticClass: "d-f a-i-c ml-3" }, [t(e.InSegments, { attrs: { id: "guido__amp-toggle", "segment-list": e.segmentList, selected: e.previewStore.emailFormat }, on: { click: e.handleFormatChange } }), e.previewStore.showAMPErrorButton ? t(e.InButtonV2, { staticClass: "ml-
|
|
6
|
+
return t("div", [t("div", { staticClass: "d-f a-i-c ml-3" }, [t(e.InSegments, { attrs: { id: "guido__amp-toggle", "segment-list": e.segmentList, selected: e.previewStore.emailFormat }, on: { click: e.handleFormatChange } }), e.previewStore.showAMPErrorButton ? t(e.InButtonV2, { staticClass: "ml-3 d-f a-i-c b-c-11 b-c-h-11 t-c-4 t-c-h-4 i-c-4 bor-w-1 bor-s-s bor-c-11 bor-r-2", attrs: { id: "guido__amp-error-button", "left-icon": "line-error-box", type: "danger", "label-text-status": !1 }, on: { click: function(l) {
|
|
7
7
|
return e.previewStore.openErrorModal();
|
|
8
8
|
} } }) : r._e()], 1)]);
|
|
9
9
|
}, a = [], i = /* @__PURE__ */ n(
|
|
@@ -12,7 +12,7 @@ var s = function() {
|
|
|
12
12
|
a,
|
|
13
13
|
!1,
|
|
14
14
|
null,
|
|
15
|
-
"
|
|
15
|
+
"5196584c"
|
|
16
16
|
);
|
|
17
17
|
const d = i.exports;
|
|
18
18
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as H, ref as
|
|
1
|
+
import { defineComponent as H, ref as c, computed as _ } from "vue";
|
|
2
2
|
import { useConfig as h } from "../../../composables/useConfig.js";
|
|
3
3
|
import { useExport as V } from "../../../composables/useExport.js";
|
|
4
4
|
import { useTestEmailClick as x } from "../../../composables/useGuidoActions.js";
|
|
@@ -10,25 +10,25 @@ import { getTooltipOptions as O } from "../../../utils/tooltipUtils.js";
|
|
|
10
10
|
import { InButtonV2 as A } from "@useinsider/design-system-vue";
|
|
11
11
|
const J = /* @__PURE__ */ H({
|
|
12
12
|
__name: "RightSlot",
|
|
13
|
-
setup(k, { expose:
|
|
14
|
-
const { config:
|
|
13
|
+
setup(k, { expose: u }) {
|
|
14
|
+
const { config: f } = h(), { exportHtml: r } = V(), { save: n } = E(), { openVersionHistory: i, closeVersionHistory: a } = w(), o = C(), t = T(), e = c(!1), s = c(!1), v = x(), d = () => {
|
|
15
15
|
if (o.isVersionHistoryOpen) {
|
|
16
16
|
a();
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
i();
|
|
20
|
-
},
|
|
20
|
+
}, y = async () => {
|
|
21
21
|
e.value = !0, await r(), e.value = !1;
|
|
22
|
-
},
|
|
22
|
+
}, S = () => {
|
|
23
23
|
o.isSaveAsTemplateDrawerOpen = !0;
|
|
24
|
-
},
|
|
24
|
+
}, g = _(() => o.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history")), l = async (p) => {
|
|
25
25
|
s.value = !0, o.loadingStatus = !0;
|
|
26
|
-
const
|
|
27
|
-
return s.value = !1, p && (o.loadingStatus = !1),
|
|
26
|
+
const m = await n(p);
|
|
27
|
+
return s.value = !1, (p || !m) && (o.loadingStatus = !1), m;
|
|
28
28
|
};
|
|
29
|
-
return
|
|
29
|
+
return u({
|
|
30
30
|
handleSave: l
|
|
31
|
-
}), { __sfc: !0, config:
|
|
31
|
+
}), { __sfc: !0, config: f, exportHtml: r, save: n, openVersionHistory: i, closeVersionHistory: a, editorStore: o, trans: t, isExporting: e, isSaving: s, testEmailClick: v, handleVersionHistory: d, handleExport: y, handleSaveAs: S, versionHistoryTooltipText: g, handleSave: l, getTooltipOptions: O, InButtonV2: A };
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
export {
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { useConfigStore as
|
|
2
|
-
import { storeToRefs as
|
|
3
|
-
const
|
|
4
|
-
const e =
|
|
1
|
+
import { useConfigStore as I } from "../stores/config.js";
|
|
2
|
+
import { storeToRefs as T } from "pinia";
|
|
3
|
+
const w = () => {
|
|
4
|
+
const e = I(), {
|
|
5
5
|
config: t,
|
|
6
6
|
initialized: o,
|
|
7
7
|
identity: r,
|
|
8
8
|
partner: i,
|
|
9
|
-
template:
|
|
10
|
-
editor:
|
|
9
|
+
template: a,
|
|
10
|
+
editor: n,
|
|
11
11
|
ui: s,
|
|
12
|
-
features:
|
|
13
|
-
blocks:
|
|
14
|
-
compiler:
|
|
15
|
-
|
|
12
|
+
features: c,
|
|
13
|
+
blocks: u,
|
|
14
|
+
compiler: d,
|
|
15
|
+
callbacks: l,
|
|
16
|
+
templateId: p,
|
|
16
17
|
userId: f,
|
|
17
18
|
variationId: m,
|
|
18
19
|
partnerName: g,
|
|
19
|
-
productType:
|
|
20
|
-
messageType:
|
|
21
|
-
username:
|
|
22
|
-
showHeader:
|
|
23
|
-
} =
|
|
20
|
+
productType: b,
|
|
21
|
+
messageType: C,
|
|
22
|
+
username: y,
|
|
23
|
+
showHeader: E
|
|
24
|
+
} = T(e);
|
|
24
25
|
return {
|
|
25
26
|
// State refs
|
|
26
27
|
config: t,
|
|
@@ -28,26 +29,27 @@ const k = () => {
|
|
|
28
29
|
// Section refs
|
|
29
30
|
identity: r,
|
|
30
31
|
partner: i,
|
|
31
|
-
template:
|
|
32
|
-
editor:
|
|
32
|
+
template: a,
|
|
33
|
+
editor: n,
|
|
33
34
|
ui: s,
|
|
34
|
-
features:
|
|
35
|
-
blocks:
|
|
36
|
-
compiler:
|
|
35
|
+
features: c,
|
|
36
|
+
blocks: u,
|
|
37
|
+
compiler: d,
|
|
38
|
+
callbacks: l,
|
|
37
39
|
// Convenience refs
|
|
38
|
-
templateId:
|
|
40
|
+
templateId: p,
|
|
39
41
|
userId: f,
|
|
40
42
|
variationId: m,
|
|
41
43
|
partnerName: g,
|
|
42
|
-
productType:
|
|
43
|
-
messageType:
|
|
44
|
-
username:
|
|
45
|
-
showHeader:
|
|
44
|
+
productType: b,
|
|
45
|
+
messageType: C,
|
|
46
|
+
username: y,
|
|
47
|
+
showHeader: E,
|
|
46
48
|
// Methods
|
|
47
49
|
getConfig: () => t.value,
|
|
48
|
-
isFeatureEnabled: (
|
|
50
|
+
isFeatureEnabled: (F) => e.isFeatureEnabled(F)
|
|
49
51
|
};
|
|
50
52
|
};
|
|
51
53
|
export {
|
|
52
|
-
|
|
54
|
+
w as useConfig
|
|
53
55
|
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { useConfig as l } from "./useConfig.js";
|
|
2
|
+
import { useSaveStart as m, useSaveComplete as c } from "./useGuidoActions.js";
|
|
3
|
+
import { useTemplatePreparation as d } from "../utils/templatePreparation.js";
|
|
4
|
+
import { useHtmlValidator as p } from "./useHtmlValidator.js";
|
|
5
|
+
const w = () => {
|
|
6
|
+
const i = m(), s = c(), { validateHtml: o } = p(), { callbacks: a } = l();
|
|
7
|
+
return { save: async (r = !1) => {
|
|
8
|
+
var e;
|
|
9
|
+
i();
|
|
10
|
+
const { prepareTemplateDetails: n } = d(), t = await n();
|
|
11
|
+
if (await o(t.compiledHtml, t.dynamicContentList, !0) && !((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)))
|
|
12
|
+
return r || s(t), t;
|
|
11
13
|
} };
|
|
12
14
|
};
|
|
13
15
|
export {
|
|
14
|
-
|
|
16
|
+
w as useSave
|
|
15
17
|
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
const _ = 3,
|
|
1
|
+
const _ = 3, A = 3, C = 9, P = 4, o = 10, t = 20, R = 0, c = 50, n = 5;
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
A as DEFAULT_CARDS_IN_ROW,
|
|
4
|
+
o as DEFAULT_COLUMN_SPACING,
|
|
4
5
|
_ as DEFAULT_PRODUCTS_PER_ROW,
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
t as DEFAULT_ROW_SPACING,
|
|
7
|
+
P as MAX_PRODUCTS_PER_ROW,
|
|
8
|
+
C as MAX_PRODUCT_COUNT,
|
|
9
|
+
c as MAX_SPACING,
|
|
10
|
+
R as MIN_SPACING,
|
|
11
|
+
n as SPACING_STEP
|
|
7
12
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
1
|
+
import { ModificationDescription as d } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as s } from "../../../common-control.js";
|
|
3
|
+
import { getCurrentLayout as l } from "../main/utils.js";
|
|
3
4
|
const u = "recommendation-card-background-color-control", e = {
|
|
4
5
|
CARD_BACKGROUND_COLOR: "cardBackgroundColor"
|
|
5
|
-
},
|
|
6
|
+
}, a = {
|
|
6
7
|
VERTICAL: ".product-card-segment",
|
|
7
8
|
HORIZONTAL: ".product-card-wrapper"
|
|
8
9
|
};
|
|
9
|
-
class
|
|
10
|
+
class _ extends s {
|
|
10
11
|
getId() {
|
|
11
12
|
return u;
|
|
12
13
|
}
|
|
@@ -23,43 +24,22 @@ class g extends i {
|
|
|
23
24
|
onRender() {
|
|
24
25
|
this._setFormValues(), this._listenToFormUpdates();
|
|
25
26
|
}
|
|
26
|
-
onTemplateNodeUpdated(
|
|
27
|
-
super.onTemplateNodeUpdated(
|
|
27
|
+
onTemplateNodeUpdated(r) {
|
|
28
|
+
super.onTemplateNodeUpdated(r), this._setFormValues();
|
|
28
29
|
}
|
|
29
30
|
_setFormValues() {
|
|
30
|
-
const
|
|
31
|
+
const r = this._getCurrentCardBackgroundColor();
|
|
31
32
|
this.api.updateValues({
|
|
32
|
-
[e.CARD_BACKGROUND_COLOR]:
|
|
33
|
+
[e.CARD_BACKGROUND_COLOR]: r
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Gets the block element - either currentNode itself or as a descendant
|
|
37
|
-
* The currentNode could BE the block element or contain it
|
|
38
|
-
*/
|
|
39
|
-
_getBlockElement() {
|
|
40
|
-
if (!this.currentNode)
|
|
41
|
-
return null;
|
|
42
|
-
if ("getAttribute" in this.currentNode) {
|
|
43
|
-
const t = this.currentNode.getAttribute("class");
|
|
44
|
-
if (t && t.includes("ins-recommendation-v3-block-v2"))
|
|
45
|
-
return this.currentNode;
|
|
46
|
-
}
|
|
47
|
-
return "querySelector" in this.currentNode ? this.currentNode.querySelector(".ins-recommendation-v3-block-v2") : null;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Gets the current layout orientation from the block's data attribute
|
|
51
|
-
*/
|
|
52
|
-
_getCurrentLayout() {
|
|
53
|
-
const t = this._getBlockElement();
|
|
54
|
-
return !t || !("getAttribute" in t) ? "vertical" : t.getAttribute("data-layout") === "horizontal" ? "horizontal" : "vertical";
|
|
55
|
-
}
|
|
56
36
|
/**
|
|
57
37
|
* Gets the appropriate selector based on layout
|
|
58
38
|
* Vertical: .product-card-segment (inner table per product cell)
|
|
59
39
|
* Horizontal: .product-card-wrapper (table per product row)
|
|
60
40
|
*/
|
|
61
41
|
_getCardSelector() {
|
|
62
|
-
return this.
|
|
42
|
+
return l(this.currentNode) === "vertical" ? a.VERTICAL : a.HORIZONTAL;
|
|
63
43
|
}
|
|
64
44
|
/**
|
|
65
45
|
* Reads the current background color from the first product card element
|
|
@@ -68,33 +48,33 @@ class g extends i {
|
|
|
68
48
|
_getCurrentCardBackgroundColor() {
|
|
69
49
|
if (!this.currentNode || !("querySelectorAll" in this.currentNode))
|
|
70
50
|
return "transparent";
|
|
71
|
-
const
|
|
72
|
-
return !
|
|
51
|
+
const r = this._getCardSelector(), t = this.currentNode.querySelector(r);
|
|
52
|
+
return !t || !("getStyle" in t) ? "transparent" : t.getStyle("background-color") || "transparent";
|
|
73
53
|
}
|
|
74
54
|
/**
|
|
75
55
|
* Handles card background color changes
|
|
76
56
|
* Applies the color to all product card elements based on layout
|
|
77
57
|
*/
|
|
78
|
-
_onCardBackgroundColorChange(
|
|
58
|
+
_onCardBackgroundColorChange(r) {
|
|
79
59
|
if (!this.currentNode || !("querySelectorAll" in this.currentNode))
|
|
80
60
|
return;
|
|
81
|
-
const
|
|
82
|
-
this.currentNode.querySelectorAll(
|
|
61
|
+
const t = this._getCardSelector(), o = Array.from(
|
|
62
|
+
this.currentNode.querySelectorAll(t)
|
|
83
63
|
);
|
|
84
64
|
if (o.length === 0)
|
|
85
65
|
return;
|
|
86
66
|
const n = this.api.getDocumentModifier();
|
|
87
|
-
o.forEach((
|
|
88
|
-
n.modifyHtml(
|
|
89
|
-
}), n.apply(new
|
|
67
|
+
o.forEach((c) => {
|
|
68
|
+
n.modifyHtml(c).setStyle("background-color", r);
|
|
69
|
+
}), n.apply(new d("Update card background color"));
|
|
90
70
|
}
|
|
91
71
|
_listenToFormUpdates() {
|
|
92
|
-
this.api.onValueChanged(e.CARD_BACKGROUND_COLOR, (
|
|
93
|
-
this._onCardBackgroundColorChange(
|
|
72
|
+
this.api.onValueChanged(e.CARD_BACKGROUND_COLOR, (r) => {
|
|
73
|
+
this._onCardBackgroundColorChange(r);
|
|
94
74
|
});
|
|
95
75
|
}
|
|
96
76
|
}
|
|
97
77
|
export {
|
|
98
78
|
u as CARD_BACKGROUND_COLOR_CONTROL_ID,
|
|
99
|
-
|
|
79
|
+
_ as CardBackgroundColorControl
|
|
100
80
|
};
|