@ixo/editor 1.10.1 → 1.12.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.
|
@@ -24,29 +24,34 @@ var BlocknoteProvider = ({ children, editor, handlers, blockRequirements, editab
|
|
|
24
24
|
const sharedProposalsRef = useRef({});
|
|
25
25
|
const [activeDrawerId, setActiveDrawerId] = useState(null);
|
|
26
26
|
const [drawerContent, setDrawerContent] = useState(null);
|
|
27
|
-
const
|
|
27
|
+
const initialDocType = editor?.getDocType?.() || "flow";
|
|
28
|
+
console.log("[BlocknoteContext] Initial docType from editor:", initialDocType);
|
|
29
|
+
const [docType, setDocType] = useState(initialDocType);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
console.log("[BlocknoteContext] docType state updated to:", docType);
|
|
32
|
+
}, [docType]);
|
|
28
33
|
useEffect(() => {
|
|
29
34
|
if (!editor?._yRoot) {
|
|
30
|
-
console.log("[BlocknoteContext] No editor._yRoot, skipping
|
|
35
|
+
console.log("[BlocknoteContext] No editor._yRoot, skipping observer setup");
|
|
31
36
|
return;
|
|
32
37
|
}
|
|
33
38
|
const updateDocType = () => {
|
|
34
39
|
const newDocType = editor.getDocType?.() || "flow";
|
|
35
|
-
console.log("[BlocknoteContext]
|
|
36
|
-
|
|
37
|
-
console.log("[BlocknoteContext]
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
+
console.log("[BlocknoteContext] updateDocType() called, newDocType:", newDocType, "current docType:", docType);
|
|
41
|
+
if (newDocType !== docType) {
|
|
42
|
+
console.log("[BlocknoteContext] docType changed from", docType, "to", newDocType);
|
|
43
|
+
setDocType(newDocType);
|
|
44
|
+
}
|
|
40
45
|
};
|
|
41
|
-
console.log("[BlocknoteContext] Setting up
|
|
46
|
+
console.log("[BlocknoteContext] Setting up observer, calling updateDocType() initially");
|
|
42
47
|
updateDocType();
|
|
43
48
|
const observer = () => {
|
|
44
|
-
console.log("[BlocknoteContext] YMap observer
|
|
49
|
+
console.log("[BlocknoteContext] YMap observer triggered, calling updateDocType()");
|
|
45
50
|
updateDocType();
|
|
46
51
|
};
|
|
47
52
|
editor._yRoot?.observe(observer);
|
|
48
53
|
return () => {
|
|
49
|
-
console.log("[BlocknoteContext]
|
|
54
|
+
console.log("[BlocknoteContext] Unobserving YMap");
|
|
50
55
|
editor._yRoot?.unobserve(observer);
|
|
51
56
|
};
|
|
52
57
|
}, [editor]);
|
|
@@ -466,12 +471,6 @@ function PropertyValueInput({ property, value, onChange, disabled = false }) {
|
|
|
466
471
|
|
|
467
472
|
// src/mantine/blocks/components/ConditionBuilder/ConditionRow.tsx
|
|
468
473
|
function ConditionRow({ condition, availableBlocks, onUpdate, onDelete }) {
|
|
469
|
-
console.log("[ConditionRow] Props:", {
|
|
470
|
-
conditionId: condition.id,
|
|
471
|
-
sourceBlockId: condition.sourceBlockId,
|
|
472
|
-
sourceBlockType: condition.sourceBlockType,
|
|
473
|
-
availableBlocks: availableBlocks.length
|
|
474
|
-
});
|
|
475
474
|
const availableProperties = useMemo(() => {
|
|
476
475
|
if (!condition.sourceBlockType) return [];
|
|
477
476
|
return getConditionableProperties(condition.sourceBlockType);
|
|
@@ -507,11 +506,6 @@ function ConditionRow({ condition, availableBlocks, onUpdate, onDelete }) {
|
|
|
507
506
|
);
|
|
508
507
|
const handleSourceBlockChange = useCallback3(
|
|
509
508
|
(value) => {
|
|
510
|
-
console.log("[ConditionRow] Block selection changed:", {
|
|
511
|
-
oldValue: `${condition.sourceBlockType}:${condition.sourceBlockId}`,
|
|
512
|
-
newValue: value,
|
|
513
|
-
conditionId: condition.id
|
|
514
|
-
});
|
|
515
509
|
if (!value) {
|
|
516
510
|
const updatedCondition2 = {
|
|
517
511
|
...condition,
|
|
@@ -519,7 +513,6 @@ function ConditionRow({ condition, availableBlocks, onUpdate, onDelete }) {
|
|
|
519
513
|
sourceBlockType: "",
|
|
520
514
|
rule: { ...condition.rule, property: "", value: "" }
|
|
521
515
|
};
|
|
522
|
-
console.log("[ConditionRow] Calling onUpdate with cleared condition:", updatedCondition2);
|
|
523
516
|
onUpdate(updatedCondition2);
|
|
524
517
|
return;
|
|
525
518
|
}
|
|
@@ -530,7 +523,6 @@ function ConditionRow({ condition, availableBlocks, onUpdate, onDelete }) {
|
|
|
530
523
|
sourceBlockType: blockType,
|
|
531
524
|
rule: { ...condition.rule, property: "", value: "" }
|
|
532
525
|
};
|
|
533
|
-
console.log("[ConditionRow] Calling onUpdate with new block selection:", updatedCondition);
|
|
534
526
|
onUpdate(updatedCondition);
|
|
535
527
|
},
|
|
536
528
|
[condition, onUpdate]
|
|
@@ -646,21 +638,11 @@ function ConditionRow({ condition, availableBlocks, onUpdate, onDelete }) {
|
|
|
646
638
|
|
|
647
639
|
// src/mantine/components/ConditionsTab.tsx
|
|
648
640
|
function ConditionsTab({ block, editor }) {
|
|
649
|
-
console.log("[ConditionsTab] Raw block.props.conditions:", block.props.conditions);
|
|
650
641
|
const currentConditions = parseConditionConfig(block.props.conditions);
|
|
651
642
|
const availableBlocks = getAvailableBlocks(editor?.document || [], block.id);
|
|
652
|
-
console.log("[ConditionsTab] Debug info:", {
|
|
653
|
-
blockId: block?.id,
|
|
654
|
-
blockType: block?.type,
|
|
655
|
-
editorDocument: editor?.document,
|
|
656
|
-
availableBlocks,
|
|
657
|
-
currentConditions
|
|
658
|
-
});
|
|
659
643
|
const updateConditions = useCallback5(
|
|
660
644
|
(newConfig) => {
|
|
661
|
-
console.log("[ConditionsTab] updateConditions called with:", newConfig);
|
|
662
645
|
const conditionsString = stringifyConditionConfig(newConfig);
|
|
663
|
-
console.log("[ConditionsTab] Stringified conditions:", conditionsString);
|
|
664
646
|
editor.updateBlock(block, {
|
|
665
647
|
props: {
|
|
666
648
|
...block.props,
|
|
@@ -680,33 +662,23 @@ function ConditionsTab({ block, editor }) {
|
|
|
680
662
|
[currentConditions, updateConditions]
|
|
681
663
|
);
|
|
682
664
|
const handleAddCondition = useCallback5(() => {
|
|
683
|
-
console.log("[ConditionsTab] handleAddCondition called");
|
|
684
|
-
console.log("[ConditionsTab] Current conditions before adding:", currentConditions);
|
|
685
665
|
const newCondition = createDefaultCondition();
|
|
686
|
-
console.log("[ConditionsTab] Created new condition:", newCondition);
|
|
687
666
|
const newConfig = {
|
|
688
667
|
...currentConditions,
|
|
689
668
|
enabled: true,
|
|
690
669
|
// Auto-enable when adding first condition
|
|
691
670
|
conditions: [...currentConditions.conditions, newCondition]
|
|
692
671
|
};
|
|
693
|
-
console.log("[ConditionsTab] New config to be saved:", newConfig);
|
|
694
672
|
updateConditions(newConfig);
|
|
695
673
|
}, [currentConditions, updateConditions]);
|
|
696
674
|
const handleUpdateCondition = useCallback5(
|
|
697
675
|
(index, updatedCondition) => {
|
|
698
|
-
console.log("[ConditionsTab] Updating condition at index:", {
|
|
699
|
-
index,
|
|
700
|
-
updatedCondition,
|
|
701
|
-
currentConditions: currentConditions.conditions.length
|
|
702
|
-
});
|
|
703
676
|
const newConditions = [...currentConditions.conditions];
|
|
704
677
|
newConditions[index] = updatedCondition;
|
|
705
678
|
const newConfig = {
|
|
706
679
|
...currentConditions,
|
|
707
680
|
conditions: newConditions
|
|
708
681
|
};
|
|
709
|
-
console.log("[ConditionsTab] New config being sent:", newConfig);
|
|
710
682
|
updateConditions(newConfig);
|
|
711
683
|
},
|
|
712
684
|
[currentConditions, updateConditions]
|
|
@@ -740,14 +712,7 @@ function ConditionsTab({ block, editor }) {
|
|
|
740
712
|
onChange: handleModeChange,
|
|
741
713
|
fullWidth: true
|
|
742
714
|
}
|
|
743
|
-
)), /* @__PURE__ */ React5.createElement(Stack4, { gap: "sm" }, (() => {
|
|
744
|
-
console.log("[ConditionsTab] Rendering conditions:", {
|
|
745
|
-
conditionsCount: currentConditions.conditions.length,
|
|
746
|
-
conditions: currentConditions.conditions
|
|
747
|
-
});
|
|
748
|
-
return null;
|
|
749
|
-
})(), currentConditions.conditions.map((condition, index) => {
|
|
750
|
-
console.log("[ConditionsTab] Rendering condition at index:", index, condition);
|
|
715
|
+
)), /* @__PURE__ */ React5.createElement(Stack4, { gap: "sm" }, currentConditions.conditions.map((condition, index) => {
|
|
751
716
|
return /* @__PURE__ */ React5.createElement(
|
|
752
717
|
ConditionRow,
|
|
753
718
|
{
|
|
@@ -1036,14 +1001,15 @@ import { Card as Card2, Checkbox, Group as Group2, Stack as Stack6, Text as Text
|
|
|
1036
1001
|
|
|
1037
1002
|
// src/mantine/utils/iconMap.tsx
|
|
1038
1003
|
import React9 from "react";
|
|
1039
|
-
import { IconSquareCheck, IconFileText, IconCheckbox, IconNote, IconChecklist, IconThumbUp } from "@tabler/icons-react";
|
|
1004
|
+
import { IconSquareCheck, IconFileText, IconCheckbox, IconNote, IconChecklist, IconThumbUp, IconBell } from "@tabler/icons-react";
|
|
1040
1005
|
var ICON_MAP = {
|
|
1041
1006
|
"square-check": IconSquareCheck,
|
|
1042
1007
|
"file-text": IconFileText,
|
|
1043
1008
|
checklist: IconChecklist,
|
|
1044
1009
|
checkbox: IconCheckbox,
|
|
1045
1010
|
note: IconNote,
|
|
1046
|
-
"thumb-up": IconThumbUp
|
|
1011
|
+
"thumb-up": IconThumbUp,
|
|
1012
|
+
bell: IconBell
|
|
1047
1013
|
};
|
|
1048
1014
|
var getIcon = (key, size = 20, stroke = 1.5, fallback = "square-check") => {
|
|
1049
1015
|
const validKey = key in ICON_MAP ? key : fallback;
|
|
@@ -1257,7 +1223,6 @@ function useBlockConditions(block, editor, currentUser) {
|
|
|
1257
1223
|
function CheckboxBlock({ editor, block }) {
|
|
1258
1224
|
const { docType } = useBlocknoteContext();
|
|
1259
1225
|
const { actions } = useBlockConditions(block, editor);
|
|
1260
|
-
console.log("Rendering CheckboxBlock with actions:", actions);
|
|
1261
1226
|
if (docType === "template") {
|
|
1262
1227
|
return /* @__PURE__ */ React12.createElement(CheckboxTemplateView, { editor, block });
|
|
1263
1228
|
}
|
|
@@ -1266,19 +1231,11 @@ function CheckboxBlock({ editor, block }) {
|
|
|
1266
1231
|
const showActionExists = actions.some((a) => a.action === "show");
|
|
1267
1232
|
const shouldHide = hasVisibility && !showActionExists;
|
|
1268
1233
|
if (shouldHide) {
|
|
1269
|
-
console.log("[CheckboxBlock] Hiding block - visibility conditions exist but none passed");
|
|
1270
1234
|
return null;
|
|
1271
1235
|
}
|
|
1272
1236
|
const hasEnable = hasEnableConditions(conditionConfig);
|
|
1273
1237
|
const enableActionExists = actions.some((a) => a.action === "enable");
|
|
1274
1238
|
const shouldDisable = hasEnable && !enableActionExists;
|
|
1275
|
-
console.log("[CheckboxBlock] Enable state:", {
|
|
1276
|
-
blockId: block.id,
|
|
1277
|
-
hasEnable,
|
|
1278
|
-
enableActionExists,
|
|
1279
|
-
shouldDisable,
|
|
1280
|
-
actions
|
|
1281
|
-
});
|
|
1282
1239
|
return /* @__PURE__ */ React12.createElement(
|
|
1283
1240
|
CheckboxFlowView,
|
|
1284
1241
|
{
|
|
@@ -2439,7 +2396,6 @@ var ListActionsMenu = ({ options, selectionMode, onSelectActionClick, value, onC
|
|
|
2439
2396
|
key: `${opt.key}-${direction}`,
|
|
2440
2397
|
leftSection: /* @__PURE__ */ React31.createElement(Icon, { size: 16 }),
|
|
2441
2398
|
onClick: () => {
|
|
2442
|
-
console.log("Changing sort: ", direction);
|
|
2443
2399
|
onChange({ key: opt.key, direction });
|
|
2444
2400
|
},
|
|
2445
2401
|
"data-active": isActive
|
|
@@ -2971,7 +2927,6 @@ var ListFlowView = ({ block, editor }) => {
|
|
|
2971
2927
|
}, [handlers, page, listType, listConfig]);
|
|
2972
2928
|
useEffect6(() => {
|
|
2973
2929
|
if (listType && listConfig) {
|
|
2974
|
-
console.log("[ListFlowView] useEffect", listType, listConfig);
|
|
2975
2930
|
fetchData();
|
|
2976
2931
|
}
|
|
2977
2932
|
}, [listType, page, listConfig]);
|
|
@@ -2998,7 +2953,6 @@ var ListFlowView = ({ block, editor }) => {
|
|
|
2998
2953
|
}, [data?.items, sortedData, listFilterConfig]);
|
|
2999
2954
|
const renderListComponent = () => {
|
|
3000
2955
|
if (!filteredData || !listType) return null;
|
|
3001
|
-
console.log("[ListFlowView] renderListComponent", data, listType);
|
|
3002
2956
|
switch (listType) {
|
|
3003
2957
|
case "linked_resources":
|
|
3004
2958
|
return /* @__PURE__ */ React37.createElement(LinkedResourcesList, { items: filteredData, config: listConfig, mods: selectionMode, isItemChecked, onItemCheck });
|
|
@@ -3238,16 +3192,37 @@ import { Paper as Paper6, CloseButton as CloseButton4, Title as Title4 } from "@
|
|
|
3238
3192
|
|
|
3239
3193
|
// src/mantine/blocks/proposal/template/GeneralTab.tsx
|
|
3240
3194
|
import React41, { useEffect as useEffect8, useState as useState8 } from "react";
|
|
3241
|
-
import { Stack as Stack25, Text as Text25, TextInput as TextInput5, Textarea as Textarea2 } from "@mantine/core";
|
|
3242
|
-
var GeneralTab3 = ({ title, description, onTitleChange, onDescriptionChange }) => {
|
|
3195
|
+
import { Stack as Stack25, Text as Text25, TextInput as TextInput5, Textarea as Textarea2, Select as Select3, Loader as Loader3 } from "@mantine/core";
|
|
3196
|
+
var GeneralTab3 = ({ title, description, coreAddress, onTitleChange, onDescriptionChange, onGroupChange }) => {
|
|
3197
|
+
const handlers = useBlocknoteHandlers();
|
|
3243
3198
|
const [localTitle, setLocalTitle] = useState8(title || "");
|
|
3244
3199
|
const [localDescription, setLocalDescription] = useState8(description || "");
|
|
3200
|
+
const [groups, setGroups] = useState8([]);
|
|
3201
|
+
const [loadingGroups, setLoadingGroups] = useState8(false);
|
|
3245
3202
|
useEffect8(() => {
|
|
3246
3203
|
setLocalTitle(title || "");
|
|
3247
3204
|
}, [title]);
|
|
3248
3205
|
useEffect8(() => {
|
|
3249
3206
|
setLocalDescription(description || "");
|
|
3250
3207
|
}, [description]);
|
|
3208
|
+
useEffect8(() => {
|
|
3209
|
+
const fetchGroups = async () => {
|
|
3210
|
+
if (!handlers?.getDAOGroups) {
|
|
3211
|
+
console.warn("getDAOGroups handler not available");
|
|
3212
|
+
return;
|
|
3213
|
+
}
|
|
3214
|
+
setLoadingGroups(true);
|
|
3215
|
+
try {
|
|
3216
|
+
const daoGroups = await handlers.getDAOGroups();
|
|
3217
|
+
setGroups(daoGroups);
|
|
3218
|
+
} catch (error) {
|
|
3219
|
+
console.error("Failed to fetch DAO groups:", error);
|
|
3220
|
+
} finally {
|
|
3221
|
+
setLoadingGroups(false);
|
|
3222
|
+
}
|
|
3223
|
+
};
|
|
3224
|
+
fetchGroups();
|
|
3225
|
+
}, [handlers]);
|
|
3251
3226
|
return /* @__PURE__ */ React41.createElement(Stack25, { gap: "lg" }, /* @__PURE__ */ React41.createElement(Stack25, { gap: "xs" }, /* @__PURE__ */ React41.createElement(Text25, { size: "sm", fw: 600 }, "Title"), /* @__PURE__ */ React41.createElement(
|
|
3252
3227
|
TextInput5,
|
|
3253
3228
|
{
|
|
@@ -3271,6 +3246,27 @@ var GeneralTab3 = ({ title, description, onTitleChange, onDescriptionChange }) =
|
|
|
3271
3246
|
onDescriptionChange(newDescription);
|
|
3272
3247
|
}
|
|
3273
3248
|
}
|
|
3249
|
+
)), /* @__PURE__ */ React41.createElement(Stack25, { gap: "xs" }, /* @__PURE__ */ React41.createElement(Text25, { size: "sm", fw: 600 }, "Group"), /* @__PURE__ */ React41.createElement(
|
|
3250
|
+
Select3,
|
|
3251
|
+
{
|
|
3252
|
+
placeholder: loadingGroups ? "Loading groups..." : "Select a DAO group",
|
|
3253
|
+
value: groups.find((g) => g.coreAddress === coreAddress)?.id || null,
|
|
3254
|
+
onChange: (value) => {
|
|
3255
|
+
if (value) {
|
|
3256
|
+
const selectedGroup = groups.find((g) => g.id === value);
|
|
3257
|
+
if (selectedGroup) {
|
|
3258
|
+
onGroupChange(selectedGroup.coreAddress);
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
},
|
|
3262
|
+
data: groups.map((group) => ({
|
|
3263
|
+
value: group.id,
|
|
3264
|
+
label: group.name
|
|
3265
|
+
})),
|
|
3266
|
+
disabled: loadingGroups,
|
|
3267
|
+
rightSection: loadingGroups ? /* @__PURE__ */ React41.createElement(Loader3, { size: "xs" }) : void 0,
|
|
3268
|
+
searchable: true
|
|
3269
|
+
}
|
|
3274
3270
|
)));
|
|
3275
3271
|
};
|
|
3276
3272
|
|
|
@@ -3573,7 +3569,7 @@ var UpdateMembersActionForm = ({ data, onChange }) => {
|
|
|
3573
3569
|
|
|
3574
3570
|
// src/mantine/blocks/proposal/actions-components/StakeActionForm.tsx
|
|
3575
3571
|
import React45 from "react";
|
|
3576
|
-
import { Stack as Stack29, TextInput as TextInput8, Select as
|
|
3572
|
+
import { Stack as Stack29, TextInput as TextInput8, Select as Select4, NumberInput as NumberInput3 } from "@mantine/core";
|
|
3577
3573
|
var stakeTypeOptions = [
|
|
3578
3574
|
{ value: StakeType.Delegate, label: "Delegate" },
|
|
3579
3575
|
{ value: StakeType.Undelegate, label: "Undelegate" },
|
|
@@ -3619,7 +3615,7 @@ var StakeActionForm = ({ data, onChange }) => {
|
|
|
3619
3615
|
const isRedelegate = data.stakeType === StakeType.Redelegate;
|
|
3620
3616
|
const needsAmount = data.stakeType !== StakeType.WithdrawDelegatorReward;
|
|
3621
3617
|
return /* @__PURE__ */ React45.createElement(Stack29, { gap: "md" }, /* @__PURE__ */ React45.createElement(
|
|
3622
|
-
|
|
3618
|
+
Select4,
|
|
3623
3619
|
{
|
|
3624
3620
|
label: "Stake Type",
|
|
3625
3621
|
value: data.stakeType,
|
|
@@ -3661,7 +3657,7 @@ var StakeActionForm = ({ data, onChange }) => {
|
|
|
3661
3657
|
styles: inputStyles
|
|
3662
3658
|
}
|
|
3663
3659
|
), /* @__PURE__ */ React45.createElement(
|
|
3664
|
-
|
|
3660
|
+
Select4,
|
|
3665
3661
|
{
|
|
3666
3662
|
label: "Denomination",
|
|
3667
3663
|
value: data.denom,
|
|
@@ -3891,7 +3887,7 @@ Example Stargate message:
|
|
|
3891
3887
|
|
|
3892
3888
|
// src/mantine/blocks/proposal/actions-components/forms/AuthzExecActionForm.tsx
|
|
3893
3889
|
import React50 from "react";
|
|
3894
|
-
import { Stack as Stack34, Select as
|
|
3890
|
+
import { Stack as Stack34, Select as Select5, TextInput as TextInput12, Textarea as Textarea5 } from "@mantine/core";
|
|
3895
3891
|
var inputStyles6 = {
|
|
3896
3892
|
label: { color: "#adb5bd" },
|
|
3897
3893
|
input: {
|
|
@@ -3927,7 +3923,7 @@ var AuthzExecActionForm = ({ data, onChange }) => {
|
|
|
3927
3923
|
}
|
|
3928
3924
|
};
|
|
3929
3925
|
return /* @__PURE__ */ React50.createElement(Stack34, { gap: "md" }, /* @__PURE__ */ React50.createElement(
|
|
3930
|
-
|
|
3926
|
+
Select5,
|
|
3931
3927
|
{
|
|
3932
3928
|
label: "Action Type",
|
|
3933
3929
|
placeholder: "Select action type",
|
|
@@ -4749,7 +4745,7 @@ var CreateEntityActionForm = ({ data, onChange }) => {
|
|
|
4749
4745
|
|
|
4750
4746
|
// src/mantine/blocks/proposal/actions-components/forms/UpdateVotingConfigActionForm.tsx
|
|
4751
4747
|
import React65 from "react";
|
|
4752
|
-
import { Stack as Stack49, Checkbox as Checkbox6, Select as
|
|
4748
|
+
import { Stack as Stack49, Checkbox as Checkbox6, Select as Select6, NumberInput as NumberInput7, Group as Group18 } from "@mantine/core";
|
|
4753
4749
|
var inputStyles21 = {
|
|
4754
4750
|
label: { color: "#adb5bd" },
|
|
4755
4751
|
input: {
|
|
@@ -4774,7 +4770,7 @@ var UpdateVotingConfigActionForm = ({ data, onChange }) => {
|
|
|
4774
4770
|
}
|
|
4775
4771
|
}
|
|
4776
4772
|
), /* @__PURE__ */ React65.createElement(
|
|
4777
|
-
|
|
4773
|
+
Select6,
|
|
4778
4774
|
{
|
|
4779
4775
|
label: "Threshold Type",
|
|
4780
4776
|
value: data.thresholdType,
|
|
@@ -4809,7 +4805,7 @@ var UpdateVotingConfigActionForm = ({ data, onChange }) => {
|
|
|
4809
4805
|
}
|
|
4810
4806
|
}
|
|
4811
4807
|
), data.quorumEnabled && /* @__PURE__ */ React65.createElement(React65.Fragment, null, /* @__PURE__ */ React65.createElement(
|
|
4812
|
-
|
|
4808
|
+
Select6,
|
|
4813
4809
|
{
|
|
4814
4810
|
label: "Quorum Type",
|
|
4815
4811
|
value: data.quorumType,
|
|
@@ -4843,7 +4839,7 @@ var UpdateVotingConfigActionForm = ({ data, onChange }) => {
|
|
|
4843
4839
|
styles: inputStyles21
|
|
4844
4840
|
}
|
|
4845
4841
|
), /* @__PURE__ */ React65.createElement(
|
|
4846
|
-
|
|
4842
|
+
Select6,
|
|
4847
4843
|
{
|
|
4848
4844
|
label: "Duration Units",
|
|
4849
4845
|
value: data.proposalDurationUnits,
|
|
@@ -4872,7 +4868,7 @@ var UpdateVotingConfigActionForm = ({ data, onChange }) => {
|
|
|
4872
4868
|
|
|
4873
4869
|
// src/mantine/blocks/proposal/actions-components/forms/UpdatePreProposeConfigActionForm.tsx
|
|
4874
4870
|
import React66 from "react";
|
|
4875
|
-
import { Stack as Stack50, Checkbox as Checkbox7, TextInput as TextInput26, Select as
|
|
4871
|
+
import { Stack as Stack50, Checkbox as Checkbox7, TextInput as TextInput26, Select as Select7, Textarea as Textarea14 } from "@mantine/core";
|
|
4876
4872
|
var inputStyles22 = {
|
|
4877
4873
|
label: { color: "#adb5bd" },
|
|
4878
4874
|
input: {
|
|
@@ -4921,7 +4917,7 @@ var UpdatePreProposeConfigActionForm = ({ data, onChange }) => {
|
|
|
4921
4917
|
styles: inputStyles22
|
|
4922
4918
|
}
|
|
4923
4919
|
), /* @__PURE__ */ React66.createElement(
|
|
4924
|
-
|
|
4920
|
+
Select7,
|
|
4925
4921
|
{
|
|
4926
4922
|
label: "Deposit Type",
|
|
4927
4923
|
value: data.depositInfo.type,
|
|
@@ -4986,7 +4982,7 @@ var UpdatePreProposeConfigActionForm = ({ data, onChange }) => {
|
|
|
4986
4982
|
|
|
4987
4983
|
// src/mantine/blocks/proposal/actions-components/forms/GovernanceVoteActionForm.tsx
|
|
4988
4984
|
import React67 from "react";
|
|
4989
|
-
import { Stack as Stack51, TextInput as TextInput27, Select as
|
|
4985
|
+
import { Stack as Stack51, TextInput as TextInput27, Select as Select8 } from "@mantine/core";
|
|
4990
4986
|
var inputStyles23 = {
|
|
4991
4987
|
label: { color: "#adb5bd" },
|
|
4992
4988
|
input: {
|
|
@@ -5016,7 +5012,7 @@ var GovernanceVoteActionForm = ({ data, onChange }) => {
|
|
|
5016
5012
|
styles: inputStyles23
|
|
5017
5013
|
}
|
|
5018
5014
|
), /* @__PURE__ */ React67.createElement(
|
|
5019
|
-
|
|
5015
|
+
Select8,
|
|
5020
5016
|
{
|
|
5021
5017
|
label: "Vote Option",
|
|
5022
5018
|
value: data.vote?.toString() || "1",
|
|
@@ -5216,7 +5212,7 @@ var SendGroupTokenActionForm = ({ data, onChange }) => {
|
|
|
5216
5212
|
|
|
5217
5213
|
// src/mantine/blocks/proposal/actions-components/forms/ValidatorActionsActionForm.tsx
|
|
5218
5214
|
import React72 from "react";
|
|
5219
|
-
import { Stack as Stack56, Select as
|
|
5215
|
+
import { Stack as Stack56, Select as Select9, Textarea as Textarea16 } from "@mantine/core";
|
|
5220
5216
|
var inputStyles28 = {
|
|
5221
5217
|
label: { color: "#adb5bd" },
|
|
5222
5218
|
input: {
|
|
@@ -5236,7 +5232,7 @@ var ValidatorActionsActionForm = ({ data, onChange }) => {
|
|
|
5236
5232
|
{ value: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission" /* WithdrawValidatorCommission */, label: "Withdraw Commission" }
|
|
5237
5233
|
];
|
|
5238
5234
|
return /* @__PURE__ */ React72.createElement(Stack56, { gap: "md" }, /* @__PURE__ */ React72.createElement(
|
|
5239
|
-
|
|
5235
|
+
Select9,
|
|
5240
5236
|
{
|
|
5241
5237
|
label: "Validator Action Type",
|
|
5242
5238
|
value: data.validatorActionType,
|
|
@@ -6226,8 +6222,10 @@ var TemplateConfig3 = ({ editor, block }) => {
|
|
|
6226
6222
|
{
|
|
6227
6223
|
title: block.props.title || "",
|
|
6228
6224
|
description: block.props.description || "",
|
|
6225
|
+
coreAddress: block.props.coreAddress || "",
|
|
6229
6226
|
onTitleChange: (value) => updateProp("title", value),
|
|
6230
|
-
onDescriptionChange: (value) => updateProp("description", value)
|
|
6227
|
+
onDescriptionChange: (value) => updateProp("description", value),
|
|
6228
|
+
onGroupChange: (coreAddress) => updateProp("coreAddress", coreAddress)
|
|
6231
6229
|
}
|
|
6232
6230
|
)
|
|
6233
6231
|
},
|
|
@@ -6363,8 +6361,6 @@ var parseStatus = (value) => {
|
|
|
6363
6361
|
return isChainStatus(value) ? value : null;
|
|
6364
6362
|
};
|
|
6365
6363
|
var useFlowBusinessLogic = ({ block, editor }) => {
|
|
6366
|
-
const { blockRequirements } = useBlocknoteContext();
|
|
6367
|
-
const coreAddress = blockRequirements?.proposal?.coreAddress;
|
|
6368
6364
|
const [proposalContractAddress, setProposalContractAddress] = useState17(null);
|
|
6369
6365
|
const [isExecuting, setIsExecuting] = useState17(false);
|
|
6370
6366
|
const [executionError, setExecutionError] = useState17(null);
|
|
@@ -6380,6 +6376,7 @@ var useFlowBusinessLogic = ({ block, editor }) => {
|
|
|
6380
6376
|
const icon = props.icon || "\u{1F4DD}";
|
|
6381
6377
|
const proposalId = props.proposalId || "";
|
|
6382
6378
|
const status = parseStatus(props.status);
|
|
6379
|
+
const coreAddress = props.coreAddress || "";
|
|
6383
6380
|
const shouldFetch = !!proposalId && !!status && !!proposalContractAddress;
|
|
6384
6381
|
const {
|
|
6385
6382
|
proposal,
|
|
@@ -6460,24 +6457,14 @@ var useFlowBusinessLogic = ({ block, editor }) => {
|
|
|
6460
6457
|
let actions = [];
|
|
6461
6458
|
try {
|
|
6462
6459
|
const actionsJson = block.props.actions;
|
|
6463
|
-
console.log("[createProposal] Raw actions from block.props:", actionsJson);
|
|
6464
6460
|
if (actionsJson) {
|
|
6465
6461
|
actions = JSON.parse(actionsJson);
|
|
6466
|
-
console.log("[createProposal] Parsed actions:", actions);
|
|
6467
6462
|
}
|
|
6468
6463
|
} catch (error) {
|
|
6469
|
-
console.error("[createProposal] Failed to parse actions:", error);
|
|
6470
6464
|
}
|
|
6471
6465
|
const { preProposalContractAddress } = await handlers.getPreProposalContractAddress({
|
|
6472
6466
|
coreAddress: coreAddress2
|
|
6473
6467
|
});
|
|
6474
|
-
console.log("[createProposal] Creating proposal with params:", {
|
|
6475
|
-
title: localTitle,
|
|
6476
|
-
description: localDescription,
|
|
6477
|
-
actionsCount: actions.length,
|
|
6478
|
-
actions,
|
|
6479
|
-
coreAddress: coreAddress2
|
|
6480
|
-
});
|
|
6481
6468
|
const { groupContractAddress } = await handlers.getGroupContractAddress({
|
|
6482
6469
|
coreAddress: coreAddress2
|
|
6483
6470
|
});
|
|
@@ -6516,8 +6503,6 @@ var useFlowBusinessLogic = ({ block, editor }) => {
|
|
|
6516
6503
|
// src/mantine/blocks/proposal/flow/useVoteBusinessLogic.ts
|
|
6517
6504
|
import { useState as useState18, useEffect as useEffect13 } from "react";
|
|
6518
6505
|
var useVoteBusinessLogic = ({ block, editor }) => {
|
|
6519
|
-
const { blockRequirements } = useBlocknoteContext();
|
|
6520
|
-
const coreAddress = blockRequirements?.proposal?.coreAddress;
|
|
6521
6506
|
const [localError, setLocalError] = useState18(null);
|
|
6522
6507
|
const [userVote, setUserVote] = useState18(null);
|
|
6523
6508
|
const [proposalContractAddress, setProposalContractAddress] = useState18(null);
|
|
@@ -6531,6 +6516,7 @@ var useVoteBusinessLogic = ({ block, editor }) => {
|
|
|
6531
6516
|
const title = block.props.title || "";
|
|
6532
6517
|
const description = block.props.description || "";
|
|
6533
6518
|
const status = block.props.status || "draft";
|
|
6519
|
+
const coreAddress = block.props.coreAddress || "";
|
|
6534
6520
|
useEffect13(() => {
|
|
6535
6521
|
if (!handlers || !coreAddress || !proposalId) {
|
|
6536
6522
|
setProposalContractAddress(null);
|
|
@@ -6945,8 +6931,7 @@ var ActionsTab2 = ({ actions, onActionsChange, editor, block, isProposalCreated
|
|
|
6945
6931
|
// src/mantine/blocks/proposal/flow/FlowConfig.tsx
|
|
6946
6932
|
var FlowConfig = ({ editor, block }) => {
|
|
6947
6933
|
const { closePanel } = usePanelStore();
|
|
6948
|
-
const
|
|
6949
|
-
const coreAddress = blockRequirements?.proposal?.coreAddress;
|
|
6934
|
+
const coreAddress = block.props.coreAddress || "";
|
|
6950
6935
|
const [errors, setErrors] = useState21({});
|
|
6951
6936
|
const [isCreating, setIsCreating] = useState21(false);
|
|
6952
6937
|
const { createProposal, title, description, proposalId } = useFlowBusinessLogic({
|
|
@@ -7118,9 +7103,12 @@ var ProposalFlowView = ({ block, editor }) => {
|
|
|
7118
7103
|
// src/mantine/blocks/proposal/ProposalBlock.tsx
|
|
7119
7104
|
function ProposalBlock({ editor, block }) {
|
|
7120
7105
|
const { docType } = useBlocknoteContext();
|
|
7106
|
+
console.log("[ProposalBlock] Rendering with docType:", docType);
|
|
7121
7107
|
if (docType === "template") {
|
|
7108
|
+
console.log("[ProposalBlock] Rendering ProposalTemplateView (docType is template)");
|
|
7122
7109
|
return /* @__PURE__ */ React83.createElement(ProposalTemplateView, { editor, block });
|
|
7123
7110
|
}
|
|
7111
|
+
console.log("[ProposalBlock] Rendering ProposalFlowView (docType is flow)");
|
|
7124
7112
|
return /* @__PURE__ */ React83.createElement(ProposalFlowView, { block, editor });
|
|
7125
7113
|
}
|
|
7126
7114
|
|
|
@@ -7168,6 +7156,9 @@ var ProposalBlockSpec = createReactBlockSpec4(
|
|
|
7168
7156
|
proposalContractAddress: {
|
|
7169
7157
|
default: ""
|
|
7170
7158
|
},
|
|
7159
|
+
coreAddress: {
|
|
7160
|
+
default: ""
|
|
7161
|
+
},
|
|
7171
7162
|
conditions: {
|
|
7172
7163
|
default: ""
|
|
7173
7164
|
}
|
|
@@ -7198,7 +7189,7 @@ import { Paper as Paper9, CloseButton as CloseButton6, Title as Title6 } from "@
|
|
|
7198
7189
|
|
|
7199
7190
|
// src/mantine/blocks/apiRequest/template/GeneralTab.tsx
|
|
7200
7191
|
import React85, { useEffect as useEffect15, useState as useState22 } from "react";
|
|
7201
|
-
import { Divider as Divider5, Select as
|
|
7192
|
+
import { Divider as Divider5, Select as Select10, Stack as Stack65, Text as Text40, TextInput as TextInput34, Textarea as Textarea19, Button as Button17, Group as Group23, ActionIcon as ActionIcon9, Paper as Paper8 } from "@mantine/core";
|
|
7202
7193
|
import { IconTrash, IconPlus } from "@tabler/icons-react";
|
|
7203
7194
|
var GeneralTab4 = ({
|
|
7204
7195
|
title,
|
|
@@ -7282,7 +7273,7 @@ var GeneralTab4 = ({
|
|
|
7282
7273
|
}
|
|
7283
7274
|
}
|
|
7284
7275
|
)), /* @__PURE__ */ React85.createElement(Divider5, { variant: "dashed" }), /* @__PURE__ */ React85.createElement(Stack65, { gap: "xs" }, /* @__PURE__ */ React85.createElement(Text40, { size: "sm", fw: 600 }, "HTTP Method"), /* @__PURE__ */ React85.createElement(
|
|
7285
|
-
|
|
7276
|
+
Select10,
|
|
7286
7277
|
{
|
|
7287
7278
|
value: localMethod,
|
|
7288
7279
|
onChange: (value) => {
|
|
@@ -7468,7 +7459,7 @@ var ApiRequestTemplateView = ({ editor, block }) => {
|
|
|
7468
7459
|
|
|
7469
7460
|
// src/mantine/blocks/apiRequest/flow/FlowView.tsx
|
|
7470
7461
|
import React88, { useState as useState23 } from "react";
|
|
7471
|
-
import { Card as Card20, Group as Group25, Stack as Stack67, Text as Text42, ActionIcon as ActionIcon11, Tooltip as Tooltip4, Button as Button18, Badge as Badge11, Collapse, Code, Loader as
|
|
7462
|
+
import { Card as Card20, Group as Group25, Stack as Stack67, Text as Text42, ActionIcon as ActionIcon11, Tooltip as Tooltip4, Button as Button18, Badge as Badge11, Collapse, Code, Loader as Loader4, Alert as Alert9 } from "@mantine/core";
|
|
7472
7463
|
import { IconSend, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
|
|
7473
7464
|
var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
7474
7465
|
const disabled = isDisabled?.isDisabled === "disable";
|
|
@@ -7592,7 +7583,7 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
7592
7583
|
size: "sm",
|
|
7593
7584
|
variant: "light",
|
|
7594
7585
|
color: getMethodColor(method),
|
|
7595
|
-
leftSection: isLoading ? /* @__PURE__ */ React88.createElement(
|
|
7586
|
+
leftSection: isLoading ? /* @__PURE__ */ React88.createElement(Loader4, { size: 14 }) : /* @__PURE__ */ React88.createElement(IconSend, { size: 14 }),
|
|
7596
7587
|
onClick: handleExecuteRequest,
|
|
7597
7588
|
disabled: disabled || isLoading || !endpoint,
|
|
7598
7589
|
style: { flexShrink: 0 }
|
|
@@ -7639,13 +7630,7 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
7639
7630
|
function ApiRequestBlock({ editor, block }) {
|
|
7640
7631
|
const { docType } = useBlocknoteContext();
|
|
7641
7632
|
const { actions } = useBlockConditions(block, editor);
|
|
7642
|
-
console.log("[ApiRequestBlock] Rendering with:", {
|
|
7643
|
-
blockId: block.id,
|
|
7644
|
-
docType,
|
|
7645
|
-
actions
|
|
7646
|
-
});
|
|
7647
7633
|
if (docType === "template") {
|
|
7648
|
-
console.log("[ApiRequestBlock] Rendering template view for block:", block.id);
|
|
7649
7634
|
return /* @__PURE__ */ React89.createElement(ApiRequestTemplateView, { editor, block });
|
|
7650
7635
|
}
|
|
7651
7636
|
const conditionConfig = parseConditionConfig(block.props.conditions);
|
|
@@ -7653,19 +7638,11 @@ function ApiRequestBlock({ editor, block }) {
|
|
|
7653
7638
|
const showActionExists = actions.some((a) => a.action === "show");
|
|
7654
7639
|
const shouldHide = hasVisibility && !showActionExists;
|
|
7655
7640
|
if (shouldHide) {
|
|
7656
|
-
console.log("[ApiRequestBlock] Hiding block - visibility conditions exist but none passed");
|
|
7657
7641
|
return null;
|
|
7658
7642
|
}
|
|
7659
7643
|
const hasEnable = hasEnableConditions(conditionConfig);
|
|
7660
7644
|
const enableActionExists = actions.some((a) => a.action === "enable");
|
|
7661
7645
|
const shouldDisable = hasEnable && !enableActionExists;
|
|
7662
|
-
console.log("[ApiRequestBlock] Enable state:", {
|
|
7663
|
-
blockId: block.id,
|
|
7664
|
-
hasEnable,
|
|
7665
|
-
enableActionExists,
|
|
7666
|
-
shouldDisable,
|
|
7667
|
-
actions
|
|
7668
|
-
});
|
|
7669
7646
|
return /* @__PURE__ */ React89.createElement(
|
|
7670
7647
|
ApiRequestFlowView,
|
|
7671
7648
|
{
|
|
@@ -7952,7 +7929,7 @@ var EnumChecklistPreviewStep = ({ listType, onAddToBlock, onPrev }) => {
|
|
|
7952
7929
|
|
|
7953
7930
|
// src/mantine/blocks/enumChecklist/EnumChecklistConfigurationStep.tsx
|
|
7954
7931
|
import React95 from "react";
|
|
7955
|
-
import { Stack as Stack72, TextInput as TextInput35, Text as Text47, Button as Button22, Group as Group28, Switch as Switch4, Select as
|
|
7932
|
+
import { Stack as Stack72, TextInput as TextInput35, Text as Text47, Button as Button22, Group as Group28, Switch as Switch4, Select as Select11 } from "@mantine/core";
|
|
7956
7933
|
var EnumChecklistConfigurationStep = ({ enumChecklistType: listType, config, onConfigChange, onPrev, onNext, isValid }) => {
|
|
7957
7934
|
const typeConfig = ENUM_LIST_CONFIG[listType];
|
|
7958
7935
|
const configFields = getEnumListTypesConfigFields(listType);
|
|
@@ -7982,7 +7959,7 @@ var EnumChecklistConfigurationStep = ({ enumChecklistType: listType, config, onC
|
|
|
7982
7959
|
);
|
|
7983
7960
|
case "select":
|
|
7984
7961
|
return /* @__PURE__ */ React95.createElement(
|
|
7985
|
-
|
|
7962
|
+
Select11,
|
|
7986
7963
|
{
|
|
7987
7964
|
label: field.label,
|
|
7988
7965
|
description: field.description,
|
|
@@ -8227,6 +8204,566 @@ var EnumChecklistBlock = createReactBlockSpec6(
|
|
|
8227
8204
|
}
|
|
8228
8205
|
);
|
|
8229
8206
|
|
|
8207
|
+
// src/mantine/blocks/notify/NotifyBlockSpec.tsx
|
|
8208
|
+
import React103 from "react";
|
|
8209
|
+
import { createReactBlockSpec as createReactBlockSpec7 } from "@blocknote/react";
|
|
8210
|
+
|
|
8211
|
+
// src/mantine/blocks/notify/NotifyBlock.tsx
|
|
8212
|
+
import React102 from "react";
|
|
8213
|
+
|
|
8214
|
+
// src/mantine/blocks/notify/template/TemplateView.tsx
|
|
8215
|
+
import React100, { useMemo as useMemo14 } from "react";
|
|
8216
|
+
|
|
8217
|
+
// src/mantine/blocks/notify/template/TemplateConfig.tsx
|
|
8218
|
+
import React99, { useCallback as useCallback17 } from "react";
|
|
8219
|
+
import { Paper as Paper11, CloseButton as CloseButton7, Title as Title7 } from "@mantine/core";
|
|
8220
|
+
|
|
8221
|
+
// src/mantine/blocks/notify/template/GeneralTab.tsx
|
|
8222
|
+
import React98, { useEffect as useEffect17, useState as useState26 } from "react";
|
|
8223
|
+
import { Divider as Divider6, Select as Select12, 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";
|
|
8224
|
+
import { IconTrash as IconTrash2, IconPlus as IconPlus2 } from "@tabler/icons-react";
|
|
8225
|
+
var GeneralTab5 = ({
|
|
8226
|
+
title,
|
|
8227
|
+
description,
|
|
8228
|
+
channel,
|
|
8229
|
+
to,
|
|
8230
|
+
cc,
|
|
8231
|
+
bcc,
|
|
8232
|
+
subject,
|
|
8233
|
+
body,
|
|
8234
|
+
bodyType,
|
|
8235
|
+
from,
|
|
8236
|
+
replyTo,
|
|
8237
|
+
onTitleChange,
|
|
8238
|
+
onDescriptionChange,
|
|
8239
|
+
onChannelChange,
|
|
8240
|
+
onToChange,
|
|
8241
|
+
onCcChange,
|
|
8242
|
+
onBccChange,
|
|
8243
|
+
onSubjectChange,
|
|
8244
|
+
onBodyChange,
|
|
8245
|
+
onBodyTypeChange,
|
|
8246
|
+
onFromChange,
|
|
8247
|
+
onReplyToChange
|
|
8248
|
+
}) => {
|
|
8249
|
+
const [localTitle, setLocalTitle] = useState26(title || "");
|
|
8250
|
+
const [localDescription, setLocalDescription] = useState26(description || "");
|
|
8251
|
+
const [localChannel, setLocalChannel] = useState26(channel || "email");
|
|
8252
|
+
const [localTo, setLocalTo] = useState26(to || []);
|
|
8253
|
+
const [localCc, setLocalCc] = useState26(cc || []);
|
|
8254
|
+
const [localBcc, setLocalBcc] = useState26(bcc || []);
|
|
8255
|
+
const [localSubject, setLocalSubject] = useState26(subject || "");
|
|
8256
|
+
const [localBody, setLocalBody] = useState26(body || "");
|
|
8257
|
+
const [localBodyType, setLocalBodyType] = useState26(bodyType || "text");
|
|
8258
|
+
const [localFrom, setLocalFrom] = useState26(from || "");
|
|
8259
|
+
const [localReplyTo, setLocalReplyTo] = useState26(replyTo || "");
|
|
8260
|
+
useEffect17(() => setLocalTitle(title || ""), [title]);
|
|
8261
|
+
useEffect17(() => setLocalDescription(description || ""), [description]);
|
|
8262
|
+
useEffect17(() => setLocalChannel(channel || "email"), [channel]);
|
|
8263
|
+
useEffect17(() => setLocalTo(to || []), [to]);
|
|
8264
|
+
useEffect17(() => setLocalCc(cc || []), [cc]);
|
|
8265
|
+
useEffect17(() => setLocalBcc(bcc || []), [bcc]);
|
|
8266
|
+
useEffect17(() => setLocalSubject(subject || ""), [subject]);
|
|
8267
|
+
useEffect17(() => setLocalBody(body || ""), [body]);
|
|
8268
|
+
useEffect17(() => setLocalBodyType(bodyType || "text"), [bodyType]);
|
|
8269
|
+
useEffect17(() => setLocalFrom(from || ""), [from]);
|
|
8270
|
+
useEffect17(() => setLocalReplyTo(replyTo || ""), [replyTo]);
|
|
8271
|
+
const handleAddRecipient = (type) => {
|
|
8272
|
+
const setter = type === "to" ? setLocalTo : type === "cc" ? setLocalCc : setLocalBcc;
|
|
8273
|
+
const callback = type === "to" ? onToChange : type === "cc" ? onCcChange : onBccChange;
|
|
8274
|
+
const current = type === "to" ? localTo : type === "cc" ? localCc : localBcc;
|
|
8275
|
+
const newRecipients = [...current, ""];
|
|
8276
|
+
setter(newRecipients);
|
|
8277
|
+
callback(newRecipients);
|
|
8278
|
+
};
|
|
8279
|
+
const handleRemoveRecipient = (type, index) => {
|
|
8280
|
+
const setter = type === "to" ? setLocalTo : type === "cc" ? setLocalCc : setLocalBcc;
|
|
8281
|
+
const callback = type === "to" ? onToChange : type === "cc" ? onCcChange : onBccChange;
|
|
8282
|
+
const current = type === "to" ? localTo : type === "cc" ? localCc : localBcc;
|
|
8283
|
+
const newRecipients = current.filter((_, i) => i !== index);
|
|
8284
|
+
setter(newRecipients);
|
|
8285
|
+
callback(newRecipients);
|
|
8286
|
+
};
|
|
8287
|
+
const handleRecipientChange = (type, index, value) => {
|
|
8288
|
+
const setter = type === "to" ? setLocalTo : type === "cc" ? setLocalCc : setLocalBcc;
|
|
8289
|
+
const callback = type === "to" ? onToChange : type === "cc" ? onCcChange : onBccChange;
|
|
8290
|
+
const current = type === "to" ? localTo : type === "cc" ? localCc : localBcc;
|
|
8291
|
+
const newRecipients = [...current];
|
|
8292
|
+
newRecipients[index] = value;
|
|
8293
|
+
setter(newRecipients);
|
|
8294
|
+
callback(newRecipients);
|
|
8295
|
+
};
|
|
8296
|
+
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(
|
|
8297
|
+
TextInput36,
|
|
8298
|
+
{
|
|
8299
|
+
placeholder: "e.g. Welcome Email",
|
|
8300
|
+
value: localTitle,
|
|
8301
|
+
onChange: (event) => {
|
|
8302
|
+
const newTitle = event.currentTarget.value;
|
|
8303
|
+
setLocalTitle(newTitle);
|
|
8304
|
+
onTitleChange(newTitle);
|
|
8305
|
+
}
|
|
8306
|
+
}
|
|
8307
|
+
)), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "Description"), /* @__PURE__ */ React98.createElement(
|
|
8308
|
+
Textarea20,
|
|
8309
|
+
{
|
|
8310
|
+
placeholder: "Describe what this notification does",
|
|
8311
|
+
minRows: 2,
|
|
8312
|
+
value: localDescription,
|
|
8313
|
+
onChange: (event) => {
|
|
8314
|
+
const newDescription = event.currentTarget.value;
|
|
8315
|
+
setLocalDescription(newDescription);
|
|
8316
|
+
onDescriptionChange(newDescription);
|
|
8317
|
+
}
|
|
8318
|
+
}
|
|
8319
|
+
)), /* @__PURE__ */ React98.createElement(Divider6, { variant: "dashed" }), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "Channel"), /* @__PURE__ */ React98.createElement(
|
|
8320
|
+
Select12,
|
|
8321
|
+
{
|
|
8322
|
+
value: localChannel,
|
|
8323
|
+
onChange: (value) => {
|
|
8324
|
+
const newChannel = value || "email";
|
|
8325
|
+
setLocalChannel(newChannel);
|
|
8326
|
+
onChannelChange(newChannel);
|
|
8327
|
+
},
|
|
8328
|
+
data: [
|
|
8329
|
+
{ value: "email", label: "Email" },
|
|
8330
|
+
{ value: "sms", label: "SMS (Coming Soon)", disabled: true },
|
|
8331
|
+
{ value: "whatsapp", label: "WhatsApp (Coming Soon)", disabled: true },
|
|
8332
|
+
{ value: "rcs", label: "RCS (Coming Soon)", disabled: true }
|
|
8333
|
+
]
|
|
8334
|
+
}
|
|
8335
|
+
)), /* @__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(
|
|
8336
|
+
TextInput36,
|
|
8337
|
+
{
|
|
8338
|
+
style: { flex: 1 },
|
|
8339
|
+
placeholder: "email@example.com",
|
|
8340
|
+
value: recipient,
|
|
8341
|
+
onChange: (e) => handleRecipientChange("cc", index, e.currentTarget.value)
|
|
8342
|
+
}
|
|
8343
|
+
), /* @__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(
|
|
8344
|
+
TextInput36,
|
|
8345
|
+
{
|
|
8346
|
+
style: { flex: 1 },
|
|
8347
|
+
placeholder: "email@example.com",
|
|
8348
|
+
value: recipient,
|
|
8349
|
+
onChange: (e) => handleRecipientChange("bcc", index, e.currentTarget.value)
|
|
8350
|
+
}
|
|
8351
|
+
), /* @__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(
|
|
8352
|
+
TextInput36,
|
|
8353
|
+
{
|
|
8354
|
+
placeholder: "sender@example.com",
|
|
8355
|
+
value: localFrom,
|
|
8356
|
+
onChange: (event) => {
|
|
8357
|
+
const newFrom = event.currentTarget.value;
|
|
8358
|
+
setLocalFrom(newFrom);
|
|
8359
|
+
onFromChange(newFrom);
|
|
8360
|
+
}
|
|
8361
|
+
}
|
|
8362
|
+
), /* @__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(
|
|
8363
|
+
TextInput36,
|
|
8364
|
+
{
|
|
8365
|
+
placeholder: "reply@example.com",
|
|
8366
|
+
value: localReplyTo,
|
|
8367
|
+
onChange: (event) => {
|
|
8368
|
+
const newReplyTo = event.currentTarget.value;
|
|
8369
|
+
setLocalReplyTo(newReplyTo);
|
|
8370
|
+
onReplyToChange(newReplyTo);
|
|
8371
|
+
}
|
|
8372
|
+
}
|
|
8373
|
+
), /* @__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(
|
|
8374
|
+
TextInput36,
|
|
8375
|
+
{
|
|
8376
|
+
placeholder: "Email subject line",
|
|
8377
|
+
value: localSubject,
|
|
8378
|
+
onChange: (event) => {
|
|
8379
|
+
const newSubject = event.currentTarget.value;
|
|
8380
|
+
setLocalSubject(newSubject);
|
|
8381
|
+
onSubjectChange(newSubject);
|
|
8382
|
+
}
|
|
8383
|
+
}
|
|
8384
|
+
)), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "Body Type"), /* @__PURE__ */ React98.createElement(
|
|
8385
|
+
Select12,
|
|
8386
|
+
{
|
|
8387
|
+
value: localBodyType,
|
|
8388
|
+
onChange: (value) => {
|
|
8389
|
+
const newBodyType = value || "text";
|
|
8390
|
+
setLocalBodyType(newBodyType);
|
|
8391
|
+
onBodyTypeChange(newBodyType);
|
|
8392
|
+
},
|
|
8393
|
+
data: [
|
|
8394
|
+
{ value: "text", label: "Plain Text" },
|
|
8395
|
+
{ value: "html", label: "HTML" }
|
|
8396
|
+
]
|
|
8397
|
+
}
|
|
8398
|
+
)), /* @__PURE__ */ React98.createElement(Stack74, { gap: "xs" }, /* @__PURE__ */ React98.createElement(Text49, { size: "sm", fw: 600 }, "Body"), /* @__PURE__ */ React98.createElement(
|
|
8399
|
+
Textarea20,
|
|
8400
|
+
{
|
|
8401
|
+
placeholder: localBodyType === "html" ? "<h1>Hello!</h1><p>Welcome to our service.</p>" : "Email body content",
|
|
8402
|
+
minRows: 6,
|
|
8403
|
+
value: localBody,
|
|
8404
|
+
onChange: (event) => {
|
|
8405
|
+
const newBody = event.currentTarget.value;
|
|
8406
|
+
setLocalBody(newBody);
|
|
8407
|
+
onBodyChange(newBody);
|
|
8408
|
+
}
|
|
8409
|
+
}
|
|
8410
|
+
), /* @__PURE__ */ React98.createElement(Text49, { size: "xs", c: "dimmed" }, localBodyType === "html" ? "HTML content for the email body" : "Plain text content for the email body"))));
|
|
8411
|
+
};
|
|
8412
|
+
|
|
8413
|
+
// src/mantine/blocks/notify/template/TemplateConfig.tsx
|
|
8414
|
+
var TemplateConfig5 = ({ editor, block }) => {
|
|
8415
|
+
const { closePanel } = usePanelStore();
|
|
8416
|
+
const updateProp = useCallback17(
|
|
8417
|
+
(key, value) => {
|
|
8418
|
+
editor.updateBlock(block, {
|
|
8419
|
+
props: {
|
|
8420
|
+
...block.props,
|
|
8421
|
+
[key]: value
|
|
8422
|
+
}
|
|
8423
|
+
});
|
|
8424
|
+
},
|
|
8425
|
+
[editor, block]
|
|
8426
|
+
);
|
|
8427
|
+
const handleToChange = useCallback17(
|
|
8428
|
+
(to) => {
|
|
8429
|
+
updateProp("to", JSON.stringify(to));
|
|
8430
|
+
},
|
|
8431
|
+
[updateProp]
|
|
8432
|
+
);
|
|
8433
|
+
const handleCcChange = useCallback17(
|
|
8434
|
+
(cc) => {
|
|
8435
|
+
updateProp("cc", JSON.stringify(cc));
|
|
8436
|
+
},
|
|
8437
|
+
[updateProp]
|
|
8438
|
+
);
|
|
8439
|
+
const handleBccChange = useCallback17(
|
|
8440
|
+
(bcc) => {
|
|
8441
|
+
updateProp("bcc", JSON.stringify(bcc));
|
|
8442
|
+
},
|
|
8443
|
+
[updateProp]
|
|
8444
|
+
);
|
|
8445
|
+
return /* @__PURE__ */ React99.createElement(
|
|
8446
|
+
Paper11,
|
|
8447
|
+
{
|
|
8448
|
+
p: "md",
|
|
8449
|
+
shadow: "sm",
|
|
8450
|
+
style: {
|
|
8451
|
+
height: "100%",
|
|
8452
|
+
display: "flex",
|
|
8453
|
+
flexDirection: "column"
|
|
8454
|
+
}
|
|
8455
|
+
},
|
|
8456
|
+
/* @__PURE__ */ React99.createElement(
|
|
8457
|
+
"div",
|
|
8458
|
+
{
|
|
8459
|
+
style: {
|
|
8460
|
+
display: "flex",
|
|
8461
|
+
justifyContent: "space-between",
|
|
8462
|
+
alignItems: "center",
|
|
8463
|
+
marginBottom: "1rem"
|
|
8464
|
+
}
|
|
8465
|
+
},
|
|
8466
|
+
/* @__PURE__ */ React99.createElement(Title7, { order: 3 }, "Notification Settings"),
|
|
8467
|
+
/* @__PURE__ */ React99.createElement(CloseButton7, { onClick: closePanel })
|
|
8468
|
+
),
|
|
8469
|
+
/* @__PURE__ */ React99.createElement(
|
|
8470
|
+
ReusablePanel,
|
|
8471
|
+
{
|
|
8472
|
+
extraTabs: [
|
|
8473
|
+
{
|
|
8474
|
+
label: "General",
|
|
8475
|
+
value: "general",
|
|
8476
|
+
content: /* @__PURE__ */ React99.createElement(
|
|
8477
|
+
GeneralTab5,
|
|
8478
|
+
{
|
|
8479
|
+
title: block.props.title || "",
|
|
8480
|
+
description: block.props.description || "",
|
|
8481
|
+
channel: block.props.channel || "email",
|
|
8482
|
+
to: (() => {
|
|
8483
|
+
try {
|
|
8484
|
+
return typeof block.props.to === "string" ? JSON.parse(block.props.to) : block.props.to || [];
|
|
8485
|
+
} catch {
|
|
8486
|
+
return [];
|
|
8487
|
+
}
|
|
8488
|
+
})(),
|
|
8489
|
+
cc: (() => {
|
|
8490
|
+
try {
|
|
8491
|
+
return typeof block.props.cc === "string" ? JSON.parse(block.props.cc) : block.props.cc || [];
|
|
8492
|
+
} catch {
|
|
8493
|
+
return [];
|
|
8494
|
+
}
|
|
8495
|
+
})(),
|
|
8496
|
+
bcc: (() => {
|
|
8497
|
+
try {
|
|
8498
|
+
return typeof block.props.bcc === "string" ? JSON.parse(block.props.bcc) : block.props.bcc || [];
|
|
8499
|
+
} catch {
|
|
8500
|
+
return [];
|
|
8501
|
+
}
|
|
8502
|
+
})(),
|
|
8503
|
+
subject: block.props.subject || "",
|
|
8504
|
+
body: block.props.body || "",
|
|
8505
|
+
bodyType: block.props.bodyType || "text",
|
|
8506
|
+
from: block.props.from || "",
|
|
8507
|
+
replyTo: block.props.replyTo || "",
|
|
8508
|
+
onTitleChange: (value) => updateProp("title", value),
|
|
8509
|
+
onDescriptionChange: (value) => updateProp("description", value),
|
|
8510
|
+
onChannelChange: (value) => updateProp("channel", value),
|
|
8511
|
+
onToChange: handleToChange,
|
|
8512
|
+
onCcChange: handleCcChange,
|
|
8513
|
+
onBccChange: handleBccChange,
|
|
8514
|
+
onSubjectChange: (value) => updateProp("subject", value),
|
|
8515
|
+
onBodyChange: (value) => updateProp("body", value),
|
|
8516
|
+
onBodyTypeChange: (value) => updateProp("bodyType", value),
|
|
8517
|
+
onFromChange: (value) => updateProp("from", value),
|
|
8518
|
+
onReplyToChange: (value) => updateProp("replyTo", value)
|
|
8519
|
+
}
|
|
8520
|
+
)
|
|
8521
|
+
}
|
|
8522
|
+
],
|
|
8523
|
+
context: { editor, block }
|
|
8524
|
+
}
|
|
8525
|
+
)
|
|
8526
|
+
);
|
|
8527
|
+
};
|
|
8528
|
+
|
|
8529
|
+
// src/mantine/blocks/notify/template/TemplateView.tsx
|
|
8530
|
+
import { Card as Card22, Group as Group31, Stack as Stack75, Text as Text50, ActionIcon as ActionIcon14, Badge as Badge12 } from "@mantine/core";
|
|
8531
|
+
var NOTIFY_TEMPLATE_PANEL_ID = "notify-template-panel";
|
|
8532
|
+
var NotifyTemplateView = ({ editor, block }) => {
|
|
8533
|
+
const panelId = `${NOTIFY_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
8534
|
+
const panelContent = useMemo14(() => /* @__PURE__ */ React100.createElement(TemplateConfig5, { editor, block }), [editor, block]);
|
|
8535
|
+
const { open } = usePanel(panelId, panelContent);
|
|
8536
|
+
const channel = block.props.channel || "email";
|
|
8537
|
+
const to = (() => {
|
|
8538
|
+
try {
|
|
8539
|
+
const parsed = typeof block.props.to === "string" ? JSON.parse(block.props.to) : block.props.to;
|
|
8540
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
8541
|
+
} catch {
|
|
8542
|
+
return [];
|
|
8543
|
+
}
|
|
8544
|
+
})();
|
|
8545
|
+
const getChannelColor = (channel2) => {
|
|
8546
|
+
switch (channel2) {
|
|
8547
|
+
case "email":
|
|
8548
|
+
return "blue";
|
|
8549
|
+
case "sms":
|
|
8550
|
+
return "green";
|
|
8551
|
+
case "whatsapp":
|
|
8552
|
+
return "teal";
|
|
8553
|
+
case "rcs":
|
|
8554
|
+
return "violet";
|
|
8555
|
+
default:
|
|
8556
|
+
return "gray";
|
|
8557
|
+
}
|
|
8558
|
+
};
|
|
8559
|
+
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)))));
|
|
8560
|
+
};
|
|
8561
|
+
|
|
8562
|
+
// src/mantine/blocks/notify/flow/FlowView.tsx
|
|
8563
|
+
import React101, { useState as useState27 } from "react";
|
|
8564
|
+
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 Loader5, Code as Code2 } from "@mantine/core";
|
|
8565
|
+
import { IconSend as IconSend2, IconChevronDown as IconChevronDown2, IconChevronUp as IconChevronUp2, IconCheck, IconX } from "@tabler/icons-react";
|
|
8566
|
+
var NotifyFlowView = ({ editor, block, isDisabled }) => {
|
|
8567
|
+
const disabled = isDisabled?.isDisabled === "disable";
|
|
8568
|
+
const [isLoading, setIsLoading] = useState27(false);
|
|
8569
|
+
const [showDetails, setShowDetails] = useState27(false);
|
|
8570
|
+
let handlers = null;
|
|
8571
|
+
try {
|
|
8572
|
+
handlers = useBlocknoteHandlers();
|
|
8573
|
+
} catch {
|
|
8574
|
+
handlers = null;
|
|
8575
|
+
}
|
|
8576
|
+
const channel = block.props.channel || "email";
|
|
8577
|
+
const status = block.props.status || "idle";
|
|
8578
|
+
const to = (() => {
|
|
8579
|
+
try {
|
|
8580
|
+
return typeof block.props.to === "string" ? JSON.parse(block.props.to) : block.props.to || [];
|
|
8581
|
+
} catch {
|
|
8582
|
+
return [];
|
|
8583
|
+
}
|
|
8584
|
+
})();
|
|
8585
|
+
const cc = (() => {
|
|
8586
|
+
try {
|
|
8587
|
+
return typeof block.props.cc === "string" ? JSON.parse(block.props.cc) : block.props.cc || [];
|
|
8588
|
+
} catch {
|
|
8589
|
+
return [];
|
|
8590
|
+
}
|
|
8591
|
+
})();
|
|
8592
|
+
const bcc = (() => {
|
|
8593
|
+
try {
|
|
8594
|
+
return typeof block.props.bcc === "string" ? JSON.parse(block.props.bcc) : block.props.bcc || [];
|
|
8595
|
+
} catch {
|
|
8596
|
+
return [];
|
|
8597
|
+
}
|
|
8598
|
+
})();
|
|
8599
|
+
const getChannelColor = (channel2) => {
|
|
8600
|
+
switch (channel2) {
|
|
8601
|
+
case "email":
|
|
8602
|
+
return "blue";
|
|
8603
|
+
case "sms":
|
|
8604
|
+
return "green";
|
|
8605
|
+
case "whatsapp":
|
|
8606
|
+
return "teal";
|
|
8607
|
+
case "rcs":
|
|
8608
|
+
return "violet";
|
|
8609
|
+
default:
|
|
8610
|
+
return "gray";
|
|
8611
|
+
}
|
|
8612
|
+
};
|
|
8613
|
+
const getStatusColor = (status2) => {
|
|
8614
|
+
switch (status2) {
|
|
8615
|
+
case "sent":
|
|
8616
|
+
return "green";
|
|
8617
|
+
case "failed":
|
|
8618
|
+
return "red";
|
|
8619
|
+
case "sending":
|
|
8620
|
+
return "blue";
|
|
8621
|
+
default:
|
|
8622
|
+
return "gray";
|
|
8623
|
+
}
|
|
8624
|
+
};
|
|
8625
|
+
const handleSendNotification = async () => {
|
|
8626
|
+
if (disabled || !handlers || to.length === 0) return;
|
|
8627
|
+
setIsLoading(true);
|
|
8628
|
+
editor.updateBlock(block, {
|
|
8629
|
+
props: { ...block.props, status: "sending", errorMessage: "" }
|
|
8630
|
+
});
|
|
8631
|
+
try {
|
|
8632
|
+
if (channel === "email") {
|
|
8633
|
+
const params = {
|
|
8634
|
+
channel: "email",
|
|
8635
|
+
to: to.filter((email) => email.trim() !== ""),
|
|
8636
|
+
cc: cc.filter((email) => email.trim() !== ""),
|
|
8637
|
+
bcc: bcc.filter((email) => email.trim() !== ""),
|
|
8638
|
+
subject: block.props.subject || "",
|
|
8639
|
+
body: block.props.body || "",
|
|
8640
|
+
bodyType: block.props.bodyType || "text",
|
|
8641
|
+
from: block.props.from || void 0,
|
|
8642
|
+
replyTo: block.props.replyTo || void 0
|
|
8643
|
+
};
|
|
8644
|
+
if (params.cc?.length === 0) delete params.cc;
|
|
8645
|
+
if (params.bcc?.length === 0) delete params.bcc;
|
|
8646
|
+
const response = await handlers.sendNotification(params);
|
|
8647
|
+
editor.updateBlock(block, {
|
|
8648
|
+
props: {
|
|
8649
|
+
...block.props,
|
|
8650
|
+
status: "sent",
|
|
8651
|
+
messageId: response.messageId,
|
|
8652
|
+
sentAt: response.timestamp,
|
|
8653
|
+
errorMessage: ""
|
|
8654
|
+
}
|
|
8655
|
+
});
|
|
8656
|
+
}
|
|
8657
|
+
} catch (error) {
|
|
8658
|
+
editor.updateBlock(block, {
|
|
8659
|
+
props: {
|
|
8660
|
+
...block.props,
|
|
8661
|
+
status: "failed",
|
|
8662
|
+
errorMessage: error instanceof Error ? error.message : "Failed to send notification"
|
|
8663
|
+
}
|
|
8664
|
+
});
|
|
8665
|
+
} finally {
|
|
8666
|
+
setIsLoading(false);
|
|
8667
|
+
}
|
|
8668
|
+
};
|
|
8669
|
+
const canSend = !disabled && !isLoading && handlers && to.length > 0 && (channel === "email" ? block.props.subject && block.props.body : true);
|
|
8670
|
+
const sendButton = /* @__PURE__ */ React101.createElement(
|
|
8671
|
+
Button25,
|
|
8672
|
+
{
|
|
8673
|
+
size: "sm",
|
|
8674
|
+
variant: "light",
|
|
8675
|
+
color: getChannelColor(channel),
|
|
8676
|
+
leftSection: isLoading ? /* @__PURE__ */ React101.createElement(Loader5, { size: 14 }) : status === "sent" ? /* @__PURE__ */ React101.createElement(IconCheck, { size: 14 }) : /* @__PURE__ */ React101.createElement(IconSend2, { size: 14 }),
|
|
8677
|
+
onClick: handleSendNotification,
|
|
8678
|
+
disabled: !canSend,
|
|
8679
|
+
style: { flexShrink: 0 }
|
|
8680
|
+
},
|
|
8681
|
+
isLoading ? "Sending..." : status === "sent" ? "Sent" : "Send"
|
|
8682
|
+
);
|
|
8683
|
+
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(
|
|
8684
|
+
{
|
|
8685
|
+
to: to.filter((e) => e.trim() !== ""),
|
|
8686
|
+
...cc.length > 0 && { cc: cc.filter((e) => e.trim() !== "") },
|
|
8687
|
+
...bcc.length > 0 && { bcc: bcc.filter((e) => e.trim() !== "") }
|
|
8688
|
+
},
|
|
8689
|
+
null,
|
|
8690
|
+
2
|
|
8691
|
+
))), 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(
|
|
8692
|
+
{
|
|
8693
|
+
...block.props.from && { from: block.props.from },
|
|
8694
|
+
...block.props.replyTo && { replyTo: block.props.replyTo }
|
|
8695
|
+
},
|
|
8696
|
+
null,
|
|
8697
|
+
2
|
|
8698
|
+
))))))));
|
|
8699
|
+
};
|
|
8700
|
+
|
|
8701
|
+
// src/mantine/blocks/notify/NotifyBlock.tsx
|
|
8702
|
+
function NotifyBlock({ editor, block }) {
|
|
8703
|
+
const { editable } = useBlocknoteContext();
|
|
8704
|
+
const { actions } = useBlockConditions(block, editor);
|
|
8705
|
+
if (editable) {
|
|
8706
|
+
return /* @__PURE__ */ React102.createElement(NotifyTemplateView, { editor, block });
|
|
8707
|
+
}
|
|
8708
|
+
const conditionConfig = parseConditionConfig(block.props.conditions);
|
|
8709
|
+
const hasVisibility = hasVisibilityConditions(conditionConfig);
|
|
8710
|
+
const showActionExists = actions.some((a) => a.action === "show");
|
|
8711
|
+
const shouldHide = hasVisibility && !showActionExists;
|
|
8712
|
+
if (shouldHide) {
|
|
8713
|
+
return null;
|
|
8714
|
+
}
|
|
8715
|
+
const hasEnable = hasEnableConditions(conditionConfig);
|
|
8716
|
+
const enableActionExists = actions.some((a) => a.action === "enable");
|
|
8717
|
+
const shouldDisable = hasEnable && !enableActionExists;
|
|
8718
|
+
return /* @__PURE__ */ React102.createElement(NotifyFlowView, { block, editor, isDisabled: shouldDisable ? { isDisabled: "disable", message: "Notification disabled by conditions" } : void 0 });
|
|
8719
|
+
}
|
|
8720
|
+
|
|
8721
|
+
// src/mantine/blocks/notify/NotifyBlockSpec.tsx
|
|
8722
|
+
var NotifyBlockSpec = createReactBlockSpec7(
|
|
8723
|
+
{
|
|
8724
|
+
type: "notify",
|
|
8725
|
+
propSchema: {
|
|
8726
|
+
title: { default: "" },
|
|
8727
|
+
description: { default: "" },
|
|
8728
|
+
icon: { default: "bell" },
|
|
8729
|
+
// Notification channel configuration
|
|
8730
|
+
channel: { default: "email" },
|
|
8731
|
+
// Email-specific fields
|
|
8732
|
+
to: { default: "[]" },
|
|
8733
|
+
// JSON array of recipients
|
|
8734
|
+
cc: { default: "[]" },
|
|
8735
|
+
// JSON array of CC recipients
|
|
8736
|
+
bcc: { default: "[]" },
|
|
8737
|
+
// JSON array of BCC recipients
|
|
8738
|
+
subject: { default: "" },
|
|
8739
|
+
body: { default: "" },
|
|
8740
|
+
bodyType: { default: "text" },
|
|
8741
|
+
// 'text' or 'html'
|
|
8742
|
+
from: { default: "" },
|
|
8743
|
+
replyTo: { default: "" },
|
|
8744
|
+
// SMS/WhatsApp fields
|
|
8745
|
+
templateId: { default: "" },
|
|
8746
|
+
templateVariables: { default: "{}" },
|
|
8747
|
+
// JSON object
|
|
8748
|
+
// Execution status
|
|
8749
|
+
status: { default: "idle" },
|
|
8750
|
+
// 'idle', 'sending', 'sent', 'failed'
|
|
8751
|
+
messageId: { default: "" },
|
|
8752
|
+
sentAt: { default: "" },
|
|
8753
|
+
errorMessage: { default: "" },
|
|
8754
|
+
// Conditions
|
|
8755
|
+
conditions: { default: "" }
|
|
8756
|
+
},
|
|
8757
|
+
content: "inline"
|
|
8758
|
+
},
|
|
8759
|
+
{
|
|
8760
|
+
render: (props) => {
|
|
8761
|
+
const ixoProps = props;
|
|
8762
|
+
return /* @__PURE__ */ React103.createElement(NotifyBlock, { ...ixoProps });
|
|
8763
|
+
}
|
|
8764
|
+
}
|
|
8765
|
+
);
|
|
8766
|
+
|
|
8230
8767
|
// src/mantine/blocks/registry/blockRegistry.ts
|
|
8231
8768
|
var BlockRegistry = class {
|
|
8232
8769
|
constructor() {
|
|
@@ -8320,12 +8857,43 @@ blockRegistry.register({
|
|
|
8320
8857
|
validDependencies: [],
|
|
8321
8858
|
defaultProps: {}
|
|
8322
8859
|
});
|
|
8860
|
+
blockRegistry.register({
|
|
8861
|
+
type: "notify",
|
|
8862
|
+
propSchema: {
|
|
8863
|
+
title: "",
|
|
8864
|
+
description: "",
|
|
8865
|
+
icon: "bell",
|
|
8866
|
+
channel: "email",
|
|
8867
|
+
to: "[]",
|
|
8868
|
+
cc: "[]",
|
|
8869
|
+
bcc: "[]",
|
|
8870
|
+
subject: "",
|
|
8871
|
+
body: "",
|
|
8872
|
+
bodyType: "text",
|
|
8873
|
+
from: "",
|
|
8874
|
+
replyTo: "",
|
|
8875
|
+
templateId: "",
|
|
8876
|
+
templateVariables: "{}",
|
|
8877
|
+
status: "idle",
|
|
8878
|
+
messageId: "",
|
|
8879
|
+
sentAt: "",
|
|
8880
|
+
errorMessage: "",
|
|
8881
|
+
conditions: ""
|
|
8882
|
+
},
|
|
8883
|
+
validDependencies: [],
|
|
8884
|
+
defaultProps: {
|
|
8885
|
+
icon: "bell",
|
|
8886
|
+
channel: "email",
|
|
8887
|
+
bodyType: "text",
|
|
8888
|
+
status: "idle"
|
|
8889
|
+
}
|
|
8890
|
+
});
|
|
8323
8891
|
|
|
8324
8892
|
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
8325
|
-
import { useMemo as
|
|
8893
|
+
import { useMemo as useMemo15, useEffect as useEffect18, useState as useState28, useCallback as useCallback18 } from "react";
|
|
8326
8894
|
|
|
8327
8895
|
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
8328
|
-
import { useMemo as
|
|
8896
|
+
import { useMemo as useMemo16 } from "react";
|
|
8329
8897
|
|
|
8330
8898
|
// src/mantine/blocks/index.ts
|
|
8331
8899
|
var blockSpecs = {
|
|
@@ -8334,7 +8902,8 @@ var blockSpecs = {
|
|
|
8334
8902
|
enumChecklist: EnumChecklistBlock,
|
|
8335
8903
|
overview: OverviewBlock,
|
|
8336
8904
|
proposal: ProposalBlockSpec,
|
|
8337
|
-
apiRequest: ApiRequestBlockSpec
|
|
8905
|
+
apiRequest: ApiRequestBlockSpec,
|
|
8906
|
+
notify: NotifyBlockSpec
|
|
8338
8907
|
};
|
|
8339
8908
|
var getExtraSlashMenuItems = (editor) => {
|
|
8340
8909
|
const slashMenuList = [
|
|
@@ -8498,6 +9067,73 @@ var getExtraSlashMenuItems = (editor) => {
|
|
|
8498
9067
|
aliases: ["actions", "proposal-actions", "dao-actions", "governance-actions"],
|
|
8499
9068
|
group: "DAO",
|
|
8500
9069
|
subtext: "Manage proposal actions"
|
|
9070
|
+
},
|
|
9071
|
+
{
|
|
9072
|
+
title: "API Request",
|
|
9073
|
+
onItemClick: () => {
|
|
9074
|
+
editor.insertBlocks(
|
|
9075
|
+
[
|
|
9076
|
+
{
|
|
9077
|
+
type: "apiRequest",
|
|
9078
|
+
props: {
|
|
9079
|
+
title: "",
|
|
9080
|
+
description: "",
|
|
9081
|
+
icon: "square-check",
|
|
9082
|
+
endpoint: "",
|
|
9083
|
+
method: "GET",
|
|
9084
|
+
headers: "[]",
|
|
9085
|
+
body: "[]",
|
|
9086
|
+
response: "",
|
|
9087
|
+
status: "idle",
|
|
9088
|
+
conditions: ""
|
|
9089
|
+
}
|
|
9090
|
+
}
|
|
9091
|
+
],
|
|
9092
|
+
editor.getTextCursorPosition().block,
|
|
9093
|
+
"after"
|
|
9094
|
+
);
|
|
9095
|
+
},
|
|
9096
|
+
aliases: ["api", "api-request", "request", "http", "fetch"],
|
|
9097
|
+
group: "Basics",
|
|
9098
|
+
subtext: "Make HTTP requests and handle responses"
|
|
9099
|
+
},
|
|
9100
|
+
{
|
|
9101
|
+
title: "Notification",
|
|
9102
|
+
onItemClick: () => {
|
|
9103
|
+
editor.insertBlocks(
|
|
9104
|
+
[
|
|
9105
|
+
{
|
|
9106
|
+
type: "notify",
|
|
9107
|
+
props: {
|
|
9108
|
+
title: "",
|
|
9109
|
+
description: "",
|
|
9110
|
+
icon: "bell",
|
|
9111
|
+
channel: "email",
|
|
9112
|
+
to: "[]",
|
|
9113
|
+
cc: "[]",
|
|
9114
|
+
bcc: "[]",
|
|
9115
|
+
subject: "",
|
|
9116
|
+
body: "",
|
|
9117
|
+
bodyType: "text",
|
|
9118
|
+
from: "",
|
|
9119
|
+
replyTo: "",
|
|
9120
|
+
templateId: "",
|
|
9121
|
+
templateVariables: "{}",
|
|
9122
|
+
status: "idle",
|
|
9123
|
+
messageId: "",
|
|
9124
|
+
sentAt: "",
|
|
9125
|
+
errorMessage: "",
|
|
9126
|
+
conditions: ""
|
|
9127
|
+
}
|
|
9128
|
+
}
|
|
9129
|
+
],
|
|
9130
|
+
editor.getTextCursorPosition().block,
|
|
9131
|
+
"after"
|
|
9132
|
+
);
|
|
9133
|
+
},
|
|
9134
|
+
aliases: ["notify", "notification", "email", "alert", "message", "bird"],
|
|
9135
|
+
group: "Basics",
|
|
9136
|
+
subtext: "Send notifications via Email, SMS, or WhatsApp"
|
|
8501
9137
|
}
|
|
8502
9138
|
];
|
|
8503
9139
|
const yRoot = editor?._yRoot;
|
|
@@ -8576,15 +9212,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
|
|
|
8576
9212
|
import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
|
|
8577
9213
|
|
|
8578
9214
|
// src/core/hooks/useMatrixProvider.ts
|
|
8579
|
-
import { useEffect as
|
|
9215
|
+
import { useEffect as useEffect19, useState as useState29, useRef as useRef3, useCallback as useCallback19, useMemo as useMemo17 } from "react";
|
|
8580
9216
|
import { MatrixProvider } from "@ixo/matrix-crdt";
|
|
8581
9217
|
function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
8582
|
-
const [matrixProvider, setProvider] =
|
|
8583
|
-
const [status, setStatus] =
|
|
9218
|
+
const [matrixProvider, setProvider] = useState29(null);
|
|
9219
|
+
const [status, setStatus] = useState29("disconnected");
|
|
8584
9220
|
const isMountedRef = useRef3(true);
|
|
8585
9221
|
const providerRef = useRef3(null);
|
|
8586
9222
|
const retryTimeoutRef = useRef3(null);
|
|
8587
|
-
const providerOptions =
|
|
9223
|
+
const providerOptions = useMemo17(
|
|
8588
9224
|
() => ({
|
|
8589
9225
|
translator: {
|
|
8590
9226
|
updateEventType: "matrix-crdt.doc_update",
|
|
@@ -8597,22 +9233,22 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
8597
9233
|
}),
|
|
8598
9234
|
[]
|
|
8599
9235
|
);
|
|
8600
|
-
const handleDocumentAvailable =
|
|
9236
|
+
const handleDocumentAvailable = useCallback19(() => {
|
|
8601
9237
|
if (isMountedRef.current) {
|
|
8602
9238
|
setStatus("connected");
|
|
8603
9239
|
}
|
|
8604
9240
|
}, []);
|
|
8605
|
-
const handleDocumentUnavailable =
|
|
9241
|
+
const handleDocumentUnavailable = useCallback19(() => {
|
|
8606
9242
|
if (isMountedRef.current) {
|
|
8607
9243
|
setStatus("failed");
|
|
8608
9244
|
}
|
|
8609
9245
|
}, []);
|
|
8610
|
-
const handleCanWriteChanged =
|
|
9246
|
+
const handleCanWriteChanged = useCallback19(() => {
|
|
8611
9247
|
if (isMountedRef.current && providerRef.current) {
|
|
8612
9248
|
setStatus(providerRef.current.canWrite ? "connected" : "failed");
|
|
8613
9249
|
}
|
|
8614
9250
|
}, []);
|
|
8615
|
-
const initProvider =
|
|
9251
|
+
const initProvider = useCallback19(async () => {
|
|
8616
9252
|
if (!isMountedRef.current) return;
|
|
8617
9253
|
if (retryTimeoutRef.current) {
|
|
8618
9254
|
clearTimeout(retryTimeoutRef.current);
|
|
@@ -8646,7 +9282,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
8646
9282
|
}
|
|
8647
9283
|
}
|
|
8648
9284
|
}, [matrixClient, providerOptions, handleDocumentAvailable, handleDocumentUnavailable, handleCanWriteChanged]);
|
|
8649
|
-
|
|
9285
|
+
useEffect19(() => {
|
|
8650
9286
|
isMountedRef.current = true;
|
|
8651
9287
|
initProvider();
|
|
8652
9288
|
return () => {
|
|
@@ -8663,7 +9299,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
8663
9299
|
setStatus("disconnected");
|
|
8664
9300
|
};
|
|
8665
9301
|
}, [initProvider]);
|
|
8666
|
-
|
|
9302
|
+
useEffect19(() => {
|
|
8667
9303
|
return () => {
|
|
8668
9304
|
isMountedRef.current = false;
|
|
8669
9305
|
};
|
|
@@ -8672,17 +9308,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
8672
9308
|
}
|
|
8673
9309
|
|
|
8674
9310
|
// src/mantine/hooks/useCollaborativeYDoc.ts
|
|
8675
|
-
import { useMemo as
|
|
9311
|
+
import { useMemo as useMemo18 } from "react";
|
|
8676
9312
|
import * as Y from "yjs";
|
|
8677
9313
|
function useCollaborativeYDoc(_options) {
|
|
8678
|
-
return
|
|
9314
|
+
return useMemo18(() => {
|
|
8679
9315
|
const doc = new Y.Doc();
|
|
8680
9316
|
return doc;
|
|
8681
9317
|
}, []);
|
|
8682
9318
|
}
|
|
8683
9319
|
|
|
8684
9320
|
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
8685
|
-
import { useMemo as
|
|
9321
|
+
import { useMemo as useMemo19, useEffect as useEffect20 } from "react";
|
|
8686
9322
|
function useCreateCollaborativeIxoEditor(options) {
|
|
8687
9323
|
const yDoc = useCollaborativeYDoc(options);
|
|
8688
9324
|
const {
|
|
@@ -8700,7 +9336,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8700
9336
|
matrixClient,
|
|
8701
9337
|
permissions = { write: false }
|
|
8702
9338
|
} = options || {};
|
|
8703
|
-
const memoizedUser =
|
|
9339
|
+
const memoizedUser = useMemo19(
|
|
8704
9340
|
() => ({
|
|
8705
9341
|
id: user?.id || "",
|
|
8706
9342
|
name: user?.name || "",
|
|
@@ -8715,7 +9351,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8715
9351
|
matrixClient,
|
|
8716
9352
|
roomId: options.roomId
|
|
8717
9353
|
});
|
|
8718
|
-
const defaultUploadFile =
|
|
9354
|
+
const defaultUploadFile = useMemo19(
|
|
8719
9355
|
() => uploadFile || (async (file) => {
|
|
8720
9356
|
return new Promise((resolve, reject) => {
|
|
8721
9357
|
const reader = new FileReader();
|
|
@@ -8729,7 +9365,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8729
9365
|
}),
|
|
8730
9366
|
[uploadFile]
|
|
8731
9367
|
);
|
|
8732
|
-
const schema =
|
|
9368
|
+
const schema = useMemo19(
|
|
8733
9369
|
() => BlockNoteSchema2.create({
|
|
8734
9370
|
blockSpecs: {
|
|
8735
9371
|
...defaultBlockSpecs2,
|
|
@@ -8744,11 +9380,11 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8744
9380
|
}),
|
|
8745
9381
|
[]
|
|
8746
9382
|
);
|
|
8747
|
-
const root =
|
|
8748
|
-
const documentFragment =
|
|
8749
|
-
const flowArray =
|
|
8750
|
-
const userFragment =
|
|
8751
|
-
const collaborationConfig =
|
|
9383
|
+
const root = useMemo19(() => yDoc.getMap("root"), [yDoc]);
|
|
9384
|
+
const documentFragment = useMemo19(() => yDoc.getXmlFragment("document"), [yDoc]);
|
|
9385
|
+
const flowArray = useMemo19(() => yDoc.getArray("flow"), [yDoc]);
|
|
9386
|
+
const userFragment = useMemo19(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
|
|
9387
|
+
const collaborationConfig = useMemo19(
|
|
8752
9388
|
() => ({
|
|
8753
9389
|
provider: matrixProvider,
|
|
8754
9390
|
fragment: documentFragment,
|
|
@@ -8760,7 +9396,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8760
9396
|
}),
|
|
8761
9397
|
[matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
|
|
8762
9398
|
);
|
|
8763
|
-
const ixoConfig =
|
|
9399
|
+
const ixoConfig = useMemo19(
|
|
8764
9400
|
() => ({
|
|
8765
9401
|
theme,
|
|
8766
9402
|
editable,
|
|
@@ -8779,7 +9415,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8779
9415
|
uploadFile: defaultUploadFile,
|
|
8780
9416
|
collaboration: collaborationConfig
|
|
8781
9417
|
});
|
|
8782
|
-
const titleText =
|
|
9418
|
+
const titleText = useMemo19(() => yDoc.getText("title"), [yDoc]);
|
|
8783
9419
|
let ixoEditor;
|
|
8784
9420
|
if (editor) {
|
|
8785
9421
|
ixoEditor = editor;
|
|
@@ -8827,21 +9463,26 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8827
9463
|
ixoEditor.getFlow = () => {
|
|
8828
9464
|
return flowArray.toArray();
|
|
8829
9465
|
};
|
|
8830
|
-
ixoEditor.getDocType = () =>
|
|
9466
|
+
ixoEditor.getDocType = () => {
|
|
9467
|
+
const docType = root.get("docType") || "";
|
|
9468
|
+
console.log("[useCollaborativeIxoEditor] getDocType() called, returning:", docType);
|
|
9469
|
+
return docType;
|
|
9470
|
+
};
|
|
8831
9471
|
ixoEditor.setDocType = (value) => {
|
|
8832
9472
|
if (!permissions.write) {
|
|
8833
9473
|
console.warn("Cannot set doc type: write permission denied");
|
|
8834
9474
|
return;
|
|
8835
9475
|
}
|
|
9476
|
+
console.log("[useCollaborativeIxoEditor] setDocType() called, setting docType to:", value);
|
|
8836
9477
|
root.set("docType", value);
|
|
8837
9478
|
};
|
|
8838
9479
|
}
|
|
8839
|
-
|
|
9480
|
+
useEffect20(() => {
|
|
8840
9481
|
if (ixoEditor) {
|
|
8841
9482
|
ixoEditor.isEditable = editable;
|
|
8842
9483
|
}
|
|
8843
9484
|
}, [ixoEditor, editable]);
|
|
8844
|
-
|
|
9485
|
+
useEffect20(() => {
|
|
8845
9486
|
if (connectionStatus !== "connected") {
|
|
8846
9487
|
return;
|
|
8847
9488
|
}
|
|
@@ -8859,6 +9500,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8859
9500
|
root.set("createdAt", (/* @__PURE__ */ new Date()).toISOString());
|
|
8860
9501
|
root.set("createdBy", memoizedUser.id || "anonymous");
|
|
8861
9502
|
root.set("docType", "");
|
|
9503
|
+
console.log("[useCollaborativeIxoEditor] Initializing docType to empty string for new document");
|
|
8862
9504
|
if (titleText.length === 0 && options.title) {
|
|
8863
9505
|
titleText.insert(0, options.title);
|
|
8864
9506
|
}
|
|
@@ -8874,19 +9516,19 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
8874
9516
|
}
|
|
8875
9517
|
|
|
8876
9518
|
// src/mantine/IxoEditor.tsx
|
|
8877
|
-
import
|
|
9519
|
+
import React105 from "react";
|
|
8878
9520
|
import { getDefaultReactSlashMenuItems, SuggestionMenuController } from "@blocknote/react";
|
|
8879
9521
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
8880
9522
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
8881
9523
|
import { MantineProvider } from "@mantine/core";
|
|
8882
9524
|
|
|
8883
9525
|
// src/mantine/components/PanelContent.tsx
|
|
8884
|
-
import
|
|
9526
|
+
import React104 from "react";
|
|
8885
9527
|
function PanelContent() {
|
|
8886
9528
|
const { activePanel, registeredPanels } = usePanelStore();
|
|
8887
9529
|
const isOpen = activePanel !== null;
|
|
8888
9530
|
const content = activePanel ? registeredPanels.get(activePanel) : null;
|
|
8889
|
-
return /* @__PURE__ */
|
|
9531
|
+
return /* @__PURE__ */ React104.createElement(
|
|
8890
9532
|
"div",
|
|
8891
9533
|
{
|
|
8892
9534
|
style: {
|
|
@@ -8910,7 +9552,7 @@ function IxoEditorContent({
|
|
|
8910
9552
|
onSelectionChange,
|
|
8911
9553
|
children
|
|
8912
9554
|
}) {
|
|
8913
|
-
return /* @__PURE__ */
|
|
9555
|
+
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
9556
|
BlockNoteView,
|
|
8915
9557
|
{
|
|
8916
9558
|
editor,
|
|
@@ -8925,7 +9567,7 @@ function IxoEditorContent({
|
|
|
8925
9567
|
onChange,
|
|
8926
9568
|
onSelectionChange
|
|
8927
9569
|
},
|
|
8928
|
-
config.slashMenu && /* @__PURE__ */
|
|
9570
|
+
config.slashMenu && /* @__PURE__ */ React105.createElement(
|
|
8929
9571
|
SuggestionMenuController,
|
|
8930
9572
|
{
|
|
8931
9573
|
triggerCharacter: "/",
|
|
@@ -8937,7 +9579,7 @@ function IxoEditorContent({
|
|
|
8937
9579
|
}
|
|
8938
9580
|
),
|
|
8939
9581
|
children
|
|
8940
|
-
)), /* @__PURE__ */
|
|
9582
|
+
)), /* @__PURE__ */ React105.createElement(PanelContent, null));
|
|
8941
9583
|
}
|
|
8942
9584
|
function IxoEditor({
|
|
8943
9585
|
editor,
|
|
@@ -8963,9 +9605,9 @@ function IxoEditor({
|
|
|
8963
9605
|
tableHandles: true
|
|
8964
9606
|
};
|
|
8965
9607
|
const isEditable = editable;
|
|
8966
|
-
const editorContent = /* @__PURE__ */
|
|
9608
|
+
const editorContent = /* @__PURE__ */ React105.createElement(BlocknoteProvider, { editor, handlers, blockRequirements, editable: isEditable }, /* @__PURE__ */ React105.createElement(IxoEditorContent, { editor, config, isEditable, className, onChange, onSelectionChange }, children));
|
|
8967
9609
|
if (mantineTheme) {
|
|
8968
|
-
return /* @__PURE__ */
|
|
9610
|
+
return /* @__PURE__ */ React105.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
|
|
8969
9611
|
}
|
|
8970
9612
|
return editorContent;
|
|
8971
9613
|
}
|
|
@@ -9049,4 +9691,4 @@ export {
|
|
|
9049
9691
|
ixoGraphQLClient,
|
|
9050
9692
|
getEntity
|
|
9051
9693
|
};
|
|
9052
|
-
//# sourceMappingURL=chunk-
|
|
9694
|
+
//# sourceMappingURL=chunk-74X5B74P.mjs.map
|