@ixo/editor 1.16.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -36,10 +36,19 @@ var BlocknoteProvider = ({ children, editor, handlers, blockRequirements, editab
|
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
const updateDocType = () => {
|
|
39
|
+
const authoritativeDocType = editor._authoritativeDocType;
|
|
40
|
+
if (authoritativeDocType) {
|
|
41
|
+
console.log("[BlocknoteContext] Using authoritative local docType:", authoritativeDocType);
|
|
42
|
+
if (authoritativeDocType !== docType) {
|
|
43
|
+
console.log("[BlocknoteContext] Setting docType to authoritative value:", authoritativeDocType);
|
|
44
|
+
setDocType(authoritativeDocType);
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
39
48
|
const newDocType = editor.getDocType?.() || "flow";
|
|
40
|
-
console.log("[BlocknoteContext] updateDocType() called, newDocType:", newDocType, "current docType:", docType);
|
|
49
|
+
console.log("[BlocknoteContext] updateDocType() called, newDocType from YMap:", newDocType, "current docType:", docType);
|
|
41
50
|
if (newDocType !== docType) {
|
|
42
|
-
console.log("[BlocknoteContext] docType changed from", docType, "to", newDocType);
|
|
51
|
+
console.log("[BlocknoteContext] docType changed from", docType, "to", newDocType, "(remote or initial change)");
|
|
43
52
|
setDocType(newDocType);
|
|
44
53
|
}
|
|
45
54
|
};
|
|
@@ -54,7 +63,7 @@ var BlocknoteProvider = ({ children, editor, handlers, blockRequirements, editab
|
|
|
54
63
|
console.log("[BlocknoteContext] Unobserving YMap");
|
|
55
64
|
editor._yRoot?.unobserve(observer);
|
|
56
65
|
};
|
|
57
|
-
}, [editor]);
|
|
66
|
+
}, [editor, docType]);
|
|
58
67
|
useEffect(() => {
|
|
59
68
|
sharedProposalsRef.current = sharedProposals;
|
|
60
69
|
}, [sharedProposals]);
|
|
@@ -266,6 +275,41 @@ import { Stack as Stack3, SegmentedControl, Button as Button2, Text, Alert } fro
|
|
|
266
275
|
import React3, { useCallback as useCallback3, useMemo } from "react";
|
|
267
276
|
import { Card, Stack as Stack2, TextInput as TextInput2, Select as Select2, Group, Button } from "@mantine/core";
|
|
268
277
|
|
|
278
|
+
// src/mantine/blocks/apiRequest/types.ts
|
|
279
|
+
function parseResponseSchema(schemaString) {
|
|
280
|
+
if (!schemaString) return null;
|
|
281
|
+
try {
|
|
282
|
+
return JSON.parse(schemaString);
|
|
283
|
+
} catch (error) {
|
|
284
|
+
console.warn("Failed to parse response schema:", error);
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function validateResponseAgainstSchema(response, schema) {
|
|
289
|
+
const errors = [];
|
|
290
|
+
schema.fields.forEach((field) => {
|
|
291
|
+
const value = getNestedValueForValidation(response, field.path);
|
|
292
|
+
if (value === void 0) {
|
|
293
|
+
errors.push(`Missing field: ${field.path}`);
|
|
294
|
+
} else {
|
|
295
|
+
const actualType = Array.isArray(value) ? "array" : typeof value;
|
|
296
|
+
if (field.type === "object" && actualType !== "object") {
|
|
297
|
+
errors.push(`Type mismatch for ${field.path}: expected object, got ${actualType}`);
|
|
298
|
+
} else if (field.type === "array" && !Array.isArray(value)) {
|
|
299
|
+
errors.push(`Type mismatch for ${field.path}: expected array, got ${actualType}`);
|
|
300
|
+
} else if (field.type !== "object" && field.type !== "array" && actualType !== field.type) {
|
|
301
|
+
errors.push(`Type mismatch for ${field.path}: expected ${field.type}, got ${actualType}`);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
return errors;
|
|
306
|
+
}
|
|
307
|
+
function getNestedValueForValidation(obj, path) {
|
|
308
|
+
return path.split(".").reduce((current, key) => {
|
|
309
|
+
return current?.[key];
|
|
310
|
+
}, obj);
|
|
311
|
+
}
|
|
312
|
+
|
|
269
313
|
// src/mantine/blocks/registry/conditionableProperties.ts
|
|
270
314
|
var CONDITIONABLE_PROPERTIES = {
|
|
271
315
|
checkbox: [
|
|
@@ -404,10 +448,75 @@ var CONDITIONABLE_PROPERTIES = {
|
|
|
404
448
|
type: "string",
|
|
405
449
|
description: "The JSON string of actions"
|
|
406
450
|
}
|
|
451
|
+
],
|
|
452
|
+
apiRequest: [
|
|
453
|
+
{
|
|
454
|
+
name: "endpoint",
|
|
455
|
+
displayName: "Endpoint",
|
|
456
|
+
type: "string",
|
|
457
|
+
description: "The API endpoint URL"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
name: "method",
|
|
461
|
+
displayName: "HTTP Method",
|
|
462
|
+
type: "select",
|
|
463
|
+
selectOptions: [
|
|
464
|
+
{ value: "GET", label: "GET" },
|
|
465
|
+
{ value: "POST", label: "POST" },
|
|
466
|
+
{ value: "PUT", label: "PUT" },
|
|
467
|
+
{ value: "DELETE", label: "DELETE" },
|
|
468
|
+
{ value: "PATCH", label: "PATCH" }
|
|
469
|
+
],
|
|
470
|
+
description: "The HTTP method for the request"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: "response",
|
|
474
|
+
displayName: "Response",
|
|
475
|
+
type: "string",
|
|
476
|
+
description: "The response data from the API request"
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
name: "status",
|
|
480
|
+
displayName: "Status",
|
|
481
|
+
type: "select",
|
|
482
|
+
selectOptions: [
|
|
483
|
+
{ value: "idle", label: "Idle" },
|
|
484
|
+
{ value: "loading", label: "Loading" },
|
|
485
|
+
{ value: "success", label: "Success" },
|
|
486
|
+
{ value: "error", label: "Error" }
|
|
487
|
+
],
|
|
488
|
+
description: "The current status of the API request"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
name: "title",
|
|
492
|
+
displayName: "Title",
|
|
493
|
+
type: "string",
|
|
494
|
+
description: "The title of the API request block"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
name: "description",
|
|
498
|
+
displayName: "Description",
|
|
499
|
+
type: "string",
|
|
500
|
+
description: "The description of the API request block"
|
|
501
|
+
}
|
|
407
502
|
]
|
|
408
503
|
};
|
|
409
|
-
function getConditionableProperties(blockType) {
|
|
410
|
-
|
|
504
|
+
function getConditionableProperties(blockType, block) {
|
|
505
|
+
const baseProperties = CONDITIONABLE_PROPERTIES[blockType] || [];
|
|
506
|
+
if (blockType === "apiRequest" && block?.props?.responseSchema) {
|
|
507
|
+
const schema = parseResponseSchema(block.props.responseSchema);
|
|
508
|
+
if (schema && schema.fields.length > 0) {
|
|
509
|
+
const schemaProperties = schema.fields.map((field) => ({
|
|
510
|
+
name: `response.${field.path}`,
|
|
511
|
+
displayName: field.displayName,
|
|
512
|
+
type: field.type,
|
|
513
|
+
description: field.description || `Response field: ${field.displayName}`
|
|
514
|
+
}));
|
|
515
|
+
const filteredBase = baseProperties.filter((prop) => prop.name !== "response");
|
|
516
|
+
return [...filteredBase, ...schemaProperties];
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return baseProperties;
|
|
411
520
|
}
|
|
412
521
|
function getPropertyByName(blockType, propertyName) {
|
|
413
522
|
const properties = getConditionableProperties(blockType);
|
|
@@ -3434,19 +3543,32 @@ import { Paper as Paper6, CloseButton as CloseButton4, Title as Title5 } from "@
|
|
|
3434
3543
|
|
|
3435
3544
|
// src/mantine/blocks/proposal/template/GeneralTab.tsx
|
|
3436
3545
|
import React44, { useEffect as useEffect8, useState as useState8 } from "react";
|
|
3437
|
-
import { Stack as Stack27, Text as Text27, TextInput as TextInput5, Textarea as Textarea2, Select as Select3, Loader as Loader3 } from "@mantine/core";
|
|
3546
|
+
import { Stack as Stack27, Text as Text27, TextInput as TextInput5, Textarea as Textarea2, Select as Select3, Loader as Loader3, SegmentedControl as SegmentedControl4 } from "@mantine/core";
|
|
3438
3547
|
var GeneralTab3 = ({ title, description, coreAddress, onTitleChange, onDescriptionChange, onGroupChange }) => {
|
|
3439
3548
|
const handlers = useBlocknoteHandlers();
|
|
3440
3549
|
const [localTitle, setLocalTitle] = useState8(title || "");
|
|
3441
3550
|
const [localDescription, setLocalDescription] = useState8(description || "");
|
|
3442
3551
|
const [groups, setGroups] = useState8([]);
|
|
3443
3552
|
const [loadingGroups, setLoadingGroups] = useState8(false);
|
|
3553
|
+
const [inputMode, setInputMode] = useState8("select");
|
|
3554
|
+
const [manualAddress, setManualAddress] = useState8("");
|
|
3444
3555
|
useEffect8(() => {
|
|
3445
3556
|
setLocalTitle(title || "");
|
|
3446
3557
|
}, [title]);
|
|
3447
3558
|
useEffect8(() => {
|
|
3448
3559
|
setLocalDescription(description || "");
|
|
3449
3560
|
}, [description]);
|
|
3561
|
+
useEffect8(() => {
|
|
3562
|
+
if (coreAddress) {
|
|
3563
|
+
const matchesGroup = groups.some((g) => g.coreAddress === coreAddress);
|
|
3564
|
+
if (matchesGroup) {
|
|
3565
|
+
setInputMode("select");
|
|
3566
|
+
} else {
|
|
3567
|
+
setInputMode("manual");
|
|
3568
|
+
setManualAddress(coreAddress);
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
}, [coreAddress, groups]);
|
|
3450
3572
|
useEffect8(() => {
|
|
3451
3573
|
const fetchGroups = async () => {
|
|
3452
3574
|
if (!handlers?.getDAOGroups) {
|
|
@@ -3489,6 +3611,17 @@ var GeneralTab3 = ({ title, description, coreAddress, onTitleChange, onDescripti
|
|
|
3489
3611
|
}
|
|
3490
3612
|
}
|
|
3491
3613
|
)), /* @__PURE__ */ React44.createElement(Stack27, { gap: "xs" }, /* @__PURE__ */ React44.createElement(Text27, { size: "sm", fw: 600 }, "Group"), /* @__PURE__ */ React44.createElement(
|
|
3614
|
+
SegmentedControl4,
|
|
3615
|
+
{
|
|
3616
|
+
value: inputMode,
|
|
3617
|
+
onChange: (value) => setInputMode(value),
|
|
3618
|
+
data: [
|
|
3619
|
+
{ label: "Select DAO", value: "select" },
|
|
3620
|
+
{ label: "Manual Entry", value: "manual" }
|
|
3621
|
+
],
|
|
3622
|
+
fullWidth: true
|
|
3623
|
+
}
|
|
3624
|
+
), inputMode === "select" ? /* @__PURE__ */ React44.createElement(
|
|
3492
3625
|
Select3,
|
|
3493
3626
|
{
|
|
3494
3627
|
placeholder: loadingGroups ? "Loading groups..." : "Select a DAO group",
|
|
@@ -3509,6 +3642,17 @@ var GeneralTab3 = ({ title, description, coreAddress, onTitleChange, onDescripti
|
|
|
3509
3642
|
rightSection: loadingGroups ? /* @__PURE__ */ React44.createElement(Loader3, { size: "xs" }) : void 0,
|
|
3510
3643
|
searchable: true
|
|
3511
3644
|
}
|
|
3645
|
+
) : /* @__PURE__ */ React44.createElement(
|
|
3646
|
+
TextInput5,
|
|
3647
|
+
{
|
|
3648
|
+
placeholder: "Enter DAO core address",
|
|
3649
|
+
value: manualAddress,
|
|
3650
|
+
onChange: (event) => {
|
|
3651
|
+
const newAddress = event.currentTarget.value;
|
|
3652
|
+
setManualAddress(newAddress);
|
|
3653
|
+
onGroupChange(newAddress);
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3512
3656
|
)));
|
|
3513
3657
|
};
|
|
3514
3658
|
|
|
@@ -6589,8 +6733,8 @@ var OnChainProposalCard = ({
|
|
|
6589
6733
|
};
|
|
6590
6734
|
|
|
6591
6735
|
// src/mantine/blocks/proposal/flow/FlowConfig.tsx
|
|
6592
|
-
import React84, { useCallback as useCallback15, useState as useState21 } from "react";
|
|
6593
|
-
import { Paper as Paper7, CloseButton as CloseButton5, Title as Title6, Stack as Stack66, TextInput as TextInput33, Textarea as Textarea18, Button as Button16, Text as Text41, Card as Card18 } from "@mantine/core";
|
|
6736
|
+
import React84, { useCallback as useCallback15, useState as useState21, useEffect as useEffect15 } from "react";
|
|
6737
|
+
import { Paper as Paper7, CloseButton as CloseButton5, Title as Title6, Stack as Stack66, TextInput as TextInput33, Textarea as Textarea18, Button as Button16, Text as Text41, Card as Card18, Select as Select10, Loader as Loader4, SegmentedControl as SegmentedControl5 } from "@mantine/core";
|
|
6594
6738
|
|
|
6595
6739
|
// src/mantine/blocks/proposal/flow/useFlowBusinessLogic.ts
|
|
6596
6740
|
import { useEffect as useEffect12, useState as useState17 } from "react";
|
|
@@ -7173,9 +7317,14 @@ var ActionsTab2 = ({ actions, onActionsChange, editor, block, isProposalCreated
|
|
|
7173
7317
|
// src/mantine/blocks/proposal/flow/FlowConfig.tsx
|
|
7174
7318
|
var FlowConfig = ({ editor, block }) => {
|
|
7175
7319
|
const { closePanel } = usePanelStore();
|
|
7320
|
+
const handlers = useBlocknoteHandlers();
|
|
7176
7321
|
const coreAddress = block.props.coreAddress || "";
|
|
7177
7322
|
const [errors, setErrors] = useState21({});
|
|
7178
7323
|
const [isCreating, setIsCreating] = useState21(false);
|
|
7324
|
+
const [groups, setGroups] = useState21([]);
|
|
7325
|
+
const [loadingGroups, setLoadingGroups] = useState21(false);
|
|
7326
|
+
const [inputMode, setInputMode] = useState21("select");
|
|
7327
|
+
const [manualAddress, setManualAddress] = useState21("");
|
|
7179
7328
|
const { createProposal, title, description, proposalId } = useFlowBusinessLogic({
|
|
7180
7329
|
block,
|
|
7181
7330
|
editor
|
|
@@ -7193,6 +7342,35 @@ var FlowConfig = ({ editor, block }) => {
|
|
|
7193
7342
|
},
|
|
7194
7343
|
[editor, block]
|
|
7195
7344
|
);
|
|
7345
|
+
useEffect15(() => {
|
|
7346
|
+
if (coreAddress) {
|
|
7347
|
+
const matchesGroup = groups.some((g) => g.coreAddress === coreAddress);
|
|
7348
|
+
if (matchesGroup) {
|
|
7349
|
+
setInputMode("select");
|
|
7350
|
+
} else {
|
|
7351
|
+
setInputMode("manual");
|
|
7352
|
+
setManualAddress(coreAddress);
|
|
7353
|
+
}
|
|
7354
|
+
}
|
|
7355
|
+
}, [coreAddress, groups]);
|
|
7356
|
+
useEffect15(() => {
|
|
7357
|
+
const fetchGroups = async () => {
|
|
7358
|
+
if (!handlers?.getDAOGroups) {
|
|
7359
|
+
console.warn("getDAOGroups handler not available");
|
|
7360
|
+
return;
|
|
7361
|
+
}
|
|
7362
|
+
setLoadingGroups(true);
|
|
7363
|
+
try {
|
|
7364
|
+
const daoGroups = await handlers.getDAOGroups();
|
|
7365
|
+
setGroups(daoGroups);
|
|
7366
|
+
} catch (error) {
|
|
7367
|
+
console.error("Failed to fetch DAO groups:", error);
|
|
7368
|
+
} finally {
|
|
7369
|
+
setLoadingGroups(false);
|
|
7370
|
+
}
|
|
7371
|
+
};
|
|
7372
|
+
fetchGroups();
|
|
7373
|
+
}, [handlers]);
|
|
7196
7374
|
const validateForm = () => {
|
|
7197
7375
|
const newErrors = {};
|
|
7198
7376
|
if (!title.trim()) {
|
|
@@ -7219,7 +7397,52 @@ var FlowConfig = ({ editor, block }) => {
|
|
|
7219
7397
|
setIsCreating(false);
|
|
7220
7398
|
}
|
|
7221
7399
|
};
|
|
7222
|
-
const createProposalTab = /* @__PURE__ */ React84.createElement(Stack66, { gap: "lg" },
|
|
7400
|
+
const createProposalTab = /* @__PURE__ */ React84.createElement(Stack66, { gap: "lg" }, /* @__PURE__ */ React84.createElement(Stack66, { gap: "xs" }, /* @__PURE__ */ React84.createElement(Text41, { size: "sm", fw: 600 }, "DAO Group"), /* @__PURE__ */ React84.createElement(
|
|
7401
|
+
SegmentedControl5,
|
|
7402
|
+
{
|
|
7403
|
+
value: inputMode,
|
|
7404
|
+
onChange: (value) => setInputMode(value),
|
|
7405
|
+
data: [
|
|
7406
|
+
{ label: "Select DAO", value: "select" },
|
|
7407
|
+
{ label: "Manual Entry", value: "manual" }
|
|
7408
|
+
],
|
|
7409
|
+
fullWidth: true,
|
|
7410
|
+
disabled: isProposalCreated
|
|
7411
|
+
}
|
|
7412
|
+
), inputMode === "select" ? /* @__PURE__ */ React84.createElement(
|
|
7413
|
+
Select10,
|
|
7414
|
+
{
|
|
7415
|
+
placeholder: loadingGroups ? "Loading groups..." : "Select a DAO group",
|
|
7416
|
+
value: groups.find((g) => g.coreAddress === coreAddress)?.id || null,
|
|
7417
|
+
onChange: (value) => {
|
|
7418
|
+
if (value) {
|
|
7419
|
+
const selectedGroup = groups.find((g) => g.id === value);
|
|
7420
|
+
if (selectedGroup) {
|
|
7421
|
+
updateProp("coreAddress", selectedGroup.coreAddress);
|
|
7422
|
+
}
|
|
7423
|
+
}
|
|
7424
|
+
},
|
|
7425
|
+
data: groups.map((group) => ({
|
|
7426
|
+
value: group.id,
|
|
7427
|
+
label: group.name
|
|
7428
|
+
})),
|
|
7429
|
+
disabled: loadingGroups || isProposalCreated,
|
|
7430
|
+
rightSection: loadingGroups ? /* @__PURE__ */ React84.createElement(Loader4, { size: "xs" }) : void 0,
|
|
7431
|
+
searchable: true
|
|
7432
|
+
}
|
|
7433
|
+
) : /* @__PURE__ */ React84.createElement(
|
|
7434
|
+
TextInput33,
|
|
7435
|
+
{
|
|
7436
|
+
placeholder: "Enter DAO core address",
|
|
7437
|
+
value: manualAddress,
|
|
7438
|
+
onChange: (event) => {
|
|
7439
|
+
const newAddress = event.currentTarget.value;
|
|
7440
|
+
setManualAddress(newAddress);
|
|
7441
|
+
updateProp("coreAddress", newAddress);
|
|
7442
|
+
},
|
|
7443
|
+
disabled: isProposalCreated
|
|
7444
|
+
}
|
|
7445
|
+
), coreAddress && /* @__PURE__ */ React84.createElement(Card18, { padding: "sm", radius: "md", withBorder: true }, /* @__PURE__ */ React84.createElement(Text41, { size: "xs", c: "dimmed" }, "Core Address:", " ", /* @__PURE__ */ React84.createElement(Text41, { span: true, ff: "monospace", c: "bright" }, coreAddress.slice(0, 20), "...", coreAddress.slice(-10))))), /* @__PURE__ */ React84.createElement(
|
|
7223
7446
|
TextInput33,
|
|
7224
7447
|
{
|
|
7225
7448
|
label: "Title",
|
|
@@ -7416,23 +7639,393 @@ var ProposalBlockSpec = createReactBlockSpec4(
|
|
|
7416
7639
|
);
|
|
7417
7640
|
|
|
7418
7641
|
// src/mantine/blocks/apiRequest/ApiRequestBlockSpec.tsx
|
|
7419
|
-
import
|
|
7642
|
+
import React96 from "react";
|
|
7420
7643
|
import { createReactBlockSpec as createReactBlockSpec5 } from "@blocknote/react";
|
|
7421
7644
|
|
|
7422
7645
|
// src/mantine/blocks/apiRequest/ApiRequestBlock.tsx
|
|
7423
|
-
import
|
|
7646
|
+
import React95 from "react";
|
|
7424
7647
|
|
|
7425
7648
|
// src/mantine/blocks/apiRequest/template/TemplateView.tsx
|
|
7426
|
-
import
|
|
7649
|
+
import React93, { useMemo as useMemo16 } from "react";
|
|
7427
7650
|
|
|
7428
7651
|
// src/mantine/blocks/apiRequest/template/TemplateConfig.tsx
|
|
7429
|
-
import
|
|
7430
|
-
import { Paper as
|
|
7652
|
+
import React92, { useCallback as useCallback17, useMemo as useMemo15 } from "react";
|
|
7653
|
+
import { Paper as Paper10, CloseButton as CloseButton6, Title as Title7 } from "@mantine/core";
|
|
7431
7654
|
|
|
7432
7655
|
// src/mantine/blocks/apiRequest/template/GeneralTab.tsx
|
|
7433
|
-
import
|
|
7434
|
-
import { Divider as Divider5, Select as
|
|
7656
|
+
import React90, { useEffect as useEffect16, useState as useState24 } from "react";
|
|
7657
|
+
import { Divider as Divider5, Select as Select11, Stack as Stack68, Text as Text43, TextInput as TextInput34, Textarea as Textarea19, Button as Button18, Group as Group25, ActionIcon as ActionIcon12, Paper as Paper8 } from "@mantine/core";
|
|
7435
7658
|
import { IconTrash, IconPlus } from "@tabler/icons-react";
|
|
7659
|
+
|
|
7660
|
+
// src/mantine/components/DataInput/DataInput.tsx
|
|
7661
|
+
import React89, { useState as useState23, useCallback as useCallback16, useMemo as useMemo14 } from "react";
|
|
7662
|
+
import { Input as Input2, ActionIcon as ActionIcon11, Tooltip as Tooltip5, Badge as Badge11, Group as Group24 } from "@mantine/core";
|
|
7663
|
+
import { IconVariable, IconX as IconX2 } from "@tabler/icons-react";
|
|
7664
|
+
|
|
7665
|
+
// src/mantine/components/DataInput/BlockPropSelector.tsx
|
|
7666
|
+
import React88, { useState as useState22, useMemo as useMemo13 } from "react";
|
|
7667
|
+
import { Popover, Text as Text42, Stack as Stack67, Group as Group23, ActionIcon as ActionIcon10, Input, ScrollArea as ScrollArea4, Badge as Badge10, Box as Box17, Tooltip as Tooltip4 } from "@mantine/core";
|
|
7668
|
+
import { IconSearch, IconX, IconCircle, IconChevronRight, IconArrowLeft } from "@tabler/icons-react";
|
|
7669
|
+
function buildPropertyTree(properties) {
|
|
7670
|
+
const root = [];
|
|
7671
|
+
properties.forEach((prop) => {
|
|
7672
|
+
const pathParts = prop.name.split(".");
|
|
7673
|
+
let currentLevel = root;
|
|
7674
|
+
pathParts.forEach((part, index) => {
|
|
7675
|
+
const isLastPart = index === pathParts.length - 1;
|
|
7676
|
+
const fullPath = pathParts.slice(0, index + 1).join(".");
|
|
7677
|
+
let existingNode = currentLevel.find((node) => node.name === part);
|
|
7678
|
+
if (!existingNode) {
|
|
7679
|
+
const newNode = {
|
|
7680
|
+
name: part,
|
|
7681
|
+
displayName: isLastPart ? prop.displayName : part,
|
|
7682
|
+
type: isLastPart ? prop.type : "object",
|
|
7683
|
+
fullPath,
|
|
7684
|
+
children: [],
|
|
7685
|
+
isLeaf: isLastPart
|
|
7686
|
+
};
|
|
7687
|
+
currentLevel.push(newNode);
|
|
7688
|
+
existingNode = newNode;
|
|
7689
|
+
}
|
|
7690
|
+
if (!isLastPart) {
|
|
7691
|
+
currentLevel = existingNode.children;
|
|
7692
|
+
}
|
|
7693
|
+
});
|
|
7694
|
+
});
|
|
7695
|
+
return root;
|
|
7696
|
+
}
|
|
7697
|
+
function getBlockDisplayName2(block) {
|
|
7698
|
+
const title = block.props?.title || block.props?.name || block.props?.label;
|
|
7699
|
+
if (title) {
|
|
7700
|
+
return title;
|
|
7701
|
+
}
|
|
7702
|
+
return `${block.type} (${block.id.slice(0, 8)}...)`;
|
|
7703
|
+
}
|
|
7704
|
+
function getBlockTypeColor(blockType) {
|
|
7705
|
+
const colorMap = {
|
|
7706
|
+
checkbox: "blue",
|
|
7707
|
+
proposal: "green",
|
|
7708
|
+
proposalVote: "teal",
|
|
7709
|
+
list: "orange",
|
|
7710
|
+
overview: "purple",
|
|
7711
|
+
proposalActions: "pink",
|
|
7712
|
+
apiRequest: "cyan"
|
|
7713
|
+
};
|
|
7714
|
+
return colorMap[blockType] || "gray";
|
|
7715
|
+
}
|
|
7716
|
+
function BlockPropSelector({ children, opened, onClose, onSelect, editorDocument, currentBlockId }) {
|
|
7717
|
+
const [searchQuery, setSearchQuery] = useState22("");
|
|
7718
|
+
const [selectedBlock, setSelectedBlock] = useState22(null);
|
|
7719
|
+
const [navigationPath, setNavigationPath] = useState22([]);
|
|
7720
|
+
const availableBlocks = useMemo13(() => {
|
|
7721
|
+
if (!editorDocument) return [];
|
|
7722
|
+
return editorDocument.filter((block) => {
|
|
7723
|
+
if (currentBlockId && block.id === currentBlockId) {
|
|
7724
|
+
return false;
|
|
7725
|
+
}
|
|
7726
|
+
const props = getConditionableProperties(block.type);
|
|
7727
|
+
return props.length > 0;
|
|
7728
|
+
}).map((block) => ({
|
|
7729
|
+
...block,
|
|
7730
|
+
displayName: getBlockDisplayName2(block),
|
|
7731
|
+
properties: getConditionableProperties(block.type, block),
|
|
7732
|
+
propertyTree: buildPropertyTree(getConditionableProperties(block.type, block))
|
|
7733
|
+
}));
|
|
7734
|
+
}, [editorDocument, currentBlockId]);
|
|
7735
|
+
const filteredBlocks = useMemo13(() => {
|
|
7736
|
+
if (!searchQuery.trim()) {
|
|
7737
|
+
return availableBlocks;
|
|
7738
|
+
}
|
|
7739
|
+
const query = searchQuery.toLowerCase();
|
|
7740
|
+
return availableBlocks.filter((block) => {
|
|
7741
|
+
if (block.displayName.toLowerCase().includes(query)) {
|
|
7742
|
+
return true;
|
|
7743
|
+
}
|
|
7744
|
+
if (block.type.toLowerCase().includes(query)) {
|
|
7745
|
+
return true;
|
|
7746
|
+
}
|
|
7747
|
+
return block.properties.some((prop) => prop.name.toLowerCase().includes(query) || prop.displayName.toLowerCase().includes(query));
|
|
7748
|
+
});
|
|
7749
|
+
}, [availableBlocks, searchQuery]);
|
|
7750
|
+
const currentNodes = useMemo13(() => {
|
|
7751
|
+
if (!selectedBlock) return [];
|
|
7752
|
+
if (navigationPath.length === 0) {
|
|
7753
|
+
return selectedBlock.propertyTree;
|
|
7754
|
+
} else {
|
|
7755
|
+
const lastNode = navigationPath[navigationPath.length - 1];
|
|
7756
|
+
return lastNode.children;
|
|
7757
|
+
}
|
|
7758
|
+
}, [selectedBlock, navigationPath]);
|
|
7759
|
+
const handleBlockSelect = (block) => {
|
|
7760
|
+
setSelectedBlock(block);
|
|
7761
|
+
setNavigationPath([]);
|
|
7762
|
+
setSearchQuery("");
|
|
7763
|
+
};
|
|
7764
|
+
const handleNodeClick = (node) => {
|
|
7765
|
+
if (node.isLeaf) {
|
|
7766
|
+
onSelect({
|
|
7767
|
+
blockId: selectedBlock.id,
|
|
7768
|
+
blockType: selectedBlock.type,
|
|
7769
|
+
propName: node.fullPath,
|
|
7770
|
+
propDisplayName: node.displayName
|
|
7771
|
+
});
|
|
7772
|
+
handleClose();
|
|
7773
|
+
} else {
|
|
7774
|
+
setNavigationPath([...navigationPath, node]);
|
|
7775
|
+
}
|
|
7776
|
+
};
|
|
7777
|
+
const handleBack = () => {
|
|
7778
|
+
if (navigationPath.length > 0) {
|
|
7779
|
+
setNavigationPath(navigationPath.slice(0, -1));
|
|
7780
|
+
} else {
|
|
7781
|
+
setSelectedBlock(null);
|
|
7782
|
+
}
|
|
7783
|
+
};
|
|
7784
|
+
const handleClose = () => {
|
|
7785
|
+
setSelectedBlock(null);
|
|
7786
|
+
setNavigationPath([]);
|
|
7787
|
+
setSearchQuery("");
|
|
7788
|
+
onClose();
|
|
7789
|
+
};
|
|
7790
|
+
return /* @__PURE__ */ React88.createElement(Popover, { opened, onClose: handleClose, position: "bottom-end", width: 420, shadow: "md", withinPortal: true }, /* @__PURE__ */ React88.createElement(Popover.Target, null, children), /* @__PURE__ */ React88.createElement(Popover.Dropdown, { p: "md" }, /* @__PURE__ */ React88.createElement(Stack67, { gap: "md" }, /* @__PURE__ */ React88.createElement(Group23, { justify: "space-between", align: "center" }, /* @__PURE__ */ React88.createElement(Group23, { gap: "xs" }, (selectedBlock || navigationPath.length > 0) && /* @__PURE__ */ React88.createElement(ActionIcon10, { variant: "subtle", size: "sm", onClick: handleBack }, /* @__PURE__ */ React88.createElement(IconArrowLeft, { size: 16 })), /* @__PURE__ */ React88.createElement(Text42, { fw: 600, size: "sm" }, !selectedBlock ? "Select a Block" : navigationPath.length === 0 ? `${selectedBlock.displayName} - Select Property` : `${navigationPath[navigationPath.length - 1].displayName}`)), /* @__PURE__ */ React88.createElement(ActionIcon10, { variant: "subtle", size: "sm", onClick: handleClose }, /* @__PURE__ */ React88.createElement(IconX, { size: 16 }))), !selectedBlock && /* @__PURE__ */ React88.createElement(
|
|
7791
|
+
Input,
|
|
7792
|
+
{
|
|
7793
|
+
placeholder: "Search blocks and properties...",
|
|
7794
|
+
leftSection: /* @__PURE__ */ React88.createElement(IconSearch, { size: 16 }),
|
|
7795
|
+
value: searchQuery,
|
|
7796
|
+
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
7797
|
+
size: "xs",
|
|
7798
|
+
rightSection: searchQuery && /* @__PURE__ */ React88.createElement(ActionIcon10, { variant: "subtle", onClick: () => setSearchQuery(""), size: "xs" }, /* @__PURE__ */ React88.createElement(IconX, { size: 12 }))
|
|
7799
|
+
}
|
|
7800
|
+
), /* @__PURE__ */ React88.createElement(ScrollArea4, { h: 300, type: "auto" }, !selectedBlock ? (
|
|
7801
|
+
// Block selection view
|
|
7802
|
+
filteredBlocks.length === 0 ? /* @__PURE__ */ React88.createElement(Text42, { c: "dimmed", ta: "center", py: "xl", size: "sm" }, availableBlocks.length === 0 ? "No blocks with referenceable properties found" : "No blocks match your search") : /* @__PURE__ */ React88.createElement(Stack67, { gap: "sm" }, filteredBlocks.map((block) => /* @__PURE__ */ React88.createElement(
|
|
7803
|
+
Box17,
|
|
7804
|
+
{
|
|
7805
|
+
key: block.id,
|
|
7806
|
+
onClick: () => handleBlockSelect(block),
|
|
7807
|
+
style: {
|
|
7808
|
+
borderRadius: "6px",
|
|
7809
|
+
border: "1px solid var(--mantine-color-gray-3)",
|
|
7810
|
+
padding: "12px",
|
|
7811
|
+
cursor: "pointer",
|
|
7812
|
+
transition: "all 0.15s ease"
|
|
7813
|
+
},
|
|
7814
|
+
onMouseEnter: (e) => {
|
|
7815
|
+
e.currentTarget.style.backgroundColor = "var(--mantine-color-gray-0)";
|
|
7816
|
+
e.currentTarget.style.borderColor = "var(--mantine-color-gray-4)";
|
|
7817
|
+
},
|
|
7818
|
+
onMouseLeave: (e) => {
|
|
7819
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
7820
|
+
e.currentTarget.style.borderColor = "var(--mantine-color-gray-3)";
|
|
7821
|
+
}
|
|
7822
|
+
},
|
|
7823
|
+
/* @__PURE__ */ React88.createElement(Group23, { gap: "xs", justify: "space-between" }, /* @__PURE__ */ React88.createElement(Group23, { gap: "xs" }, /* @__PURE__ */ React88.createElement(
|
|
7824
|
+
IconCircle,
|
|
7825
|
+
{
|
|
7826
|
+
size: 10,
|
|
7827
|
+
fill: `var(--mantine-color-${getBlockTypeColor(block.type)}-6)`,
|
|
7828
|
+
color: `var(--mantine-color-${getBlockTypeColor(block.type)}-6)`
|
|
7829
|
+
}
|
|
7830
|
+
), /* @__PURE__ */ React88.createElement(Text42, { fw: 500, size: "sm" }, block.displayName), /* @__PURE__ */ React88.createElement(Badge10, { size: "xs", variant: "light", color: getBlockTypeColor(block.type) }, block.type)), /* @__PURE__ */ React88.createElement(IconChevronRight, { size: 16, color: "var(--mantine-color-gray-5)" }))
|
|
7831
|
+
)))
|
|
7832
|
+
) : (
|
|
7833
|
+
// Property navigation view
|
|
7834
|
+
currentNodes.length === 0 ? /* @__PURE__ */ React88.createElement(Text42, { c: "dimmed", ta: "center", py: "xl", size: "sm" }, "No properties available") : /* @__PURE__ */ React88.createElement(Stack67, { gap: "xs" }, currentNodes.map((node, index) => /* @__PURE__ */ React88.createElement(Tooltip4, { key: index, label: node.isLeaf ? `Select ${node.displayName}` : `Navigate into ${node.displayName}`, position: "left", withArrow: true }, /* @__PURE__ */ React88.createElement(
|
|
7835
|
+
Box17,
|
|
7836
|
+
{
|
|
7837
|
+
onClick: () => handleNodeClick(node),
|
|
7838
|
+
style: {
|
|
7839
|
+
padding: "10px 12px",
|
|
7840
|
+
borderRadius: "4px",
|
|
7841
|
+
cursor: "pointer",
|
|
7842
|
+
transition: "background-color 0.15s ease",
|
|
7843
|
+
border: "1px solid transparent"
|
|
7844
|
+
},
|
|
7845
|
+
onMouseEnter: (e) => {
|
|
7846
|
+
e.currentTarget.style.backgroundColor = "var(--mantine-color-gray-0)";
|
|
7847
|
+
e.currentTarget.style.borderColor = "var(--mantine-color-gray-3)";
|
|
7848
|
+
},
|
|
7849
|
+
onMouseLeave: (e) => {
|
|
7850
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
7851
|
+
e.currentTarget.style.borderColor = "transparent";
|
|
7852
|
+
}
|
|
7853
|
+
},
|
|
7854
|
+
/* @__PURE__ */ React88.createElement(Group23, { gap: "xs", justify: "space-between" }, /* @__PURE__ */ React88.createElement(Group23, { gap: "xs" }, /* @__PURE__ */ React88.createElement(Text42, { size: "sm" }, node.displayName), /* @__PURE__ */ React88.createElement(Badge10, { size: "xs", variant: "dot", color: "gray" }, node.type)), !node.isLeaf && /* @__PURE__ */ React88.createElement(IconChevronRight, { size: 16, color: "var(--mantine-color-gray-5)" }))
|
|
7855
|
+
))))
|
|
7856
|
+
)))));
|
|
7857
|
+
}
|
|
7858
|
+
|
|
7859
|
+
// src/mantine/utils/referenceResolver.ts
|
|
7860
|
+
var REFERENCE_REGEX = /\{\{([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_.]+)\}\}/g;
|
|
7861
|
+
function parseReferences(input) {
|
|
7862
|
+
const references = [];
|
|
7863
|
+
const regex = new RegExp(REFERENCE_REGEX);
|
|
7864
|
+
let match;
|
|
7865
|
+
while ((match = regex.exec(input)) !== null) {
|
|
7866
|
+
references.push({
|
|
7867
|
+
fullMatch: match[0],
|
|
7868
|
+
blockId: match[1],
|
|
7869
|
+
propPath: match[2],
|
|
7870
|
+
startIndex: match.index,
|
|
7871
|
+
endIndex: match.index + match[0].length
|
|
7872
|
+
});
|
|
7873
|
+
}
|
|
7874
|
+
return references;
|
|
7875
|
+
}
|
|
7876
|
+
function getNestedValue(obj, path) {
|
|
7877
|
+
return path.split(".").reduce((current, key) => {
|
|
7878
|
+
return current?.[key];
|
|
7879
|
+
}, obj);
|
|
7880
|
+
}
|
|
7881
|
+
function resolveSingleReference(blockId, propPath, editorDocument) {
|
|
7882
|
+
if (!editorDocument || !Array.isArray(editorDocument)) {
|
|
7883
|
+
console.warn("Invalid editor document provided to resolveSingleReference");
|
|
7884
|
+
return void 0;
|
|
7885
|
+
}
|
|
7886
|
+
const block = editorDocument.find((b) => b.id === blockId);
|
|
7887
|
+
if (!block) {
|
|
7888
|
+
console.warn(`Block not found: ${blockId}`);
|
|
7889
|
+
return void 0;
|
|
7890
|
+
}
|
|
7891
|
+
if (propPath.startsWith("response.")) {
|
|
7892
|
+
const responseData = block.props.response;
|
|
7893
|
+
if (!responseData) {
|
|
7894
|
+
console.warn(`No response data in block ${blockId}`);
|
|
7895
|
+
return void 0;
|
|
7896
|
+
}
|
|
7897
|
+
try {
|
|
7898
|
+
const parsedResponse = typeof responseData === "string" ? JSON.parse(responseData) : responseData;
|
|
7899
|
+
const innerPath = propPath.substring("response.".length);
|
|
7900
|
+
const value2 = getNestedValue(parsedResponse, innerPath);
|
|
7901
|
+
if (value2 === void 0) {
|
|
7902
|
+
console.warn(`Property not found in response: ${innerPath} in block ${blockId}`);
|
|
7903
|
+
}
|
|
7904
|
+
return value2;
|
|
7905
|
+
} catch (error) {
|
|
7906
|
+
console.warn(`Failed to parse response JSON for block ${blockId}:`, error);
|
|
7907
|
+
return void 0;
|
|
7908
|
+
}
|
|
7909
|
+
}
|
|
7910
|
+
const value = getNestedValue(block.props, propPath);
|
|
7911
|
+
if (value === void 0) {
|
|
7912
|
+
console.warn(`Property not found: ${propPath} in block ${blockId}`);
|
|
7913
|
+
}
|
|
7914
|
+
return value;
|
|
7915
|
+
}
|
|
7916
|
+
function resolveReferences(input, editorDocument, options = {}) {
|
|
7917
|
+
const { fallback = "", stringifyObjects = true } = options;
|
|
7918
|
+
if (input == null) {
|
|
7919
|
+
return "";
|
|
7920
|
+
}
|
|
7921
|
+
const inputStr = String(input);
|
|
7922
|
+
const references = parseReferences(inputStr);
|
|
7923
|
+
if (references.length === 0) {
|
|
7924
|
+
return inputStr;
|
|
7925
|
+
}
|
|
7926
|
+
let result = inputStr;
|
|
7927
|
+
for (let i = references.length - 1; i >= 0; i--) {
|
|
7928
|
+
const ref = references[i];
|
|
7929
|
+
const resolvedValue = resolveSingleReference(ref.blockId, ref.propPath, editorDocument);
|
|
7930
|
+
let replacementStr;
|
|
7931
|
+
if (resolvedValue === void 0 || resolvedValue === null) {
|
|
7932
|
+
replacementStr = fallback;
|
|
7933
|
+
} else if (typeof resolvedValue === "object") {
|
|
7934
|
+
replacementStr = stringifyObjects ? JSON.stringify(resolvedValue) : fallback;
|
|
7935
|
+
} else {
|
|
7936
|
+
replacementStr = String(resolvedValue);
|
|
7937
|
+
}
|
|
7938
|
+
result = result.substring(0, ref.startIndex) + replacementStr + result.substring(ref.endIndex);
|
|
7939
|
+
}
|
|
7940
|
+
return result;
|
|
7941
|
+
}
|
|
7942
|
+
function hasReferences(input) {
|
|
7943
|
+
if (input == null) return false;
|
|
7944
|
+
return parseReferences(String(input)).length > 0;
|
|
7945
|
+
}
|
|
7946
|
+
function createReference(blockId, propPath) {
|
|
7947
|
+
return `{{${blockId}.${propPath}}}`;
|
|
7948
|
+
}
|
|
7949
|
+
|
|
7950
|
+
// src/mantine/components/DataInput/DataInput.tsx
|
|
7951
|
+
function DataInput({
|
|
7952
|
+
value,
|
|
7953
|
+
onChange,
|
|
7954
|
+
placeholder,
|
|
7955
|
+
editorDocument,
|
|
7956
|
+
currentBlockId,
|
|
7957
|
+
leftSection,
|
|
7958
|
+
disabled = false,
|
|
7959
|
+
description,
|
|
7960
|
+
label,
|
|
7961
|
+
required,
|
|
7962
|
+
size = "sm"
|
|
7963
|
+
}) {
|
|
7964
|
+
const [selectorOpened, setSelectorOpened] = useState23(false);
|
|
7965
|
+
const containsReferences = useMemo14(() => {
|
|
7966
|
+
return hasReferences(value);
|
|
7967
|
+
}, [value]);
|
|
7968
|
+
const references = useMemo14(() => {
|
|
7969
|
+
return parseReferences(value || "");
|
|
7970
|
+
}, [value]);
|
|
7971
|
+
const handleOpenSelector = useCallback16(() => {
|
|
7972
|
+
setSelectorOpened(true);
|
|
7973
|
+
}, []);
|
|
7974
|
+
const handleCloseSelector = useCallback16(() => {
|
|
7975
|
+
setSelectorOpened(false);
|
|
7976
|
+
}, []);
|
|
7977
|
+
const handleSelectProperty = useCallback16(
|
|
7978
|
+
(selection) => {
|
|
7979
|
+
const reference = createReference(selection.blockId, selection.propName);
|
|
7980
|
+
const newValue = value ? `${value}${reference}` : reference;
|
|
7981
|
+
onChange(newValue);
|
|
7982
|
+
},
|
|
7983
|
+
[value, onChange]
|
|
7984
|
+
);
|
|
7985
|
+
const handleClearReferences = useCallback16(() => {
|
|
7986
|
+
let newValue = value || "";
|
|
7987
|
+
references.forEach((ref) => {
|
|
7988
|
+
newValue = newValue.replace(ref.fullMatch, "");
|
|
7989
|
+
});
|
|
7990
|
+
onChange(newValue);
|
|
7991
|
+
}, [value, references, onChange]);
|
|
7992
|
+
return /* @__PURE__ */ React89.createElement(Input2.Wrapper, { label, description, required, size, style: { width: "100%" } }, /* @__PURE__ */ React89.createElement(
|
|
7993
|
+
Input2,
|
|
7994
|
+
{
|
|
7995
|
+
value: value || "",
|
|
7996
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
|
7997
|
+
placeholder,
|
|
7998
|
+
leftSection,
|
|
7999
|
+
disabled,
|
|
8000
|
+
size,
|
|
8001
|
+
style: { width: "100%" },
|
|
8002
|
+
rightSectionPointerEvents: "all",
|
|
8003
|
+
rightSection: /* @__PURE__ */ React89.createElement(Group24, { gap: 4, wrap: "nowrap" }, containsReferences && /* @__PURE__ */ React89.createElement(Tooltip5, { label: "Click to clear all references", position: "left" }, /* @__PURE__ */ React89.createElement(Badge11, { size: "sm", variant: "light", color: "blue", style: { cursor: "pointer" }, onClick: handleClearReferences, leftSection: /* @__PURE__ */ React89.createElement(IconX2, { size: 10 }) }, references.length, " ref", references.length !== 1 ? "s" : "")), /* @__PURE__ */ React89.createElement(
|
|
8004
|
+
BlockPropSelector,
|
|
8005
|
+
{
|
|
8006
|
+
opened: selectorOpened,
|
|
8007
|
+
onClose: handleCloseSelector,
|
|
8008
|
+
onSelect: handleSelectProperty,
|
|
8009
|
+
editorDocument,
|
|
8010
|
+
currentBlockId
|
|
8011
|
+
},
|
|
8012
|
+
/* @__PURE__ */ React89.createElement(Tooltip5, { label: "Insert reference to another block's property", position: "left" }, /* @__PURE__ */ React89.createElement(
|
|
8013
|
+
ActionIcon11,
|
|
8014
|
+
{
|
|
8015
|
+
variant: containsReferences ? "light" : "subtle",
|
|
8016
|
+
color: containsReferences ? "blue" : "gray",
|
|
8017
|
+
onClick: handleOpenSelector,
|
|
8018
|
+
disabled,
|
|
8019
|
+
size
|
|
8020
|
+
},
|
|
8021
|
+
/* @__PURE__ */ React89.createElement(IconVariable, { size: 16 })
|
|
8022
|
+
))
|
|
8023
|
+
))
|
|
8024
|
+
}
|
|
8025
|
+
));
|
|
8026
|
+
}
|
|
8027
|
+
|
|
8028
|
+
// src/mantine/blocks/apiRequest/template/GeneralTab.tsx
|
|
7436
8029
|
var GeneralTab4 = ({
|
|
7437
8030
|
title,
|
|
7438
8031
|
description,
|
|
@@ -7445,20 +8038,22 @@ var GeneralTab4 = ({
|
|
|
7445
8038
|
onEndpointChange,
|
|
7446
8039
|
onMethodChange,
|
|
7447
8040
|
onHeadersChange,
|
|
7448
|
-
onBodyChange
|
|
8041
|
+
onBodyChange,
|
|
8042
|
+
editor,
|
|
8043
|
+
blockId
|
|
7449
8044
|
}) => {
|
|
7450
|
-
const [localTitle, setLocalTitle] =
|
|
7451
|
-
const [localDescription, setLocalDescription] =
|
|
7452
|
-
const [localEndpoint, setLocalEndpoint] =
|
|
7453
|
-
const [localMethod, setLocalMethod] =
|
|
7454
|
-
const [localHeaders, setLocalHeaders] =
|
|
7455
|
-
const [localBody, setLocalBody] =
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
8045
|
+
const [localTitle, setLocalTitle] = useState24(title || "");
|
|
8046
|
+
const [localDescription, setLocalDescription] = useState24(description || "");
|
|
8047
|
+
const [localEndpoint, setLocalEndpoint] = useState24(endpoint || "");
|
|
8048
|
+
const [localMethod, setLocalMethod] = useState24(method || "GET");
|
|
8049
|
+
const [localHeaders, setLocalHeaders] = useState24(headers || []);
|
|
8050
|
+
const [localBody, setLocalBody] = useState24(body || []);
|
|
8051
|
+
useEffect16(() => setLocalTitle(title || ""), [title]);
|
|
8052
|
+
useEffect16(() => setLocalDescription(description || ""), [description]);
|
|
8053
|
+
useEffect16(() => setLocalEndpoint(endpoint || ""), [endpoint]);
|
|
8054
|
+
useEffect16(() => setLocalMethod(method || "GET"), [method]);
|
|
8055
|
+
useEffect16(() => setLocalHeaders(headers || []), [headers]);
|
|
8056
|
+
useEffect16(() => setLocalBody(body || []), [body]);
|
|
7462
8057
|
const handleAddHeader = () => {
|
|
7463
8058
|
const newHeaders = [...localHeaders, { key: "", value: "" }];
|
|
7464
8059
|
setLocalHeaders(newHeaders);
|
|
@@ -7491,7 +8086,7 @@ var GeneralTab4 = ({
|
|
|
7491
8086
|
setLocalBody(newBody);
|
|
7492
8087
|
onBodyChange(newBody);
|
|
7493
8088
|
};
|
|
7494
|
-
return /* @__PURE__ */
|
|
8089
|
+
return /* @__PURE__ */ React90.createElement(Stack68, { gap: "lg" }, /* @__PURE__ */ React90.createElement(Stack68, { gap: "xs" }, /* @__PURE__ */ React90.createElement(Text43, { size: "sm", fw: 600 }, "Title"), /* @__PURE__ */ React90.createElement(
|
|
7495
8090
|
TextInput34,
|
|
7496
8091
|
{
|
|
7497
8092
|
placeholder: "e.g. Submit User Data",
|
|
@@ -7502,7 +8097,7 @@ var GeneralTab4 = ({
|
|
|
7502
8097
|
onTitleChange(newTitle);
|
|
7503
8098
|
}
|
|
7504
8099
|
}
|
|
7505
|
-
)), /* @__PURE__ */
|
|
8100
|
+
)), /* @__PURE__ */ React90.createElement(Stack68, { gap: "xs" }, /* @__PURE__ */ React90.createElement(Text43, { size: "sm", fw: 600 }, "Description"), /* @__PURE__ */ React90.createElement(
|
|
7506
8101
|
Textarea19,
|
|
7507
8102
|
{
|
|
7508
8103
|
placeholder: "Describe what this API request does",
|
|
@@ -7514,8 +8109,8 @@ var GeneralTab4 = ({
|
|
|
7514
8109
|
onDescriptionChange(newDescription);
|
|
7515
8110
|
}
|
|
7516
8111
|
}
|
|
7517
|
-
)), /* @__PURE__ */
|
|
7518
|
-
|
|
8112
|
+
)), /* @__PURE__ */ React90.createElement(Divider5, { variant: "dashed" }), /* @__PURE__ */ React90.createElement(Stack68, { gap: "xs" }, /* @__PURE__ */ React90.createElement(Text43, { size: "sm", fw: 600 }, "HTTP Method"), /* @__PURE__ */ React90.createElement(
|
|
8113
|
+
Select11,
|
|
7519
8114
|
{
|
|
7520
8115
|
value: localMethod,
|
|
7521
8116
|
onChange: (value) => {
|
|
@@ -7531,7 +8126,7 @@ var GeneralTab4 = ({
|
|
|
7531
8126
|
{ value: "PATCH", label: "PATCH" }
|
|
7532
8127
|
]
|
|
7533
8128
|
}
|
|
7534
|
-
)), /* @__PURE__ */
|
|
8129
|
+
)), /* @__PURE__ */ React90.createElement(Stack68, { gap: "xs" }, /* @__PURE__ */ React90.createElement(Text43, { size: "sm", fw: 600 }, "Endpoint URL"), /* @__PURE__ */ React90.createElement(
|
|
7535
8130
|
TextInput34,
|
|
7536
8131
|
{
|
|
7537
8132
|
placeholder: "https://api.example.com/endpoint",
|
|
@@ -7542,45 +8137,140 @@ var GeneralTab4 = ({
|
|
|
7542
8137
|
onEndpointChange(newEndpoint);
|
|
7543
8138
|
}
|
|
7544
8139
|
}
|
|
7545
|
-
)), /* @__PURE__ */
|
|
7546
|
-
|
|
8140
|
+
)), /* @__PURE__ */ React90.createElement(Divider5, { variant: "dashed" }), /* @__PURE__ */ React90.createElement(Stack68, { gap: "xs" }, /* @__PURE__ */ React90.createElement(Group25, { justify: "space-between" }, /* @__PURE__ */ React90.createElement(Text43, { size: "sm", fw: 600 }, "Request Headers"), /* @__PURE__ */ React90.createElement(Button18, { size: "xs", variant: "light", leftSection: /* @__PURE__ */ React90.createElement(IconPlus, { size: 14 }), onClick: handleAddHeader }, "Add Header")), /* @__PURE__ */ React90.createElement(Text43, { size: "xs" }, "Add custom headers to your API request (e.g., Authorization, Content-Type)"), localHeaders.length > 0 && /* @__PURE__ */ React90.createElement(Stack68, { gap: "xs" }, localHeaders.map((header, index) => /* @__PURE__ */ React90.createElement(Paper8, { key: index, p: "xs" }, /* @__PURE__ */ React90.createElement(Group25, { gap: "xs", align: "flex-start" }, /* @__PURE__ */ React90.createElement(
|
|
8141
|
+
DataInput,
|
|
7547
8142
|
{
|
|
7548
8143
|
placeholder: "Header key (e.g., Authorization)",
|
|
7549
8144
|
value: header.key,
|
|
7550
|
-
onChange: (
|
|
7551
|
-
|
|
8145
|
+
onChange: (value) => handleHeaderChange(index, "key", value),
|
|
8146
|
+
editorDocument: editor?.document || [],
|
|
8147
|
+
currentBlockId: blockId,
|
|
8148
|
+
size: "sm"
|
|
7552
8149
|
}
|
|
7553
|
-
), /* @__PURE__ */
|
|
7554
|
-
|
|
8150
|
+
), /* @__PURE__ */ React90.createElement(
|
|
8151
|
+
DataInput,
|
|
7555
8152
|
{
|
|
7556
8153
|
placeholder: "Header value (e.g., Bearer token123)",
|
|
7557
8154
|
value: header.value,
|
|
7558
|
-
onChange: (
|
|
7559
|
-
|
|
8155
|
+
onChange: (value) => handleHeaderChange(index, "value", value),
|
|
8156
|
+
editorDocument: editor?.document || [],
|
|
8157
|
+
currentBlockId: blockId,
|
|
8158
|
+
size: "sm"
|
|
7560
8159
|
}
|
|
7561
|
-
), /* @__PURE__ */
|
|
7562
|
-
|
|
8160
|
+
), /* @__PURE__ */ React90.createElement(ActionIcon12, { color: "red", variant: "subtle", onClick: () => handleRemoveHeader(index) }, /* @__PURE__ */ React90.createElement(IconTrash, { size: 16 }))))))), /* @__PURE__ */ React90.createElement(Divider5, { variant: "dashed" }), /* @__PURE__ */ React90.createElement(Stack68, { gap: "xs" }, /* @__PURE__ */ React90.createElement(Group25, { justify: "space-between" }, /* @__PURE__ */ React90.createElement(Text43, { size: "sm", fw: 600 }, "Request Body (JSON)"), /* @__PURE__ */ React90.createElement(Button18, { size: "xs", variant: "light", leftSection: /* @__PURE__ */ React90.createElement(IconPlus, { size: 14 }), onClick: handleAddBodyField }, "Add Field")), /* @__PURE__ */ React90.createElement(Text43, { size: "xs" }, "Build your JSON request body as key-value pairs"), localBody.length > 0 && /* @__PURE__ */ React90.createElement(Stack68, { gap: "xs" }, localBody.map((field, index) => /* @__PURE__ */ React90.createElement(Paper8, { key: index, p: "xs" }, /* @__PURE__ */ React90.createElement(Group25, { gap: "xs", align: "flex-start" }, /* @__PURE__ */ React90.createElement(
|
|
8161
|
+
DataInput,
|
|
7563
8162
|
{
|
|
7564
8163
|
placeholder: "Field key (e.g., name)",
|
|
7565
8164
|
value: field.key,
|
|
7566
|
-
onChange: (
|
|
7567
|
-
|
|
8165
|
+
onChange: (value) => handleBodyFieldChange(index, "key", value),
|
|
8166
|
+
editorDocument: editor?.document || [],
|
|
8167
|
+
currentBlockId: blockId,
|
|
8168
|
+
size: "sm"
|
|
7568
8169
|
}
|
|
7569
|
-
), /* @__PURE__ */
|
|
7570
|
-
|
|
8170
|
+
), /* @__PURE__ */ React90.createElement(
|
|
8171
|
+
DataInput,
|
|
7571
8172
|
{
|
|
7572
8173
|
placeholder: "Field value (e.g., John Doe)",
|
|
7573
8174
|
value: field.value,
|
|
7574
|
-
onChange: (
|
|
7575
|
-
|
|
8175
|
+
onChange: (value) => handleBodyFieldChange(index, "value", value),
|
|
8176
|
+
editorDocument: editor?.document || [],
|
|
8177
|
+
currentBlockId: blockId,
|
|
8178
|
+
size: "sm"
|
|
8179
|
+
}
|
|
8180
|
+
), /* @__PURE__ */ React90.createElement(ActionIcon12, { color: "red", variant: "subtle", onClick: () => handleRemoveBodyField(index) }, /* @__PURE__ */ React90.createElement(IconTrash, { size: 16 }))))))));
|
|
8181
|
+
};
|
|
8182
|
+
|
|
8183
|
+
// src/mantine/blocks/apiRequest/template/ResponseSchemaTab.tsx
|
|
8184
|
+
import React91 from "react";
|
|
8185
|
+
import { Stack as Stack69, Text as Text44, Button as Button19, Group as Group26, ActionIcon as ActionIcon13, Paper as Paper9, TextInput as TextInput35, Select as Select12, Textarea as Textarea20, Alert as Alert9, Code } from "@mantine/core";
|
|
8186
|
+
import { IconTrash as IconTrash2, IconPlus as IconPlus2, IconInfoCircle } from "@tabler/icons-react";
|
|
8187
|
+
var ResponseSchemaTab = ({ schema, onSchemaChange, blockId }) => {
|
|
8188
|
+
const fields = schema?.fields || [];
|
|
8189
|
+
const handleAddField = () => {
|
|
8190
|
+
const newFields = [
|
|
8191
|
+
...fields,
|
|
8192
|
+
{
|
|
8193
|
+
path: "",
|
|
8194
|
+
displayName: "",
|
|
8195
|
+
type: "string",
|
|
8196
|
+
description: ""
|
|
8197
|
+
}
|
|
8198
|
+
];
|
|
8199
|
+
onSchemaChange({ fields: newFields });
|
|
8200
|
+
};
|
|
8201
|
+
const handleRemoveField = (index) => {
|
|
8202
|
+
const newFields = fields.filter((_, i) => i !== index);
|
|
8203
|
+
onSchemaChange({ fields: newFields });
|
|
8204
|
+
};
|
|
8205
|
+
const handleFieldChange = (index, key, value) => {
|
|
8206
|
+
const newFields = [...fields];
|
|
8207
|
+
newFields[index] = { ...newFields[index], [key]: value };
|
|
8208
|
+
onSchemaChange({ fields: newFields });
|
|
8209
|
+
};
|
|
8210
|
+
return /* @__PURE__ */ React91.createElement(Stack69, { gap: "lg" }, /* @__PURE__ */ React91.createElement(Alert9, { icon: /* @__PURE__ */ React91.createElement(IconInfoCircle, { size: 16 }), title: "Response Schema", color: "blue" }, /* @__PURE__ */ React91.createElement(Text44, { size: "xs" }, "Define the expected structure of your API response. This allows other blocks to reference specific fields from the response data using the DataInput component.")), /* @__PURE__ */ React91.createElement(Stack69, { gap: "xs" }, /* @__PURE__ */ React91.createElement(Text44, { size: "sm", fw: 600 }, "How it works"), /* @__PURE__ */ React91.createElement(Text44, { size: "xs", c: "dimmed" }, "1. Define response fields using dot notation (e.g., ", /* @__PURE__ */ React91.createElement(Code, null, "customer.email"), ")"), /* @__PURE__ */ React91.createElement(Text44, { size: "xs", c: "dimmed" }, "2. Fields become available in DataInput selectors across other blocks"), /* @__PURE__ */ React91.createElement(Text44, { size: "xs", c: "dimmed" }, "3. Reference them like: ", /* @__PURE__ */ React91.createElement(Code, null, `{{${blockId}.response.customer.email}}`))), /* @__PURE__ */ React91.createElement(Stack69, { gap: "xs" }, /* @__PURE__ */ React91.createElement(Group26, { justify: "space-between" }, /* @__PURE__ */ React91.createElement(Text44, { size: "sm", fw: 600 }, "Response Fields"), /* @__PURE__ */ React91.createElement(Button19, { size: "xs", variant: "light", leftSection: /* @__PURE__ */ React91.createElement(IconPlus2, { size: 14 }), onClick: handleAddField }, "Add Field")), fields.length === 0 ? /* @__PURE__ */ React91.createElement(Paper9, { p: "md", withBorder: true, style: { backgroundColor: "var(--mantine-color-gray-0)" } }, /* @__PURE__ */ React91.createElement(Text44, { size: "sm", c: "dimmed", ta: "center" }, 'No response fields defined yet. Click "Add Field" to start defining your response structure.')) : /* @__PURE__ */ React91.createElement(Stack69, { gap: "md" }, fields.map((field, index) => /* @__PURE__ */ React91.createElement(Paper9, { key: index, p: "md", withBorder: true }, /* @__PURE__ */ React91.createElement(Stack69, { gap: "sm" }, /* @__PURE__ */ React91.createElement(Group26, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React91.createElement(Text44, { size: "sm", fw: 500 }, "Field ", index + 1), /* @__PURE__ */ React91.createElement(ActionIcon13, { color: "red", variant: "subtle", onClick: () => handleRemoveField(index) }, /* @__PURE__ */ React91.createElement(IconTrash2, { size: 16 }))), /* @__PURE__ */ React91.createElement(
|
|
8211
|
+
TextInput35,
|
|
8212
|
+
{
|
|
8213
|
+
label: "Field Path",
|
|
8214
|
+
placeholder: "e.g., customer.email or product.id",
|
|
8215
|
+
description: "Use dot notation to specify nested fields in the API response",
|
|
8216
|
+
value: field.path,
|
|
8217
|
+
onChange: (e) => handleFieldChange(index, "path", e.currentTarget.value),
|
|
8218
|
+
required: true,
|
|
8219
|
+
size: "sm"
|
|
8220
|
+
}
|
|
8221
|
+
), /* @__PURE__ */ React91.createElement(
|
|
8222
|
+
TextInput35,
|
|
8223
|
+
{
|
|
8224
|
+
label: "Display Name",
|
|
8225
|
+
placeholder: "e.g., User Email",
|
|
8226
|
+
description: "Human-readable name shown in DataInput selector",
|
|
8227
|
+
value: field.displayName,
|
|
8228
|
+
onChange: (e) => handleFieldChange(index, "displayName", e.currentTarget.value),
|
|
8229
|
+
required: true,
|
|
8230
|
+
size: "sm"
|
|
8231
|
+
}
|
|
8232
|
+
), /* @__PURE__ */ React91.createElement(
|
|
8233
|
+
Select12,
|
|
8234
|
+
{
|
|
8235
|
+
label: "Type",
|
|
8236
|
+
description: "Expected data type of this field",
|
|
8237
|
+
value: field.type,
|
|
8238
|
+
onChange: (value) => handleFieldChange(index, "type", value || "string"),
|
|
8239
|
+
data: [
|
|
8240
|
+
{ value: "string", label: "String" },
|
|
8241
|
+
{ value: "number", label: "Number" },
|
|
8242
|
+
{ value: "boolean", label: "Boolean" },
|
|
8243
|
+
{ value: "object", label: "Object" },
|
|
8244
|
+
{ value: "array", label: "Array" }
|
|
8245
|
+
],
|
|
8246
|
+
size: "sm"
|
|
7576
8247
|
}
|
|
7577
|
-
), /* @__PURE__ */
|
|
8248
|
+
), /* @__PURE__ */ React91.createElement(
|
|
8249
|
+
Textarea20,
|
|
8250
|
+
{
|
|
8251
|
+
label: "Description (optional)",
|
|
8252
|
+
placeholder: "Describe what this field represents",
|
|
8253
|
+
value: field.description || "",
|
|
8254
|
+
onChange: (e) => handleFieldChange(index, "description", e.currentTarget.value),
|
|
8255
|
+
minRows: 2,
|
|
8256
|
+
size: "sm"
|
|
8257
|
+
}
|
|
8258
|
+
), field.path && field.displayName && /* @__PURE__ */ React91.createElement(Stack69, { gap: 4 }, /* @__PURE__ */ React91.createElement(Text44, { size: "xs", c: "dimmed" }, "Reference format:"), /* @__PURE__ */ React91.createElement(Code, { block: true, style: { fontSize: "11px" } }, `{{${blockId}.response.${field.path}}}`))))))), fields.length === 0 && /* @__PURE__ */ React91.createElement(Stack69, { gap: "xs" }, /* @__PURE__ */ React91.createElement(Text44, { size: "sm", fw: 600 }, "Example Schema"), /* @__PURE__ */ React91.createElement(Text44, { size: "xs", c: "dimmed" }, "For a typical API response like:"), /* @__PURE__ */ React91.createElement(Code, { block: true, style: { fontSize: "11px" } }, `{
|
|
8259
|
+
"customer": {
|
|
8260
|
+
"email": "user@example.com",
|
|
8261
|
+
"name": "John Doe"
|
|
8262
|
+
},
|
|
8263
|
+
"product": {
|
|
8264
|
+
"id": "l1v6r07b",
|
|
8265
|
+
"name": "Product-1"
|
|
8266
|
+
}
|
|
8267
|
+
}`), /* @__PURE__ */ React91.createElement(Text44, { size: "xs", c: "dimmed" }, "You would define fields like:"), /* @__PURE__ */ React91.createElement(Text44, { size: "xs", c: "dimmed" }, "\u2022 Path: ", /* @__PURE__ */ React91.createElement(Code, null, "customer.email"), ', Display Name: "Customer Email", Type: string'), /* @__PURE__ */ React91.createElement(Text44, { size: "xs", c: "dimmed" }, "\u2022 Path: ", /* @__PURE__ */ React91.createElement(Code, null, "customer.name"), ', Display Name: "Customer Name", Type: string'), /* @__PURE__ */ React91.createElement(Text44, { size: "xs", c: "dimmed" }, "\u2022 Path: ", /* @__PURE__ */ React91.createElement(Code, null, "product.id"), ', Display Name: "Product ID", Type: string'), /* @__PURE__ */ React91.createElement(Text44, { size: "xs", c: "dimmed" }, "\u2022 Path: ", /* @__PURE__ */ React91.createElement(Code, null, "product.name"), ', Display Name: "Product Name", Type: string')));
|
|
7578
8268
|
};
|
|
7579
8269
|
|
|
7580
8270
|
// src/mantine/blocks/apiRequest/template/TemplateConfig.tsx
|
|
7581
8271
|
var TemplateConfig4 = ({ editor, block }) => {
|
|
7582
8272
|
const { closePanel } = usePanelStore();
|
|
7583
|
-
const updateProp =
|
|
8273
|
+
const updateProp = useCallback17(
|
|
7584
8274
|
(key, value) => {
|
|
7585
8275
|
editor.updateBlock(block, {
|
|
7586
8276
|
props: {
|
|
@@ -7591,20 +8281,88 @@ var TemplateConfig4 = ({ editor, block }) => {
|
|
|
7591
8281
|
},
|
|
7592
8282
|
[editor, block]
|
|
7593
8283
|
);
|
|
7594
|
-
const handleHeadersChange =
|
|
8284
|
+
const handleHeadersChange = useCallback17(
|
|
7595
8285
|
(headers) => {
|
|
7596
8286
|
updateProp("headers", JSON.stringify(headers));
|
|
7597
8287
|
},
|
|
7598
8288
|
[updateProp]
|
|
7599
8289
|
);
|
|
7600
|
-
const handleBodyChange =
|
|
8290
|
+
const handleBodyChange = useCallback17(
|
|
7601
8291
|
(body) => {
|
|
7602
8292
|
updateProp("body", JSON.stringify(body));
|
|
7603
8293
|
},
|
|
7604
8294
|
[updateProp]
|
|
7605
8295
|
);
|
|
7606
|
-
|
|
7607
|
-
|
|
8296
|
+
const handleSchemaChange = useCallback17(
|
|
8297
|
+
(schema) => {
|
|
8298
|
+
updateProp("responseSchema", JSON.stringify(schema));
|
|
8299
|
+
},
|
|
8300
|
+
[updateProp]
|
|
8301
|
+
);
|
|
8302
|
+
const parsedResponseSchema = useMemo15(() => {
|
|
8303
|
+
return parseResponseSchema(block.props.responseSchema);
|
|
8304
|
+
}, [block.props.responseSchema]);
|
|
8305
|
+
const tabs = useMemo15(
|
|
8306
|
+
() => [
|
|
8307
|
+
{
|
|
8308
|
+
label: "General",
|
|
8309
|
+
value: "general",
|
|
8310
|
+
content: /* @__PURE__ */ React92.createElement(
|
|
8311
|
+
GeneralTab4,
|
|
8312
|
+
{
|
|
8313
|
+
title: block.props.title || "",
|
|
8314
|
+
description: block.props.description || "",
|
|
8315
|
+
endpoint: block.props.endpoint || "",
|
|
8316
|
+
method: block.props.method || "GET",
|
|
8317
|
+
headers: (() => {
|
|
8318
|
+
try {
|
|
8319
|
+
return typeof block.props.headers === "string" ? JSON.parse(block.props.headers) : block.props.headers || [];
|
|
8320
|
+
} catch {
|
|
8321
|
+
return [];
|
|
8322
|
+
}
|
|
8323
|
+
})(),
|
|
8324
|
+
body: (() => {
|
|
8325
|
+
try {
|
|
8326
|
+
return typeof block.props.body === "string" ? JSON.parse(block.props.body) : block.props.body || [];
|
|
8327
|
+
} catch {
|
|
8328
|
+
return [];
|
|
8329
|
+
}
|
|
8330
|
+
})(),
|
|
8331
|
+
onTitleChange: (value) => updateProp("title", value),
|
|
8332
|
+
onDescriptionChange: (value) => updateProp("description", value),
|
|
8333
|
+
onEndpointChange: (value) => updateProp("endpoint", value),
|
|
8334
|
+
onMethodChange: (value) => updateProp("method", value),
|
|
8335
|
+
onHeadersChange: handleHeadersChange,
|
|
8336
|
+
onBodyChange: handleBodyChange,
|
|
8337
|
+
editor,
|
|
8338
|
+
blockId: block.id
|
|
8339
|
+
}
|
|
8340
|
+
)
|
|
8341
|
+
},
|
|
8342
|
+
{
|
|
8343
|
+
label: "Response Schema",
|
|
8344
|
+
value: "response-schema",
|
|
8345
|
+
content: /* @__PURE__ */ React92.createElement(ResponseSchemaTab, { schema: parsedResponseSchema, onSchemaChange: handleSchemaChange, blockId: block.id })
|
|
8346
|
+
}
|
|
8347
|
+
],
|
|
8348
|
+
[
|
|
8349
|
+
block.props.title,
|
|
8350
|
+
block.props.description,
|
|
8351
|
+
block.props.endpoint,
|
|
8352
|
+
block.props.method,
|
|
8353
|
+
block.props.headers,
|
|
8354
|
+
block.props.body,
|
|
8355
|
+
block.id,
|
|
8356
|
+
parsedResponseSchema,
|
|
8357
|
+
updateProp,
|
|
8358
|
+
handleHeadersChange,
|
|
8359
|
+
handleBodyChange,
|
|
8360
|
+
handleSchemaChange,
|
|
8361
|
+
editor
|
|
8362
|
+
]
|
|
8363
|
+
);
|
|
8364
|
+
return /* @__PURE__ */ React92.createElement(
|
|
8365
|
+
Paper10,
|
|
7608
8366
|
{
|
|
7609
8367
|
p: "md",
|
|
7610
8368
|
shadow: "sm",
|
|
@@ -7614,7 +8372,7 @@ var TemplateConfig4 = ({ editor, block }) => {
|
|
|
7614
8372
|
flexDirection: "column"
|
|
7615
8373
|
}
|
|
7616
8374
|
},
|
|
7617
|
-
/* @__PURE__ */
|
|
8375
|
+
/* @__PURE__ */ React92.createElement(
|
|
7618
8376
|
"div",
|
|
7619
8377
|
{
|
|
7620
8378
|
style: {
|
|
@@ -7624,59 +8382,19 @@ var TemplateConfig4 = ({ editor, block }) => {
|
|
|
7624
8382
|
marginBottom: "1rem"
|
|
7625
8383
|
}
|
|
7626
8384
|
},
|
|
7627
|
-
/* @__PURE__ */
|
|
7628
|
-
/* @__PURE__ */
|
|
8385
|
+
/* @__PURE__ */ React92.createElement(Title7, { order: 3 }, "API Request Settings"),
|
|
8386
|
+
/* @__PURE__ */ React92.createElement(CloseButton6, { onClick: closePanel })
|
|
7629
8387
|
),
|
|
7630
|
-
/* @__PURE__ */
|
|
7631
|
-
ReusablePanel,
|
|
7632
|
-
{
|
|
7633
|
-
extraTabs: [
|
|
7634
|
-
{
|
|
7635
|
-
label: "General",
|
|
7636
|
-
value: "general",
|
|
7637
|
-
content: /* @__PURE__ */ React89.createElement(
|
|
7638
|
-
GeneralTab4,
|
|
7639
|
-
{
|
|
7640
|
-
title: block.props.title || "",
|
|
7641
|
-
description: block.props.description || "",
|
|
7642
|
-
endpoint: block.props.endpoint || "",
|
|
7643
|
-
method: block.props.method || "GET",
|
|
7644
|
-
headers: (() => {
|
|
7645
|
-
try {
|
|
7646
|
-
return typeof block.props.headers === "string" ? JSON.parse(block.props.headers) : block.props.headers || [];
|
|
7647
|
-
} catch {
|
|
7648
|
-
return [];
|
|
7649
|
-
}
|
|
7650
|
-
})(),
|
|
7651
|
-
body: (() => {
|
|
7652
|
-
try {
|
|
7653
|
-
return typeof block.props.body === "string" ? JSON.parse(block.props.body) : block.props.body || [];
|
|
7654
|
-
} catch {
|
|
7655
|
-
return [];
|
|
7656
|
-
}
|
|
7657
|
-
})(),
|
|
7658
|
-
onTitleChange: (value) => updateProp("title", value),
|
|
7659
|
-
onDescriptionChange: (value) => updateProp("description", value),
|
|
7660
|
-
onEndpointChange: (value) => updateProp("endpoint", value),
|
|
7661
|
-
onMethodChange: (value) => updateProp("method", value),
|
|
7662
|
-
onHeadersChange: handleHeadersChange,
|
|
7663
|
-
onBodyChange: handleBodyChange
|
|
7664
|
-
}
|
|
7665
|
-
)
|
|
7666
|
-
}
|
|
7667
|
-
],
|
|
7668
|
-
context: { editor, block }
|
|
7669
|
-
}
|
|
7670
|
-
)
|
|
8388
|
+
/* @__PURE__ */ React92.createElement(ReusablePanel, { extraTabs: tabs, context: { editor, block } })
|
|
7671
8389
|
);
|
|
7672
8390
|
};
|
|
7673
8391
|
|
|
7674
8392
|
// src/mantine/blocks/apiRequest/template/TemplateView.tsx
|
|
7675
|
-
import { Card as Card19, Group as
|
|
8393
|
+
import { Card as Card19, Group as Group27, Stack as Stack70, Text as Text45, ActionIcon as ActionIcon14, Badge as Badge12 } from "@mantine/core";
|
|
7676
8394
|
var API_REQUEST_TEMPLATE_PANEL_ID = "api-request-template-panel";
|
|
7677
8395
|
var ApiRequestTemplateView = ({ editor, block }) => {
|
|
7678
8396
|
const panelId = `${API_REQUEST_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
7679
|
-
const panelContent =
|
|
8397
|
+
const panelContent = useMemo16(() => /* @__PURE__ */ React93.createElement(TemplateConfig4, { editor, block }), [editor, block]);
|
|
7680
8398
|
const { open } = usePanel(panelId, panelContent);
|
|
7681
8399
|
const method = block.props.method || "GET";
|
|
7682
8400
|
const endpoint = block.props.endpoint || "https://api.example.com/endpoint";
|
|
@@ -7696,17 +8414,18 @@ var ApiRequestTemplateView = ({ editor, block }) => {
|
|
|
7696
8414
|
return "gray";
|
|
7697
8415
|
}
|
|
7698
8416
|
};
|
|
7699
|
-
return /* @__PURE__ */
|
|
8417
|
+
return /* @__PURE__ */ React93.createElement(Card19, { withBorder: true, padding: "md", radius: "md", style: { width: "100%", cursor: "pointer", position: "relative" }, onClick: open }, /* @__PURE__ */ React93.createElement(Badge12, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React93.createElement(Group27, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React93.createElement(Group27, { wrap: "nowrap", align: "center" }, /* @__PURE__ */ React93.createElement(ActionIcon14, { variant: "light", color: "violet", size: "lg", radius: "xl", style: { flexShrink: 0 } }, getIcon(block.props.icon, 18, 1.5, "square-check")), /* @__PURE__ */ React93.createElement(Stack70, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React93.createElement(Group27, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React93.createElement(Badge12, { size: "sm", variant: "filled", color: getMethodColor(method) }, method), /* @__PURE__ */ React93.createElement(Text45, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "API Request")), /* @__PURE__ */ React93.createElement(Text45, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 1 }, endpoint), block.props.description && /* @__PURE__ */ React93.createElement(Text45, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description)))));
|
|
7700
8418
|
};
|
|
7701
8419
|
|
|
7702
8420
|
// src/mantine/blocks/apiRequest/flow/FlowView.tsx
|
|
7703
|
-
import
|
|
7704
|
-
import { Card as Card20, Group as
|
|
7705
|
-
import { IconSend, IconChevronDown as IconChevronDown2, IconChevronUp as IconChevronUp2 } from "@tabler/icons-react";
|
|
8421
|
+
import React94, { useState as useState25 } from "react";
|
|
8422
|
+
import { Card as Card20, Group as Group28, Stack as Stack71, Text as Text46, ActionIcon as ActionIcon15, Tooltip as Tooltip6, Button as Button20, Badge as Badge13, Collapse as Collapse2, Code as Code2, Loader as Loader5, Alert as Alert10 } from "@mantine/core";
|
|
8423
|
+
import { IconSend, IconChevronDown as IconChevronDown2, IconChevronUp as IconChevronUp2, IconAlertTriangle } from "@tabler/icons-react";
|
|
7706
8424
|
var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
7707
8425
|
const disabled = isDisabled?.isDisabled === "disable";
|
|
7708
|
-
const [isLoading, setIsLoading] =
|
|
7709
|
-
const [showDetails, setShowDetails] =
|
|
8426
|
+
const [isLoading, setIsLoading] = useState25(false);
|
|
8427
|
+
const [showDetails, setShowDetails] = useState25(false);
|
|
8428
|
+
const [validationWarnings, setValidationWarnings] = useState25([]);
|
|
7710
8429
|
const method = block.props.method || "GET";
|
|
7711
8430
|
const endpoint = block.props.endpoint || "";
|
|
7712
8431
|
const headers = (() => {
|
|
@@ -7760,17 +8479,23 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
7760
8479
|
props: { ...block.props, status: "loading", response: "" }
|
|
7761
8480
|
});
|
|
7762
8481
|
try {
|
|
8482
|
+
const editorDocument = editor?.document || [];
|
|
8483
|
+
const resolvedEndpoint = resolveReferences(endpoint, editorDocument);
|
|
7763
8484
|
const headersObj = {};
|
|
7764
8485
|
headers.forEach((h) => {
|
|
7765
8486
|
if (h.key && h.value) {
|
|
7766
|
-
|
|
8487
|
+
const resolvedKey = resolveReferences(h.key, editorDocument);
|
|
8488
|
+
const resolvedValue = resolveReferences(h.value, editorDocument);
|
|
8489
|
+
headersObj[resolvedKey] = resolvedValue;
|
|
7767
8490
|
}
|
|
7768
8491
|
});
|
|
7769
8492
|
const bodyObj = {};
|
|
7770
8493
|
if (method !== "GET") {
|
|
7771
8494
|
body.forEach((b) => {
|
|
7772
8495
|
if (b.key && b.value) {
|
|
7773
|
-
|
|
8496
|
+
const resolvedKey = resolveReferences(b.key, editorDocument);
|
|
8497
|
+
const resolvedValue = resolveReferences(b.value, editorDocument);
|
|
8498
|
+
bodyObj[resolvedKey] = resolvedValue;
|
|
7774
8499
|
}
|
|
7775
8500
|
});
|
|
7776
8501
|
}
|
|
@@ -7784,21 +8509,24 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
7784
8509
|
if (method !== "GET" && Object.keys(bodyObj).length > 0) {
|
|
7785
8510
|
fetchOptions.body = JSON.stringify(bodyObj);
|
|
7786
8511
|
}
|
|
7787
|
-
const apiResponse = await fetch(
|
|
8512
|
+
const apiResponse = await fetch(resolvedEndpoint, fetchOptions);
|
|
7788
8513
|
const responseData = await apiResponse.json();
|
|
8514
|
+
const schema = parseResponseSchema(block.props.responseSchema);
|
|
8515
|
+
if (schema && schema.fields.length > 0) {
|
|
8516
|
+
const errors = validateResponseAgainstSchema(responseData, schema);
|
|
8517
|
+
if (errors.length > 0) {
|
|
8518
|
+
console.warn("Response validation warnings:", errors);
|
|
8519
|
+
setValidationWarnings(errors);
|
|
8520
|
+
setShowDetails(true);
|
|
8521
|
+
} else {
|
|
8522
|
+
setValidationWarnings([]);
|
|
8523
|
+
}
|
|
8524
|
+
}
|
|
7789
8525
|
editor.updateBlock(block, {
|
|
7790
8526
|
props: {
|
|
7791
8527
|
...block.props,
|
|
7792
8528
|
status: apiResponse.ok ? "success" : "error",
|
|
7793
|
-
response: JSON.stringify(
|
|
7794
|
-
{
|
|
7795
|
-
status: apiResponse.status,
|
|
7796
|
-
statusText: apiResponse.statusText,
|
|
7797
|
-
data: responseData
|
|
7798
|
-
},
|
|
7799
|
-
null,
|
|
7800
|
-
2
|
|
7801
|
-
)
|
|
8529
|
+
response: JSON.stringify(responseData, null, 2)
|
|
7802
8530
|
}
|
|
7803
8531
|
});
|
|
7804
8532
|
} catch (error) {
|
|
@@ -7819,21 +8547,21 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
7819
8547
|
setIsLoading(false);
|
|
7820
8548
|
}
|
|
7821
8549
|
};
|
|
7822
|
-
const executeButton = /* @__PURE__ */
|
|
7823
|
-
|
|
8550
|
+
const executeButton = /* @__PURE__ */ React94.createElement(
|
|
8551
|
+
Button20,
|
|
7824
8552
|
{
|
|
7825
8553
|
size: "sm",
|
|
7826
8554
|
variant: "light",
|
|
7827
8555
|
color: getMethodColor(method),
|
|
7828
|
-
leftSection: isLoading ? /* @__PURE__ */
|
|
8556
|
+
leftSection: isLoading ? /* @__PURE__ */ React94.createElement(Loader5, { size: 14 }) : /* @__PURE__ */ React94.createElement(IconSend, { size: 14 }),
|
|
7829
8557
|
onClick: handleExecuteRequest,
|
|
7830
8558
|
disabled: disabled || isLoading || !endpoint,
|
|
7831
8559
|
style: { flexShrink: 0 }
|
|
7832
8560
|
},
|
|
7833
8561
|
isLoading ? "Sending..." : "Execute"
|
|
7834
8562
|
);
|
|
7835
|
-
return /* @__PURE__ */
|
|
7836
|
-
|
|
8563
|
+
return /* @__PURE__ */ React94.createElement(Card20, { withBorder: true, padding: "md", radius: "md", style: { width: "100%" } }, /* @__PURE__ */ React94.createElement(Stack71, { gap: "md" }, /* @__PURE__ */ React94.createElement(Group28, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React94.createElement(Group28, { wrap: "nowrap", align: "flex-start", style: { flex: 1 } }, /* @__PURE__ */ React94.createElement(ActionIcon15, { variant: "light", color: "violet", size: "lg", radius: "xl", style: { flexShrink: 0 } }, getIcon(block.props.icon, 18, 1.5, "square-check")), /* @__PURE__ */ React94.createElement(Stack71, { gap: "xs", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React94.createElement(Group28, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React94.createElement(Badge13, { size: "sm", variant: "filled", color: getMethodColor(method) }, method), /* @__PURE__ */ React94.createElement(Text46, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "API Request"), status !== "idle" && /* @__PURE__ */ React94.createElement(Badge13, { size: "xs", variant: "dot", color: getStatusColor(status) }, status)), /* @__PURE__ */ React94.createElement(
|
|
8564
|
+
Text46,
|
|
7837
8565
|
{
|
|
7838
8566
|
size: "xs",
|
|
7839
8567
|
c: "dimmed",
|
|
@@ -7845,7 +8573,7 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
7845
8573
|
}
|
|
7846
8574
|
},
|
|
7847
8575
|
endpoint || "No endpoint configured"
|
|
7848
|
-
), block.props.description && /* @__PURE__ */
|
|
8576
|
+
), block.props.description && /* @__PURE__ */ React94.createElement(Text46, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), /* @__PURE__ */ React94.createElement(Group28, { gap: "xs", style: { flexShrink: 0 } }, disabled && isDisabled?.message ? /* @__PURE__ */ React94.createElement(Tooltip6, { label: isDisabled.message, position: "left", withArrow: true }, executeButton) : executeButton, /* @__PURE__ */ React94.createElement(ActionIcon15, { variant: "subtle", onClick: () => setShowDetails(!showDetails), disabled: headers.length === 0 && body.length === 0 && !response }, showDetails ? /* @__PURE__ */ React94.createElement(IconChevronUp2, { size: 16 }) : /* @__PURE__ */ React94.createElement(IconChevronDown2, { size: 16 })))), /* @__PURE__ */ React94.createElement(Collapse2, { in: showDetails }, /* @__PURE__ */ React94.createElement(Stack71, { gap: "md" }, validationWarnings.length > 0 && /* @__PURE__ */ React94.createElement(Alert10, { icon: /* @__PURE__ */ React94.createElement(IconAlertTriangle, { size: 16 }), title: "Schema Validation Warnings", color: "yellow" }, /* @__PURE__ */ React94.createElement(Stack71, { gap: "xs" }, /* @__PURE__ */ React94.createElement(Text46, { size: "xs" }, "The API response does not match the defined schema:"), validationWarnings.map((warning, index) => /* @__PURE__ */ React94.createElement(Text46, { key: index, size: "xs", c: "dimmed" }, "\u2022 ", warning)))), headers.length > 0 && /* @__PURE__ */ React94.createElement(Stack71, { gap: "xs" }, /* @__PURE__ */ React94.createElement(Text46, { size: "xs", fw: 600, c: "dimmed" }, "Headers:"), /* @__PURE__ */ React94.createElement(Code2, { block: true, style: { fontSize: "11px" } }, JSON.stringify(
|
|
7849
8577
|
headers.reduce(
|
|
7850
8578
|
(acc, h) => {
|
|
7851
8579
|
if (h.key && h.value) acc[h.key] = h.value;
|
|
@@ -7855,7 +8583,7 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
7855
8583
|
),
|
|
7856
8584
|
null,
|
|
7857
8585
|
2
|
|
7858
|
-
))), method !== "GET" && body.length > 0 && /* @__PURE__ */
|
|
8586
|
+
))), method !== "GET" && body.length > 0 && /* @__PURE__ */ React94.createElement(Stack71, { gap: "xs" }, /* @__PURE__ */ React94.createElement(Text46, { size: "xs", fw: 600, c: "dimmed" }, "Body:"), /* @__PURE__ */ React94.createElement(Code2, { block: true, style: { fontSize: "11px" } }, JSON.stringify(
|
|
7859
8587
|
body.reduce(
|
|
7860
8588
|
(acc, b) => {
|
|
7861
8589
|
if (b.key && b.value) acc[b.key] = b.value;
|
|
@@ -7865,7 +8593,7 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
7865
8593
|
),
|
|
7866
8594
|
null,
|
|
7867
8595
|
2
|
|
7868
|
-
))), response && /* @__PURE__ */
|
|
8596
|
+
))), response && /* @__PURE__ */ React94.createElement(Stack71, { gap: "xs" }, /* @__PURE__ */ React94.createElement(Text46, { size: "xs", fw: 600, c: "dimmed" }, "Response:"), status === "error" ? /* @__PURE__ */ React94.createElement(Alert10, { color: "red", title: "Error", styles: { message: { fontSize: "11px" } } }, /* @__PURE__ */ React94.createElement(Code2, { block: true, style: { fontSize: "11px" } }, response)) : /* @__PURE__ */ React94.createElement(Code2, { block: true, style: { fontSize: "11px", maxHeight: "300px", overflow: "auto" } }, response))))));
|
|
7869
8597
|
};
|
|
7870
8598
|
|
|
7871
8599
|
// src/mantine/blocks/apiRequest/ApiRequestBlock.tsx
|
|
@@ -7873,7 +8601,7 @@ function ApiRequestBlock({ editor, block }) {
|
|
|
7873
8601
|
const { docType } = useBlocknoteContext();
|
|
7874
8602
|
const { actions } = useBlockConditions(block, editor);
|
|
7875
8603
|
if (docType === "template") {
|
|
7876
|
-
return /* @__PURE__ */
|
|
8604
|
+
return /* @__PURE__ */ React95.createElement(ApiRequestTemplateView, { editor, block });
|
|
7877
8605
|
}
|
|
7878
8606
|
const conditionConfig = parseConditionConfig(block.props.conditions);
|
|
7879
8607
|
const hasVisibility = hasVisibilityConditions(conditionConfig);
|
|
@@ -7885,7 +8613,7 @@ function ApiRequestBlock({ editor, block }) {
|
|
|
7885
8613
|
const hasEnable = hasEnableConditions(conditionConfig);
|
|
7886
8614
|
const enableActionExists = actions.some((a) => a.action === "enable");
|
|
7887
8615
|
const shouldDisable = hasEnable && !enableActionExists;
|
|
7888
|
-
return /* @__PURE__ */
|
|
8616
|
+
return /* @__PURE__ */ React95.createElement(
|
|
7889
8617
|
ApiRequestFlowView,
|
|
7890
8618
|
{
|
|
7891
8619
|
block,
|
|
@@ -7930,6 +8658,9 @@ var ApiRequestBlockSpec = createReactBlockSpec5(
|
|
|
7930
8658
|
status: {
|
|
7931
8659
|
default: "idle"
|
|
7932
8660
|
},
|
|
8661
|
+
responseSchema: {
|
|
8662
|
+
default: ""
|
|
8663
|
+
},
|
|
7933
8664
|
conditions: {
|
|
7934
8665
|
default: ""
|
|
7935
8666
|
}
|
|
@@ -7939,37 +8670,37 @@ var ApiRequestBlockSpec = createReactBlockSpec5(
|
|
|
7939
8670
|
{
|
|
7940
8671
|
render: (props) => {
|
|
7941
8672
|
const ixoProps = props;
|
|
7942
|
-
return /* @__PURE__ */
|
|
8673
|
+
return /* @__PURE__ */ React96.createElement(ApiRequestBlock, { ...ixoProps });
|
|
7943
8674
|
}
|
|
7944
8675
|
}
|
|
7945
8676
|
);
|
|
7946
8677
|
|
|
7947
8678
|
// src/mantine/blocks/enumChecklist/EnumChecklistBlock.tsx
|
|
7948
|
-
import
|
|
8679
|
+
import React103, { useState as useState27, useEffect as useEffect17, useMemo as useMemo17, useCallback as useCallback18 } from "react";
|
|
7949
8680
|
import { createReactBlockSpec as createReactBlockSpec6 } from "@blocknote/react";
|
|
7950
|
-
import { Stack as
|
|
8681
|
+
import { Stack as Stack77, Text as Text52, Button as Button25, ActionIcon as ActionIcon16, Center as Center3, Flex as Flex19 } from "@mantine/core";
|
|
7951
8682
|
|
|
7952
8683
|
// src/mantine/blocks/enumChecklist/oracle_personalities/index.tsx
|
|
7953
|
-
import
|
|
7954
|
-
import { Box as
|
|
8684
|
+
import React97 from "react";
|
|
8685
|
+
import { Box as Box18, Flex as Flex18, Stack as Stack72, Text as Text47, Image as Image13 } from "@mantine/core";
|
|
7955
8686
|
function OraclePersonalitiesEnumList({ selectionMode, isItemChecked, onItemCheck, items }) {
|
|
7956
8687
|
if (!items || items.length === 0) {
|
|
7957
|
-
return /* @__PURE__ */
|
|
8688
|
+
return /* @__PURE__ */ React97.createElement(Text47, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No assets found");
|
|
7958
8689
|
}
|
|
7959
|
-
const rows = items.map(({ id, name, description, voice, icon }) => /* @__PURE__ */
|
|
7960
|
-
return /* @__PURE__ */
|
|
8690
|
+
const rows = items.map(({ id, name, description, voice, icon }) => /* @__PURE__ */ React97.createElement(ListItemContainer, { key: id }, /* @__PURE__ */ React97.createElement(Flex18, { align: "center", gap: "sm" }, /* @__PURE__ */ React97.createElement(Image13, { radius: 16, w: 62, h: 62, src: icon, alt: name }), /* @__PURE__ */ React97.createElement(Stack72, { gap: 0 }, /* @__PURE__ */ React97.createElement(Text47, { size: "sm", fw: 500 }, name || "-"), description !== void 0 && /* @__PURE__ */ React97.createElement(Text47, { size: "sm", c: "dimmed" }, description))), /* @__PURE__ */ React97.createElement(Flex18, { align: "center", gap: "md" }, /* @__PURE__ */ React97.createElement(Stack72, { ta: "right", gap: 0 }, /* @__PURE__ */ React97.createElement(Text47, { size: "sm", fw: 500 }, "Voice"), /* @__PURE__ */ React97.createElement(Text47, { size: "sm", c: "dimmed" }, voice)), selectionMode && /* @__PURE__ */ React97.createElement(ListItemCheckbox, { ariaLabel: `Select oracle ${name}`, checked: isItemChecked?.(id), onCheck: (checked) => onItemCheck?.(id, checked) }))));
|
|
8691
|
+
return /* @__PURE__ */ React97.createElement(Box18, { flex: 1 }, /* @__PURE__ */ React97.createElement(Stack72, null, rows));
|
|
7961
8692
|
}
|
|
7962
8693
|
|
|
7963
8694
|
// src/mantine/blocks/enumChecklist/EnumChecklistConfigModal.tsx
|
|
7964
|
-
import
|
|
7965
|
-
import { Modal, Group as
|
|
8695
|
+
import React102, { useState as useState26 } from "react";
|
|
8696
|
+
import { Modal, Group as Group32, Box as Box20 } from "@mantine/core";
|
|
7966
8697
|
|
|
7967
8698
|
// src/mantine/blocks/list/modal/ModalNavigation.tsx
|
|
7968
|
-
import
|
|
7969
|
-
import { Stack as
|
|
8699
|
+
import React98 from "react";
|
|
8700
|
+
import { Stack as Stack73, Button as Button21, Text as Text48 } from "@mantine/core";
|
|
7970
8701
|
var ModalNavigation = ({ steps, activeStep, onStepChange, showUpdateButton = false, onUpdateBlock }) => {
|
|
7971
|
-
return /* @__PURE__ */
|
|
7972
|
-
|
|
8702
|
+
return /* @__PURE__ */ React98.createElement(Stack73, { gap: "xs", style: { height: "100%" } }, /* @__PURE__ */ React98.createElement(Stack73, { gap: "xs", style: { flex: 1 } }, steps.map((step) => /* @__PURE__ */ React98.createElement(
|
|
8703
|
+
Button21,
|
|
7973
8704
|
{
|
|
7974
8705
|
key: step.id,
|
|
7975
8706
|
variant: activeStep === step.id ? "filled" : "subtle",
|
|
@@ -7986,13 +8717,13 @@ var ModalNavigation = ({ steps, activeStep, onStepChange, showUpdateButton = fal
|
|
|
7986
8717
|
}
|
|
7987
8718
|
}
|
|
7988
8719
|
},
|
|
7989
|
-
/* @__PURE__ */
|
|
7990
|
-
))), showUpdateButton && /* @__PURE__ */
|
|
8720
|
+
/* @__PURE__ */ React98.createElement(Stack73, { gap: 2, align: "flex-start" }, /* @__PURE__ */ React98.createElement(Text48, { size: "sm", fw: 500 }, step.label), /* @__PURE__ */ React98.createElement(Text48, { size: "xs", opacity: 0.7 }, step.description))
|
|
8721
|
+
))), showUpdateButton && /* @__PURE__ */ React98.createElement(Button21, { variant: "filled", color: "blue", onClick: onUpdateBlock, style: { marginTop: "auto" } }, "Update Block"));
|
|
7991
8722
|
};
|
|
7992
8723
|
|
|
7993
8724
|
// src/mantine/blocks/enumChecklist/EnumChecklistTypeSelection.tsx
|
|
7994
|
-
import
|
|
7995
|
-
import { Stack as
|
|
8725
|
+
import React99 from "react";
|
|
8726
|
+
import { Stack as Stack74, Card as Card21, Group as Group29, Text as Text49, Box as Box19, Button as Button22 } from "@mantine/core";
|
|
7996
8727
|
|
|
7997
8728
|
// src/mantine/blocks/enumChecklist/oracle_personalities/config.ts
|
|
7998
8729
|
var oraclePersonalitiesMetadata = {
|
|
@@ -8121,7 +8852,7 @@ function getEnumListItems(type) {
|
|
|
8121
8852
|
// src/mantine/blocks/enumChecklist/EnumChecklistTypeSelection.tsx
|
|
8122
8853
|
var EnumChecklistTypeSelection = ({ selectedType, onTypeSelect, onNext }) => {
|
|
8123
8854
|
const enumListsMeta = getEnumListTypesMetadata();
|
|
8124
|
-
return /* @__PURE__ */
|
|
8855
|
+
return /* @__PURE__ */ React99.createElement(Stack74, { gap: "md" }, /* @__PURE__ */ React99.createElement("div", null, /* @__PURE__ */ React99.createElement(Text49, { size: "lg", fw: 600, mb: "xs" }, "Choose List Type"), /* @__PURE__ */ React99.createElement(Text49, { size: "sm", c: "dimmed" }, "Select the type of list you want to create")), /* @__PURE__ */ React99.createElement(Stack74, { gap: "sm" }, enumListsMeta.map((enumChecklistMeta) => /* @__PURE__ */ React99.createElement(
|
|
8125
8856
|
Card21,
|
|
8126
8857
|
{
|
|
8127
8858
|
key: enumChecklistMeta.id,
|
|
@@ -8134,8 +8865,8 @@ var EnumChecklistTypeSelection = ({ selectedType, onTypeSelect, onNext }) => {
|
|
|
8134
8865
|
},
|
|
8135
8866
|
onClick: () => onTypeSelect(enumChecklistMeta.id)
|
|
8136
8867
|
},
|
|
8137
|
-
/* @__PURE__ */
|
|
8138
|
-
|
|
8868
|
+
/* @__PURE__ */ React99.createElement(Group29, { gap: "md", align: "flex-start" }, /* @__PURE__ */ React99.createElement(
|
|
8869
|
+
Box19,
|
|
8139
8870
|
{
|
|
8140
8871
|
style: {
|
|
8141
8872
|
width: 48,
|
|
@@ -8150,36 +8881,36 @@ var EnumChecklistTypeSelection = ({ selectedType, onTypeSelect, onNext }) => {
|
|
|
8150
8881
|
}
|
|
8151
8882
|
},
|
|
8152
8883
|
enumChecklistMeta.icon
|
|
8153
|
-
), /* @__PURE__ */
|
|
8154
|
-
))), /* @__PURE__ */
|
|
8884
|
+
), /* @__PURE__ */ React99.createElement(Stack74, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React99.createElement(Text49, { size: "md", fw: 600 }, enumChecklistMeta.name), /* @__PURE__ */ React99.createElement(Text49, { size: "sm", c: "dimmed" }, enumChecklistMeta.description)))
|
|
8885
|
+
))), /* @__PURE__ */ React99.createElement(Group29, { justify: "flex-end", mt: "md" }, /* @__PURE__ */ React99.createElement(Button22, { onClick: onNext, disabled: !selectedType }, "Next")));
|
|
8155
8886
|
};
|
|
8156
8887
|
|
|
8157
8888
|
// src/mantine/blocks/enumChecklist/EnumChecklistPreviewStep.tsx
|
|
8158
|
-
import
|
|
8159
|
-
import { Stack as
|
|
8889
|
+
import React100 from "react";
|
|
8890
|
+
import { Stack as Stack75, Text as Text50, Button as Button23, Group as Group30 } from "@mantine/core";
|
|
8160
8891
|
var EnumChecklistPreviewStep = ({ listType, onAddToBlock, onPrev }) => {
|
|
8161
8892
|
const renderListComponent = () => {
|
|
8162
8893
|
switch (listType) {
|
|
8163
8894
|
case "oracle_personalities":
|
|
8164
|
-
return /* @__PURE__ */
|
|
8895
|
+
return /* @__PURE__ */ React100.createElement(OraclePersonalitiesEnumList, { items: getEnumListItems(listType) });
|
|
8165
8896
|
default:
|
|
8166
8897
|
return null;
|
|
8167
8898
|
}
|
|
8168
8899
|
};
|
|
8169
|
-
return /* @__PURE__ */
|
|
8900
|
+
return /* @__PURE__ */ React100.createElement(Stack75, { gap: "md" }, /* @__PURE__ */ React100.createElement("div", null, /* @__PURE__ */ React100.createElement(Text50, { size: "lg", fw: 600, mb: "xs" }, "Preview ", getEnumListNameByType(listType)), /* @__PURE__ */ React100.createElement(Text50, { size: "sm", c: "dimmed" }, "Preview how your list will look with the current configuration")), /* @__PURE__ */ React100.createElement("div", { style: { maxHeight: "400px", overflow: "auto" } }, renderListComponent()), /* @__PURE__ */ React100.createElement(Group30, { justify: "space-between", mt: "md" }, /* @__PURE__ */ React100.createElement(Button23, { variant: "subtle", onClick: onPrev }, "Previous"), /* @__PURE__ */ React100.createElement(Button23, { onClick: onAddToBlock }, "Add to Block")));
|
|
8170
8901
|
};
|
|
8171
8902
|
|
|
8172
8903
|
// src/mantine/blocks/enumChecklist/EnumChecklistConfigurationStep.tsx
|
|
8173
|
-
import
|
|
8174
|
-
import { Stack as
|
|
8904
|
+
import React101 from "react";
|
|
8905
|
+
import { Stack as Stack76, TextInput as TextInput36, Text as Text51, Button as Button24, Group as Group31, Switch as Switch4, Select as Select13 } from "@mantine/core";
|
|
8175
8906
|
var EnumChecklistConfigurationStep = ({ enumChecklistType: listType, config, onConfigChange, onPrev, onNext, isValid }) => {
|
|
8176
8907
|
const typeConfig = ENUM_LIST_CONFIG[listType];
|
|
8177
8908
|
const configFields = getEnumListTypesConfigFields(listType);
|
|
8178
8909
|
const renderListConfigField = (field) => {
|
|
8179
8910
|
switch (field.type) {
|
|
8180
8911
|
case "text":
|
|
8181
|
-
return /* @__PURE__ */
|
|
8182
|
-
|
|
8912
|
+
return /* @__PURE__ */ React101.createElement(
|
|
8913
|
+
TextInput36,
|
|
8183
8914
|
{
|
|
8184
8915
|
label: field.label,
|
|
8185
8916
|
description: field.description,
|
|
@@ -8190,7 +8921,7 @@ var EnumChecklistConfigurationStep = ({ enumChecklistType: listType, config, onC
|
|
|
8190
8921
|
}
|
|
8191
8922
|
);
|
|
8192
8923
|
case "switch":
|
|
8193
|
-
return /* @__PURE__ */
|
|
8924
|
+
return /* @__PURE__ */ React101.createElement(
|
|
8194
8925
|
Switch4,
|
|
8195
8926
|
{
|
|
8196
8927
|
label: field.label,
|
|
@@ -8200,8 +8931,8 @@ var EnumChecklistConfigurationStep = ({ enumChecklistType: listType, config, onC
|
|
|
8200
8931
|
}
|
|
8201
8932
|
);
|
|
8202
8933
|
case "select":
|
|
8203
|
-
return /* @__PURE__ */
|
|
8204
|
-
|
|
8934
|
+
return /* @__PURE__ */ React101.createElement(
|
|
8935
|
+
Select13,
|
|
8205
8936
|
{
|
|
8206
8937
|
label: field.label,
|
|
8207
8938
|
description: field.description,
|
|
@@ -8213,8 +8944,8 @@ var EnumChecklistConfigurationStep = ({ enumChecklistType: listType, config, onC
|
|
|
8213
8944
|
}
|
|
8214
8945
|
);
|
|
8215
8946
|
default:
|
|
8216
|
-
return /* @__PURE__ */
|
|
8217
|
-
|
|
8947
|
+
return /* @__PURE__ */ React101.createElement(
|
|
8948
|
+
TextInput36,
|
|
8218
8949
|
{
|
|
8219
8950
|
label: field.label,
|
|
8220
8951
|
description: field.description,
|
|
@@ -8226,14 +8957,14 @@ var EnumChecklistConfigurationStep = ({ enumChecklistType: listType, config, onC
|
|
|
8226
8957
|
);
|
|
8227
8958
|
}
|
|
8228
8959
|
};
|
|
8229
|
-
return /* @__PURE__ */
|
|
8960
|
+
return /* @__PURE__ */ React101.createElement(Stack76, { gap: "md" }, /* @__PURE__ */ React101.createElement("div", null, /* @__PURE__ */ React101.createElement(Text51, { size: "lg", fw: 600, mb: "xs" }, "Configure ", typeConfig.metadata.name), /* @__PURE__ */ React101.createElement(Text51, { size: "sm", c: "dimmed" }, typeConfig.metadata.description)), /* @__PURE__ */ React101.createElement(Stack76, { gap: "sm" }, configFields.map((field) => /* @__PURE__ */ React101.createElement("div", { key: field.key }, renderListConfigField(field)))), /* @__PURE__ */ React101.createElement(Group31, { justify: "space-between", mt: "md" }, /* @__PURE__ */ React101.createElement(Button24, { variant: "subtle", onClick: onPrev }, "Previous"), /* @__PURE__ */ React101.createElement(Button24, { onClick: onNext, disabled: !isValid }, "Next")));
|
|
8230
8961
|
};
|
|
8231
8962
|
|
|
8232
8963
|
// src/mantine/blocks/enumChecklist/EnumChecklistConfigModal.tsx
|
|
8233
8964
|
var EnumChecklistConfigModal = ({ opened, onClose, onSave, initialConfig }) => {
|
|
8234
|
-
const [activeStep, setActiveStep] =
|
|
8235
|
-
const [selectedType, setSelectedType] =
|
|
8236
|
-
const [config, setConfig] =
|
|
8965
|
+
const [activeStep, setActiveStep] = useState26("type");
|
|
8966
|
+
const [selectedType, setSelectedType] = useState26(initialConfig?.listType || null);
|
|
8967
|
+
const [config, setConfig] = useState26(initialConfig?.listConfig || {});
|
|
8237
8968
|
const handleTypeSelect = (type) => {
|
|
8238
8969
|
setSelectedType(type);
|
|
8239
8970
|
const configFieldsByType = getEnumListTypesConfigFields(type);
|
|
@@ -8288,9 +9019,9 @@ var EnumChecklistConfigModal = ({ opened, onClose, onSave, initialConfig }) => {
|
|
|
8288
9019
|
const renderStepContent = () => {
|
|
8289
9020
|
switch (activeStep) {
|
|
8290
9021
|
case "type":
|
|
8291
|
-
return /* @__PURE__ */
|
|
9022
|
+
return /* @__PURE__ */ React102.createElement(EnumChecklistTypeSelection, { selectedType, onTypeSelect: handleTypeSelect, onNext: () => setActiveStep("configure") });
|
|
8292
9023
|
case "configure":
|
|
8293
|
-
return selectedType ? /* @__PURE__ */
|
|
9024
|
+
return selectedType ? /* @__PURE__ */ React102.createElement(
|
|
8294
9025
|
EnumChecklistConfigurationStep,
|
|
8295
9026
|
{
|
|
8296
9027
|
enumChecklistType: selectedType,
|
|
@@ -8302,22 +9033,22 @@ var EnumChecklistConfigModal = ({ opened, onClose, onSave, initialConfig }) => {
|
|
|
8302
9033
|
}
|
|
8303
9034
|
) : null;
|
|
8304
9035
|
case "preview":
|
|
8305
|
-
return selectedType ? /* @__PURE__ */
|
|
9036
|
+
return selectedType ? /* @__PURE__ */ React102.createElement(EnumChecklistPreviewStep, { listType: selectedType, onAddToBlock: handleAddToBlock, onPrev: () => setActiveStep("configure") }) : null;
|
|
8306
9037
|
default:
|
|
8307
9038
|
return null;
|
|
8308
9039
|
}
|
|
8309
9040
|
};
|
|
8310
|
-
return /* @__PURE__ */
|
|
9041
|
+
return /* @__PURE__ */ React102.createElement(Modal, { opened, onClose: handleClose, title: "Configure Enum Checklist Block", size: "xl" }, /* @__PURE__ */ React102.createElement(Group32, { align: "flex-start", gap: "lg", style: { minHeight: "400px" } }, /* @__PURE__ */ React102.createElement(Box20, { style: { width: "200px", flexShrink: 0, height: "400px", display: "flex" } }, /* @__PURE__ */ React102.createElement(ModalNavigation, { steps, activeStep, onStepChange: setActiveStep, showUpdateButton: selectedType !== null, onUpdateBlock: handleAddToBlock })), /* @__PURE__ */ React102.createElement(Box20, { style: { flex: 1 } }, renderStepContent())));
|
|
8311
9042
|
};
|
|
8312
9043
|
|
|
8313
9044
|
// src/mantine/blocks/enumChecklist/EnumChecklistBlock.tsx
|
|
8314
|
-
var IconSettings2 = () => /* @__PURE__ */
|
|
9045
|
+
var IconSettings2 = () => /* @__PURE__ */ React103.createElement("span", null, "\u2699\uFE0F");
|
|
8315
9046
|
var EnumChecklistBlockType = "enumChecklist";
|
|
8316
9047
|
var EnumChecklistBlockContent = ({ block, editor }) => {
|
|
8317
|
-
const [modalOpened, setModalOpened] =
|
|
9048
|
+
const [modalOpened, setModalOpened] = useState27(false);
|
|
8318
9049
|
const { editable } = useBlocknoteContext();
|
|
8319
9050
|
const listType = block.props.listType && block.props.listType !== "" ? block.props.listType : null;
|
|
8320
|
-
const listConfig =
|
|
9051
|
+
const listConfig = useMemo17(() => {
|
|
8321
9052
|
if (block.props.listConfig && block.props.listConfig !== "{}") {
|
|
8322
9053
|
try {
|
|
8323
9054
|
return JSON.parse(block.props.listConfig);
|
|
@@ -8328,7 +9059,7 @@ var EnumChecklistBlockContent = ({ block, editor }) => {
|
|
|
8328
9059
|
}
|
|
8329
9060
|
return {};
|
|
8330
9061
|
}, [block.props.listConfig]);
|
|
8331
|
-
const selectedIds =
|
|
9062
|
+
const selectedIds = useMemo17(() => {
|
|
8332
9063
|
if (block.props.selectedIds && block.props.selectedIds !== "[]") {
|
|
8333
9064
|
try {
|
|
8334
9065
|
return new Set(JSON.parse(block.props.selectedIds));
|
|
@@ -8339,7 +9070,7 @@ var EnumChecklistBlockContent = ({ block, editor }) => {
|
|
|
8339
9070
|
}
|
|
8340
9071
|
return /* @__PURE__ */ new Set();
|
|
8341
9072
|
}, [block.props.selectedIds]);
|
|
8342
|
-
|
|
9073
|
+
useEffect17(() => {
|
|
8343
9074
|
if (listConfig?.selection_mode === "single" && selectedIds.size > 1) {
|
|
8344
9075
|
const arr = Array.from(selectedIds);
|
|
8345
9076
|
const lastSelected = arr.length > 0 ? arr[arr.length - 1] : void 0;
|
|
@@ -8348,13 +9079,13 @@ var EnumChecklistBlockContent = ({ block, editor }) => {
|
|
|
8348
9079
|
});
|
|
8349
9080
|
}
|
|
8350
9081
|
}, [listConfig?.selection_mode, selectedIds]);
|
|
8351
|
-
const isItemChecked =
|
|
9082
|
+
const isItemChecked = useCallback18(
|
|
8352
9083
|
(id) => {
|
|
8353
9084
|
return selectedIds.has(id);
|
|
8354
9085
|
},
|
|
8355
9086
|
[selectedIds]
|
|
8356
9087
|
);
|
|
8357
|
-
const onItemCheck =
|
|
9088
|
+
const onItemCheck = useCallback18(
|
|
8358
9089
|
(id, checked) => {
|
|
8359
9090
|
const currentSelectedIds = Array.from(selectedIds);
|
|
8360
9091
|
let newSelectedIds;
|
|
@@ -8397,7 +9128,7 @@ var EnumChecklistBlockContent = ({ block, editor }) => {
|
|
|
8397
9128
|
if (!listType) return null;
|
|
8398
9129
|
switch (listType) {
|
|
8399
9130
|
case "oracle_personalities":
|
|
8400
|
-
return /* @__PURE__ */
|
|
9131
|
+
return /* @__PURE__ */ React103.createElement(
|
|
8401
9132
|
OraclePersonalitiesEnumList,
|
|
8402
9133
|
{
|
|
8403
9134
|
items: getEnumListItems(listType),
|
|
@@ -8410,7 +9141,7 @@ var EnumChecklistBlockContent = ({ block, editor }) => {
|
|
|
8410
9141
|
return null;
|
|
8411
9142
|
}
|
|
8412
9143
|
};
|
|
8413
|
-
return /* @__PURE__ */
|
|
9144
|
+
return /* @__PURE__ */ React103.createElement(Stack77, { w: "100%" }, listType && /* @__PURE__ */ React103.createElement(Flex19, { align: "center", justify: "space-between", gap: "xs" }, /* @__PURE__ */ React103.createElement(Text52, null, getEnumListNameByType(listType)), listConfig.listSelectionMode && /* @__PURE__ */ React103.createElement(Text52, { lh: 0.5, c: "dimmed" }, listConfig?.selection_mode === "single" ? "Single Selection" : "Multi Selection"), editable && /* @__PURE__ */ React103.createElement(Flex19, { justify: listType ? "space-between" : "flex-end" }, /* @__PURE__ */ React103.createElement(Flex19, { gap: "xs" }, /* @__PURE__ */ React103.createElement(ActionIcon16, { variant: "subtle", size: "sm", onClick: () => setModalOpened(true) }, /* @__PURE__ */ React103.createElement(IconSettings2, null))))), /* @__PURE__ */ React103.createElement(Flex19, { flex: 1 }, !listType ? /* @__PURE__ */ React103.createElement(Center3, { py: "xl" }, /* @__PURE__ */ React103.createElement(Stack77, { align: "center", gap: "sm" }, /* @__PURE__ */ React103.createElement(Text52, { size: "sm", c: "dimmed", ta: "center" }, "No list type configured"), /* @__PURE__ */ React103.createElement(Button25, { size: "sm", variant: "light", onClick: () => setModalOpened(true) }, "Configure List"))) : /* @__PURE__ */ React103.createElement(Stack77, { gap: "md", flex: 1 }, renderListComponent())), /* @__PURE__ */ React103.createElement(
|
|
8414
9145
|
EnumChecklistConfigModal,
|
|
8415
9146
|
{
|
|
8416
9147
|
opened: modalOpened,
|
|
@@ -8442,28 +9173,28 @@ var EnumChecklistBlock = createReactBlockSpec6(
|
|
|
8442
9173
|
content: "none"
|
|
8443
9174
|
},
|
|
8444
9175
|
{
|
|
8445
|
-
render: (props) => /* @__PURE__ */
|
|
9176
|
+
render: (props) => /* @__PURE__ */ React103.createElement(EnumChecklistBlockContent, { ...props })
|
|
8446
9177
|
}
|
|
8447
9178
|
);
|
|
8448
9179
|
|
|
8449
9180
|
// src/mantine/blocks/notify/NotifyBlockSpec.tsx
|
|
8450
|
-
import
|
|
9181
|
+
import React109 from "react";
|
|
8451
9182
|
import { createReactBlockSpec as createReactBlockSpec7 } from "@blocknote/react";
|
|
8452
9183
|
|
|
8453
9184
|
// src/mantine/blocks/notify/NotifyBlock.tsx
|
|
8454
|
-
import
|
|
9185
|
+
import React108 from "react";
|
|
8455
9186
|
|
|
8456
9187
|
// src/mantine/blocks/notify/template/TemplateView.tsx
|
|
8457
|
-
import
|
|
9188
|
+
import React106, { useMemo as useMemo18 } from "react";
|
|
8458
9189
|
|
|
8459
9190
|
// src/mantine/blocks/notify/template/TemplateConfig.tsx
|
|
8460
|
-
import
|
|
8461
|
-
import { Paper as
|
|
9191
|
+
import React105, { useCallback as useCallback19 } from "react";
|
|
9192
|
+
import { Paper as Paper12, CloseButton as CloseButton7, Title as Title8 } from "@mantine/core";
|
|
8462
9193
|
|
|
8463
9194
|
// src/mantine/blocks/notify/template/GeneralTab.tsx
|
|
8464
|
-
import
|
|
8465
|
-
import { Divider as Divider6, Select as
|
|
8466
|
-
import { IconTrash as
|
|
9195
|
+
import React104, { useEffect as useEffect18, useState as useState28 } from "react";
|
|
9196
|
+
import { Divider as Divider6, Select as Select14, Stack as Stack78, Text as Text53, TextInput as TextInput37, Textarea as Textarea21, Button as Button26, Group as Group33, ActionIcon as ActionIcon17, Paper as Paper11 } from "@mantine/core";
|
|
9197
|
+
import { IconTrash as IconTrash3, IconPlus as IconPlus3 } from "@tabler/icons-react";
|
|
8467
9198
|
var GeneralTab5 = ({
|
|
8468
9199
|
title,
|
|
8469
9200
|
description,
|
|
@@ -8486,30 +9217,32 @@ var GeneralTab5 = ({
|
|
|
8486
9217
|
onBodyChange,
|
|
8487
9218
|
onBodyTypeChange,
|
|
8488
9219
|
onFromChange,
|
|
8489
|
-
onReplyToChange
|
|
9220
|
+
onReplyToChange,
|
|
9221
|
+
editor,
|
|
9222
|
+
blockId
|
|
8490
9223
|
}) => {
|
|
8491
|
-
const [localTitle, setLocalTitle] =
|
|
8492
|
-
const [localDescription, setLocalDescription] =
|
|
8493
|
-
const [localChannel, setLocalChannel] =
|
|
8494
|
-
const [localTo, setLocalTo] =
|
|
8495
|
-
const [localCc, setLocalCc] =
|
|
8496
|
-
const [localBcc, setLocalBcc] =
|
|
8497
|
-
const [localSubject, setLocalSubject] =
|
|
8498
|
-
const [localBody, setLocalBody] =
|
|
8499
|
-
const [localBodyType, setLocalBodyType] =
|
|
8500
|
-
const [localFrom, setLocalFrom] =
|
|
8501
|
-
const [localReplyTo, setLocalReplyTo] =
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
9224
|
+
const [localTitle, setLocalTitle] = useState28(title || "");
|
|
9225
|
+
const [localDescription, setLocalDescription] = useState28(description || "");
|
|
9226
|
+
const [localChannel, setLocalChannel] = useState28(channel || "email");
|
|
9227
|
+
const [localTo, setLocalTo] = useState28(to || []);
|
|
9228
|
+
const [localCc, setLocalCc] = useState28(cc || []);
|
|
9229
|
+
const [localBcc, setLocalBcc] = useState28(bcc || []);
|
|
9230
|
+
const [localSubject, setLocalSubject] = useState28(subject || "");
|
|
9231
|
+
const [localBody, setLocalBody] = useState28(body || "");
|
|
9232
|
+
const [localBodyType, setLocalBodyType] = useState28(bodyType || "text");
|
|
9233
|
+
const [localFrom, setLocalFrom] = useState28(from || "");
|
|
9234
|
+
const [localReplyTo, setLocalReplyTo] = useState28(replyTo || "");
|
|
9235
|
+
useEffect18(() => setLocalTitle(title || ""), [title]);
|
|
9236
|
+
useEffect18(() => setLocalDescription(description || ""), [description]);
|
|
9237
|
+
useEffect18(() => setLocalChannel(channel || "email"), [channel]);
|
|
9238
|
+
useEffect18(() => setLocalTo(to || []), [to]);
|
|
9239
|
+
useEffect18(() => setLocalCc(cc || []), [cc]);
|
|
9240
|
+
useEffect18(() => setLocalBcc(bcc || []), [bcc]);
|
|
9241
|
+
useEffect18(() => setLocalSubject(subject || ""), [subject]);
|
|
9242
|
+
useEffect18(() => setLocalBody(body || ""), [body]);
|
|
9243
|
+
useEffect18(() => setLocalBodyType(bodyType || "text"), [bodyType]);
|
|
9244
|
+
useEffect18(() => setLocalFrom(from || ""), [from]);
|
|
9245
|
+
useEffect18(() => setLocalReplyTo(replyTo || ""), [replyTo]);
|
|
8513
9246
|
const handleAddRecipient = (type) => {
|
|
8514
9247
|
const setter = type === "to" ? setLocalTo : type === "cc" ? setLocalCc : setLocalBcc;
|
|
8515
9248
|
const callback = type === "to" ? onToChange : type === "cc" ? onCcChange : onBccChange;
|
|
@@ -8535,8 +9268,8 @@ var GeneralTab5 = ({
|
|
|
8535
9268
|
setter(newRecipients);
|
|
8536
9269
|
callback(newRecipients);
|
|
8537
9270
|
};
|
|
8538
|
-
return /* @__PURE__ */
|
|
8539
|
-
|
|
9271
|
+
return /* @__PURE__ */ React104.createElement(Stack78, { gap: "lg" }, /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, /* @__PURE__ */ React104.createElement(Text53, { size: "sm", fw: 600 }, "Title"), /* @__PURE__ */ React104.createElement(
|
|
9272
|
+
TextInput37,
|
|
8540
9273
|
{
|
|
8541
9274
|
placeholder: "e.g. Welcome Email",
|
|
8542
9275
|
value: localTitle,
|
|
@@ -8546,8 +9279,8 @@ var GeneralTab5 = ({
|
|
|
8546
9279
|
onTitleChange(newTitle);
|
|
8547
9280
|
}
|
|
8548
9281
|
}
|
|
8549
|
-
)), /* @__PURE__ */
|
|
8550
|
-
|
|
9282
|
+
)), /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, /* @__PURE__ */ React104.createElement(Text53, { size: "sm", fw: 600 }, "Description"), /* @__PURE__ */ React104.createElement(
|
|
9283
|
+
Textarea21,
|
|
8551
9284
|
{
|
|
8552
9285
|
placeholder: "Describe what this notification does",
|
|
8553
9286
|
minRows: 2,
|
|
@@ -8558,8 +9291,8 @@ var GeneralTab5 = ({
|
|
|
8558
9291
|
onDescriptionChange(newDescription);
|
|
8559
9292
|
}
|
|
8560
9293
|
}
|
|
8561
|
-
)), /* @__PURE__ */
|
|
8562
|
-
|
|
9294
|
+
)), /* @__PURE__ */ React104.createElement(Divider6, { variant: "dashed" }), /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, /* @__PURE__ */ React104.createElement(Text53, { size: "sm", fw: 600 }, "Channel"), /* @__PURE__ */ React104.createElement(
|
|
9295
|
+
Select14,
|
|
8563
9296
|
{
|
|
8564
9297
|
value: localChannel,
|
|
8565
9298
|
onChange: (value) => {
|
|
@@ -8574,24 +9307,38 @@ var GeneralTab5 = ({
|
|
|
8574
9307
|
{ value: "rcs", label: "RCS (Coming Soon)", disabled: true }
|
|
8575
9308
|
]
|
|
8576
9309
|
}
|
|
8577
|
-
)), /* @__PURE__ */
|
|
8578
|
-
|
|
9310
|
+
)), /* @__PURE__ */ React104.createElement(Divider6, { variant: "dashed" }), localChannel === "email" && /* @__PURE__ */ React104.createElement(React104.Fragment, null, /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, /* @__PURE__ */ React104.createElement(Group33, { justify: "space-between" }, /* @__PURE__ */ React104.createElement(Text53, { size: "sm", fw: 600 }, "To (Recipients)"), /* @__PURE__ */ React104.createElement(Button26, { size: "xs", leftSection: /* @__PURE__ */ React104.createElement(IconPlus3, { size: 14 }), onClick: () => handleAddRecipient("to") }, "Add")), localTo.length === 0 && /* @__PURE__ */ React104.createElement(Text53, { size: "xs", c: "dimmed" }, "No recipients added yet"), /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, localTo.map((recipient, index) => /* @__PURE__ */ React104.createElement(Paper11, { key: index, p: "xs", withBorder: true }, /* @__PURE__ */ React104.createElement(Group33, { gap: "xs", wrap: "nowrap", align: "flex-start" }, /* @__PURE__ */ React104.createElement(
|
|
9311
|
+
DataInput,
|
|
8579
9312
|
{
|
|
8580
|
-
|
|
8581
|
-
placeholder: "email@example.com",
|
|
9313
|
+
placeholder: "email@example.com or reference",
|
|
8582
9314
|
value: recipient,
|
|
8583
|
-
onChange: (
|
|
9315
|
+
onChange: (value) => handleRecipientChange("to", index, value),
|
|
9316
|
+
editorDocument: editor?.document || [],
|
|
9317
|
+
currentBlockId: blockId,
|
|
9318
|
+
size: "sm"
|
|
8584
9319
|
}
|
|
8585
|
-
), /* @__PURE__ */
|
|
8586
|
-
|
|
9320
|
+
), /* @__PURE__ */ React104.createElement(ActionIcon17, { color: "red", variant: "light", onClick: () => handleRemoveRecipient("to", index) }, /* @__PURE__ */ React104.createElement(IconTrash3, { size: 16 }))))))), /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, /* @__PURE__ */ React104.createElement(Group33, { justify: "space-between" }, /* @__PURE__ */ React104.createElement(Text53, { size: "sm", fw: 600 }, "CC (Optional)"), /* @__PURE__ */ React104.createElement(Button26, { size: "xs", leftSection: /* @__PURE__ */ React104.createElement(IconPlus3, { size: 14 }), onClick: () => handleAddRecipient("cc") }, "Add")), localCc.length > 0 && /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, localCc.map((recipient, index) => /* @__PURE__ */ React104.createElement(Paper11, { key: index, p: "xs", withBorder: true }, /* @__PURE__ */ React104.createElement(Group33, { gap: "xs", wrap: "nowrap", align: "flex-start" }, /* @__PURE__ */ React104.createElement(
|
|
9321
|
+
DataInput,
|
|
8587
9322
|
{
|
|
8588
|
-
|
|
8589
|
-
placeholder: "email@example.com",
|
|
9323
|
+
placeholder: "email@example.com or reference",
|
|
8590
9324
|
value: recipient,
|
|
8591
|
-
onChange: (
|
|
9325
|
+
onChange: (value) => handleRecipientChange("cc", index, value),
|
|
9326
|
+
editorDocument: editor?.document || [],
|
|
9327
|
+
currentBlockId: blockId,
|
|
9328
|
+
size: "sm"
|
|
8592
9329
|
}
|
|
8593
|
-
), /* @__PURE__ */
|
|
8594
|
-
|
|
9330
|
+
), /* @__PURE__ */ React104.createElement(ActionIcon17, { color: "red", variant: "light", onClick: () => handleRemoveRecipient("cc", index) }, /* @__PURE__ */ React104.createElement(IconTrash3, { size: 16 }))))))), /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, /* @__PURE__ */ React104.createElement(Group33, { justify: "space-between" }, /* @__PURE__ */ React104.createElement(Text53, { size: "sm", fw: 600 }, "BCC (Optional)"), /* @__PURE__ */ React104.createElement(Button26, { size: "xs", leftSection: /* @__PURE__ */ React104.createElement(IconPlus3, { size: 14 }), onClick: () => handleAddRecipient("bcc") }, "Add")), localBcc.length > 0 && /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, localBcc.map((recipient, index) => /* @__PURE__ */ React104.createElement(Paper11, { key: index, p: "xs", withBorder: true }, /* @__PURE__ */ React104.createElement(Group33, { gap: "xs", wrap: "nowrap", align: "flex-start" }, /* @__PURE__ */ React104.createElement(
|
|
9331
|
+
DataInput,
|
|
9332
|
+
{
|
|
9333
|
+
placeholder: "email@example.com or reference",
|
|
9334
|
+
value: recipient,
|
|
9335
|
+
onChange: (value) => handleRecipientChange("bcc", index, value),
|
|
9336
|
+
editorDocument: editor?.document || [],
|
|
9337
|
+
currentBlockId: blockId,
|
|
9338
|
+
size: "sm"
|
|
9339
|
+
}
|
|
9340
|
+
), /* @__PURE__ */ React104.createElement(ActionIcon17, { color: "red", variant: "light", onClick: () => handleRemoveRecipient("bcc", index) }, /* @__PURE__ */ React104.createElement(IconTrash3, { size: 16 }))))))), /* @__PURE__ */ React104.createElement(Divider6, { variant: "dashed" }), /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, /* @__PURE__ */ React104.createElement(Text53, { size: "sm", fw: 600 }, "From (Optional)"), /* @__PURE__ */ React104.createElement(
|
|
9341
|
+
TextInput37,
|
|
8595
9342
|
{
|
|
8596
9343
|
placeholder: "sender@example.com",
|
|
8597
9344
|
value: localFrom,
|
|
@@ -8601,8 +9348,8 @@ var GeneralTab5 = ({
|
|
|
8601
9348
|
onFromChange(newFrom);
|
|
8602
9349
|
}
|
|
8603
9350
|
}
|
|
8604
|
-
), /* @__PURE__ */
|
|
8605
|
-
|
|
9351
|
+
), /* @__PURE__ */ React104.createElement(Text53, { size: "xs", c: "dimmed" }, "Custom sender email address")), /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, /* @__PURE__ */ React104.createElement(Text53, { size: "sm", fw: 600 }, "Reply-To (Optional)"), /* @__PURE__ */ React104.createElement(
|
|
9352
|
+
TextInput37,
|
|
8606
9353
|
{
|
|
8607
9354
|
placeholder: "reply@example.com",
|
|
8608
9355
|
value: localReplyTo,
|
|
@@ -8612,8 +9359,8 @@ var GeneralTab5 = ({
|
|
|
8612
9359
|
onReplyToChange(newReplyTo);
|
|
8613
9360
|
}
|
|
8614
9361
|
}
|
|
8615
|
-
), /* @__PURE__ */
|
|
8616
|
-
|
|
9362
|
+
), /* @__PURE__ */ React104.createElement(Text53, { size: "xs", c: "dimmed" }, "Where replies should be sent")), /* @__PURE__ */ React104.createElement(Divider6, { variant: "dashed" }), /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, /* @__PURE__ */ React104.createElement(Text53, { size: "sm", fw: 600 }, "Subject"), /* @__PURE__ */ React104.createElement(
|
|
9363
|
+
TextInput37,
|
|
8617
9364
|
{
|
|
8618
9365
|
placeholder: "Email subject line",
|
|
8619
9366
|
value: localSubject,
|
|
@@ -8623,8 +9370,8 @@ var GeneralTab5 = ({
|
|
|
8623
9370
|
onSubjectChange(newSubject);
|
|
8624
9371
|
}
|
|
8625
9372
|
}
|
|
8626
|
-
)), /* @__PURE__ */
|
|
8627
|
-
|
|
9373
|
+
)), /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, /* @__PURE__ */ React104.createElement(Text53, { size: "sm", fw: 600 }, "Body Type"), /* @__PURE__ */ React104.createElement(
|
|
9374
|
+
Select14,
|
|
8628
9375
|
{
|
|
8629
9376
|
value: localBodyType,
|
|
8630
9377
|
onChange: (value) => {
|
|
@@ -8637,8 +9384,8 @@ var GeneralTab5 = ({
|
|
|
8637
9384
|
{ value: "html", label: "HTML" }
|
|
8638
9385
|
]
|
|
8639
9386
|
}
|
|
8640
|
-
)), /* @__PURE__ */
|
|
8641
|
-
|
|
9387
|
+
)), /* @__PURE__ */ React104.createElement(Stack78, { gap: "xs" }, /* @__PURE__ */ React104.createElement(Text53, { size: "sm", fw: 600 }, "Body"), /* @__PURE__ */ React104.createElement(
|
|
9388
|
+
Textarea21,
|
|
8642
9389
|
{
|
|
8643
9390
|
placeholder: localBodyType === "html" ? "<h1>Hello!</h1><p>Welcome to our service.</p>" : "Email body content",
|
|
8644
9391
|
minRows: 6,
|
|
@@ -8649,13 +9396,13 @@ var GeneralTab5 = ({
|
|
|
8649
9396
|
onBodyChange(newBody);
|
|
8650
9397
|
}
|
|
8651
9398
|
}
|
|
8652
|
-
), /* @__PURE__ */
|
|
9399
|
+
), /* @__PURE__ */ React104.createElement(Text53, { size: "xs", c: "dimmed" }, localBodyType === "html" ? "HTML content for the email body" : "Plain text content for the email body"))));
|
|
8653
9400
|
};
|
|
8654
9401
|
|
|
8655
9402
|
// src/mantine/blocks/notify/template/TemplateConfig.tsx
|
|
8656
9403
|
var TemplateConfig5 = ({ editor, block }) => {
|
|
8657
9404
|
const { closePanel } = usePanelStore();
|
|
8658
|
-
const updateProp =
|
|
9405
|
+
const updateProp = useCallback19(
|
|
8659
9406
|
(key, value) => {
|
|
8660
9407
|
editor.updateBlock(block, {
|
|
8661
9408
|
props: {
|
|
@@ -8666,26 +9413,26 @@ var TemplateConfig5 = ({ editor, block }) => {
|
|
|
8666
9413
|
},
|
|
8667
9414
|
[editor, block]
|
|
8668
9415
|
);
|
|
8669
|
-
const handleToChange =
|
|
9416
|
+
const handleToChange = useCallback19(
|
|
8670
9417
|
(to) => {
|
|
8671
9418
|
updateProp("to", JSON.stringify(to));
|
|
8672
9419
|
},
|
|
8673
9420
|
[updateProp]
|
|
8674
9421
|
);
|
|
8675
|
-
const handleCcChange =
|
|
9422
|
+
const handleCcChange = useCallback19(
|
|
8676
9423
|
(cc) => {
|
|
8677
9424
|
updateProp("cc", JSON.stringify(cc));
|
|
8678
9425
|
},
|
|
8679
9426
|
[updateProp]
|
|
8680
9427
|
);
|
|
8681
|
-
const handleBccChange =
|
|
9428
|
+
const handleBccChange = useCallback19(
|
|
8682
9429
|
(bcc) => {
|
|
8683
9430
|
updateProp("bcc", JSON.stringify(bcc));
|
|
8684
9431
|
},
|
|
8685
9432
|
[updateProp]
|
|
8686
9433
|
);
|
|
8687
|
-
return /* @__PURE__ */
|
|
8688
|
-
|
|
9434
|
+
return /* @__PURE__ */ React105.createElement(
|
|
9435
|
+
Paper12,
|
|
8689
9436
|
{
|
|
8690
9437
|
p: "md",
|
|
8691
9438
|
shadow: "sm",
|
|
@@ -8695,7 +9442,7 @@ var TemplateConfig5 = ({ editor, block }) => {
|
|
|
8695
9442
|
flexDirection: "column"
|
|
8696
9443
|
}
|
|
8697
9444
|
},
|
|
8698
|
-
/* @__PURE__ */
|
|
9445
|
+
/* @__PURE__ */ React105.createElement(
|
|
8699
9446
|
"div",
|
|
8700
9447
|
{
|
|
8701
9448
|
style: {
|
|
@@ -8705,17 +9452,17 @@ var TemplateConfig5 = ({ editor, block }) => {
|
|
|
8705
9452
|
marginBottom: "1rem"
|
|
8706
9453
|
}
|
|
8707
9454
|
},
|
|
8708
|
-
/* @__PURE__ */
|
|
8709
|
-
/* @__PURE__ */
|
|
9455
|
+
/* @__PURE__ */ React105.createElement(Title8, { order: 3 }, "Notification Settings"),
|
|
9456
|
+
/* @__PURE__ */ React105.createElement(CloseButton7, { onClick: closePanel })
|
|
8710
9457
|
),
|
|
8711
|
-
/* @__PURE__ */
|
|
9458
|
+
/* @__PURE__ */ React105.createElement(
|
|
8712
9459
|
ReusablePanel,
|
|
8713
9460
|
{
|
|
8714
9461
|
extraTabs: [
|
|
8715
9462
|
{
|
|
8716
9463
|
label: "General",
|
|
8717
9464
|
value: "general",
|
|
8718
|
-
content: /* @__PURE__ */
|
|
9465
|
+
content: /* @__PURE__ */ React105.createElement(
|
|
8719
9466
|
GeneralTab5,
|
|
8720
9467
|
{
|
|
8721
9468
|
title: block.props.title || "",
|
|
@@ -8757,7 +9504,9 @@ var TemplateConfig5 = ({ editor, block }) => {
|
|
|
8757
9504
|
onBodyChange: (value) => updateProp("body", value),
|
|
8758
9505
|
onBodyTypeChange: (value) => updateProp("bodyType", value),
|
|
8759
9506
|
onFromChange: (value) => updateProp("from", value),
|
|
8760
|
-
onReplyToChange: (value) => updateProp("replyTo", value)
|
|
9507
|
+
onReplyToChange: (value) => updateProp("replyTo", value),
|
|
9508
|
+
editor,
|
|
9509
|
+
blockId: block.id
|
|
8761
9510
|
}
|
|
8762
9511
|
)
|
|
8763
9512
|
}
|
|
@@ -8769,11 +9518,11 @@ var TemplateConfig5 = ({ editor, block }) => {
|
|
|
8769
9518
|
};
|
|
8770
9519
|
|
|
8771
9520
|
// src/mantine/blocks/notify/template/TemplateView.tsx
|
|
8772
|
-
import { Card as Card22, Group as
|
|
9521
|
+
import { Card as Card22, Group as Group34, Stack as Stack79, Text as Text54, ActionIcon as ActionIcon18, Badge as Badge14 } from "@mantine/core";
|
|
8773
9522
|
var NOTIFY_TEMPLATE_PANEL_ID = "notify-template-panel";
|
|
8774
9523
|
var NotifyTemplateView = ({ editor, block }) => {
|
|
8775
9524
|
const panelId = `${NOTIFY_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
8776
|
-
const panelContent =
|
|
9525
|
+
const panelContent = useMemo18(() => /* @__PURE__ */ React106.createElement(TemplateConfig5, { editor, block }), [editor, block]);
|
|
8777
9526
|
const { open } = usePanel(panelId, panelContent);
|
|
8778
9527
|
const channel = block.props.channel || "email";
|
|
8779
9528
|
const to = (() => {
|
|
@@ -8798,17 +9547,17 @@ var NotifyTemplateView = ({ editor, block }) => {
|
|
|
8798
9547
|
return "gray";
|
|
8799
9548
|
}
|
|
8800
9549
|
};
|
|
8801
|
-
return /* @__PURE__ */
|
|
9550
|
+
return /* @__PURE__ */ React106.createElement(Card22, { withBorder: true, padding: "md", radius: "md", style: { width: "100%", cursor: "pointer", position: "relative" }, onClick: open }, /* @__PURE__ */ React106.createElement(Badge14, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React106.createElement(Group34, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React106.createElement(Group34, { wrap: "nowrap", align: "center" }, /* @__PURE__ */ React106.createElement(ActionIcon18, { variant: "light", color: getChannelColor(channel), size: "lg", radius: "xl", style: { flexShrink: 0 } }, getIcon(block.props.icon, 18, 1.5, "bell")), /* @__PURE__ */ React106.createElement(Stack79, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React106.createElement(Group34, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React106.createElement(Badge14, { size: "sm", variant: "filled", color: getChannelColor(channel) }, channel.toUpperCase()), /* @__PURE__ */ React106.createElement(Text54, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Notification")), /* @__PURE__ */ React106.createElement(Text54, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 1 }, to.length > 0 ? `To: ${to.join(", ")}` : "Click to configure recipients"), block.props.description && /* @__PURE__ */ React106.createElement(Text54, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description)))));
|
|
8802
9551
|
};
|
|
8803
9552
|
|
|
8804
9553
|
// src/mantine/blocks/notify/flow/FlowView.tsx
|
|
8805
|
-
import
|
|
8806
|
-
import { Card as Card23, Group as
|
|
8807
|
-
import { IconSend as IconSend2, IconChevronDown as IconChevronDown3, IconChevronUp as IconChevronUp3, IconCheck, IconX } from "@tabler/icons-react";
|
|
9554
|
+
import React107, { useState as useState29 } from "react";
|
|
9555
|
+
import { Card as Card23, Group as Group35, Stack as Stack80, Text as Text55, ActionIcon as ActionIcon19, Tooltip as Tooltip7, Button as Button27, Badge as Badge15, Collapse as Collapse3, Alert as Alert11, Loader as Loader6, Code as Code3 } from "@mantine/core";
|
|
9556
|
+
import { IconSend as IconSend2, IconChevronDown as IconChevronDown3, IconChevronUp as IconChevronUp3, IconCheck, IconX as IconX3 } from "@tabler/icons-react";
|
|
8808
9557
|
var NotifyFlowView = ({ editor, block, isDisabled }) => {
|
|
8809
9558
|
const disabled = isDisabled?.isDisabled === "disable";
|
|
8810
|
-
const [isLoading, setIsLoading] =
|
|
8811
|
-
const [showDetails, setShowDetails] =
|
|
9559
|
+
const [isLoading, setIsLoading] = useState29(false);
|
|
9560
|
+
const [showDetails, setShowDetails] = useState29(false);
|
|
8812
9561
|
let handlers = null;
|
|
8813
9562
|
try {
|
|
8814
9563
|
handlers = useBlocknoteHandlers();
|
|
@@ -8871,17 +9620,25 @@ var NotifyFlowView = ({ editor, block, isDisabled }) => {
|
|
|
8871
9620
|
props: { ...block.props, status: "sending", errorMessage: "" }
|
|
8872
9621
|
});
|
|
8873
9622
|
try {
|
|
9623
|
+
const editorDocument = editor?.document || [];
|
|
8874
9624
|
if (channel === "email") {
|
|
9625
|
+
const resolvedTo = to.filter((email) => email.trim() !== "").map((email) => resolveReferences(email, editorDocument));
|
|
9626
|
+
const resolvedCc = cc.filter((email) => email.trim() !== "").map((email) => resolveReferences(email, editorDocument));
|
|
9627
|
+
const resolvedBcc = bcc.filter((email) => email.trim() !== "").map((email) => resolveReferences(email, editorDocument));
|
|
9628
|
+
const resolvedSubject = resolveReferences(block.props.subject || "", editorDocument);
|
|
9629
|
+
const resolvedBody = resolveReferences(block.props.body || "", editorDocument);
|
|
9630
|
+
const resolvedFrom = block.props.from ? resolveReferences(block.props.from, editorDocument) : void 0;
|
|
9631
|
+
const resolvedReplyTo = block.props.replyTo ? resolveReferences(block.props.replyTo, editorDocument) : void 0;
|
|
8875
9632
|
const params = {
|
|
8876
9633
|
channel: "email",
|
|
8877
|
-
to:
|
|
8878
|
-
cc:
|
|
8879
|
-
bcc:
|
|
8880
|
-
subject:
|
|
8881
|
-
body:
|
|
9634
|
+
to: resolvedTo,
|
|
9635
|
+
cc: resolvedCc,
|
|
9636
|
+
bcc: resolvedBcc,
|
|
9637
|
+
subject: resolvedSubject,
|
|
9638
|
+
body: resolvedBody,
|
|
8882
9639
|
bodyType: block.props.bodyType || "text",
|
|
8883
|
-
from:
|
|
8884
|
-
replyTo:
|
|
9640
|
+
from: resolvedFrom,
|
|
9641
|
+
replyTo: resolvedReplyTo
|
|
8885
9642
|
};
|
|
8886
9643
|
if (params.cc?.length === 0) delete params.cc;
|
|
8887
9644
|
if (params.bcc?.length === 0) delete params.bcc;
|
|
@@ -8909,20 +9666,20 @@ var NotifyFlowView = ({ editor, block, isDisabled }) => {
|
|
|
8909
9666
|
}
|
|
8910
9667
|
};
|
|
8911
9668
|
const canSend = !disabled && !isLoading && handlers && to.length > 0 && (channel === "email" ? block.props.subject && block.props.body : true);
|
|
8912
|
-
const sendButton = /* @__PURE__ */
|
|
8913
|
-
|
|
9669
|
+
const sendButton = /* @__PURE__ */ React107.createElement(
|
|
9670
|
+
Button27,
|
|
8914
9671
|
{
|
|
8915
9672
|
size: "sm",
|
|
8916
9673
|
variant: "light",
|
|
8917
9674
|
color: getChannelColor(channel),
|
|
8918
|
-
leftSection: isLoading ? /* @__PURE__ */
|
|
9675
|
+
leftSection: isLoading ? /* @__PURE__ */ React107.createElement(Loader6, { size: 14 }) : status === "sent" ? /* @__PURE__ */ React107.createElement(IconCheck, { size: 14 }) : /* @__PURE__ */ React107.createElement(IconSend2, { size: 14 }),
|
|
8919
9676
|
onClick: handleSendNotification,
|
|
8920
9677
|
disabled: !canSend,
|
|
8921
9678
|
style: { flexShrink: 0 }
|
|
8922
9679
|
},
|
|
8923
9680
|
isLoading ? "Sending..." : status === "sent" ? "Sent" : "Send"
|
|
8924
9681
|
);
|
|
8925
|
-
return /* @__PURE__ */
|
|
9682
|
+
return /* @__PURE__ */ React107.createElement(Card23, { withBorder: true, padding: "md", radius: "md", style: { width: "100%" } }, /* @__PURE__ */ React107.createElement(Stack80, { gap: "md" }, /* @__PURE__ */ React107.createElement(Group35, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React107.createElement(Group35, { wrap: "nowrap", align: "flex-start", style: { flex: 1 } }, /* @__PURE__ */ React107.createElement(ActionIcon19, { variant: "light", color: getChannelColor(channel), size: "lg", radius: "xl", style: { flexShrink: 0 } }, getIcon(block.props.icon, 18, 1.5, "bell")), /* @__PURE__ */ React107.createElement(Stack80, { gap: "xs", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React107.createElement(Group35, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React107.createElement(Badge15, { size: "sm", variant: "filled", color: getChannelColor(channel) }, channel.toUpperCase()), /* @__PURE__ */ React107.createElement(Text55, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Notification"), status !== "idle" && /* @__PURE__ */ React107.createElement(Badge15, { size: "xs", variant: "dot", color: getStatusColor(status) }, status)), /* @__PURE__ */ React107.createElement(Text55, { 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__ */ React107.createElement(Text55, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), /* @__PURE__ */ React107.createElement(Group35, { gap: "xs", style: { flexShrink: 0 } }, disabled && isDisabled?.message ? /* @__PURE__ */ React107.createElement(Tooltip7, { label: isDisabled.message, position: "left", withArrow: true }, sendButton) : sendButton, /* @__PURE__ */ React107.createElement(ActionIcon19, { variant: "subtle", onClick: () => setShowDetails(!showDetails) }, showDetails ? /* @__PURE__ */ React107.createElement(IconChevronUp3, { size: 16 }) : /* @__PURE__ */ React107.createElement(IconChevronDown3, { size: 16 })))), status === "failed" && block.props.errorMessage && /* @__PURE__ */ React107.createElement(Alert11, { color: "red", icon: /* @__PURE__ */ React107.createElement(IconX3, { size: 16 }), title: "Failed to send", styles: { message: { fontSize: "12px" } } }, block.props.errorMessage), status === "sent" && block.props.messageId && /* @__PURE__ */ React107.createElement(Alert11, { color: "green", icon: /* @__PURE__ */ React107.createElement(IconCheck, { size: 16 }), title: "Sent successfully", styles: { message: { fontSize: "12px" } } }, "Message ID: ", block.props.messageId, block.props.sentAt && /* @__PURE__ */ React107.createElement(React107.Fragment, null, /* @__PURE__ */ React107.createElement("br", null), "Sent at: ", new Date(block.props.sentAt).toLocaleString())), /* @__PURE__ */ React107.createElement(Collapse3, { in: showDetails }, /* @__PURE__ */ React107.createElement(Stack80, { gap: "md" }, channel === "email" && /* @__PURE__ */ React107.createElement(React107.Fragment, null, /* @__PURE__ */ React107.createElement(Stack80, { gap: "xs" }, /* @__PURE__ */ React107.createElement(Text55, { size: "xs", fw: 600, c: "dimmed" }, "Recipients:"), /* @__PURE__ */ React107.createElement(Code3, { block: true, style: { fontSize: "11px" } }, JSON.stringify(
|
|
8926
9683
|
{
|
|
8927
9684
|
to: to.filter((e) => e.trim() !== ""),
|
|
8928
9685
|
...cc.length > 0 && { cc: cc.filter((e) => e.trim() !== "") },
|
|
@@ -8930,7 +9687,7 @@ var NotifyFlowView = ({ editor, block, isDisabled }) => {
|
|
|
8930
9687
|
},
|
|
8931
9688
|
null,
|
|
8932
9689
|
2
|
|
8933
|
-
))), block.props.subject && /* @__PURE__ */
|
|
9690
|
+
))), block.props.subject && /* @__PURE__ */ React107.createElement(Stack80, { gap: "xs" }, /* @__PURE__ */ React107.createElement(Text55, { size: "xs", fw: 600, c: "dimmed" }, "Subject:"), /* @__PURE__ */ React107.createElement(Text55, { size: "xs" }, block.props.subject)), block.props.body && /* @__PURE__ */ React107.createElement(Stack80, { gap: "xs" }, /* @__PURE__ */ React107.createElement(Text55, { size: "xs", fw: 600, c: "dimmed" }, "Body (", block.props.bodyType || "text", "):"), /* @__PURE__ */ React107.createElement(Code3, { block: true, style: { fontSize: "11px", maxHeight: "200px", overflow: "auto" } }, block.props.body)), (block.props.from || block.props.replyTo) && /* @__PURE__ */ React107.createElement(Stack80, { gap: "xs" }, /* @__PURE__ */ React107.createElement(Text55, { size: "xs", fw: 600, c: "dimmed" }, "Additional:"), /* @__PURE__ */ React107.createElement(Code3, { block: true, style: { fontSize: "11px" } }, JSON.stringify(
|
|
8934
9691
|
{
|
|
8935
9692
|
...block.props.from && { from: block.props.from },
|
|
8936
9693
|
...block.props.replyTo && { replyTo: block.props.replyTo }
|
|
@@ -8945,7 +9702,7 @@ function NotifyBlock({ editor, block }) {
|
|
|
8945
9702
|
const { editable } = useBlocknoteContext();
|
|
8946
9703
|
const { actions } = useBlockConditions(block, editor);
|
|
8947
9704
|
if (editable) {
|
|
8948
|
-
return /* @__PURE__ */
|
|
9705
|
+
return /* @__PURE__ */ React108.createElement(NotifyTemplateView, { editor, block });
|
|
8949
9706
|
}
|
|
8950
9707
|
const conditionConfig = parseConditionConfig(block.props.conditions);
|
|
8951
9708
|
const hasVisibility = hasVisibilityConditions(conditionConfig);
|
|
@@ -8957,7 +9714,7 @@ function NotifyBlock({ editor, block }) {
|
|
|
8957
9714
|
const hasEnable = hasEnableConditions(conditionConfig);
|
|
8958
9715
|
const enableActionExists = actions.some((a) => a.action === "enable");
|
|
8959
9716
|
const shouldDisable = hasEnable && !enableActionExists;
|
|
8960
|
-
return /* @__PURE__ */
|
|
9717
|
+
return /* @__PURE__ */ React108.createElement(NotifyFlowView, { block, editor, isDisabled: shouldDisable ? { isDisabled: "disable", message: "Notification disabled by conditions" } : void 0 });
|
|
8961
9718
|
}
|
|
8962
9719
|
|
|
8963
9720
|
// src/mantine/blocks/notify/NotifyBlockSpec.tsx
|
|
@@ -9001,18 +9758,18 @@ var NotifyBlockSpec = createReactBlockSpec7(
|
|
|
9001
9758
|
{
|
|
9002
9759
|
render: (props) => {
|
|
9003
9760
|
const ixoProps = props;
|
|
9004
|
-
return /* @__PURE__ */
|
|
9761
|
+
return /* @__PURE__ */ React109.createElement(NotifyBlock, { ...ixoProps });
|
|
9005
9762
|
}
|
|
9006
9763
|
}
|
|
9007
9764
|
);
|
|
9008
9765
|
|
|
9009
9766
|
// src/mantine/blocks/list/ui/ListBlocksToolbar.tsx
|
|
9010
|
-
import
|
|
9011
|
-
import { ActionIcon as
|
|
9767
|
+
import React110 from "react";
|
|
9768
|
+
import { ActionIcon as ActionIcon20, Group as Group36, Tooltip as Tooltip8 } from "@mantine/core";
|
|
9012
9769
|
import { IconChevronUp as IconChevronUp4, IconChevronDown as IconChevronDown4 } from "@tabler/icons-react";
|
|
9013
9770
|
var ListBlocksToolbar = () => {
|
|
9014
9771
|
const { broadcastCollapse } = useListBlocksUI();
|
|
9015
|
-
return /* @__PURE__ */
|
|
9772
|
+
return /* @__PURE__ */ React110.createElement(Group36, { gap: "xs" }, /* @__PURE__ */ React110.createElement(Tooltip8, { label: "Collapse all lists", withArrow: true }, /* @__PURE__ */ React110.createElement(ActionIcon20, { c: "dimmed", variant: "subtle", size: "sm", "aria-label": "Collapse all lists", onClick: () => broadcastCollapse("collapse") }, /* @__PURE__ */ React110.createElement(IconChevronUp4, { size: 18 }))), /* @__PURE__ */ React110.createElement(Tooltip8, { label: "Expand all lists", withArrow: true }, /* @__PURE__ */ React110.createElement(ActionIcon20, { c: "dimmed", variant: "subtle", size: "sm", "aria-label": "Expand all lists", onClick: () => broadcastCollapse("expand") }, /* @__PURE__ */ React110.createElement(IconChevronDown4, { size: 18 }))));
|
|
9016
9773
|
};
|
|
9017
9774
|
|
|
9018
9775
|
// src/mantine/blocks/registry/blockRegistry.ts
|
|
@@ -9141,10 +9898,10 @@ blockRegistry.register({
|
|
|
9141
9898
|
});
|
|
9142
9899
|
|
|
9143
9900
|
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
9144
|
-
import { useMemo as
|
|
9901
|
+
import { useMemo as useMemo19, useEffect as useEffect19, useState as useState30, useCallback as useCallback20 } from "react";
|
|
9145
9902
|
|
|
9146
9903
|
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
9147
|
-
import { useMemo as
|
|
9904
|
+
import { useMemo as useMemo20 } from "react";
|
|
9148
9905
|
|
|
9149
9906
|
// src/mantine/blocks/index.ts
|
|
9150
9907
|
var blockSpecs = {
|
|
@@ -9248,31 +10005,6 @@ var getExtraSlashMenuItems = (editor) => {
|
|
|
9248
10005
|
group: "Domains",
|
|
9249
10006
|
subtext: "Create an overview from DID data"
|
|
9250
10007
|
},
|
|
9251
|
-
{
|
|
9252
|
-
title: "Proposal Vote",
|
|
9253
|
-
onItemClick: () => {
|
|
9254
|
-
editor.insertBlocks(
|
|
9255
|
-
[
|
|
9256
|
-
{
|
|
9257
|
-
type: "proposalVote",
|
|
9258
|
-
props: {
|
|
9259
|
-
title: "",
|
|
9260
|
-
subtitle: "",
|
|
9261
|
-
icon: 'A\uFFFD\uFFFD,\uFFFD?"A3A_A,A?',
|
|
9262
|
-
status: "open",
|
|
9263
|
-
daysLeft: 0,
|
|
9264
|
-
conditions: ""
|
|
9265
|
-
}
|
|
9266
|
-
}
|
|
9267
|
-
],
|
|
9268
|
-
editor.getTextCursorPosition().block,
|
|
9269
|
-
"after"
|
|
9270
|
-
);
|
|
9271
|
-
},
|
|
9272
|
-
aliases: ["vote", "proposal-vote", "governance-vote", "dao-vote"],
|
|
9273
|
-
group: "DAO",
|
|
9274
|
-
subtext: "Create a proposal voting block"
|
|
9275
|
-
},
|
|
9276
10008
|
{
|
|
9277
10009
|
title: "Proposal",
|
|
9278
10010
|
onItemClick: () => {
|
|
@@ -9297,28 +10029,6 @@ var getExtraSlashMenuItems = (editor) => {
|
|
|
9297
10029
|
group: "DAO",
|
|
9298
10030
|
subtext: "Create a new DAO proposal"
|
|
9299
10031
|
},
|
|
9300
|
-
{
|
|
9301
|
-
title: "Proposal Actions",
|
|
9302
|
-
onItemClick: () => {
|
|
9303
|
-
editor.insertBlocks(
|
|
9304
|
-
[
|
|
9305
|
-
{
|
|
9306
|
-
type: "proposalActions",
|
|
9307
|
-
props: {
|
|
9308
|
-
proposalBlockId: "",
|
|
9309
|
-
hasDependencies: true,
|
|
9310
|
-
actions: "[]"
|
|
9311
|
-
}
|
|
9312
|
-
}
|
|
9313
|
-
],
|
|
9314
|
-
editor.getTextCursorPosition().block,
|
|
9315
|
-
"after"
|
|
9316
|
-
);
|
|
9317
|
-
},
|
|
9318
|
-
aliases: ["actions", "proposal-actions", "dao-actions", "governance-actions"],
|
|
9319
|
-
group: "DAO",
|
|
9320
|
-
subtext: "Manage proposal actions"
|
|
9321
|
-
},
|
|
9322
10032
|
{
|
|
9323
10033
|
title: "API Request",
|
|
9324
10034
|
onItemClick: () => {
|
|
@@ -9390,7 +10100,7 @@ var getExtraSlashMenuItems = (editor) => {
|
|
|
9390
10100
|
const yRoot = editor?._yRoot;
|
|
9391
10101
|
const docType = yRoot?.get("docType");
|
|
9392
10102
|
if (docType === "page") {
|
|
9393
|
-
return slashMenuList.filter((item) => item.title !== "Proposal
|
|
10103
|
+
return slashMenuList.filter((item) => item.title !== "Proposal");
|
|
9394
10104
|
}
|
|
9395
10105
|
return slashMenuList;
|
|
9396
10106
|
};
|
|
@@ -9463,15 +10173,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
|
|
|
9463
10173
|
import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
|
|
9464
10174
|
|
|
9465
10175
|
// src/core/hooks/useMatrixProvider.ts
|
|
9466
|
-
import { useEffect as
|
|
10176
|
+
import { useEffect as useEffect20, useState as useState31, useRef as useRef4, useCallback as useCallback21, useMemo as useMemo21 } from "react";
|
|
9467
10177
|
import { MatrixProvider } from "@ixo/matrix-crdt";
|
|
9468
10178
|
function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
9469
|
-
const [matrixProvider, setProvider] =
|
|
9470
|
-
const [status, setStatus] =
|
|
10179
|
+
const [matrixProvider, setProvider] = useState31(null);
|
|
10180
|
+
const [status, setStatus] = useState31("disconnected");
|
|
9471
10181
|
const isMountedRef = useRef4(true);
|
|
9472
10182
|
const providerRef = useRef4(null);
|
|
9473
10183
|
const retryTimeoutRef = useRef4(null);
|
|
9474
|
-
const providerOptions =
|
|
10184
|
+
const providerOptions = useMemo21(
|
|
9475
10185
|
() => ({
|
|
9476
10186
|
translator: {
|
|
9477
10187
|
updateEventType: "matrix-crdt.doc_update",
|
|
@@ -9484,22 +10194,22 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
9484
10194
|
}),
|
|
9485
10195
|
[]
|
|
9486
10196
|
);
|
|
9487
|
-
const handleDocumentAvailable =
|
|
10197
|
+
const handleDocumentAvailable = useCallback21(() => {
|
|
9488
10198
|
if (isMountedRef.current) {
|
|
9489
10199
|
setStatus("connected");
|
|
9490
10200
|
}
|
|
9491
10201
|
}, []);
|
|
9492
|
-
const handleDocumentUnavailable =
|
|
10202
|
+
const handleDocumentUnavailable = useCallback21(() => {
|
|
9493
10203
|
if (isMountedRef.current) {
|
|
9494
10204
|
setStatus("failed");
|
|
9495
10205
|
}
|
|
9496
10206
|
}, []);
|
|
9497
|
-
const handleCanWriteChanged =
|
|
10207
|
+
const handleCanWriteChanged = useCallback21(() => {
|
|
9498
10208
|
if (isMountedRef.current && providerRef.current) {
|
|
9499
10209
|
setStatus(providerRef.current.canWrite ? "connected" : "failed");
|
|
9500
10210
|
}
|
|
9501
10211
|
}, []);
|
|
9502
|
-
const initProvider =
|
|
10212
|
+
const initProvider = useCallback21(async () => {
|
|
9503
10213
|
if (!isMountedRef.current) return;
|
|
9504
10214
|
if (retryTimeoutRef.current) {
|
|
9505
10215
|
clearTimeout(retryTimeoutRef.current);
|
|
@@ -9533,7 +10243,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
9533
10243
|
}
|
|
9534
10244
|
}
|
|
9535
10245
|
}, [matrixClient, providerOptions, handleDocumentAvailable, handleDocumentUnavailable, handleCanWriteChanged]);
|
|
9536
|
-
|
|
10246
|
+
useEffect20(() => {
|
|
9537
10247
|
isMountedRef.current = true;
|
|
9538
10248
|
initProvider();
|
|
9539
10249
|
return () => {
|
|
@@ -9550,7 +10260,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
9550
10260
|
setStatus("disconnected");
|
|
9551
10261
|
};
|
|
9552
10262
|
}, [initProvider]);
|
|
9553
|
-
|
|
10263
|
+
useEffect20(() => {
|
|
9554
10264
|
return () => {
|
|
9555
10265
|
isMountedRef.current = false;
|
|
9556
10266
|
};
|
|
@@ -9559,17 +10269,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
9559
10269
|
}
|
|
9560
10270
|
|
|
9561
10271
|
// src/mantine/hooks/useCollaborativeYDoc.ts
|
|
9562
|
-
import { useMemo as
|
|
10272
|
+
import { useMemo as useMemo22 } from "react";
|
|
9563
10273
|
import * as Y from "yjs";
|
|
9564
10274
|
function useCollaborativeYDoc(_options) {
|
|
9565
|
-
return
|
|
10275
|
+
return useMemo22(() => {
|
|
9566
10276
|
const doc = new Y.Doc();
|
|
9567
10277
|
return doc;
|
|
9568
10278
|
}, []);
|
|
9569
10279
|
}
|
|
9570
10280
|
|
|
9571
10281
|
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
9572
|
-
import { useMemo as
|
|
10282
|
+
import { useMemo as useMemo23, useEffect as useEffect21 } from "react";
|
|
9573
10283
|
function useCreateCollaborativeIxoEditor(options) {
|
|
9574
10284
|
const yDoc = useCollaborativeYDoc(options);
|
|
9575
10285
|
const {
|
|
@@ -9587,7 +10297,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
9587
10297
|
matrixClient,
|
|
9588
10298
|
permissions = { write: false }
|
|
9589
10299
|
} = options || {};
|
|
9590
|
-
const memoizedUser =
|
|
10300
|
+
const memoizedUser = useMemo23(
|
|
9591
10301
|
() => ({
|
|
9592
10302
|
id: user?.id || "",
|
|
9593
10303
|
name: user?.name || "",
|
|
@@ -9602,7 +10312,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
9602
10312
|
matrixClient,
|
|
9603
10313
|
roomId: options.roomId
|
|
9604
10314
|
});
|
|
9605
|
-
const defaultUploadFile =
|
|
10315
|
+
const defaultUploadFile = useMemo23(
|
|
9606
10316
|
() => uploadFile || (async (file) => {
|
|
9607
10317
|
return new Promise((resolve, reject) => {
|
|
9608
10318
|
const reader = new FileReader();
|
|
@@ -9616,7 +10326,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
9616
10326
|
}),
|
|
9617
10327
|
[uploadFile]
|
|
9618
10328
|
);
|
|
9619
|
-
const schema =
|
|
10329
|
+
const schema = useMemo23(
|
|
9620
10330
|
() => BlockNoteSchema2.create({
|
|
9621
10331
|
blockSpecs: {
|
|
9622
10332
|
...defaultBlockSpecs2,
|
|
@@ -9631,11 +10341,11 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
9631
10341
|
}),
|
|
9632
10342
|
[]
|
|
9633
10343
|
);
|
|
9634
|
-
const root =
|
|
9635
|
-
const documentFragment =
|
|
9636
|
-
const flowArray =
|
|
9637
|
-
const userFragment =
|
|
9638
|
-
const collaborationConfig =
|
|
10344
|
+
const root = useMemo23(() => yDoc.getMap("root"), [yDoc]);
|
|
10345
|
+
const documentFragment = useMemo23(() => yDoc.getXmlFragment("document"), [yDoc]);
|
|
10346
|
+
const flowArray = useMemo23(() => yDoc.getArray("flow"), [yDoc]);
|
|
10347
|
+
const userFragment = useMemo23(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
|
|
10348
|
+
const collaborationConfig = useMemo23(
|
|
9639
10349
|
() => ({
|
|
9640
10350
|
provider: matrixProvider,
|
|
9641
10351
|
fragment: documentFragment,
|
|
@@ -9647,7 +10357,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
9647
10357
|
}),
|
|
9648
10358
|
[matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
|
|
9649
10359
|
);
|
|
9650
|
-
const ixoConfig =
|
|
10360
|
+
const ixoConfig = useMemo23(
|
|
9651
10361
|
() => ({
|
|
9652
10362
|
theme,
|
|
9653
10363
|
editable,
|
|
@@ -9666,7 +10376,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
9666
10376
|
uploadFile: defaultUploadFile,
|
|
9667
10377
|
collaboration: collaborationConfig
|
|
9668
10378
|
});
|
|
9669
|
-
const titleText =
|
|
10379
|
+
const titleText = useMemo23(() => yDoc.getText("title"), [yDoc]);
|
|
9670
10380
|
let ixoEditor;
|
|
9671
10381
|
if (editor) {
|
|
9672
10382
|
ixoEditor = editor;
|
|
@@ -9725,15 +10435,16 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
9725
10435
|
return;
|
|
9726
10436
|
}
|
|
9727
10437
|
console.log("[useCollaborativeIxoEditor] setDocType() called, setting docType to:", value);
|
|
10438
|
+
ixoEditor._authoritativeDocType = value;
|
|
9728
10439
|
root.set("docType", value);
|
|
9729
10440
|
};
|
|
9730
10441
|
}
|
|
9731
|
-
|
|
10442
|
+
useEffect21(() => {
|
|
9732
10443
|
if (ixoEditor) {
|
|
9733
10444
|
ixoEditor.isEditable = editable;
|
|
9734
10445
|
}
|
|
9735
10446
|
}, [ixoEditor, editable]);
|
|
9736
|
-
|
|
10447
|
+
useEffect21(() => {
|
|
9737
10448
|
if (connectionStatus !== "connected") {
|
|
9738
10449
|
return;
|
|
9739
10450
|
}
|
|
@@ -9767,19 +10478,19 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
9767
10478
|
}
|
|
9768
10479
|
|
|
9769
10480
|
// src/mantine/IxoEditor.tsx
|
|
9770
|
-
import
|
|
10481
|
+
import React112 from "react";
|
|
9771
10482
|
import { getDefaultReactSlashMenuItems, SuggestionMenuController } from "@blocknote/react";
|
|
9772
10483
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
9773
10484
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
9774
|
-
import { Flex as Flex20, MantineProvider, Text as
|
|
10485
|
+
import { Flex as Flex20, MantineProvider, Text as Text56 } from "@mantine/core";
|
|
9775
10486
|
|
|
9776
10487
|
// src/mantine/components/PanelContent.tsx
|
|
9777
|
-
import
|
|
10488
|
+
import React111 from "react";
|
|
9778
10489
|
function PanelContent() {
|
|
9779
10490
|
const { activePanel, registeredPanels } = usePanelStore();
|
|
9780
10491
|
const isOpen = activePanel !== null;
|
|
9781
10492
|
const content = activePanel ? registeredPanels.get(activePanel) : null;
|
|
9782
|
-
return /* @__PURE__ */
|
|
10493
|
+
return /* @__PURE__ */ React111.createElement(
|
|
9783
10494
|
"div",
|
|
9784
10495
|
{
|
|
9785
10496
|
style: {
|
|
@@ -9803,7 +10514,7 @@ function IxoEditorContent({
|
|
|
9803
10514
|
onSelectionChange,
|
|
9804
10515
|
children
|
|
9805
10516
|
}) {
|
|
9806
|
-
return /* @__PURE__ */
|
|
10517
|
+
return /* @__PURE__ */ React112.createElement("div", { style: { display: "flex", height: "100%" } }, /* @__PURE__ */ React112.createElement("div", { className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`, style: { flex: 1 } }, /* @__PURE__ */ React112.createElement(
|
|
9807
10518
|
BlockNoteView,
|
|
9808
10519
|
{
|
|
9809
10520
|
editor,
|
|
@@ -9818,7 +10529,7 @@ function IxoEditorContent({
|
|
|
9818
10529
|
onChange,
|
|
9819
10530
|
onSelectionChange
|
|
9820
10531
|
},
|
|
9821
|
-
config.slashMenu && /* @__PURE__ */
|
|
10532
|
+
config.slashMenu && /* @__PURE__ */ React112.createElement(
|
|
9822
10533
|
SuggestionMenuController,
|
|
9823
10534
|
{
|
|
9824
10535
|
triggerCharacter: "/",
|
|
@@ -9830,7 +10541,7 @@ function IxoEditorContent({
|
|
|
9830
10541
|
}
|
|
9831
10542
|
),
|
|
9832
10543
|
children
|
|
9833
|
-
)), /* @__PURE__ */
|
|
10544
|
+
)), /* @__PURE__ */ React112.createElement(PanelContent, null));
|
|
9834
10545
|
}
|
|
9835
10546
|
function IxoEditor({
|
|
9836
10547
|
editor,
|
|
@@ -9856,9 +10567,9 @@ function IxoEditor({
|
|
|
9856
10567
|
tableHandles: true
|
|
9857
10568
|
};
|
|
9858
10569
|
const isEditable = editable;
|
|
9859
|
-
const editorContent = /* @__PURE__ */
|
|
10570
|
+
const editorContent = /* @__PURE__ */ React112.createElement(BlocknoteProvider, { editor, handlers, blockRequirements, editable: isEditable }, /* @__PURE__ */ React112.createElement(ListBlocksUIProvider, null, /* @__PURE__ */ React112.createElement(Flex20, { pr: 25, justify: "flex-end", align: "center", gap: "xs" }, /* @__PURE__ */ React112.createElement(Text56, { size: "xs", c: "dimmed", tt: "uppercase" }, "Global actions"), /* @__PURE__ */ React112.createElement(ListBlocksToolbar, null)), /* @__PURE__ */ React112.createElement(IxoEditorContent, { editor, config, isEditable, className, onChange, onSelectionChange }, children)));
|
|
9860
10571
|
if (mantineTheme) {
|
|
9861
|
-
return /* @__PURE__ */
|
|
10572
|
+
return /* @__PURE__ */ React112.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
|
|
9862
10573
|
}
|
|
9863
10574
|
return editorContent;
|
|
9864
10575
|
}
|
|
@@ -9942,4 +10653,4 @@ export {
|
|
|
9942
10653
|
ixoGraphQLClient,
|
|
9943
10654
|
getEntity
|
|
9944
10655
|
};
|
|
9945
|
-
//# sourceMappingURL=chunk-
|
|
10656
|
+
//# sourceMappingURL=chunk-NWID2DZ5.mjs.map
|