@inspirer-dev/crm-dashboard 1.0.85 → 1.0.88
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/admin/src/components/ButtonsBuilder/index.tsx +4 -1
- package/admin/src/components/StepFlowBuilder/panels/EventTriggerConfig.tsx +13 -19
- package/admin/src/components/TriggerConfigField/index.tsx +120 -0
- package/admin/src/components/TriggerParamsField/index.tsx +331 -109
- package/dist/_chunks/index-BqcFfrh8.js +478 -0
- package/dist/_chunks/{index-BQcRoIJr.js → index-C6cSKRAH.js} +115 -2
- package/dist/_chunks/index-CKr1VvX0.mjs +476 -0
- package/dist/_chunks/{index-u-jR-zfs.js → index-CapXG1AZ.js} +4 -1
- package/dist/_chunks/{index-DRhcN7TG.mjs → index-ClbsgJmF.mjs} +4 -1
- package/dist/_chunks/{index-354YMebI.js → index-DitYBTyj.js} +10 -28
- package/dist/_chunks/{index-gR86Z3uh.mjs → index-P8pE6Zbx.mjs} +10 -28
- package/dist/_chunks/{index-Dhj0KzCX.mjs → index-o12Z75S3.mjs} +116 -3
- package/dist/admin/index.js +4 -4
- package/dist/admin/index.mjs +4 -4
- package/package.json +1 -1
- package/admin/playground/dist/assets/index-9hS_dqwV.css +0 -1
- package/admin/playground/dist/assets/index-BfQ5hqOR.js +0 -2588
- package/admin/playground/dist/index.html +0 -14
- package/dist/_chunks/index-CqRPcaXV.js +0 -304
- package/dist/_chunks/index-DnyoVNLo.mjs +0 -304
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const designSystem = require("@strapi/design-system");
|
|
6
|
+
const icons = require("@strapi/icons");
|
|
7
|
+
const styledComponents = require("styled-components");
|
|
8
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
9
|
+
const React__default = /* @__PURE__ */ _interopDefault(React);
|
|
10
|
+
const TRIGGER_PARAMS = [
|
|
11
|
+
{
|
|
12
|
+
key: "delaySeconds",
|
|
13
|
+
label: "Задержка",
|
|
14
|
+
description: "Задержка перед показом после срабатывания триггера",
|
|
15
|
+
unit: "сек",
|
|
16
|
+
min: 0,
|
|
17
|
+
placeholder: "7",
|
|
18
|
+
stageTypes: ["side_hint", "modal", "retry"]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
key: "timeOnSiteSeconds",
|
|
22
|
+
label: "Время на сайте",
|
|
23
|
+
description: "Мин. время на сайте для срабатывания",
|
|
24
|
+
unit: "сек",
|
|
25
|
+
min: 0,
|
|
26
|
+
placeholder: "120",
|
|
27
|
+
stageTypes: ["exit_intent", "side_hint", "modal"]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
key: "scrollThresholdPx",
|
|
31
|
+
label: "Порог скролла",
|
|
32
|
+
description: "Скролл в пикселях для срабатывания",
|
|
33
|
+
unit: "px",
|
|
34
|
+
min: 0,
|
|
35
|
+
placeholder: "200",
|
|
36
|
+
stageTypes: ["side_hint"]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: "idleSeconds",
|
|
40
|
+
label: "Бездействие",
|
|
41
|
+
description: "Время без кликов/скролла",
|
|
42
|
+
unit: "сек",
|
|
43
|
+
min: 0,
|
|
44
|
+
placeholder: "15",
|
|
45
|
+
stageTypes: ["side_hint"]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
key: "caseViewSeconds",
|
|
49
|
+
label: "Просмотр кейса",
|
|
50
|
+
description: "Время на странице кейса",
|
|
51
|
+
unit: "сек",
|
|
52
|
+
min: 0,
|
|
53
|
+
placeholder: "12",
|
|
54
|
+
stageTypes: ["modal", "side_hint"]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
key: "activePlayMinutes",
|
|
58
|
+
label: "Активная игра",
|
|
59
|
+
description: "Время активной игры",
|
|
60
|
+
unit: "мин",
|
|
61
|
+
min: 0,
|
|
62
|
+
placeholder: "10",
|
|
63
|
+
stageTypes: ["modal"]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "actionCountThreshold",
|
|
67
|
+
label: "Порог действий",
|
|
68
|
+
description: "Кол-во значимых действий + низкий баланс",
|
|
69
|
+
unit: "",
|
|
70
|
+
min: 0,
|
|
71
|
+
placeholder: "2",
|
|
72
|
+
stageTypes: ["modal"]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: "balanceThresholdMultiplier",
|
|
76
|
+
label: "Множитель баланса",
|
|
77
|
+
description: 'Множитель мин. цены кейса для "низкого баланса"',
|
|
78
|
+
unit: "×",
|
|
79
|
+
min: 0,
|
|
80
|
+
placeholder: "1.5",
|
|
81
|
+
stageTypes: ["modal", "side_hint"]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
key: "abandonedTimeoutMinutes",
|
|
85
|
+
label: "Таймаут заброшенного депозита",
|
|
86
|
+
description: "Через сколько минут депозит считается заброшенным",
|
|
87
|
+
unit: "мин",
|
|
88
|
+
min: 1,
|
|
89
|
+
placeholder: "10",
|
|
90
|
+
stageTypes: ["retry"]
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
key: "minDepositAmount",
|
|
94
|
+
label: "Мин. сумма депозита",
|
|
95
|
+
description: "Подстановка в {{min_deposit}} в текстах",
|
|
96
|
+
unit: "₽",
|
|
97
|
+
min: 0,
|
|
98
|
+
placeholder: "250",
|
|
99
|
+
stageTypes: ["modal", "side_hint", "retry"]
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
const STAGE_TYPE_LABELS = {
|
|
103
|
+
side_hint: "Side-hint",
|
|
104
|
+
modal: "Modal",
|
|
105
|
+
exit_intent: "Exit intent",
|
|
106
|
+
retry: "Retry"
|
|
107
|
+
};
|
|
108
|
+
const parseValue = (value) => {
|
|
109
|
+
if (!value) return [{}];
|
|
110
|
+
if (typeof value === "string") {
|
|
111
|
+
try {
|
|
112
|
+
const parsed = JSON.parse(value);
|
|
113
|
+
if (Array.isArray(parsed)) return parsed.length > 0 ? parsed : [{}];
|
|
114
|
+
if (typeof parsed === "object" && parsed !== null) return [parsed];
|
|
115
|
+
} catch {
|
|
116
|
+
}
|
|
117
|
+
return [{}];
|
|
118
|
+
}
|
|
119
|
+
if (Array.isArray(value)) return value.length > 0 ? value : [{}];
|
|
120
|
+
if (typeof value === "object") return [value];
|
|
121
|
+
return [{}];
|
|
122
|
+
};
|
|
123
|
+
const serialize = (groups) => {
|
|
124
|
+
const cleaned = groups.map((group) => {
|
|
125
|
+
const out = {};
|
|
126
|
+
for (const [key, val] of Object.entries(group)) {
|
|
127
|
+
if (typeof val === "number") out[key] = val;
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
}).filter((group) => Object.keys(group).length > 0);
|
|
131
|
+
return JSON.stringify(cleaned.length > 0 ? cleaned : []);
|
|
132
|
+
};
|
|
133
|
+
const DEPTH_BORDERS = ["#7b79ff", "#ee5e52", "#0c75af", "#328048"];
|
|
134
|
+
const useThemeColors = () => {
|
|
135
|
+
const theme = styledComponents.useTheme();
|
|
136
|
+
const isDark = theme?.colors?.neutral0 === "#212134";
|
|
137
|
+
return React.useMemo(
|
|
138
|
+
() => ({
|
|
139
|
+
isDark,
|
|
140
|
+
emptyBorder: isDark ? "#32324d" : "#dcdce4",
|
|
141
|
+
cardBorder: isDark ? "#32324d" : "#eaeaef",
|
|
142
|
+
tagBg: isDark ? "#2d2d4a" : "#f0f0ff",
|
|
143
|
+
groupBg: isDark ? "#1a1a2e" : "#f6f6f9",
|
|
144
|
+
orDividerLine: isDark ? "#32324d" : "#dcdce4",
|
|
145
|
+
andLabelColor: isDark ? "#a5a5ba" : "#666687",
|
|
146
|
+
depthBorders: DEPTH_BORDERS
|
|
147
|
+
}),
|
|
148
|
+
[isDark]
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
const getParamDef = (key) => TRIGGER_PARAMS.find((p) => p.key === key);
|
|
152
|
+
const ParamCard = ({
|
|
153
|
+
paramKey,
|
|
154
|
+
value,
|
|
155
|
+
onValueChange,
|
|
156
|
+
onRemove,
|
|
157
|
+
disabled,
|
|
158
|
+
colors
|
|
159
|
+
}) => {
|
|
160
|
+
const def = getParamDef(paramKey);
|
|
161
|
+
if (!def) return null;
|
|
162
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { background: "neutral0", style: { border: `1px solid ${colors.cardBorder}` }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardContent, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, alignItems: "center", padding: 3, children: [
|
|
163
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1, minWidth: 0 }, children: [
|
|
164
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", marginBottom: 1, children: [
|
|
165
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", children: def.label }),
|
|
166
|
+
def.unit && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: [
|
|
167
|
+
"(",
|
|
168
|
+
def.unit,
|
|
169
|
+
")"
|
|
170
|
+
] })
|
|
171
|
+
] }),
|
|
172
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: def.description }),
|
|
173
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 1, marginTop: 1, wrap: "wrap", children: def.stageTypes.map((st) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
174
|
+
designSystem.Box,
|
|
175
|
+
{
|
|
176
|
+
style: {
|
|
177
|
+
padding: "1px 6px",
|
|
178
|
+
borderRadius: "4px",
|
|
179
|
+
backgroundColor: colors.tagBg,
|
|
180
|
+
fontSize: "11px"
|
|
181
|
+
},
|
|
182
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "primary600", children: STAGE_TYPE_LABELS[st] || st })
|
|
183
|
+
},
|
|
184
|
+
st
|
|
185
|
+
)) })
|
|
186
|
+
] }),
|
|
187
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: 120, flexShrink: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
188
|
+
designSystem.NumberInput,
|
|
189
|
+
{
|
|
190
|
+
placeholder: def.placeholder,
|
|
191
|
+
value: value ?? "",
|
|
192
|
+
onValueChange,
|
|
193
|
+
disabled,
|
|
194
|
+
size: "S",
|
|
195
|
+
step: paramKey === "balanceThresholdMultiplier" ? 0.1 : 1
|
|
196
|
+
}
|
|
197
|
+
) }),
|
|
198
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label: "Удалить параметр", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
199
|
+
designSystem.IconButton,
|
|
200
|
+
{
|
|
201
|
+
onClick: onRemove,
|
|
202
|
+
label: "Delete",
|
|
203
|
+
variant: "ghost",
|
|
204
|
+
size: "S",
|
|
205
|
+
disabled,
|
|
206
|
+
style: { color: "#d02b20", flexShrink: 0 },
|
|
207
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { width: 16, height: 16 })
|
|
208
|
+
}
|
|
209
|
+
) })
|
|
210
|
+
] }) }) });
|
|
211
|
+
};
|
|
212
|
+
const AndLabel = ({ colors }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", paddingTop: 1, paddingBottom: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
213
|
+
designSystem.Typography,
|
|
214
|
+
{
|
|
215
|
+
variant: "sigma",
|
|
216
|
+
textColor: "neutral600",
|
|
217
|
+
style: {
|
|
218
|
+
fontSize: "11px",
|
|
219
|
+
fontWeight: 700,
|
|
220
|
+
letterSpacing: "0.5px",
|
|
221
|
+
color: colors.andLabelColor,
|
|
222
|
+
textTransform: "uppercase"
|
|
223
|
+
},
|
|
224
|
+
children: "И"
|
|
225
|
+
}
|
|
226
|
+
) });
|
|
227
|
+
const OrDivider = ({ colors }) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, paddingTop: 2, paddingBottom: 2, children: [
|
|
228
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1, height: "1px", backgroundColor: colors.orDividerLine } }),
|
|
229
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
230
|
+
designSystem.Box,
|
|
231
|
+
{
|
|
232
|
+
style: {
|
|
233
|
+
padding: "2px 12px",
|
|
234
|
+
borderRadius: "12px",
|
|
235
|
+
border: `1px solid ${colors.orDividerLine}`,
|
|
236
|
+
backgroundColor: colors.isDark ? "#212134" : "#ffffff"
|
|
237
|
+
},
|
|
238
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
239
|
+
designSystem.Typography,
|
|
240
|
+
{
|
|
241
|
+
variant: "sigma",
|
|
242
|
+
style: {
|
|
243
|
+
fontSize: "11px",
|
|
244
|
+
fontWeight: 700,
|
|
245
|
+
letterSpacing: "0.5px",
|
|
246
|
+
color: colors.andLabelColor,
|
|
247
|
+
textTransform: "uppercase"
|
|
248
|
+
},
|
|
249
|
+
children: "ИЛИ"
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
}
|
|
253
|
+
),
|
|
254
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1, height: "1px", backgroundColor: colors.orDividerLine } })
|
|
255
|
+
] });
|
|
256
|
+
const ParamGroupCard = ({
|
|
257
|
+
group,
|
|
258
|
+
groupIndex,
|
|
259
|
+
totalGroups,
|
|
260
|
+
onAddParam,
|
|
261
|
+
onRemoveParam,
|
|
262
|
+
onSetValue,
|
|
263
|
+
onRemoveGroup,
|
|
264
|
+
disabled,
|
|
265
|
+
colors
|
|
266
|
+
}) => {
|
|
267
|
+
const activeKeys = Object.keys(group);
|
|
268
|
+
const availableParams = TRIGGER_PARAMS.filter((p) => !activeKeys.includes(p.key));
|
|
269
|
+
const borderColor = colors.depthBorders[groupIndex % colors.depthBorders.length];
|
|
270
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
271
|
+
designSystem.Box,
|
|
272
|
+
{
|
|
273
|
+
padding: 4,
|
|
274
|
+
hasRadius: true,
|
|
275
|
+
style: {
|
|
276
|
+
backgroundColor: colors.groupBg,
|
|
277
|
+
borderLeft: `3px solid ${borderColor}`,
|
|
278
|
+
border: `1px solid ${colors.cardBorder}`,
|
|
279
|
+
borderLeftWidth: "3px",
|
|
280
|
+
borderLeftColor: borderColor
|
|
281
|
+
},
|
|
282
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
|
|
283
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
|
|
284
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
285
|
+
designSystem.Typography,
|
|
286
|
+
{
|
|
287
|
+
variant: "sigma",
|
|
288
|
+
textColor: "neutral700",
|
|
289
|
+
style: { textTransform: "uppercase", fontSize: "11px", letterSpacing: "0.5px" },
|
|
290
|
+
children: [
|
|
291
|
+
"Группа ",
|
|
292
|
+
groupIndex + 1
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
),
|
|
296
|
+
totalGroups > 1 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label: "Удалить группу", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
297
|
+
designSystem.IconButton,
|
|
298
|
+
{
|
|
299
|
+
onClick: onRemoveGroup,
|
|
300
|
+
label: "Удалить группу",
|
|
301
|
+
variant: "ghost",
|
|
302
|
+
size: "S",
|
|
303
|
+
disabled,
|
|
304
|
+
style: { color: "#d02b20" },
|
|
305
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { width: 14, height: 14 })
|
|
306
|
+
}
|
|
307
|
+
) })
|
|
308
|
+
] }),
|
|
309
|
+
activeKeys.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
310
|
+
designSystem.Box,
|
|
311
|
+
{
|
|
312
|
+
padding: 3,
|
|
313
|
+
hasRadius: true,
|
|
314
|
+
style: {
|
|
315
|
+
border: `1px dashed ${colors.emptyBorder}`,
|
|
316
|
+
textAlign: "center"
|
|
317
|
+
},
|
|
318
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: "Добавьте параметры в группу" })
|
|
319
|
+
}
|
|
320
|
+
) : activeKeys.map((key, i) => /* @__PURE__ */ jsxRuntime.jsxs(React__default.default.Fragment, { children: [
|
|
321
|
+
i > 0 && /* @__PURE__ */ jsxRuntime.jsx(AndLabel, { colors }),
|
|
322
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
323
|
+
ParamCard,
|
|
324
|
+
{
|
|
325
|
+
paramKey: key,
|
|
326
|
+
value: group[key],
|
|
327
|
+
onValueChange: (val) => onSetValue(key, val),
|
|
328
|
+
onRemove: () => onRemoveParam(key),
|
|
329
|
+
disabled,
|
|
330
|
+
colors
|
|
331
|
+
}
|
|
332
|
+
)
|
|
333
|
+
] }, key)),
|
|
334
|
+
availableParams.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(AddParamSelect, { available: availableParams, onAdd: onAddParam, disabled }) })
|
|
335
|
+
] })
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
};
|
|
339
|
+
const TriggerParamsField = React.forwardRef(
|
|
340
|
+
({ name, value, onChange, intlLabel, disabled, error, required, hint }, ref) => {
|
|
341
|
+
const initialRef = React.useRef(value);
|
|
342
|
+
const [groups, setGroups] = React.useState(() => parseValue(initialRef.current));
|
|
343
|
+
const colors = useThemeColors();
|
|
344
|
+
const update = (next) => {
|
|
345
|
+
setGroups(next);
|
|
346
|
+
onChange({ target: { name, value: serialize(next) } });
|
|
347
|
+
};
|
|
348
|
+
const addGroup = () => {
|
|
349
|
+
update([...groups, {}]);
|
|
350
|
+
};
|
|
351
|
+
const removeGroup = (idx) => {
|
|
352
|
+
const next = groups.filter((_, i) => i !== idx);
|
|
353
|
+
update(next.length > 0 ? next : [{}]);
|
|
354
|
+
};
|
|
355
|
+
const addParamToGroup = (idx, key) => {
|
|
356
|
+
const next = groups.map((g, i) => i === idx ? { ...g, [key]: null } : g);
|
|
357
|
+
update(next);
|
|
358
|
+
};
|
|
359
|
+
const removeParamFromGroup = (idx, key) => {
|
|
360
|
+
const next = groups.map((g, i) => {
|
|
361
|
+
if (i !== idx) return g;
|
|
362
|
+
const copy = { ...g };
|
|
363
|
+
delete copy[key];
|
|
364
|
+
return copy;
|
|
365
|
+
});
|
|
366
|
+
update(next);
|
|
367
|
+
};
|
|
368
|
+
const setParamValue = (idx, key, val) => {
|
|
369
|
+
const next = groups.map((g, i) => i === idx ? { ...g, [key]: val ?? null } : g);
|
|
370
|
+
update(next);
|
|
371
|
+
};
|
|
372
|
+
const allEmpty = groups.every((g) => Object.keys(g).length === 0);
|
|
373
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { name, error, required, hint, ref, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 3, children: [
|
|
374
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
375
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: intlLabel?.defaultMessage || "Trigger Params" }),
|
|
376
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: "Настройте параметры срабатывания для этого этапа" })
|
|
377
|
+
] }) }),
|
|
378
|
+
groups.length === 1 && allEmpty ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
379
|
+
designSystem.Box,
|
|
380
|
+
{
|
|
381
|
+
padding: 5,
|
|
382
|
+
background: "neutral100",
|
|
383
|
+
hasRadius: true,
|
|
384
|
+
style: {
|
|
385
|
+
border: `2px dashed ${colors.emptyBorder}`,
|
|
386
|
+
textAlign: "center"
|
|
387
|
+
},
|
|
388
|
+
children: [
|
|
389
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral500", children: "Параметры не настроены" }),
|
|
390
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
391
|
+
designSystem.Typography,
|
|
392
|
+
{
|
|
393
|
+
variant: "pi",
|
|
394
|
+
textColor: "neutral400",
|
|
395
|
+
style: { display: "block", marginTop: 4 },
|
|
396
|
+
children: "Добавьте параметры триггера, чтобы управлять условиями показа этапа"
|
|
397
|
+
}
|
|
398
|
+
)
|
|
399
|
+
]
|
|
400
|
+
}
|
|
401
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 0, children: groups.map((group, idx) => /* @__PURE__ */ jsxRuntime.jsxs(React__default.default.Fragment, { children: [
|
|
402
|
+
idx > 0 && /* @__PURE__ */ jsxRuntime.jsx(OrDivider, { colors }),
|
|
403
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
404
|
+
ParamGroupCard,
|
|
405
|
+
{
|
|
406
|
+
group,
|
|
407
|
+
groupIndex: idx,
|
|
408
|
+
totalGroups: groups.length,
|
|
409
|
+
onAddParam: (key) => addParamToGroup(idx, key),
|
|
410
|
+
onRemoveParam: (key) => removeParamFromGroup(idx, key),
|
|
411
|
+
onSetValue: (key, val) => setParamValue(idx, key, val),
|
|
412
|
+
onRemoveGroup: () => removeGroup(idx),
|
|
413
|
+
disabled,
|
|
414
|
+
colors
|
|
415
|
+
}
|
|
416
|
+
)
|
|
417
|
+
] }, idx)) }),
|
|
418
|
+
groups.length === 1 && allEmpty ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
419
|
+
AddParamSelect,
|
|
420
|
+
{
|
|
421
|
+
available: TRIGGER_PARAMS,
|
|
422
|
+
onAdd: (key) => addParamToGroup(0, key),
|
|
423
|
+
disabled
|
|
424
|
+
}
|
|
425
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
426
|
+
designSystem.Button,
|
|
427
|
+
{
|
|
428
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
429
|
+
onClick: addGroup,
|
|
430
|
+
disabled,
|
|
431
|
+
variant: "tertiary",
|
|
432
|
+
size: "S",
|
|
433
|
+
children: "Добавить OR группу"
|
|
434
|
+
}
|
|
435
|
+
),
|
|
436
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {}),
|
|
437
|
+
hint && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
438
|
+
] }) });
|
|
439
|
+
}
|
|
440
|
+
);
|
|
441
|
+
TriggerParamsField.displayName = "TriggerParamsField";
|
|
442
|
+
const AddParamSelect = ({ available, onAdd, disabled }) => {
|
|
443
|
+
const [selected, setSelected] = React.useState(null);
|
|
444
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "flex-end", children: [
|
|
445
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
446
|
+
designSystem.SingleSelect,
|
|
447
|
+
{
|
|
448
|
+
placeholder: "Выберите параметр...",
|
|
449
|
+
value: selected,
|
|
450
|
+
onChange: (val) => setSelected(val),
|
|
451
|
+
disabled,
|
|
452
|
+
size: "S",
|
|
453
|
+
children: available.map((p) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SingleSelectOption, { value: p.key, children: [
|
|
454
|
+
p.label,
|
|
455
|
+
" — ",
|
|
456
|
+
p.description
|
|
457
|
+
] }, p.key))
|
|
458
|
+
}
|
|
459
|
+
) }),
|
|
460
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
461
|
+
designSystem.Button,
|
|
462
|
+
{
|
|
463
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
464
|
+
onClick: () => {
|
|
465
|
+
if (selected) {
|
|
466
|
+
onAdd(selected);
|
|
467
|
+
setSelected(null);
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
disabled: disabled || !selected,
|
|
471
|
+
variant: "secondary",
|
|
472
|
+
size: "S",
|
|
473
|
+
children: "Добавить"
|
|
474
|
+
}
|
|
475
|
+
)
|
|
476
|
+
] });
|
|
477
|
+
};
|
|
478
|
+
exports.default = TriggerParamsField;
|
|
@@ -15,7 +15,9 @@ const ANALYTICS_EVENTS = {
|
|
|
15
15
|
{ value: "upgrade", label: "Upgrade Completed" },
|
|
16
16
|
{ value: "battle", label: "Battle Completed" },
|
|
17
17
|
{ value: "contract", label: "Contract Completed" },
|
|
18
|
-
{ value: "withdrawal", label: "Withdrawal Completed" }
|
|
18
|
+
{ value: "withdrawal", label: "Withdrawal Completed" },
|
|
19
|
+
{ value: "deposit_abandoned", label: "Deposit Abandoned" },
|
|
20
|
+
{ value: "balance_low", label: "Balance Low" }
|
|
19
21
|
],
|
|
20
22
|
Case: [
|
|
21
23
|
{ value: "gg-case-fav", label: "Case Favorite" },
|
|
@@ -154,7 +156,9 @@ const parseConfig = (value) => {
|
|
|
154
156
|
scheduleTime: parsed.scheduleTime || "12:00",
|
|
155
157
|
scheduleDays: Array.isArray(parsed.scheduleDays) ? parsed.scheduleDays : [1, 2, 3, 4, 5],
|
|
156
158
|
scheduleCron: parsed.scheduleCron || "0 12 * * *",
|
|
157
|
-
scheduleEveryMinutes: parsed.scheduleEveryMinutes ?? 5
|
|
159
|
+
scheduleEveryMinutes: parsed.scheduleEveryMinutes ?? 5,
|
|
160
|
+
depositAbandonedTimeoutMinutes: parsed.depositAbandonedTimeoutMinutes ?? 10,
|
|
161
|
+
balanceLowThreshold: parsed.balanceLowThreshold ?? 5
|
|
158
162
|
});
|
|
159
163
|
if (typeof value === "string") {
|
|
160
164
|
try {
|
|
@@ -465,6 +469,115 @@ const TriggerConfigField = React.forwardRef(
|
|
|
465
469
|
}
|
|
466
470
|
)
|
|
467
471
|
] }),
|
|
472
|
+
config.eventName === "deposit_abandoned" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
473
|
+
designSystem.Box,
|
|
474
|
+
{
|
|
475
|
+
padding: 4,
|
|
476
|
+
hasRadius: true,
|
|
477
|
+
style: {
|
|
478
|
+
background: colors.event.innerCard,
|
|
479
|
+
border: `1px solid ${colors.event.border}`
|
|
480
|
+
},
|
|
481
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, children: [
|
|
482
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
483
|
+
designSystem.Box,
|
|
484
|
+
{
|
|
485
|
+
style: {
|
|
486
|
+
width: 40,
|
|
487
|
+
height: 40,
|
|
488
|
+
borderRadius: 10,
|
|
489
|
+
background: "linear-gradient(135deg, #f97316 0%, #ea580c 100%)",
|
|
490
|
+
display: "flex",
|
|
491
|
+
alignItems: "center",
|
|
492
|
+
justifyContent: "center",
|
|
493
|
+
color: "#fff",
|
|
494
|
+
flexShrink: 0
|
|
495
|
+
},
|
|
496
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Clock, { width: 20, height: 20 })
|
|
497
|
+
}
|
|
498
|
+
),
|
|
499
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1 }, children: [
|
|
500
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
501
|
+
designSystem.Typography,
|
|
502
|
+
{
|
|
503
|
+
variant: "pi",
|
|
504
|
+
fontWeight: "bold",
|
|
505
|
+
textColor: "neutral700",
|
|
506
|
+
style: { marginBottom: 4, display: "block" },
|
|
507
|
+
children: "Таймаут незавершённого депозита"
|
|
508
|
+
}
|
|
509
|
+
),
|
|
510
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: "Через сколько минут считать депозит брошенным" })
|
|
511
|
+
] }),
|
|
512
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: 100 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
513
|
+
designSystem.NumberInput,
|
|
514
|
+
{
|
|
515
|
+
value: config.depositAbandonedTimeoutMinutes ?? 10,
|
|
516
|
+
onValueChange: (val) => handleUpdate({ depositAbandonedTimeoutMinutes: val ?? 10 }),
|
|
517
|
+
disabled,
|
|
518
|
+
step: 1,
|
|
519
|
+
min: 1,
|
|
520
|
+
max: 60
|
|
521
|
+
}
|
|
522
|
+
) }),
|
|
523
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: "мин" })
|
|
524
|
+
] })
|
|
525
|
+
}
|
|
526
|
+
),
|
|
527
|
+
config.eventName === "balance_low" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
528
|
+
designSystem.Box,
|
|
529
|
+
{
|
|
530
|
+
padding: 4,
|
|
531
|
+
hasRadius: true,
|
|
532
|
+
style: {
|
|
533
|
+
background: colors.event.innerCard,
|
|
534
|
+
border: `1px solid ${colors.event.border}`
|
|
535
|
+
},
|
|
536
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, children: [
|
|
537
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
538
|
+
designSystem.Box,
|
|
539
|
+
{
|
|
540
|
+
style: {
|
|
541
|
+
width: 40,
|
|
542
|
+
height: 40,
|
|
543
|
+
borderRadius: 10,
|
|
544
|
+
background: "linear-gradient(135deg, #ef4444 0%, #dc2626 100%)",
|
|
545
|
+
display: "flex",
|
|
546
|
+
alignItems: "center",
|
|
547
|
+
justifyContent: "center",
|
|
548
|
+
color: "#fff",
|
|
549
|
+
flexShrink: 0
|
|
550
|
+
},
|
|
551
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Clock, { width: 20, height: 20 })
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1 }, children: [
|
|
555
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
556
|
+
designSystem.Typography,
|
|
557
|
+
{
|
|
558
|
+
variant: "pi",
|
|
559
|
+
fontWeight: "bold",
|
|
560
|
+
textColor: "neutral700",
|
|
561
|
+
style: { marginBottom: 4, display: "block" },
|
|
562
|
+
children: "Порог баланса"
|
|
563
|
+
}
|
|
564
|
+
),
|
|
565
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: "Событие сработает когда баланс упадёт ниже этой суммы" })
|
|
566
|
+
] }),
|
|
567
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: 100 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
568
|
+
designSystem.NumberInput,
|
|
569
|
+
{
|
|
570
|
+
value: config.balanceLowThreshold ?? 5,
|
|
571
|
+
onValueChange: (val) => handleUpdate({ balanceLowThreshold: val ?? 5 }),
|
|
572
|
+
disabled,
|
|
573
|
+
step: 0.5,
|
|
574
|
+
min: 0
|
|
575
|
+
}
|
|
576
|
+
) }),
|
|
577
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: "$" })
|
|
578
|
+
] })
|
|
579
|
+
}
|
|
580
|
+
),
|
|
468
581
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
469
582
|
designSystem.Box,
|
|
470
583
|
{
|