@useinsider/guido 3.12.0-beta.435bd0b → 3.12.0-beta.458ffd7
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 -0
- package/dist/@types/config/schemas.js +64 -50
- package/dist/composables/useAllowlistToast.js +21 -0
- package/dist/composables/useSave.js +44 -24
- package/dist/composables/useUserRole.js +13 -0
- package/dist/composables/validators/useAllowlistValidator.js +31 -0
- package/dist/enums/roles.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +23 -21
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +41 -40
- package/dist/extensions/Blocks/controlFactories.js +125 -75
- package/dist/src/@types/config/schemas.d.ts +32 -0
- package/dist/src/composables/useAllowlistToast.d.ts +17 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useUserRole.d.ts +8 -0
- package/dist/src/composables/validators/useAllowlistValidator.d.ts +9 -0
- package/dist/src/enums/roles.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +36 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SettingsPanelRegistry as E, SettingsPanelTab as _, SettingsTab as
|
|
2
|
-
import { BLOCK_ID as
|
|
1
|
+
import { SettingsPanelRegistry as E, SettingsPanelTab as _, SettingsTab as I, ContainerControls as C } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { BLOCK_ID as R } from "./block.js";
|
|
3
3
|
import { RecommendationBlockId as S } from "./constants/blockIds.js";
|
|
4
4
|
import { RecommendationControlId as T } from "./constants/controlIds.js";
|
|
5
5
|
import "./constants/selectors.js";
|
|
6
|
-
import { CONTROL_BLOCK_ID as
|
|
6
|
+
import { CONTROL_BLOCK_ID as U } from "./controls/main/index.js";
|
|
7
7
|
import "./store/recommendation.js";
|
|
8
8
|
import "./utils/captureStyleTemplates.js";
|
|
9
9
|
import "./controls/name/index.js";
|
|
@@ -13,37 +13,38 @@ import "./controls/omnibusPrice/index.js";
|
|
|
13
13
|
import "./controls/omnibusDiscount/index.js";
|
|
14
14
|
import "./controls/button/index.js";
|
|
15
15
|
import "./controls/image/index.js";
|
|
16
|
-
import { SPACING_CONTROL_ID as
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
16
|
+
import { SPACING_CONTROL_ID as A } from "./controls/spacing/index.js";
|
|
17
|
+
import "./controls/blockBackground/index.js";
|
|
18
|
+
import { CARD_BACKGROUND_COLOR_CONTROL_ID as L } from "./controls/cardBackground/index.js";
|
|
19
|
+
import { COMPOSITION_CONTROL_BLOCK_ID as D } from "./controls/cardComposition/index.js";
|
|
19
20
|
import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
|
|
20
|
-
class
|
|
21
|
-
registerBlockControls(
|
|
22
|
-
|
|
21
|
+
class s extends E {
|
|
22
|
+
registerBlockControls(O) {
|
|
23
|
+
O[R] = [
|
|
23
24
|
new _(
|
|
24
|
-
|
|
25
|
+
I.SETTINGS,
|
|
25
26
|
[
|
|
26
|
-
|
|
27
|
+
U,
|
|
27
28
|
C.EXTERNAL_INDENTS
|
|
28
29
|
]
|
|
29
30
|
),
|
|
30
31
|
new _(
|
|
31
|
-
|
|
32
|
+
I.STYLES,
|
|
32
33
|
[
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
T.BLOCK_BACKGROUND,
|
|
35
|
+
L,
|
|
36
|
+
A
|
|
36
37
|
]
|
|
37
38
|
),
|
|
38
39
|
new _(
|
|
39
40
|
"Card Composition",
|
|
40
41
|
[
|
|
41
|
-
|
|
42
|
+
D
|
|
42
43
|
]
|
|
43
44
|
).withLabel(this.api.translate("Card Composition"))
|
|
44
|
-
],
|
|
45
|
+
], O[S.NAME] = [
|
|
45
46
|
new _(
|
|
46
|
-
|
|
47
|
+
I.SETTINGS,
|
|
47
48
|
[
|
|
48
49
|
N,
|
|
49
50
|
T.NAME_STYLE,
|
|
@@ -53,7 +54,7 @@ class d extends E {
|
|
|
53
54
|
]
|
|
54
55
|
),
|
|
55
56
|
new _(
|
|
56
|
-
|
|
57
|
+
I.STYLES,
|
|
57
58
|
[
|
|
58
59
|
T.NAME_BACKGROUND,
|
|
59
60
|
T.NAME_FONT_FAMILY,
|
|
@@ -61,9 +62,9 @@ class d extends E {
|
|
|
61
62
|
T.NAME_COLOR
|
|
62
63
|
]
|
|
63
64
|
)
|
|
64
|
-
],
|
|
65
|
+
], O[S.PRICE] = [
|
|
65
66
|
new _(
|
|
66
|
-
|
|
67
|
+
I.SETTINGS,
|
|
67
68
|
[
|
|
68
69
|
N,
|
|
69
70
|
T.PRICE_STYLE,
|
|
@@ -72,7 +73,7 @@ class d extends E {
|
|
|
72
73
|
]
|
|
73
74
|
),
|
|
74
75
|
new _(
|
|
75
|
-
|
|
76
|
+
I.STYLES,
|
|
76
77
|
[
|
|
77
78
|
T.PRICE_BACKGROUND,
|
|
78
79
|
T.PRICE_FONT_FAMILY,
|
|
@@ -80,9 +81,9 @@ class d extends E {
|
|
|
80
81
|
T.PRICE_COLOR
|
|
81
82
|
]
|
|
82
83
|
)
|
|
83
|
-
],
|
|
84
|
+
], O[S.OLD_PRICE] = [
|
|
84
85
|
new _(
|
|
85
|
-
|
|
86
|
+
I.SETTINGS,
|
|
86
87
|
[
|
|
87
88
|
N,
|
|
88
89
|
T.OLD_PRICE_STYLE,
|
|
@@ -91,7 +92,7 @@ class d extends E {
|
|
|
91
92
|
]
|
|
92
93
|
),
|
|
93
94
|
new _(
|
|
94
|
-
|
|
95
|
+
I.STYLES,
|
|
95
96
|
[
|
|
96
97
|
T.OLD_PRICE_BACKGROUND,
|
|
97
98
|
T.OLD_PRICE_FONT_FAMILY,
|
|
@@ -99,9 +100,9 @@ class d extends E {
|
|
|
99
100
|
T.OLD_PRICE_COLOR
|
|
100
101
|
]
|
|
101
102
|
)
|
|
102
|
-
],
|
|
103
|
+
], O[S.OMNIBUS_PRICE] = [
|
|
103
104
|
new _(
|
|
104
|
-
|
|
105
|
+
I.SETTINGS,
|
|
105
106
|
[
|
|
106
107
|
N,
|
|
107
108
|
T.OMNIBUS_PRICE_TEXT_BEFORE,
|
|
@@ -112,7 +113,7 @@ class d extends E {
|
|
|
112
113
|
]
|
|
113
114
|
),
|
|
114
115
|
new _(
|
|
115
|
-
|
|
116
|
+
I.STYLES,
|
|
116
117
|
[
|
|
117
118
|
T.OMNIBUS_PRICE_BACKGROUND,
|
|
118
119
|
T.OMNIBUS_PRICE_FONT_FAMILY,
|
|
@@ -120,9 +121,9 @@ class d extends E {
|
|
|
120
121
|
T.OMNIBUS_PRICE_COLOR
|
|
121
122
|
]
|
|
122
123
|
)
|
|
123
|
-
],
|
|
124
|
+
], O[S.OMNIBUS_DISCOUNT] = [
|
|
124
125
|
new _(
|
|
125
|
-
|
|
126
|
+
I.SETTINGS,
|
|
126
127
|
[
|
|
127
128
|
N,
|
|
128
129
|
T.OMNIBUS_DISCOUNT_TEXT_BEFORE,
|
|
@@ -133,7 +134,7 @@ class d extends E {
|
|
|
133
134
|
]
|
|
134
135
|
),
|
|
135
136
|
new _(
|
|
136
|
-
|
|
137
|
+
I.STYLES,
|
|
137
138
|
[
|
|
138
139
|
T.OMNIBUS_DISCOUNT_BACKGROUND,
|
|
139
140
|
T.OMNIBUS_DISCOUNT_FONT_FAMILY,
|
|
@@ -141,9 +142,9 @@ class d extends E {
|
|
|
141
142
|
T.OMNIBUS_DISCOUNT_COLOR
|
|
142
143
|
]
|
|
143
144
|
)
|
|
144
|
-
],
|
|
145
|
+
], O[S.BUTTON] = [
|
|
145
146
|
new _(
|
|
146
|
-
|
|
147
|
+
I.SETTINGS,
|
|
147
148
|
[
|
|
148
149
|
N,
|
|
149
150
|
T.BUTTON_TEXT,
|
|
@@ -153,7 +154,7 @@ class d extends E {
|
|
|
153
154
|
]
|
|
154
155
|
),
|
|
155
156
|
new _(
|
|
156
|
-
|
|
157
|
+
I.STYLES,
|
|
157
158
|
[
|
|
158
159
|
T.BUTTON_COLOR,
|
|
159
160
|
T.BUTTON_FONT_FAMILY,
|
|
@@ -164,9 +165,9 @@ class d extends E {
|
|
|
164
165
|
T.BUTTON_BORDER
|
|
165
166
|
]
|
|
166
167
|
)
|
|
167
|
-
],
|
|
168
|
+
], O[S.CUSTOM_ATTRIBUTE] = [
|
|
168
169
|
new _(
|
|
169
|
-
|
|
170
|
+
I.SETTINGS,
|
|
170
171
|
[
|
|
171
172
|
T.CUSTOM_ATTR_STYLE,
|
|
172
173
|
T.CUSTOM_ATTR_ALIGN,
|
|
@@ -175,7 +176,7 @@ class d extends E {
|
|
|
175
176
|
]
|
|
176
177
|
),
|
|
177
178
|
new _(
|
|
178
|
-
|
|
179
|
+
I.STYLES,
|
|
179
180
|
[
|
|
180
181
|
T.CUSTOM_ATTR_BACKGROUND,
|
|
181
182
|
T.CUSTOM_ATTR_FONT_FAMILY,
|
|
@@ -183,9 +184,9 @@ class d extends E {
|
|
|
183
184
|
T.CUSTOM_ATTR_COLOR
|
|
184
185
|
]
|
|
185
186
|
)
|
|
186
|
-
],
|
|
187
|
+
], O[S.IMAGE] = [
|
|
187
188
|
new _(
|
|
188
|
-
|
|
189
|
+
I.SETTINGS,
|
|
189
190
|
[
|
|
190
191
|
N,
|
|
191
192
|
T.IMAGE_SIZE,
|
|
@@ -196,5 +197,5 @@ class d extends E {
|
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
199
|
export {
|
|
199
|
-
|
|
200
|
+
s as SettingsPanel
|
|
200
201
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TextAlignBuiltInControl as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
return class extends
|
|
1
|
+
import { TextAlignBuiltInControl as C, TextColorBuiltInControl as x, TextSizeBuiltInControl as T, TextStyleBuiltInControl as B, TextFontFamilyBuiltInControl as m, ButtonBackgroundColorBuiltInControl as d, TextPaddingsBuiltInControl as y, ImageSizeBuiltInControl as b, ImageMarginsBuiltInControl as I, ButtonAlignBuiltInControl as S, ButtonBorderBuiltInControl as A, ButtonBorderRadiusBuiltInControl as k, ButtonColorBuiltInControl as N, ButtonFontFamilyBuiltInControl as h, ButtonMarginsBuiltInControl as p, ButtonPaddingsBuiltInControl as $, ButtonTextBuiltInControl as q, ButtonTextSizeBuiltInControl as F, ButtonTextStyleAndFontColorBuiltInControl as v, ButtonFitToContainerBuiltInControl as R, TextLineSpacingBuiltInControl as M } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
const O = "buttonTextStyleForm", a = "backgroundColor", g = /* @__PURE__ */ new Set(["", "transparent", "rgba(0, 0, 0, 0)"]), _ = ["elementColor", a], E = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
3
|
+
function P(o, n, r) {
|
|
4
|
+
return class extends C {
|
|
5
5
|
getId() {
|
|
6
6
|
return o;
|
|
7
7
|
}
|
|
@@ -13,8 +13,8 @@ function z(o, n, r) {
|
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return class extends
|
|
16
|
+
function H(o, n, r) {
|
|
17
|
+
return class extends x {
|
|
18
18
|
getId() {
|
|
19
19
|
return o;
|
|
20
20
|
}
|
|
@@ -26,8 +26,8 @@ function v(o, n, r) {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return class extends
|
|
29
|
+
function U(o, n, r) {
|
|
30
|
+
return class extends T {
|
|
31
31
|
getId() {
|
|
32
32
|
return o;
|
|
33
33
|
}
|
|
@@ -39,8 +39,8 @@ function P(o, n, r) {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return class extends
|
|
42
|
+
function Y(o, n, r) {
|
|
43
|
+
return class extends B {
|
|
44
44
|
getId() {
|
|
45
45
|
return o;
|
|
46
46
|
}
|
|
@@ -52,8 +52,8 @@ function D(o, n, r) {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
return class extends
|
|
55
|
+
function G(o, n, r) {
|
|
56
|
+
return class extends m {
|
|
57
57
|
getId() {
|
|
58
58
|
return o;
|
|
59
59
|
}
|
|
@@ -65,8 +65,8 @@ function K(o, n, r) {
|
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
return class extends
|
|
68
|
+
function V(o, n, r) {
|
|
69
|
+
return class extends d {
|
|
70
70
|
getId() {
|
|
71
71
|
return o;
|
|
72
72
|
}
|
|
@@ -89,16 +89,65 @@ function L(o, n, r) {
|
|
|
89
89
|
const t = this.getTargetNodes(e);
|
|
90
90
|
if (!t.length)
|
|
91
91
|
return;
|
|
92
|
-
const
|
|
92
|
+
const i = this.api.getValues()[a], l = !i || g.has(i), s = this.api.getDocumentModifier();
|
|
93
93
|
return t.forEach((u) => {
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
}),
|
|
94
|
+
const c = s.modifyHtml(u);
|
|
95
|
+
l ? c.removeStyle("background-color") : c.setStyle("background-color", i);
|
|
96
|
+
}), s;
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
100
|
+
function K(o) {
|
|
101
|
+
const n = _.find((e) => e in o);
|
|
102
|
+
if (!n)
|
|
103
|
+
return;
|
|
104
|
+
const r = o[n];
|
|
105
|
+
return typeof r == "string" ? r : "";
|
|
106
|
+
}
|
|
107
|
+
function L(o, n) {
|
|
108
|
+
return n.startsWith(".") && "hasClass" in o && o.hasClass(n.slice(1));
|
|
109
|
+
}
|
|
110
|
+
function z(o, n) {
|
|
111
|
+
try {
|
|
112
|
+
return L(o, n) ? o : o.closest(n) ?? void 0;
|
|
113
|
+
} catch {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function w(o, n) {
|
|
118
|
+
return class extends d {
|
|
119
|
+
getId() {
|
|
120
|
+
return o;
|
|
121
|
+
}
|
|
122
|
+
/** The parent control renders its own generic title; restore the block-level wording. */
|
|
123
|
+
getLabels() {
|
|
124
|
+
return { title: this.api.translate("Block Background Color") };
|
|
125
|
+
}
|
|
126
|
+
/** Guard: redirect the borrowed button parent onto the block `<td>` so it never paints the Buy buttons. */
|
|
127
|
+
getTargetNodes(r) {
|
|
128
|
+
const e = z(r, n);
|
|
129
|
+
return e ? [e] : [];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Writes the picked background onto the block as an inline style plus a `bgcolor`
|
|
133
|
+
* attribute. This is the whole mechanism, not a mirror: the parent control's own
|
|
134
|
+
* write never reaches the block element (verified at runtime). `bgcolor` is the
|
|
135
|
+
* channel Outlook honours on a `<td>`, and matches what the migrator emits.
|
|
136
|
+
*/
|
|
137
|
+
getAdditionalModifications(r) {
|
|
138
|
+
const [e] = this.getTargetNodes(r);
|
|
139
|
+
if (!e)
|
|
140
|
+
return;
|
|
141
|
+
const t = K(this.api.getValues());
|
|
142
|
+
if (t === void 0)
|
|
143
|
+
return;
|
|
144
|
+
const i = !t || g.has(t), l = this.api.getDocumentModifier(), s = l.modifyHtml(e);
|
|
145
|
+
return i ? s.removeStyle("background-color").removeAttribute("bgcolor") : (s.setStyle("background-color", t), E.test(t) ? s.setAttribute("bgcolor", t) : s.removeAttribute("bgcolor")), l;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function W(o, n, r) {
|
|
150
|
+
return class extends y {
|
|
102
151
|
getId() {
|
|
103
152
|
return o;
|
|
104
153
|
}
|
|
@@ -110,7 +159,7 @@ function U(o, n, r) {
|
|
|
110
159
|
}
|
|
111
160
|
};
|
|
112
161
|
}
|
|
113
|
-
function
|
|
162
|
+
function X(o, n, r) {
|
|
114
163
|
return class extends M {
|
|
115
164
|
getId() {
|
|
116
165
|
return o;
|
|
@@ -120,8 +169,8 @@ function Y(o, n, r) {
|
|
|
120
169
|
}
|
|
121
170
|
};
|
|
122
171
|
}
|
|
123
|
-
function
|
|
124
|
-
return class extends
|
|
172
|
+
function j(o, n, r = ".ins-recommendation-product-container") {
|
|
173
|
+
return class extends S {
|
|
125
174
|
getId() {
|
|
126
175
|
return o;
|
|
127
176
|
}
|
|
@@ -131,8 +180,8 @@ function w(o, n, r = ".ins-recommendation-product-container") {
|
|
|
131
180
|
}
|
|
132
181
|
};
|
|
133
182
|
}
|
|
134
|
-
function
|
|
135
|
-
return class extends
|
|
183
|
+
function J(o, n, r = ".ins-recommendation-product-container") {
|
|
184
|
+
return class extends N {
|
|
136
185
|
getId() {
|
|
137
186
|
return o;
|
|
138
187
|
}
|
|
@@ -142,8 +191,8 @@ function G(o, n, r = ".ins-recommendation-product-container") {
|
|
|
142
191
|
}
|
|
143
192
|
};
|
|
144
193
|
}
|
|
145
|
-
function
|
|
146
|
-
return class extends
|
|
194
|
+
function Q(o, n, r = ".ins-recommendation-product-container") {
|
|
195
|
+
return class extends A {
|
|
147
196
|
getId() {
|
|
148
197
|
return o;
|
|
149
198
|
}
|
|
@@ -153,8 +202,8 @@ function H(o, n, r = ".ins-recommendation-product-container") {
|
|
|
153
202
|
}
|
|
154
203
|
};
|
|
155
204
|
}
|
|
156
|
-
function
|
|
157
|
-
return class extends
|
|
205
|
+
function Z(o, n, r = ".ins-recommendation-product-container") {
|
|
206
|
+
return class extends k {
|
|
158
207
|
getId() {
|
|
159
208
|
return o;
|
|
160
209
|
}
|
|
@@ -164,8 +213,8 @@ function V(o, n, r = ".ins-recommendation-product-container") {
|
|
|
164
213
|
}
|
|
165
214
|
};
|
|
166
215
|
}
|
|
167
|
-
function
|
|
168
|
-
return class extends
|
|
216
|
+
function tt(o, n, r = ".ins-recommendation-product-container") {
|
|
217
|
+
return class extends h {
|
|
169
218
|
getId() {
|
|
170
219
|
return o;
|
|
171
220
|
}
|
|
@@ -175,8 +224,8 @@ function W(o, n, r = ".ins-recommendation-product-container") {
|
|
|
175
224
|
}
|
|
176
225
|
};
|
|
177
226
|
}
|
|
178
|
-
function
|
|
179
|
-
return class extends
|
|
227
|
+
function et(o, n, r = ".ins-recommendation-product-container") {
|
|
228
|
+
return class extends p {
|
|
180
229
|
getId() {
|
|
181
230
|
return o;
|
|
182
231
|
}
|
|
@@ -186,7 +235,7 @@ function X(o, n, r = ".ins-recommendation-product-container") {
|
|
|
186
235
|
}
|
|
187
236
|
};
|
|
188
237
|
}
|
|
189
|
-
function
|
|
238
|
+
function nt(o, n, r = ".ins-recommendation-product-container") {
|
|
190
239
|
return class extends $ {
|
|
191
240
|
getId() {
|
|
192
241
|
return o;
|
|
@@ -197,8 +246,8 @@ function j(o, n, r = ".ins-recommendation-product-container") {
|
|
|
197
246
|
}
|
|
198
247
|
};
|
|
199
248
|
}
|
|
200
|
-
function
|
|
201
|
-
return class extends
|
|
249
|
+
function rt(o, n, r = ".ins-recommendation-product-container") {
|
|
250
|
+
return class extends q {
|
|
202
251
|
getId() {
|
|
203
252
|
return o;
|
|
204
253
|
}
|
|
@@ -208,8 +257,8 @@ function J(o, n, r = ".ins-recommendation-product-container") {
|
|
|
208
257
|
}
|
|
209
258
|
};
|
|
210
259
|
}
|
|
211
|
-
function
|
|
212
|
-
return class extends
|
|
260
|
+
function ot(o, n, r = ".ins-recommendation-product-container") {
|
|
261
|
+
return class extends F {
|
|
213
262
|
getId() {
|
|
214
263
|
return o;
|
|
215
264
|
}
|
|
@@ -219,8 +268,8 @@ function Q(o, n, r = ".ins-recommendation-product-container") {
|
|
|
219
268
|
}
|
|
220
269
|
};
|
|
221
270
|
}
|
|
222
|
-
function
|
|
223
|
-
return class extends
|
|
271
|
+
function st(o, n, r) {
|
|
272
|
+
return class extends v {
|
|
224
273
|
getId() {
|
|
225
274
|
return o;
|
|
226
275
|
}
|
|
@@ -242,21 +291,21 @@ function Z(o, n, r) {
|
|
|
242
291
|
const t = e.closest(r);
|
|
243
292
|
if (!t)
|
|
244
293
|
return;
|
|
245
|
-
const
|
|
246
|
-
if (!
|
|
294
|
+
const i = t.querySelectorAll(`[esd-extension-block-id="${n}"] a.es-button`);
|
|
295
|
+
if (!i.length)
|
|
247
296
|
return;
|
|
248
|
-
const
|
|
249
|
-
if (!
|
|
297
|
+
const l = this.api.getValues()[O];
|
|
298
|
+
if (!l)
|
|
250
299
|
return;
|
|
251
|
-
const
|
|
252
|
-
return
|
|
253
|
-
|
|
254
|
-
}),
|
|
300
|
+
const s = l.bold ? "bold" : "normal", u = l.italic ? "italic" : "normal", c = this.api.getDocumentModifier();
|
|
301
|
+
return i.forEach((f) => {
|
|
302
|
+
c.modifyHtml(f).setStyle("font-weight", s).setStyle("font-style", u);
|
|
303
|
+
}), c;
|
|
255
304
|
}
|
|
256
305
|
};
|
|
257
306
|
}
|
|
258
|
-
function
|
|
259
|
-
return class extends
|
|
307
|
+
function it(o, n, r) {
|
|
308
|
+
return class extends R {
|
|
260
309
|
getId() {
|
|
261
310
|
return o;
|
|
262
311
|
}
|
|
@@ -266,8 +315,8 @@ function tt(o, n, r) {
|
|
|
266
315
|
}
|
|
267
316
|
};
|
|
268
317
|
}
|
|
269
|
-
function
|
|
270
|
-
return class extends
|
|
318
|
+
function lt(o, n, r) {
|
|
319
|
+
return class extends b {
|
|
271
320
|
getId() {
|
|
272
321
|
return o;
|
|
273
322
|
}
|
|
@@ -281,8 +330,8 @@ function et(o, n, r) {
|
|
|
281
330
|
}
|
|
282
331
|
};
|
|
283
332
|
}
|
|
284
|
-
function
|
|
285
|
-
return class extends
|
|
333
|
+
function ct(o, n, r) {
|
|
334
|
+
return class extends I {
|
|
286
335
|
getId() {
|
|
287
336
|
return o;
|
|
288
337
|
}
|
|
@@ -297,25 +346,26 @@ function nt(o, n, r) {
|
|
|
297
346
|
};
|
|
298
347
|
}
|
|
299
348
|
export {
|
|
300
|
-
w as
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
349
|
+
w as createBlockBackgroundColorControl,
|
|
350
|
+
j as createButtonAlignControl,
|
|
351
|
+
Q as createButtonBorderControl,
|
|
352
|
+
Z as createButtonBorderRadiusControl,
|
|
353
|
+
J as createButtonColorControl,
|
|
354
|
+
it as createButtonFitToContainerControl,
|
|
355
|
+
tt as createButtonFontFamilyControl,
|
|
356
|
+
et as createButtonMarginsControl,
|
|
357
|
+
nt as createButtonPaddingsControl,
|
|
358
|
+
rt as createButtonTextControl,
|
|
359
|
+
ot as createButtonTextSizeControl,
|
|
360
|
+
st as createButtonTextStyleAndFontColorControl,
|
|
361
|
+
ct as createImageMarginsControl,
|
|
362
|
+
lt as createImageSizeControl,
|
|
363
|
+
W as createPaddingsControl,
|
|
364
|
+
P as createTextAlignControl,
|
|
365
|
+
V as createTextBackgroundColorControl,
|
|
366
|
+
H as createTextColorControl,
|
|
367
|
+
G as createTextFontFamilyControl,
|
|
368
|
+
X as createTextLineSpacingControl,
|
|
369
|
+
U as createTextSizeControl,
|
|
370
|
+
Y as createTextStyleControl
|
|
321
371
|
};
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { DynamicContentNode } from '../generic';
|
|
9
9
|
import type { SavedTemplateDetails } from '../stripo';
|
|
10
|
+
import type { ActionButton } from '../toaster';
|
|
10
11
|
import * as v from 'valibot';
|
|
11
12
|
/**
|
|
12
13
|
* Handler function for external validation before save
|
|
@@ -14,6 +15,19 @@ import * as v from 'valibot';
|
|
|
14
15
|
* @returns Promise<boolean> - true if valid, false to cancel save
|
|
15
16
|
*/
|
|
16
17
|
export type ExternalValidationHandler = (data: Omit<SavedTemplateDetails, 'metadata'>) => Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Content for the domain-allowlist block toaster. By default Guido self-serves this (see
|
|
20
|
+
* useAllowlistToast): it resolves the user role via /get-user-role-and-email, builds the
|
|
21
|
+
* settings deep-link, and pulls copy from window.trans. A host may supply an override to
|
|
22
|
+
* replace that content. `actionButton.onClick` runs the action (e.g. the "Add to allowlist"
|
|
23
|
+
* deep-link). Returning null/void falls back to Guido's self-served toaster.
|
|
24
|
+
* @param blockedDomains - the non-allowlisted domains found in the template
|
|
25
|
+
*/
|
|
26
|
+
export interface AllowlistToastContent {
|
|
27
|
+
message: string;
|
|
28
|
+
actionButton?: ActionButton;
|
|
29
|
+
}
|
|
30
|
+
export type ResolveAllowlistToastHandler = (blockedDomains: string[]) => AllowlistToastContent | null | void;
|
|
17
31
|
/**
|
|
18
32
|
* Message type constants for email templates
|
|
19
33
|
*/
|
|
@@ -377,6 +391,8 @@ export declare const FeaturesSchema: v.ObjectSchema<{
|
|
|
377
391
|
readonly liquidSyntax: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
378
392
|
/** Enable autosave (3-min interval + tab-hide). User toggles on/off from the header. */
|
|
379
393
|
readonly autosave: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
394
|
+
/** Enable pre-save domain-allowlist validation (opt-in; host supplies the block toaster via callbacks.resolveAllowlistToast) */
|
|
395
|
+
readonly allowlistEnabled: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
380
396
|
}, undefined>;
|
|
381
397
|
/**
|
|
382
398
|
* Default block types available in Stripo
|
|
@@ -582,6 +598,13 @@ export declare const CallbacksSchema: v.ObjectSchema<{
|
|
|
582
598
|
* Return false to cancel the save operation.
|
|
583
599
|
*/
|
|
584
600
|
readonly externalValidation: v.OptionalSchema<v.CustomSchema<ExternalValidationHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
601
|
+
/**
|
|
602
|
+
* OPTIONAL override for the domain-allowlist block toaster (features.allowlistEnabled). By
|
|
603
|
+
* default Guido self-serves the toaster — resolves the user role via /get-user-role-and-email,
|
|
604
|
+
* builds the settings deep-link, and reads copy from window.trans — so consumers only flip the
|
|
605
|
+
* flag. Supply this only to replace that content. Returning null/void keeps Guido's default.
|
|
606
|
+
*/
|
|
607
|
+
readonly resolveAllowlistToast: v.OptionalSchema<v.CustomSchema<ResolveAllowlistToastHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
585
608
|
}, undefined>;
|
|
586
609
|
/**
|
|
587
610
|
* Complete Guido configuration schema
|
|
@@ -764,6 +787,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
764
787
|
readonly liquidSyntax: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
765
788
|
/** Enable autosave (3-min interval + tab-hide). User toggles on/off from the header. */
|
|
766
789
|
readonly autosave: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
790
|
+
/** Enable pre-save domain-allowlist validation (opt-in; host supplies the block toaster via callbacks.resolveAllowlistToast) */
|
|
791
|
+
readonly allowlistEnabled: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
767
792
|
}, undefined>, {}>;
|
|
768
793
|
/** Block configuration */
|
|
769
794
|
readonly blocks: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -834,5 +859,12 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
834
859
|
* Return false to cancel the save operation.
|
|
835
860
|
*/
|
|
836
861
|
readonly externalValidation: v.OptionalSchema<v.CustomSchema<ExternalValidationHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
862
|
+
/**
|
|
863
|
+
* OPTIONAL override for the domain-allowlist block toaster (features.allowlistEnabled). By
|
|
864
|
+
* default Guido self-serves the toaster — resolves the user role via /get-user-role-and-email,
|
|
865
|
+
* builds the settings deep-link, and reads copy from window.trans — so consumers only flip the
|
|
866
|
+
* flag. Supply this only to replace that content. Returning null/void keeps Guido's default.
|
|
867
|
+
*/
|
|
868
|
+
readonly resolveAllowlistToast: v.OptionalSchema<v.CustomSchema<ResolveAllowlistToastHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
837
869
|
}, undefined>, {}>;
|
|
838
870
|
}, undefined>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AllowlistToastContent } from '@@/Types/config/schemas';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the "Add to allowlist" InOne Settings deep-link (Security tab, add-domain modal
|
|
4
|
+
* prefilled). The route is identical across InOne products, so Guido builds it generically.
|
|
5
|
+
* @param value - domain(s) to prefill; base64-encoded into the `values` query param.
|
|
6
|
+
*/
|
|
7
|
+
export declare const buildAllowlistSettingsUrl: (value: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Builds the domain-allowlist block-toaster content Guido renders when a save is blocked.
|
|
10
|
+
* Guido owns the whole toaster: it resolves the user role itself (useUserRole → the shared
|
|
11
|
+
* /get-user-role-and-email endpoint) and pulls copy from window.trans, so consumers only need
|
|
12
|
+
* to set features.allowlistEnabled. Manage users get the "Add to allowlist" deep-link button;
|
|
13
|
+
* everyone else gets a message-only warning. SD-143197.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useAllowlistToast: () => {
|
|
16
|
+
resolveAllowlistToast: (blockedDomains: string[]) => Promise<AllowlistToastContent>;
|
|
17
|
+
};
|