@inspirer-dev/crm-dashboard 1.0.10 → 1.0.11

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.
@@ -0,0 +1,253 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useState, useEffect } from "react";
3
+ import { Field, Flex, Box, Typography, Card, CardContent, TextInput, SingleSelect, SingleSelectOption } from "@strapi/design-system";
4
+ const DEFAULT_CONFIG = {
5
+ type: "event_based",
6
+ eventName: "",
7
+ delayValue: 10,
8
+ delayUnit: "minutes",
9
+ scheduleType: "daily",
10
+ scheduleTime: "12:00",
11
+ scheduleDays: [1, 2, 3, 4, 5],
12
+ scheduleCron: "0 12 * * *"
13
+ };
14
+ const WEEKDAYS = [
15
+ { value: 0, label: "Sun" },
16
+ { value: 1, label: "Mon" },
17
+ { value: 2, label: "Tue" },
18
+ { value: 3, label: "Wed" },
19
+ { value: 4, label: "Thu" },
20
+ { value: 5, label: "Fri" },
21
+ { value: 6, label: "Sat" }
22
+ ];
23
+ const parseConfig = (value) => {
24
+ if (!value) return DEFAULT_CONFIG;
25
+ try {
26
+ const parsed = JSON.parse(value);
27
+ return {
28
+ type: parsed.type || "event_based",
29
+ eventName: parsed.eventName || "",
30
+ delayValue: parsed.delayValue ?? 10,
31
+ delayUnit: parsed.delayUnit || "minutes",
32
+ scheduleType: parsed.scheduleType || "daily",
33
+ scheduleTime: parsed.scheduleTime || "12:00",
34
+ scheduleDays: parsed.scheduleDays || [1, 2, 3, 4, 5],
35
+ scheduleCron: parsed.scheduleCron || "0 12 * * *"
36
+ };
37
+ } catch {
38
+ return DEFAULT_CONFIG;
39
+ }
40
+ };
41
+ const serializeConfig = (config) => {
42
+ return JSON.stringify(config);
43
+ };
44
+ const TriggerConfigField = forwardRef(
45
+ ({ name, value, onChange, intlLabel, disabled, error, required, hint }, ref) => {
46
+ const [config, setConfig] = useState(() => parseConfig(value));
47
+ useEffect(() => {
48
+ const parsed = parseConfig(value);
49
+ setConfig(parsed);
50
+ }, [value]);
51
+ const handleUpdate = (updates) => {
52
+ const newConfig = { ...config, ...updates };
53
+ setConfig(newConfig);
54
+ onChange({
55
+ target: {
56
+ name,
57
+ value: serializeConfig(newConfig)
58
+ }
59
+ });
60
+ };
61
+ const toggleDay = (day) => {
62
+ const days = config.scheduleDays || [];
63
+ const newDays = days.includes(day) ? days.filter((d) => d !== day) : [...days, day].sort((a, b) => a - b);
64
+ handleUpdate({ scheduleDays: newDays });
65
+ };
66
+ const isEventBased = config.type === "event_based";
67
+ const isDbBased = config.type === "db_based";
68
+ return /* @__PURE__ */ jsx(Field.Root, { name, error, required, hint, ref, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 3, children: [
69
+ /* @__PURE__ */ jsx(Field.Label, { children: intlLabel?.defaultMessage || "Trigger Configuration" }),
70
+ /* @__PURE__ */ jsxs(Box, { children: [
71
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", style: { marginBottom: "8px", display: "block" }, children: "Campaign Type" }),
72
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
73
+ /* @__PURE__ */ jsxs(
74
+ Box,
75
+ {
76
+ padding: 3,
77
+ background: isEventBased ? "primary100" : "neutral100",
78
+ hasRadius: true,
79
+ style: {
80
+ cursor: disabled ? "not-allowed" : "pointer",
81
+ border: `2px solid ${isEventBased ? "#4945ff" : "#dcdce4"}`,
82
+ flex: 1,
83
+ textAlign: "center"
84
+ },
85
+ onClick: () => !disabled && handleUpdate({ type: "event_based" }),
86
+ children: [
87
+ /* @__PURE__ */ jsx(
88
+ Typography,
89
+ {
90
+ variant: "omega",
91
+ fontWeight: isEventBased ? "bold" : "regular",
92
+ textColor: isEventBased ? "primary600" : "neutral600",
93
+ children: "Event-Based"
94
+ }
95
+ ),
96
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral500", children: "Fires on user action" })
97
+ ]
98
+ }
99
+ ),
100
+ /* @__PURE__ */ jsxs(
101
+ Box,
102
+ {
103
+ padding: 3,
104
+ background: isDbBased ? "primary100" : "neutral100",
105
+ hasRadius: true,
106
+ style: {
107
+ cursor: disabled ? "not-allowed" : "pointer",
108
+ border: `2px solid ${isDbBased ? "#4945ff" : "#dcdce4"}`,
109
+ flex: 1,
110
+ textAlign: "center"
111
+ },
112
+ onClick: () => !disabled && handleUpdate({ type: "db_based" }),
113
+ children: [
114
+ /* @__PURE__ */ jsx(
115
+ Typography,
116
+ {
117
+ variant: "omega",
118
+ fontWeight: isDbBased ? "bold" : "regular",
119
+ textColor: isDbBased ? "primary600" : "neutral600",
120
+ children: "DB-Based (Scheduled)"
121
+ }
122
+ ),
123
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral500", children: "Runs on schedule" })
124
+ ]
125
+ }
126
+ )
127
+ ] })
128
+ ] }),
129
+ isEventBased && /* @__PURE__ */ jsx(Card, { background: "neutral100", children: /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 4, padding: 4, children: [
130
+ /* @__PURE__ */ jsx(Typography, { variant: "delta", children: "Event Configuration" }),
131
+ /* @__PURE__ */ jsxs(Field.Root, { name: `${name}-eventName`, children: [
132
+ /* @__PURE__ */ jsx(Field.Label, { children: "Event Name" }),
133
+ /* @__PURE__ */ jsx(
134
+ TextInput,
135
+ {
136
+ placeholder: "e.g., gg-case-deposit",
137
+ value: config.eventName || "",
138
+ onChange: (e) => handleUpdate({ eventName: e.target.value }),
139
+ disabled
140
+ }
141
+ ),
142
+ /* @__PURE__ */ jsx(Field.Hint, { children: "The event that triggers this campaign (e.g., gg-case-deposit, gg-deposit-suggestion-selected)" })
143
+ ] }),
144
+ /* @__PURE__ */ jsxs(Box, { children: [
145
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral800", style: { marginBottom: "8px", display: "block" }, children: "Delay Before Sending" }),
146
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "flex-start", children: [
147
+ /* @__PURE__ */ jsx(Box, { style: { width: "120px" }, children: /* @__PURE__ */ jsx(
148
+ TextInput,
149
+ {
150
+ type: "number",
151
+ value: String(config.delayValue || 0),
152
+ onChange: (e) => handleUpdate({ delayValue: parseInt(e.target.value, 10) || 0 }),
153
+ disabled,
154
+ "aria-label": "Delay value"
155
+ }
156
+ ) }),
157
+ /* @__PURE__ */ jsx(Box, { style: { width: "150px" }, children: /* @__PURE__ */ jsxs(
158
+ SingleSelect,
159
+ {
160
+ value: config.delayUnit || "minutes",
161
+ onChange: (val) => handleUpdate({ delayUnit: val }),
162
+ disabled,
163
+ children: [
164
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "seconds", children: "seconds" }),
165
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "minutes", children: "minutes" }),
166
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "hours", children: "hours" })
167
+ ]
168
+ }
169
+ ) })
170
+ ] }),
171
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral500", style: { marginTop: "4px" }, children: "Wait this long after the event before checking segment rules and sending" })
172
+ ] })
173
+ ] }) }) }),
174
+ isDbBased && /* @__PURE__ */ jsx(Card, { background: "neutral100", children: /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 4, padding: 4, children: [
175
+ /* @__PURE__ */ jsx(Typography, { variant: "delta", children: "Schedule Configuration" }),
176
+ /* @__PURE__ */ jsxs(Field.Root, { name: `${name}-scheduleType`, children: [
177
+ /* @__PURE__ */ jsx(Field.Label, { children: "Schedule Type" }),
178
+ /* @__PURE__ */ jsxs(
179
+ SingleSelect,
180
+ {
181
+ value: config.scheduleType || "daily",
182
+ onChange: (val) => handleUpdate({ scheduleType: val }),
183
+ disabled,
184
+ children: [
185
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "daily", children: "Daily" }),
186
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "weekly", children: "Weekly" }),
187
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "cron", children: "Custom (Cron)" })
188
+ ]
189
+ }
190
+ )
191
+ ] }),
192
+ (config.scheduleType === "daily" || config.scheduleType === "weekly") && /* @__PURE__ */ jsxs(Field.Root, { name: `${name}-scheduleTime`, children: [
193
+ /* @__PURE__ */ jsx(Field.Label, { children: "Time of Day (UTC)" }),
194
+ /* @__PURE__ */ jsx(
195
+ TextInput,
196
+ {
197
+ type: "time",
198
+ value: config.scheduleTime || "12:00",
199
+ onChange: (e) => handleUpdate({ scheduleTime: e.target.value }),
200
+ disabled
201
+ }
202
+ )
203
+ ] }),
204
+ config.scheduleType === "weekly" && /* @__PURE__ */ jsxs(Box, { children: [
205
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral800", style: { marginBottom: "8px", display: "block" }, children: "Days of Week" }),
206
+ /* @__PURE__ */ jsx(Flex, { gap: 2, wrap: "wrap", children: WEEKDAYS.map((day) => /* @__PURE__ */ jsx(
207
+ Box,
208
+ {
209
+ padding: 2,
210
+ background: (config.scheduleDays || []).includes(day.value) ? "primary100" : "neutral100",
211
+ hasRadius: true,
212
+ style: {
213
+ cursor: disabled ? "not-allowed" : "pointer",
214
+ border: `1px solid ${(config.scheduleDays || []).includes(day.value) ? "#4945ff" : "#dcdce4"}`,
215
+ minWidth: "50px",
216
+ textAlign: "center"
217
+ },
218
+ onClick: () => !disabled && toggleDay(day.value),
219
+ children: /* @__PURE__ */ jsx(
220
+ Typography,
221
+ {
222
+ variant: "omega",
223
+ textColor: (config.scheduleDays || []).includes(day.value) ? "primary600" : "neutral600",
224
+ children: day.label
225
+ }
226
+ )
227
+ },
228
+ day.value
229
+ )) })
230
+ ] }),
231
+ config.scheduleType === "cron" && /* @__PURE__ */ jsxs(Field.Root, { name: `${name}-scheduleCron`, children: [
232
+ /* @__PURE__ */ jsx(Field.Label, { children: "Cron Expression" }),
233
+ /* @__PURE__ */ jsx(
234
+ TextInput,
235
+ {
236
+ placeholder: "0 12 * * *",
237
+ value: config.scheduleCron || "",
238
+ onChange: (e) => handleUpdate({ scheduleCron: e.target.value }),
239
+ disabled
240
+ }
241
+ ),
242
+ /* @__PURE__ */ jsx(Field.Hint, { children: 'Standard cron format: minute hour day month weekday (e.g., "0 12 * * *" = daily at 12:00 UTC)' })
243
+ ] })
244
+ ] }) }) }),
245
+ error && /* @__PURE__ */ jsx(Field.Error, { children: error }),
246
+ hint && /* @__PURE__ */ jsx(Field.Hint, { children: hint })
247
+ ] }) });
248
+ }
249
+ );
250
+ TriggerConfigField.displayName = "TriggerConfigField";
251
+ export {
252
+ TriggerConfigField as default
253
+ };
@@ -0,0 +1,253 @@
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 DEFAULT_CONFIG = {
7
+ type: "event_based",
8
+ eventName: "",
9
+ delayValue: 10,
10
+ delayUnit: "minutes",
11
+ scheduleType: "daily",
12
+ scheduleTime: "12:00",
13
+ scheduleDays: [1, 2, 3, 4, 5],
14
+ scheduleCron: "0 12 * * *"
15
+ };
16
+ const WEEKDAYS = [
17
+ { value: 0, label: "Sun" },
18
+ { value: 1, label: "Mon" },
19
+ { value: 2, label: "Tue" },
20
+ { value: 3, label: "Wed" },
21
+ { value: 4, label: "Thu" },
22
+ { value: 5, label: "Fri" },
23
+ { value: 6, label: "Sat" }
24
+ ];
25
+ const parseConfig = (value) => {
26
+ if (!value) return DEFAULT_CONFIG;
27
+ try {
28
+ const parsed = JSON.parse(value);
29
+ return {
30
+ type: parsed.type || "event_based",
31
+ eventName: parsed.eventName || "",
32
+ delayValue: parsed.delayValue ?? 10,
33
+ delayUnit: parsed.delayUnit || "minutes",
34
+ scheduleType: parsed.scheduleType || "daily",
35
+ scheduleTime: parsed.scheduleTime || "12:00",
36
+ scheduleDays: parsed.scheduleDays || [1, 2, 3, 4, 5],
37
+ scheduleCron: parsed.scheduleCron || "0 12 * * *"
38
+ };
39
+ } catch {
40
+ return DEFAULT_CONFIG;
41
+ }
42
+ };
43
+ const serializeConfig = (config) => {
44
+ return JSON.stringify(config);
45
+ };
46
+ const TriggerConfigField = React.forwardRef(
47
+ ({ name, value, onChange, intlLabel, disabled, error, required, hint }, ref) => {
48
+ const [config, setConfig] = React.useState(() => parseConfig(value));
49
+ React.useEffect(() => {
50
+ const parsed = parseConfig(value);
51
+ setConfig(parsed);
52
+ }, [value]);
53
+ const handleUpdate = (updates) => {
54
+ const newConfig = { ...config, ...updates };
55
+ setConfig(newConfig);
56
+ onChange({
57
+ target: {
58
+ name,
59
+ value: serializeConfig(newConfig)
60
+ }
61
+ });
62
+ };
63
+ const toggleDay = (day) => {
64
+ const days = config.scheduleDays || [];
65
+ const newDays = days.includes(day) ? days.filter((d) => d !== day) : [...days, day].sort((a, b) => a - b);
66
+ handleUpdate({ scheduleDays: newDays });
67
+ };
68
+ const isEventBased = config.type === "event_based";
69
+ const isDbBased = config.type === "db_based";
70
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { name, error, required, hint, ref, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 3, children: [
71
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: intlLabel?.defaultMessage || "Trigger Configuration" }),
72
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
73
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { marginBottom: "8px", display: "block" }, children: "Campaign Type" }),
74
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
75
+ /* @__PURE__ */ jsxRuntime.jsxs(
76
+ designSystem.Box,
77
+ {
78
+ padding: 3,
79
+ background: isEventBased ? "primary100" : "neutral100",
80
+ hasRadius: true,
81
+ style: {
82
+ cursor: disabled ? "not-allowed" : "pointer",
83
+ border: `2px solid ${isEventBased ? "#4945ff" : "#dcdce4"}`,
84
+ flex: 1,
85
+ textAlign: "center"
86
+ },
87
+ onClick: () => !disabled && handleUpdate({ type: "event_based" }),
88
+ children: [
89
+ /* @__PURE__ */ jsxRuntime.jsx(
90
+ designSystem.Typography,
91
+ {
92
+ variant: "omega",
93
+ fontWeight: isEventBased ? "bold" : "regular",
94
+ textColor: isEventBased ? "primary600" : "neutral600",
95
+ children: "Event-Based"
96
+ }
97
+ ),
98
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: "Fires on user action" })
99
+ ]
100
+ }
101
+ ),
102
+ /* @__PURE__ */ jsxRuntime.jsxs(
103
+ designSystem.Box,
104
+ {
105
+ padding: 3,
106
+ background: isDbBased ? "primary100" : "neutral100",
107
+ hasRadius: true,
108
+ style: {
109
+ cursor: disabled ? "not-allowed" : "pointer",
110
+ border: `2px solid ${isDbBased ? "#4945ff" : "#dcdce4"}`,
111
+ flex: 1,
112
+ textAlign: "center"
113
+ },
114
+ onClick: () => !disabled && handleUpdate({ type: "db_based" }),
115
+ children: [
116
+ /* @__PURE__ */ jsxRuntime.jsx(
117
+ designSystem.Typography,
118
+ {
119
+ variant: "omega",
120
+ fontWeight: isDbBased ? "bold" : "regular",
121
+ textColor: isDbBased ? "primary600" : "neutral600",
122
+ children: "DB-Based (Scheduled)"
123
+ }
124
+ ),
125
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: "Runs on schedule" })
126
+ ]
127
+ }
128
+ )
129
+ ] })
130
+ ] }),
131
+ isEventBased && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardContent, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 4, padding: 4, children: [
132
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", children: "Event Configuration" }),
133
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: `${name}-eventName`, children: [
134
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Event Name" }),
135
+ /* @__PURE__ */ jsxRuntime.jsx(
136
+ designSystem.TextInput,
137
+ {
138
+ placeholder: "e.g., gg-case-deposit",
139
+ value: config.eventName || "",
140
+ onChange: (e) => handleUpdate({ eventName: e.target.value }),
141
+ disabled
142
+ }
143
+ ),
144
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, { children: "The event that triggers this campaign (e.g., gg-case-deposit, gg-deposit-suggestion-selected)" })
145
+ ] }),
146
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
147
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral800", style: { marginBottom: "8px", display: "block" }, children: "Delay Before Sending" }),
148
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "flex-start", children: [
149
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "120px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
150
+ designSystem.TextInput,
151
+ {
152
+ type: "number",
153
+ value: String(config.delayValue || 0),
154
+ onChange: (e) => handleUpdate({ delayValue: parseInt(e.target.value, 10) || 0 }),
155
+ disabled,
156
+ "aria-label": "Delay value"
157
+ }
158
+ ) }),
159
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: "150px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
160
+ designSystem.SingleSelect,
161
+ {
162
+ value: config.delayUnit || "minutes",
163
+ onChange: (val) => handleUpdate({ delayUnit: val }),
164
+ disabled,
165
+ children: [
166
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "seconds", children: "seconds" }),
167
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "minutes", children: "minutes" }),
168
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "hours", children: "hours" })
169
+ ]
170
+ }
171
+ ) })
172
+ ] }),
173
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", style: { marginTop: "4px" }, children: "Wait this long after the event before checking segment rules and sending" })
174
+ ] })
175
+ ] }) }) }),
176
+ isDbBased && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardContent, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 4, padding: 4, children: [
177
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", children: "Schedule Configuration" }),
178
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: `${name}-scheduleType`, children: [
179
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Schedule Type" }),
180
+ /* @__PURE__ */ jsxRuntime.jsxs(
181
+ designSystem.SingleSelect,
182
+ {
183
+ value: config.scheduleType || "daily",
184
+ onChange: (val) => handleUpdate({ scheduleType: val }),
185
+ disabled,
186
+ children: [
187
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "daily", children: "Daily" }),
188
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "weekly", children: "Weekly" }),
189
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "cron", children: "Custom (Cron)" })
190
+ ]
191
+ }
192
+ )
193
+ ] }),
194
+ (config.scheduleType === "daily" || config.scheduleType === "weekly") && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: `${name}-scheduleTime`, children: [
195
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Time of Day (UTC)" }),
196
+ /* @__PURE__ */ jsxRuntime.jsx(
197
+ designSystem.TextInput,
198
+ {
199
+ type: "time",
200
+ value: config.scheduleTime || "12:00",
201
+ onChange: (e) => handleUpdate({ scheduleTime: e.target.value }),
202
+ disabled
203
+ }
204
+ )
205
+ ] }),
206
+ config.scheduleType === "weekly" && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
207
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral800", style: { marginBottom: "8px", display: "block" }, children: "Days of Week" }),
208
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, wrap: "wrap", children: WEEKDAYS.map((day) => /* @__PURE__ */ jsxRuntime.jsx(
209
+ designSystem.Box,
210
+ {
211
+ padding: 2,
212
+ background: (config.scheduleDays || []).includes(day.value) ? "primary100" : "neutral100",
213
+ hasRadius: true,
214
+ style: {
215
+ cursor: disabled ? "not-allowed" : "pointer",
216
+ border: `1px solid ${(config.scheduleDays || []).includes(day.value) ? "#4945ff" : "#dcdce4"}`,
217
+ minWidth: "50px",
218
+ textAlign: "center"
219
+ },
220
+ onClick: () => !disabled && toggleDay(day.value),
221
+ children: /* @__PURE__ */ jsxRuntime.jsx(
222
+ designSystem.Typography,
223
+ {
224
+ variant: "omega",
225
+ textColor: (config.scheduleDays || []).includes(day.value) ? "primary600" : "neutral600",
226
+ children: day.label
227
+ }
228
+ )
229
+ },
230
+ day.value
231
+ )) })
232
+ ] }),
233
+ config.scheduleType === "cron" && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: `${name}-scheduleCron`, children: [
234
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Cron Expression" }),
235
+ /* @__PURE__ */ jsxRuntime.jsx(
236
+ designSystem.TextInput,
237
+ {
238
+ placeholder: "0 12 * * *",
239
+ value: config.scheduleCron || "",
240
+ onChange: (e) => handleUpdate({ scheduleCron: e.target.value }),
241
+ disabled
242
+ }
243
+ ),
244
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, { children: 'Standard cron format: minute hour day month weekday (e.g., "0 12 * * *" = daily at 12:00 UTC)' })
245
+ ] })
246
+ ] }) }) }),
247
+ error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, { children: error }),
248
+ hint && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, { children: hint })
249
+ ] }) });
250
+ }
251
+ );
252
+ TriggerConfigField.displayName = "TriggerConfigField";
253
+ exports.default = TriggerConfigField;
@@ -22,7 +22,6 @@ const index = {
22
22
  app.customFields.register({
23
23
  name: "rules",
24
24
  pluginId: PLUGIN_ID,
25
- plugin: PLUGIN_ID,
26
25
  type: "json",
27
26
  intlLabel: {
28
27
  id: `${PLUGIN_ID}.rules.label`,
@@ -44,6 +43,54 @@ const index = {
44
43
  advanced: []
45
44
  }
46
45
  });
46
+ app.customFields.register({
47
+ name: "trigger-config",
48
+ pluginId: PLUGIN_ID,
49
+ type: "json",
50
+ intlLabel: {
51
+ id: `${PLUGIN_ID}.trigger-config.label`,
52
+ defaultMessage: "Trigger Configuration"
53
+ },
54
+ intlDescription: {
55
+ id: `${PLUGIN_ID}.trigger-config.description`,
56
+ defaultMessage: "Configure segment type (scheduled or event-triggered) and trigger settings"
57
+ },
58
+ icon: icons.Clock,
59
+ components: {
60
+ Input: async () => Promise.resolve().then(() => require(
61
+ /* webpackChunkName: "crm-trigger-config" */
62
+ "../_chunks/index-DRJ5o0cz.js"
63
+ ))
64
+ },
65
+ options: {
66
+ base: [],
67
+ advanced: []
68
+ }
69
+ });
70
+ app.customFields.register({
71
+ name: "cancel-conditions",
72
+ pluginId: PLUGIN_ID,
73
+ type: "json",
74
+ intlLabel: {
75
+ id: `${PLUGIN_ID}.cancel-conditions.label`,
76
+ defaultMessage: "Cancel Conditions"
77
+ },
78
+ intlDescription: {
79
+ id: `${PLUGIN_ID}.cancel-conditions.description`,
80
+ defaultMessage: "Conditions that will cancel sending (checked right before send)"
81
+ },
82
+ icon: icons.Cross,
83
+ components: {
84
+ Input: async () => Promise.resolve().then(() => require(
85
+ /* webpackChunkName: "crm-cancel-conditions" */
86
+ "../_chunks/index-Cf8DZYT6.js"
87
+ ))
88
+ },
89
+ options: {
90
+ base: [],
91
+ advanced: []
92
+ }
93
+ });
47
94
  app.addMenuLink({
48
95
  to: `/plugins/${PLUGIN_ID}`,
49
96
  icon: icons.Message,
@@ -1,4 +1,4 @@
1
- import { Message } from "@strapi/icons";
1
+ import { Message, Clock, Cross } from "@strapi/icons";
2
2
  const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
3
3
  const v = glob[path];
4
4
  if (v) {
@@ -21,7 +21,6 @@ const index = {
21
21
  app.customFields.register({
22
22
  name: "rules",
23
23
  pluginId: PLUGIN_ID,
24
- plugin: PLUGIN_ID,
25
24
  type: "json",
26
25
  intlLabel: {
27
26
  id: `${PLUGIN_ID}.rules.label`,
@@ -43,6 +42,54 @@ const index = {
43
42
  advanced: []
44
43
  }
45
44
  });
45
+ app.customFields.register({
46
+ name: "trigger-config",
47
+ pluginId: PLUGIN_ID,
48
+ type: "json",
49
+ intlLabel: {
50
+ id: `${PLUGIN_ID}.trigger-config.label`,
51
+ defaultMessage: "Trigger Configuration"
52
+ },
53
+ intlDescription: {
54
+ id: `${PLUGIN_ID}.trigger-config.description`,
55
+ defaultMessage: "Configure segment type (scheduled or event-triggered) and trigger settings"
56
+ },
57
+ icon: Clock,
58
+ components: {
59
+ Input: async () => import(
60
+ /* webpackChunkName: "crm-trigger-config" */
61
+ "../_chunks/index-DFqEb9sm.mjs"
62
+ )
63
+ },
64
+ options: {
65
+ base: [],
66
+ advanced: []
67
+ }
68
+ });
69
+ app.customFields.register({
70
+ name: "cancel-conditions",
71
+ pluginId: PLUGIN_ID,
72
+ type: "json",
73
+ intlLabel: {
74
+ id: `${PLUGIN_ID}.cancel-conditions.label`,
75
+ defaultMessage: "Cancel Conditions"
76
+ },
77
+ intlDescription: {
78
+ id: `${PLUGIN_ID}.cancel-conditions.description`,
79
+ defaultMessage: "Conditions that will cancel sending (checked right before send)"
80
+ },
81
+ icon: Cross,
82
+ components: {
83
+ Input: async () => import(
84
+ /* webpackChunkName: "crm-cancel-conditions" */
85
+ "../_chunks/index-Bnjm_sYk.mjs"
86
+ )
87
+ },
88
+ options: {
89
+ base: [],
90
+ advanced: []
91
+ }
92
+ });
46
93
  app.addMenuLink({
47
94
  to: `/plugins/${PLUGIN_ID}`,
48
95
  icon: Message,
@@ -5,6 +5,16 @@ const register = ({ strapi: strapi2 }) => {
5
5
  plugin: "crm-dashboard",
6
6
  type: "json"
7
7
  });
8
+ strapi2.customFields.register({
9
+ name: "trigger-config",
10
+ plugin: "crm-dashboard",
11
+ type: "json"
12
+ });
13
+ strapi2.customFields.register({
14
+ name: "cancel-conditions",
15
+ plugin: "crm-dashboard",
16
+ type: "json"
17
+ });
8
18
  };
9
19
  const bootstrap = ({ strapi: strapi2 }) => {
10
20
  };
@@ -4,6 +4,16 @@ const register = ({ strapi: strapi2 }) => {
4
4
  plugin: "crm-dashboard",
5
5
  type: "json"
6
6
  });
7
+ strapi2.customFields.register({
8
+ name: "trigger-config",
9
+ plugin: "crm-dashboard",
10
+ type: "json"
11
+ });
12
+ strapi2.customFields.register({
13
+ name: "cancel-conditions",
14
+ plugin: "crm-dashboard",
15
+ type: "json"
16
+ });
7
17
  };
8
18
  const bootstrap = ({ strapi: strapi2 }) => {
9
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inspirer-dev/crm-dashboard",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "CRM Dashboard and Tools",
5
5
  "strapi": {
6
6
  "name": "crm-dashboard",