@carlonicora/nextjs-jsonapi 6.8.0 → 6.10.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-D3LDTJCP.mjs → BlockNoteEditor-GK3DRTOP.mjs} +51 -17
- package/dist/BlockNoteEditor-GK3DRTOP.mjs.map +1 -0
- package/dist/{BlockNoteEditor-FB6FQFRF.js → BlockNoteEditor-YOKJOVV3.js} +74 -40
- package/dist/BlockNoteEditor-YOKJOVV3.js.map +1 -0
- package/dist/{BlockNoteViewer-LGFMGTYX.js → BlockNoteViewer-EKAWVLIR.js} +3 -3
- package/dist/{BlockNoteViewer-LGFMGTYX.js.map → BlockNoteViewer-EKAWVLIR.js.map} +1 -1
- package/dist/{BlockNoteViewer-YSPYUDZE.mjs → BlockNoteViewer-RWRI3QO2.mjs} +2 -2
- package/dist/{HandbookSectionInterface-BYsmnPEz.d.mts → HandbookSectionInterface-BPgqqwgw.d.mts} +20 -1
- package/dist/{HandbookSectionInterface-OePKPbqN.d.ts → HandbookSectionInterface-_51oA3om.d.ts} +20 -1
- package/dist/billing/index.js +492 -492
- package/dist/billing/index.mjs +3 -3
- package/dist/{chunk-D44UDP4G.mjs → chunk-3TNGKMJU.mjs} +2 -2
- package/dist/{chunk-UT4GVYJE.js → chunk-4UFMLTL2.js} +1387 -955
- package/dist/chunk-4UFMLTL2.js.map +1 -0
- package/dist/{chunk-VT5HRZH7.mjs → chunk-6HFRXEF5.mjs} +326 -3
- package/dist/chunk-6HFRXEF5.mjs.map +1 -0
- package/dist/{chunk-5HBFQEYU.mjs → chunk-AWLTSKMM.mjs} +2 -2
- package/dist/{chunk-TL5O7EGW.mjs → chunk-DPAM7BCE.mjs} +2 -2
- package/dist/{chunk-PSLT5JLE.js → chunk-G3YKDIAL.js} +3 -3
- package/dist/{chunk-PSLT5JLE.js.map → chunk-G3YKDIAL.js.map} +1 -1
- package/dist/{chunk-ZXK2OMCC.js → chunk-KRQRJA4J.js} +8 -8
- package/dist/{chunk-ZXK2OMCC.js.map → chunk-KRQRJA4J.js.map} +1 -1
- package/dist/{chunk-JHT32ODN.js → chunk-RNZ3IK5J.js} +4 -4
- package/dist/{chunk-JHT32ODN.js.map → chunk-RNZ3IK5J.js.map} +1 -1
- package/dist/{chunk-UZP7KRAV.js → chunk-SQTXJPRE.js} +500 -177
- package/dist/chunk-SQTXJPRE.js.map +1 -0
- package/dist/{chunk-5HTX4RDA.mjs → chunk-THZAK7S3.mjs} +1743 -1311
- package/dist/chunk-THZAK7S3.mjs.map +1 -0
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +69 -8
- package/dist/components/index.d.ts +69 -8
- package/dist/components/index.js +14 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +13 -3
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +134 -3
- package/dist/core/index.d.ts +134 -3
- package/dist/core/index.js +24 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +23 -1
- package/dist/email-automations/index.d.mts +6 -1
- package/dist/email-automations/index.d.ts +6 -1
- package/dist/email-automations/index.js +101 -94
- package/dist/email-automations/index.js.map +1 -1
- package/dist/email-automations/index.mjs +12 -5
- 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 +4 -4
- package/dist/features/analytics/server.mjs +2 -2
- package/dist/features/blog/index.js +150 -150
- package/dist/features/blog/index.mjs +3 -3
- package/dist/features/blog/server.js +16 -16
- package/dist/features/blog/server.mjs +1 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +127 -127
- package/dist/features/tokenusage/index.mjs +4 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +25 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/messages/en.json +62 -0
- package/messages/it.json +62 -0
- package/package.json +1 -1
- package/src/components/editors/BlockNoteEditor.tsx +69 -14
- package/src/components/editors/__tests__/BlockNoteEditor.ai.spec.tsx +295 -0
- package/src/components/index.ts +1 -0
- package/src/core/index.ts +3 -0
- package/src/core/registry/ModuleRegistry.ts +4 -0
- package/src/features/assistant/components/containers/AssistantPageContainer.tsx +20 -9
- package/src/features/assistant/components/containers/__tests__/AssistantPageContainer.spec.tsx +116 -0
- package/src/features/assistant/components/parts/AssistantThread.tsx +2 -1
- package/src/features/assistant-message/components/MessageItem.tsx +1 -1
- package/src/features/assistant-message/components/MessageList.tsx +1 -1
- package/src/features/assistant-message/components/parts/MessageSourcesContainer.tsx +1 -1
- package/src/features/assistant-message/components/parts/MessageSourcesPanel.tsx +1 -1
- package/src/features/assistant-message/components/parts/__tests__/MessageSourcesPanel.spec.tsx +17 -1
- package/src/features/assistant-message/components/parts/__tests__/SuggestedQuestionsTab.spec.tsx +22 -0
- package/src/features/assistant-message/components/parts/tabs/SuggestedQuestionsTab.tsx +5 -3
- package/src/features/email-automation/components/unsubscribe/EmailUnsubscribe.tsx +14 -2
- package/src/features/email-blast/EmailBlastAudienceModule.ts +12 -0
- package/src/features/email-blast/EmailBlastDeliveryModule.ts +12 -0
- package/src/features/email-blast/EmailBlastModule.ts +28 -0
- package/src/features/email-blast/components/containers/EmailBlastContainer.tsx +145 -0
- package/src/features/email-blast/components/containers/EmailBlastsListContainer.tsx +36 -0
- package/src/features/email-blast/components/forms/EmailBlastEditor.tsx +132 -0
- package/src/features/email-blast/components/forms/EmailBlastSendDialog.tsx +104 -0
- package/src/features/email-blast/components/index.ts +5 -0
- package/src/features/email-blast/components/lists/EmailBlastsList.tsx +57 -0
- package/src/features/email-blast/data/EmailBlast.ts +89 -0
- package/src/features/email-blast/data/EmailBlastAudience.ts +22 -0
- package/src/features/email-blast/data/EmailBlastAudienceInterface.ts +5 -0
- package/src/features/email-blast/data/EmailBlastDelivery.ts +36 -0
- package/src/features/email-blast/data/EmailBlastDeliveryInterface.ts +7 -0
- package/src/features/email-blast/data/EmailBlastDeliveryService.ts +25 -0
- package/src/features/email-blast/data/EmailBlastInterface.ts +22 -0
- package/src/features/email-blast/data/EmailBlastService.ts +101 -0
- package/src/features/email-blast/data/__tests__/EmailBlast.spec.ts +73 -0
- package/src/features/email-blast/data/email-blast.fields.ts +8 -0
- package/src/features/email-blast/data/email-blast.segments.ts +10 -0
- package/src/features/email-blast/data/index.ts +10 -0
- package/src/features/email-blast/hooks/useEmailBlastTableStructure.tsx +104 -0
- package/src/features/email-blast/index.ts +4 -0
- package/src/features/index.ts +1 -0
- package/dist/BlockNoteEditor-D3LDTJCP.mjs.map +0 -1
- package/dist/BlockNoteEditor-FB6FQFRF.js.map +0 -1
- package/dist/chunk-5HTX4RDA.mjs.map +0 -1
- package/dist/chunk-UT4GVYJE.js.map +0 -1
- package/dist/chunk-UZP7KRAV.js.map +0 -1
- package/dist/chunk-VT5HRZH7.mjs.map +0 -1
- /package/dist/{BlockNoteViewer-YSPYUDZE.mjs.map → BlockNoteViewer-RWRI3QO2.mjs.map} +0 -0
- /package/dist/{chunk-D44UDP4G.mjs.map → chunk-3TNGKMJU.mjs.map} +0 -0
- /package/dist/{chunk-5HBFQEYU.mjs.map → chunk-AWLTSKMM.mjs.map} +0 -0
- /package/dist/{chunk-TL5O7EGW.mjs.map → chunk-DPAM7BCE.mjs.map} +0 -0
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
35
|
-
require('../chunk-
|
|
34
|
+
var _chunk4UFMLTL2js = require('../chunk-4UFMLTL2.js');
|
|
35
|
+
require('../chunk-KRQRJA4J.js');
|
|
36
36
|
require('../chunk-G4JR3SFV.js');
|
|
37
37
|
|
|
38
38
|
|
|
@@ -44,7 +44,8 @@ require('../chunk-G4JR3SFV.js');
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
var _chunkSQTXJPREjs = require('../chunk-SQTXJPRE.js');
|
|
48
49
|
require('../chunk-GHE4VT2R.js');
|
|
49
50
|
require('../chunk-LXKSUWAV.js');
|
|
50
51
|
require('../chunk-JTPRJNT2.js');
|
|
@@ -80,12 +81,12 @@ function EmailAutomationEditorInternal({
|
|
|
80
81
|
onDialogOpenChange
|
|
81
82
|
}) {
|
|
82
83
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
83
|
-
const router =
|
|
84
|
+
const router = _chunkSQTXJPREjs.useI18nRouter.call(void 0, );
|
|
84
85
|
const isEdit = !!automation;
|
|
85
86
|
const [triggers, setTriggers] = _react.useState.call(void 0, []);
|
|
86
87
|
_react.useEffect.call(void 0, () => {
|
|
87
88
|
let active = true;
|
|
88
|
-
|
|
89
|
+
_chunkSQTXJPREjs.EmailAutomationService.findTriggers().then((list) => {
|
|
89
90
|
if (active) setTriggers(list);
|
|
90
91
|
}).catch(() => {
|
|
91
92
|
});
|
|
@@ -123,14 +124,14 @@ function EmailAutomationEditorInternal({
|
|
|
123
124
|
defaultValues: getDefaultValues()
|
|
124
125
|
});
|
|
125
126
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
126
|
-
|
|
127
|
+
_chunk4UFMLTL2js.EditorSheet,
|
|
127
128
|
{
|
|
128
129
|
form,
|
|
129
130
|
entityType: t("emailAutomations.admin.title"),
|
|
130
131
|
entityName: _optionalChain([automation, 'optionalAccess', _7 => _7.name]),
|
|
131
132
|
title: isEdit ? t("emailAutomations.admin.editAutomation") : t("emailAutomations.admin.newAutomation"),
|
|
132
133
|
isEdit,
|
|
133
|
-
module:
|
|
134
|
+
module: _chunkSQTXJPREjs.Modules.EmailAutomation,
|
|
134
135
|
size: "md",
|
|
135
136
|
propagateChanges,
|
|
136
137
|
onSuccess,
|
|
@@ -144,7 +145,7 @@ function EmailAutomationEditorInternal({
|
|
|
144
145
|
replyTo: values.replyTo || void 0,
|
|
145
146
|
isActive: values.isActive
|
|
146
147
|
};
|
|
147
|
-
return isEdit ? await
|
|
148
|
+
return isEdit ? await _chunkSQTXJPREjs.EmailAutomationService.update(payload) : await _chunkSQTXJPREjs.EmailAutomationService.create(payload);
|
|
148
149
|
},
|
|
149
150
|
onReset: getDefaultValues,
|
|
150
151
|
trigger,
|
|
@@ -153,9 +154,9 @@ function EmailAutomationEditorInternal({
|
|
|
153
154
|
dialogOpen,
|
|
154
155
|
onDialogOpenChange,
|
|
155
156
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
156
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
157
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.FormInput, { form, id: "name", name: t("emailAutomations.fields.name.label"), isRequired: true }),
|
|
157
158
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
158
|
-
|
|
159
|
+
_chunk4UFMLTL2js.FormSelect,
|
|
159
160
|
{
|
|
160
161
|
form,
|
|
161
162
|
id: "trigger",
|
|
@@ -166,7 +167,7 @@ function EmailAutomationEditorInternal({
|
|
|
166
167
|
}
|
|
167
168
|
),
|
|
168
169
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
169
|
-
|
|
170
|
+
_chunk4UFMLTL2js.FormSelect,
|
|
170
171
|
{
|
|
171
172
|
form,
|
|
172
173
|
id: "exitTrigger",
|
|
@@ -176,9 +177,9 @@ function EmailAutomationEditorInternal({
|
|
|
176
177
|
allowEmpty: true
|
|
177
178
|
}
|
|
178
179
|
),
|
|
179
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
180
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.FormInput, { form, id: "replyTo", name: t("emailAutomations.fields.replyTo.label") }),
|
|
180
181
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
181
|
-
|
|
182
|
+
_chunk4UFMLTL2js.FormSwitch,
|
|
182
183
|
{
|
|
183
184
|
form,
|
|
184
185
|
id: "isActive",
|
|
@@ -202,14 +203,14 @@ var EmailAutomationEditor_default = EmailAutomationEditor;
|
|
|
202
203
|
function EmailAutomationsList({ fullWidth } = {}) {
|
|
203
204
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
204
205
|
const [triggers, setTriggers] = _react.useState.call(void 0, []);
|
|
205
|
-
const data =
|
|
206
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
206
|
+
const data = _chunk4UFMLTL2js.useDataListRetriever.call(void 0, {
|
|
207
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkSQTXJPREjs.EmailAutomationService.findMany(params), "retriever"),
|
|
207
208
|
retrieverParams: {},
|
|
208
|
-
module:
|
|
209
|
+
module: _chunkSQTXJPREjs.Modules.EmailAutomation
|
|
209
210
|
});
|
|
210
211
|
_react.useEffect.call(void 0, () => {
|
|
211
212
|
let active = true;
|
|
212
|
-
|
|
213
|
+
_chunkSQTXJPREjs.EmailAutomationService.findTriggers().then((list) => {
|
|
213
214
|
if (active) setTriggers(list);
|
|
214
215
|
}).catch(() => {
|
|
215
216
|
});
|
|
@@ -223,7 +224,7 @@ function EmailAutomationsList({ fullWidth } = {}) {
|
|
|
223
224
|
);
|
|
224
225
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, EmailAutomationEditor_default, {}, "create-email-automation")];
|
|
225
226
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
226
|
-
|
|
227
|
+
_chunk4UFMLTL2js.ContentListTable,
|
|
227
228
|
{
|
|
228
229
|
data,
|
|
229
230
|
fields: [
|
|
@@ -235,12 +236,12 @@ function EmailAutomationsList({ fullWidth } = {}) {
|
|
|
235
236
|
"completed" /* completed */,
|
|
236
237
|
"unsubscribed" /* unsubscribed */
|
|
237
238
|
],
|
|
238
|
-
tableGeneratorType:
|
|
239
|
+
tableGeneratorType: _chunkSQTXJPREjs.Modules.EmailAutomation,
|
|
239
240
|
functions,
|
|
240
241
|
fullWidth,
|
|
241
242
|
title: t("emailAutomations.admin.title"),
|
|
242
243
|
context: { triggerLabels },
|
|
243
|
-
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
244
|
+
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.EmptyState, { icon: _lucidereact.MailIcon, title: t("emailAutomations.admin.empty") })
|
|
244
245
|
}
|
|
245
246
|
);
|
|
246
247
|
}
|
|
@@ -251,7 +252,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, EmailAutomationsList, "EmailAutomationsList
|
|
|
251
252
|
function EmailAutomationsListContainer() {
|
|
252
253
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
253
254
|
const breadcrumbs = [{ name: t("emailAutomations.admin.title") }];
|
|
254
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
255
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SharedProvider, { value: { breadcrumbs, title: { type: t("emailAutomations.admin.title") } }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.RoundPageContainer, { module: _chunkSQTXJPREjs.Modules.EmailAutomation, fullWidth: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EmailAutomationsList, { fullWidth: true }) }) });
|
|
255
256
|
}
|
|
256
257
|
_chunk7QVYU63Ejs.__name.call(void 0, EmailAutomationsListContainer, "EmailAutomationsListContainer");
|
|
257
258
|
|
|
@@ -270,8 +271,8 @@ var EmailAutomationProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
270
271
|
const [selectedStepId, setSelectedStepId] = _react.useState.call(void 0, null);
|
|
271
272
|
const reload = _react.useCallback.call(void 0, async () => {
|
|
272
273
|
const [loadedAutomation, loadedSteps] = await Promise.all([
|
|
273
|
-
|
|
274
|
-
|
|
274
|
+
_chunkSQTXJPREjs.EmailAutomationService.findOne({ id: automationId }),
|
|
275
|
+
_chunkSQTXJPREjs.EmailAutomationStepService.findByAutomation({ automationId })
|
|
275
276
|
]);
|
|
276
277
|
setAutomation(loadedAutomation);
|
|
277
278
|
setSteps(loadedSteps);
|
|
@@ -281,7 +282,7 @@ var EmailAutomationProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
281
282
|
}, [reload]);
|
|
282
283
|
_react.useEffect.call(void 0, () => {
|
|
283
284
|
let active = true;
|
|
284
|
-
|
|
285
|
+
_chunkSQTXJPREjs.EmailAutomationService.findTriggers().then((list) => {
|
|
285
286
|
if (active) setTriggers(list);
|
|
286
287
|
}).catch(() => {
|
|
287
288
|
});
|
|
@@ -292,7 +293,7 @@ var EmailAutomationProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
292
293
|
const select = _react.useCallback.call(void 0, (id) => setSelectedStepId(id), []);
|
|
293
294
|
const createStep = _react.useCallback.call(void 0,
|
|
294
295
|
async (input) => {
|
|
295
|
-
const saved = await
|
|
296
|
+
const saved = await _chunkSQTXJPREjs.EmailAutomationStepService.create({ ...input, id: _nullishCoalesce(input.id, () => ( _uuid.v4.call(void 0, ))), automationId });
|
|
296
297
|
await reload();
|
|
297
298
|
return saved;
|
|
298
299
|
},
|
|
@@ -300,7 +301,7 @@ var EmailAutomationProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
300
301
|
);
|
|
301
302
|
const updateStep = _react.useCallback.call(void 0,
|
|
302
303
|
async (input) => {
|
|
303
|
-
const saved = await
|
|
304
|
+
const saved = await _chunkSQTXJPREjs.EmailAutomationStepService.update({ ...input, automationId });
|
|
304
305
|
await reload();
|
|
305
306
|
return saved;
|
|
306
307
|
},
|
|
@@ -308,7 +309,7 @@ var EmailAutomationProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
308
309
|
);
|
|
309
310
|
const deleteStep = _react.useCallback.call(void 0,
|
|
310
311
|
async (id) => {
|
|
311
|
-
await
|
|
312
|
+
await _chunkSQTXJPREjs.EmailAutomationStepService.delete({ id });
|
|
312
313
|
if (selectedStepId === id) setSelectedStepId(null);
|
|
313
314
|
await reload();
|
|
314
315
|
},
|
|
@@ -316,8 +317,8 @@ var EmailAutomationProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
316
317
|
);
|
|
317
318
|
const setNext = _react.useCallback.call(void 0,
|
|
318
319
|
async (stepId, nextStepId) => {
|
|
319
|
-
if (nextStepId) await
|
|
320
|
-
else await
|
|
320
|
+
if (nextStepId) await _chunkSQTXJPREjs.EmailAutomationStepService.setNext({ stepId, nextStepId });
|
|
321
|
+
else await _chunkSQTXJPREjs.EmailAutomationStepService.clearNext({ stepId });
|
|
321
322
|
await reload();
|
|
322
323
|
},
|
|
323
324
|
[reload]
|
|
@@ -326,7 +327,7 @@ var EmailAutomationProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
326
327
|
async (stepId, x, y) => {
|
|
327
328
|
const step = steps.find((candidate) => candidate.id === stepId);
|
|
328
329
|
if (!step) return;
|
|
329
|
-
await
|
|
330
|
+
await _chunkSQTXJPREjs.EmailAutomationStepService.update({
|
|
330
331
|
id: step.id,
|
|
331
332
|
automationId,
|
|
332
333
|
subject: step.subject,
|
|
@@ -340,7 +341,7 @@ var EmailAutomationProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void
|
|
|
340
341
|
[automationId, reload, steps]
|
|
341
342
|
);
|
|
342
343
|
const tidy = _react.useCallback.call(void 0, async () => {
|
|
343
|
-
await
|
|
344
|
+
await _chunkSQTXJPREjs.EmailAutomationService.tidy({ id: automationId });
|
|
344
345
|
await reload();
|
|
345
346
|
}, [automationId, reload]);
|
|
346
347
|
const value = _react.useMemo.call(void 0,
|
|
@@ -395,7 +396,7 @@ function EmailAutomationActiveSwitch() {
|
|
|
395
396
|
const toggle = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (checked) => {
|
|
396
397
|
setSaving(true);
|
|
397
398
|
try {
|
|
398
|
-
await
|
|
399
|
+
await _chunkSQTXJPREjs.EmailAutomationService.update({
|
|
399
400
|
id: automation.id,
|
|
400
401
|
name: automation.name,
|
|
401
402
|
trigger: automation.trigger,
|
|
@@ -405,17 +406,17 @@ function EmailAutomationActiveSwitch() {
|
|
|
405
406
|
});
|
|
406
407
|
await reload();
|
|
407
408
|
} catch (error) {
|
|
408
|
-
|
|
409
|
+
_chunk4UFMLTL2js.errorToast.call(void 0, { title: t("common.errors.error"), error });
|
|
409
410
|
} finally {
|
|
410
411
|
setSaving(false);
|
|
411
412
|
}
|
|
412
413
|
}, "toggle");
|
|
413
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
414
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
415
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
414
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Tooltip, { children: [
|
|
415
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.TooltipTrigger, { render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { className: "flex items-center gap-x-2" }), children: [
|
|
416
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Switch, { checked: automation.isActive, onCheckedChange: (checked) => void toggle(checked), disabled: saving }),
|
|
416
417
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-xs", children: t("emailAutomations.fields.isActive.label") })
|
|
417
418
|
] }),
|
|
418
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
419
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.TooltipContent, { className: "max-w-xs", children: t("emailAutomations.fields.isActive.help") })
|
|
419
420
|
] });
|
|
420
421
|
}
|
|
421
422
|
_chunk7QVYU63Ejs.__name.call(void 0, EmailAutomationActiveSwitch, "EmailAutomationActiveSwitch");
|
|
@@ -448,7 +449,7 @@ function CanvasToolbar({ onTidy }) {
|
|
|
448
449
|
const { zoomIn, zoomOut, fitView } = _react3.useReactFlow.call(void 0, );
|
|
449
450
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { "data-help": "canvas.toolbar", className: "absolute end-2 top-2 z-10 flex flex-col gap-1 max-md:top-14", children: [
|
|
450
451
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
451
|
-
|
|
452
|
+
_chunk4UFMLTL2js.Button,
|
|
452
453
|
{
|
|
453
454
|
type: "button",
|
|
454
455
|
variant: "outline",
|
|
@@ -459,7 +460,7 @@ function CanvasToolbar({ onTidy }) {
|
|
|
459
460
|
}
|
|
460
461
|
),
|
|
461
462
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
462
|
-
|
|
463
|
+
_chunk4UFMLTL2js.Button,
|
|
463
464
|
{
|
|
464
465
|
type: "button",
|
|
465
466
|
variant: "outline",
|
|
@@ -470,7 +471,7 @@ function CanvasToolbar({ onTidy }) {
|
|
|
470
471
|
}
|
|
471
472
|
),
|
|
472
473
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
473
|
-
|
|
474
|
+
_chunk4UFMLTL2js.Button,
|
|
474
475
|
{
|
|
475
476
|
type: "button",
|
|
476
477
|
variant: "outline",
|
|
@@ -481,7 +482,7 @@ function CanvasToolbar({ onTidy }) {
|
|
|
481
482
|
}
|
|
482
483
|
),
|
|
483
484
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
484
|
-
|
|
485
|
+
_chunk4UFMLTL2js.Button,
|
|
485
486
|
{
|
|
486
487
|
type: "button",
|
|
487
488
|
variant: "outline",
|
|
@@ -772,14 +773,14 @@ function EmailStepEditorInternal({
|
|
|
772
773
|
defaultValues: getDefaultValues()
|
|
773
774
|
});
|
|
774
775
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
775
|
-
|
|
776
|
+
_chunk4UFMLTL2js.EditorSheet,
|
|
776
777
|
{
|
|
777
778
|
form,
|
|
778
779
|
entityType: t("emailAutomations.step.title"),
|
|
779
780
|
entityName: _optionalChain([step, 'optionalAccess', _18 => _18.subject]),
|
|
780
781
|
title: isEdit ? t("emailAutomations.step.editTitle") : t("emailAutomations.step.title"),
|
|
781
782
|
isEdit,
|
|
782
|
-
module:
|
|
783
|
+
module: _chunkSQTXJPREjs.Modules.EmailAutomationStep,
|
|
783
784
|
size: "lg",
|
|
784
785
|
onSubmit: async (values) => {
|
|
785
786
|
const payload = {
|
|
@@ -791,7 +792,7 @@ function EmailStepEditorInternal({
|
|
|
791
792
|
positionX: step ? step.positionX : _optionalChain([initialPosition, 'optionalAccess', _19 => _19.x]),
|
|
792
793
|
positionY: step ? step.positionY : _optionalChain([initialPosition, 'optionalAccess', _20 => _20.y])
|
|
793
794
|
};
|
|
794
|
-
return isEdit ? await
|
|
795
|
+
return isEdit ? await _chunkSQTXJPREjs.EmailAutomationStepService.update(payload) : await _chunkSQTXJPREjs.EmailAutomationStepService.create(payload);
|
|
795
796
|
},
|
|
796
797
|
onSuccess: async () => {
|
|
797
798
|
await reload();
|
|
@@ -804,9 +805,9 @@ function EmailStepEditorInternal({
|
|
|
804
805
|
dialogOpen,
|
|
805
806
|
onDialogOpenChange,
|
|
806
807
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
807
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
808
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.FormInput, { form, id: "subject", name: t("emailAutomations.step.fields.subject.label"), isRequired: true }),
|
|
808
809
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
809
|
-
|
|
810
|
+
_chunk4UFMLTL2js.FormInput,
|
|
810
811
|
{
|
|
811
812
|
form,
|
|
812
813
|
id: "delayHours",
|
|
@@ -816,7 +817,7 @@ function EmailStepEditorInternal({
|
|
|
816
817
|
}
|
|
817
818
|
),
|
|
818
819
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
819
|
-
|
|
820
|
+
_chunk4UFMLTL2js.FormTextarea,
|
|
820
821
|
{
|
|
821
822
|
form,
|
|
822
823
|
id: "body",
|
|
@@ -956,7 +957,7 @@ var stepIdOf = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (nodeId) =>
|
|
|
956
957
|
function EmailAutomationCanvas() {
|
|
957
958
|
const { automation, steps, triggers, select, reload, createStep, deleteStep, setNext, updatePosition, tidy } = useEmailAutomation();
|
|
958
959
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
959
|
-
const isMobile =
|
|
960
|
+
const isMobile = _chunkSQTXJPREjs.useIsMobile.call(void 0, );
|
|
960
961
|
const [nodes, setNodes] = _react.useState.call(void 0, []);
|
|
961
962
|
const [edges, setEdges] = _react.useState.call(void 0, []);
|
|
962
963
|
const { screenToFlowPosition } = _react3.useReactFlow.call(void 0, );
|
|
@@ -995,7 +996,7 @@ function EmailAutomationCanvas() {
|
|
|
995
996
|
try {
|
|
996
997
|
await setNext(stepId, nextStepId);
|
|
997
998
|
} catch (error) {
|
|
998
|
-
|
|
999
|
+
_chunk4UFMLTL2js.errorToast.call(void 0, { title: t("emailAutomations.canvas.chainError"), error });
|
|
999
1000
|
await reload();
|
|
1000
1001
|
}
|
|
1001
1002
|
},
|
|
@@ -1009,7 +1010,7 @@ function EmailAutomationCanvas() {
|
|
|
1009
1010
|
if (!_optionalChain([conn, 'access', _29 => _29.targetHandle, 'optionalAccess', _30 => _30.startsWith, 'call', _31 => _31(STEP_TARGET_HANDLE_PREFIX)])) return;
|
|
1010
1011
|
const targetStepId = conn.targetHandle.slice(STEP_TARGET_HANDLE_PREFIX.length);
|
|
1011
1012
|
if (from.handleId === TRIGGER_SOURCE_HANDLE) {
|
|
1012
|
-
|
|
1013
|
+
_chunkSQTXJPREjs.showError.call(void 0, t("emailAutomations.canvas.chainError"));
|
|
1013
1014
|
return;
|
|
1014
1015
|
}
|
|
1015
1016
|
if (!from.handleId.startsWith(STEP_SOURCE_HANDLE_PREFIX)) return;
|
|
@@ -1127,7 +1128,7 @@ function EmailAutomationCanvas() {
|
|
|
1127
1128
|
try {
|
|
1128
1129
|
await deleteStep(stepId);
|
|
1129
1130
|
} catch (error) {
|
|
1130
|
-
|
|
1131
|
+
_chunk4UFMLTL2js.errorToast.call(void 0, { title: t("emailAutomations.canvas.deleteEmail"), error });
|
|
1131
1132
|
throw error;
|
|
1132
1133
|
}
|
|
1133
1134
|
}, [pendingDeleteStepId, deleteStep, t]);
|
|
@@ -1190,7 +1191,7 @@ function EmailAutomationCanvas() {
|
|
|
1190
1191
|
}
|
|
1191
1192
|
),
|
|
1192
1193
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1193
|
-
|
|
1194
|
+
_chunk4UFMLTL2js.ConfirmDialog,
|
|
1194
1195
|
{
|
|
1195
1196
|
open: pendingDeleteStepId !== null,
|
|
1196
1197
|
onOpenChange: (open) => {
|
|
@@ -1205,20 +1206,20 @@ function EmailAutomationCanvas() {
|
|
|
1205
1206
|
}
|
|
1206
1207
|
),
|
|
1207
1208
|
paneMenu && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1208
|
-
|
|
1209
|
+
_chunk4UFMLTL2js.ContextMenu,
|
|
1209
1210
|
{
|
|
1210
1211
|
open: true,
|
|
1211
1212
|
onOpenChange: (open) => {
|
|
1212
1213
|
if (!open) setPaneMenu(null);
|
|
1213
1214
|
},
|
|
1214
1215
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1215
|
-
|
|
1216
|
+
_chunk4UFMLTL2js.ContextMenuContent,
|
|
1216
1217
|
{
|
|
1217
1218
|
anchor: pointAnchor(paneMenu.screenX, paneMenu.screenY),
|
|
1218
1219
|
side: "bottom",
|
|
1219
1220
|
align: "start",
|
|
1220
1221
|
sideOffset: 4,
|
|
1221
|
-
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1222
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.ContextMenuItem, { onClick: handleCreateStepFromPane, children: [
|
|
1222
1223
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.PlusIcon, {}),
|
|
1223
1224
|
t("emailAutomations.canvas.addEmail")
|
|
1224
1225
|
] })
|
|
@@ -1227,21 +1228,21 @@ function EmailAutomationCanvas() {
|
|
|
1227
1228
|
}
|
|
1228
1229
|
),
|
|
1229
1230
|
nodeMenu && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1230
|
-
|
|
1231
|
+
_chunk4UFMLTL2js.ContextMenu,
|
|
1231
1232
|
{
|
|
1232
1233
|
open: true,
|
|
1233
1234
|
onOpenChange: (open) => {
|
|
1234
1235
|
if (!open) setNodeMenu(null);
|
|
1235
1236
|
},
|
|
1236
1237
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1237
|
-
|
|
1238
|
+
_chunk4UFMLTL2js.ContextMenuContent,
|
|
1238
1239
|
{
|
|
1239
1240
|
anchor: pointAnchor(nodeMenu.screenX, nodeMenu.screenY),
|
|
1240
1241
|
side: "bottom",
|
|
1241
1242
|
align: "start",
|
|
1242
1243
|
sideOffset: 4,
|
|
1243
1244
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1244
|
-
|
|
1245
|
+
_chunk4UFMLTL2js.ContextMenuItem,
|
|
1245
1246
|
{
|
|
1246
1247
|
onClick: () => {
|
|
1247
1248
|
const menu = nodeMenu;
|
|
@@ -1282,7 +1283,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, TriggerAutomationEditor, "TriggerAutomation
|
|
|
1282
1283
|
// src/features/email-automation/components/canvas/EmailAutomationCanvasTab.tsx
|
|
1283
1284
|
|
|
1284
1285
|
function EmailAutomationCanvasTab() {
|
|
1285
|
-
const { open, setOpen } =
|
|
1286
|
+
const { open, setOpen } = _chunk4UFMLTL2js.useSidebar.call(void 0, );
|
|
1286
1287
|
_react.useEffect.call(void 0, () => {
|
|
1287
1288
|
const prev = open;
|
|
1288
1289
|
if (prev) setOpen(false);
|
|
@@ -1303,10 +1304,10 @@ function EmailAutomationRecipientsList() {
|
|
|
1303
1304
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1304
1305
|
const { automation } = useEmailAutomation();
|
|
1305
1306
|
const [statusFilter, setStatusFilter] = _react.useState.call(void 0, "all");
|
|
1306
|
-
const data =
|
|
1307
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
1307
|
+
const data = _chunk4UFMLTL2js.useDataListRetriever.call(void 0, {
|
|
1308
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkSQTXJPREjs.EmailAutomationService.findEnrollments(params), "retriever"),
|
|
1308
1309
|
retrieverParams: { automationId: _optionalChain([automation, 'optionalAccess', _44 => _44.id]) },
|
|
1309
|
-
module:
|
|
1310
|
+
module: _chunkSQTXJPREjs.Modules.EmailAutomationEnrollment
|
|
1310
1311
|
});
|
|
1311
1312
|
const handleStatusChange = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => {
|
|
1312
1313
|
const status = _nullishCoalesce(value, () => ( "all"));
|
|
@@ -1325,21 +1326,21 @@ function EmailAutomationRecipientsList() {
|
|
|
1325
1326
|
[t]
|
|
1326
1327
|
);
|
|
1327
1328
|
const filters = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4", children: [
|
|
1328
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1329
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1330
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1331
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1332
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1333
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1334
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1335
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1336
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1329
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Select, { items: statusItems, value: statusFilter, onValueChange: handleStatusChange, children: [
|
|
1330
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectTrigger, { className: "w-40", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectValue, {}) }),
|
|
1331
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.SelectContent, { children: [
|
|
1332
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectItem, { value: "all", children: t("emailAutomations.recipients.status.all") }),
|
|
1333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectItem, { value: "active", children: t("emailAutomations.recipients.status.active") }),
|
|
1334
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectItem, { value: "completed", children: t("emailAutomations.recipients.status.completed") }),
|
|
1335
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectItem, { value: "unsubscribed", children: t("emailAutomations.recipients.status.unsubscribed") }),
|
|
1336
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectItem, { value: "exited", children: t("emailAutomations.recipients.status.exited") }),
|
|
1337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SelectItem, { value: "failed", children: t("emailAutomations.recipients.status.failed") })
|
|
1337
1338
|
] })
|
|
1338
1339
|
] }),
|
|
1339
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1340
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Button, { variant: "outline", size: "icon", onClick: () => void data.refresh(), disabled: !data.isLoaded, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: `h-4 w-4 ${!data.isLoaded ? "animate-spin" : ""}` }) })
|
|
1340
1341
|
] });
|
|
1341
1342
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1342
|
-
|
|
1343
|
+
_chunk4UFMLTL2js.ContentListTable,
|
|
1343
1344
|
{
|
|
1344
1345
|
data,
|
|
1345
1346
|
fields: [
|
|
@@ -1350,7 +1351,7 @@ function EmailAutomationRecipientsList() {
|
|
|
1350
1351
|
"nextSendAt" /* nextSendAt */,
|
|
1351
1352
|
"sentCount" /* sentCount */
|
|
1352
1353
|
],
|
|
1353
|
-
tableGeneratorType:
|
|
1354
|
+
tableGeneratorType: _chunkSQTXJPREjs.Modules.EmailAutomationEnrollment,
|
|
1354
1355
|
filters,
|
|
1355
1356
|
allowSearch: false,
|
|
1356
1357
|
emptyState: t("emailAutomations.recipients.empty")
|
|
@@ -1367,15 +1368,15 @@ function EmailAutomationContainer({ automationId }) {
|
|
|
1367
1368
|
_chunk7QVYU63Ejs.__name.call(void 0, EmailAutomationContainer, "EmailAutomationContainer");
|
|
1368
1369
|
function EmailAutomationShell() {
|
|
1369
1370
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1370
|
-
const generateUrl =
|
|
1371
|
+
const generateUrl = _chunk4UFMLTL2js.usePageUrlGenerator.call(void 0, );
|
|
1371
1372
|
const { automation, reload } = useEmailAutomation();
|
|
1372
1373
|
if (!automation) return null;
|
|
1373
1374
|
const breadcrumbs = [
|
|
1374
|
-
{ name: t("emailAutomations.admin.title"), href: generateUrl({ page:
|
|
1375
|
+
{ name: t("emailAutomations.admin.title"), href: generateUrl({ page: _chunkSQTXJPREjs.Modules.EmailAutomation }) },
|
|
1375
1376
|
{ name: automation.name }
|
|
1376
1377
|
];
|
|
1377
1378
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1378
|
-
|
|
1379
|
+
_chunk4UFMLTL2js.SharedProvider,
|
|
1379
1380
|
{
|
|
1380
1381
|
value: {
|
|
1381
1382
|
breadcrumbs,
|
|
@@ -1389,9 +1390,9 @@ function EmailAutomationShell() {
|
|
|
1389
1390
|
}
|
|
1390
1391
|
},
|
|
1391
1392
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1392
|
-
|
|
1393
|
+
_chunk4UFMLTL2js.RoundPageContainer,
|
|
1393
1394
|
{
|
|
1394
|
-
module:
|
|
1395
|
+
module: _chunkSQTXJPREjs.Modules.EmailAutomation,
|
|
1395
1396
|
id: automation.id,
|
|
1396
1397
|
fullWidth: true,
|
|
1397
1398
|
forceHeader: true,
|
|
@@ -1421,7 +1422,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, EmailAutomationShell, "EmailAutomationShell
|
|
|
1421
1422
|
|
|
1422
1423
|
|
|
1423
1424
|
|
|
1424
|
-
function EmailUnsubscribe({ token, scope }) {
|
|
1425
|
+
function EmailUnsubscribe({ token, scope, source = "automation" }) {
|
|
1425
1426
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1426
1427
|
const [state, setState] = _react.useState.call(void 0, "loading");
|
|
1427
1428
|
const [stoppedScope, setStoppedScope] = _react.useState.call(void 0, scope);
|
|
@@ -1430,7 +1431,13 @@ function EmailUnsubscribe({ token, scope }) {
|
|
|
1430
1431
|
_react.useEffect.call(void 0, () => {
|
|
1431
1432
|
async function unsubscribe() {
|
|
1432
1433
|
try {
|
|
1433
|
-
|
|
1434
|
+
if (source === "blast") {
|
|
1435
|
+
await _chunkSQTXJPREjs.EmailBlastDeliveryService.unsubscribe({ token });
|
|
1436
|
+
setStoppedScope("all");
|
|
1437
|
+
setState("success");
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1440
|
+
const enrollment = await _chunkSQTXJPREjs.EmailAutomationEnrollmentService.unsubscribe({ token, scope });
|
|
1434
1441
|
setAutomationName(_nullishCoalesce(_optionalChain([enrollment, 'optionalAccess', _45 => _45.automation, 'optionalAccess', _46 => _46.name]), () => ( "")));
|
|
1435
1442
|
setStoppedScope(scope);
|
|
1436
1443
|
setState("success");
|
|
@@ -1440,11 +1447,11 @@ function EmailUnsubscribe({ token, scope }) {
|
|
|
1440
1447
|
}
|
|
1441
1448
|
_chunk7QVYU63Ejs.__name.call(void 0, unsubscribe, "unsubscribe");
|
|
1442
1449
|
unsubscribe();
|
|
1443
|
-
}, [token, scope]);
|
|
1450
|
+
}, [token, scope, source]);
|
|
1444
1451
|
const stopAll = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1445
1452
|
setIsStoppingAll(true);
|
|
1446
1453
|
try {
|
|
1447
|
-
await
|
|
1454
|
+
await _chunkSQTXJPREjs.EmailAutomationEnrollmentService.unsubscribe({ token, scope: "all" });
|
|
1448
1455
|
setStoppedScope("all");
|
|
1449
1456
|
} catch (e3) {
|
|
1450
1457
|
setState("error");
|
|
@@ -1461,16 +1468,16 @@ function EmailUnsubscribe({ token, scope }) {
|
|
|
1461
1468
|
if (state === "error") {
|
|
1462
1469
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center space-y-4 py-16 text-center", children: [
|
|
1463
1470
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-destructive/10 rounded-full p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.XCircle, { className: "text-destructive h-12 w-12" }) }),
|
|
1464
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1471
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SectionHeader, { level: 2, children: t("emailAutomations.unsubscribe.invalidTitle") }),
|
|
1465
1472
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground max-w-md text-sm leading-relaxed", children: t("emailAutomations.unsubscribe.invalidBody") })
|
|
1466
1473
|
] });
|
|
1467
1474
|
}
|
|
1468
1475
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center space-y-4 py-16 text-center", children: [
|
|
1469
1476
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-primary/10 rounded-full p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CheckCircle, { className: "text-primary h-12 w-12" }) }),
|
|
1470
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1477
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SectionHeader, { level: 2, children: t("emailAutomations.unsubscribe.title") }),
|
|
1471
1478
|
stoppedScope === "all" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground max-w-md text-sm leading-relaxed", children: t("emailAutomations.unsubscribe.stoppedAll") }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1472
1479
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground max-w-md text-sm leading-relaxed", children: t("emailAutomations.unsubscribe.stoppedAutomation", { name: automationName }) }),
|
|
1473
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1480
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Button, { variant: "secondary", onClick: stopAll, disabled: isStoppingAll, children: [
|
|
1474
1481
|
isStoppingAll && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
1475
1482
|
t("emailAutomations.unsubscribe.alsoStopAll")
|
|
1476
1483
|
] })
|
|
@@ -1485,7 +1492,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, EmailUnsubscribe, "EmailUnsubscribe");
|
|
|
1485
1492
|
|
|
1486
1493
|
var useEmailAutomationTableStructure = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
|
|
1487
1494
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1488
|
-
const generateUrl =
|
|
1495
|
+
const generateUrl = _chunk4UFMLTL2js.usePageUrlGenerator.call(void 0, );
|
|
1489
1496
|
const triggerLabels = _nullishCoalesce(_optionalChain([params, 'access', _47 => _47.context, 'optionalAccess', _48 => _48.triggerLabels]), () => ( {}));
|
|
1490
1497
|
const tableData = _react.useMemo.call(void 0, () => {
|
|
1491
1498
|
return params.data.map((automation) => {
|
|
@@ -1514,7 +1521,7 @@ var useEmailAutomationTableStructure = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.c
|
|
|
1514
1521
|
header: t("emailAutomations.list.columns.name"),
|
|
1515
1522
|
cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => {
|
|
1516
1523
|
const automation = row.original.jsonApiData;
|
|
1517
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1524
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Link, { href: generateUrl({ page: _chunkSQTXJPREjs.Modules.EmailAutomation, id: automation.id }), children: automation.name });
|
|
1518
1525
|
}, "cell"),
|
|
1519
1526
|
enableSorting: false,
|
|
1520
1527
|
enableHiding: false
|
|
@@ -1537,7 +1544,7 @@ var useEmailAutomationTableStructure = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.c
|
|
|
1537
1544
|
header: t("emailAutomations.list.columns.status"),
|
|
1538
1545
|
cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => {
|
|
1539
1546
|
const automation = row.original.jsonApiData;
|
|
1540
|
-
return automation.isActive ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1547
|
+
return automation.isActive ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Badge, { variant: "softGreen", children: t("emailAutomations.list.status.on") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.Badge, { variant: "softGray", children: t("emailAutomations.list.status.off") });
|
|
1541
1548
|
}, "cell"),
|
|
1542
1549
|
enableSorting: false,
|
|
1543
1550
|
enableHiding: false
|
|
@@ -1560,7 +1567,7 @@ var useEmailAutomationTableStructure = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.c
|
|
|
1560
1567
|
}, [params.fields, fieldColumnMap, t, generateUrl]);
|
|
1561
1568
|
return _react.useMemo.call(void 0, () => ({ data: tableData, columns }), [tableData, columns]);
|
|
1562
1569
|
}, "useEmailAutomationTableStructure");
|
|
1563
|
-
|
|
1570
|
+
_chunk4UFMLTL2js.registerTableGenerator.call(void 0, "email-automations", useEmailAutomationTableStructure);
|
|
1564
1571
|
|
|
1565
1572
|
// src/features/email-automation/hooks/useEmailAutomationEnrollmentTableStructure.tsx
|
|
1566
1573
|
|
|
@@ -1575,7 +1582,7 @@ var STATUS_VARIANTS = {
|
|
|
1575
1582
|
};
|
|
1576
1583
|
var useEmailAutomationEnrollmentTableStructure = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
|
|
1577
1584
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1578
|
-
const locale =
|
|
1585
|
+
const locale = _chunkSQTXJPREjs.dateFormatLocale.call(void 0, _nextintl.useLocale.call(void 0, ));
|
|
1579
1586
|
const tableData = _react.useMemo.call(void 0, () => {
|
|
1580
1587
|
return params.data.map((enrollment) => {
|
|
1581
1588
|
const entry = { jsonApiData: enrollment };
|
|
@@ -1616,7 +1623,7 @@ var useEmailAutomationEnrollmentTableStructure = /* @__PURE__ */ _chunk7QVYU63Ej
|
|
|
1616
1623
|
cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => {
|
|
1617
1624
|
const enrollment = row.original.jsonApiData;
|
|
1618
1625
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1619
|
-
|
|
1626
|
+
_chunk4UFMLTL2js.Badge,
|
|
1620
1627
|
{
|
|
1621
1628
|
variant: _nullishCoalesce(STATUS_VARIANTS[enrollment.status], () => ( "softGray")),
|
|
1622
1629
|
title: enrollment.status === "failed" ? enrollment.lastError : void 0,
|
|
@@ -1645,7 +1652,7 @@ var useEmailAutomationEnrollmentTableStructure = /* @__PURE__ */ _chunk7QVYU63Ej
|
|
|
1645
1652
|
cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => {
|
|
1646
1653
|
const enrollment = row.original.jsonApiData;
|
|
1647
1654
|
if (!enrollment.nextSendAt) return empty;
|
|
1648
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-xs tabular-nums", children:
|
|
1655
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-xs tabular-nums", children: _chunkSQTXJPREjs.formatDate.call(void 0, enrollment.nextSendAt, "dateTime", locale) });
|
|
1649
1656
|
}, "cell"),
|
|
1650
1657
|
enableSorting: false,
|
|
1651
1658
|
enableHiding: false
|
|
@@ -1667,7 +1674,7 @@ var useEmailAutomationEnrollmentTableStructure = /* @__PURE__ */ _chunk7QVYU63Ej
|
|
|
1667
1674
|
}, [params.fields, fieldColumnMap, t, locale]);
|
|
1668
1675
|
return _react.useMemo.call(void 0, () => ({ data: tableData, columns }), [tableData, columns]);
|
|
1669
1676
|
}, "useEmailAutomationEnrollmentTableStructure");
|
|
1670
|
-
|
|
1677
|
+
_chunk4UFMLTL2js.registerTableGenerator.call(void 0, "email-automation-enrollments", useEmailAutomationEnrollmentTableStructure);
|
|
1671
1678
|
|
|
1672
1679
|
|
|
1673
1680
|
|