@ixo/editor 1.10.1 → 1.11.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.
|
@@ -1036,14 +1036,15 @@ import { Card as Card2, Checkbox, Group as Group2, Stack as Stack6, Text as Text
|
|
|
1036
1036
|
|
|
1037
1037
|
// src/mantine/utils/iconMap.tsx
|
|
1038
1038
|
import React9 from "react";
|
|
1039
|
-
import { IconSquareCheck, IconFileText, IconCheckbox, IconNote, IconChecklist, IconThumbUp } from "@tabler/icons-react";
|
|
1039
|
+
import { IconSquareCheck, IconFileText, IconCheckbox, IconNote, IconChecklist, IconThumbUp, IconBell } from "@tabler/icons-react";
|
|
1040
1040
|
var ICON_MAP = {
|
|
1041
1041
|
"square-check": IconSquareCheck,
|
|
1042
1042
|
"file-text": IconFileText,
|
|
1043
1043
|
checklist: IconChecklist,
|
|
1044
1044
|
checkbox: IconCheckbox,
|
|
1045
1045
|
note: IconNote,
|
|
1046
|
-
"thumb-up": IconThumbUp
|
|
1046
|
+
"thumb-up": IconThumbUp,
|
|
1047
|
+
bell: IconBell
|
|
1047
1048
|
};
|
|
1048
1049
|
var getIcon = (key, size = 20, stroke = 1.5, fallback = "square-check") => {
|
|
1049
1050
|
const validKey = key in ICON_MAP ? key : fallback;
|
|
@@ -8227,6 +8228,566 @@ var EnumChecklistBlock = createReactBlockSpec6(
|
|
|
8227
8228
|
}
|
|
8228
8229
|
);
|
|
8229
8230
|
|
|
8231
|
+
// src/mantine/blocks/notify/NotifyBlockSpec.tsx
|
|
8232
|
+
import React103 from "react";
|
|
8233
|
+
import { createReactBlockSpec as createReactBlockSpec7 } from "@blocknote/react";
|
|
8234
|
+
|
|
8235
|
+
// src/mantine/blocks/notify/NotifyBlock.tsx
|
|
8236
|
+
import React102 from "react";
|
|
8237
|
+
|
|
8238
|
+
// src/mantine/blocks/notify/template/TemplateView.tsx
|
|
8239
|
+
import React100, { useMemo as useMemo14 } from "react";
|
|
8240
|
+
|
|
8241
|
+
// src/mantine/blocks/notify/template/TemplateConfig.tsx
|
|
8242
|
+
import React99, { useCallback as useCallback17 } from "react";
|
|
8243
|
+
import { Paper as Paper11, CloseButton as CloseButton7, Title as Title7 } from "@mantine/core";
|
|
8244
|
+
|
|
8245
|
+
// src/mantine/blocks/notify/template/GeneralTab.tsx
|
|
8246
|
+
import React98, { useEffect as useEffect17, useState as useState26 } from "react";
|
|
8247
|
+
import { Divider as Divider6, Select as Select11, Stack as Stack74, Text as Text49, TextInput as TextInput36, Textarea as Textarea20, Button as Button24, Group as Group30, ActionIcon as ActionIcon13, Paper as Paper10 } from "@mantine/core";
|
|
8248
|
+
import { IconTrash as IconTrash2, IconPlus as IconPlus2 } from "@tabler/icons-react";
|
|
8249
|
+
var GeneralTab5 = ({
|
|
8250
|
+
title,
|
|
8251
|
+
description,
|
|
8252
|
+
channel,
|
|
8253
|
+
to,
|
|
8254
|
+
cc,
|
|
8255
|
+
bcc,
|
|
8256
|
+
subject,
|
|
8257
|
+
body,
|
|
8258
|
+
bodyType,
|
|
8259
|
+
from,
|
|
8260
|
+
replyTo,
|
|
8261
|
+
onTitleChange,
|
|
8262
|
+
onDescriptionChange,
|
|
8263
|
+
onChannelChange,
|
|
8264
|
+
onToChange,
|
|
8265
|
+
onCcChange,
|
|
8266
|
+
onBccChange,
|
|
8267
|
+
onSubjectChange,
|
|
8268
|
+
onBodyChange,
|
|
8269
|
+
onBodyTypeChange,
|
|
8270
|
+
onFromChange,
|
|
8271
|
+
onReplyToChange
|
|
8272
|
+
}) => {
|
|
8273
|
+
const [localTitle, setLocalTitle] = useState26(title || "");
|
|
8274
|
+
const [localDescription, setLocalDescription] = useState26(description || "");
|
|
8275
|
+
const [localChannel, setLocalChannel] = useState26(channel || "email");
|
|
8276
|
+
const [localTo, setLocalTo] = useState26(to || []);
|
|
8277
|
+
const [localCc, setLocalCc] = useState26(cc || []);
|
|
8278
|
+
const [localBcc, setLocalBcc] = useState26(bcc || []);
|
|
8279
|
+
const [localSubject, setLocalSubject] = useState26(subject || "");
|
|
8280
|
+
const [localBody, setLocalBody] = useState26(body || "");
|
|
8281
|
+
const [localBodyType, setLocalBodyType] = useState26(bodyType || "text");
|
|
8282
|
+
const [localFrom, setLocalFrom] = useState26(from || "");
|
|
8283
|
+
const [localReplyTo, setLocalReplyTo] = useState26(replyTo || "");
|
|
8284
|
+
useEffect17(() => setLocalTitle(title || ""), [title]);
|
|
8285
|
+
useEffect17(() => setLocalDescription(description || ""), [description]);
|
|
8286
|
+
useEffect17(() => setLocalChannel(channel || "email"), [channel]);
|
|
8287
|
+
useEffect17(() => setLocalTo(to || []), [to]);
|
|
8288
|
+
useEffect17(() => setLocalCc(cc || []), [cc]);
|
|
8289
|
+
useEffect17(() => setLocalBcc(bcc || []), [bcc]);
|
|
8290
|
+
useEffect17(() => setLocalSubject(subject || ""), [subject]);
|
|
8291
|
+
useEffect17(() => setLocalBody(body || ""), [body]);
|
|
8292
|
+
useEffect17(() => setLocalBodyType(bodyType || "text"), [bodyType]);
|
|
8293
|
+
useEffect17(() => setLocalFrom(from || ""), [from]);
|
|
8294
|
+
useEffect17(() => setLocalReplyTo(replyTo || ""), [replyTo]);
|
|
8295
|
+
const handleAddRecipient = (type) => {
|
|
8296
|
+
const setter = type === "to" ? setLocalTo : type === "cc" ? setLocalCc : setLocalBcc;
|
|
8297
|
+
const callback = type === "to" ? onToChange : type === "cc" ? onCcChange : onBccChange;
|
|
8298
|
+
const current = type === "to" ? localTo : type === "cc" ? localCc : localBcc;
|
|
8299
|
+
const newRecipients = [...current, ""];
|
|
8300
|
+
setter(newRecipients);
|
|
8301
|
+
callback(newRecipients);
|
|
8302
|
+
};
|
|
8303
|
+
const handleRemoveRecipient = (type, index) => {
|
|
8304
|
+
const setter = type === "to" ? setLocalTo : type === "cc" ? setLocalCc : setLocalBcc;
|
|
8305
|
+
const callback = type === "to" ? onToChange : type === "cc" ? onCcChange : onBccChange;
|
|
8306
|
+
const current = type === "to" ? localTo : type === "cc" ? localCc : localBcc;
|
|
8307
|
+
const newRecipients = current.filter((_, i) => i !== index);
|
|
8308
|
+
setter(newRecipients);
|
|
8309
|
+
callback(newRecipients);
|
|
8310
|
+
};
|
|
8311
|
+
const handleRecipientChange = (type, index, value) => {
|
|
8312
|
+
const setter = type === "to" ? setLocalTo : type === "cc" ? setLocalCc : setLocalBcc;
|
|
8313
|
+
const callback = type === "to" ? onToChange : type === "cc" ? onCcChange : onBccChange;
|
|
8314
|
+
const current = type === "to" ? localTo : type === "cc" ? localCc : localBcc;
|
|
8315
|
+
const newRecipients = [...current];
|
|
8316
|
+
newRecipients[index] = value;
|
|
8317
|
+
setter(newRecipients);
|
|
8318
|
+
callback(newRecipients);
|
|
8319
|
+
};
|
|
8320
|
+
return /* @__PURE__ */ React98.createElement(Stack74, { gap: "lg" }, /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "Title"), /* @__PURE__ */ React98.createElement(
|
|
8321
|
+
TextInput36,
|
|
8322
|
+
{
|
|
8323
|
+
placeholder: "e.g. Welcome Email",
|
|
8324
|
+
value: localTitle,
|
|
8325
|
+
onChange: (event) => {
|
|
8326
|
+
const newTitle = event.currentTarget.value;
|
|
8327
|
+
setLocalTitle(newTitle);
|
|
8328
|
+
onTitleChange(newTitle);
|
|
8329
|
+
}
|
|
8330
|
+
}
|
|
8331
|
+
)), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "Description"), /* @__PURE__ */ React98.createElement(
|
|
8332
|
+
Textarea20,
|
|
8333
|
+
{
|
|
8334
|
+
placeholder: "Describe what this notification does",
|
|
8335
|
+
minRows: 2,
|
|
8336
|
+
value: localDescription,
|
|
8337
|
+
onChange: (event) => {
|
|
8338
|
+
const newDescription = event.currentTarget.value;
|
|
8339
|
+
setLocalDescription(newDescription);
|
|
8340
|
+
onDescriptionChange(newDescription);
|
|
8341
|
+
}
|
|
8342
|
+
}
|
|
8343
|
+
)), /* @__PURE__ */ React98.createElement(Divider6, { variant: "dashed" }), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "Channel"), /* @__PURE__ */ React98.createElement(
|
|
8344
|
+
Select11,
|
|
8345
|
+
{
|
|
8346
|
+
value: localChannel,
|
|
8347
|
+
onChange: (value) => {
|
|
8348
|
+
const newChannel = value || "email";
|
|
8349
|
+
setLocalChannel(newChannel);
|
|
8350
|
+
onChannelChange(newChannel);
|
|
8351
|
+
},
|
|
8352
|
+
data: [
|
|
8353
|
+
{ value: "email", label: "Email" },
|
|
8354
|
+
{ value: "sms", label: "SMS (Coming Soon)", disabled: true },
|
|
8355
|
+
{ value: "whatsapp", label: "WhatsApp (Coming Soon)", disabled: true },
|
|
8356
|
+
{ value: "rcs", label: "RCS (Coming Soon)", disabled: true }
|
|
8357
|
+
]
|
|
8358
|
+
}
|
|
8359
|
+
)), /* @__PURE__ */ React98.createElement(Divider6, { variant: "dashed" }), localChannel === "email" && /* @__PURE__ */ React98.createElement(React98.Fragment, null, /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Group30, { justify: "space-between" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "To (Recipients)"), /* @__PURE__ */ React98.createElement(Button24, { size: "xs", leftSection: /* @__PURE__ */ React98.createElement(IconPlus2, { size: 14 }), onClick: () => handleAddRecipient("to") }, "Add")), localTo.length === 0 && /* @__PURE__ */ React98.createElement(Text49, { size: "xs", c: "dimmed" }, "No recipients added yet"), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, localTo.map((recipient, index) => /* @__PURE__ */ React98.createElement(Paper10, { key: index, p: "xs", withBorder: true }, /* @__PURE__ */ React98.createElement(Group30, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React98.createElement(TextInput36, { style: { flex: 1 }, placeholder: "email@example.com", value: recipient, onChange: (e) => handleRecipientChange("to", index, e.currentTarget.value) }), /* @__PURE__ */ React98.createElement(ActionIcon13, { color: "red", variant: "light", onClick: () => handleRemoveRecipient("to", index) }, /* @__PURE__ */ React98.createElement(IconTrash2, { size: 16 }))))))), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Group30, { justify: "space-between" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "CC (Optional)"), /* @__PURE__ */ React98.createElement(Button24, { size: "xs", leftSection: /* @__PURE__ */ React98.createElement(IconPlus2, { size: 14 }), onClick: () => handleAddRecipient("cc") }, "Add")), localCc.length > 0 && /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, localCc.map((recipient, index) => /* @__PURE__ */ React98.createElement(Paper10, { key: index, p: "xs", withBorder: true }, /* @__PURE__ */ React98.createElement(Group30, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React98.createElement(
|
|
8360
|
+
TextInput36,
|
|
8361
|
+
{
|
|
8362
|
+
style: { flex: 1 },
|
|
8363
|
+
placeholder: "email@example.com",
|
|
8364
|
+
value: recipient,
|
|
8365
|
+
onChange: (e) => handleRecipientChange("cc", index, e.currentTarget.value)
|
|
8366
|
+
}
|
|
8367
|
+
), /* @__PURE__ */ React98.createElement(ActionIcon13, { color: "red", variant: "light", onClick: () => handleRemoveRecipient("cc", index) }, /* @__PURE__ */ React98.createElement(IconTrash2, { size: 16 }))))))), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Group30, { justify: "space-between" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "BCC (Optional)"), /* @__PURE__ */ React98.createElement(Button24, { size: "xs", leftSection: /* @__PURE__ */ React98.createElement(IconPlus2, { size: 14 }), onClick: () => handleAddRecipient("bcc") }, "Add")), localBcc.length > 0 && /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, localBcc.map((recipient, index) => /* @__PURE__ */ React98.createElement(Paper10, { key: index, p: "xs", withBorder: true }, /* @__PURE__ */ React98.createElement(Group30, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React98.createElement(
|
|
8368
|
+
TextInput36,
|
|
8369
|
+
{
|
|
8370
|
+
style: { flex: 1 },
|
|
8371
|
+
placeholder: "email@example.com",
|
|
8372
|
+
value: recipient,
|
|
8373
|
+
onChange: (e) => handleRecipientChange("bcc", index, e.currentTarget.value)
|
|
8374
|
+
}
|
|
8375
|
+
), /* @__PURE__ */ React98.createElement(ActionIcon13, { color: "red", variant: "light", onClick: () => handleRemoveRecipient("bcc", index) }, /* @__PURE__ */ React98.createElement(IconTrash2, { size: 16 }))))))), /* @__PURE__ */ React98.createElement(Divider6, { variant: "dashed" }), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "From (Optional)"), /* @__PURE__ */ React98.createElement(
|
|
8376
|
+
TextInput36,
|
|
8377
|
+
{
|
|
8378
|
+
placeholder: "sender@example.com",
|
|
8379
|
+
value: localFrom,
|
|
8380
|
+
onChange: (event) => {
|
|
8381
|
+
const newFrom = event.currentTarget.value;
|
|
8382
|
+
setLocalFrom(newFrom);
|
|
8383
|
+
onFromChange(newFrom);
|
|
8384
|
+
}
|
|
8385
|
+
}
|
|
8386
|
+
), /* @__PURE__ */ React98.createElement(Text49, { size: "xs", c: "dimmed" }, "Custom sender email address")), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "Reply-To (Optional)"), /* @__PURE__ */ React98.createElement(
|
|
8387
|
+
TextInput36,
|
|
8388
|
+
{
|
|
8389
|
+
placeholder: "reply@example.com",
|
|
8390
|
+
value: localReplyTo,
|
|
8391
|
+
onChange: (event) => {
|
|
8392
|
+
const newReplyTo = event.currentTarget.value;
|
|
8393
|
+
setLocalReplyTo(newReplyTo);
|
|
8394
|
+
onReplyToChange(newReplyTo);
|
|
8395
|
+
}
|
|
8396
|
+
}
|
|
8397
|
+
), /* @__PURE__ */ React98.createElement(Text49, { size: "xs", c: "dimmed" }, "Where replies should be sent")), /* @__PURE__ */ React98.createElement(Divider6, { variant: "dashed" }), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "Subject"), /* @__PURE__ */ React98.createElement(
|
|
8398
|
+
TextInput36,
|
|
8399
|
+
{
|
|
8400
|
+
placeholder: "Email subject line",
|
|
8401
|
+
value: localSubject,
|
|
8402
|
+
onChange: (event) => {
|
|
8403
|
+
const newSubject = event.currentTarget.value;
|
|
8404
|
+
setLocalSubject(newSubject);
|
|
8405
|
+
onSubjectChange(newSubject);
|
|
8406
|
+
}
|
|
8407
|
+
}
|
|
8408
|
+
)), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "Body Type"), /* @__PURE__ */ React98.createElement(
|
|
8409
|
+
Select11,
|
|
8410
|
+
{
|
|
8411
|
+
value: localBodyType,
|
|
8412
|
+
onChange: (value) => {
|
|
8413
|
+
const newBodyType = value || "text";
|
|
8414
|
+
setLocalBodyType(newBodyType);
|
|
8415
|
+
onBodyTypeChange(newBodyType);
|
|
8416
|
+
},
|
|
8417
|
+
data: [
|
|
8418
|
+
{ value: "text", label: "Plain Text" },
|
|
8419
|
+
{ value: "html", label: "HTML" }
|
|
8420
|
+
]
|
|
8421
|
+
}
|
|
8422
|
+
)), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "Body"), /* @__PURE__ */ React98.createElement(
|
|
8423
|
+
Textarea20,
|
|
8424
|
+
{
|
|
8425
|
+
placeholder: localBodyType === "html" ? "<h1>Hello!</h1><p>Welcome to our service.</p>" : "Email body content",
|
|
8426
|
+
minRows: 6,
|
|
8427
|
+
value: localBody,
|
|
8428
|
+
onChange: (event) => {
|
|
8429
|
+
const newBody = event.currentTarget.value;
|
|
8430
|
+
setLocalBody(newBody);
|
|
8431
|
+
onBodyChange(newBody);
|
|
8432
|
+
}
|
|
8433
|
+
}
|
|
8434
|
+
), /* @__PURE__ */ React98.createElement(Text49, { size: "xs", c: "dimmed" }, localBodyType === "html" ? "HTML content for the email body" : "Plain text content for the email body"))));
|
|
8435
|
+
};
|
|
8436
|
+
|
|
8437
|
+
// src/mantine/blocks/notify/template/TemplateConfig.tsx
|
|
8438
|
+
var TemplateConfig5 = ({ editor, block }) => {
|
|
8439
|
+
const { closePanel } = usePanelStore();
|
|
8440
|
+
const updateProp = useCallback17(
|
|
8441
|
+
(key, value) => {
|
|
8442
|
+
editor.updateBlock(block, {
|
|
8443
|
+
props: {
|
|
8444
|
+
...block.props,
|
|
8445
|
+
[key]: value
|
|
8446
|
+
}
|
|
8447
|
+
});
|
|
8448
|
+
},
|
|
8449
|
+
[editor, block]
|
|
8450
|
+
);
|
|
8451
|
+
const handleToChange = useCallback17(
|
|
8452
|
+
(to) => {
|
|
8453
|
+
updateProp("to", JSON.stringify(to));
|
|
8454
|
+
},
|
|
8455
|
+
[updateProp]
|
|
8456
|
+
);
|
|
8457
|
+
const handleCcChange = useCallback17(
|
|
8458
|
+
(cc) => {
|
|
8459
|
+
updateProp("cc", JSON.stringify(cc));
|
|
8460
|
+
},
|
|
8461
|
+
[updateProp]
|
|
8462
|
+
);
|
|
8463
|
+
const handleBccChange = useCallback17(
|
|
8464
|
+
(bcc) => {
|
|
8465
|
+
updateProp("bcc", JSON.stringify(bcc));
|
|
8466
|
+
},
|
|
8467
|
+
[updateProp]
|
|
8468
|
+
);
|
|
8469
|
+
return /* @__PURE__ */ React99.createElement(
|
|
8470
|
+
Paper11,
|
|
8471
|
+
{
|
|
8472
|
+
p: "md",
|
|
8473
|
+
shadow: "sm",
|
|
8474
|
+
style: {
|
|
8475
|
+
height: "100%",
|
|
8476
|
+
display: "flex",
|
|
8477
|
+
flexDirection: "column"
|
|
8478
|
+
}
|
|
8479
|
+
},
|
|
8480
|
+
/* @__PURE__ */ React99.createElement(
|
|
8481
|
+
"div",
|
|
8482
|
+
{
|
|
8483
|
+
style: {
|
|
8484
|
+
display: "flex",
|
|
8485
|
+
justifyContent: "space-between",
|
|
8486
|
+
alignItems: "center",
|
|
8487
|
+
marginBottom: "1rem"
|
|
8488
|
+
}
|
|
8489
|
+
},
|
|
8490
|
+
/* @__PURE__ */ React99.createElement(Title7, { order: 3 }, "Notification Settings"),
|
|
8491
|
+
/* @__PURE__ */ React99.createElement(CloseButton7, { onClick: closePanel })
|
|
8492
|
+
),
|
|
8493
|
+
/* @__PURE__ */ React99.createElement(
|
|
8494
|
+
ReusablePanel,
|
|
8495
|
+
{
|
|
8496
|
+
extraTabs: [
|
|
8497
|
+
{
|
|
8498
|
+
label: "General",
|
|
8499
|
+
value: "general",
|
|
8500
|
+
content: /* @__PURE__ */ React99.createElement(
|
|
8501
|
+
GeneralTab5,
|
|
8502
|
+
{
|
|
8503
|
+
title: block.props.title || "",
|
|
8504
|
+
description: block.props.description || "",
|
|
8505
|
+
channel: block.props.channel || "email",
|
|
8506
|
+
to: (() => {
|
|
8507
|
+
try {
|
|
8508
|
+
return typeof block.props.to === "string" ? JSON.parse(block.props.to) : block.props.to || [];
|
|
8509
|
+
} catch {
|
|
8510
|
+
return [];
|
|
8511
|
+
}
|
|
8512
|
+
})(),
|
|
8513
|
+
cc: (() => {
|
|
8514
|
+
try {
|
|
8515
|
+
return typeof block.props.cc === "string" ? JSON.parse(block.props.cc) : block.props.cc || [];
|
|
8516
|
+
} catch {
|
|
8517
|
+
return [];
|
|
8518
|
+
}
|
|
8519
|
+
})(),
|
|
8520
|
+
bcc: (() => {
|
|
8521
|
+
try {
|
|
8522
|
+
return typeof block.props.bcc === "string" ? JSON.parse(block.props.bcc) : block.props.bcc || [];
|
|
8523
|
+
} catch {
|
|
8524
|
+
return [];
|
|
8525
|
+
}
|
|
8526
|
+
})(),
|
|
8527
|
+
subject: block.props.subject || "",
|
|
8528
|
+
body: block.props.body || "",
|
|
8529
|
+
bodyType: block.props.bodyType || "text",
|
|
8530
|
+
from: block.props.from || "",
|
|
8531
|
+
replyTo: block.props.replyTo || "",
|
|
8532
|
+
onTitleChange: (value) => updateProp("title", value),
|
|
8533
|
+
onDescriptionChange: (value) => updateProp("description", value),
|
|
8534
|
+
onChannelChange: (value) => updateProp("channel", value),
|
|
8535
|
+
onToChange: handleToChange,
|
|
8536
|
+
onCcChange: handleCcChange,
|
|
8537
|
+
onBccChange: handleBccChange,
|
|
8538
|
+
onSubjectChange: (value) => updateProp("subject", value),
|
|
8539
|
+
onBodyChange: (value) => updateProp("body", value),
|
|
8540
|
+
onBodyTypeChange: (value) => updateProp("bodyType", value),
|
|
8541
|
+
onFromChange: (value) => updateProp("from", value),
|
|
8542
|
+
onReplyToChange: (value) => updateProp("replyTo", value)
|
|
8543
|
+
}
|
|
8544
|
+
)
|
|
8545
|
+
}
|
|
8546
|
+
],
|
|
8547
|
+
context: { editor, block }
|
|
8548
|
+
}
|
|
8549
|
+
)
|
|
8550
|
+
);
|
|
8551
|
+
};
|
|
8552
|
+
|
|
8553
|
+
// src/mantine/blocks/notify/template/TemplateView.tsx
|
|
8554
|
+
import { Card as Card22, Group as Group31, Stack as Stack75, Text as Text50, ActionIcon as ActionIcon14, Badge as Badge12 } from "@mantine/core";
|
|
8555
|
+
var NOTIFY_TEMPLATE_PANEL_ID = "notify-template-panel";
|
|
8556
|
+
var NotifyTemplateView = ({ editor, block }) => {
|
|
8557
|
+
const panelId = `${NOTIFY_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
8558
|
+
const panelContent = useMemo14(() => /* @__PURE__ */ React100.createElement(TemplateConfig5, { editor, block }), [editor, block]);
|
|
8559
|
+
const { open } = usePanel(panelId, panelContent);
|
|
8560
|
+
const channel = block.props.channel || "email";
|
|
8561
|
+
const to = (() => {
|
|
8562
|
+
try {
|
|
8563
|
+
const parsed = typeof block.props.to === "string" ? JSON.parse(block.props.to) : block.props.to;
|
|
8564
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
8565
|
+
} catch {
|
|
8566
|
+
return [];
|
|
8567
|
+
}
|
|
8568
|
+
})();
|
|
8569
|
+
const getChannelColor = (channel2) => {
|
|
8570
|
+
switch (channel2) {
|
|
8571
|
+
case "email":
|
|
8572
|
+
return "blue";
|
|
8573
|
+
case "sms":
|
|
8574
|
+
return "green";
|
|
8575
|
+
case "whatsapp":
|
|
8576
|
+
return "teal";
|
|
8577
|
+
case "rcs":
|
|
8578
|
+
return "violet";
|
|
8579
|
+
default:
|
|
8580
|
+
return "gray";
|
|
8581
|
+
}
|
|
8582
|
+
};
|
|
8583
|
+
return /* @__PURE__ */ React100.createElement(Card22, { withBorder: true, padding: "md", radius: "md", style: { width: "100%", cursor: "pointer", position: "relative" }, onClick: open }, /* @__PURE__ */ React100.createElement(Badge12, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React100.createElement(Group31, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React100.createElement(Group31, { wrap: "nowrap", align: "center" }, /* @__PURE__ */ React100.createElement(ActionIcon14, { variant: "light", color: getChannelColor(channel), size: "lg", radius: "xl", style: { flexShrink: 0 } }, getIcon(block.props.icon, 18, 1.5, "bell")), /* @__PURE__ */ React100.createElement(Stack75, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React100.createElement(Group31, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React100.createElement(Badge12, { size: "sm", variant: "filled", color: getChannelColor(channel) }, channel.toUpperCase()), /* @__PURE__ */ React100.createElement(Text50, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Notification")), /* @__PURE__ */ React100.createElement(Text50, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 1 }, to.length > 0 ? `To: ${to.join(", ")}` : "Click to configure recipients"), block.props.description && /* @__PURE__ */ React100.createElement(Text50, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description)))));
|
|
8584
|
+
};
|
|
8585
|
+
|
|
8586
|
+
// src/mantine/blocks/notify/flow/FlowView.tsx
|
|
8587
|
+
import React101, { useState as useState27 } from "react";
|
|
8588
|
+
import { Card as Card23, Group as Group32, Stack as Stack76, Text as Text51, ActionIcon as ActionIcon15, Tooltip as Tooltip5, Button as Button25, Badge as Badge13, Collapse as Collapse2, Alert as Alert10, Loader as Loader4, Code as Code2 } from "@mantine/core";
|
|
8589
|
+
import { IconSend as IconSend2, IconChevronDown as IconChevronDown2, IconChevronUp as IconChevronUp2, IconCheck, IconX } from "@tabler/icons-react";
|
|
8590
|
+
var NotifyFlowView = ({ editor, block, isDisabled }) => {
|
|
8591
|
+
const disabled = isDisabled?.isDisabled === "disable";
|
|
8592
|
+
const [isLoading, setIsLoading] = useState27(false);
|
|
8593
|
+
const [showDetails, setShowDetails] = useState27(false);
|
|
8594
|
+
let handlers = null;
|
|
8595
|
+
try {
|
|
8596
|
+
handlers = useBlocknoteHandlers();
|
|
8597
|
+
} catch {
|
|
8598
|
+
handlers = null;
|
|
8599
|
+
}
|
|
8600
|
+
const channel = block.props.channel || "email";
|
|
8601
|
+
const status = block.props.status || "idle";
|
|
8602
|
+
const to = (() => {
|
|
8603
|
+
try {
|
|
8604
|
+
return typeof block.props.to === "string" ? JSON.parse(block.props.to) : block.props.to || [];
|
|
8605
|
+
} catch {
|
|
8606
|
+
return [];
|
|
8607
|
+
}
|
|
8608
|
+
})();
|
|
8609
|
+
const cc = (() => {
|
|
8610
|
+
try {
|
|
8611
|
+
return typeof block.props.cc === "string" ? JSON.parse(block.props.cc) : block.props.cc || [];
|
|
8612
|
+
} catch {
|
|
8613
|
+
return [];
|
|
8614
|
+
}
|
|
8615
|
+
})();
|
|
8616
|
+
const bcc = (() => {
|
|
8617
|
+
try {
|
|
8618
|
+
return typeof block.props.bcc === "string" ? JSON.parse(block.props.bcc) : block.props.bcc || [];
|
|
8619
|
+
} catch {
|
|
8620
|
+
return [];
|
|
8621
|
+
}
|
|
8622
|
+
})();
|
|
8623
|
+
const getChannelColor = (channel2) => {
|
|
8624
|
+
switch (channel2) {
|
|
8625
|
+
case "email":
|
|
8626
|
+
return "blue";
|
|
8627
|
+
case "sms":
|
|
8628
|
+
return "green";
|
|
8629
|
+
case "whatsapp":
|
|
8630
|
+
return "teal";
|
|
8631
|
+
case "rcs":
|
|
8632
|
+
return "violet";
|
|
8633
|
+
default:
|
|
8634
|
+
return "gray";
|
|
8635
|
+
}
|
|
8636
|
+
};
|
|
8637
|
+
const getStatusColor = (status2) => {
|
|
8638
|
+
switch (status2) {
|
|
8639
|
+
case "sent":
|
|
8640
|
+
return "green";
|
|
8641
|
+
case "failed":
|
|
8642
|
+
return "red";
|
|
8643
|
+
case "sending":
|
|
8644
|
+
return "blue";
|
|
8645
|
+
default:
|
|
8646
|
+
return "gray";
|
|
8647
|
+
}
|
|
8648
|
+
};
|
|
8649
|
+
const handleSendNotification = async () => {
|
|
8650
|
+
if (disabled || !handlers || to.length === 0) return;
|
|
8651
|
+
setIsLoading(true);
|
|
8652
|
+
editor.updateBlock(block, {
|
|
8653
|
+
props: { ...block.props, status: "sending", errorMessage: "" }
|
|
8654
|
+
});
|
|
8655
|
+
try {
|
|
8656
|
+
if (channel === "email") {
|
|
8657
|
+
const params = {
|
|
8658
|
+
channel: "email",
|
|
8659
|
+
to: to.filter((email) => email.trim() !== ""),
|
|
8660
|
+
cc: cc.filter((email) => email.trim() !== ""),
|
|
8661
|
+
bcc: bcc.filter((email) => email.trim() !== ""),
|
|
8662
|
+
subject: block.props.subject || "",
|
|
8663
|
+
body: block.props.body || "",
|
|
8664
|
+
bodyType: block.props.bodyType || "text",
|
|
8665
|
+
from: block.props.from || void 0,
|
|
8666
|
+
replyTo: block.props.replyTo || void 0
|
|
8667
|
+
};
|
|
8668
|
+
if (params.cc?.length === 0) delete params.cc;
|
|
8669
|
+
if (params.bcc?.length === 0) delete params.bcc;
|
|
8670
|
+
const response = await handlers.sendNotification(params);
|
|
8671
|
+
editor.updateBlock(block, {
|
|
8672
|
+
props: {
|
|
8673
|
+
...block.props,
|
|
8674
|
+
status: "sent",
|
|
8675
|
+
messageId: response.messageId,
|
|
8676
|
+
sentAt: response.timestamp,
|
|
8677
|
+
errorMessage: ""
|
|
8678
|
+
}
|
|
8679
|
+
});
|
|
8680
|
+
}
|
|
8681
|
+
} catch (error) {
|
|
8682
|
+
editor.updateBlock(block, {
|
|
8683
|
+
props: {
|
|
8684
|
+
...block.props,
|
|
8685
|
+
status: "failed",
|
|
8686
|
+
errorMessage: error instanceof Error ? error.message : "Failed to send notification"
|
|
8687
|
+
}
|
|
8688
|
+
});
|
|
8689
|
+
} finally {
|
|
8690
|
+
setIsLoading(false);
|
|
8691
|
+
}
|
|
8692
|
+
};
|
|
8693
|
+
const canSend = !disabled && !isLoading && handlers && to.length > 0 && (channel === "email" ? block.props.subject && block.props.body : true);
|
|
8694
|
+
const sendButton = /* @__PURE__ */ React101.createElement(
|
|
8695
|
+
Button25,
|
|
8696
|
+
{
|
|
8697
|
+
size: "sm",
|
|
8698
|
+
variant: "light",
|
|
8699
|
+
color: getChannelColor(channel),
|
|
8700
|
+
leftSection: isLoading ? /* @__PURE__ */ React101.createElement(Loader4, { size: 14 }) : status === "sent" ? /* @__PURE__ */ React101.createElement(IconCheck, { size: 14 }) : /* @__PURE__ */ React101.createElement(IconSend2, { size: 14 }),
|
|
8701
|
+
onClick: handleSendNotification,
|
|
8702
|
+
disabled: !canSend,
|
|
8703
|
+
style: { flexShrink: 0 }
|
|
8704
|
+
},
|
|
8705
|
+
isLoading ? "Sending..." : status === "sent" ? "Sent" : "Send"
|
|
8706
|
+
);
|
|
8707
|
+
return /* @__PURE__ */ React101.createElement(Card23, { withBorder: true, padding: "md", radius: "md", style: { width: "100%" } }, /* @__PURE__ */ React101.createElement(Stack76, { gap: "md" }, /* @__PURE__ */ React101.createElement(Group32, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React101.createElement(Group32, { wrap: "nowrap", align: "flex-start", style: { flex: 1 } }, /* @__PURE__ */ React101.createElement(ActionIcon15, { variant: "light", color: getChannelColor(channel), size: "lg", radius: "xl", style: { flexShrink: 0 } }, getIcon(block.props.icon, 18, 1.5, "bell")), /* @__PURE__ */ React101.createElement(Stack76, { gap: "xs", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React101.createElement(Group32, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React101.createElement(Badge13, { size: "sm", variant: "filled", color: getChannelColor(channel) }, channel.toUpperCase()), /* @__PURE__ */ React101.createElement(Text51, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Notification"), status !== "idle" && /* @__PURE__ */ React101.createElement(Badge13, { size: "xs", variant: "dot", color: getStatusColor(status) }, status)), /* @__PURE__ */ React101.createElement(Text51, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 1 }, to.length > 0 ? `To: ${to.slice(0, 2).join(", ")}${to.length > 2 ? ` +${to.length - 2} more` : ""}` : "No recipients"), block.props.description && /* @__PURE__ */ React101.createElement(Text51, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), /* @__PURE__ */ React101.createElement(Group32, { gap: "xs", style: { flexShrink: 0 } }, disabled && isDisabled?.message ? /* @__PURE__ */ React101.createElement(Tooltip5, { label: isDisabled.message, position: "left", withArrow: true }, sendButton) : sendButton, /* @__PURE__ */ React101.createElement(ActionIcon15, { variant: "subtle", onClick: () => setShowDetails(!showDetails) }, showDetails ? /* @__PURE__ */ React101.createElement(IconChevronUp2, { size: 16 }) : /* @__PURE__ */ React101.createElement(IconChevronDown2, { size: 16 })))), status === "failed" && block.props.errorMessage && /* @__PURE__ */ React101.createElement(Alert10, { color: "red", icon: /* @__PURE__ */ React101.createElement(IconX, { size: 16 }), title: "Failed to send", styles: { message: { fontSize: "12px" } } }, block.props.errorMessage), status === "sent" && block.props.messageId && /* @__PURE__ */ React101.createElement(Alert10, { color: "green", icon: /* @__PURE__ */ React101.createElement(IconCheck, { size: 16 }), title: "Sent successfully", styles: { message: { fontSize: "12px" } } }, "Message ID: ", block.props.messageId, block.props.sentAt && /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement("br", null), "Sent at: ", new Date(block.props.sentAt).toLocaleString())), /* @__PURE__ */ React101.createElement(Collapse2, { in: showDetails }, /* @__PURE__ */ React101.createElement(Stack76, { gap: "md" }, channel === "email" && /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Stack76, { gap: "xs" }, /* @__PURE__ */ React101.createElement(Text51, { size: "xs", fw: 600, c: "dimmed" }, "Recipients:"), /* @__PURE__ */ React101.createElement(Code2, { block: true, style: { fontSize: "11px" } }, JSON.stringify(
|
|
8708
|
+
{
|
|
8709
|
+
to: to.filter((e) => e.trim() !== ""),
|
|
8710
|
+
...cc.length > 0 && { cc: cc.filter((e) => e.trim() !== "") },
|
|
8711
|
+
...bcc.length > 0 && { bcc: bcc.filter((e) => e.trim() !== "") }
|
|
8712
|
+
},
|
|
8713
|
+
null,
|
|
8714
|
+
2
|
|
8715
|
+
))), block.props.subject && /* @__PURE__ */ React101.createElement(Stack76, { gap: "xs" }, /* @__PURE__ */ React101.createElement(Text51, { size: "xs", fw: 600, c: "dimmed" }, "Subject:"), /* @__PURE__ */ React101.createElement(Text51, { size: "xs" }, block.props.subject)), block.props.body && /* @__PURE__ */ React101.createElement(Stack76, { gap: "xs" }, /* @__PURE__ */ React101.createElement(Text51, { size: "xs", fw: 600, c: "dimmed" }, "Body (", block.props.bodyType || "text", "):"), /* @__PURE__ */ React101.createElement(Code2, { block: true, style: { fontSize: "11px", maxHeight: "200px", overflow: "auto" } }, block.props.body)), (block.props.from || block.props.replyTo) && /* @__PURE__ */ React101.createElement(Stack76, { gap: "xs" }, /* @__PURE__ */ React101.createElement(Text51, { size: "xs", fw: 600, c: "dimmed" }, "Additional:"), /* @__PURE__ */ React101.createElement(Code2, { block: true, style: { fontSize: "11px" } }, JSON.stringify(
|
|
8716
|
+
{
|
|
8717
|
+
...block.props.from && { from: block.props.from },
|
|
8718
|
+
...block.props.replyTo && { replyTo: block.props.replyTo }
|
|
8719
|
+
},
|
|
8720
|
+
null,
|
|
8721
|
+
2
|
|
8722
|
+
))))))));
|
|
8723
|
+
};
|
|
8724
|
+
|
|
8725
|
+
// src/mantine/blocks/notify/NotifyBlock.tsx
|
|
8726
|
+
function NotifyBlock({ editor, block }) {
|
|
8727
|
+
const { editable } = useBlocknoteContext();
|
|
8728
|
+
const { actions } = useBlockConditions(block, editor);
|
|
8729
|
+
if (editable) {
|
|
8730
|
+
return /* @__PURE__ */ React102.createElement(NotifyTemplateView, { editor, block });
|
|
8731
|
+
}
|
|
8732
|
+
const conditionConfig = parseConditionConfig(block.props.conditions);
|
|
8733
|
+
const hasVisibility = hasVisibilityConditions(conditionConfig);
|
|
8734
|
+
const showActionExists = actions.some((a) => a.action === "show");
|
|
8735
|
+
const shouldHide = hasVisibility && !showActionExists;
|
|
8736
|
+
if (shouldHide) {
|
|
8737
|
+
return null;
|
|
8738
|
+
}
|
|
8739
|
+
const hasEnable = hasEnableConditions(conditionConfig);
|
|
8740
|
+
const enableActionExists = actions.some((a) => a.action === "enable");
|
|
8741
|
+
const shouldDisable = hasEnable && !enableActionExists;
|
|
8742
|
+
return /* @__PURE__ */ React102.createElement(NotifyFlowView, { block, editor, isDisabled: shouldDisable ? { isDisabled: "disable", message: "Notification disabled by conditions" } : void 0 });
|
|
8743
|
+
}
|
|
8744
|
+
|
|
8745
|
+
// src/mantine/blocks/notify/NotifyBlockSpec.tsx
|
|
8746
|
+
var NotifyBlockSpec = createReactBlockSpec7(
|
|
8747
|
+
{
|
|
8748
|
+
type: "notify",
|
|
8749
|
+
propSchema: {
|
|
8750
|
+
title: { default: "" },
|
|
8751
|
+
description: { default: "" },
|
|
8752
|
+
icon: { default: "bell" },
|
|
8753
|
+
// Notification channel configuration
|
|
8754
|
+
channel: { default: "email" },
|
|
8755
|
+
// Email-specific fields
|
|
8756
|
+
to: { default: "[]" },
|
|
8757
|
+
// JSON array of recipients
|
|
8758
|
+
cc: { default: "[]" },
|
|
8759
|
+
// JSON array of CC recipients
|
|
8760
|
+
bcc: { default: "[]" },
|
|
8761
|
+
// JSON array of BCC recipients
|
|
8762
|
+
subject: { default: "" },
|
|
8763
|
+
body: { default: "" },
|
|
8764
|
+
bodyType: { default: "text" },
|
|
8765
|
+
// 'text' or 'html'
|
|
8766
|
+
from: { default: "" },
|
|
8767
|
+
replyTo: { default: "" },
|
|
8768
|
+
// SMS/WhatsApp fields
|
|
8769
|
+
templateId: { default: "" },
|
|
8770
|
+
templateVariables: { default: "{}" },
|
|
8771
|
+
// JSON object
|
|
8772
|
+
// Execution status
|
|
8773
|
+
status: { default: "idle" },
|
|
8774
|
+
// 'idle', 'sending', 'sent', 'failed'
|
|
8775
|
+
messageId: { default: "" },
|
|
8776
|
+
sentAt: { default: "" },
|
|
8777
|
+
errorMessage: { default: "" },
|
|
8778
|
+
// Conditions
|
|
8779
|
+
conditions: { default: "" }
|
|
8780
|
+
},
|
|
8781
|
+
content: "inline"
|
|
8782
|
+
},
|
|
8783
|
+
{
|
|
8784
|
+
render: (props) => {
|
|
8785
|
+
const ixoProps = props;
|
|
8786
|
+
return /* @__PURE__ */ React103.createElement(NotifyBlock, { ...ixoProps });
|
|
8787
|
+
}
|
|
8788
|
+
}
|
|
8789
|
+
);
|
|
8790
|
+
|
|
8230
8791
|
// src/mantine/blocks/registry/blockRegistry.ts
|
|
8231
8792
|
var BlockRegistry = class {
|
|
8232
8793
|
constructor() {
|
|
@@ -8320,12 +8881,43 @@ blockRegistry.register({
|
|
|
8320
8881
|
validDependencies: [],
|
|
8321
8882
|
defaultProps: {}
|
|
8322
8883
|
});
|
|
8884
|
+
blockRegistry.register({
|
|
8885
|
+
type: "notify",
|
|
8886
|
+
propSchema: {
|
|
8887
|
+
title: "",
|
|
8888
|
+
description: "",
|
|
8889
|
+
icon: "bell",
|
|
8890
|
+
channel: "email",
|
|
8891
|
+
to: "[]",
|
|
8892
|
+
cc: "[]",
|
|
8893
|
+
bcc: "[]",
|
|
8894
|
+
subject: "",
|
|
8895
|
+
body: "",
|
|
8896
|
+
bodyType: "text",
|
|
8897
|
+
from: "",
|
|
8898
|
+
replyTo: "",
|
|
8899
|
+
templateId: "",
|
|
8900
|
+
templateVariables: "{}",
|
|
8901
|
+
status: "idle",
|
|
8902
|
+
messageId: "",
|
|
8903
|
+
sentAt: "",
|
|
8904
|
+
errorMessage: "",
|
|
8905
|
+
conditions: ""
|
|
8906
|
+
},
|
|
8907
|
+
validDependencies: [],
|
|
8908
|
+
defaultProps: {
|
|
8909
|
+
icon: "bell",
|
|
8910
|
+
channel: "email",
|
|
8911
|
+
bodyType: "text",
|
|
8912
|
+
status: "idle"
|
|
8913
|
+
}
|
|
8914
|
+
});
|
|
8323
8915
|
|
|
8324
8916
|
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
8325
|
-
import { useMemo as
|
|
8917
|
+
import { useMemo as useMemo15, useEffect as useEffect18, useState as useState28, useCallback as useCallback18 } from "react";
|
|
8326
8918
|
|
|
8327
8919
|
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
8328
|
-
import { useMemo as
|
|
8920
|
+
import { useMemo as useMemo16 } from "react";
|
|
8329
8921
|
|
|
8330
8922
|
// src/mantine/blocks/index.ts
|
|
8331
8923
|
var blockSpecs = {
|
|
@@ -8334,7 +8926,8 @@ var blockSpecs = {
|
|
|
8334
8926
|
enumChecklist: EnumChecklistBlock,
|
|
8335
8927
|
overview: OverviewBlock,
|
|
8336
8928
|
proposal: ProposalBlockSpec,
|
|
8337
|
-
apiRequest: ApiRequestBlockSpec
|
|
8929
|
+
apiRequest: ApiRequestBlockSpec,
|
|
8930
|
+
notify: NotifyBlockSpec
|
|
8338
8931
|
};
|
|
8339
8932
|
var getExtraSlashMenuItems = (editor) => {
|
|
8340
8933
|
const slashMenuList = [
|
|
@@ -8498,6 +9091,73 @@ var getExtraSlashMenuItems = (editor) => {
|
|
|
8498
9091
|
aliases: ["actions", "proposal-actions", "dao-actions", "governance-actions"],
|
|
8499
9092
|
group: "DAO",
|
|
8500
9093
|
subtext: "Manage proposal actions"
|
|
9094
|
+
},
|
|
9095
|
+
{
|
|
9096
|
+
title: "API Request",
|
|
9097
|
+
onItemClick: () => {
|
|
9098
|
+
editor.insertBlocks(
|
|
9099
|
+
[
|
|
9100
|
+
{
|
|
9101
|
+
type: "apiRequest",
|
|
9102
|
+
props: {
|
|
9103
|
+
title: "",
|
|
9104
|
+
description: "",
|
|
9105
|
+
icon: "square-check",
|
|
9106
|
+
endpoint: "",
|
|
9107
|
+
method: "GET",
|
|
9108
|
+
headers: "[]",
|
|
9109
|
+
body: "[]",
|
|
9110
|
+
response: "",
|
|
9111
|
+
status: "idle",
|
|
9112
|
+
conditions: ""
|
|
9113
|
+
}
|
|
9114
|
+
}
|
|
9115
|
+
],
|
|
9116
|
+
editor.getTextCursorPosition().block,
|
|
9117
|
+
"after"
|
|
9118
|
+
);
|
|
9119
|
+
},
|
|
9120
|
+
aliases: ["api", "api-request", "request", "http", "fetch"],
|
|
9121
|
+
group: "Basics",
|
|
9122
|
+
subtext: "Make HTTP requests and handle responses"
|
|
9123
|
+
},
|
|
9124
|
+
{
|
|
9125
|
+
title: "Notification",
|
|
9126
|
+
onItemClick: () => {
|
|
9127
|
+
editor.insertBlocks(
|
|
9128
|
+
[
|
|
9129
|
+
{
|
|
9130
|
+
type: "notify",
|
|
9131
|
+
props: {
|
|
9132
|
+
title: "",
|
|
9133
|
+
description: "",
|
|
9134
|
+
icon: "bell",
|
|
9135
|
+
channel: "email",
|
|
9136
|
+
to: "[]",
|
|
9137
|
+
cc: "[]",
|
|
9138
|
+
bcc: "[]",
|
|
9139
|
+
subject: "",
|
|
9140
|
+
body: "",
|
|
9141
|
+
bodyType: "text",
|
|
9142
|
+
from: "",
|
|
9143
|
+
replyTo: "",
|
|
9144
|
+
templateId: "",
|
|
9145
|
+
templateVariables: "{}",
|
|
9146
|
+
status: "idle",
|
|
9147
|
+
messageId: "",
|
|
9148
|
+
sentAt: "",
|
|
9149
|
+
errorMessage: "",
|
|
9150
|
+
conditions: ""
|
|
9151
|
+
}
|
|
9152
|
+
}
|
|
9153
|
+
],
|
|
9154
|
+
editor.getTextCursorPosition().block,
|
|
9155
|
+
"after"
|
|
9156
|
+
);
|
|
9157
|
+
},
|
|
9158
|
+
aliases: ["notify", "notification", "email", "alert", "message", "bird"],
|
|
9159
|
+
group: "Basics",
|
|
9160
|
+
subtext: "Send notifications via Email, SMS, or WhatsApp"
|
|
8501
9161
|
}
|
|
8502
9162
|
];
|
|
8503
9163
|
const yRoot = editor?._yRoot;
|
|
@@ -8576,15 +9236,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
|
|
|
8576
9236
|
import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
|
|
8577
9237
|
|
|
8578
9238
|
// src/core/hooks/useMatrixProvider.ts
|
|
8579
|
-
import { useEffect as
|
|
9239
|
+
import { useEffect as useEffect19, useState as useState29, useRef as useRef3, useCallback as useCallback19, useMemo as useMemo17 } from "react";
|
|
8580
9240
|
import { MatrixProvider } from "@ixo/matrix-crdt";
|
|
8581
9241
|
function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
8582
|
-
const [matrixProvider, setProvider] =
|
|
8583
|
-
const [status, setStatus] =
|
|
9242
|
+
const [matrixProvider, setProvider] = useState29(null);
|
|
9243
|
+
const [status, setStatus] = useState29("disconnected");
|
|
8584
9244
|
const isMountedRef = useRef3(true);
|
|
8585
9245
|
const providerRef = useRef3(null);
|
|
8586
9246
|
const retryTimeoutRef = useRef3(null);
|
|
8587
|
-
const providerOptions =
|
|
9247
|
+
const providerOptions = useMemo17(
|
|
8588
9248
|
() => ({
|
|
8589
9249
|
translator: {
|
|
8590
9250
|
updateEventType: "matrix-crdt.doc_update",
|
|
@@ -8597,22 +9257,22 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
8597
9257
|
}),
|
|
8598
9258
|
[]
|
|
8599
9259
|
);
|
|
8600
|
-
const handleDocumentAvailable =
|
|
9260
|
+
const handleDocumentAvailable = useCallback19(() => {
|
|
8601
9261
|
if (isMountedRef.current) {
|
|
8602
9262
|
setStatus("connected");
|
|
8603
9263
|
}
|
|
8604
9264
|
}, []);
|
|
8605
|
-
const handleDocumentUnavailable =
|
|
9265
|
+
const handleDocumentUnavailable = useCallback19(() => {
|
|
8606
9266
|
if (isMountedRef.current) {
|
|
8607
9267
|
setStatus("failed");
|
|
8608
9268
|
}
|
|
8609
9269
|
}, []);
|
|
8610
|
-
const handleCanWriteChanged =
|
|
9270
|
+
const handleCanWriteChanged = useCallback19(() => {
|
|
8611
9271
|
if (isMountedRef.current && providerRef.current) {
|
|
8612
9272
|
setStatus(providerRef.current.canWrite ? "connected" : "failed");
|
|
8613
9273
|
}
|
|
8614
9274
|
}, []);
|
|
8615
|
-
const initProvider =
|
|
9275
|
+
const initProvider = useCallback19(async () => {
|
|
8616
9276
|
if (!isMountedRef.current) return;
|
|
8617
9277
|
if (retryTimeoutRef.current) {
|
|
8618
9278
|
clearTimeout(retryTimeoutRef.current);
|
|
@@ -8646,7 +9306,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
8646
9306
|
}
|
|
8647
9307
|
}
|
|
8648
9308
|
}, [matrixClient, providerOptions, handleDocumentAvailable, handleDocumentUnavailable, handleCanWriteChanged]);
|
|
8649
|
-
|
|
9309
|
+
useEffect19(() => {
|
|
8650
9310
|
isMountedRef.current = true;
|
|
8651
9311
|
initProvider();
|
|
8652
9312
|
return () => {
|
|
@@ -8663,7 +9323,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
8663
9323
|
setStatus("disconnected");
|
|
8664
9324
|
};
|
|
8665
9325
|
}, [initProvider]);
|
|
8666
|
-
|
|
9326
|
+
useEffect19(() => {
|
|
8667
9327
|
return () => {
|
|
8668
9328
|
isMountedRef.current = false;
|
|
8669
9329
|
};
|
|
@@ -8672,17 +9332,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
8672
9332
|
}
|
|
8673
9333
|
|
|
8674
9334
|
// src/mantine/hooks/useCollaborativeYDoc.ts
|
|
8675
|
-
import { useMemo as
|
|
9335
|
+
import { useMemo as useMemo18 } from "react";
|
|
8676
9336
|
import * as Y from "yjs";
|
|
8677
9337
|
function useCollaborativeYDoc(_options) {
|
|
8678
|
-
return
|
|
9338
|
+
return useMemo18(() => {
|
|
8679
9339
|
const doc = new Y.Doc();
|
|
8680
9340
|
return doc;
|
|
8681
9341
|
}, []);
|
|
8682
9342
|
}
|
|
8683
9343
|
|
|
8684
9344
|
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
8685
|
-
import { useMemo as
|
|
9345
|
+
import { useMemo as useMemo19, useEffect as useEffect20 } from "react";
|
|
8686
9346
|
function useCreateCollaborativeIxoEditor(options) {
|
|
8687
9347
|
const yDoc = useCollaborativeYDoc(options);
|
|
8688
9348
|
const {
|
|
@@ -8700,7 +9360,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8700
9360
|
matrixClient,
|
|
8701
9361
|
permissions = { write: false }
|
|
8702
9362
|
} = options || {};
|
|
8703
|
-
const memoizedUser =
|
|
9363
|
+
const memoizedUser = useMemo19(
|
|
8704
9364
|
() => ({
|
|
8705
9365
|
id: user?.id || "",
|
|
8706
9366
|
name: user?.name || "",
|
|
@@ -8715,7 +9375,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8715
9375
|
matrixClient,
|
|
8716
9376
|
roomId: options.roomId
|
|
8717
9377
|
});
|
|
8718
|
-
const defaultUploadFile =
|
|
9378
|
+
const defaultUploadFile = useMemo19(
|
|
8719
9379
|
() => uploadFile || (async (file) => {
|
|
8720
9380
|
return new Promise((resolve, reject) => {
|
|
8721
9381
|
const reader = new FileReader();
|
|
@@ -8729,7 +9389,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8729
9389
|
}),
|
|
8730
9390
|
[uploadFile]
|
|
8731
9391
|
);
|
|
8732
|
-
const schema =
|
|
9392
|
+
const schema = useMemo19(
|
|
8733
9393
|
() => BlockNoteSchema2.create({
|
|
8734
9394
|
blockSpecs: {
|
|
8735
9395
|
...defaultBlockSpecs2,
|
|
@@ -8744,11 +9404,11 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8744
9404
|
}),
|
|
8745
9405
|
[]
|
|
8746
9406
|
);
|
|
8747
|
-
const root =
|
|
8748
|
-
const documentFragment =
|
|
8749
|
-
const flowArray =
|
|
8750
|
-
const userFragment =
|
|
8751
|
-
const collaborationConfig =
|
|
9407
|
+
const root = useMemo19(() => yDoc.getMap("root"), [yDoc]);
|
|
9408
|
+
const documentFragment = useMemo19(() => yDoc.getXmlFragment("document"), [yDoc]);
|
|
9409
|
+
const flowArray = useMemo19(() => yDoc.getArray("flow"), [yDoc]);
|
|
9410
|
+
const userFragment = useMemo19(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
|
|
9411
|
+
const collaborationConfig = useMemo19(
|
|
8752
9412
|
() => ({
|
|
8753
9413
|
provider: matrixProvider,
|
|
8754
9414
|
fragment: documentFragment,
|
|
@@ -8760,7 +9420,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8760
9420
|
}),
|
|
8761
9421
|
[matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
|
|
8762
9422
|
);
|
|
8763
|
-
const ixoConfig =
|
|
9423
|
+
const ixoConfig = useMemo19(
|
|
8764
9424
|
() => ({
|
|
8765
9425
|
theme,
|
|
8766
9426
|
editable,
|
|
@@ -8779,7 +9439,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8779
9439
|
uploadFile: defaultUploadFile,
|
|
8780
9440
|
collaboration: collaborationConfig
|
|
8781
9441
|
});
|
|
8782
|
-
const titleText =
|
|
9442
|
+
const titleText = useMemo19(() => yDoc.getText("title"), [yDoc]);
|
|
8783
9443
|
let ixoEditor;
|
|
8784
9444
|
if (editor) {
|
|
8785
9445
|
ixoEditor = editor;
|
|
@@ -8836,12 +9496,12 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8836
9496
|
root.set("docType", value);
|
|
8837
9497
|
};
|
|
8838
9498
|
}
|
|
8839
|
-
|
|
9499
|
+
useEffect20(() => {
|
|
8840
9500
|
if (ixoEditor) {
|
|
8841
9501
|
ixoEditor.isEditable = editable;
|
|
8842
9502
|
}
|
|
8843
9503
|
}, [ixoEditor, editable]);
|
|
8844
|
-
|
|
9504
|
+
useEffect20(() => {
|
|
8845
9505
|
if (connectionStatus !== "connected") {
|
|
8846
9506
|
return;
|
|
8847
9507
|
}
|
|
@@ -8874,19 +9534,19 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8874
9534
|
}
|
|
8875
9535
|
|
|
8876
9536
|
// src/mantine/IxoEditor.tsx
|
|
8877
|
-
import
|
|
9537
|
+
import React105 from "react";
|
|
8878
9538
|
import { getDefaultReactSlashMenuItems, SuggestionMenuController } from "@blocknote/react";
|
|
8879
9539
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
8880
9540
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
8881
9541
|
import { MantineProvider } from "@mantine/core";
|
|
8882
9542
|
|
|
8883
9543
|
// src/mantine/components/PanelContent.tsx
|
|
8884
|
-
import
|
|
9544
|
+
import React104 from "react";
|
|
8885
9545
|
function PanelContent() {
|
|
8886
9546
|
const { activePanel, registeredPanels } = usePanelStore();
|
|
8887
9547
|
const isOpen = activePanel !== null;
|
|
8888
9548
|
const content = activePanel ? registeredPanels.get(activePanel) : null;
|
|
8889
|
-
return /* @__PURE__ */
|
|
9549
|
+
return /* @__PURE__ */ React104.createElement(
|
|
8890
9550
|
"div",
|
|
8891
9551
|
{
|
|
8892
9552
|
style: {
|
|
@@ -8910,7 +9570,7 @@ function IxoEditorContent({
|
|
|
8910
9570
|
onSelectionChange,
|
|
8911
9571
|
children
|
|
8912
9572
|
}) {
|
|
8913
|
-
return /* @__PURE__ */
|
|
9573
|
+
return /* @__PURE__ */ React105.createElement("div", { style: { display: "flex", height: "100%" } }, /* @__PURE__ */ React105.createElement("div", { className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`, style: { flex: 1 } }, /* @__PURE__ */ React105.createElement(
|
|
8914
9574
|
BlockNoteView,
|
|
8915
9575
|
{
|
|
8916
9576
|
editor,
|
|
@@ -8925,7 +9585,7 @@ function IxoEditorContent({
|
|
|
8925
9585
|
onChange,
|
|
8926
9586
|
onSelectionChange
|
|
8927
9587
|
},
|
|
8928
|
-
config.slashMenu && /* @__PURE__ */
|
|
9588
|
+
config.slashMenu && /* @__PURE__ */ React105.createElement(
|
|
8929
9589
|
SuggestionMenuController,
|
|
8930
9590
|
{
|
|
8931
9591
|
triggerCharacter: "/",
|
|
@@ -8937,7 +9597,7 @@ function IxoEditorContent({
|
|
|
8937
9597
|
}
|
|
8938
9598
|
),
|
|
8939
9599
|
children
|
|
8940
|
-
)), /* @__PURE__ */
|
|
9600
|
+
)), /* @__PURE__ */ React105.createElement(PanelContent, null));
|
|
8941
9601
|
}
|
|
8942
9602
|
function IxoEditor({
|
|
8943
9603
|
editor,
|
|
@@ -8963,9 +9623,9 @@ function IxoEditor({
|
|
|
8963
9623
|
tableHandles: true
|
|
8964
9624
|
};
|
|
8965
9625
|
const isEditable = editable;
|
|
8966
|
-
const editorContent = /* @__PURE__ */
|
|
9626
|
+
const editorContent = /* @__PURE__ */ React105.createElement(BlocknoteProvider, { editor, handlers, blockRequirements, editable: isEditable }, /* @__PURE__ */ React105.createElement(IxoEditorContent, { editor, config, isEditable, className, onChange, onSelectionChange }, children));
|
|
8967
9627
|
if (mantineTheme) {
|
|
8968
|
-
return /* @__PURE__ */
|
|
9628
|
+
return /* @__PURE__ */ React105.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
|
|
8969
9629
|
}
|
|
8970
9630
|
return editorContent;
|
|
8971
9631
|
}
|
|
@@ -9049,4 +9709,4 @@ export {
|
|
|
9049
9709
|
ixoGraphQLClient,
|
|
9050
9710
|
getEntity
|
|
9051
9711
|
};
|
|
9052
|
-
//# sourceMappingURL=chunk-
|
|
9712
|
+
//# sourceMappingURL=chunk-7MKIYHNA.mjs.map
|