@carlonicora/nextjs-jsonapi 6.15.0 → 6.17.0
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/{BlockNoteEditor-UIAX72XW.js → BlockNoteEditor-FAUTV5FW.js} +20 -20
- package/dist/{BlockNoteEditor-UIAX72XW.js.map → BlockNoteEditor-FAUTV5FW.js.map} +1 -1
- package/dist/{BlockNoteEditor-I3J6YYXK.mjs → BlockNoteEditor-IGUHTERQ.mjs} +5 -5
- package/dist/{BlockNoteViewer-HIUAJQRI.mjs → BlockNoteViewer-X4UEVI2A.mjs} +3 -3
- package/dist/{BlockNoteViewer-APBOPT4B.js → BlockNoteViewer-XYKFY77F.js} +4 -4
- package/dist/{BlockNoteViewer-APBOPT4B.js.map → BlockNoteViewer-XYKFY77F.js.map} +1 -1
- package/dist/EmailPurpose-DOsSqM5K.d.mts +3 -0
- package/dist/EmailPurpose-DOsSqM5K.d.ts +3 -0
- package/dist/billing/index.js +492 -492
- package/dist/billing/index.mjs +4 -4
- package/dist/{chunk-RT7XFGIN.js → chunk-4OCBNCKH.js} +1041 -999
- package/dist/chunk-4OCBNCKH.js.map +1 -0
- package/dist/{chunk-4XLDBOSE.js → chunk-A7Y5YW7Q.js} +1 -1
- package/dist/{chunk-4XLDBOSE.js.map → chunk-A7Y5YW7Q.js.map} +1 -1
- package/dist/{chunk-ZYSNJKOP.js → chunk-DFA566KY.js} +4 -4
- package/dist/{chunk-ZYSNJKOP.js.map → chunk-DFA566KY.js.map} +1 -1
- package/dist/{chunk-DJXSCARG.js → chunk-I5BQLY7V.js} +9 -9
- package/dist/{chunk-DJXSCARG.js.map → chunk-I5BQLY7V.js.map} +1 -1
- package/dist/{chunk-RFKSJIQB.mjs → chunk-KMPBSOFB.mjs} +138 -5
- package/dist/chunk-KMPBSOFB.mjs.map +1 -0
- package/dist/{chunk-UOTHRJD2.mjs → chunk-OKBJEIOP.mjs} +1 -1
- package/dist/chunk-OKBJEIOP.mjs.map +1 -0
- package/dist/{chunk-PMESKNKL.js → chunk-OO2DBP6L.js} +1106 -973
- package/dist/chunk-OO2DBP6L.js.map +1 -0
- package/dist/{chunk-RYY7USSW.mjs → chunk-RINMQQZH.mjs} +56 -14
- package/dist/{chunk-RYY7USSW.mjs.map → chunk-RINMQQZH.mjs.map} +1 -1
- package/dist/{chunk-HAW5PNJG.mjs → chunk-TY5YWBLL.mjs} +3 -3
- package/dist/{chunk-OUEYZOLB.mjs → chunk-YVKWACDP.mjs} +2 -2
- package/dist/client/index.js +5 -5
- package/dist/client/index.mjs +4 -4
- package/dist/components/index.d.mts +10 -3
- package/dist/components/index.d.ts +10 -3
- package/dist/components/index.js +5 -5
- package/dist/components/index.mjs +4 -4
- package/dist/contexts/index.js +5 -5
- package/dist/contexts/index.mjs +4 -4
- package/dist/core/index.d.mts +92 -7
- package/dist/core/index.d.ts +92 -7
- package/dist/core/index.js +7 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +6 -2
- package/dist/{email-automation-enrollment.fields-BZvF14qx.d.mts → email-automation-enrollment.fields-CPsgxLif.d.mts} +11 -1
- package/dist/{email-automation-enrollment.fields-Cp3VMzFq.d.ts → email-automation-enrollment.fields-CVicSamF.d.ts} +11 -1
- package/dist/email-automations/index.d.mts +19 -5
- package/dist/email-automations/index.d.ts +19 -5
- package/dist/email-automations/index.js +356 -129
- package/dist/email-automations/index.js.map +1 -1
- package/dist/email-automations/index.mjs +306 -79
- package/dist/email-automations/index.mjs.map +1 -1
- package/dist/features/analytics/index.js +121 -121
- package/dist/features/analytics/index.mjs +4 -4
- package/dist/features/analytics/server.js +5 -5
- package/dist/features/analytics/server.mjs +3 -3
- package/dist/features/blog/index.js +151 -151
- package/dist/features/blog/index.mjs +4 -4
- package/dist/features/blog/server.js +17 -17
- package/dist/features/blog/server.mjs +2 -2
- package/dist/features/help/index.js +38 -38
- package/dist/features/help/index.mjs +4 -4
- package/dist/features/tokenusage/index.js +127 -127
- package/dist/features/tokenusage/index.mjs +4 -4
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/offline/index.js +14 -14
- package/dist/offline/index.mjs +1 -1
- package/dist/{referral-admin.interface-RVO-ZTJz.d.mts → referral-admin.interface-DTj4LzXx.d.mts} +3 -0
- package/dist/{referral-admin.interface-CnytdDaQ.d.ts → referral-admin.interface-DeSCw3Pp.d.ts} +3 -0
- package/dist/server/index.js +4 -4
- package/dist/server/index.mjs +3 -3
- package/messages/en.json +35 -3
- package/messages/it.json +35 -3
- package/package.json +1 -1
- package/src/core/index.ts +1 -0
- package/src/core/registry/ModuleRegistry.ts +1 -0
- package/src/features/email-automation/EmailAutomationCandidateModule.ts +12 -0
- package/src/features/email-automation/EmailAutomationModule.ts +1 -0
- package/src/features/email-automation/components/__tests__/EmailAutomationEditor.spec.tsx +74 -9
- package/src/features/email-automation/components/forms/EmailAutomationAddPersonDialog.tsx +226 -0
- package/src/features/email-automation/components/forms/EmailAutomationEditor.tsx +23 -0
- package/src/features/email-automation/components/forms/EmailStepEditor.tsx +7 -3
- package/src/features/email-automation/components/index.ts +1 -0
- package/src/features/email-automation/components/lists/EmailAutomationRecipientsList.tsx +38 -20
- package/src/features/email-automation/components/lists/EmailAutomationsList.tsx +1 -0
- package/src/features/email-automation/components/unsubscribe/EmailUnsubscribe.tsx +9 -4
- package/src/features/email-automation/data/EmailAutomation.ts +9 -0
- package/src/features/email-automation/data/EmailAutomationCandidate.ts +66 -0
- package/src/features/email-automation/data/EmailAutomationCandidateInterface.ts +19 -0
- package/src/features/email-automation/data/EmailAutomationEnrollment.ts +16 -2
- package/src/features/email-automation/data/EmailAutomationEnrollmentInterface.ts +7 -0
- package/src/features/email-automation/data/EmailAutomationInterface.ts +3 -0
- package/src/features/email-automation/data/EmailAutomationService.ts +53 -1
- package/src/features/email-automation/data/EmailPurpose.ts +1 -0
- package/src/features/email-automation/data/__tests__/email-automation-models.spec.ts +70 -0
- package/src/features/email-automation/data/email-automation.fields.ts +1 -0
- package/src/features/email-automation/data/index.ts +2 -0
- package/src/features/email-automation/hooks/useEmailAutomationTableStructure.tsx +19 -0
- package/src/features/email-automation/index.ts +2 -0
- package/src/features/email-blast/EmailBlastModule.ts +1 -0
- package/src/features/email-blast/components/forms/EmailBlastEditor.tsx +33 -4
- package/src/features/email-blast/components/lists/EmailBlastsList.tsx +1 -0
- package/src/features/email-blast/data/EmailBlast.ts +10 -1
- package/src/features/email-blast/data/EmailBlastInterface.ts +3 -0
- package/src/features/email-blast/data/__tests__/EmailBlast.spec.ts +18 -0
- package/src/features/email-blast/data/email-blast.fields.ts +1 -0
- package/src/features/email-blast/hooks/useEmailBlastTableStructure.tsx +15 -0
- package/src/features/notification/components/notifications/PushNotificationProvider.tsx +14 -2
- package/src/features/notification/components/notifications/__tests__/PushNotificationProvider.spec.tsx +11 -0
- package/dist/chunk-PMESKNKL.js.map +0 -1
- package/dist/chunk-RFKSJIQB.mjs.map +0 -1
- package/dist/chunk-RT7XFGIN.js.map +0 -1
- package/dist/chunk-UOTHRJD2.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-I3J6YYXK.mjs.map → BlockNoteEditor-IGUHTERQ.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-HIUAJQRI.mjs.map → BlockNoteViewer-X4UEVI2A.mjs.map} +0 -0
- /package/dist/{chunk-HAW5PNJG.mjs.map → chunk-TY5YWBLL.mjs.map} +0 -0
- /package/dist/{chunk-OUEYZOLB.mjs.map → chunk-YVKWACDP.mjs.map} +0 -0
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
Avatar,
|
|
4
|
+
AvatarFallback,
|
|
3
5
|
Badge,
|
|
4
6
|
Button,
|
|
7
|
+
Command,
|
|
8
|
+
CommandEmpty,
|
|
9
|
+
CommandGroup,
|
|
10
|
+
CommandInput,
|
|
11
|
+
CommandItem,
|
|
12
|
+
CommandList,
|
|
5
13
|
ConfirmDialog,
|
|
6
14
|
ContentListTable,
|
|
7
15
|
ContextMenu,
|
|
8
16
|
ContextMenuContent,
|
|
9
17
|
ContextMenuItem,
|
|
18
|
+
Dialog,
|
|
19
|
+
DialogContent,
|
|
20
|
+
DialogHeader,
|
|
21
|
+
DialogTitle,
|
|
22
|
+
DialogTrigger,
|
|
10
23
|
EditorSheet,
|
|
11
24
|
EmptyState,
|
|
12
25
|
FormInput,
|
|
@@ -29,11 +42,12 @@ import {
|
|
|
29
42
|
errorToast,
|
|
30
43
|
registerTableGenerator,
|
|
31
44
|
useDataListRetriever,
|
|
45
|
+
useDebounce,
|
|
32
46
|
usePageUrlGenerator,
|
|
33
47
|
useSidebar
|
|
34
|
-
} from "../chunk-
|
|
48
|
+
} from "../chunk-RINMQQZH.mjs";
|
|
35
49
|
import "../chunk-VOXD3ZLY.mjs";
|
|
36
|
-
import "../chunk-
|
|
50
|
+
import "../chunk-TY5YWBLL.mjs";
|
|
37
51
|
import "../chunk-PW42LRSL.mjs";
|
|
38
52
|
import {
|
|
39
53
|
EmailAutomationEnrollmentService,
|
|
@@ -42,14 +56,16 @@ import {
|
|
|
42
56
|
EmailBlastDeliveryService,
|
|
43
57
|
dateFormatLocale,
|
|
44
58
|
formatDate,
|
|
59
|
+
getInitials,
|
|
45
60
|
showError,
|
|
61
|
+
showToast,
|
|
46
62
|
useIsMobile
|
|
47
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-KMPBSOFB.mjs";
|
|
48
64
|
import "../chunk-OY65RYD3.mjs";
|
|
49
65
|
import {
|
|
50
66
|
Modules,
|
|
51
67
|
useI18nRouter
|
|
52
|
-
} from "../chunk-
|
|
68
|
+
} from "../chunk-OKBJEIOP.mjs";
|
|
53
69
|
import "../chunk-AUD6ZLBB.mjs";
|
|
54
70
|
import "../chunk-M3N7LPHX.mjs";
|
|
55
71
|
import "../chunk-4ZJIUTIV.mjs";
|
|
@@ -109,7 +125,8 @@ function EmailAutomationEditorInternal({
|
|
|
109
125
|
replyTo: z.string().refine((value) => value === "" || z.email().safeParse(value).success, {
|
|
110
126
|
message: t("emailAutomations.fields.replyTo.error")
|
|
111
127
|
}),
|
|
112
|
-
isActive: z.boolean()
|
|
128
|
+
isActive: z.boolean(),
|
|
129
|
+
purpose: z.enum(["service", "marketing"], { message: t("emailPurpose.error") })
|
|
113
130
|
}),
|
|
114
131
|
[t]
|
|
115
132
|
);
|
|
@@ -120,7 +137,9 @@ function EmailAutomationEditorInternal({
|
|
|
120
137
|
trigger: automation?.trigger ?? "",
|
|
121
138
|
exitTrigger: automation?.exitTrigger ?? "",
|
|
122
139
|
replyTo: automation?.replyTo ?? "",
|
|
123
|
-
isActive: automation?.isActive ?? false
|
|
140
|
+
isActive: automation?.isActive ?? false,
|
|
141
|
+
// No preselected value on create: the form refuses to save without a choice.
|
|
142
|
+
purpose: automation?.purpose ?? ""
|
|
124
143
|
}),
|
|
125
144
|
[automation]
|
|
126
145
|
);
|
|
@@ -128,6 +147,14 @@ function EmailAutomationEditorInternal({
|
|
|
128
147
|
resolver: zodResolver(formSchema),
|
|
129
148
|
defaultValues: getDefaultValues()
|
|
130
149
|
});
|
|
150
|
+
const purpose = form.watch("purpose");
|
|
151
|
+
const purposeValues = useMemo(
|
|
152
|
+
() => [
|
|
153
|
+
{ id: "service", text: t("emailPurpose.service") },
|
|
154
|
+
{ id: "marketing", text: t("emailPurpose.marketing") }
|
|
155
|
+
],
|
|
156
|
+
[t]
|
|
157
|
+
);
|
|
131
158
|
return /* @__PURE__ */ jsx(
|
|
132
159
|
EditorSheet,
|
|
133
160
|
{
|
|
@@ -148,7 +175,8 @@ function EmailAutomationEditorInternal({
|
|
|
148
175
|
trigger: values.trigger || void 0,
|
|
149
176
|
exitTrigger: values.exitTrigger || void 0,
|
|
150
177
|
replyTo: values.replyTo || void 0,
|
|
151
|
-
isActive: values.isActive
|
|
178
|
+
isActive: values.isActive,
|
|
179
|
+
purpose: values.purpose
|
|
152
180
|
};
|
|
153
181
|
return isEdit ? await EmailAutomationService.update(payload) : await EmailAutomationService.create(payload);
|
|
154
182
|
},
|
|
@@ -160,6 +188,18 @@ function EmailAutomationEditorInternal({
|
|
|
160
188
|
onDialogOpenChange,
|
|
161
189
|
children: /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
162
190
|
/* @__PURE__ */ jsx(FormInput, { form, id: "name", name: t("emailAutomations.fields.name.label"), isRequired: true }),
|
|
191
|
+
/* @__PURE__ */ jsx(
|
|
192
|
+
FormSelect,
|
|
193
|
+
{
|
|
194
|
+
form,
|
|
195
|
+
id: "purpose",
|
|
196
|
+
name: t("emailPurpose.label"),
|
|
197
|
+
placeholder: t("emailPurpose.placeholder"),
|
|
198
|
+
values: purposeValues,
|
|
199
|
+
description: purpose === "service" ? t("emailPurpose.serviceWarning") : void 0,
|
|
200
|
+
isRequired: true
|
|
201
|
+
}
|
|
202
|
+
),
|
|
163
203
|
/* @__PURE__ */ jsx(
|
|
164
204
|
FormSelect,
|
|
165
205
|
{
|
|
@@ -234,6 +274,7 @@ function EmailAutomationsList({ fullWidth } = {}) {
|
|
|
234
274
|
data,
|
|
235
275
|
fields: [
|
|
236
276
|
"name" /* name */,
|
|
277
|
+
"purpose" /* purpose */,
|
|
237
278
|
"trigger" /* trigger */,
|
|
238
279
|
"status" /* status */,
|
|
239
280
|
"steps" /* steps */,
|
|
@@ -262,7 +303,7 @@ function EmailAutomationsListContainer() {
|
|
|
262
303
|
__name(EmailAutomationsListContainer, "EmailAutomationsListContainer");
|
|
263
304
|
|
|
264
305
|
// src/features/email-automation/components/containers/EmailAutomationContainer.tsx
|
|
265
|
-
import { useTranslations as
|
|
306
|
+
import { useTranslations as useTranslations11 } from "next-intl";
|
|
266
307
|
|
|
267
308
|
// src/features/email-automation/contexts/EmailAutomationContext.tsx
|
|
268
309
|
import { createContext, useCallback as useCallback2, useContext, useEffect as useEffect3, useMemo as useMemo3, useState as useState3 } from "react";
|
|
@@ -739,7 +780,8 @@ import { useForm as useForm2 } from "react-hook-form";
|
|
|
739
780
|
import { v4 as v43 } from "uuid";
|
|
740
781
|
import { z as z2 } from "zod";
|
|
741
782
|
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
742
|
-
var TEMPLATE_VARIABLES = ["{{name}}", "{{email}}", "{{url}}", "{{unsubscribeUrl}}"
|
|
783
|
+
var TEMPLATE_VARIABLES = ["{{name}}", "{{email}}", "{{url}}", "{{unsubscribeUrl}}"];
|
|
784
|
+
var MARKETING_ONLY_VARIABLES = ["{{unsubscribeAllUrl}}"];
|
|
743
785
|
function EmailStepEditorInternal({
|
|
744
786
|
step,
|
|
745
787
|
automationId,
|
|
@@ -753,8 +795,9 @@ function EmailStepEditorInternal({
|
|
|
753
795
|
onSuccess
|
|
754
796
|
}) {
|
|
755
797
|
const t = useTranslations6();
|
|
756
|
-
const { reload } = useEmailAutomation();
|
|
798
|
+
const { automation, reload } = useEmailAutomation();
|
|
757
799
|
const isEdit = !!step;
|
|
800
|
+
const templateVariables = automation?.purpose === "service" ? TEMPLATE_VARIABLES : [...TEMPLATE_VARIABLES, ...MARKETING_ONLY_VARIABLES];
|
|
758
801
|
const formSchema = useMemo4(
|
|
759
802
|
() => z2.object({
|
|
760
803
|
id: z2.uuidv4(),
|
|
@@ -833,7 +876,7 @@ function EmailStepEditorInternal({
|
|
|
833
876
|
/* @__PURE__ */ jsxs5("span", { className: "block", children: [
|
|
834
877
|
t("emailAutomations.step.variablesHint"),
|
|
835
878
|
" ",
|
|
836
|
-
|
|
879
|
+
templateVariables.map((variable) => /* @__PURE__ */ jsx9("span", { className: "me-2 text-foreground", children: variable }, variable))
|
|
837
880
|
] }),
|
|
838
881
|
/* @__PURE__ */ jsx9("span", { className: "mt-1 block", children: t("emailAutomations.step.unsubscribeHint") })
|
|
839
882
|
] })
|
|
@@ -1302,13 +1345,171 @@ __name(EmailAutomationCanvasTab, "EmailAutomationCanvasTab");
|
|
|
1302
1345
|
|
|
1303
1346
|
// src/features/email-automation/components/lists/EmailAutomationRecipientsList.tsx
|
|
1304
1347
|
import { RefreshCw } from "lucide-react";
|
|
1348
|
+
import { useTranslations as useTranslations10 } from "next-intl";
|
|
1349
|
+
import { useMemo as useMemo7, useState as useState7 } from "react";
|
|
1350
|
+
|
|
1351
|
+
// src/features/email-automation/components/forms/EmailAutomationAddPersonDialog.tsx
|
|
1352
|
+
import { UserPlusIcon } from "lucide-react";
|
|
1305
1353
|
import { useTranslations as useTranslations9 } from "next-intl";
|
|
1306
|
-
import {
|
|
1307
|
-
import {
|
|
1308
|
-
|
|
1354
|
+
import { useCallback as useCallback6, useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
|
|
1355
|
+
import { v4 as v44 } from "uuid";
|
|
1356
|
+
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1357
|
+
function EmailAutomationAddPersonDialog({
|
|
1358
|
+
automationId,
|
|
1359
|
+
disabled,
|
|
1360
|
+
onAdded
|
|
1361
|
+
}) {
|
|
1309
1362
|
const t = useTranslations9();
|
|
1310
|
-
const
|
|
1311
|
-
const
|
|
1363
|
+
const [open, setOpen] = useState6(false);
|
|
1364
|
+
const searchTermRef = useRef3("");
|
|
1365
|
+
const [searchTerm, setSearchTerm] = useState6("");
|
|
1366
|
+
const sentinelRef = useRef3(null);
|
|
1367
|
+
const data = useDataListRetriever({
|
|
1368
|
+
ready: open,
|
|
1369
|
+
retriever: /* @__PURE__ */ __name((params) => EmailAutomationService.findCandidates(params), "retriever"),
|
|
1370
|
+
retrieverParams: { automationId },
|
|
1371
|
+
module: Modules.EmailAutomationCandidate
|
|
1372
|
+
});
|
|
1373
|
+
useEffect6(() => {
|
|
1374
|
+
if (open) data.setReady(true);
|
|
1375
|
+
}, [data, open]);
|
|
1376
|
+
const refreshList = useCallback6(
|
|
1377
|
+
async (searchedTerm) => {
|
|
1378
|
+
if (searchedTerm === searchTermRef.current) return;
|
|
1379
|
+
searchTermRef.current = searchedTerm;
|
|
1380
|
+
await data.search(searchedTerm);
|
|
1381
|
+
},
|
|
1382
|
+
[data]
|
|
1383
|
+
);
|
|
1384
|
+
const updateSearchTerm = useDebounce(refreshList, 500);
|
|
1385
|
+
useEffect6(() => {
|
|
1386
|
+
if (open) updateSearchTerm(searchTerm);
|
|
1387
|
+
}, [open, searchTerm]);
|
|
1388
|
+
useEffect6(() => () => updateSearchTerm.cancel(), [updateSearchTerm]);
|
|
1389
|
+
useEffect6(() => {
|
|
1390
|
+
if (!data.next || !sentinelRef.current) return;
|
|
1391
|
+
const observer = new IntersectionObserver(
|
|
1392
|
+
(entries) => {
|
|
1393
|
+
if (entries[0]?.isIntersecting) data.next?.();
|
|
1394
|
+
},
|
|
1395
|
+
{ threshold: 0.1, rootMargin: "200px" }
|
|
1396
|
+
);
|
|
1397
|
+
observer.observe(sentinelRef.current);
|
|
1398
|
+
return () => observer.disconnect();
|
|
1399
|
+
}, [data.next]);
|
|
1400
|
+
const handleOpenChange = /* @__PURE__ */ __name((next) => {
|
|
1401
|
+
setOpen(next);
|
|
1402
|
+
if (!next) {
|
|
1403
|
+
updateSearchTerm.cancel();
|
|
1404
|
+
return;
|
|
1405
|
+
}
|
|
1406
|
+
setSearchTerm("");
|
|
1407
|
+
if (data.isLoaded) {
|
|
1408
|
+
if (searchTermRef.current !== "") {
|
|
1409
|
+
searchTermRef.current = "";
|
|
1410
|
+
void data.search("");
|
|
1411
|
+
} else {
|
|
1412
|
+
void data.refresh();
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
}, "handleOpenChange");
|
|
1416
|
+
const add = /* @__PURE__ */ __name(async (candidate) => {
|
|
1417
|
+
if (!candidate.addable) return;
|
|
1418
|
+
try {
|
|
1419
|
+
await EmailAutomationService.addEnrollment({
|
|
1420
|
+
automationId,
|
|
1421
|
+
input: { id: v44(), recipientType: candidate.recipientType, recipientId: candidate.recipientId }
|
|
1422
|
+
});
|
|
1423
|
+
setOpen(false);
|
|
1424
|
+
showToast(t("emailAutomations.recipients.addDialog.added", { email: candidate.email }));
|
|
1425
|
+
onAdded();
|
|
1426
|
+
} catch (error) {
|
|
1427
|
+
errorToast({ title: t("common.errors.error"), error });
|
|
1428
|
+
}
|
|
1429
|
+
}, "add");
|
|
1430
|
+
const candidates = data.data ?? [];
|
|
1431
|
+
const addable = candidates.filter((candidate) => candidate.addable);
|
|
1432
|
+
const blocked = candidates.filter((candidate) => !candidate.addable);
|
|
1433
|
+
const renderCandidate = /* @__PURE__ */ __name((candidate) => /* @__PURE__ */ jsx15(
|
|
1434
|
+
CommandItem,
|
|
1435
|
+
{
|
|
1436
|
+
className: "cursor-pointer hover:bg-muted data-selected:hover:bg-muted bg-transparent data-selected:bg-transparent",
|
|
1437
|
+
value: candidate.id,
|
|
1438
|
+
disabled: !candidate.addable,
|
|
1439
|
+
"data-testid": `email-automation-candidate-${candidate.recipientId}`,
|
|
1440
|
+
"data-addable": candidate.addable ? "true" : "false",
|
|
1441
|
+
onSelect: () => void add(candidate),
|
|
1442
|
+
children: /* @__PURE__ */ jsxs9("div", { className: "flex min-w-0 flex-1 flex-row items-center px-4 py-1", children: [
|
|
1443
|
+
/* @__PURE__ */ jsx15("div", { className: "*:ring-border *:ring-1", children: /* @__PURE__ */ jsx15(Avatar, { className: "h-6 w-6", children: /* @__PURE__ */ jsx15(AvatarFallback, { children: getInitials(candidate.name || candidate.email) }) }) }),
|
|
1444
|
+
/* @__PURE__ */ jsx15("div", { className: "ms-5 me-3 flex min-w-0 flex-1 flex-col", children: candidate.name ? /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
1445
|
+
/* @__PURE__ */ jsx15("div", { className: "truncate text-sm font-medium", children: candidate.name }),
|
|
1446
|
+
/* @__PURE__ */ jsx15("div", { className: "truncate text-xs font-normal", children: candidate.email })
|
|
1447
|
+
] }) : /* @__PURE__ */ jsx15("div", { className: "truncate text-sm font-medium", children: candidate.email }) }),
|
|
1448
|
+
candidate.addable ? /* @__PURE__ */ jsx15(
|
|
1449
|
+
Badge,
|
|
1450
|
+
{
|
|
1451
|
+
variant: candidate.recipientType === "waitlist" ? "softBlue" : "softGray",
|
|
1452
|
+
className: "ms-auto shrink-0",
|
|
1453
|
+
children: t(`emailAutomations.recipients.addDialog.kind.${candidate.recipientType}`)
|
|
1454
|
+
}
|
|
1455
|
+
) : candidate.reason && /* @__PURE__ */ jsx15(
|
|
1456
|
+
Badge,
|
|
1457
|
+
{
|
|
1458
|
+
variant: "softAmber",
|
|
1459
|
+
className: "ms-auto shrink-0",
|
|
1460
|
+
"data-testid": `email-automation-candidate-reason-${candidate.recipientId}`,
|
|
1461
|
+
children: t(`emailAutomations.recipients.addDialog.reason.${candidate.reason}`)
|
|
1462
|
+
}
|
|
1463
|
+
)
|
|
1464
|
+
] })
|
|
1465
|
+
},
|
|
1466
|
+
candidate.id
|
|
1467
|
+
), "renderCandidate");
|
|
1468
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
1469
|
+
/* @__PURE__ */ jsxs9(Dialog, { open, onOpenChange: handleOpenChange, children: [
|
|
1470
|
+
/* @__PURE__ */ jsxs9(
|
|
1471
|
+
DialogTrigger,
|
|
1472
|
+
{
|
|
1473
|
+
render: /* @__PURE__ */ jsx15(Button, { variant: "outline", size: "sm", "data-testid": "email-automation-add-person" }),
|
|
1474
|
+
disabled,
|
|
1475
|
+
children: [
|
|
1476
|
+
/* @__PURE__ */ jsx15(UserPlusIcon, { className: "h-3.5 w-3.5" }),
|
|
1477
|
+
t("emailAutomations.recipients.addPerson")
|
|
1478
|
+
]
|
|
1479
|
+
}
|
|
1480
|
+
),
|
|
1481
|
+
/* @__PURE__ */ jsxs9(DialogContent, { className: "sm:max-w-2xl", "data-testid": "email-automation-add-person-dialog", children: [
|
|
1482
|
+
/* @__PURE__ */ jsx15(DialogHeader, { children: /* @__PURE__ */ jsx15(DialogTitle, { children: t("emailAutomations.recipients.addDialog.title") }) }),
|
|
1483
|
+
/* @__PURE__ */ jsxs9(Command, { shouldFilter: false, children: [
|
|
1484
|
+
/* @__PURE__ */ jsx15(
|
|
1485
|
+
CommandInput,
|
|
1486
|
+
{
|
|
1487
|
+
"data-testid": "email-automation-add-person-search",
|
|
1488
|
+
placeholder: t("emailAutomations.recipients.addDialog.search"),
|
|
1489
|
+
value: searchTerm,
|
|
1490
|
+
onValueChange: setSearchTerm
|
|
1491
|
+
}
|
|
1492
|
+
),
|
|
1493
|
+
/* @__PURE__ */ jsxs9(CommandList, { className: "mt-2", children: [
|
|
1494
|
+
/* @__PURE__ */ jsx15(CommandEmpty, { children: t("emailAutomations.recipients.addDialog.empty") }),
|
|
1495
|
+
addable.length > 0 && /* @__PURE__ */ jsx15(CommandGroup, { heading: t("emailAutomations.recipients.addDialog.groups.addable"), children: addable.map(renderCandidate) }),
|
|
1496
|
+
blocked.length > 0 && /* @__PURE__ */ jsx15(CommandGroup, { heading: t("emailAutomations.recipients.addDialog.groups.blocked"), children: blocked.map(renderCandidate) }),
|
|
1497
|
+
data.next && /* @__PURE__ */ jsx15("div", { ref: sentinelRef, style: { height: 1 } })
|
|
1498
|
+
] })
|
|
1499
|
+
] })
|
|
1500
|
+
] })
|
|
1501
|
+
] }),
|
|
1502
|
+
disabled && /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground text-xs font-normal", children: t("emailAutomations.recipients.addPersonNoSteps") })
|
|
1503
|
+
] });
|
|
1504
|
+
}
|
|
1505
|
+
__name(EmailAutomationAddPersonDialog, "EmailAutomationAddPersonDialog");
|
|
1506
|
+
|
|
1507
|
+
// src/features/email-automation/components/lists/EmailAutomationRecipientsList.tsx
|
|
1508
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1509
|
+
function EmailAutomationRecipientsList() {
|
|
1510
|
+
const t = useTranslations10();
|
|
1511
|
+
const { automation, reload } = useEmailAutomation();
|
|
1512
|
+
const [statusFilter, setStatusFilter] = useState7("all");
|
|
1312
1513
|
const data = useDataListRetriever({
|
|
1313
1514
|
retriever: /* @__PURE__ */ __name((params) => EmailAutomationService.findEnrollments(params), "retriever"),
|
|
1314
1515
|
retrieverParams: { automationId: automation?.id },
|
|
@@ -1330,21 +1531,32 @@ function EmailAutomationRecipientsList() {
|
|
|
1330
1531
|
}),
|
|
1331
1532
|
[t]
|
|
1332
1533
|
);
|
|
1333
|
-
const filters = /* @__PURE__ */
|
|
1334
|
-
/* @__PURE__ */
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1534
|
+
const filters = /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-4", children: [
|
|
1535
|
+
automation && /* @__PURE__ */ jsx16(
|
|
1536
|
+
EmailAutomationAddPersonDialog,
|
|
1537
|
+
{
|
|
1538
|
+
automationId: automation.id,
|
|
1539
|
+
disabled: automation.stepCount === 0,
|
|
1540
|
+
onAdded: () => {
|
|
1541
|
+
void data.refresh();
|
|
1542
|
+
void reload();
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
),
|
|
1546
|
+
/* @__PURE__ */ jsxs10(Select, { items: statusItems, value: statusFilter, onValueChange: handleStatusChange, children: [
|
|
1547
|
+
/* @__PURE__ */ jsx16(SelectTrigger, { className: "w-40", children: /* @__PURE__ */ jsx16(SelectValue, {}) }),
|
|
1548
|
+
/* @__PURE__ */ jsxs10(SelectContent, { children: [
|
|
1549
|
+
/* @__PURE__ */ jsx16(SelectItem, { value: "all", children: t("emailAutomations.recipients.status.all") }),
|
|
1550
|
+
/* @__PURE__ */ jsx16(SelectItem, { value: "active", children: t("emailAutomations.recipients.status.active") }),
|
|
1551
|
+
/* @__PURE__ */ jsx16(SelectItem, { value: "completed", children: t("emailAutomations.recipients.status.completed") }),
|
|
1552
|
+
/* @__PURE__ */ jsx16(SelectItem, { value: "unsubscribed", children: t("emailAutomations.recipients.status.unsubscribed") }),
|
|
1553
|
+
/* @__PURE__ */ jsx16(SelectItem, { value: "exited", children: t("emailAutomations.recipients.status.exited") }),
|
|
1554
|
+
/* @__PURE__ */ jsx16(SelectItem, { value: "failed", children: t("emailAutomations.recipients.status.failed") })
|
|
1343
1555
|
] })
|
|
1344
1556
|
] }),
|
|
1345
|
-
/* @__PURE__ */
|
|
1557
|
+
/* @__PURE__ */ jsx16(Button, { variant: "outline", size: "icon", onClick: () => void data.refresh(), disabled: !data.isLoaded, children: /* @__PURE__ */ jsx16(RefreshCw, { className: `h-4 w-4 ${!data.isLoaded ? "animate-spin" : ""}` }) })
|
|
1346
1558
|
] });
|
|
1347
|
-
return /* @__PURE__ */
|
|
1559
|
+
return /* @__PURE__ */ jsx16("div", { "data-testid": "email-automation-recipients", children: /* @__PURE__ */ jsx16(
|
|
1348
1560
|
ContentListTable,
|
|
1349
1561
|
{
|
|
1350
1562
|
data,
|
|
@@ -1357,22 +1569,23 @@ function EmailAutomationRecipientsList() {
|
|
|
1357
1569
|
"sentCount" /* sentCount */
|
|
1358
1570
|
],
|
|
1359
1571
|
tableGeneratorType: Modules.EmailAutomationEnrollment,
|
|
1572
|
+
title: t("emailAutomations.tabs.recipients"),
|
|
1360
1573
|
filters,
|
|
1361
1574
|
allowSearch: false,
|
|
1362
1575
|
emptyState: t("emailAutomations.recipients.empty")
|
|
1363
1576
|
}
|
|
1364
|
-
);
|
|
1577
|
+
) });
|
|
1365
1578
|
}
|
|
1366
1579
|
__name(EmailAutomationRecipientsList, "EmailAutomationRecipientsList");
|
|
1367
1580
|
|
|
1368
1581
|
// src/features/email-automation/components/containers/EmailAutomationContainer.tsx
|
|
1369
|
-
import { jsx as
|
|
1582
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1370
1583
|
function EmailAutomationContainer({ automationId }) {
|
|
1371
|
-
return /* @__PURE__ */
|
|
1584
|
+
return /* @__PURE__ */ jsx17(EmailAutomationProvider, { automationId, children: /* @__PURE__ */ jsx17(EmailAutomationShell, {}) });
|
|
1372
1585
|
}
|
|
1373
1586
|
__name(EmailAutomationContainer, "EmailAutomationContainer");
|
|
1374
1587
|
function EmailAutomationShell() {
|
|
1375
|
-
const t =
|
|
1588
|
+
const t = useTranslations11();
|
|
1376
1589
|
const generateUrl = usePageUrlGenerator();
|
|
1377
1590
|
const { automation, reload } = useEmailAutomation();
|
|
1378
1591
|
if (!automation) return null;
|
|
@@ -1380,7 +1593,7 @@ function EmailAutomationShell() {
|
|
|
1380
1593
|
{ name: t("emailAutomations.admin.title"), href: generateUrl({ page: Modules.EmailAutomation }) },
|
|
1381
1594
|
{ name: automation.name }
|
|
1382
1595
|
];
|
|
1383
|
-
return /* @__PURE__ */
|
|
1596
|
+
return /* @__PURE__ */ jsx17(
|
|
1384
1597
|
SharedProvider,
|
|
1385
1598
|
{
|
|
1386
1599
|
value: {
|
|
@@ -1389,12 +1602,12 @@ function EmailAutomationShell() {
|
|
|
1389
1602
|
type: t("emailAutomations.admin.title"),
|
|
1390
1603
|
element: automation.name,
|
|
1391
1604
|
functions: [
|
|
1392
|
-
/* @__PURE__ */
|
|
1393
|
-
/* @__PURE__ */
|
|
1605
|
+
/* @__PURE__ */ jsx17(EmailAutomationActiveSwitch, {}, "emailAutomationActiveSwitch"),
|
|
1606
|
+
/* @__PURE__ */ jsx17(EmailAutomationEditor, { automation, onSuccess: reload }, "emailAutomationEditor")
|
|
1394
1607
|
]
|
|
1395
1608
|
}
|
|
1396
1609
|
},
|
|
1397
|
-
children: /* @__PURE__ */
|
|
1610
|
+
children: /* @__PURE__ */ jsx17(
|
|
1398
1611
|
RoundPageContainer,
|
|
1399
1612
|
{
|
|
1400
1613
|
module: Modules.EmailAutomation,
|
|
@@ -1406,13 +1619,13 @@ function EmailAutomationShell() {
|
|
|
1406
1619
|
{
|
|
1407
1620
|
sectionKey: "canvas",
|
|
1408
1621
|
label: t("emailAutomations.tabs.canvas"),
|
|
1409
|
-
content: /* @__PURE__ */
|
|
1622
|
+
content: /* @__PURE__ */ jsx17(EmailAutomationCanvasTab, {}),
|
|
1410
1623
|
fillHeight: true
|
|
1411
1624
|
},
|
|
1412
1625
|
{
|
|
1413
1626
|
sectionKey: "recipients",
|
|
1414
1627
|
label: t("emailAutomations.tabs.recipients"),
|
|
1415
|
-
content: /* @__PURE__ */
|
|
1628
|
+
content: /* @__PURE__ */ jsx17(EmailAutomationRecipientsList, {})
|
|
1416
1629
|
}
|
|
1417
1630
|
]
|
|
1418
1631
|
}
|
|
@@ -1424,16 +1637,17 @@ __name(EmailAutomationShell, "EmailAutomationShell");
|
|
|
1424
1637
|
|
|
1425
1638
|
// src/features/email-automation/components/unsubscribe/EmailUnsubscribe.tsx
|
|
1426
1639
|
import { CheckCircle, Loader2, XCircle } from "lucide-react";
|
|
1427
|
-
import { useTranslations as
|
|
1428
|
-
import { useEffect as
|
|
1429
|
-
import { Fragment as
|
|
1640
|
+
import { useTranslations as useTranslations12 } from "next-intl";
|
|
1641
|
+
import { useEffect as useEffect7, useState as useState8 } from "react";
|
|
1642
|
+
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1430
1643
|
function EmailUnsubscribe({ token, scope, source = "automation" }) {
|
|
1431
|
-
const t =
|
|
1432
|
-
const [state, setState] =
|
|
1433
|
-
const [stoppedScope, setStoppedScope] =
|
|
1434
|
-
const [automationName, setAutomationName] =
|
|
1435
|
-
const [
|
|
1436
|
-
|
|
1644
|
+
const t = useTranslations12();
|
|
1645
|
+
const [state, setState] = useState8("loading");
|
|
1646
|
+
const [stoppedScope, setStoppedScope] = useState8(scope);
|
|
1647
|
+
const [automationName, setAutomationName] = useState8("");
|
|
1648
|
+
const [isServiceAutomation, setIsServiceAutomation] = useState8(false);
|
|
1649
|
+
const [isStoppingAll, setIsStoppingAll] = useState8(false);
|
|
1650
|
+
useEffect7(() => {
|
|
1437
1651
|
async function unsubscribe() {
|
|
1438
1652
|
try {
|
|
1439
1653
|
if (source === "blast") {
|
|
@@ -1444,6 +1658,7 @@ function EmailUnsubscribe({ token, scope, source = "automation" }) {
|
|
|
1444
1658
|
}
|
|
1445
1659
|
const enrollment = await EmailAutomationEnrollmentService.unsubscribe({ token, scope });
|
|
1446
1660
|
setAutomationName(enrollment?.automation?.name ?? "");
|
|
1661
|
+
setIsServiceAutomation(enrollment?.automation?.purpose === "service");
|
|
1447
1662
|
setStoppedScope(scope);
|
|
1448
1663
|
setState("success");
|
|
1449
1664
|
} catch {
|
|
@@ -1465,25 +1680,25 @@ function EmailUnsubscribe({ token, scope, source = "automation" }) {
|
|
|
1465
1680
|
}
|
|
1466
1681
|
}, "stopAll");
|
|
1467
1682
|
if (state === "loading") {
|
|
1468
|
-
return /* @__PURE__ */
|
|
1469
|
-
/* @__PURE__ */
|
|
1470
|
-
/* @__PURE__ */
|
|
1683
|
+
return /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center justify-center space-y-4 py-16 text-center", children: [
|
|
1684
|
+
/* @__PURE__ */ jsx18(Loader2, { className: "text-primary h-12 w-12 animate-spin" }),
|
|
1685
|
+
/* @__PURE__ */ jsx18("p", { className: "text-muted-foreground text-sm", children: t("emailAutomations.unsubscribe.loading") })
|
|
1471
1686
|
] });
|
|
1472
1687
|
}
|
|
1473
1688
|
if (state === "error") {
|
|
1474
|
-
return /* @__PURE__ */
|
|
1475
|
-
/* @__PURE__ */
|
|
1476
|
-
/* @__PURE__ */
|
|
1477
|
-
/* @__PURE__ */
|
|
1689
|
+
return /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center justify-center space-y-4 py-16 text-center", children: [
|
|
1690
|
+
/* @__PURE__ */ jsx18("div", { className: "bg-destructive/10 rounded-full p-4", children: /* @__PURE__ */ jsx18(XCircle, { className: "text-destructive h-12 w-12" }) }),
|
|
1691
|
+
/* @__PURE__ */ jsx18(SectionHeader, { level: 2, children: t("emailAutomations.unsubscribe.invalidTitle") }),
|
|
1692
|
+
/* @__PURE__ */ jsx18("p", { className: "text-muted-foreground max-w-md text-sm leading-relaxed", children: t("emailAutomations.unsubscribe.invalidBody") })
|
|
1478
1693
|
] });
|
|
1479
1694
|
}
|
|
1480
|
-
return /* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1483
|
-
stoppedScope === "all" ? /* @__PURE__ */
|
|
1484
|
-
/* @__PURE__ */
|
|
1485
|
-
/* @__PURE__ */
|
|
1486
|
-
isStoppingAll && /* @__PURE__ */
|
|
1695
|
+
return /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center justify-center space-y-4 py-16 text-center", children: [
|
|
1696
|
+
/* @__PURE__ */ jsx18("div", { className: "bg-primary/10 rounded-full p-4", children: /* @__PURE__ */ jsx18(CheckCircle, { className: "text-primary h-12 w-12" }) }),
|
|
1697
|
+
/* @__PURE__ */ jsx18(SectionHeader, { level: 2, children: t("emailAutomations.unsubscribe.title") }),
|
|
1698
|
+
stoppedScope === "all" ? /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground max-w-md text-sm leading-relaxed", children: t("emailAutomations.unsubscribe.stoppedAll") }) : /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
1699
|
+
/* @__PURE__ */ jsx18("p", { className: "text-muted-foreground max-w-md text-sm leading-relaxed", children: t("emailAutomations.unsubscribe.stoppedAutomation", { name: automationName }) }),
|
|
1700
|
+
!isServiceAutomation && /* @__PURE__ */ jsxs11(Button, { variant: "secondary", onClick: stopAll, disabled: isStoppingAll, children: [
|
|
1701
|
+
isStoppingAll && /* @__PURE__ */ jsx18(Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
1487
1702
|
t("emailAutomations.unsubscribe.alsoStopAll")
|
|
1488
1703
|
] })
|
|
1489
1704
|
] })
|
|
@@ -1492,11 +1707,11 @@ function EmailUnsubscribe({ token, scope, source = "automation" }) {
|
|
|
1492
1707
|
__name(EmailUnsubscribe, "EmailUnsubscribe");
|
|
1493
1708
|
|
|
1494
1709
|
// src/features/email-automation/hooks/useEmailAutomationTableStructure.tsx
|
|
1495
|
-
import { useTranslations as
|
|
1710
|
+
import { useTranslations as useTranslations13 } from "next-intl";
|
|
1496
1711
|
import { useMemo as useMemo8 } from "react";
|
|
1497
|
-
import { jsx as
|
|
1712
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1498
1713
|
var useEmailAutomationTableStructure = /* @__PURE__ */ __name((params) => {
|
|
1499
|
-
const t =
|
|
1714
|
+
const t = useTranslations13();
|
|
1500
1715
|
const generateUrl = usePageUrlGenerator();
|
|
1501
1716
|
const triggerLabels = params.context?.triggerLabels ?? {};
|
|
1502
1717
|
const tableData = useMemo8(() => {
|
|
@@ -1514,7 +1729,7 @@ var useEmailAutomationTableStructure = /* @__PURE__ */ __name((params) => {
|
|
|
1514
1729
|
header,
|
|
1515
1730
|
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
1516
1731
|
const automation = row.original.jsonApiData;
|
|
1517
|
-
return /* @__PURE__ */
|
|
1732
|
+
return /* @__PURE__ */ jsx19("span", { className: "block text-xs tabular-nums text-end", children: read(automation) ?? 0 });
|
|
1518
1733
|
}, "cell"),
|
|
1519
1734
|
enableSorting: false,
|
|
1520
1735
|
enableHiding: false
|
|
@@ -1526,7 +1741,18 @@ var useEmailAutomationTableStructure = /* @__PURE__ */ __name((params) => {
|
|
|
1526
1741
|
header: t("emailAutomations.list.columns.name"),
|
|
1527
1742
|
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
1528
1743
|
const automation = row.original.jsonApiData;
|
|
1529
|
-
return /* @__PURE__ */
|
|
1744
|
+
return /* @__PURE__ */ jsx19(Link, { href: generateUrl({ page: Modules.EmailAutomation, id: automation.id }), children: automation.name });
|
|
1745
|
+
}, "cell"),
|
|
1746
|
+
enableSorting: false,
|
|
1747
|
+
enableHiding: false
|
|
1748
|
+
}),
|
|
1749
|
+
["purpose" /* purpose */]: () => ({
|
|
1750
|
+
id: "purpose",
|
|
1751
|
+
accessorKey: "purpose",
|
|
1752
|
+
header: t("emailAutomations.list.columns.purpose"),
|
|
1753
|
+
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
1754
|
+
const automation = row.original.jsonApiData;
|
|
1755
|
+
return automation.purpose === "service" ? /* @__PURE__ */ jsx19(Badge, { variant: "softBlue", "data-testid": "email-automation-purpose-badge", children: t("emailPurpose.service") }) : /* @__PURE__ */ jsx19(Badge, { variant: "softGray", "data-testid": "email-automation-purpose-badge", children: t("emailPurpose.marketing") });
|
|
1530
1756
|
}, "cell"),
|
|
1531
1757
|
enableSorting: false,
|
|
1532
1758
|
enableHiding: false
|
|
@@ -1537,8 +1763,8 @@ var useEmailAutomationTableStructure = /* @__PURE__ */ __name((params) => {
|
|
|
1537
1763
|
header: t("emailAutomations.list.columns.trigger"),
|
|
1538
1764
|
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
1539
1765
|
const automation = row.original.jsonApiData;
|
|
1540
|
-
if (!automation.trigger) return /* @__PURE__ */
|
|
1541
|
-
return /* @__PURE__ */
|
|
1766
|
+
if (!automation.trigger) return /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground text-xs", children: "\u2014" });
|
|
1767
|
+
return /* @__PURE__ */ jsx19("span", { className: "text-sm", children: triggerLabels[automation.trigger] ?? automation.trigger });
|
|
1542
1768
|
}, "cell"),
|
|
1543
1769
|
enableSorting: false,
|
|
1544
1770
|
enableHiding: false
|
|
@@ -1549,7 +1775,7 @@ var useEmailAutomationTableStructure = /* @__PURE__ */ __name((params) => {
|
|
|
1549
1775
|
header: t("emailAutomations.list.columns.status"),
|
|
1550
1776
|
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
1551
1777
|
const automation = row.original.jsonApiData;
|
|
1552
|
-
return automation.isActive ? /* @__PURE__ */
|
|
1778
|
+
return automation.isActive ? /* @__PURE__ */ jsx19(Badge, { variant: "softGreen", children: t("emailAutomations.list.status.on") }) : /* @__PURE__ */ jsx19(Badge, { variant: "softGray", children: t("emailAutomations.list.status.off") });
|
|
1553
1779
|
}, "cell"),
|
|
1554
1780
|
enableSorting: false,
|
|
1555
1781
|
enableHiding: false
|
|
@@ -1575,9 +1801,9 @@ var useEmailAutomationTableStructure = /* @__PURE__ */ __name((params) => {
|
|
|
1575
1801
|
registerTableGenerator("email-automations", useEmailAutomationTableStructure);
|
|
1576
1802
|
|
|
1577
1803
|
// src/features/email-automation/hooks/useEmailAutomationEnrollmentTableStructure.tsx
|
|
1578
|
-
import { useLocale, useTranslations as
|
|
1804
|
+
import { useLocale, useTranslations as useTranslations14 } from "next-intl";
|
|
1579
1805
|
import { useMemo as useMemo9 } from "react";
|
|
1580
|
-
import { jsx as
|
|
1806
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1581
1807
|
var STATUS_VARIANTS = {
|
|
1582
1808
|
active: "softGreen",
|
|
1583
1809
|
completed: "softBlue",
|
|
@@ -1586,7 +1812,7 @@ var STATUS_VARIANTS = {
|
|
|
1586
1812
|
failed: "softRed"
|
|
1587
1813
|
};
|
|
1588
1814
|
var useEmailAutomationEnrollmentTableStructure = /* @__PURE__ */ __name((params) => {
|
|
1589
|
-
const t =
|
|
1815
|
+
const t = useTranslations14();
|
|
1590
1816
|
const locale = dateFormatLocale(useLocale());
|
|
1591
1817
|
const tableData = useMemo9(() => {
|
|
1592
1818
|
return params.data.map((enrollment) => {
|
|
@@ -1597,7 +1823,7 @@ var useEmailAutomationEnrollmentTableStructure = /* @__PURE__ */ __name((params)
|
|
|
1597
1823
|
return entry;
|
|
1598
1824
|
});
|
|
1599
1825
|
}, [params.data, params.fields]);
|
|
1600
|
-
const empty = /* @__PURE__ */
|
|
1826
|
+
const empty = /* @__PURE__ */ jsx20("span", { className: "text-muted-foreground text-xs", children: "\u2014" });
|
|
1601
1827
|
const fieldColumnMap = {
|
|
1602
1828
|
["email" /* email */]: () => ({
|
|
1603
1829
|
id: "email",
|
|
@@ -1605,7 +1831,7 @@ var useEmailAutomationEnrollmentTableStructure = /* @__PURE__ */ __name((params)
|
|
|
1605
1831
|
header: t("emailAutomations.recipients.columns.email"),
|
|
1606
1832
|
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
1607
1833
|
const enrollment = row.original.jsonApiData;
|
|
1608
|
-
return /* @__PURE__ */
|
|
1834
|
+
return /* @__PURE__ */ jsx20("span", { className: "text-sm", children: enrollment.email });
|
|
1609
1835
|
}, "cell"),
|
|
1610
1836
|
enableSorting: false,
|
|
1611
1837
|
enableHiding: false
|
|
@@ -1616,7 +1842,7 @@ var useEmailAutomationEnrollmentTableStructure = /* @__PURE__ */ __name((params)
|
|
|
1616
1842
|
header: t("emailAutomations.recipients.columns.name"),
|
|
1617
1843
|
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
1618
1844
|
const enrollment = row.original.jsonApiData;
|
|
1619
|
-
return enrollment.name ? /* @__PURE__ */
|
|
1845
|
+
return enrollment.name ? /* @__PURE__ */ jsx20("span", { className: "text-sm", children: enrollment.name }) : empty;
|
|
1620
1846
|
}, "cell"),
|
|
1621
1847
|
enableSorting: false,
|
|
1622
1848
|
enableHiding: false
|
|
@@ -1627,7 +1853,7 @@ var useEmailAutomationEnrollmentTableStructure = /* @__PURE__ */ __name((params)
|
|
|
1627
1853
|
header: t("emailAutomations.recipients.columns.status"),
|
|
1628
1854
|
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
1629
1855
|
const enrollment = row.original.jsonApiData;
|
|
1630
|
-
return /* @__PURE__ */
|
|
1856
|
+
return /* @__PURE__ */ jsx20(
|
|
1631
1857
|
Badge,
|
|
1632
1858
|
{
|
|
1633
1859
|
variant: STATUS_VARIANTS[enrollment.status] ?? "softGray",
|
|
@@ -1645,7 +1871,7 @@ var useEmailAutomationEnrollmentTableStructure = /* @__PURE__ */ __name((params)
|
|
|
1645
1871
|
header: t("emailAutomations.recipients.columns.currentStep"),
|
|
1646
1872
|
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
1647
1873
|
const enrollment = row.original.jsonApiData;
|
|
1648
|
-
return enrollment.currentStepSubject ? /* @__PURE__ */
|
|
1874
|
+
return enrollment.currentStepSubject ? /* @__PURE__ */ jsx20("span", { className: "text-sm", children: enrollment.currentStepSubject }) : empty;
|
|
1649
1875
|
}, "cell"),
|
|
1650
1876
|
enableSorting: false,
|
|
1651
1877
|
enableHiding: false
|
|
@@ -1657,7 +1883,7 @@ var useEmailAutomationEnrollmentTableStructure = /* @__PURE__ */ __name((params)
|
|
|
1657
1883
|
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
1658
1884
|
const enrollment = row.original.jsonApiData;
|
|
1659
1885
|
if (!enrollment.nextSendAt) return empty;
|
|
1660
|
-
return /* @__PURE__ */
|
|
1886
|
+
return /* @__PURE__ */ jsx20("span", { className: "text-xs tabular-nums", children: formatDate(enrollment.nextSendAt, "dateTime", locale) });
|
|
1661
1887
|
}, "cell"),
|
|
1662
1888
|
enableSorting: false,
|
|
1663
1889
|
enableHiding: false
|
|
@@ -1668,7 +1894,7 @@ var useEmailAutomationEnrollmentTableStructure = /* @__PURE__ */ __name((params)
|
|
|
1668
1894
|
header: t("emailAutomations.recipients.columns.sentCount"),
|
|
1669
1895
|
cell: /* @__PURE__ */ __name(({ row }) => {
|
|
1670
1896
|
const enrollment = row.original.jsonApiData;
|
|
1671
|
-
return /* @__PURE__ */
|
|
1897
|
+
return /* @__PURE__ */ jsx20("span", { className: "block text-xs tabular-nums text-end", children: enrollment.sentCount ?? 0 });
|
|
1672
1898
|
}, "cell"),
|
|
1673
1899
|
enableSorting: false,
|
|
1674
1900
|
enableHiding: false
|
|
@@ -1684,6 +1910,7 @@ export {
|
|
|
1684
1910
|
CanvasToolbar,
|
|
1685
1911
|
DelayEdge,
|
|
1686
1912
|
EmailAutomationActiveSwitch,
|
|
1913
|
+
EmailAutomationAddPersonDialog,
|
|
1687
1914
|
EmailAutomationCanvas,
|
|
1688
1915
|
EmailAutomationCanvasInspector,
|
|
1689
1916
|
EmailAutomationCanvasTab,
|