@ixo/editor 1.27.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-S45RB34V.mjs → chunk-3BZ6OPAK.mjs} +987 -942
- package/dist/chunk-3BZ6OPAK.mjs.map +1 -0
- package/dist/index.mjs +1 -1
- package/dist/mantine/index.mjs +1 -1
- package/package.json +1 -1
- package/style-core.css +17 -0
- package/style-mantine.css +17 -0
- package/style.css +17 -0
- package/dist/chunk-S45RB34V.mjs.map +0 -1
|
@@ -216,7 +216,6 @@ function parseConditionConfig(conditionsString) {
|
|
|
216
216
|
try {
|
|
217
217
|
return JSON.parse(conditionsString);
|
|
218
218
|
} catch (error) {
|
|
219
|
-
console.error("[parseConditionConfig] Failed to parse conditions:", error);
|
|
220
219
|
return {
|
|
221
220
|
enabled: false,
|
|
222
221
|
mode: "all_must_pass",
|
|
@@ -230,7 +229,6 @@ function stringifyConditionConfig(config) {
|
|
|
230
229
|
try {
|
|
231
230
|
return JSON.stringify(config);
|
|
232
231
|
} catch (error) {
|
|
233
|
-
console.error("[stringifyConditionConfig] Failed to stringify conditions:", error);
|
|
234
232
|
return JSON.stringify({
|
|
235
233
|
enabled: false,
|
|
236
234
|
mode: "all_must_pass",
|
|
@@ -290,7 +288,6 @@ function parseResponseSchema(schemaString) {
|
|
|
290
288
|
try {
|
|
291
289
|
return JSON.parse(schemaString);
|
|
292
290
|
} catch (error) {
|
|
293
|
-
console.warn("Failed to parse response schema:", error);
|
|
294
291
|
return null;
|
|
295
292
|
}
|
|
296
293
|
}
|
|
@@ -1342,7 +1339,6 @@ function evaluateCondition(condition, sourceBlock, _currentUser) {
|
|
|
1342
1339
|
passes = sourceValue !== "" && sourceValue !== null && sourceValue !== void 0;
|
|
1343
1340
|
break;
|
|
1344
1341
|
default:
|
|
1345
|
-
console.warn(`[evaluateCondition] Unknown operator: ${rule.operator}`);
|
|
1346
1342
|
passes = false;
|
|
1347
1343
|
}
|
|
1348
1344
|
return {
|
|
@@ -1517,8 +1513,7 @@ var useSharedProposal = ({ proposalId, contractAddress, autoFetch = true }) => {
|
|
|
1517
1513
|
const cacheKey = `${contractAddress}:${proposalId}`;
|
|
1518
1514
|
useEffect5(() => {
|
|
1519
1515
|
if (!proposalId || !contractAddress || !autoFetch) return;
|
|
1520
|
-
fetchSharedProposal(proposalId, contractAddress).then(setLocalProposal).catch((
|
|
1521
|
-
console.error("Failed to fetch proposal:", error);
|
|
1516
|
+
fetchSharedProposal(proposalId, contractAddress).then(setLocalProposal).catch(() => {
|
|
1522
1517
|
});
|
|
1523
1518
|
}, [proposalId, contractAddress, fetchSharedProposal, autoFetch]);
|
|
1524
1519
|
useEffect5(() => {
|
|
@@ -2343,7 +2338,6 @@ var GeneralTab2 = ({ initialConfig, onSave }) => {
|
|
|
2343
2338
|
const user = handlers.getCurrentUser();
|
|
2344
2339
|
handleConfigChange("address", user.address);
|
|
2345
2340
|
} catch (error) {
|
|
2346
|
-
console.error("Failed to get current user:", error);
|
|
2347
2341
|
}
|
|
2348
2342
|
}
|
|
2349
2343
|
};
|
|
@@ -2508,7 +2502,6 @@ var TemplateConfig2 = ({ editor, block }) => {
|
|
|
2508
2502
|
listConfig = JSON.parse(block.props.listConfig);
|
|
2509
2503
|
}
|
|
2510
2504
|
} catch (error) {
|
|
2511
|
-
console.error("Failed to parse listConfig:", error);
|
|
2512
2505
|
}
|
|
2513
2506
|
let sortOptions = {};
|
|
2514
2507
|
try {
|
|
@@ -2516,7 +2509,6 @@ var TemplateConfig2 = ({ editor, block }) => {
|
|
|
2516
2509
|
sortOptions = JSON.parse(block.props.sortOptions);
|
|
2517
2510
|
}
|
|
2518
2511
|
} catch (error) {
|
|
2519
|
-
console.error("Failed to parse sortOptions:", error);
|
|
2520
2512
|
}
|
|
2521
2513
|
let filterOptions = {};
|
|
2522
2514
|
try {
|
|
@@ -2524,7 +2516,6 @@ var TemplateConfig2 = ({ editor, block }) => {
|
|
|
2524
2516
|
filterOptions = JSON.parse(block.props.filterOptions);
|
|
2525
2517
|
}
|
|
2526
2518
|
} catch (error) {
|
|
2527
|
-
console.error("Failed to parse filterOptions:", error);
|
|
2528
2519
|
}
|
|
2529
2520
|
const initialConfig = listType && listConfig ? {
|
|
2530
2521
|
type: listType,
|
|
@@ -2659,7 +2650,6 @@ var LinkedResourcesList = ({ items, isMultiSelect, isItemChecked, onItemCheck, c
|
|
|
2659
2650
|
return /* @__PURE__ */ React26.createElement(Text8, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No linked resources found");
|
|
2660
2651
|
}
|
|
2661
2652
|
const rows = items.map((item, index) => {
|
|
2662
|
-
console.log(item);
|
|
2663
2653
|
const title = item.description || item.id || `Resource ${index + 1}`;
|
|
2664
2654
|
const isChecked = isItemChecked?.(item.id);
|
|
2665
2655
|
return /* @__PURE__ */ React26.createElement(ListItemContainer, { onClick: () => onItemCheck?.(item.id, !isChecked), key: item.id || index, isChecked: !!isChecked }, /* @__PURE__ */ React26.createElement(Flex3, { align: "center", gap: "sm" }, /* @__PURE__ */ React26.createElement(
|
|
@@ -3176,7 +3166,6 @@ var ListSelectionPanel = ({ selectedIds, listType }) => {
|
|
|
3176
3166
|
setItemData({ id: selectedItemId });
|
|
3177
3167
|
}
|
|
3178
3168
|
} catch (err) {
|
|
3179
|
-
console.error("Failed to fetch item details:", err);
|
|
3180
3169
|
setError(err instanceof Error ? err.message : "Failed to fetch item details");
|
|
3181
3170
|
} finally {
|
|
3182
3171
|
setLoading(false);
|
|
@@ -3464,7 +3453,6 @@ var ListFlowView = ({ block, editor }) => {
|
|
|
3464
3453
|
try {
|
|
3465
3454
|
return JSON.parse(block.props.listConfig);
|
|
3466
3455
|
} catch (error2) {
|
|
3467
|
-
console.error("Failed to parse listConfig:", error2);
|
|
3468
3456
|
return {};
|
|
3469
3457
|
}
|
|
3470
3458
|
}
|
|
@@ -3475,7 +3463,6 @@ var ListFlowView = ({ block, editor }) => {
|
|
|
3475
3463
|
try {
|
|
3476
3464
|
return JSON.parse(block.props.sortOptions);
|
|
3477
3465
|
} catch (error2) {
|
|
3478
|
-
console.error("Failed to parse listSortConfigOptions:", error2);
|
|
3479
3466
|
return {};
|
|
3480
3467
|
}
|
|
3481
3468
|
}
|
|
@@ -3486,7 +3473,6 @@ var ListFlowView = ({ block, editor }) => {
|
|
|
3486
3473
|
try {
|
|
3487
3474
|
return JSON.parse(block.props.filterOptions);
|
|
3488
3475
|
} catch (error2) {
|
|
3489
|
-
console.error("Failed to parse listSortConfigOptions:", error2);
|
|
3490
3476
|
return {};
|
|
3491
3477
|
}
|
|
3492
3478
|
}
|
|
@@ -3497,7 +3483,6 @@ var ListFlowView = ({ block, editor }) => {
|
|
|
3497
3483
|
try {
|
|
3498
3484
|
return JSON.parse(block.props.filter);
|
|
3499
3485
|
} catch (error2) {
|
|
3500
|
-
console.error("Failed to parse listSortConfigOptions:", error2);
|
|
3501
3486
|
return {};
|
|
3502
3487
|
}
|
|
3503
3488
|
}
|
|
@@ -3508,7 +3493,6 @@ var ListFlowView = ({ block, editor }) => {
|
|
|
3508
3493
|
try {
|
|
3509
3494
|
return JSON.parse(block.props.sort);
|
|
3510
3495
|
} catch (error2) {
|
|
3511
|
-
console.error("Failed to parse listSortConfig:", error2);
|
|
3512
3496
|
return {};
|
|
3513
3497
|
}
|
|
3514
3498
|
}
|
|
@@ -4000,7 +3984,6 @@ var GeneralTab3 = ({ title, description, coreAddress, onTitleChange, onDescripti
|
|
|
4000
3984
|
useEffect9(() => {
|
|
4001
3985
|
const fetchGroups = async () => {
|
|
4002
3986
|
if (!handlers?.getDAOGroups) {
|
|
4003
|
-
console.warn("getDAOGroups handler not available");
|
|
4004
3987
|
return;
|
|
4005
3988
|
}
|
|
4006
3989
|
setLoadingGroups(true);
|
|
@@ -4008,7 +3991,6 @@ var GeneralTab3 = ({ title, description, coreAddress, onTitleChange, onDescripti
|
|
|
4008
3991
|
const daoGroups = await handlers.getDAOGroups();
|
|
4009
3992
|
setGroups(daoGroups);
|
|
4010
3993
|
} catch (error) {
|
|
4011
|
-
console.error("Failed to fetch DAO groups:", error);
|
|
4012
3994
|
} finally {
|
|
4013
3995
|
setLoadingGroups(false);
|
|
4014
3996
|
}
|
|
@@ -6100,7 +6082,6 @@ var ActionsPanel = ({ actions, editingIndex, onSave, onCancel, isTemplateMode =
|
|
|
6100
6082
|
if (!currentActionConfig) return;
|
|
6101
6083
|
const validation = currentActionConfig.validateData(actionData);
|
|
6102
6084
|
if (!validation.isValid) {
|
|
6103
|
-
console.error("Validation errors:", validation.errors);
|
|
6104
6085
|
return;
|
|
6105
6086
|
}
|
|
6106
6087
|
const action = {
|
|
@@ -6259,7 +6240,6 @@ var ActionsTab = ({ actions, onActionsChange, editor, block }) => {
|
|
|
6259
6240
|
try {
|
|
6260
6241
|
return JSON.parse(actionsJson);
|
|
6261
6242
|
} catch (error) {
|
|
6262
|
-
console.error("Failed to parse actions:", error);
|
|
6263
6243
|
return [];
|
|
6264
6244
|
}
|
|
6265
6245
|
};
|
|
@@ -6561,9 +6541,6 @@ var useFlowBusinessLogic = ({ block, editor }) => {
|
|
|
6561
6541
|
setProposalContractAddress(resolvedAddress);
|
|
6562
6542
|
}
|
|
6563
6543
|
} catch (error) {
|
|
6564
|
-
if (!isCancelled) {
|
|
6565
|
-
console.error("Failed to fetch proposal contract address:", error);
|
|
6566
|
-
}
|
|
6567
6544
|
}
|
|
6568
6545
|
};
|
|
6569
6546
|
void loadProposalContract();
|
|
@@ -6581,7 +6558,6 @@ var useFlowBusinessLogic = ({ block, editor }) => {
|
|
|
6581
6558
|
}, [proposal, status]);
|
|
6582
6559
|
const handleExecuteProposal = async () => {
|
|
6583
6560
|
if (!handlers || !proposalContractAddress || !proposalId) {
|
|
6584
|
-
console.error("Execute proposal: Missing required data");
|
|
6585
6561
|
return;
|
|
6586
6562
|
}
|
|
6587
6563
|
setIsExecuting(true);
|
|
@@ -6595,7 +6571,6 @@ var useFlowBusinessLogic = ({ block, editor }) => {
|
|
|
6595
6571
|
await refetch();
|
|
6596
6572
|
} catch (error) {
|
|
6597
6573
|
const message = error instanceof Error ? error.message : "Failed to execute proposal";
|
|
6598
|
-
console.error("Failed to execute proposal:", error);
|
|
6599
6574
|
setExecutionError(message);
|
|
6600
6575
|
} finally {
|
|
6601
6576
|
setIsExecuting(false);
|
|
@@ -6684,9 +6659,6 @@ var useVoteBusinessLogic = ({ block, editor }) => {
|
|
|
6684
6659
|
setProposalContractAddress(resolvedAddress);
|
|
6685
6660
|
}
|
|
6686
6661
|
} catch (error) {
|
|
6687
|
-
if (!isCancelled) {
|
|
6688
|
-
console.error("[ProposalVote] Failed to fetch proposal contract address:", error);
|
|
6689
|
-
}
|
|
6690
6662
|
}
|
|
6691
6663
|
};
|
|
6692
6664
|
void loadProposalContract();
|
|
@@ -6707,9 +6679,6 @@ var useVoteBusinessLogic = ({ block, editor }) => {
|
|
|
6707
6679
|
setUserVote(vote);
|
|
6708
6680
|
}
|
|
6709
6681
|
} catch (error) {
|
|
6710
|
-
if (!isCancelled) {
|
|
6711
|
-
console.error("[ProposalVote] Failed to fetch user vote:", error);
|
|
6712
|
-
}
|
|
6713
6682
|
}
|
|
6714
6683
|
};
|
|
6715
6684
|
void loadUserVote();
|
|
@@ -6725,7 +6694,6 @@ var useVoteBusinessLogic = ({ block, editor }) => {
|
|
|
6725
6694
|
const vote = await handlers.getVote(voteParams.proposalContractAddress, voteParams.proposalId.toString(), user.address);
|
|
6726
6695
|
setUserVote(vote);
|
|
6727
6696
|
} catch (err) {
|
|
6728
|
-
console.error("Failed to vote:", err);
|
|
6729
6697
|
setLocalError("Failed to submit vote");
|
|
6730
6698
|
}
|
|
6731
6699
|
};
|
|
@@ -6987,7 +6955,6 @@ var ActionsTab2 = ({ actions, onActionsChange, editor, block, isProposalCreated
|
|
|
6987
6955
|
try {
|
|
6988
6956
|
return JSON.parse(actionsJson);
|
|
6989
6957
|
} catch (error) {
|
|
6990
|
-
console.error("Failed to parse actions:", error);
|
|
6991
6958
|
return [];
|
|
6992
6959
|
}
|
|
6993
6960
|
};
|
|
@@ -7117,7 +7084,6 @@ var FlowConfig = ({ editor, block }) => {
|
|
|
7117
7084
|
useEffect16(() => {
|
|
7118
7085
|
const fetchGroups = async () => {
|
|
7119
7086
|
if (!handlers?.getDAOGroups) {
|
|
7120
|
-
console.warn("getDAOGroups handler not available");
|
|
7121
7087
|
return;
|
|
7122
7088
|
}
|
|
7123
7089
|
setLoadingGroups(true);
|
|
@@ -7125,7 +7091,6 @@ var FlowConfig = ({ editor, block }) => {
|
|
|
7125
7091
|
const daoGroups = await handlers.getDAOGroups();
|
|
7126
7092
|
setGroups(daoGroups);
|
|
7127
7093
|
} catch (error) {
|
|
7128
|
-
console.error("Failed to fetch DAO groups:", error);
|
|
7129
7094
|
} finally {
|
|
7130
7095
|
setLoadingGroups(false);
|
|
7131
7096
|
}
|
|
@@ -7329,12 +7294,9 @@ var ProposalFlowView = ({ block, editor }) => {
|
|
|
7329
7294
|
// src/mantine/blocks/proposal/ProposalBlock.tsx
|
|
7330
7295
|
function ProposalBlock({ editor, block }) {
|
|
7331
7296
|
const { docType } = useBlocknoteContext();
|
|
7332
|
-
console.log("[ProposalBlock] Rendering with docType:", docType);
|
|
7333
7297
|
if (docType === "template") {
|
|
7334
|
-
console.log("[ProposalBlock] Rendering ProposalTemplateView (docType is template)");
|
|
7335
7298
|
return /* @__PURE__ */ React94.createElement(ProposalTemplateView, { editor, block });
|
|
7336
7299
|
}
|
|
7337
|
-
console.log("[ProposalBlock] Rendering ProposalFlowView (docType is flow)");
|
|
7338
7300
|
return /* @__PURE__ */ React94.createElement(ProposalFlowView, { block, editor });
|
|
7339
7301
|
}
|
|
7340
7302
|
|
|
@@ -7641,37 +7603,27 @@ function getNestedValue(obj, path) {
|
|
|
7641
7603
|
}
|
|
7642
7604
|
function resolveSingleReference(blockId, propPath, editorDocument) {
|
|
7643
7605
|
if (!editorDocument || !Array.isArray(editorDocument)) {
|
|
7644
|
-
console.warn("Invalid editor document provided to resolveSingleReference");
|
|
7645
7606
|
return void 0;
|
|
7646
7607
|
}
|
|
7647
7608
|
const block = editorDocument.find((b) => b.id === blockId);
|
|
7648
7609
|
if (!block) {
|
|
7649
|
-
console.warn(`Block not found: ${blockId}`);
|
|
7650
7610
|
return void 0;
|
|
7651
7611
|
}
|
|
7652
7612
|
if (propPath.startsWith("response.")) {
|
|
7653
7613
|
const responseData = block.props.response;
|
|
7654
7614
|
if (!responseData) {
|
|
7655
|
-
console.warn(`No response data in block ${blockId}`);
|
|
7656
7615
|
return void 0;
|
|
7657
7616
|
}
|
|
7658
7617
|
try {
|
|
7659
7618
|
const parsedResponse = typeof responseData === "string" ? JSON.parse(responseData) : responseData;
|
|
7660
7619
|
const innerPath = propPath.substring("response.".length);
|
|
7661
7620
|
const value2 = getNestedValue(parsedResponse, innerPath);
|
|
7662
|
-
if (value2 === void 0) {
|
|
7663
|
-
console.warn(`Property not found in response: ${innerPath} in block ${blockId}`);
|
|
7664
|
-
}
|
|
7665
7621
|
return value2;
|
|
7666
7622
|
} catch (error) {
|
|
7667
|
-
console.warn(`Failed to parse response JSON for block ${blockId}:`, error);
|
|
7668
7623
|
return void 0;
|
|
7669
7624
|
}
|
|
7670
7625
|
}
|
|
7671
7626
|
const value = getNestedValue(block.props, propPath);
|
|
7672
|
-
if (value === void 0) {
|
|
7673
|
-
console.warn(`Property not found: ${propPath} in block ${blockId}`);
|
|
7674
|
-
}
|
|
7675
7627
|
return value;
|
|
7676
7628
|
}
|
|
7677
7629
|
function resolveReferences(input, editorDocument, options = {}) {
|
|
@@ -8225,7 +8177,7 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
8225
8177
|
return "gray";
|
|
8226
8178
|
}
|
|
8227
8179
|
};
|
|
8228
|
-
const
|
|
8180
|
+
const getStatusColor2 = (status2) => {
|
|
8229
8181
|
switch (status2) {
|
|
8230
8182
|
case "success":
|
|
8231
8183
|
return "green";
|
|
@@ -8280,7 +8232,6 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
8280
8232
|
if (schema && schema.fields.length > 0) {
|
|
8281
8233
|
const errors = validateResponseAgainstSchema(responseData, schema);
|
|
8282
8234
|
if (errors.length > 0) {
|
|
8283
|
-
console.warn("Response validation warnings:", errors);
|
|
8284
8235
|
setValidationWarnings(errors);
|
|
8285
8236
|
setShowDetails(true);
|
|
8286
8237
|
} else {
|
|
@@ -8325,7 +8276,7 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
8325
8276
|
},
|
|
8326
8277
|
isLoading ? "Sending..." : "Execute"
|
|
8327
8278
|
);
|
|
8328
|
-
return /* @__PURE__ */ React102.createElement(BaseContainer, null, /* @__PURE__ */ React102.createElement(Stack74, { gap: "md" }, /* @__PURE__ */ React102.createElement(Group30, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React102.createElement(Group30, { wrap: "nowrap", align: "flex-start", style: { flex: 1 } }, getIcon("square-check", block.props.icon), /* @__PURE__ */ React102.createElement(Stack74, { gap: "xs", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React102.createElement(Group30, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React102.createElement(Badge13, { size: "sm", variant: "filled", color: getMethodColor(method) }, method), /* @__PURE__ */ React102.createElement(Text48, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "API Request"), status !== "idle" && /* @__PURE__ */ React102.createElement(Badge13, { size: "xs", variant: "dot", color:
|
|
8279
|
+
return /* @__PURE__ */ React102.createElement(BaseContainer, null, /* @__PURE__ */ React102.createElement(Stack74, { gap: "md" }, /* @__PURE__ */ React102.createElement(Group30, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React102.createElement(Group30, { wrap: "nowrap", align: "flex-start", style: { flex: 1 } }, getIcon("square-check", block.props.icon), /* @__PURE__ */ React102.createElement(Stack74, { gap: "xs", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React102.createElement(Group30, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React102.createElement(Badge13, { size: "sm", variant: "filled", color: getMethodColor(method) }, method), /* @__PURE__ */ React102.createElement(Text48, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "API Request"), status !== "idle" && /* @__PURE__ */ React102.createElement(Badge13, { size: "xs", variant: "dot", color: getStatusColor2(status) }, status)), /* @__PURE__ */ React102.createElement(
|
|
8329
8280
|
Text48,
|
|
8330
8281
|
{
|
|
8331
8282
|
size: "xs",
|
|
@@ -8818,7 +8769,6 @@ var EnumChecklistBlockContent = ({ block, editor }) => {
|
|
|
8818
8769
|
try {
|
|
8819
8770
|
return JSON.parse(block.props.listConfig);
|
|
8820
8771
|
} catch (error) {
|
|
8821
|
-
console.error("Failed to parse listConfig:", error);
|
|
8822
8772
|
return {};
|
|
8823
8773
|
}
|
|
8824
8774
|
}
|
|
@@ -8829,7 +8779,6 @@ var EnumChecklistBlockContent = ({ block, editor }) => {
|
|
|
8829
8779
|
try {
|
|
8830
8780
|
return new Set(JSON.parse(block.props.selectedIds));
|
|
8831
8781
|
} catch (error) {
|
|
8832
|
-
console.error("Failed to parse selectedIds:", error);
|
|
8833
8782
|
return /* @__PURE__ */ new Set();
|
|
8834
8783
|
}
|
|
8835
8784
|
}
|
|
@@ -9374,7 +9323,7 @@ var NotifyFlowView = ({ editor, block, isDisabled }) => {
|
|
|
9374
9323
|
return "gray";
|
|
9375
9324
|
}
|
|
9376
9325
|
};
|
|
9377
|
-
const
|
|
9326
|
+
const getStatusColor2 = (status2) => {
|
|
9378
9327
|
switch (status2) {
|
|
9379
9328
|
case "sent":
|
|
9380
9329
|
return "green";
|
|
@@ -9452,7 +9401,7 @@ var NotifyFlowView = ({ editor, block, isDisabled }) => {
|
|
|
9452
9401
|
},
|
|
9453
9402
|
isLoading ? "Sending..." : status === "sent" ? "Sent" : "Send"
|
|
9454
9403
|
);
|
|
9455
|
-
return /* @__PURE__ */ React115.createElement(BaseContainer, null, /* @__PURE__ */ React115.createElement(Stack83, { gap: "md" }, /* @__PURE__ */ React115.createElement(Group37, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React115.createElement(Group37, { wrap: "nowrap", align: "flex-start", style: { flex: 1 } }, getIcon("bell", block.props.icon), /* @__PURE__ */ React115.createElement(Stack83, { gap: "xs", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React115.createElement(Group37, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React115.createElement(Badge15, { size: "sm", variant: "filled", color: getChannelColor(channel) }, channel.toUpperCase()), /* @__PURE__ */ React115.createElement(Text57, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Notification"), status !== "idle" && /* @__PURE__ */ React115.createElement(Badge15, { size: "xs", variant: "dot", color:
|
|
9404
|
+
return /* @__PURE__ */ React115.createElement(BaseContainer, null, /* @__PURE__ */ React115.createElement(Stack83, { gap: "md" }, /* @__PURE__ */ React115.createElement(Group37, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React115.createElement(Group37, { wrap: "nowrap", align: "flex-start", style: { flex: 1 } }, getIcon("bell", block.props.icon), /* @__PURE__ */ React115.createElement(Stack83, { gap: "xs", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React115.createElement(Group37, { gap: "xs", wrap: "nowrap" }, /* @__PURE__ */ React115.createElement(Badge15, { size: "sm", variant: "filled", color: getChannelColor(channel) }, channel.toUpperCase()), /* @__PURE__ */ React115.createElement(Text57, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Notification"), status !== "idle" && /* @__PURE__ */ React115.createElement(Badge15, { size: "xs", variant: "dot", color: getStatusColor2(status) }, status)), /* @__PURE__ */ React115.createElement(Text57, { 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__ */ React115.createElement(Text57, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), /* @__PURE__ */ React115.createElement(Group37, { gap: "xs", style: { flexShrink: 0 } }, disabled && isDisabled?.message ? /* @__PURE__ */ React115.createElement(Tooltip7, { label: isDisabled.message, position: "left", withArrow: true }, sendButton) : sendButton, /* @__PURE__ */ React115.createElement(ActionIcon13, { variant: "subtle", onClick: () => setShowDetails(!showDetails) }, showDetails ? /* @__PURE__ */ React115.createElement(IconChevronUp3, { size: 16 }) : /* @__PURE__ */ React115.createElement(IconChevronDown4, { size: 16 })))), status === "failed" && block.props.errorMessage && /* @__PURE__ */ React115.createElement(Alert12, { color: "red", icon: /* @__PURE__ */ React115.createElement(IconX3, { size: 16 }), title: "Failed to send", styles: { message: { fontSize: "12px" } } }, block.props.errorMessage), status === "sent" && block.props.messageId && /* @__PURE__ */ React115.createElement(Alert12, { color: "green", icon: /* @__PURE__ */ React115.createElement(IconCheck, { size: 16 }), title: "Sent successfully", styles: { message: { fontSize: "12px" } } }, "Message ID: ", block.props.messageId, block.props.sentAt && /* @__PURE__ */ React115.createElement(React115.Fragment, null, /* @__PURE__ */ React115.createElement("br", null), "Sent at: ", new Date(block.props.sentAt).toLocaleString())), /* @__PURE__ */ React115.createElement(Collapse4, { in: showDetails }, /* @__PURE__ */ React115.createElement(Stack83, { gap: "md" }, channel === "email" && /* @__PURE__ */ React115.createElement(React115.Fragment, null, /* @__PURE__ */ React115.createElement(Stack83, { gap: "xs" }, /* @__PURE__ */ React115.createElement(Text57, { size: "xs", fw: 600, c: "dimmed" }, "Recipients:"), /* @__PURE__ */ React115.createElement(Code3, { block: true, style: { fontSize: "11px" } }, JSON.stringify(
|
|
9456
9405
|
{
|
|
9457
9406
|
to: to.filter((e) => e.trim() !== ""),
|
|
9458
9407
|
...cc.length > 0 && { cc: cc.filter((e) => e.trim() !== "") },
|
|
@@ -9565,7 +9514,6 @@ var CollectionSelector = ({
|
|
|
9565
9514
|
onAdminAddressChange,
|
|
9566
9515
|
currentAdminAddress
|
|
9567
9516
|
}) => {
|
|
9568
|
-
console.log("[CollectionSelector] Rendered with selectedCollections:", selectedCollections);
|
|
9569
9517
|
const handlers = useBlocknoteHandlers();
|
|
9570
9518
|
const [localDid, setLocalDid] = useState31(did || "");
|
|
9571
9519
|
const [collections, setCollections] = useState31([]);
|
|
@@ -9596,7 +9544,6 @@ var CollectionSelector = ({
|
|
|
9596
9544
|
setError("No claim collections found for this DID");
|
|
9597
9545
|
}
|
|
9598
9546
|
} catch (err) {
|
|
9599
|
-
console.error("Error fetching claim collections:", err);
|
|
9600
9547
|
setError(err instanceof Error ? err.message : "Failed to fetch claim collections");
|
|
9601
9548
|
setCollections([]);
|
|
9602
9549
|
} finally {
|
|
@@ -9605,14 +9552,11 @@ var CollectionSelector = ({
|
|
|
9605
9552
|
};
|
|
9606
9553
|
const handleToggleCollection = (collectionId) => {
|
|
9607
9554
|
if (!collectionId) return;
|
|
9608
|
-
console.log("[CollectionSelector] Toggle collection:", collectionId);
|
|
9609
|
-
console.log("[CollectionSelector] Current selectedCollections:", selectedCollections);
|
|
9610
9555
|
const currentSelections = selectedCollections || [];
|
|
9611
9556
|
const newSelected = currentSelections.includes(collectionId) ? currentSelections.filter((id) => id !== collectionId) : [...currentSelections, collectionId];
|
|
9612
|
-
console.log("[CollectionSelector] New selectedCollections:", newSelected);
|
|
9613
9557
|
onCollectionsChange(newSelected);
|
|
9614
9558
|
};
|
|
9615
|
-
const
|
|
9559
|
+
const getCollectionName2 = (collection) => {
|
|
9616
9560
|
if (!collection) return "Unnamed Collection";
|
|
9617
9561
|
return collection.protocol?.profile?.name || collection.name || "Unnamed Collection";
|
|
9618
9562
|
};
|
|
@@ -9633,7 +9577,7 @@ var CollectionSelector = ({
|
|
|
9633
9577
|
Checkbox10,
|
|
9634
9578
|
{
|
|
9635
9579
|
key: collection.id,
|
|
9636
|
-
label: /* @__PURE__ */ React118.createElement(Stack84, { gap: 2 }, /* @__PURE__ */ React118.createElement(Text58, { size: "sm", fw: 500 },
|
|
9580
|
+
label: /* @__PURE__ */ React118.createElement(Stack84, { gap: 2 }, /* @__PURE__ */ React118.createElement(Text58, { size: "sm", fw: 500 }, getCollectionName2(collection)), /* @__PURE__ */ React118.createElement(Text58, { size: "xs", c: "dimmed", style: { fontFamily: "monospace" } }, "ID: ", collection.id), collection.description && /* @__PURE__ */ React118.createElement(Text58, { size: "xs", c: "dimmed" }, collection.description)),
|
|
9637
9581
|
checked: selectedCollections?.includes(collection.id) ?? false,
|
|
9638
9582
|
onChange: () => handleToggleCollection(collection.id)
|
|
9639
9583
|
}
|
|
@@ -9671,9 +9615,7 @@ var GeneralTab6 = ({
|
|
|
9671
9615
|
}, [selectedCollections]);
|
|
9672
9616
|
const handleCollectionsChange = useCallback20(
|
|
9673
9617
|
(collections) => {
|
|
9674
|
-
console.log("[Claim GeneralTab] handleCollectionsChange called with:", collections);
|
|
9675
9618
|
const stringified = JSON.stringify(collections || []);
|
|
9676
|
-
console.log("[Claim GeneralTab] Stringified:", stringified);
|
|
9677
9619
|
onSelectedCollectionsChange(stringified);
|
|
9678
9620
|
},
|
|
9679
9621
|
[onSelectedCollectionsChange]
|
|
@@ -9729,7 +9671,6 @@ var TemplateConfig6 = ({ editor, block }) => {
|
|
|
9729
9671
|
const { closePanel } = usePanelStore();
|
|
9730
9672
|
const updateProp = useCallback21(
|
|
9731
9673
|
(key, value) => {
|
|
9732
|
-
console.log("[Claim TemplateConfig] Updating prop:", key, value);
|
|
9733
9674
|
editor.updateBlock(block, {
|
|
9734
9675
|
props: {
|
|
9735
9676
|
...block.props,
|
|
@@ -9803,16 +9744,178 @@ var ClaimTemplateView = ({ editor, block }) => {
|
|
|
9803
9744
|
};
|
|
9804
9745
|
|
|
9805
9746
|
// src/mantine/blocks/claim/flow/FlowView.tsx
|
|
9806
|
-
import React124, {
|
|
9747
|
+
import React124, { useMemo as useMemo25 } from "react";
|
|
9807
9748
|
import { Stack as Stack88, Text as Text62, Loader as Loader11, Center as Center5, Alert as Alert15, Title as Title11, Flex as Flex22, ActionIcon as ActionIcon16 } from "@mantine/core";
|
|
9749
|
+
|
|
9750
|
+
// src/mantine/hooks/useCurrentUser.ts
|
|
9751
|
+
import { useState as useState33, useEffect as useEffect22, useRef as useRef4 } from "react";
|
|
9752
|
+
function useCurrentUser() {
|
|
9753
|
+
const { getCurrentUser } = useBlocknoteHandlers();
|
|
9754
|
+
const getCurrentUserRef = useRef4(getCurrentUser);
|
|
9755
|
+
useEffect22(() => {
|
|
9756
|
+
getCurrentUserRef.current = getCurrentUser;
|
|
9757
|
+
}, [getCurrentUser]);
|
|
9758
|
+
const [userAddress, setUserAddress] = useState33("");
|
|
9759
|
+
useEffect22(() => {
|
|
9760
|
+
const fetchUserAddress = () => {
|
|
9761
|
+
try {
|
|
9762
|
+
const user = getCurrentUserRef.current();
|
|
9763
|
+
setUserAddress(user?.address || "");
|
|
9764
|
+
} catch (err) {
|
|
9765
|
+
setUserAddress("");
|
|
9766
|
+
}
|
|
9767
|
+
};
|
|
9768
|
+
fetchUserAddress();
|
|
9769
|
+
}, []);
|
|
9770
|
+
return userAddress;
|
|
9771
|
+
}
|
|
9772
|
+
|
|
9773
|
+
// src/mantine/hooks/useCollections.ts
|
|
9774
|
+
import { useState as useState34, useEffect as useEffect23, useCallback as useCallback22, useRef as useRef5, useMemo as useMemo21 } from "react";
|
|
9775
|
+
function useCollections(did, selectedCollectionIds, block, editor) {
|
|
9776
|
+
const { getClaimCollections } = useBlocknoteHandlers();
|
|
9777
|
+
const getClaimCollectionsRef = useRef5(getClaimCollections);
|
|
9778
|
+
useEffect23(() => {
|
|
9779
|
+
getClaimCollectionsRef.current = getClaimCollections;
|
|
9780
|
+
}, [getClaimCollections]);
|
|
9781
|
+
const [collections, setCollections] = useState34([]);
|
|
9782
|
+
const [loading, setLoading] = useState34(false);
|
|
9783
|
+
const [error, setError] = useState34(null);
|
|
9784
|
+
const adminAddressUpdatedRef = useRef5(false);
|
|
9785
|
+
const selectedCollectionIdsStr = useMemo21(() => JSON.stringify(selectedCollectionIds.sort()), [selectedCollectionIds]);
|
|
9786
|
+
const fetchCollections = useCallback22(async () => {
|
|
9787
|
+
if (!did || selectedCollectionIds.length === 0) {
|
|
9788
|
+
setCollections([]);
|
|
9789
|
+
return;
|
|
9790
|
+
}
|
|
9791
|
+
if (loading) {
|
|
9792
|
+
return;
|
|
9793
|
+
}
|
|
9794
|
+
setLoading(true);
|
|
9795
|
+
setError(null);
|
|
9796
|
+
try {
|
|
9797
|
+
const response = await getClaimCollectionsRef.current({ deedDid: did });
|
|
9798
|
+
const { adminAddress: fetchedAdminAddress = "", collections: allCollections = [] } = response || {};
|
|
9799
|
+
const currentAdminAddress = block.props.adminAddress || "";
|
|
9800
|
+
if (fetchedAdminAddress && !currentAdminAddress && !adminAddressUpdatedRef.current) {
|
|
9801
|
+
adminAddressUpdatedRef.current = true;
|
|
9802
|
+
editor.updateBlock(block, {
|
|
9803
|
+
props: {
|
|
9804
|
+
...block.props,
|
|
9805
|
+
adminAddress: fetchedAdminAddress
|
|
9806
|
+
}
|
|
9807
|
+
});
|
|
9808
|
+
}
|
|
9809
|
+
const selectedCollections = Array.isArray(allCollections) ? allCollections.filter((c) => c && selectedCollectionIds.includes(c.id)) : [];
|
|
9810
|
+
setCollections(selectedCollections);
|
|
9811
|
+
} catch (err) {
|
|
9812
|
+
setError(err instanceof Error ? err.message : "Failed to fetch collections");
|
|
9813
|
+
setCollections([]);
|
|
9814
|
+
} finally {
|
|
9815
|
+
setLoading(false);
|
|
9816
|
+
}
|
|
9817
|
+
}, [did, selectedCollectionIdsStr]);
|
|
9818
|
+
useEffect23(() => {
|
|
9819
|
+
fetchCollections();
|
|
9820
|
+
}, [fetchCollections]);
|
|
9821
|
+
return { collections, loading, error, refetch: fetchCollections };
|
|
9822
|
+
}
|
|
9823
|
+
|
|
9824
|
+
// src/mantine/blocks/claim/flow/FlowView.tsx
|
|
9808
9825
|
import { IconSettings as IconSettings3, IconRefresh as IconRefresh2, IconAlertCircle as IconAlertCircle3 } from "@tabler/icons-react";
|
|
9809
9826
|
|
|
9810
9827
|
// src/mantine/blocks/claim/flow/ClaimCollectionsList.tsx
|
|
9811
|
-
import React123, { useMemo as
|
|
9828
|
+
import React123, { useMemo as useMemo24 } from "react";
|
|
9812
9829
|
import { Stack as Stack87, Text as Text61, ActionIcon as ActionIcon15, Tooltip as Tooltip8, Loader as Loader10, Center as Center4 } from "@mantine/core";
|
|
9813
9830
|
|
|
9831
|
+
// src/mantine/hooks/useUserRoles.ts
|
|
9832
|
+
import { useState as useState35, useEffect as useEffect24, useMemo as useMemo22, useRef as useRef6 } from "react";
|
|
9833
|
+
|
|
9834
|
+
// src/mantine/hooks/utils.ts
|
|
9835
|
+
function isClientFulfillmentError(error) {
|
|
9836
|
+
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
9837
|
+
return /client(?:.+)?(cannot|can't).+fulfil?/i.test(message);
|
|
9838
|
+
}
|
|
9839
|
+
|
|
9840
|
+
// src/mantine/hooks/useUserRoles.ts
|
|
9841
|
+
function useUserRoles(collections, userAddress, adminAddress, deedId) {
|
|
9842
|
+
const { getUserRoles } = useBlocknoteHandlers();
|
|
9843
|
+
const getUserRolesRef = useRef6(getUserRoles);
|
|
9844
|
+
useEffect24(() => {
|
|
9845
|
+
getUserRolesRef.current = getUserRoles;
|
|
9846
|
+
}, [getUserRoles]);
|
|
9847
|
+
const [userRoles, setUserRoles] = useState35({});
|
|
9848
|
+
const [loading, setLoading] = useState35(true);
|
|
9849
|
+
const failedRequestKeyRef = useRef6(null);
|
|
9850
|
+
const collectionIdsKey = useMemo22(
|
|
9851
|
+
() => collections.map((c) => c.id).sort().join("|"),
|
|
9852
|
+
[collections]
|
|
9853
|
+
);
|
|
9854
|
+
const requestKey = useMemo22(() => [userAddress, adminAddress, deedId, collectionIdsKey].filter(Boolean).join("|"), [userAddress, adminAddress, deedId, collectionIdsKey]);
|
|
9855
|
+
useEffect24(() => {
|
|
9856
|
+
let isMounted = true;
|
|
9857
|
+
const setEmptyRoles = () => {
|
|
9858
|
+
const rolesMap = {};
|
|
9859
|
+
collections.forEach((collection) => {
|
|
9860
|
+
rolesMap[collection.id] = null;
|
|
9861
|
+
});
|
|
9862
|
+
if (isMounted) {
|
|
9863
|
+
setUserRoles(rolesMap);
|
|
9864
|
+
}
|
|
9865
|
+
};
|
|
9866
|
+
const fetchUserRoles = async () => {
|
|
9867
|
+
if (!collections || collections.length === 0 || !userAddress || !adminAddress) {
|
|
9868
|
+
setLoading(false);
|
|
9869
|
+
return;
|
|
9870
|
+
}
|
|
9871
|
+
if (!requestKey || failedRequestKeyRef.current === requestKey) {
|
|
9872
|
+
setLoading(false);
|
|
9873
|
+
return;
|
|
9874
|
+
}
|
|
9875
|
+
const getUserRolesFn = getUserRolesRef.current;
|
|
9876
|
+
if (typeof getUserRolesFn !== "function") {
|
|
9877
|
+
setEmptyRoles();
|
|
9878
|
+
setLoading(false);
|
|
9879
|
+
return;
|
|
9880
|
+
}
|
|
9881
|
+
try {
|
|
9882
|
+
setLoading(true);
|
|
9883
|
+
const collectionIds = collections.map((c) => c.id);
|
|
9884
|
+
const roles = await getUserRolesFn({
|
|
9885
|
+
userAddress,
|
|
9886
|
+
adminAddress,
|
|
9887
|
+
deedDid: deedId,
|
|
9888
|
+
collectionIds
|
|
9889
|
+
});
|
|
9890
|
+
const rolesMap = {};
|
|
9891
|
+
collections.forEach((collection) => {
|
|
9892
|
+
const roleData = roles?.find((r) => r.collectionId === collection.id);
|
|
9893
|
+
rolesMap[collection.id] = roleData?.role || null;
|
|
9894
|
+
});
|
|
9895
|
+
setUserRoles(rolesMap);
|
|
9896
|
+
} catch (error) {
|
|
9897
|
+
if (isClientFulfillmentError(error)) {
|
|
9898
|
+
failedRequestKeyRef.current = requestKey;
|
|
9899
|
+
} else {
|
|
9900
|
+
failedRequestKeyRef.current = null;
|
|
9901
|
+
}
|
|
9902
|
+
setEmptyRoles();
|
|
9903
|
+
} finally {
|
|
9904
|
+
if (isMounted) {
|
|
9905
|
+
setLoading(false);
|
|
9906
|
+
}
|
|
9907
|
+
}
|
|
9908
|
+
};
|
|
9909
|
+
fetchUserRoles();
|
|
9910
|
+
return () => {
|
|
9911
|
+
isMounted = false;
|
|
9912
|
+
};
|
|
9913
|
+
}, [collections, userAddress, adminAddress, deedId, requestKey]);
|
|
9914
|
+
return { userRoles, loading };
|
|
9915
|
+
}
|
|
9916
|
+
|
|
9814
9917
|
// src/mantine/blocks/claim/flow/ClaimsListSheet.tsx
|
|
9815
|
-
import React122, { useState as
|
|
9918
|
+
import React122, { useState as useState36, useEffect as useEffect25, useCallback as useCallback23, useMemo as useMemo23 } from "react";
|
|
9816
9919
|
import { CloseButton as CloseButton9, Title as Title10, Loader as Loader9, Stack as Stack86, Text as Text60, Button as Button28, ActionIcon as ActionIcon14, Alert as Alert14 } from "@mantine/core";
|
|
9817
9920
|
import { IconArrowLeft as IconArrowLeft2, IconAlertCircle as IconAlertCircle2 } from "@tabler/icons-react";
|
|
9818
9921
|
import { Survey, SurveyModel } from "@ixo/surveys";
|
|
@@ -9980,14 +10083,16 @@ var surveyTheme = {
|
|
|
9980
10083
|
var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, userAddress, onSubmitComplete }) => {
|
|
9981
10084
|
const { closePanel } = usePanelStore();
|
|
9982
10085
|
const handlers = useBlocknoteHandlers();
|
|
9983
|
-
const [viewMode, setViewMode] =
|
|
9984
|
-
const [claims, setClaims] =
|
|
9985
|
-
const [loading, setLoading] =
|
|
9986
|
-
const [error, setError] =
|
|
9987
|
-
const [surveyJson, setSurveyJson] =
|
|
9988
|
-
const [surveyLoading, setSurveyLoading] =
|
|
9989
|
-
const [surveyError, setSurveyError] =
|
|
9990
|
-
|
|
10086
|
+
const [viewMode, setViewMode] = useState36("list");
|
|
10087
|
+
const [claims, setClaims] = useState36([]);
|
|
10088
|
+
const [loading, setLoading] = useState36(true);
|
|
10089
|
+
const [error, setError] = useState36(null);
|
|
10090
|
+
const [surveyJson, setSurveyJson] = useState36(null);
|
|
10091
|
+
const [surveyLoading, setSurveyLoading] = useState36(false);
|
|
10092
|
+
const [surveyError, setSurveyError] = useState36(null);
|
|
10093
|
+
console.log("[ClaimsListSheet] render", { collectionId, collectionName, deedId, adminAddress, userAddress, viewMode });
|
|
10094
|
+
const fetchClaims = useCallback23(async () => {
|
|
10095
|
+
console.log("[ClaimsListSheet] fetchClaims start", { collectionId, userAddress });
|
|
9991
10096
|
try {
|
|
9992
10097
|
setLoading(true);
|
|
9993
10098
|
setError(null);
|
|
@@ -9995,36 +10100,51 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
9995
10100
|
collectionId,
|
|
9996
10101
|
userAddress
|
|
9997
10102
|
});
|
|
9998
|
-
|
|
10103
|
+
console.log("[ClaimsListSheet] fetchClaims result", result);
|
|
10104
|
+
if (!result) {
|
|
10105
|
+
alert("Error in ClaimsListSheet.tsx:37 - getClaimsPerUserAddress() returned no data");
|
|
10106
|
+
}
|
|
10107
|
+
setClaims(Array.isArray(result) ? result : []);
|
|
9999
10108
|
} catch (err) {
|
|
10000
|
-
|
|
10001
|
-
|
|
10109
|
+
const errorMsg = err instanceof Error ? err.message : "Failed to fetch claims";
|
|
10110
|
+
alert(`Error in ClaimsListSheet.tsx:37 - getClaimsPerUserAddress() failed: ${errorMsg}`);
|
|
10111
|
+
setError(errorMsg);
|
|
10002
10112
|
setClaims([]);
|
|
10003
10113
|
} finally {
|
|
10004
10114
|
setLoading(false);
|
|
10005
10115
|
}
|
|
10006
|
-
}, [collectionId, userAddress
|
|
10007
|
-
const fetchSurveyTemplate =
|
|
10116
|
+
}, [collectionId, userAddress]);
|
|
10117
|
+
const fetchSurveyTemplate = useCallback23(async () => {
|
|
10118
|
+
console.log("[ClaimsListSheet] fetchSurveyTemplate start", { deedId });
|
|
10008
10119
|
try {
|
|
10009
10120
|
setSurveyLoading(true);
|
|
10010
10121
|
setSurveyError(null);
|
|
10011
10122
|
const result = await handlers.getDeedSurveyTemplate(deedId);
|
|
10012
|
-
|
|
10123
|
+
console.log("[ClaimsListSheet] fetchSurveyTemplate result", result);
|
|
10124
|
+
if (!result) {
|
|
10125
|
+
alert("Error in ClaimsListSheet.tsx:65 - getDeedSurveyTemplate() returned no data");
|
|
10126
|
+
setSurveyError("No data returned from getDeedSurveyTemplate");
|
|
10127
|
+
} else if (result?.surveyTemplate) {
|
|
10013
10128
|
setSurveyJson(result.surveyTemplate);
|
|
10014
10129
|
} else {
|
|
10130
|
+
alert("Error in ClaimsListSheet.tsx:65 - getDeedSurveyTemplate() returned data without surveyTemplate");
|
|
10015
10131
|
setSurveyError("No survey template found for this deed");
|
|
10016
10132
|
}
|
|
10017
10133
|
} catch (err) {
|
|
10018
|
-
|
|
10019
|
-
|
|
10134
|
+
const errorMsg = err instanceof Error ? err.message : "Failed to load survey template";
|
|
10135
|
+
alert(`Error in ClaimsListSheet.tsx:65 - getDeedSurveyTemplate() failed: ${errorMsg}`);
|
|
10136
|
+
setSurveyError(errorMsg);
|
|
10137
|
+
setSurveyJson(null);
|
|
10020
10138
|
} finally {
|
|
10021
10139
|
setSurveyLoading(false);
|
|
10022
10140
|
}
|
|
10023
|
-
}, [deedId
|
|
10024
|
-
|
|
10141
|
+
}, [deedId]);
|
|
10142
|
+
useEffect25(() => {
|
|
10143
|
+
console.log("[ClaimsListSheet] useEffect fetchClaims");
|
|
10025
10144
|
fetchClaims();
|
|
10026
10145
|
}, [fetchClaims]);
|
|
10027
|
-
const surveyModel =
|
|
10146
|
+
const surveyModel = useMemo23(() => {
|
|
10147
|
+
console.log("[ClaimsListSheet] surveyModel useMemo", { hasSurveyJson: !!surveyJson });
|
|
10028
10148
|
if (!surveyJson) return null;
|
|
10029
10149
|
const model = new SurveyModel(surveyJson);
|
|
10030
10150
|
model.applyTheme(surveyTheme);
|
|
@@ -10032,19 +10152,30 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
10032
10152
|
model.questionsOnPageMode = "singlePage";
|
|
10033
10153
|
return model;
|
|
10034
10154
|
}, [surveyJson]);
|
|
10035
|
-
const handleSurveyComplete =
|
|
10155
|
+
const handleSurveyComplete = useCallback23(
|
|
10036
10156
|
async (sender) => {
|
|
10157
|
+
console.log("[ClaimsListSheet] handleSurveyComplete fired", { data: sender?.data });
|
|
10037
10158
|
const surveyData = sender.data;
|
|
10038
|
-
console.log("Survey completed:", surveyData);
|
|
10039
10159
|
try {
|
|
10040
10160
|
const pin = await handlers.requestPin({
|
|
10041
10161
|
title: "Verify Identity",
|
|
10042
10162
|
description: "Enter your PIN to submit the claim",
|
|
10043
10163
|
submitText: "Verify"
|
|
10044
10164
|
});
|
|
10165
|
+
console.log("[ClaimsListSheet] requestPin resolved", { hasPin: !!pin });
|
|
10166
|
+
if (!pin) {
|
|
10167
|
+
alert("Error in ClaimsListSheet.tsx:107 - requestPin() returned no data");
|
|
10168
|
+
throw new Error("No PIN provided");
|
|
10169
|
+
}
|
|
10045
10170
|
if (!adminAddress) {
|
|
10046
10171
|
throw new Error("Admin address is not set. Please configure the claim block first.");
|
|
10047
10172
|
}
|
|
10173
|
+
console.log("[ClaimsListSheet] submitClaim payload", {
|
|
10174
|
+
deedId,
|
|
10175
|
+
collectionId,
|
|
10176
|
+
adminAddress,
|
|
10177
|
+
surveyDataKeys: Object.keys(surveyData || {})
|
|
10178
|
+
});
|
|
10048
10179
|
const result = await handlers.submitClaim({
|
|
10049
10180
|
surveyData,
|
|
10050
10181
|
deedDid: deedId,
|
|
@@ -10052,37 +10183,58 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
10052
10183
|
adminAddress,
|
|
10053
10184
|
pin
|
|
10054
10185
|
});
|
|
10055
|
-
console.log("
|
|
10186
|
+
console.log("[ClaimsListSheet] submitClaim result", result);
|
|
10187
|
+
if (!result) {
|
|
10188
|
+
alert("Error in ClaimsListSheet.tsx:119 - submitClaim() returned no data");
|
|
10189
|
+
throw new Error("No result returned from submitClaim");
|
|
10190
|
+
}
|
|
10056
10191
|
closePanel();
|
|
10057
10192
|
onSubmitComplete?.();
|
|
10058
10193
|
} catch (error2) {
|
|
10059
|
-
|
|
10060
|
-
|
|
10194
|
+
const errorMsg = error2 instanceof Error ? error2.message : "Failed to submit claim";
|
|
10195
|
+
if (error2 instanceof Error && error2.message === "No PIN provided") {
|
|
10196
|
+
} else if (error2 instanceof Error && error2.message === "No result returned from submitClaim") {
|
|
10197
|
+
} else if (error2 instanceof Error && error2.message.includes("requestPin")) {
|
|
10198
|
+
alert(`Error in ClaimsListSheet.tsx:107 - requestPin() failed: ${errorMsg}`);
|
|
10199
|
+
} else if (error2 instanceof Error && error2.message.includes("submitClaim")) {
|
|
10200
|
+
alert(`Error in ClaimsListSheet.tsx:119 - submitClaim() failed: ${errorMsg}`);
|
|
10201
|
+
} else {
|
|
10202
|
+
alert(`Error in ClaimsListSheet.tsx:107-119 - Handler failed: ${errorMsg}`);
|
|
10203
|
+
}
|
|
10204
|
+
console.error("[ClaimsListSheet] handleSurveyComplete error", error2);
|
|
10205
|
+
setSurveyError(errorMsg);
|
|
10061
10206
|
}
|
|
10062
10207
|
},
|
|
10063
10208
|
[handlers, deedId, collectionId, adminAddress, closePanel, onSubmitComplete]
|
|
10064
10209
|
);
|
|
10065
|
-
|
|
10210
|
+
useEffect25(() => {
|
|
10066
10211
|
if (surveyModel) {
|
|
10212
|
+
console.log("[ClaimsListSheet] register surveyModel.onComplete listener");
|
|
10067
10213
|
surveyModel.onComplete.add(handleSurveyComplete);
|
|
10068
10214
|
return () => {
|
|
10215
|
+
console.log("[ClaimsListSheet] cleanup surveyModel.onComplete listener");
|
|
10069
10216
|
surveyModel.onComplete.remove(handleSurveyComplete);
|
|
10070
10217
|
};
|
|
10071
10218
|
}
|
|
10072
10219
|
return void 0;
|
|
10073
10220
|
}, [surveyModel, handleSurveyComplete]);
|
|
10074
10221
|
const handleNewClaim = () => {
|
|
10222
|
+
console.log("[ClaimsListSheet] handleNewClaim", { hasSurveyJson: !!surveyJson });
|
|
10075
10223
|
if (!surveyJson) {
|
|
10076
10224
|
fetchSurveyTemplate();
|
|
10077
10225
|
}
|
|
10078
10226
|
setViewMode("survey");
|
|
10079
10227
|
};
|
|
10080
10228
|
const handleBackToList = () => {
|
|
10229
|
+
console.log("[ClaimsListSheet] handleBackToList");
|
|
10081
10230
|
setViewMode("list");
|
|
10082
10231
|
setSurveyError(null);
|
|
10083
10232
|
fetchClaims();
|
|
10084
10233
|
};
|
|
10085
10234
|
const getClaimStatus = (paymentsStatus) => {
|
|
10235
|
+
if (!paymentsStatus) {
|
|
10236
|
+
return "pending";
|
|
10237
|
+
}
|
|
10086
10238
|
if (paymentsStatus.approval === "PAID") {
|
|
10087
10239
|
return "approved";
|
|
10088
10240
|
}
|
|
@@ -10091,7 +10243,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
10091
10243
|
}
|
|
10092
10244
|
return "pending";
|
|
10093
10245
|
};
|
|
10094
|
-
const
|
|
10246
|
+
const getStatusColor2 = (status) => {
|
|
10095
10247
|
switch (status) {
|
|
10096
10248
|
case "approved":
|
|
10097
10249
|
return "green";
|
|
@@ -10102,7 +10254,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
10102
10254
|
return "yellow";
|
|
10103
10255
|
}
|
|
10104
10256
|
};
|
|
10105
|
-
const
|
|
10257
|
+
const formatDate2 = (dateString) => {
|
|
10106
10258
|
try {
|
|
10107
10259
|
return new Date(dateString).toLocaleDateString();
|
|
10108
10260
|
} catch {
|
|
@@ -10161,7 +10313,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
10161
10313
|
},
|
|
10162
10314
|
/* @__PURE__ */ React122.createElement(Stack86, { gap: "md", style: { flex: 1 } }, /* @__PURE__ */ React122.createElement(Button28, { onClick: handleNewClaim, fullWidth: true }, "New Claim"), loading ? /* @__PURE__ */ React122.createElement(Stack86, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React122.createElement(Loader9, { size: "lg" }), /* @__PURE__ */ React122.createElement(Text60, { size: "sm", c: "dimmed" }, "Loading claims...")) : error ? /* @__PURE__ */ React122.createElement(Alert14, { color: "red", title: "Failed to load claims", icon: /* @__PURE__ */ React122.createElement(IconAlertCircle2, { size: 18 }) }, /* @__PURE__ */ React122.createElement(Text60, { size: "sm" }, error)) : claims.length === 0 ? /* @__PURE__ */ React122.createElement(Stack86, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React122.createElement(Text60, { size: "sm", c: "dimmed", ta: "center" }, 'No claims found. Click "New Claim" to submit your first claim.')) : /* @__PURE__ */ React122.createElement(Stack86, { gap: "xs" }, claims.map((claim) => {
|
|
10163
10315
|
const status = getClaimStatus(claim.paymentsStatus);
|
|
10164
|
-
return /* @__PURE__ */ React122.createElement(ListItemContainer, { key: claim.claimId }, /* @__PURE__ */ React122.createElement(Stack86, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React122.createElement(Text60, { size: "sm", fw: 500 }, "Claim #", claim.claimId.slice(-8)), /* @__PURE__ */ React122.createElement(Text60, { size: "xs", c: "dimmed" }, "Submitted: ",
|
|
10316
|
+
return /* @__PURE__ */ React122.createElement(ListItemContainer, { key: claim.claimId }, /* @__PURE__ */ React122.createElement(Stack86, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React122.createElement(Text60, { size: "sm", fw: 500 }, "Claim #", claim.claimId.slice(-8)), /* @__PURE__ */ React122.createElement(Text60, { size: "xs", c: "dimmed" }, "Submitted: ", formatDate2(claim.submissionDate))), /* @__PURE__ */ React122.createElement(Text60, { size: "xs", fw: 500, c: getStatusColor2(status) }, status.toUpperCase()));
|
|
10165
10317
|
})))
|
|
10166
10318
|
),
|
|
10167
10319
|
/* @__PURE__ */ React122.createElement(
|
|
@@ -10191,17 +10343,32 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
10191
10343
|
// src/mantine/blocks/claim/flow/ClaimCollectionsList.tsx
|
|
10192
10344
|
import { IconArrowRight as IconArrowRight2 } from "@tabler/icons-react";
|
|
10193
10345
|
var CollectionItem = ({ collection, deedId, adminAddress, userRole, onRefresh }) => {
|
|
10194
|
-
|
|
10195
|
-
const
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10346
|
+
console.log("[CollectionItem] RENDER START", { collectionId: collection.id, userRole });
|
|
10347
|
+
const { getCurrentUser } = useBlocknoteHandlers();
|
|
10348
|
+
let currentUser;
|
|
10349
|
+
try {
|
|
10350
|
+
console.log("[CollectionItem] Calling getCurrentUser...");
|
|
10351
|
+
currentUser = getCurrentUser();
|
|
10352
|
+
console.log("[CollectionItem] getCurrentUser result:", currentUser);
|
|
10353
|
+
if (!currentUser) {
|
|
10354
|
+
alert("Error in ClaimCollectionsList.tsx:31 - getCurrentUser() returned no data");
|
|
10355
|
+
currentUser = { address: "" };
|
|
10356
|
+
}
|
|
10357
|
+
} catch (err) {
|
|
10358
|
+
console.log("[CollectionItem] getCurrentUser ERROR:", err);
|
|
10359
|
+
alert(`Error in ClaimCollectionsList.tsx:31 - getCurrentUser() failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
10360
|
+
currentUser = { address: "" };
|
|
10361
|
+
}
|
|
10362
|
+
const getCollectionName2 = (collection2) => collection2.protocol?.profile?.name || collection2.name || "Unnamed Collection";
|
|
10199
10363
|
const isServiceAgent = userRole === "SA" /* ServiceProvider */;
|
|
10200
10364
|
const canAccessClaims = isServiceAgent;
|
|
10201
10365
|
const claimsPanelId = `claims-list-${collection.id}`;
|
|
10202
|
-
const collectionName =
|
|
10203
|
-
|
|
10204
|
-
|
|
10366
|
+
const collectionName = getCollectionName2(collection);
|
|
10367
|
+
console.log("[CollectionItem] Panel setup", { claimsPanelId, collectionName, canAccessClaims });
|
|
10368
|
+
console.log("[CollectionItem] Creating claimsPanelContent useMemo...");
|
|
10369
|
+
const claimsPanelContent = useMemo24(() => {
|
|
10370
|
+
console.log("[CollectionItem] claimsPanelContent useMemo EXECUTING", { collectionId: collection.id });
|
|
10371
|
+
return /* @__PURE__ */ React123.createElement(
|
|
10205
10372
|
ClaimsListSheet,
|
|
10206
10373
|
{
|
|
10207
10374
|
collectionId: collection.id,
|
|
@@ -10211,56 +10378,23 @@ var CollectionItem = ({ collection, deedId, adminAddress, userRole, onRefresh })
|
|
|
10211
10378
|
userAddress: currentUser.address,
|
|
10212
10379
|
onSubmitComplete: onRefresh
|
|
10213
10380
|
}
|
|
10214
|
-
)
|
|
10215
|
-
|
|
10216
|
-
);
|
|
10381
|
+
);
|
|
10382
|
+
}, [collection.id, collectionName, deedId, adminAddress, currentUser.address, onRefresh]);
|
|
10383
|
+
console.log("[CollectionItem] Calling usePanel with panelId:", claimsPanelId);
|
|
10217
10384
|
const { open: openClaimsPanel } = usePanel(claimsPanelId, claimsPanelContent);
|
|
10385
|
+
console.log("[CollectionItem] usePanel returned");
|
|
10218
10386
|
const handleClick = () => {
|
|
10387
|
+
console.log("[CollectionItem] handleClick called", { canAccessClaims });
|
|
10219
10388
|
if (canAccessClaims) {
|
|
10389
|
+
console.log("[CollectionItem] Opening claims panel...");
|
|
10220
10390
|
openClaimsPanel();
|
|
10221
10391
|
}
|
|
10222
10392
|
};
|
|
10223
|
-
return /* @__PURE__ */ React123.createElement("div", { style: { opacity: canAccessClaims ? 1 : 0.5 } }, /* @__PURE__ */ React123.createElement(ListItemContainer, null, /* @__PURE__ */ React123.createElement(Stack87, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React123.createElement(Text61, { size: "sm", fw: 500, c: canAccessClaims ? void 0 : "dimmed" },
|
|
10393
|
+
return /* @__PURE__ */ React123.createElement("div", { style: { opacity: canAccessClaims ? 1 : 0.5 } }, /* @__PURE__ */ React123.createElement(ListItemContainer, null, /* @__PURE__ */ React123.createElement(Stack87, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React123.createElement(Text61, { size: "sm", fw: 500, c: canAccessClaims ? void 0 : "dimmed" }, collectionName), collection.description && /* @__PURE__ */ React123.createElement(Text61, { size: "xs", c: "dimmed" }, collection.description)), /* @__PURE__ */ React123.createElement(Tooltip8, { label: "You need to apply to be a service agent first", disabled: canAccessClaims, position: "left", withArrow: true }, /* @__PURE__ */ React123.createElement(ActionIcon15, { variant: "subtle", size: "lg", onClick: handleClick, disabled: !canAccessClaims, style: { cursor: canAccessClaims ? "pointer" : "not-allowed" } }, /* @__PURE__ */ React123.createElement(IconArrowRight2, { size: 20 })))));
|
|
10224
10394
|
};
|
|
10225
10395
|
var ClaimCollectionsList = ({ collections, deedId, adminAddress, userAddress, onRefresh }) => {
|
|
10226
|
-
const
|
|
10227
|
-
|
|
10228
|
-
const [loadingRoles, setLoadingRoles] = useState34(true);
|
|
10229
|
-
useEffect23(() => {
|
|
10230
|
-
const fetchUserRoles = async () => {
|
|
10231
|
-
if (!collections || collections.length === 0 || !userAddress || !adminAddress) {
|
|
10232
|
-
setLoadingRoles(false);
|
|
10233
|
-
return;
|
|
10234
|
-
}
|
|
10235
|
-
try {
|
|
10236
|
-
setLoadingRoles(true);
|
|
10237
|
-
const collectionIds = collections.map((c) => c.id);
|
|
10238
|
-
const roles = await handlers.getUserRoles({
|
|
10239
|
-
userAddress,
|
|
10240
|
-
adminAddress,
|
|
10241
|
-
deedDid: deedId,
|
|
10242
|
-
collectionIds
|
|
10243
|
-
});
|
|
10244
|
-
const rolesMap = {};
|
|
10245
|
-
collections.forEach((collection) => {
|
|
10246
|
-
const roleData = roles?.find((r) => r.collectionId === collection.id);
|
|
10247
|
-
rolesMap[collection.id] = roleData?.role || null;
|
|
10248
|
-
});
|
|
10249
|
-
setUserRoles(rolesMap);
|
|
10250
|
-
} catch (error) {
|
|
10251
|
-
console.error("Error fetching user roles:", error);
|
|
10252
|
-
const rolesMap = {};
|
|
10253
|
-
collections.forEach((collection) => {
|
|
10254
|
-
rolesMap[collection.id] = null;
|
|
10255
|
-
});
|
|
10256
|
-
setUserRoles(rolesMap);
|
|
10257
|
-
} finally {
|
|
10258
|
-
setLoadingRoles(false);
|
|
10259
|
-
}
|
|
10260
|
-
};
|
|
10261
|
-
fetchUserRoles();
|
|
10262
|
-
}, [collections, userAddress, adminAddress, handlers, deedId]);
|
|
10263
|
-
if (!collections || collections.length === 0) {
|
|
10396
|
+
const { userRoles, loading: loadingRoles } = useUserRoles(collections, userAddress, adminAddress, deedId);
|
|
10397
|
+
if (!collections?.length) {
|
|
10264
10398
|
return /* @__PURE__ */ React123.createElement(Text61, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No claim collections found");
|
|
10265
10399
|
}
|
|
10266
10400
|
if (loadingRoles) {
|
|
@@ -10273,68 +10407,40 @@ var ClaimCollectionsList = ({ collections, deedId, adminAddress, userAddress, on
|
|
|
10273
10407
|
var CLAIM_FLOW_PANEL_ID = "claim-flow-panel";
|
|
10274
10408
|
var ClaimFlowView = ({ editor, block }) => {
|
|
10275
10409
|
const { editable } = useBlocknoteContext();
|
|
10276
|
-
const
|
|
10277
|
-
const currentUser = handlers.getCurrentUser();
|
|
10278
|
-
const [collections, setCollections] = useState35([]);
|
|
10279
|
-
const [loading, setLoading] = useState35(false);
|
|
10280
|
-
const [error, setError] = useState35(null);
|
|
10410
|
+
const userAddress = useCurrentUser();
|
|
10281
10411
|
const panelId = `${CLAIM_FLOW_PANEL_ID}-${block.id}`;
|
|
10282
|
-
const panelContent =
|
|
10412
|
+
const panelContent = useMemo25(() => /* @__PURE__ */ React124.createElement(TemplateConfig6, { editor, block }), [editor, block]);
|
|
10283
10413
|
const { open } = usePanel(panelId, panelContent);
|
|
10284
|
-
const selectedCollectionIds =
|
|
10414
|
+
const selectedCollectionIds = useMemo25(() => {
|
|
10285
10415
|
try {
|
|
10286
|
-
|
|
10416
|
+
const parsed = JSON.parse(block.props.selectedCollections || "[]");
|
|
10417
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
10287
10418
|
} catch {
|
|
10288
10419
|
return [];
|
|
10289
10420
|
}
|
|
10290
10421
|
}, [block.props.selectedCollections]);
|
|
10291
10422
|
const did = block.props.deedDid;
|
|
10292
10423
|
const adminAddress = block.props.adminAddress || "";
|
|
10293
|
-
const
|
|
10294
|
-
if (!did || selectedCollectionIds.length === 0) {
|
|
10295
|
-
setCollections([]);
|
|
10296
|
-
return;
|
|
10297
|
-
}
|
|
10298
|
-
setLoading(true);
|
|
10299
|
-
setError(null);
|
|
10300
|
-
try {
|
|
10301
|
-
const response = await handlers.getClaimCollections({ deedDid: did });
|
|
10302
|
-
const { adminAddress: adminAddress2, collections: allCollections } = response || { adminAddress: "", collections: [] };
|
|
10303
|
-
if (adminAddress2 && (!block.props.adminAddress || block.props.adminAddress === "")) {
|
|
10304
|
-
editor.updateBlock(block, {
|
|
10305
|
-
props: {
|
|
10306
|
-
...block.props,
|
|
10307
|
-
adminAddress: adminAddress2
|
|
10308
|
-
}
|
|
10309
|
-
});
|
|
10310
|
-
}
|
|
10311
|
-
const selectedCollections = (allCollections || []).filter((c) => selectedCollectionIds.includes(c?.id));
|
|
10312
|
-
setCollections(selectedCollections);
|
|
10313
|
-
} catch (err) {
|
|
10314
|
-
console.error("Error fetching collections:", err);
|
|
10315
|
-
setError(err instanceof Error ? err.message : "Failed to fetch collections");
|
|
10316
|
-
} finally {
|
|
10317
|
-
setLoading(false);
|
|
10318
|
-
}
|
|
10319
|
-
}, [did, selectedCollectionIds, handlers, editor, block]);
|
|
10320
|
-
useEffect24(() => {
|
|
10321
|
-
fetchCollections();
|
|
10322
|
-
}, [fetchCollections]);
|
|
10424
|
+
const { collections, loading, error, refetch } = useCollections(did, selectedCollectionIds, block, editor);
|
|
10323
10425
|
if (!did) {
|
|
10324
10426
|
return /* @__PURE__ */ React124.createElement(Center5, { py: "xl" }, /* @__PURE__ */ React124.createElement(Text62, { size: "sm", c: "dimmed" }, "Please configure the claim block in template mode first"));
|
|
10325
10427
|
}
|
|
10326
10428
|
if (selectedCollectionIds.length === 0) {
|
|
10327
10429
|
return /* @__PURE__ */ React124.createElement(Center5, { py: "xl" }, /* @__PURE__ */ React124.createElement(Text62, { size: "sm", c: "dimmed" }, "No claim collections selected"));
|
|
10328
10430
|
}
|
|
10329
|
-
return /* @__PURE__ */ React124.createElement(Stack88, { w: "100%" }, /* @__PURE__ */ React124.createElement(Flex22, { px: 5, align: "center", justify: "space-between" }, /* @__PURE__ */ React124.createElement(Title11, { order: 4 }, "Submit Claims"), /* @__PURE__ */ React124.createElement(Flex22, { gap: "xs" }, /* @__PURE__ */ React124.createElement(ActionIcon16, { variant: "subtle", size: "sm", onClick:
|
|
10431
|
+
return /* @__PURE__ */ React124.createElement(Stack88, { w: "100%" }, /* @__PURE__ */ React124.createElement(Flex22, { px: 5, align: "center", justify: "space-between" }, /* @__PURE__ */ React124.createElement(Title11, { order: 4 }, "Submit Claims"), /* @__PURE__ */ React124.createElement(Flex22, { gap: "xs" }, /* @__PURE__ */ React124.createElement(ActionIcon16, { variant: "subtle", size: "sm", onClick: refetch, loading }, /* @__PURE__ */ React124.createElement(IconRefresh2, { size: 18 })), editable && /* @__PURE__ */ React124.createElement(ActionIcon16, { variant: "subtle", size: "sm", onClick: open }, /* @__PURE__ */ React124.createElement(IconSettings3, { size: 18 })))), loading ? /* @__PURE__ */ React124.createElement(Center5, { py: "xl" }, /* @__PURE__ */ React124.createElement(Loader11, { size: "md" })) : error ? /* @__PURE__ */ React124.createElement(Alert15, { color: "red", title: "Failed to load collections", icon: /* @__PURE__ */ React124.createElement(IconAlertCircle3, { size: 18 }) }, /* @__PURE__ */ React124.createElement(Text62, { size: "sm" }, error)) : /* @__PURE__ */ React124.createElement(ClaimCollectionsList, { collections, deedId: did, adminAddress, userAddress, onRefresh: refetch }));
|
|
10330
10432
|
};
|
|
10331
10433
|
|
|
10332
10434
|
// src/mantine/blocks/claim/ClaimBlock.tsx
|
|
10333
10435
|
function ClaimBlock({ editor, block }) {
|
|
10436
|
+
console.log("[ClaimBlock] RENDER START", { blockId: block.id, docType: "..." });
|
|
10334
10437
|
const { docType } = useBlocknoteContext();
|
|
10438
|
+
console.log("[ClaimBlock] docType:", docType);
|
|
10335
10439
|
if (docType === "template") {
|
|
10440
|
+
console.log("[ClaimBlock] Rendering TEMPLATE view");
|
|
10336
10441
|
return /* @__PURE__ */ React125.createElement(ClaimTemplateView, { editor, block });
|
|
10337
10442
|
}
|
|
10443
|
+
console.log("[ClaimBlock] Rendering FLOW view");
|
|
10338
10444
|
return /* @__PURE__ */ React125.createElement(ClaimFlowView, { editor, block });
|
|
10339
10445
|
}
|
|
10340
10446
|
|
|
@@ -10361,14 +10467,14 @@ var ClaimBlockSpec = createReactBlockSpec8(
|
|
|
10361
10467
|
);
|
|
10362
10468
|
|
|
10363
10469
|
// src/mantine/blocks/bid/BidBlockSpec.tsx
|
|
10364
|
-
import
|
|
10470
|
+
import React141 from "react";
|
|
10365
10471
|
import { createReactBlockSpec as createReactBlockSpec9 } from "@blocknote/react";
|
|
10366
10472
|
|
|
10367
10473
|
// src/mantine/blocks/bid/BidBlock.tsx
|
|
10368
|
-
import
|
|
10474
|
+
import React140 from "react";
|
|
10369
10475
|
|
|
10370
10476
|
// src/mantine/blocks/bid/template/TemplateView.tsx
|
|
10371
|
-
import React130, { useMemo as
|
|
10477
|
+
import React130, { useMemo as useMemo27 } from "react";
|
|
10372
10478
|
import { Group as Group39, Stack as Stack89, Text as Text63, Badge as Badge17 } from "@mantine/core";
|
|
10373
10479
|
|
|
10374
10480
|
// src/mantine/blocks/bid/template/TemplateConfig.tsx
|
|
@@ -10376,14 +10482,14 @@ import React129, { useCallback as useCallback25 } from "react";
|
|
|
10376
10482
|
import { Paper as Paper14, CloseButton as CloseButton10, Title as Title12 } from "@mantine/core";
|
|
10377
10483
|
|
|
10378
10484
|
// src/mantine/blocks/bid/template/GeneralTab.tsx
|
|
10379
|
-
import React127, { useEffect as
|
|
10485
|
+
import React127, { useEffect as useEffect26, useState as useState37 } from "react";
|
|
10380
10486
|
var GeneralTab7 = ({ title, description, onTitleChange, onDescriptionChange }) => {
|
|
10381
|
-
const [localTitle, setLocalTitle] =
|
|
10382
|
-
const [localDescription, setLocalDescription] =
|
|
10383
|
-
|
|
10487
|
+
const [localTitle, setLocalTitle] = useState37(title || "");
|
|
10488
|
+
const [localDescription, setLocalDescription] = useState37(description || "");
|
|
10489
|
+
useEffect26(() => {
|
|
10384
10490
|
setLocalTitle(title || "");
|
|
10385
10491
|
}, [title]);
|
|
10386
|
-
|
|
10492
|
+
useEffect26(() => {
|
|
10387
10493
|
setLocalDescription(description || "");
|
|
10388
10494
|
}, [description]);
|
|
10389
10495
|
return /* @__PURE__ */ React127.createElement(BaseSection, null, /* @__PURE__ */ React127.createElement(
|
|
@@ -10415,9 +10521,9 @@ var GeneralTab7 = ({ title, description, onTitleChange, onDescriptionChange }) =
|
|
|
10415
10521
|
};
|
|
10416
10522
|
|
|
10417
10523
|
// src/mantine/blocks/bid/template/CollectionsTab.tsx
|
|
10418
|
-
import React128, { useCallback as useCallback24, useMemo as
|
|
10524
|
+
import React128, { useCallback as useCallback24, useMemo as useMemo26 } from "react";
|
|
10419
10525
|
var CollectionsTab = ({ did, selectedCollections, adminAddress, onDidChange, onSelectedCollectionsChange, onAdminAddressChange }) => {
|
|
10420
|
-
const parsedSelectedCollections =
|
|
10526
|
+
const parsedSelectedCollections = useMemo26(() => {
|
|
10421
10527
|
try {
|
|
10422
10528
|
return JSON.parse(selectedCollections || "[]");
|
|
10423
10529
|
} catch {
|
|
@@ -10532,9 +10638,9 @@ var TemplateConfig7 = ({ editor, block }) => {
|
|
|
10532
10638
|
var BID_TEMPLATE_PANEL_ID = "bid-template-panel";
|
|
10533
10639
|
var BidTemplateView = ({ editor, block }) => {
|
|
10534
10640
|
const panelId = `${BID_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
10535
|
-
const panelContent =
|
|
10641
|
+
const panelContent = useMemo27(() => /* @__PURE__ */ React130.createElement(TemplateConfig7, { editor, block }), [editor, block]);
|
|
10536
10642
|
const { open } = usePanel(panelId, panelContent);
|
|
10537
|
-
const selectedCollectionsCount =
|
|
10643
|
+
const selectedCollectionsCount = useMemo27(() => {
|
|
10538
10644
|
try {
|
|
10539
10645
|
const parsed = JSON.parse(block.props.selectedCollections || "[]");
|
|
10540
10646
|
return parsed.length;
|
|
@@ -10546,34 +10652,35 @@ var BidTemplateView = ({ editor, block }) => {
|
|
|
10546
10652
|
return /* @__PURE__ */ React130.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React130.createElement(Badge17, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React130.createElement(Group39, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React130.createElement(Group39, { wrap: "nowrap", align: "center" }, getIcon("dollar-sign", "dollar-sign"), /* @__PURE__ */ React130.createElement(Stack89, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React130.createElement(Text63, { fw: 500, size: "sm", contentEditable: false }, "Bid Block"), /* @__PURE__ */ React130.createElement(Text63, { size: "xs", c: "dimmed", contentEditable: false }, block.props.did ? didDisplay : "Configure bid settings"), selectedCollectionsCount > 0 && /* @__PURE__ */ React130.createElement(Text63, { size: "xs", c: "blue", contentEditable: false }, selectedCollectionsCount, " collection", selectedCollectionsCount !== 1 ? "s" : "", " selected")))));
|
|
10547
10653
|
};
|
|
10548
10654
|
|
|
10549
|
-
// src/mantine/blocks/bid/flow/FlowView.tsx
|
|
10550
|
-
import
|
|
10551
|
-
import { Stack as
|
|
10655
|
+
// src/mantine/blocks/bid/flow/components/FlowView.tsx
|
|
10656
|
+
import React139, { useMemo as useMemo34 } from "react";
|
|
10657
|
+
import { Stack as Stack96, Text as Text70, Loader as Loader16, Center as Center8, Alert as Alert18, Title as Title16, Flex as Flex23, ActionIcon as ActionIcon19 } from "@mantine/core";
|
|
10552
10658
|
import { IconSettings as IconSettings4, IconRefresh as IconRefresh3, IconAlertCircle as IconAlertCircle6 } from "@tabler/icons-react";
|
|
10553
10659
|
|
|
10554
|
-
// src/mantine/blocks/bid/flow/ClaimCollectionsList.tsx
|
|
10555
|
-
import
|
|
10556
|
-
import { Stack as
|
|
10557
|
-
import { IconChevronDown as IconChevronDown5, IconArrowDown as IconArrowDown3, IconArrowUp as IconArrowUp3 } from "@tabler/icons-react";
|
|
10660
|
+
// src/mantine/blocks/bid/flow/components/ClaimCollectionsList.tsx
|
|
10661
|
+
import React138 from "react";
|
|
10662
|
+
import { Stack as Stack95, Text as Text69, Loader as Loader15, Center as Center7 } from "@mantine/core";
|
|
10558
10663
|
|
|
10559
|
-
// src/mantine/blocks/bid/flow/
|
|
10560
|
-
import
|
|
10664
|
+
// src/mantine/blocks/bid/flow/components/CollectionItem.tsx
|
|
10665
|
+
import React137, { useMemo as useMemo33 } from "react";
|
|
10666
|
+
import { Stack as Stack94, Text as Text68, Button as Button30, Menu as Menu2, Badge as Badge20, ActionIcon as ActionIcon18, Box as Box23 } from "@mantine/core";
|
|
10667
|
+
import { IconChevronDown as IconChevronDown5, IconArrowRight as IconArrowRight4 } from "@tabler/icons-react";
|
|
10668
|
+
|
|
10669
|
+
// src/mantine/blocks/bid/flow/components/BidSurveyPanel.tsx
|
|
10670
|
+
import React131, { useMemo as useMemo29, useEffect as useEffect28 } from "react";
|
|
10561
10671
|
import { Paper as Paper15, CloseButton as CloseButton11, Title as Title13, Loader as Loader12, Stack as Stack90, Text as Text64 } from "@mantine/core";
|
|
10562
|
-
import { Survey as Survey2
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
var SURVEY_THEME_FOREGROUND = SURVEY_THEME_VARIABLES["--sjs-general-forecolor"] ?? "#ffffff";
|
|
10569
|
-
var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
|
|
10570
|
-
const { closePanel } = usePanelStore();
|
|
10672
|
+
import { Survey as Survey2 } from "@ixo/surveys";
|
|
10673
|
+
|
|
10674
|
+
// src/mantine/blocks/bid/flow/hooks/useBidSurvey.ts
|
|
10675
|
+
import { useState as useState38, useEffect as useEffect27, useMemo as useMemo28, useCallback as useCallback26 } from "react";
|
|
10676
|
+
import { SurveyModel as SurveyModel2 } from "@ixo/surveys";
|
|
10677
|
+
function useBidSurvey(deedId, collectionId, role, onSubmitComplete) {
|
|
10571
10678
|
const handlers = useBlocknoteHandlers();
|
|
10572
|
-
const
|
|
10573
|
-
const [
|
|
10574
|
-
const [
|
|
10575
|
-
const
|
|
10576
|
-
|
|
10679
|
+
const { closePanel } = usePanelStore();
|
|
10680
|
+
const [surveyJson, setSurveyJson] = useState38(null);
|
|
10681
|
+
const [loading, setLoading] = useState38(true);
|
|
10682
|
+
const [error, setError] = useState38(null);
|
|
10683
|
+
useEffect27(() => {
|
|
10577
10684
|
const fetchSurveyTemplate = async () => {
|
|
10578
10685
|
try {
|
|
10579
10686
|
setLoading(true);
|
|
@@ -10585,7 +10692,6 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
|
|
|
10585
10692
|
setError("No survey template found for this role");
|
|
10586
10693
|
}
|
|
10587
10694
|
} catch (err) {
|
|
10588
|
-
console.error("Error fetching survey template:", err);
|
|
10589
10695
|
setError(err instanceof Error ? err.message : "Failed to load survey template");
|
|
10590
10696
|
} finally {
|
|
10591
10697
|
setLoading(false);
|
|
@@ -10593,7 +10699,7 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
|
|
|
10593
10699
|
};
|
|
10594
10700
|
fetchSurveyTemplate();
|
|
10595
10701
|
}, [deedId, role, handlers]);
|
|
10596
|
-
const surveyModel =
|
|
10702
|
+
const surveyModel = useMemo28(() => {
|
|
10597
10703
|
if (!surveyJson) return null;
|
|
10598
10704
|
const model = new SurveyModel2(surveyJson);
|
|
10599
10705
|
model.applyTheme(surveyTheme);
|
|
@@ -10601,20 +10707,9 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
|
|
|
10601
10707
|
model.questionsOnPageMode = "singlePage";
|
|
10602
10708
|
return model;
|
|
10603
10709
|
}, [surveyJson]);
|
|
10604
|
-
const surveyContainerStyle = useMemo26(
|
|
10605
|
-
() => ({
|
|
10606
|
-
flex: 1,
|
|
10607
|
-
overflow: "auto",
|
|
10608
|
-
backgroundColor: SURVEY_THEME_BACKGROUND,
|
|
10609
|
-
color: SURVEY_THEME_FOREGROUND,
|
|
10610
|
-
...SURVEY_THEME_VARIABLES
|
|
10611
|
-
}),
|
|
10612
|
-
[]
|
|
10613
|
-
);
|
|
10614
10710
|
const handleSurveyComplete = useCallback26(
|
|
10615
10711
|
async (sender) => {
|
|
10616
10712
|
const surveyData = sender.data;
|
|
10617
|
-
console.log("Survey completed:", surveyData);
|
|
10618
10713
|
try {
|
|
10619
10714
|
const bidRole = role === "service_agent" ? "SA" /* serviceProviders */ : "EA" /* evaluators */;
|
|
10620
10715
|
await handlers.submitBid({
|
|
@@ -10622,17 +10717,57 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
|
|
|
10622
10717
|
role: bidRole,
|
|
10623
10718
|
surveyAnswers: surveyData
|
|
10624
10719
|
});
|
|
10625
|
-
console.log("Bid submitted successfully");
|
|
10626
10720
|
closePanel();
|
|
10627
10721
|
onSubmitComplete?.();
|
|
10628
10722
|
} catch (error2) {
|
|
10629
|
-
console.error("Failed to submit bid:", error2);
|
|
10630
10723
|
setError(error2 instanceof Error ? error2.message : "Failed to submit bid");
|
|
10631
10724
|
}
|
|
10632
10725
|
},
|
|
10633
10726
|
[handlers, collectionId, role, closePanel, onSubmitComplete]
|
|
10634
10727
|
);
|
|
10635
|
-
|
|
10728
|
+
return {
|
|
10729
|
+
surveyModel,
|
|
10730
|
+
loading,
|
|
10731
|
+
error,
|
|
10732
|
+
handleSurveyComplete
|
|
10733
|
+
};
|
|
10734
|
+
}
|
|
10735
|
+
|
|
10736
|
+
// src/mantine/blocks/bid/flow/constants.ts
|
|
10737
|
+
var ROLE_CONFIG = {
|
|
10738
|
+
service_agent: { color: "blue", label: "Service Agent" },
|
|
10739
|
+
SA: { color: "blue", label: "Service Agent" },
|
|
10740
|
+
evaluation_agent: { color: "green", label: "Evaluation Agent" },
|
|
10741
|
+
EA: { color: "green", label: "Evaluation Agent" }
|
|
10742
|
+
};
|
|
10743
|
+
var STATUS_CONFIG = {
|
|
10744
|
+
pending: { color: "yellow", label: "Pending" },
|
|
10745
|
+
approved: { color: "green", label: "Approved" },
|
|
10746
|
+
rejected: { color: "red", label: "Rejected" }
|
|
10747
|
+
};
|
|
10748
|
+
var SURVEY_THEME_VARIABLES = Object.entries(surveyTheme.cssVariables ?? {}).reduce((acc, [key, value]) => {
|
|
10749
|
+
acc[key] = value;
|
|
10750
|
+
return acc;
|
|
10751
|
+
}, {});
|
|
10752
|
+
var SURVEY_THEME_BACKGROUND = SURVEY_THEME_VARIABLES["--sjs-general-backcolor"] ?? "#050505";
|
|
10753
|
+
var SURVEY_THEME_FOREGROUND = SURVEY_THEME_VARIABLES["--sjs-general-forecolor"] ?? "#ffffff";
|
|
10754
|
+
|
|
10755
|
+
// src/mantine/blocks/bid/flow/components/BidSurveyPanel.tsx
|
|
10756
|
+
var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
|
|
10757
|
+
const { closePanel } = usePanelStore();
|
|
10758
|
+
const { surveyModel, loading, error, handleSurveyComplete } = useBidSurvey(deedId, collectionId, role, onSubmitComplete);
|
|
10759
|
+
const roleLabel = role === "service_agent" ? "Service Agent" : "Evaluation Agent";
|
|
10760
|
+
const surveyContainerStyle = useMemo29(
|
|
10761
|
+
() => ({
|
|
10762
|
+
flex: 1,
|
|
10763
|
+
overflow: "auto",
|
|
10764
|
+
backgroundColor: SURVEY_THEME_BACKGROUND,
|
|
10765
|
+
color: SURVEY_THEME_FOREGROUND,
|
|
10766
|
+
...SURVEY_THEME_VARIABLES
|
|
10767
|
+
}),
|
|
10768
|
+
[]
|
|
10769
|
+
);
|
|
10770
|
+
useEffect28(() => {
|
|
10636
10771
|
if (surveyModel) {
|
|
10637
10772
|
surveyModel.onComplete.add(handleSurveyComplete);
|
|
10638
10773
|
return () => {
|
|
@@ -10669,43 +10804,79 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
|
|
|
10669
10804
|
);
|
|
10670
10805
|
};
|
|
10671
10806
|
|
|
10672
|
-
// src/mantine/blocks/bid/flow/BidsList.tsx
|
|
10673
|
-
import
|
|
10674
|
-
import { Stack as
|
|
10675
|
-
import { IconAlertCircle as IconAlertCircle5
|
|
10807
|
+
// src/mantine/blocks/bid/flow/components/BidsList.tsx
|
|
10808
|
+
import React134, { useCallback as useCallback29 } from "react";
|
|
10809
|
+
import { Stack as Stack93, Text as Text67, Loader as Loader14, Center as Center6, Alert as Alert17, Paper as Paper17, CloseButton as CloseButton13, Title as Title15 } from "@mantine/core";
|
|
10810
|
+
import { IconAlertCircle as IconAlertCircle5 } from "@tabler/icons-react";
|
|
10811
|
+
|
|
10812
|
+
// src/mantine/blocks/bid/flow/components/BidItem.tsx
|
|
10813
|
+
import React133, { useMemo as useMemo32 } from "react";
|
|
10814
|
+
import { Stack as Stack92, Text as Text66, Badge as Badge19, Group as Group41, ActionIcon as ActionIcon17 } from "@mantine/core";
|
|
10815
|
+
import { IconArrowRight as IconArrowRight3 } from "@tabler/icons-react";
|
|
10676
10816
|
|
|
10677
|
-
// src/mantine/blocks/bid/flow/BidViewPanel.tsx
|
|
10678
|
-
import React132, { useMemo as
|
|
10817
|
+
// src/mantine/blocks/bid/flow/components/BidViewPanel.tsx
|
|
10818
|
+
import React132, { useMemo as useMemo31, useState as useState41 } from "react";
|
|
10679
10819
|
import { Paper as Paper16, CloseButton as CloseButton12, Title as Title14, Loader as Loader13, Stack as Stack91, Text as Text65, Badge as Badge18, Button as Button29, Group as Group40, Modal as Modal2, Alert as Alert16 } from "@mantine/core";
|
|
10680
|
-
import { Survey as Survey3
|
|
10820
|
+
import { Survey as Survey3 } from "@ixo/surveys";
|
|
10681
10821
|
import { IconCheck as IconCheck2, IconX as IconX4, IconAlertCircle as IconAlertCircle4 } from "@tabler/icons-react";
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
|
|
10705
|
-
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10822
|
+
|
|
10823
|
+
// src/mantine/blocks/bid/flow/hooks/useBidView.ts
|
|
10824
|
+
import { useState as useState39, useEffect as useEffect29, useMemo as useMemo30 } from "react";
|
|
10825
|
+
import { SurveyModel as SurveyModel3 } from "@ixo/surveys";
|
|
10826
|
+
|
|
10827
|
+
// src/mantine/blocks/bid/flow/utils.ts
|
|
10828
|
+
function formatDate(dateString) {
|
|
10829
|
+
try {
|
|
10830
|
+
const date = new Date(dateString);
|
|
10831
|
+
return date.toLocaleDateString(void 0, {
|
|
10832
|
+
year: "numeric",
|
|
10833
|
+
month: "short",
|
|
10834
|
+
day: "numeric"
|
|
10835
|
+
});
|
|
10836
|
+
} catch {
|
|
10837
|
+
return dateString;
|
|
10838
|
+
}
|
|
10839
|
+
}
|
|
10840
|
+
function getRoleLabel(role) {
|
|
10841
|
+
return ROLE_CONFIG[role]?.label || role;
|
|
10842
|
+
}
|
|
10843
|
+
function getRoleColor(role) {
|
|
10844
|
+
return ROLE_CONFIG[role]?.color || "gray";
|
|
10845
|
+
}
|
|
10846
|
+
function getStatusLabel(status) {
|
|
10847
|
+
return STATUS_CONFIG[status]?.label || status;
|
|
10848
|
+
}
|
|
10849
|
+
function getStatusColor(status) {
|
|
10850
|
+
return STATUS_CONFIG[status]?.color || "gray";
|
|
10851
|
+
}
|
|
10852
|
+
function getCollectionName(collection) {
|
|
10853
|
+
return collection.protocol?.profile?.name || collection.name || "Unnamed Collection";
|
|
10854
|
+
}
|
|
10855
|
+
function parseBidData(data) {
|
|
10856
|
+
try {
|
|
10857
|
+
return typeof data === "string" ? JSON.parse(data) : data;
|
|
10858
|
+
} catch {
|
|
10859
|
+
return data;
|
|
10860
|
+
}
|
|
10861
|
+
}
|
|
10862
|
+
|
|
10863
|
+
// src/mantine/blocks/bid/flow/hooks/useBidView.ts
|
|
10864
|
+
function useBidView(bid, deedId) {
|
|
10865
|
+
const handlers = useBlocknoteHandlers();
|
|
10866
|
+
const [surveyJson, setSurveyJson] = useState39(null);
|
|
10867
|
+
const [loading, setLoading] = useState39(true);
|
|
10868
|
+
const [error, setError] = useState39(null);
|
|
10869
|
+
useEffect29(() => {
|
|
10870
|
+
const fetchSurveyTemplate = async () => {
|
|
10871
|
+
try {
|
|
10872
|
+
setLoading(true);
|
|
10873
|
+
setError(null);
|
|
10874
|
+
let result;
|
|
10875
|
+
if (bid.role === "service_agent" || bid.role === "SA") {
|
|
10876
|
+
result = await handlers.getBidContributorSurveyTemplate(deedId);
|
|
10877
|
+
} else if (bid.role === "evaluation_agent" || bid.role === "EA") {
|
|
10878
|
+
result = await handlers.getBidEvaluatorSurveyTemplate(deedId);
|
|
10879
|
+
} else {
|
|
10709
10880
|
setError(`Unknown role: ${bid.role}`);
|
|
10710
10881
|
setLoading(false);
|
|
10711
10882
|
return;
|
|
@@ -10716,7 +10887,6 @@ var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
|
|
|
10716
10887
|
setError("No survey template found for this role");
|
|
10717
10888
|
}
|
|
10718
10889
|
} catch (err) {
|
|
10719
|
-
console.error("Error fetching survey template:", err);
|
|
10720
10890
|
setError(err instanceof Error ? err.message : "Failed to load survey template");
|
|
10721
10891
|
} finally {
|
|
10722
10892
|
setLoading(false);
|
|
@@ -10724,51 +10894,30 @@ var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
|
|
|
10724
10894
|
};
|
|
10725
10895
|
fetchSurveyTemplate();
|
|
10726
10896
|
}, [deedId, bid.role, handlers]);
|
|
10727
|
-
const surveyModel =
|
|
10897
|
+
const surveyModel = useMemo30(() => {
|
|
10728
10898
|
if (!surveyJson) return null;
|
|
10729
10899
|
const model = new SurveyModel3(surveyJson);
|
|
10730
10900
|
model.applyTheme(surveyTheme);
|
|
10731
10901
|
model.showQuestionNumbers = "off";
|
|
10732
10902
|
model.questionsOnPageMode = "singlePage";
|
|
10733
10903
|
model.mode = "display";
|
|
10734
|
-
|
|
10735
|
-
try {
|
|
10736
|
-
bidData = typeof bid.data === "string" ? JSON.parse(bid.data) : bid.data;
|
|
10737
|
-
} catch {
|
|
10738
|
-
bidData = bid.data;
|
|
10739
|
-
}
|
|
10740
|
-
model.data = bidData;
|
|
10904
|
+
model.data = parseBidData(bid.data);
|
|
10741
10905
|
return model;
|
|
10742
10906
|
}, [surveyJson, bid.data]);
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
);
|
|
10753
|
-
const
|
|
10754
|
-
if (role === "service_agent" || role === "SA") return "Service Agent";
|
|
10755
|
-
if (role === "evaluation_agent" || role === "EA") return "Evaluation Agent";
|
|
10756
|
-
return role;
|
|
10757
|
-
};
|
|
10758
|
-
const getRoleBadge = (role) => {
|
|
10759
|
-
const roleConfig = {
|
|
10760
|
-
service_agent: { color: "blue", label: "Service Agent" },
|
|
10761
|
-
SA: { color: "blue", label: "Service Agent" },
|
|
10762
|
-
evaluation_agent: { color: "green", label: "Evaluation Agent" },
|
|
10763
|
-
EA: { color: "green", label: "Evaluation Agent" }
|
|
10764
|
-
};
|
|
10765
|
-
const config = roleConfig[role] || { color: "gray", label: role };
|
|
10766
|
-
return /* @__PURE__ */ React132.createElement(Badge18, { size: "sm", color: config.color }, config.label);
|
|
10767
|
-
};
|
|
10768
|
-
const handleApproveBid = async () => {
|
|
10907
|
+
return { surveyModel, loading, error };
|
|
10908
|
+
}
|
|
10909
|
+
|
|
10910
|
+
// src/mantine/blocks/bid/flow/hooks/useBidActions.ts
|
|
10911
|
+
import { useState as useState40, useCallback as useCallback27 } from "react";
|
|
10912
|
+
function useBidActions(bid, deedId, adminAddress, onRefresh) {
|
|
10913
|
+
const handlers = useBlocknoteHandlers();
|
|
10914
|
+
const { closePanel } = usePanelStore();
|
|
10915
|
+
const [loading, setLoading] = useState40(false);
|
|
10916
|
+
const [error, setError] = useState40(null);
|
|
10917
|
+
const approveBid = useCallback27(async () => {
|
|
10769
10918
|
try {
|
|
10770
|
-
|
|
10771
|
-
|
|
10919
|
+
setLoading(true);
|
|
10920
|
+
setError(null);
|
|
10772
10921
|
if (bid.role === "service_agent" || bid.role === "SA") {
|
|
10773
10922
|
await handlers.approveServiceAgentApplication({
|
|
10774
10923
|
adminAddress,
|
|
@@ -10796,41 +10945,67 @@ var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
|
|
|
10796
10945
|
closePanel();
|
|
10797
10946
|
onRefresh?.();
|
|
10798
10947
|
} catch (err) {
|
|
10799
|
-
|
|
10800
|
-
setActionError(err instanceof Error ? err.message : "Failed to approve bid");
|
|
10801
|
-
} finally {
|
|
10802
|
-
setActionLoading(false);
|
|
10803
|
-
}
|
|
10804
|
-
};
|
|
10805
|
-
const handleRejectBid = async () => {
|
|
10806
|
-
if (!rejectReason.trim()) {
|
|
10807
|
-
setActionError("Please provide a reason for rejection");
|
|
10808
|
-
return;
|
|
10809
|
-
}
|
|
10810
|
-
try {
|
|
10811
|
-
setActionLoading(true);
|
|
10812
|
-
setActionError(null);
|
|
10813
|
-
await handlers.rejectBid({
|
|
10814
|
-
bidId: bid.id,
|
|
10815
|
-
collectionId: bid.collection,
|
|
10816
|
-
did: deedId,
|
|
10817
|
-
reason: rejectReason
|
|
10818
|
-
});
|
|
10819
|
-
setRejectModalOpen(false);
|
|
10820
|
-
closePanel();
|
|
10821
|
-
onRefresh?.();
|
|
10822
|
-
} catch (err) {
|
|
10823
|
-
console.error("Error rejecting bid:", err);
|
|
10824
|
-
setActionError(err instanceof Error ? err.message : "Failed to reject bid");
|
|
10948
|
+
setError(err instanceof Error ? err.message : "Failed to approve bid");
|
|
10825
10949
|
} finally {
|
|
10826
|
-
|
|
10950
|
+
setLoading(false);
|
|
10827
10951
|
}
|
|
10828
|
-
};
|
|
10829
|
-
const
|
|
10952
|
+
}, [bid, deedId, adminAddress, handlers, closePanel, onRefresh]);
|
|
10953
|
+
const rejectBid = useCallback27(
|
|
10954
|
+
async (reason) => {
|
|
10955
|
+
if (!reason.trim()) {
|
|
10956
|
+
setError("Please provide a reason for rejection");
|
|
10957
|
+
return;
|
|
10958
|
+
}
|
|
10959
|
+
try {
|
|
10960
|
+
setLoading(true);
|
|
10961
|
+
setError(null);
|
|
10962
|
+
await handlers.rejectBid({
|
|
10963
|
+
bidId: bid.id,
|
|
10964
|
+
collectionId: bid.collection,
|
|
10965
|
+
did: deedId,
|
|
10966
|
+
reason
|
|
10967
|
+
});
|
|
10968
|
+
closePanel();
|
|
10969
|
+
onRefresh?.();
|
|
10970
|
+
} catch (err) {
|
|
10971
|
+
setError(err instanceof Error ? err.message : "Failed to reject bid");
|
|
10972
|
+
} finally {
|
|
10973
|
+
setLoading(false);
|
|
10974
|
+
}
|
|
10975
|
+
},
|
|
10976
|
+
[bid, deedId, handlers, closePanel, onRefresh]
|
|
10977
|
+
);
|
|
10978
|
+
return { approveBid, rejectBid, loading, error, setError };
|
|
10979
|
+
}
|
|
10980
|
+
|
|
10981
|
+
// src/mantine/blocks/bid/flow/components/BidViewPanel.tsx
|
|
10982
|
+
var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
|
|
10983
|
+
const { closePanel } = usePanelStore();
|
|
10984
|
+
const { surveyModel, loading, error } = useBidView(bid, deedId);
|
|
10985
|
+
const { approveBid, rejectBid, loading: actionLoading, error: actionError, setError: setActionError } = useBidActions(bid, deedId, adminAddress, onRefresh);
|
|
10986
|
+
const [rejectModalOpen, setRejectModalOpen] = useState41(false);
|
|
10987
|
+
const [rejectReason, setRejectReason] = useState41("");
|
|
10988
|
+
const surveyContainerStyle = useMemo31(
|
|
10989
|
+
() => ({
|
|
10990
|
+
flex: 1,
|
|
10991
|
+
overflow: "auto",
|
|
10992
|
+
backgroundColor: SURVEY_THEME_BACKGROUND,
|
|
10993
|
+
color: SURVEY_THEME_FOREGROUND,
|
|
10994
|
+
...SURVEY_THEME_VARIABLES
|
|
10995
|
+
}),
|
|
10996
|
+
[]
|
|
10997
|
+
);
|
|
10998
|
+
const handleRejectClick = () => {
|
|
10830
10999
|
setRejectReason("");
|
|
10831
11000
|
setActionError(null);
|
|
10832
11001
|
setRejectModalOpen(true);
|
|
10833
11002
|
};
|
|
11003
|
+
const handleRejectConfirm = async () => {
|
|
11004
|
+
await rejectBid(rejectReason);
|
|
11005
|
+
if (!actionError) {
|
|
11006
|
+
setRejectModalOpen(false);
|
|
11007
|
+
}
|
|
11008
|
+
};
|
|
10834
11009
|
return /* @__PURE__ */ React132.createElement(
|
|
10835
11010
|
Paper16,
|
|
10836
11011
|
{
|
|
@@ -10852,81 +11027,61 @@ var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
|
|
|
10852
11027
|
marginBottom: "1rem"
|
|
10853
11028
|
}
|
|
10854
11029
|
},
|
|
10855
|
-
/* @__PURE__ */ React132.createElement(Stack91, { gap: "xs" }, /* @__PURE__ */ React132.createElement(Title14, { order: 3 }, getRoleLabel(bid.role), " Bid"),
|
|
11030
|
+
/* @__PURE__ */ React132.createElement(Stack91, { gap: "xs" }, /* @__PURE__ */ React132.createElement(Title14, { order: 3 }, getRoleLabel(bid.role), " Bid"), /* @__PURE__ */ React132.createElement(Badge18, { size: "sm", color: getRoleColor(bid.role) }, getRoleLabel(bid.role))),
|
|
10856
11031
|
/* @__PURE__ */ React132.createElement(CloseButton12, { onClick: closePanel })
|
|
10857
11032
|
),
|
|
10858
|
-
!loading && !error && /* @__PURE__ */ React132.createElement(Stack91, { gap: "md", mb: "md" }, actionError && /* @__PURE__ */ React132.createElement(Alert16, { color: "red", icon: /* @__PURE__ */ React132.createElement(IconAlertCircle4, { size: 16 }), onClose: () => setActionError(null), withCloseButton: true }, actionError), /* @__PURE__ */ React132.createElement(Group40, { justify: "flex-end" }, /* @__PURE__ */ React132.createElement(Button29, { variant: "outline", color: "red", leftSection: /* @__PURE__ */ React132.createElement(IconX4, { size: 16 }), onClick:
|
|
11033
|
+
!loading && !error && /* @__PURE__ */ React132.createElement(Stack91, { gap: "md", mb: "md" }, actionError && /* @__PURE__ */ React132.createElement(Alert16, { color: "red", icon: /* @__PURE__ */ React132.createElement(IconAlertCircle4, { size: 16 }), onClose: () => setActionError(null), withCloseButton: true }, actionError), /* @__PURE__ */ React132.createElement(Group40, { justify: "flex-end" }, /* @__PURE__ */ React132.createElement(Button29, { variant: "outline", color: "red", leftSection: /* @__PURE__ */ React132.createElement(IconX4, { size: 16 }), onClick: handleRejectClick, loading: actionLoading, disabled: actionLoading }, "Reject"), /* @__PURE__ */ React132.createElement(Button29, { variant: "filled", color: "green", leftSection: /* @__PURE__ */ React132.createElement(IconCheck2, { size: 16 }), onClick: approveBid, loading: actionLoading, disabled: actionLoading }, "Approve"))),
|
|
10859
11034
|
/* @__PURE__ */ React132.createElement("div", { style: surveyContainerStyle }, loading && /* @__PURE__ */ React132.createElement(Stack91, { align: "center", justify: "center", style: { height: "100%" } }, /* @__PURE__ */ React132.createElement(Loader13, { size: "lg" }), /* @__PURE__ */ React132.createElement(Text65, { size: "sm", c: "dimmed" }, "Loading bid details...")), error && /* @__PURE__ */ React132.createElement(Stack91, { align: "center", justify: "center", style: { height: "100%", padding: "1rem" } }, /* @__PURE__ */ React132.createElement(Text65, { size: "sm", c: "red" }, error)), !loading && !error && surveyModel && /* @__PURE__ */ React132.createElement(Survey3, { model: surveyModel })),
|
|
10860
|
-
/* @__PURE__ */ React132.createElement(Modal2, { opened: rejectModalOpen, onClose: () => setRejectModalOpen(false), title: "Reject Bid", centered: true }, /* @__PURE__ */ React132.createElement(Stack91, { gap: "md" }, /* @__PURE__ */ React132.createElement(Text65, { size: "sm" }, "Please provide a reason for rejecting this bid:"), /* @__PURE__ */ React132.createElement(BaseTextArea, { placeholder: "Enter rejection reason...", value: rejectReason, onChange: (e) => setRejectReason(e.currentTarget.value), minRows: 3 }), /* @__PURE__ */ React132.createElement(Group40, { justify: "flex-end" }, /* @__PURE__ */ React132.createElement(Button29, { variant: "outline", onClick: () => setRejectModalOpen(false), disabled: actionLoading }, "Cancel"), /* @__PURE__ */ React132.createElement(Button29, { color: "red", onClick:
|
|
11035
|
+
/* @__PURE__ */ React132.createElement(Modal2, { opened: rejectModalOpen, onClose: () => setRejectModalOpen(false), title: "Reject Bid", centered: true }, /* @__PURE__ */ React132.createElement(Stack91, { gap: "md" }, /* @__PURE__ */ React132.createElement(Text65, { size: "sm" }, "Please provide a reason for rejecting this bid:"), /* @__PURE__ */ React132.createElement(BaseTextArea, { placeholder: "Enter rejection reason...", value: rejectReason, onChange: (e) => setRejectReason(e.currentTarget.value), minRows: 3 }), /* @__PURE__ */ React132.createElement(Group40, { justify: "flex-end" }, /* @__PURE__ */ React132.createElement(Button29, { variant: "outline", onClick: () => setRejectModalOpen(false), disabled: actionLoading }, "Cancel"), /* @__PURE__ */ React132.createElement(Button29, { color: "red", onClick: handleRejectConfirm, loading: actionLoading, disabled: !rejectReason.trim() }, "Reject Bid"))))
|
|
10861
11036
|
);
|
|
10862
11037
|
};
|
|
10863
11038
|
|
|
10864
|
-
// src/mantine/
|
|
10865
|
-
|
|
11039
|
+
// src/mantine/hooks/useUserProfile.ts
|
|
11040
|
+
import { useState as useState42, useEffect as useEffect30 } from "react";
|
|
11041
|
+
function useUserProfile(did) {
|
|
10866
11042
|
const handlers = useBlocknoteHandlers();
|
|
10867
|
-
const [userProfile, setUserProfile] =
|
|
10868
|
-
const [
|
|
10869
|
-
|
|
11043
|
+
const [userProfile, setUserProfile] = useState42(null);
|
|
11044
|
+
const [loading, setLoading] = useState42(false);
|
|
11045
|
+
useEffect30(() => {
|
|
10870
11046
|
const fetchUserProfile = async () => {
|
|
10871
|
-
if (!
|
|
11047
|
+
if (!did) return;
|
|
10872
11048
|
try {
|
|
10873
|
-
|
|
10874
|
-
const profile = await handlers.getMatrixInfoPerDid(
|
|
10875
|
-
setUserProfile(profile);
|
|
11049
|
+
setLoading(true);
|
|
11050
|
+
const profile = await handlers.getMatrixInfoPerDid(did);
|
|
11051
|
+
setUserProfile(profile || null);
|
|
10876
11052
|
} catch (error) {
|
|
10877
|
-
|
|
11053
|
+
setUserProfile(null);
|
|
10878
11054
|
} finally {
|
|
10879
|
-
|
|
11055
|
+
setLoading(false);
|
|
10880
11056
|
}
|
|
10881
11057
|
};
|
|
10882
11058
|
fetchUserProfile();
|
|
10883
|
-
}, [
|
|
11059
|
+
}, [did]);
|
|
11060
|
+
return { userProfile, loading };
|
|
11061
|
+
}
|
|
11062
|
+
|
|
11063
|
+
// src/mantine/blocks/bid/flow/components/BidItem.tsx
|
|
11064
|
+
var BidItem = ({ bid, deedId, adminAddress, onRefresh }) => {
|
|
11065
|
+
const { userProfile, loading: loadingProfile } = useUserProfile(bid.did);
|
|
10884
11066
|
const bidPanelId = `bid-view-${bid.id}`;
|
|
10885
|
-
const bidPanelContent =
|
|
11067
|
+
const bidPanelContent = useMemo32(() => /* @__PURE__ */ React133.createElement(BidViewPanel, { bid, deedId, adminAddress, onRefresh }), [bid, deedId, adminAddress, onRefresh]);
|
|
10886
11068
|
const { open: openBidPanel } = usePanel(bidPanelId, bidPanelContent);
|
|
10887
11069
|
const displayName = userProfile?.displayname || bid.did;
|
|
10888
|
-
const getRoleBadge = (role) => {
|
|
10889
|
-
const roleConfig = {
|
|
10890
|
-
service_agent: { color: "blue", label: "Service Agent" },
|
|
10891
|
-
SA: { color: "blue", label: "Service Agent" },
|
|
10892
|
-
evaluation_agent: { color: "green", label: "Evaluation Agent" },
|
|
10893
|
-
EA: { color: "green", label: "Evaluation Agent" }
|
|
10894
|
-
};
|
|
10895
|
-
const config = roleConfig[role] || { color: "gray", label: role };
|
|
10896
|
-
return /* @__PURE__ */ React133.createElement(Badge19, { size: "xs", variant: "light", color: config.color }, config.label);
|
|
10897
|
-
};
|
|
10898
|
-
const getStatusBadge = (status) => {
|
|
10899
|
-
const statusConfig = {
|
|
10900
|
-
pending: { color: "yellow", label: "Pending" },
|
|
10901
|
-
approved: { color: "green", label: "Approved" },
|
|
10902
|
-
rejected: { color: "red", label: "Rejected" }
|
|
10903
|
-
};
|
|
10904
|
-
const config = statusConfig[status] || { color: "gray", label: status };
|
|
10905
|
-
return /* @__PURE__ */ React133.createElement(Badge19, { size: "sm", color: config.color }, config.label);
|
|
10906
|
-
};
|
|
10907
|
-
const formatDate = (dateString) => {
|
|
10908
|
-
try {
|
|
10909
|
-
const date = new Date(dateString);
|
|
10910
|
-
return date.toLocaleDateString(void 0, {
|
|
10911
|
-
year: "numeric",
|
|
10912
|
-
month: "short",
|
|
10913
|
-
day: "numeric"
|
|
10914
|
-
});
|
|
10915
|
-
} catch {
|
|
10916
|
-
return dateString;
|
|
10917
|
-
}
|
|
10918
|
-
};
|
|
10919
11070
|
const displayDate = bid.created || "";
|
|
10920
11071
|
const displayStatus = bid.status;
|
|
10921
11072
|
const displayReason = bid.reason;
|
|
10922
|
-
return /* @__PURE__ */ React133.createElement(ListItemContainer,
|
|
11073
|
+
return /* @__PURE__ */ React133.createElement(ListItemContainer, { isChecked: false, onClick: () => {
|
|
11074
|
+
} }, /* @__PURE__ */ React133.createElement(Stack92, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React133.createElement(Group41, { gap: "xs" }, /* @__PURE__ */ React133.createElement(Text66, { size: "xs", fw: 500 }, loadingProfile ? "Loading..." : displayName), userProfile?.verified && /* @__PURE__ */ React133.createElement(Text66, { size: "xs", c: "blue", fw: 600, title: "Verified user" }, "\u2713"), /* @__PURE__ */ React133.createElement(Badge19, { size: "xs", variant: "light", color: getRoleColor(bid.role) }, getRoleLabel(bid.role))), /* @__PURE__ */ React133.createElement(Text66, { size: "xs", c: "dimmed" }, "Submitted: ", formatDate(displayDate)), displayStatus === "rejected" && displayReason && /* @__PURE__ */ React133.createElement(Text66, { size: "xs", c: "red" }, "Reason: ", displayReason)), /* @__PURE__ */ React133.createElement(Group41, { gap: "xs" }, displayStatus && /* @__PURE__ */ React133.createElement(Badge19, { size: "sm", color: getStatusColor(displayStatus) }, getStatusLabel(displayStatus)), /* @__PURE__ */ React133.createElement(ActionIcon17, { variant: "subtle", size: "lg", onClick: openBidPanel }, /* @__PURE__ */ React133.createElement(IconArrowRight3, { size: 20 }))));
|
|
10923
11075
|
};
|
|
10924
|
-
|
|
11076
|
+
|
|
11077
|
+
// src/mantine/blocks/bid/flow/hooks/useBids.ts
|
|
11078
|
+
import { useState as useState43, useEffect as useEffect31, useCallback as useCallback28 } from "react";
|
|
11079
|
+
function useBids(collectionId) {
|
|
10925
11080
|
const handlers = useBlocknoteHandlers();
|
|
10926
|
-
const [bids, setBids] =
|
|
10927
|
-
const [loading, setLoading] =
|
|
10928
|
-
const [error, setError] =
|
|
10929
|
-
const fetchBids =
|
|
11081
|
+
const [bids, setBids] = useState43([]);
|
|
11082
|
+
const [loading, setLoading] = useState43(true);
|
|
11083
|
+
const [error, setError] = useState43(null);
|
|
11084
|
+
const fetchBids = useCallback28(async () => {
|
|
10930
11085
|
if (!collectionId) {
|
|
10931
11086
|
setLoading(false);
|
|
10932
11087
|
return;
|
|
@@ -10935,53 +11090,124 @@ var BidsList = ({ collectionId, deedId, adminAddress, onRefresh }) => {
|
|
|
10935
11090
|
setLoading(true);
|
|
10936
11091
|
setError(null);
|
|
10937
11092
|
const response = await handlers.queryBids({ collectionId });
|
|
10938
|
-
setBids(response?.data
|
|
11093
|
+
setBids(Array.isArray(response?.data) ? response.data : []);
|
|
10939
11094
|
} catch (err) {
|
|
10940
|
-
console.error("Error fetching bids:", err);
|
|
10941
11095
|
setError(err instanceof Error ? err.message : "Failed to fetch bids");
|
|
10942
11096
|
setBids([]);
|
|
10943
11097
|
} finally {
|
|
10944
11098
|
setLoading(false);
|
|
10945
11099
|
}
|
|
10946
|
-
}, [collectionId
|
|
10947
|
-
|
|
11100
|
+
}, [collectionId]);
|
|
11101
|
+
useEffect31(() => {
|
|
10948
11102
|
fetchBids();
|
|
10949
11103
|
}, [fetchBids]);
|
|
10950
|
-
|
|
10951
|
-
|
|
11104
|
+
return { bids, loading, error, refetch: fetchBids };
|
|
11105
|
+
}
|
|
11106
|
+
|
|
11107
|
+
// src/mantine/blocks/bid/flow/components/BidsList.tsx
|
|
11108
|
+
var BidsList = ({ collectionId, deedId, adminAddress, onRefresh }) => {
|
|
11109
|
+
const { closePanel } = usePanelStore();
|
|
11110
|
+
const { bids, loading, error, refetch } = useBids(collectionId);
|
|
11111
|
+
const handleRefresh = useCallback29(() => {
|
|
11112
|
+
refetch();
|
|
10952
11113
|
onRefresh();
|
|
10953
|
-
}, [
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
|
|
11114
|
+
}, [refetch, onRefresh]);
|
|
11115
|
+
const renderContent = () => {
|
|
11116
|
+
if (loading) {
|
|
11117
|
+
return /* @__PURE__ */ React134.createElement(Center6, { py: "md" }, /* @__PURE__ */ React134.createElement(Loader14, { size: "sm" }));
|
|
11118
|
+
}
|
|
11119
|
+
if (error) {
|
|
11120
|
+
return /* @__PURE__ */ React134.createElement(Alert17, { color: "red", icon: /* @__PURE__ */ React134.createElement(IconAlertCircle5, { size: 16 }), py: "xs" }, /* @__PURE__ */ React134.createElement(Text67, { size: "xs" }, error));
|
|
11121
|
+
}
|
|
11122
|
+
if (!bids || bids.length === 0) {
|
|
11123
|
+
return /* @__PURE__ */ React134.createElement(Text67, { size: "xs", c: "dimmed", ta: "center", py: "sm" }, "No bids submitted yet");
|
|
11124
|
+
}
|
|
11125
|
+
return /* @__PURE__ */ React134.createElement(Stack93, { gap: "xs", pl: "md" }, bids.map((bid) => /* @__PURE__ */ React134.createElement(BidItem, { key: bid.id, bid, deedId, adminAddress, onRefresh: handleRefresh })));
|
|
11126
|
+
};
|
|
11127
|
+
return /* @__PURE__ */ React134.createElement(
|
|
11128
|
+
Paper17,
|
|
11129
|
+
{
|
|
11130
|
+
p: "md",
|
|
11131
|
+
shadow: "sm",
|
|
11132
|
+
style: {
|
|
11133
|
+
height: "100%",
|
|
11134
|
+
display: "flex",
|
|
11135
|
+
flexDirection: "column"
|
|
11136
|
+
}
|
|
11137
|
+
},
|
|
11138
|
+
/* @__PURE__ */ React134.createElement(
|
|
11139
|
+
"div",
|
|
11140
|
+
{
|
|
11141
|
+
style: {
|
|
11142
|
+
display: "flex",
|
|
11143
|
+
justifyContent: "space-between",
|
|
11144
|
+
alignItems: "center",
|
|
11145
|
+
marginBottom: "1rem"
|
|
11146
|
+
}
|
|
11147
|
+
},
|
|
11148
|
+
/* @__PURE__ */ React134.createElement(Title15, { order: 3 }, "Submitted Bids"),
|
|
11149
|
+
/* @__PURE__ */ React134.createElement(CloseButton13, { onClick: closePanel })
|
|
11150
|
+
),
|
|
11151
|
+
renderContent()
|
|
11152
|
+
);
|
|
10964
11153
|
};
|
|
10965
11154
|
|
|
10966
|
-
// src/
|
|
11155
|
+
// src/icons/UserCheck.tsx
|
|
11156
|
+
import React135 from "react";
|
|
11157
|
+
var UserCheck = ({ size = 24, color = "currentColor", style }) => {
|
|
11158
|
+
return /* @__PURE__ */ React135.createElement(
|
|
11159
|
+
"svg",
|
|
11160
|
+
{
|
|
11161
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11162
|
+
width: size,
|
|
11163
|
+
height: size,
|
|
11164
|
+
viewBox: "0 0 24 24",
|
|
11165
|
+
fill: "none",
|
|
11166
|
+
stroke: color,
|
|
11167
|
+
strokeWidth: "2",
|
|
11168
|
+
strokeLinecap: "round",
|
|
11169
|
+
strokeLinejoin: "round",
|
|
11170
|
+
className: "lucide lucide-user-check-icon lucide-user-check",
|
|
11171
|
+
style
|
|
11172
|
+
},
|
|
11173
|
+
/* @__PURE__ */ React135.createElement("path", { d: "m16 11 2 2 4-4" }),
|
|
11174
|
+
/* @__PURE__ */ React135.createElement("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
|
|
11175
|
+
/* @__PURE__ */ React135.createElement("circle", { cx: "9", cy: "7", r: "4" })
|
|
11176
|
+
);
|
|
11177
|
+
};
|
|
11178
|
+
var UserCheck_default = UserCheck;
|
|
11179
|
+
|
|
11180
|
+
// src/icons/UserPlus.tsx
|
|
11181
|
+
import React136 from "react";
|
|
11182
|
+
var UserPlus = ({ size = 24, color = "currentColor", style }) => {
|
|
11183
|
+
return /* @__PURE__ */ React136.createElement(
|
|
11184
|
+
"svg",
|
|
11185
|
+
{
|
|
11186
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11187
|
+
width: size,
|
|
11188
|
+
height: size,
|
|
11189
|
+
viewBox: "0 0 24 24",
|
|
11190
|
+
fill: "none",
|
|
11191
|
+
stroke: color,
|
|
11192
|
+
strokeWidth: "2",
|
|
11193
|
+
strokeLinecap: "round",
|
|
11194
|
+
strokeLinejoin: "round",
|
|
11195
|
+
className: "lucide lucide-user-plus-icon lucide-user-plus",
|
|
11196
|
+
style
|
|
11197
|
+
},
|
|
11198
|
+
/* @__PURE__ */ React136.createElement("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
|
|
11199
|
+
/* @__PURE__ */ React136.createElement("circle", { cx: "9", cy: "7", r: "4" }),
|
|
11200
|
+
/* @__PURE__ */ React136.createElement("line", { x1: "19", x2: "19", y1: "8", y2: "14" }),
|
|
11201
|
+
/* @__PURE__ */ React136.createElement("line", { x1: "22", x2: "16", y1: "11", y2: "11" })
|
|
11202
|
+
);
|
|
11203
|
+
};
|
|
11204
|
+
var UserPlus_default = UserPlus;
|
|
11205
|
+
|
|
11206
|
+
// src/mantine/blocks/bid/flow/components/CollectionItem.tsx
|
|
10967
11207
|
var CollectionItem2 = ({ collection, deedId, adminAddress, userRole, onRefresh }) => {
|
|
10968
|
-
const [isExpanded, setIsExpanded] = useState40(false);
|
|
10969
|
-
const getCollectionName = (collection2) => {
|
|
10970
|
-
return collection2.protocol?.profile?.name || collection2.name || "Unnamed Collection";
|
|
10971
|
-
};
|
|
10972
|
-
const getRoleBadge = (role) => {
|
|
10973
|
-
const roleConfig = {
|
|
10974
|
-
["SA" /* ServiceProvider */]: { label: "Service Agent", color: "blue" },
|
|
10975
|
-
["EA" /* Evaluator */]: { label: "Evaluation Agent", color: "green" },
|
|
10976
|
-
["PO" /* Owner */]: { label: "Owner", color: "violet" },
|
|
10977
|
-
["IA" /* Investor */]: { label: "Investor", color: "orange" }
|
|
10978
|
-
};
|
|
10979
|
-
const config = roleConfig[role] || { label: role, color: "gray" };
|
|
10980
|
-
return /* @__PURE__ */ React134.createElement(Badge20, { size: "sm", color: config.color }, config.label);
|
|
10981
|
-
};
|
|
10982
11208
|
const serviceAgentPanelId = `bid-survey-${collection.id}-service_agent`;
|
|
10983
|
-
const serviceAgentPanelContent =
|
|
10984
|
-
() => /* @__PURE__ */
|
|
11209
|
+
const serviceAgentPanelContent = useMemo33(
|
|
11210
|
+
() => /* @__PURE__ */ React137.createElement(
|
|
10985
11211
|
BidSurveyPanel,
|
|
10986
11212
|
{
|
|
10987
11213
|
deedId,
|
|
@@ -10994,8 +11220,8 @@ var CollectionItem2 = ({ collection, deedId, adminAddress, userRole, onRefresh }
|
|
|
10994
11220
|
);
|
|
10995
11221
|
const { open: openServiceAgent } = usePanel(serviceAgentPanelId, serviceAgentPanelContent);
|
|
10996
11222
|
const evaluationAgentPanelId = `bid-survey-${collection.id}-evaluation_agent`;
|
|
10997
|
-
const evaluationAgentPanelContent =
|
|
10998
|
-
() => /* @__PURE__ */
|
|
11223
|
+
const evaluationAgentPanelContent = useMemo33(
|
|
11224
|
+
() => /* @__PURE__ */ React137.createElement(
|
|
10999
11225
|
BidSurveyPanel,
|
|
11000
11226
|
{
|
|
11001
11227
|
deedId,
|
|
@@ -11007,143 +11233,78 @@ var CollectionItem2 = ({ collection, deedId, adminAddress, userRole, onRefresh }
|
|
|
11007
11233
|
[deedId, collection.id, onRefresh]
|
|
11008
11234
|
);
|
|
11009
11235
|
const { open: openEvaluationAgent } = usePanel(evaluationAgentPanelId, evaluationAgentPanelContent);
|
|
11236
|
+
const bidsListPanelId = `bids-list-${collection.id}`;
|
|
11237
|
+
const bidsListPanelContent = useMemo33(
|
|
11238
|
+
() => /* @__PURE__ */ React137.createElement(BidsList, { collectionId: collection.id, deedId, adminAddress, onRefresh }),
|
|
11239
|
+
[collection.id, deedId, adminAddress, onRefresh]
|
|
11240
|
+
);
|
|
11241
|
+
const { open: openBidsList } = usePanel(bidsListPanelId, bidsListPanelContent);
|
|
11010
11242
|
const renderActionButton = () => {
|
|
11011
11243
|
if (userRole === "PO" /* Owner */) {
|
|
11012
|
-
return /* @__PURE__ */
|
|
11244
|
+
return /* @__PURE__ */ React137.createElement(ActionIcon18, { variant: "subtle", size: "lg", onClick: openBidsList }, /* @__PURE__ */ React137.createElement(IconArrowRight4, { size: 20 }));
|
|
11013
11245
|
} else if (userRole === "SA" /* ServiceProvider */ || userRole === "EA" /* Evaluator */) {
|
|
11014
|
-
return
|
|
11246
|
+
return /* @__PURE__ */ React137.createElement(Badge20, { size: "sm", color: getRoleColor(userRole) }, getRoleLabel(userRole));
|
|
11015
11247
|
} else {
|
|
11016
|
-
return /* @__PURE__ */
|
|
11248
|
+
return /* @__PURE__ */ React137.createElement(Menu2, { shadow: "md", width: 200 }, /* @__PURE__ */ React137.createElement(Menu2.Target, null, /* @__PURE__ */ React137.createElement(Button30, { size: "xs", variant: "light", rightSection: /* @__PURE__ */ React137.createElement(IconChevronDown5, { size: 14 }) }, "Apply")), /* @__PURE__ */ React137.createElement(Menu2.Dropdown, null, /* @__PURE__ */ React137.createElement(Menu2.Label, null, "Select Role"), /* @__PURE__ */ React137.createElement(Menu2.Item, { onClick: openServiceAgent }, "Service Agent"), /* @__PURE__ */ React137.createElement(Menu2.Item, { onClick: openEvaluationAgent }, "Evaluation Agent")));
|
|
11249
|
+
}
|
|
11250
|
+
};
|
|
11251
|
+
const getCollectionIcon = () => {
|
|
11252
|
+
if (userRole === "PO" /* Owner */) {
|
|
11253
|
+
return /* @__PURE__ */ React137.createElement(UserCheck_default, null);
|
|
11017
11254
|
}
|
|
11255
|
+
return /* @__PURE__ */ React137.createElement(UserPlus_default, null);
|
|
11018
11256
|
};
|
|
11019
|
-
return /* @__PURE__ */
|
|
11257
|
+
return /* @__PURE__ */ React137.createElement(ListItemContainer, { isChecked: false, onClick: () => {
|
|
11258
|
+
} }, /* @__PURE__ */ React137.createElement(Box23, { mr: "md", style: { display: "flex", alignItems: "center" } }, getCollectionIcon()), /* @__PURE__ */ React137.createElement(Stack94, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React137.createElement(Text68, { size: "sm", fw: 500 }, getCollectionName(collection)), collection.description && /* @__PURE__ */ React137.createElement(Text68, { size: "xs", c: "dimmed" }, collection.description)), renderActionButton());
|
|
11020
11259
|
};
|
|
11260
|
+
|
|
11261
|
+
// src/mantine/blocks/bid/flow/components/ClaimCollectionsList.tsx
|
|
11021
11262
|
var ClaimCollectionsList2 = ({ collections, deedId, adminAddress, userAddress, onRefresh }) => {
|
|
11022
|
-
const
|
|
11023
|
-
const [userRoles, setUserRoles] = useState40({});
|
|
11024
|
-
const [loadingRoles, setLoadingRoles] = useState40(true);
|
|
11025
|
-
useEffect29(() => {
|
|
11026
|
-
const fetchUserRoles = async () => {
|
|
11027
|
-
if (!collections || collections.length === 0 || !userAddress || !adminAddress) {
|
|
11028
|
-
setLoadingRoles(false);
|
|
11029
|
-
return;
|
|
11030
|
-
}
|
|
11031
|
-
try {
|
|
11032
|
-
setLoadingRoles(true);
|
|
11033
|
-
const collectionIds = collections.map((c) => c.id);
|
|
11034
|
-
const roles = await handlers.getUserRoles({
|
|
11035
|
-
userAddress,
|
|
11036
|
-
adminAddress,
|
|
11037
|
-
deedDid: deedId,
|
|
11038
|
-
collectionIds
|
|
11039
|
-
});
|
|
11040
|
-
const rolesMap = {};
|
|
11041
|
-
collections.forEach((collection) => {
|
|
11042
|
-
const roleData = roles?.find((r) => r.collectionId === collection.id);
|
|
11043
|
-
rolesMap[collection.id] = roleData?.role || null;
|
|
11044
|
-
});
|
|
11045
|
-
setUserRoles(rolesMap);
|
|
11046
|
-
} catch (error) {
|
|
11047
|
-
console.error("Error fetching user roles:", error);
|
|
11048
|
-
const rolesMap = {};
|
|
11049
|
-
collections.forEach((collection) => {
|
|
11050
|
-
rolesMap[collection.id] = null;
|
|
11051
|
-
});
|
|
11052
|
-
setUserRoles(rolesMap);
|
|
11053
|
-
} finally {
|
|
11054
|
-
setLoadingRoles(false);
|
|
11055
|
-
}
|
|
11056
|
-
};
|
|
11057
|
-
fetchUserRoles();
|
|
11058
|
-
}, [collections, userAddress, adminAddress, handlers, deedId]);
|
|
11263
|
+
const { userRoles, loading } = useUserRoles(collections, userAddress, adminAddress, deedId);
|
|
11059
11264
|
if (!collections || collections.length === 0) {
|
|
11060
|
-
return /* @__PURE__ */
|
|
11265
|
+
return /* @__PURE__ */ React138.createElement(Text69, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No claim collections found");
|
|
11061
11266
|
}
|
|
11062
|
-
if (
|
|
11063
|
-
return /* @__PURE__ */
|
|
11267
|
+
if (loading) {
|
|
11268
|
+
return /* @__PURE__ */ React138.createElement(Center7, { py: "md" }, /* @__PURE__ */ React138.createElement(Loader15, { size: "sm" }));
|
|
11064
11269
|
}
|
|
11065
|
-
return /* @__PURE__ */
|
|
11270
|
+
return /* @__PURE__ */ React138.createElement(Stack95, { gap: "md", px: 5 }, collections.map((collection) => /* @__PURE__ */ React138.createElement(CollectionItem2, { key: collection.id, collection, deedId, adminAddress, userRole: userRoles[collection.id] || null, onRefresh })));
|
|
11066
11271
|
};
|
|
11067
11272
|
|
|
11068
|
-
// src/mantine/blocks/bid/flow/FlowView.tsx
|
|
11273
|
+
// src/mantine/blocks/bid/flow/components/FlowView.tsx
|
|
11069
11274
|
var BID_FLOW_PANEL_ID = "bid-flow-panel";
|
|
11070
11275
|
var BidFlowView = ({ editor, block }) => {
|
|
11071
11276
|
const { editable } = useBlocknoteContext();
|
|
11072
|
-
const
|
|
11073
|
-
const [collections, setCollections] = useState41([]);
|
|
11074
|
-
const [loading, setLoading] = useState41(false);
|
|
11075
|
-
const [error, setError] = useState41(null);
|
|
11076
|
-
const [userAddress, setUserAddress] = useState41("");
|
|
11277
|
+
const userAddress = useCurrentUser();
|
|
11077
11278
|
const panelId = `${BID_FLOW_PANEL_ID}-${block.id}`;
|
|
11078
|
-
const panelContent =
|
|
11279
|
+
const panelContent = useMemo34(() => /* @__PURE__ */ React139.createElement(TemplateConfig7, { editor, block }), [editor, block]);
|
|
11079
11280
|
const { open } = usePanel(panelId, panelContent);
|
|
11080
|
-
const selectedCollectionIds =
|
|
11281
|
+
const selectedCollectionIds = useMemo34(() => {
|
|
11081
11282
|
try {
|
|
11082
|
-
|
|
11283
|
+
const parsed = JSON.parse(block.props.selectedCollections || "[]");
|
|
11284
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
11083
11285
|
} catch {
|
|
11084
11286
|
return [];
|
|
11085
11287
|
}
|
|
11086
11288
|
}, [block.props.selectedCollections]);
|
|
11087
11289
|
const did = block.props.did;
|
|
11088
11290
|
const adminAddress = block.props.adminAddress || "";
|
|
11089
|
-
|
|
11090
|
-
const fetchUserAddress = () => {
|
|
11091
|
-
try {
|
|
11092
|
-
const user = handlers.getCurrentUser();
|
|
11093
|
-
setUserAddress(user?.address || "");
|
|
11094
|
-
} catch (err) {
|
|
11095
|
-
console.error("Error fetching current user:", err);
|
|
11096
|
-
setUserAddress("");
|
|
11097
|
-
}
|
|
11098
|
-
};
|
|
11099
|
-
fetchUserAddress();
|
|
11100
|
-
}, [handlers]);
|
|
11101
|
-
const fetchCollections = useCallback28(async () => {
|
|
11102
|
-
if (!did || selectedCollectionIds.length === 0) {
|
|
11103
|
-
setCollections([]);
|
|
11104
|
-
return;
|
|
11105
|
-
}
|
|
11106
|
-
setLoading(true);
|
|
11107
|
-
setError(null);
|
|
11108
|
-
try {
|
|
11109
|
-
const response = await handlers.getClaimCollections({ deedDid: did });
|
|
11110
|
-
const { adminAddress: adminAddress2, collections: allCollections } = response || { adminAddress: "", collections: [] };
|
|
11111
|
-
if (adminAddress2 && (!block.props.adminAddress || block.props.adminAddress === "")) {
|
|
11112
|
-
editor.updateBlock(block, {
|
|
11113
|
-
props: {
|
|
11114
|
-
...block.props,
|
|
11115
|
-
adminAddress: adminAddress2
|
|
11116
|
-
}
|
|
11117
|
-
});
|
|
11118
|
-
}
|
|
11119
|
-
const selectedCollections = (allCollections || []).filter((c) => selectedCollectionIds.includes(c?.id));
|
|
11120
|
-
setCollections(selectedCollections);
|
|
11121
|
-
} catch (err) {
|
|
11122
|
-
console.error("Error fetching collections:", err);
|
|
11123
|
-
setError(err instanceof Error ? err.message : "Failed to fetch collections");
|
|
11124
|
-
} finally {
|
|
11125
|
-
setLoading(false);
|
|
11126
|
-
}
|
|
11127
|
-
}, [did, selectedCollectionIds, handlers, editor, block]);
|
|
11128
|
-
useEffect30(() => {
|
|
11129
|
-
fetchCollections();
|
|
11130
|
-
}, [fetchCollections]);
|
|
11291
|
+
const { collections, loading, error, refetch } = useCollections(did, selectedCollectionIds, block, editor);
|
|
11131
11292
|
if (!did) {
|
|
11132
|
-
return /* @__PURE__ */
|
|
11293
|
+
return /* @__PURE__ */ React139.createElement(Center8, { py: "xl" }, /* @__PURE__ */ React139.createElement(Text70, { size: "sm", c: "dimmed" }, "Please configure the bid block in template mode first"));
|
|
11133
11294
|
}
|
|
11134
11295
|
if (selectedCollectionIds.length === 0) {
|
|
11135
|
-
return /* @__PURE__ */
|
|
11296
|
+
return /* @__PURE__ */ React139.createElement(Center8, { py: "xl" }, /* @__PURE__ */ React139.createElement(Text70, { size: "sm", c: "dimmed" }, "No claim collections selected"));
|
|
11136
11297
|
}
|
|
11137
|
-
return /* @__PURE__ */
|
|
11298
|
+
return /* @__PURE__ */ React139.createElement(Stack96, { w: "100%" }, /* @__PURE__ */ React139.createElement(Flex23, { px: 5, align: "center", justify: "space-between" }, /* @__PURE__ */ React139.createElement(Title16, { order: 4 }, "Bid Application"), /* @__PURE__ */ React139.createElement(Flex23, { gap: "xs" }, /* @__PURE__ */ React139.createElement(ActionIcon19, { variant: "subtle", size: "sm", onClick: refetch, loading }, /* @__PURE__ */ React139.createElement(IconRefresh3, { size: 18 })), editable && /* @__PURE__ */ React139.createElement(ActionIcon19, { variant: "subtle", size: "sm", onClick: open }, /* @__PURE__ */ React139.createElement(IconSettings4, { size: 18 })))), loading ? /* @__PURE__ */ React139.createElement(Center8, { py: "xl" }, /* @__PURE__ */ React139.createElement(Loader16, { size: "md" })) : error ? /* @__PURE__ */ React139.createElement(Alert18, { color: "red", title: "Failed to load collections", icon: /* @__PURE__ */ React139.createElement(IconAlertCircle6, { size: 18 }) }, /* @__PURE__ */ React139.createElement(Text70, { size: "sm" }, error)) : /* @__PURE__ */ React139.createElement(ClaimCollectionsList2, { collections, deedId: did, adminAddress, userAddress, onRefresh: refetch }));
|
|
11138
11299
|
};
|
|
11139
11300
|
|
|
11140
11301
|
// src/mantine/blocks/bid/BidBlock.tsx
|
|
11141
11302
|
function BidBlock({ editor, block }) {
|
|
11142
11303
|
const { docType } = useBlocknoteContext();
|
|
11143
11304
|
if (docType === "template") {
|
|
11144
|
-
return /* @__PURE__ */
|
|
11305
|
+
return /* @__PURE__ */ React140.createElement(BidTemplateView, { editor, block });
|
|
11145
11306
|
}
|
|
11146
|
-
return /* @__PURE__ */
|
|
11307
|
+
return /* @__PURE__ */ React140.createElement(BidFlowView, { editor, block });
|
|
11147
11308
|
}
|
|
11148
11309
|
|
|
11149
11310
|
// src/mantine/blocks/bid/BidBlockSpec.tsx
|
|
@@ -11162,24 +11323,24 @@ var BidBlockSpec = createReactBlockSpec9(
|
|
|
11162
11323
|
{
|
|
11163
11324
|
render: (props) => {
|
|
11164
11325
|
const ixoProps = props;
|
|
11165
|
-
return /* @__PURE__ */
|
|
11326
|
+
return /* @__PURE__ */ React141.createElement(BidBlock, { ...ixoProps });
|
|
11166
11327
|
}
|
|
11167
11328
|
}
|
|
11168
11329
|
);
|
|
11169
11330
|
|
|
11170
11331
|
// src/mantine/blocks/evaluator/EvaluatorBlock.tsx
|
|
11171
|
-
import
|
|
11332
|
+
import React148 from "react";
|
|
11172
11333
|
|
|
11173
11334
|
// src/mantine/blocks/evaluator/template/TemplateView.tsx
|
|
11174
|
-
import
|
|
11175
|
-
import { Group as Group42, Stack as
|
|
11335
|
+
import React144, { useMemo as useMemo36 } from "react";
|
|
11336
|
+
import { Group as Group42, Stack as Stack97, Text as Text71, Badge as Badge21 } from "@mantine/core";
|
|
11176
11337
|
|
|
11177
11338
|
// src/mantine/blocks/evaluator/template/TemplateConfig.tsx
|
|
11178
|
-
import
|
|
11179
|
-
import { Paper as
|
|
11339
|
+
import React143, { useCallback as useCallback31 } from "react";
|
|
11340
|
+
import { Paper as Paper18, CloseButton as CloseButton14, Title as Title17 } from "@mantine/core";
|
|
11180
11341
|
|
|
11181
11342
|
// src/mantine/blocks/evaluator/template/GeneralTab.tsx
|
|
11182
|
-
import
|
|
11343
|
+
import React142, { useEffect as useEffect32, useState as useState44, useCallback as useCallback30, useMemo as useMemo35 } from "react";
|
|
11183
11344
|
var GeneralTab8 = ({
|
|
11184
11345
|
title,
|
|
11185
11346
|
description,
|
|
@@ -11192,31 +11353,29 @@ var GeneralTab8 = ({
|
|
|
11192
11353
|
onSelectedCollectionsChange,
|
|
11193
11354
|
onAdminAddressChange
|
|
11194
11355
|
}) => {
|
|
11195
|
-
const [localTitle, setLocalTitle] =
|
|
11196
|
-
const [localDescription, setLocalDescription] =
|
|
11197
|
-
|
|
11356
|
+
const [localTitle, setLocalTitle] = useState44(title || "");
|
|
11357
|
+
const [localDescription, setLocalDescription] = useState44(description || "");
|
|
11358
|
+
useEffect32(() => {
|
|
11198
11359
|
setLocalTitle(title || "");
|
|
11199
11360
|
}, [title]);
|
|
11200
|
-
|
|
11361
|
+
useEffect32(() => {
|
|
11201
11362
|
setLocalDescription(description || "");
|
|
11202
11363
|
}, [description]);
|
|
11203
|
-
const parsedSelectedCollections =
|
|
11364
|
+
const parsedSelectedCollections = useMemo35(() => {
|
|
11204
11365
|
try {
|
|
11205
11366
|
return JSON.parse(selectedCollections || "[]");
|
|
11206
11367
|
} catch {
|
|
11207
11368
|
return [];
|
|
11208
11369
|
}
|
|
11209
11370
|
}, [selectedCollections]);
|
|
11210
|
-
const handleCollectionsChange =
|
|
11371
|
+
const handleCollectionsChange = useCallback30(
|
|
11211
11372
|
(collections) => {
|
|
11212
|
-
console.log("[Evaluator GeneralTab] handleCollectionsChange called with:", collections);
|
|
11213
11373
|
const stringified = JSON.stringify(collections || []);
|
|
11214
|
-
console.log("[Evaluator GeneralTab] Stringified:", stringified);
|
|
11215
11374
|
onSelectedCollectionsChange(stringified);
|
|
11216
11375
|
},
|
|
11217
11376
|
[onSelectedCollectionsChange]
|
|
11218
11377
|
);
|
|
11219
|
-
const handleAdminAddressChange =
|
|
11378
|
+
const handleAdminAddressChange = useCallback30(
|
|
11220
11379
|
(adminAddress2) => {
|
|
11221
11380
|
if (onAdminAddressChange) {
|
|
11222
11381
|
onAdminAddressChange(adminAddress2);
|
|
@@ -11224,7 +11383,7 @@ var GeneralTab8 = ({
|
|
|
11224
11383
|
},
|
|
11225
11384
|
[onAdminAddressChange]
|
|
11226
11385
|
);
|
|
11227
|
-
return /* @__PURE__ */
|
|
11386
|
+
return /* @__PURE__ */ React142.createElement(BaseSection, null, /* @__PURE__ */ React142.createElement(
|
|
11228
11387
|
BaseTextInput,
|
|
11229
11388
|
{
|
|
11230
11389
|
label: "Title",
|
|
@@ -11236,7 +11395,7 @@ var GeneralTab8 = ({
|
|
|
11236
11395
|
onTitleChange(newTitle);
|
|
11237
11396
|
}
|
|
11238
11397
|
}
|
|
11239
|
-
), /* @__PURE__ */
|
|
11398
|
+
), /* @__PURE__ */ React142.createElement(
|
|
11240
11399
|
BaseTextArea,
|
|
11241
11400
|
{
|
|
11242
11401
|
label: "Description",
|
|
@@ -11249,7 +11408,7 @@ var GeneralTab8 = ({
|
|
|
11249
11408
|
onDescriptionChange(newDescription);
|
|
11250
11409
|
}
|
|
11251
11410
|
}
|
|
11252
|
-
), /* @__PURE__ */
|
|
11411
|
+
), /* @__PURE__ */ React142.createElement(
|
|
11253
11412
|
CollectionSelector,
|
|
11254
11413
|
{
|
|
11255
11414
|
did: deedDid,
|
|
@@ -11265,9 +11424,8 @@ var GeneralTab8 = ({
|
|
|
11265
11424
|
// src/mantine/blocks/evaluator/template/TemplateConfig.tsx
|
|
11266
11425
|
var TemplateConfig8 = ({ editor, block }) => {
|
|
11267
11426
|
const { closePanel } = usePanelStore();
|
|
11268
|
-
const updateProp =
|
|
11427
|
+
const updateProp = useCallback31(
|
|
11269
11428
|
(key, value) => {
|
|
11270
|
-
console.log("[Evaluator TemplateConfig] Updating prop:", key, value);
|
|
11271
11429
|
editor.updateBlock(block, {
|
|
11272
11430
|
props: {
|
|
11273
11431
|
...block.props,
|
|
@@ -11277,8 +11435,8 @@ var TemplateConfig8 = ({ editor, block }) => {
|
|
|
11277
11435
|
},
|
|
11278
11436
|
[editor, block]
|
|
11279
11437
|
);
|
|
11280
|
-
return /* @__PURE__ */
|
|
11281
|
-
|
|
11438
|
+
return /* @__PURE__ */ React143.createElement(
|
|
11439
|
+
Paper18,
|
|
11282
11440
|
{
|
|
11283
11441
|
p: "md",
|
|
11284
11442
|
shadow: "sm",
|
|
@@ -11288,7 +11446,7 @@ var TemplateConfig8 = ({ editor, block }) => {
|
|
|
11288
11446
|
flexDirection: "column"
|
|
11289
11447
|
}
|
|
11290
11448
|
},
|
|
11291
|
-
/* @__PURE__ */
|
|
11449
|
+
/* @__PURE__ */ React143.createElement(
|
|
11292
11450
|
"div",
|
|
11293
11451
|
{
|
|
11294
11452
|
style: {
|
|
@@ -11298,17 +11456,17 @@ var TemplateConfig8 = ({ editor, block }) => {
|
|
|
11298
11456
|
marginBottom: "1rem"
|
|
11299
11457
|
}
|
|
11300
11458
|
},
|
|
11301
|
-
/* @__PURE__ */
|
|
11302
|
-
/* @__PURE__ */
|
|
11459
|
+
/* @__PURE__ */ React143.createElement(Title17, { order: 3 }, "Evaluator Settings"),
|
|
11460
|
+
/* @__PURE__ */ React143.createElement(CloseButton14, { onClick: closePanel })
|
|
11303
11461
|
),
|
|
11304
|
-
/* @__PURE__ */
|
|
11462
|
+
/* @__PURE__ */ React143.createElement(
|
|
11305
11463
|
ReusablePanel,
|
|
11306
11464
|
{
|
|
11307
11465
|
extraTabs: [
|
|
11308
11466
|
{
|
|
11309
11467
|
label: "General",
|
|
11310
11468
|
value: "general",
|
|
11311
|
-
content: /* @__PURE__ */
|
|
11469
|
+
content: /* @__PURE__ */ React143.createElement(
|
|
11312
11470
|
GeneralTab8,
|
|
11313
11471
|
{
|
|
11314
11472
|
title: block.props.title || "",
|
|
@@ -11335,24 +11493,24 @@ var TemplateConfig8 = ({ editor, block }) => {
|
|
|
11335
11493
|
var EVALUATOR_TEMPLATE_PANEL_ID = "evaluator-template-panel";
|
|
11336
11494
|
var EvaluatorTemplateView = ({ editor, block }) => {
|
|
11337
11495
|
const panelId = `${EVALUATOR_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
11338
|
-
const panelContent =
|
|
11496
|
+
const panelContent = useMemo36(() => /* @__PURE__ */ React144.createElement(TemplateConfig8, { editor, block }), [editor, block]);
|
|
11339
11497
|
const { open } = usePanel(panelId, panelContent);
|
|
11340
|
-
return /* @__PURE__ */
|
|
11498
|
+
return /* @__PURE__ */ React144.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React144.createElement(Badge21, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React144.createElement(Group42, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React144.createElement(Group42, { wrap: "nowrap", align: "center" }, getIcon("checklist", block.props.icon), /* @__PURE__ */ React144.createElement(Stack97, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React144.createElement(Text71, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Evaluator Title"), /* @__PURE__ */ React144.createElement(Text71, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description || "Evaluator description")))));
|
|
11341
11499
|
};
|
|
11342
11500
|
|
|
11343
11501
|
// src/mantine/blocks/evaluator/flow/FlowView.tsx
|
|
11344
|
-
import
|
|
11345
|
-
import { Stack as
|
|
11502
|
+
import React147, { useMemo as useMemo39 } from "react";
|
|
11503
|
+
import { Stack as Stack100, Text as Text74, Loader as Loader19, Center as Center10, Alert as Alert20, Title as Title19, Flex as Flex24, ActionIcon as ActionIcon22 } from "@mantine/core";
|
|
11346
11504
|
import { IconSettings as IconSettings5, IconRefresh as IconRefresh5, IconAlertCircle as IconAlertCircle8 } from "@tabler/icons-react";
|
|
11347
11505
|
|
|
11348
11506
|
// src/mantine/blocks/evaluator/flow/ClaimCollectionsList.tsx
|
|
11349
|
-
import
|
|
11350
|
-
import { Stack as
|
|
11507
|
+
import React146, { useMemo as useMemo38, useEffect as useEffect34, useRef as useRef7 } from "react";
|
|
11508
|
+
import { Stack as Stack99, Text as Text73, ActionIcon as ActionIcon21, Tooltip as Tooltip9, Loader as Loader18, Center as Center9 } from "@mantine/core";
|
|
11351
11509
|
|
|
11352
11510
|
// src/mantine/blocks/evaluator/flow/ClaimsList.tsx
|
|
11353
|
-
import
|
|
11354
|
-
import { Paper as
|
|
11355
|
-
import { IconAlertCircle as IconAlertCircle7, IconArrowRight as
|
|
11511
|
+
import React145, { useState as useState45, useEffect as useEffect33, useCallback as useCallback32, useMemo as useMemo37 } from "react";
|
|
11512
|
+
import { Paper as Paper19, CloseButton as CloseButton15, Title as Title18, Loader as Loader17, Stack as Stack98, Text as Text72, ActionIcon as ActionIcon20, Alert as Alert19, Badge as Badge22, Group as Group43, Button as Button31, Divider as Divider7 } from "@mantine/core";
|
|
11513
|
+
import { IconAlertCircle as IconAlertCircle7, IconArrowRight as IconArrowRight5, IconRefresh as IconRefresh4, IconArrowLeft as IconArrowLeft3 } from "@tabler/icons-react";
|
|
11356
11514
|
import { Survey as Survey4, SurveyModel as SurveyModel4 } from "@ixo/surveys";
|
|
11357
11515
|
|
|
11358
11516
|
// src/mantine/blocks/evaluator/flow/theme.ts
|
|
@@ -11514,67 +11672,68 @@ var surveyTheme2 = {
|
|
|
11514
11672
|
};
|
|
11515
11673
|
|
|
11516
11674
|
// src/mantine/blocks/evaluator/flow/ClaimsList.tsx
|
|
11517
|
-
var
|
|
11675
|
+
var SURVEY_THEME_VARIABLES2 = Object.entries(surveyTheme2.cssVariables ?? {}).reduce((acc, [key, value]) => {
|
|
11518
11676
|
acc[key] = value;
|
|
11519
11677
|
return acc;
|
|
11520
11678
|
}, {});
|
|
11521
|
-
var
|
|
11522
|
-
var
|
|
11679
|
+
var SURVEY_THEME_BACKGROUND2 = SURVEY_THEME_VARIABLES2["--sjs-general-backcolor"] ?? "#050505";
|
|
11680
|
+
var SURVEY_THEME_FOREGROUND2 = SURVEY_THEME_VARIABLES2["--sjs-general-forecolor"] ?? "#ffffff";
|
|
11523
11681
|
var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvaluationComplete }) => {
|
|
11524
11682
|
const { closePanel } = usePanelStore();
|
|
11525
11683
|
const handlers = useBlocknoteHandlers();
|
|
11526
|
-
const [viewMode, setViewMode] =
|
|
11527
|
-
const [claims, setClaims] =
|
|
11528
|
-
const [loading, setLoading] =
|
|
11529
|
-
const [error, setError] =
|
|
11530
|
-
const [selectedClaim, setSelectedClaim] =
|
|
11531
|
-
const [claimData, setClaimData] =
|
|
11532
|
-
const [surveyJson, setSurveyJson] =
|
|
11533
|
-
const [surveyLoading, setSurveyLoading] =
|
|
11534
|
-
const [surveyError, setSurveyError] =
|
|
11535
|
-
const [evaluating, setEvaluating] =
|
|
11536
|
-
const fetchClaims =
|
|
11684
|
+
const [viewMode, setViewMode] = useState45("list");
|
|
11685
|
+
const [claims, setClaims] = useState45([]);
|
|
11686
|
+
const [loading, setLoading] = useState45(true);
|
|
11687
|
+
const [error, setError] = useState45(null);
|
|
11688
|
+
const [selectedClaim, setSelectedClaim] = useState45(null);
|
|
11689
|
+
const [claimData, setClaimData] = useState45(null);
|
|
11690
|
+
const [surveyJson, setSurveyJson] = useState45(null);
|
|
11691
|
+
const [surveyLoading, setSurveyLoading] = useState45(false);
|
|
11692
|
+
const [surveyError, setSurveyError] = useState45(null);
|
|
11693
|
+
const [evaluating, setEvaluating] = useState45(false);
|
|
11694
|
+
const fetchClaims = useCallback32(async () => {
|
|
11537
11695
|
try {
|
|
11538
11696
|
setLoading(true);
|
|
11539
11697
|
setError(null);
|
|
11540
11698
|
const result = await handlers.getClaimsPerCollectionId({
|
|
11541
11699
|
collectionId
|
|
11542
11700
|
});
|
|
11543
|
-
setClaims(result
|
|
11701
|
+
setClaims(Array.isArray(result) ? result : []);
|
|
11544
11702
|
} catch (err) {
|
|
11545
|
-
console.error("Error fetching claims:", err);
|
|
11546
11703
|
setError(err instanceof Error ? err.message : "Failed to fetch claims");
|
|
11547
11704
|
setClaims([]);
|
|
11548
11705
|
} finally {
|
|
11549
11706
|
setLoading(false);
|
|
11550
11707
|
}
|
|
11551
|
-
}, [collectionId
|
|
11552
|
-
|
|
11708
|
+
}, [collectionId]);
|
|
11709
|
+
useEffect33(() => {
|
|
11553
11710
|
fetchClaims();
|
|
11554
11711
|
}, [fetchClaims]);
|
|
11555
|
-
const fetchClaimAndSurvey =
|
|
11712
|
+
const fetchClaimAndSurvey = useCallback32(
|
|
11556
11713
|
async (claim) => {
|
|
11557
11714
|
try {
|
|
11558
11715
|
setSurveyLoading(true);
|
|
11559
11716
|
setSurveyError(null);
|
|
11560
11717
|
const claimDataResult = await handlers.getClaimData(collectionId, claim.claimId);
|
|
11561
|
-
setClaimData(claimDataResult);
|
|
11718
|
+
setClaimData(claimDataResult || null);
|
|
11562
11719
|
const surveyResult = await handlers.getBidContributorSurveyTemplate(deedId);
|
|
11563
|
-
if (surveyResult) {
|
|
11720
|
+
if (surveyResult?.surveyTemplate) {
|
|
11564
11721
|
setSurveyJson(surveyResult.surveyTemplate);
|
|
11565
11722
|
} else {
|
|
11566
11723
|
setSurveyError("No survey template found for this deed");
|
|
11567
11724
|
}
|
|
11568
11725
|
} catch (err) {
|
|
11569
|
-
console.error("Error fetching claim data:", err);
|
|
11570
11726
|
setSurveyError(err instanceof Error ? err.message : "Failed to load claim data");
|
|
11727
|
+
setClaimData(null);
|
|
11728
|
+
setSurveyJson(null);
|
|
11571
11729
|
} finally {
|
|
11572
11730
|
setSurveyLoading(false);
|
|
11573
11731
|
}
|
|
11574
11732
|
},
|
|
11575
|
-
|
|
11733
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11734
|
+
[collectionId, deedId]
|
|
11576
11735
|
);
|
|
11577
|
-
const handleViewClaim =
|
|
11736
|
+
const handleViewClaim = useCallback32(
|
|
11578
11737
|
(claim) => {
|
|
11579
11738
|
setSelectedClaim(claim);
|
|
11580
11739
|
fetchClaimAndSurvey(claim);
|
|
@@ -11582,7 +11741,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11582
11741
|
},
|
|
11583
11742
|
[fetchClaimAndSurvey]
|
|
11584
11743
|
);
|
|
11585
|
-
const handleBackToList =
|
|
11744
|
+
const handleBackToList = useCallback32(() => {
|
|
11586
11745
|
setViewMode("list");
|
|
11587
11746
|
setSelectedClaim(null);
|
|
11588
11747
|
setClaimData(null);
|
|
@@ -11591,7 +11750,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11591
11750
|
setEvaluating(false);
|
|
11592
11751
|
fetchClaims();
|
|
11593
11752
|
}, [fetchClaims]);
|
|
11594
|
-
const surveyModel =
|
|
11753
|
+
const surveyModel = useMemo37(() => {
|
|
11595
11754
|
if (!surveyJson || !claimData) return null;
|
|
11596
11755
|
const model = new SurveyModel4(surveyJson);
|
|
11597
11756
|
model.applyTheme(surveyTheme2);
|
|
@@ -11603,18 +11762,18 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11603
11762
|
}
|
|
11604
11763
|
return model;
|
|
11605
11764
|
}, [surveyJson, claimData]);
|
|
11606
|
-
const surveyContainerStyle =
|
|
11765
|
+
const surveyContainerStyle = useMemo37(
|
|
11607
11766
|
() => ({
|
|
11608
11767
|
flex: 1,
|
|
11609
11768
|
overflow: "auto",
|
|
11610
|
-
backgroundColor:
|
|
11611
|
-
color:
|
|
11612
|
-
...
|
|
11769
|
+
backgroundColor: SURVEY_THEME_BACKGROUND2,
|
|
11770
|
+
color: SURVEY_THEME_FOREGROUND2,
|
|
11771
|
+
...SURVEY_THEME_VARIABLES2,
|
|
11613
11772
|
padding: "1rem"
|
|
11614
11773
|
}),
|
|
11615
11774
|
[]
|
|
11616
11775
|
);
|
|
11617
|
-
const handleApprove =
|
|
11776
|
+
const handleApprove = useCallback32(async () => {
|
|
11618
11777
|
if (!selectedClaim) return;
|
|
11619
11778
|
try {
|
|
11620
11779
|
setEvaluating(true);
|
|
@@ -11637,30 +11796,26 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11637
11796
|
// Optional - pass undefined for now
|
|
11638
11797
|
}
|
|
11639
11798
|
);
|
|
11640
|
-
console.log("Claim approved successfully:", selectedClaim.claimId);
|
|
11641
11799
|
handleBackToList();
|
|
11642
11800
|
} catch (error2) {
|
|
11643
|
-
console.error("Failed to approve claim:", error2);
|
|
11644
11801
|
setSurveyError(error2 instanceof Error ? error2.message : "Failed to approve claim");
|
|
11645
11802
|
setEvaluating(false);
|
|
11646
11803
|
}
|
|
11647
11804
|
}, [selectedClaim, handlers, deedId, collectionId, adminAddress, handleBackToList]);
|
|
11648
|
-
const handleReject =
|
|
11805
|
+
const handleReject = useCallback32(async () => {
|
|
11649
11806
|
if (!selectedClaim) return;
|
|
11650
11807
|
try {
|
|
11651
11808
|
setEvaluating(true);
|
|
11652
11809
|
setSurveyError(null);
|
|
11653
|
-
console.log("Rejecting claim:", selectedClaim.claimId);
|
|
11654
11810
|
handleBackToList();
|
|
11655
11811
|
} catch (error2) {
|
|
11656
|
-
console.error("Failed to reject claim:", error2);
|
|
11657
11812
|
setSurveyError(error2 instanceof Error ? error2.message : "Failed to reject claim");
|
|
11658
11813
|
} finally {
|
|
11659
11814
|
setEvaluating(false);
|
|
11660
11815
|
}
|
|
11661
11816
|
}, [selectedClaim, handleBackToList]);
|
|
11662
|
-
return /* @__PURE__ */
|
|
11663
|
-
|
|
11817
|
+
return /* @__PURE__ */ React145.createElement(
|
|
11818
|
+
Paper19,
|
|
11664
11819
|
{
|
|
11665
11820
|
p: "md",
|
|
11666
11821
|
shadow: "sm",
|
|
@@ -11671,7 +11826,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11671
11826
|
overflow: "hidden"
|
|
11672
11827
|
}
|
|
11673
11828
|
},
|
|
11674
|
-
/* @__PURE__ */
|
|
11829
|
+
/* @__PURE__ */ React145.createElement(
|
|
11675
11830
|
"div",
|
|
11676
11831
|
{
|
|
11677
11832
|
style: {
|
|
@@ -11681,10 +11836,10 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11681
11836
|
marginBottom: "1rem"
|
|
11682
11837
|
}
|
|
11683
11838
|
},
|
|
11684
|
-
/* @__PURE__ */
|
|
11685
|
-
/* @__PURE__ */
|
|
11839
|
+
/* @__PURE__ */ React145.createElement("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" } }, viewMode === "survey" && /* @__PURE__ */ React145.createElement(ActionIcon20, { variant: "subtle", onClick: handleBackToList }, /* @__PURE__ */ React145.createElement(IconArrowLeft3, { size: 20 })), /* @__PURE__ */ React145.createElement(Title18, { order: 3 }, viewMode === "list" ? `${collectionName} - Claims` : `Evaluate Claim #${selectedClaim?.claimId.slice(-8)}`), viewMode === "list" && !loading && claims.length > 0 && /* @__PURE__ */ React145.createElement(Badge22, { size: "lg", variant: "light" }, claims.length)),
|
|
11840
|
+
/* @__PURE__ */ React145.createElement(Group43, { gap: "xs" }, viewMode === "list" && /* @__PURE__ */ React145.createElement(ActionIcon20, { variant: "subtle", onClick: fetchClaims, loading, title: "Refresh claims" }, /* @__PURE__ */ React145.createElement(IconRefresh4, { size: 18 })), /* @__PURE__ */ React145.createElement(CloseButton15, { onClick: closePanel }))
|
|
11686
11841
|
),
|
|
11687
|
-
/* @__PURE__ */
|
|
11842
|
+
/* @__PURE__ */ React145.createElement(
|
|
11688
11843
|
"div",
|
|
11689
11844
|
{
|
|
11690
11845
|
style: {
|
|
@@ -11693,7 +11848,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11693
11848
|
position: "relative"
|
|
11694
11849
|
}
|
|
11695
11850
|
},
|
|
11696
|
-
/* @__PURE__ */
|
|
11851
|
+
/* @__PURE__ */ React145.createElement(
|
|
11697
11852
|
"div",
|
|
11698
11853
|
{
|
|
11699
11854
|
style: {
|
|
@@ -11711,9 +11866,9 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11711
11866
|
pointerEvents: viewMode === "list" ? "auto" : "none"
|
|
11712
11867
|
}
|
|
11713
11868
|
},
|
|
11714
|
-
/* @__PURE__ */
|
|
11869
|
+
/* @__PURE__ */ React145.createElement(Stack98, { gap: "md", style: { flex: 1 } }, loading ? /* @__PURE__ */ React145.createElement(Stack98, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React145.createElement(Loader17, { size: "lg" }), /* @__PURE__ */ React145.createElement(Text72, { size: "sm", c: "dimmed" }, "Loading claims...")) : error ? /* @__PURE__ */ React145.createElement(Alert19, { color: "red", title: "Failed to load claims", icon: /* @__PURE__ */ React145.createElement(IconAlertCircle7, { size: 18 }) }, /* @__PURE__ */ React145.createElement(Text72, { size: "sm" }, error)) : claims.length === 0 ? /* @__PURE__ */ React145.createElement(Stack98, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React145.createElement(Text72, { size: "sm", c: "dimmed", ta: "center" }, "No claims found for this collection.")) : /* @__PURE__ */ React145.createElement(Stack98, { gap: "xs" }, claims.map((claim) => /* @__PURE__ */ React145.createElement(ClaimListItem, { key: claim.claimId, claim, onViewClaim: () => handleViewClaim(claim) }))))
|
|
11715
11870
|
),
|
|
11716
|
-
/* @__PURE__ */
|
|
11871
|
+
/* @__PURE__ */ React145.createElement(
|
|
11717
11872
|
"div",
|
|
11718
11873
|
{
|
|
11719
11874
|
style: {
|
|
@@ -11731,30 +11886,30 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11731
11886
|
pointerEvents: viewMode === "survey" ? "auto" : "none"
|
|
11732
11887
|
}
|
|
11733
11888
|
},
|
|
11734
|
-
surveyLoading ? /* @__PURE__ */
|
|
11889
|
+
surveyLoading ? /* @__PURE__ */ React145.createElement(Stack98, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React145.createElement(Loader17, { size: "lg" }), /* @__PURE__ */ React145.createElement(Text72, { size: "sm", c: "dimmed" }, "Loading claim data...")) : surveyError ? /* @__PURE__ */ React145.createElement(Stack98, { style: { flex: 1 } }, /* @__PURE__ */ React145.createElement(Alert19, { color: "red", title: "Failed to load claim data", icon: /* @__PURE__ */ React145.createElement(IconAlertCircle7, { size: 18 }) }, /* @__PURE__ */ React145.createElement(Text72, { size: "sm" }, surveyError))) : /* @__PURE__ */ React145.createElement(React145.Fragment, null, /* @__PURE__ */ React145.createElement("div", { style: surveyContainerStyle }, surveyModel && /* @__PURE__ */ React145.createElement(Survey4, { model: surveyModel })), /* @__PURE__ */ React145.createElement(Divider7, { my: "md" }), /* @__PURE__ */ React145.createElement(Stack98, { gap: "sm" }, /* @__PURE__ */ React145.createElement(Button31, { color: "green", onClick: handleApprove, loading: evaluating, disabled: evaluating }, "Approve Claim"), /* @__PURE__ */ React145.createElement(Button31, { color: "red", variant: "outline", onClick: handleReject, loading: evaluating, disabled: evaluating }, "Reject Claim")))
|
|
11735
11890
|
)
|
|
11736
11891
|
)
|
|
11737
11892
|
);
|
|
11738
11893
|
};
|
|
11739
11894
|
var ClaimListItem = ({ claim, onViewClaim }) => {
|
|
11740
11895
|
const handlers = useBlocknoteHandlers();
|
|
11741
|
-
const [userProfile, setUserProfile] =
|
|
11742
|
-
const [loadingProfile, setLoadingProfile] =
|
|
11743
|
-
|
|
11896
|
+
const [userProfile, setUserProfile] = useState45(null);
|
|
11897
|
+
const [loadingProfile, setLoadingProfile] = useState45(false);
|
|
11898
|
+
useEffect33(() => {
|
|
11744
11899
|
const fetchUserProfile = async () => {
|
|
11745
11900
|
if (!claim.agentDid) return;
|
|
11746
11901
|
try {
|
|
11747
11902
|
setLoadingProfile(true);
|
|
11748
11903
|
const profile = await handlers.getMatrixInfoPerDid(claim.agentDid);
|
|
11749
|
-
setUserProfile(profile);
|
|
11904
|
+
setUserProfile(profile || null);
|
|
11750
11905
|
} catch (error) {
|
|
11751
|
-
|
|
11906
|
+
setUserProfile(null);
|
|
11752
11907
|
} finally {
|
|
11753
11908
|
setLoadingProfile(false);
|
|
11754
11909
|
}
|
|
11755
11910
|
};
|
|
11756
11911
|
fetchUserProfile();
|
|
11757
|
-
}, [claim.agentDid
|
|
11912
|
+
}, [claim.agentDid]);
|
|
11758
11913
|
const getClaimStatus = (claim2) => {
|
|
11759
11914
|
if ("status" in claim2 && claim2.status) {
|
|
11760
11915
|
const status = String(claim2.status).toLowerCase();
|
|
@@ -11783,7 +11938,7 @@ var ClaimListItem = ({ claim, onViewClaim }) => {
|
|
|
11783
11938
|
}
|
|
11784
11939
|
return { status: "Pending", color: "yellow" };
|
|
11785
11940
|
};
|
|
11786
|
-
const
|
|
11941
|
+
const formatDate2 = (dateString) => {
|
|
11787
11942
|
if (!dateString) return "N/A";
|
|
11788
11943
|
try {
|
|
11789
11944
|
return new Date(dateString).toLocaleDateString();
|
|
@@ -11793,7 +11948,7 @@ var ClaimListItem = ({ claim, onViewClaim }) => {
|
|
|
11793
11948
|
};
|
|
11794
11949
|
const claimStatus = getClaimStatus(claim);
|
|
11795
11950
|
const displayName = userProfile?.displayname || (claim.agentAddress ? `${claim.agentAddress.slice(0, 12)}...` : "Unknown");
|
|
11796
|
-
return /* @__PURE__ */
|
|
11951
|
+
return /* @__PURE__ */ React145.createElement(
|
|
11797
11952
|
"div",
|
|
11798
11953
|
{
|
|
11799
11954
|
onClick: onViewClaim,
|
|
@@ -11807,24 +11962,28 @@ var ClaimListItem = ({ claim, onViewClaim }) => {
|
|
|
11807
11962
|
tabIndex: 0,
|
|
11808
11963
|
style: { cursor: "pointer" }
|
|
11809
11964
|
},
|
|
11810
|
-
/* @__PURE__ */
|
|
11965
|
+
/* @__PURE__ */ React145.createElement(ListItemContainer, null, /* @__PURE__ */ React145.createElement(Stack98, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React145.createElement(Text72, { size: "sm", fw: 500 }, "Claim #", claim.claimId.slice(-8)), /* @__PURE__ */ React145.createElement(Text72, { size: "xs", c: "dimmed" }, "Submitted: ", formatDate2(claim.submissionDate || claim.submittedAt)), claim.agentDid && /* @__PURE__ */ React145.createElement(Group43, { gap: 4 }, /* @__PURE__ */ React145.createElement(Text72, { size: "xs", c: "dimmed" }, "Agent: ", loadingProfile ? "Loading..." : displayName), userProfile?.verified && /* @__PURE__ */ React145.createElement(Text72, { size: "xs", c: "blue", fw: 600, title: "Verified user" }, "\u2713"))), /* @__PURE__ */ React145.createElement(Stack98, { gap: 4, align: "flex-end" }, /* @__PURE__ */ React145.createElement(Badge22, { color: claimStatus.color, size: "sm" }, claimStatus.status), /* @__PURE__ */ React145.createElement(ActionIcon20, { variant: "subtle", size: "sm" }, /* @__PURE__ */ React145.createElement(IconArrowRight5, { size: 16 }))))
|
|
11811
11966
|
);
|
|
11812
11967
|
};
|
|
11813
11968
|
|
|
11814
11969
|
// src/mantine/blocks/evaluator/flow/ClaimCollectionsList.tsx
|
|
11815
|
-
import { IconArrowRight as
|
|
11970
|
+
import { IconArrowRight as IconArrowRight6 } from "@tabler/icons-react";
|
|
11816
11971
|
var CollectionItem3 = ({ collection, deedId, adminAddress, userRole, onRefresh }) => {
|
|
11817
|
-
const
|
|
11818
|
-
const
|
|
11819
|
-
|
|
11972
|
+
const { getCurrentUser } = useBlocknoteHandlers();
|
|
11973
|
+
const getCurrentUserRef = useRef7(getCurrentUser);
|
|
11974
|
+
useEffect34(() => {
|
|
11975
|
+
getCurrentUserRef.current = getCurrentUser;
|
|
11976
|
+
}, [getCurrentUser]);
|
|
11977
|
+
const currentUser = getCurrentUserRef.current();
|
|
11978
|
+
const getCollectionName2 = (collection2) => {
|
|
11820
11979
|
return collection2.protocol?.profile?.name || collection2.name || "Unnamed Collection";
|
|
11821
11980
|
};
|
|
11822
11981
|
const isEvaluator = userRole === "EA" /* Evaluator */;
|
|
11823
11982
|
const canEvaluateClaims = isEvaluator;
|
|
11824
11983
|
const claimsPanelId = `evaluator-claims-list-${collection.id}`;
|
|
11825
|
-
const collectionName =
|
|
11826
|
-
const claimsPanelContent =
|
|
11827
|
-
() => /* @__PURE__ */
|
|
11984
|
+
const collectionName = getCollectionName2(collection);
|
|
11985
|
+
const claimsPanelContent = useMemo38(
|
|
11986
|
+
() => /* @__PURE__ */ React146.createElement(
|
|
11828
11987
|
ClaimsList,
|
|
11829
11988
|
{
|
|
11830
11989
|
collectionId: collection.id,
|
|
@@ -11843,122 +12002,54 @@ var CollectionItem3 = ({ collection, deedId, adminAddress, userRole, onRefresh }
|
|
|
11843
12002
|
openClaimsPanel();
|
|
11844
12003
|
}
|
|
11845
12004
|
};
|
|
11846
|
-
return /* @__PURE__ */
|
|
12005
|
+
return /* @__PURE__ */ React146.createElement("div", { style: { opacity: canEvaluateClaims ? 1 : 0.5 } }, /* @__PURE__ */ React146.createElement(ListItemContainer, null, /* @__PURE__ */ React146.createElement(Stack99, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React146.createElement(Text73, { size: "sm", fw: 500, c: canEvaluateClaims ? void 0 : "dimmed" }, getCollectionName2(collection)), collection.description && /* @__PURE__ */ React146.createElement(Text73, { size: "xs", c: "dimmed" }, collection.description)), /* @__PURE__ */ React146.createElement(Tooltip9, { label: "You need to be an evaluator agent to review claims", disabled: canEvaluateClaims, position: "left", withArrow: true }, /* @__PURE__ */ React146.createElement(ActionIcon21, { variant: "subtle", size: "lg", onClick: handleClick, disabled: !canEvaluateClaims, style: { cursor: canEvaluateClaims ? "pointer" : "not-allowed" } }, /* @__PURE__ */ React146.createElement(IconArrowRight6, { size: 20 })))));
|
|
11847
12006
|
};
|
|
11848
12007
|
var ClaimCollectionsList3 = ({ collections, deedId, adminAddress, userAddress, onRefresh }) => {
|
|
11849
|
-
const
|
|
11850
|
-
const [userRoles, setUserRoles] = useState44({});
|
|
11851
|
-
const [loadingRoles, setLoadingRoles] = useState44(true);
|
|
11852
|
-
useEffect33(() => {
|
|
11853
|
-
const fetchUserRoles = async () => {
|
|
11854
|
-
if (!collections || collections.length === 0 || !userAddress || !adminAddress) {
|
|
11855
|
-
setLoadingRoles(false);
|
|
11856
|
-
return;
|
|
11857
|
-
}
|
|
11858
|
-
try {
|
|
11859
|
-
setLoadingRoles(true);
|
|
11860
|
-
const collectionIds = collections.map((c) => c.id);
|
|
11861
|
-
const roles = await handlers.getUserRoles({
|
|
11862
|
-
userAddress,
|
|
11863
|
-
adminAddress,
|
|
11864
|
-
deedDid: deedId,
|
|
11865
|
-
collectionIds
|
|
11866
|
-
});
|
|
11867
|
-
const rolesMap = {};
|
|
11868
|
-
collections.forEach((collection) => {
|
|
11869
|
-
const roleData = roles?.find((r) => r.collectionId === collection.id);
|
|
11870
|
-
rolesMap[collection.id] = roleData?.role || null;
|
|
11871
|
-
});
|
|
11872
|
-
setUserRoles(rolesMap);
|
|
11873
|
-
} catch (error) {
|
|
11874
|
-
console.error("Error fetching user roles:", error);
|
|
11875
|
-
const rolesMap = {};
|
|
11876
|
-
collections.forEach((collection) => {
|
|
11877
|
-
rolesMap[collection.id] = null;
|
|
11878
|
-
});
|
|
11879
|
-
setUserRoles(rolesMap);
|
|
11880
|
-
} finally {
|
|
11881
|
-
setLoadingRoles(false);
|
|
11882
|
-
}
|
|
11883
|
-
};
|
|
11884
|
-
fetchUserRoles();
|
|
11885
|
-
}, [collections, userAddress, adminAddress, handlers, deedId]);
|
|
12008
|
+
const { userRoles, loading: loadingRoles } = useUserRoles(collections, userAddress, adminAddress, deedId);
|
|
11886
12009
|
if (!collections || collections.length === 0) {
|
|
11887
|
-
return /* @__PURE__ */
|
|
12010
|
+
return /* @__PURE__ */ React146.createElement(Text73, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No claim collections found");
|
|
11888
12011
|
}
|
|
11889
12012
|
if (loadingRoles) {
|
|
11890
|
-
return /* @__PURE__ */
|
|
12013
|
+
return /* @__PURE__ */ React146.createElement(Center9, { py: "md" }, /* @__PURE__ */ React146.createElement(Loader18, { size: "sm" }));
|
|
11891
12014
|
}
|
|
11892
|
-
return /* @__PURE__ */
|
|
12015
|
+
return /* @__PURE__ */ React146.createElement(Stack99, { gap: "md", px: 5 }, collections.map((collection) => /* @__PURE__ */ React146.createElement(CollectionItem3, { key: collection.id, collection, deedId, adminAddress, userRole: userRoles[collection.id] || null, onRefresh })));
|
|
11893
12016
|
};
|
|
11894
12017
|
|
|
11895
12018
|
// src/mantine/blocks/evaluator/flow/FlowView.tsx
|
|
11896
12019
|
var EvaluatorFlowView = ({ editor, block }) => {
|
|
11897
12020
|
const { editable } = useBlocknoteContext();
|
|
11898
|
-
const
|
|
11899
|
-
const
|
|
11900
|
-
const [collections, setCollections] = useState45([]);
|
|
11901
|
-
const [loading, setLoading] = useState45(false);
|
|
11902
|
-
const [error, setError] = useState45(null);
|
|
11903
|
-
const selectedCollectionIds = useMemo35(() => {
|
|
12021
|
+
const userAddress = useCurrentUser();
|
|
12022
|
+
const selectedCollectionIds = useMemo39(() => {
|
|
11904
12023
|
try {
|
|
11905
|
-
|
|
12024
|
+
const parsed = JSON.parse(block.props.selectedCollections || "[]");
|
|
12025
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
11906
12026
|
} catch {
|
|
11907
12027
|
return [];
|
|
11908
12028
|
}
|
|
11909
12029
|
}, [block.props.selectedCollections]);
|
|
11910
12030
|
const did = block.props.deedDid;
|
|
11911
12031
|
const adminAddress = block.props.adminAddress || "";
|
|
11912
|
-
const
|
|
11913
|
-
if (!did || selectedCollectionIds.length === 0) {
|
|
11914
|
-
setCollections([]);
|
|
11915
|
-
return;
|
|
11916
|
-
}
|
|
11917
|
-
setLoading(true);
|
|
11918
|
-
setError(null);
|
|
11919
|
-
try {
|
|
11920
|
-
const response = await handlers.getClaimCollections({ deedDid: did });
|
|
11921
|
-
const { adminAddress: adminAddress2, collections: allCollections } = response || { adminAddress: "", collections: [] };
|
|
11922
|
-
if (adminAddress2 && (!block.props.adminAddress || block.props.adminAddress === "")) {
|
|
11923
|
-
editor.updateBlock(block, {
|
|
11924
|
-
props: {
|
|
11925
|
-
...block.props,
|
|
11926
|
-
adminAddress: adminAddress2
|
|
11927
|
-
}
|
|
11928
|
-
});
|
|
11929
|
-
}
|
|
11930
|
-
const selectedCollections = (allCollections || []).filter((c) => selectedCollectionIds.includes(c?.id));
|
|
11931
|
-
setCollections(selectedCollections);
|
|
11932
|
-
} catch (err) {
|
|
11933
|
-
console.error("Error fetching collections:", err);
|
|
11934
|
-
setError(err instanceof Error ? err.message : "Failed to fetch collections");
|
|
11935
|
-
} finally {
|
|
11936
|
-
setLoading(false);
|
|
11937
|
-
}
|
|
11938
|
-
}, [did, selectedCollectionIds, handlers, editor, block]);
|
|
11939
|
-
useEffect34(() => {
|
|
11940
|
-
fetchCollections();
|
|
11941
|
-
}, [fetchCollections]);
|
|
12032
|
+
const { collections, loading, error, refetch } = useCollections(did, selectedCollectionIds, block, editor);
|
|
11942
12033
|
if (!did) {
|
|
11943
|
-
return /* @__PURE__ */
|
|
12034
|
+
return /* @__PURE__ */ React147.createElement(Center10, { py: "xl" }, /* @__PURE__ */ React147.createElement(Text74, { size: "sm", c: "dimmed" }, "Please configure the evaluator block in template mode first"));
|
|
11944
12035
|
}
|
|
11945
12036
|
if (selectedCollectionIds.length === 0) {
|
|
11946
|
-
return /* @__PURE__ */
|
|
12037
|
+
return /* @__PURE__ */ React147.createElement(Center10, { py: "xl" }, /* @__PURE__ */ React147.createElement(Text74, { size: "sm", c: "dimmed" }, "No claim collections selected"));
|
|
11947
12038
|
}
|
|
11948
|
-
return /* @__PURE__ */
|
|
12039
|
+
return /* @__PURE__ */ React147.createElement(Stack100, { w: "100%" }, /* @__PURE__ */ React147.createElement(Flex24, { px: 5, align: "center", justify: "space-between" }, /* @__PURE__ */ React147.createElement(Title19, { order: 4 }, "Evaluate Claims"), /* @__PURE__ */ React147.createElement(Flex24, { gap: "xs" }, /* @__PURE__ */ React147.createElement(ActionIcon22, { variant: "subtle", size: "sm", onClick: refetch, loading }, /* @__PURE__ */ React147.createElement(IconRefresh5, { size: 18 })), editable && /* @__PURE__ */ React147.createElement(ActionIcon22, { variant: "subtle", size: "sm" }, /* @__PURE__ */ React147.createElement(IconSettings5, { size: 18 })))), loading ? /* @__PURE__ */ React147.createElement(Center10, { py: "xl" }, /* @__PURE__ */ React147.createElement(Loader19, { size: "md" })) : error ? /* @__PURE__ */ React147.createElement(Alert20, { color: "red", title: "Failed to load collections", icon: /* @__PURE__ */ React147.createElement(IconAlertCircle8, { size: 18 }) }, /* @__PURE__ */ React147.createElement(Text74, { size: "sm" }, error)) : /* @__PURE__ */ React147.createElement(ClaimCollectionsList3, { collections, deedId: did, adminAddress, userAddress, onRefresh: refetch }));
|
|
11949
12040
|
};
|
|
11950
12041
|
|
|
11951
12042
|
// src/mantine/blocks/evaluator/EvaluatorBlock.tsx
|
|
11952
12043
|
function EvaluatorBlock({ editor, block }) {
|
|
11953
12044
|
const { docType } = useBlocknoteContext();
|
|
11954
12045
|
if (docType === "template") {
|
|
11955
|
-
return /* @__PURE__ */
|
|
12046
|
+
return /* @__PURE__ */ React148.createElement(EvaluatorTemplateView, { editor, block });
|
|
11956
12047
|
}
|
|
11957
|
-
return /* @__PURE__ */
|
|
12048
|
+
return /* @__PURE__ */ React148.createElement(EvaluatorFlowView, { editor, block });
|
|
11958
12049
|
}
|
|
11959
12050
|
|
|
11960
12051
|
// src/mantine/blocks/evaluator/EvaluatorBlockSpec.tsx
|
|
11961
|
-
import
|
|
12052
|
+
import React149 from "react";
|
|
11962
12053
|
import { createReactBlockSpec as createReactBlockSpec10 } from "@blocknote/react";
|
|
11963
12054
|
var EvaluatorBlockSpec = createReactBlockSpec10(
|
|
11964
12055
|
{
|
|
@@ -11976,18 +12067,18 @@ var EvaluatorBlockSpec = createReactBlockSpec10(
|
|
|
11976
12067
|
{
|
|
11977
12068
|
render: (props) => {
|
|
11978
12069
|
const ixoProps = props;
|
|
11979
|
-
return /* @__PURE__ */
|
|
12070
|
+
return /* @__PURE__ */ React149.createElement(EvaluatorBlock, { ...ixoProps });
|
|
11980
12071
|
}
|
|
11981
12072
|
}
|
|
11982
12073
|
);
|
|
11983
12074
|
|
|
11984
12075
|
// src/mantine/blocks/list/ui/ListBlocksToolbar.tsx
|
|
11985
|
-
import
|
|
12076
|
+
import React150 from "react";
|
|
11986
12077
|
import { ActionIcon as ActionIcon23, Group as Group44, Tooltip as Tooltip10 } from "@mantine/core";
|
|
11987
12078
|
import { IconChevronUp as IconChevronUp4, IconChevronDown as IconChevronDown6 } from "@tabler/icons-react";
|
|
11988
12079
|
var ListBlocksToolbar = () => {
|
|
11989
12080
|
const { broadcastCollapse } = useListBlocksUI();
|
|
11990
|
-
return /* @__PURE__ */
|
|
12081
|
+
return /* @__PURE__ */ React150.createElement(Group44, { gap: "xs" }, /* @__PURE__ */ React150.createElement(Tooltip10, { label: "Collapse all lists", withArrow: true }, /* @__PURE__ */ React150.createElement(ActionIcon23, { c: "dimmed", variant: "subtle", size: "sm", "aria-label": "Collapse all lists", onClick: () => broadcastCollapse("collapse") }, /* @__PURE__ */ React150.createElement(IconChevronUp4, { size: 18 }))), /* @__PURE__ */ React150.createElement(Tooltip10, { label: "Expand all lists", withArrow: true }, /* @__PURE__ */ React150.createElement(ActionIcon23, { c: "dimmed", variant: "subtle", size: "sm", "aria-label": "Expand all lists", onClick: () => broadcastCollapse("expand") }, /* @__PURE__ */ React150.createElement(IconChevronDown6, { size: 18 }))));
|
|
11991
12082
|
};
|
|
11992
12083
|
|
|
11993
12084
|
// src/mantine/blocks/registry/blockRegistry.ts
|
|
@@ -12143,10 +12234,10 @@ blockRegistry.register({
|
|
|
12143
12234
|
});
|
|
12144
12235
|
|
|
12145
12236
|
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
12146
|
-
import { useMemo as
|
|
12237
|
+
import { useMemo as useMemo40, useEffect as useEffect35, useState as useState46, useCallback as useCallback33 } from "react";
|
|
12147
12238
|
|
|
12148
12239
|
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
12149
|
-
import { useMemo as
|
|
12240
|
+
import { useMemo as useMemo41 } from "react";
|
|
12150
12241
|
|
|
12151
12242
|
// src/mantine/blocks/index.ts
|
|
12152
12243
|
var blockSpecs = {
|
|
@@ -12475,15 +12566,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
|
|
|
12475
12566
|
import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
|
|
12476
12567
|
|
|
12477
12568
|
// src/core/hooks/useMatrixProvider.ts
|
|
12478
|
-
import { useEffect as useEffect36, useState as useState47, useRef as
|
|
12569
|
+
import { useEffect as useEffect36, useState as useState47, useRef as useRef8, useCallback as useCallback34, useMemo as useMemo42 } from "react";
|
|
12479
12570
|
import { MatrixProvider } from "@ixo/matrix-crdt";
|
|
12480
12571
|
function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
12481
12572
|
const [matrixProvider, setProvider] = useState47(null);
|
|
12482
12573
|
const [status, setStatus] = useState47("disconnected");
|
|
12483
|
-
const isMountedRef =
|
|
12484
|
-
const providerRef =
|
|
12485
|
-
const retryTimeoutRef =
|
|
12486
|
-
const providerOptions =
|
|
12574
|
+
const isMountedRef = useRef8(true);
|
|
12575
|
+
const providerRef = useRef8(null);
|
|
12576
|
+
const retryTimeoutRef = useRef8(null);
|
|
12577
|
+
const providerOptions = useMemo42(
|
|
12487
12578
|
() => ({
|
|
12488
12579
|
translator: {
|
|
12489
12580
|
updateEventType: "matrix-crdt.doc_update",
|
|
@@ -12534,7 +12625,6 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
12534
12625
|
provider.dispose();
|
|
12535
12626
|
}
|
|
12536
12627
|
} catch (err) {
|
|
12537
|
-
console.error("Matrix setup failed", err);
|
|
12538
12628
|
if (isMountedRef.current) {
|
|
12539
12629
|
setStatus("failed");
|
|
12540
12630
|
retryTimeoutRef.current = setTimeout(() => {
|
|
@@ -12571,17 +12661,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
12571
12661
|
}
|
|
12572
12662
|
|
|
12573
12663
|
// src/mantine/hooks/useCollaborativeYDoc.ts
|
|
12574
|
-
import { useMemo as
|
|
12664
|
+
import { useMemo as useMemo43 } from "react";
|
|
12575
12665
|
import * as Y from "yjs";
|
|
12576
12666
|
function useCollaborativeYDoc(_options) {
|
|
12577
|
-
return
|
|
12667
|
+
return useMemo43(() => {
|
|
12578
12668
|
const doc = new Y.Doc();
|
|
12579
12669
|
return doc;
|
|
12580
12670
|
}, []);
|
|
12581
12671
|
}
|
|
12582
12672
|
|
|
12583
12673
|
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
12584
|
-
import { useMemo as
|
|
12674
|
+
import { useMemo as useMemo44, useEffect as useEffect37 } from "react";
|
|
12585
12675
|
function useCreateCollaborativeIxoEditor(options) {
|
|
12586
12676
|
const yDoc = useCollaborativeYDoc(options);
|
|
12587
12677
|
const {
|
|
@@ -12600,7 +12690,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12600
12690
|
matrixClient,
|
|
12601
12691
|
permissions = { write: false }
|
|
12602
12692
|
} = options || {};
|
|
12603
|
-
const memoizedUser =
|
|
12693
|
+
const memoizedUser = useMemo44(
|
|
12604
12694
|
() => ({
|
|
12605
12695
|
id: user?.id || "",
|
|
12606
12696
|
name: user?.name || "",
|
|
@@ -12615,7 +12705,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12615
12705
|
matrixClient,
|
|
12616
12706
|
roomId: options.roomId
|
|
12617
12707
|
});
|
|
12618
|
-
const defaultUploadFile =
|
|
12708
|
+
const defaultUploadFile = useMemo44(
|
|
12619
12709
|
() => uploadFile || (async (file) => {
|
|
12620
12710
|
return new Promise((resolve, reject) => {
|
|
12621
12711
|
const reader = new FileReader();
|
|
@@ -12629,7 +12719,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12629
12719
|
}),
|
|
12630
12720
|
[uploadFile]
|
|
12631
12721
|
);
|
|
12632
|
-
const schema =
|
|
12722
|
+
const schema = useMemo44(
|
|
12633
12723
|
() => BlockNoteSchema2.create({
|
|
12634
12724
|
blockSpecs: {
|
|
12635
12725
|
...defaultBlockSpecs2,
|
|
@@ -12644,11 +12734,11 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12644
12734
|
}),
|
|
12645
12735
|
[]
|
|
12646
12736
|
);
|
|
12647
|
-
const root =
|
|
12648
|
-
const documentFragment =
|
|
12649
|
-
const flowArray =
|
|
12650
|
-
const userFragment =
|
|
12651
|
-
const collaborationConfig =
|
|
12737
|
+
const root = useMemo44(() => yDoc.getMap("root"), [yDoc]);
|
|
12738
|
+
const documentFragment = useMemo44(() => yDoc.getXmlFragment("document"), [yDoc]);
|
|
12739
|
+
const flowArray = useMemo44(() => yDoc.getArray("flow"), [yDoc]);
|
|
12740
|
+
const userFragment = useMemo44(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
|
|
12741
|
+
const collaborationConfig = useMemo44(
|
|
12652
12742
|
() => ({
|
|
12653
12743
|
provider: matrixProvider,
|
|
12654
12744
|
fragment: documentFragment,
|
|
@@ -12660,7 +12750,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12660
12750
|
}),
|
|
12661
12751
|
[matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
|
|
12662
12752
|
);
|
|
12663
|
-
const ixoConfig =
|
|
12753
|
+
const ixoConfig = useMemo44(
|
|
12664
12754
|
() => ({
|
|
12665
12755
|
theme,
|
|
12666
12756
|
editable,
|
|
@@ -12679,7 +12769,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12679
12769
|
uploadFile: defaultUploadFile,
|
|
12680
12770
|
collaboration: collaborationConfig
|
|
12681
12771
|
});
|
|
12682
|
-
const titleText =
|
|
12772
|
+
const titleText = useMemo44(() => yDoc.getText("title"), [yDoc]);
|
|
12683
12773
|
let ixoEditor;
|
|
12684
12774
|
if (editor) {
|
|
12685
12775
|
ixoEditor = editor;
|
|
@@ -12694,7 +12784,6 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12694
12784
|
};
|
|
12695
12785
|
ixoEditor.updateUserProps = (block, updates) => {
|
|
12696
12786
|
if (!permissions.write) {
|
|
12697
|
-
console.warn("Cannot update user props: write permission denied");
|
|
12698
12787
|
return;
|
|
12699
12788
|
}
|
|
12700
12789
|
const prev = userFragment.get(block.id) || {};
|
|
@@ -12713,7 +12802,6 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12713
12802
|
};
|
|
12714
12803
|
ixoEditor.updateFlowMetadata = (updates) => {
|
|
12715
12804
|
if (!permissions.write) {
|
|
12716
|
-
console.warn("Cannot update flow metadata: write permission denied");
|
|
12717
12805
|
return;
|
|
12718
12806
|
}
|
|
12719
12807
|
Object.entries(updates).forEach(([key, value]) => {
|
|
@@ -12729,48 +12817,30 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12729
12817
|
return flowArray.toArray();
|
|
12730
12818
|
};
|
|
12731
12819
|
ixoEditor.setCoverImage = (imageData) => {
|
|
12732
|
-
console.log("[setCoverImage] Called with:", imageData);
|
|
12733
|
-
console.log("[setCoverImage] Permissions:", permissions);
|
|
12734
12820
|
if (!permissions.write) {
|
|
12735
|
-
console.warn("[setCoverImage] Cannot set cover image: write permission denied");
|
|
12736
12821
|
return;
|
|
12737
12822
|
}
|
|
12738
12823
|
if (imageData === void 0 || imageData === null) {
|
|
12739
|
-
console.log("[setCoverImage] Removing coverImage from yDoc root...");
|
|
12740
12824
|
root.delete("coverImage");
|
|
12741
|
-
console.log("[setCoverImage] Delete complete. Verifying:", root.get("coverImage"));
|
|
12742
12825
|
} else {
|
|
12743
|
-
console.log("[setCoverImage] Setting coverImage in yDoc root...");
|
|
12744
12826
|
root.set("coverImage", imageData);
|
|
12745
|
-
console.log("[setCoverImage] Set complete. Verifying:", root.get("coverImage"));
|
|
12746
12827
|
}
|
|
12747
12828
|
};
|
|
12748
12829
|
ixoEditor.getCoverImage = () => {
|
|
12749
|
-
|
|
12750
|
-
console.log("[getCoverImage] Retrieved:", result);
|
|
12751
|
-
return result;
|
|
12830
|
+
return root.get("coverImage");
|
|
12752
12831
|
};
|
|
12753
12832
|
ixoEditor.setLogo = (imageData) => {
|
|
12754
|
-
console.log("[setLogo] Called with:", imageData);
|
|
12755
|
-
console.log("[setLogo] Permissions:", permissions);
|
|
12756
12833
|
if (!permissions.write) {
|
|
12757
|
-
console.warn("[setLogo] Cannot set logo: write permission denied");
|
|
12758
12834
|
return;
|
|
12759
12835
|
}
|
|
12760
12836
|
if (imageData === void 0 || imageData === null) {
|
|
12761
|
-
console.log("[setLogo] Removing logo from yDoc root...");
|
|
12762
12837
|
root.delete("logo");
|
|
12763
|
-
console.log("[setLogo] Delete complete. Verifying:", root.get("logo"));
|
|
12764
12838
|
} else {
|
|
12765
|
-
console.log("[setLogo] Setting logo in yDoc root...");
|
|
12766
12839
|
root.set("logo", imageData);
|
|
12767
|
-
console.log("[setLogo] Set complete. Verifying:", root.get("logo"));
|
|
12768
12840
|
}
|
|
12769
12841
|
};
|
|
12770
12842
|
ixoEditor.getLogo = () => {
|
|
12771
|
-
|
|
12772
|
-
console.log("[getLogo] Retrieved:", result);
|
|
12773
|
-
return result;
|
|
12843
|
+
return root.get("logo");
|
|
12774
12844
|
};
|
|
12775
12845
|
}
|
|
12776
12846
|
useEffect37(() => {
|
|
@@ -12810,36 +12880,31 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12810
12880
|
}
|
|
12811
12881
|
|
|
12812
12882
|
// src/mantine/components/CoverImage.tsx
|
|
12813
|
-
import
|
|
12814
|
-
import { Box as
|
|
12883
|
+
import React151, { useState as useState48, useRef as useRef9, useEffect as useEffect38 } from "react";
|
|
12884
|
+
import { Box as Box24, Button as Button32, Group as Group45 } from "@mantine/core";
|
|
12815
12885
|
function CoverImage({ coverImageUrl, logoUrl }) {
|
|
12816
12886
|
const { editor, handlers, editable } = useBlocknoteContext();
|
|
12817
12887
|
const [isHovering, setIsHovering] = useState48(false);
|
|
12818
|
-
const [isLogoHovering, setIsLogoHovering] = useState48(false);
|
|
12819
12888
|
const [isRepositioning, setIsRepositioning] = useState48(false);
|
|
12820
12889
|
const [coverPosition, setCoverPosition] = useState48(50);
|
|
12821
|
-
const coverFileInputRef =
|
|
12822
|
-
const logoFileInputRef =
|
|
12823
|
-
const [coverImageData, setCoverImageData] = useState48(editor?.getCoverImage?.());
|
|
12824
|
-
const [logoData, setLogoData] = useState48(editor?.getLogo?.());
|
|
12890
|
+
const coverFileInputRef = useRef9(null);
|
|
12891
|
+
const logoFileInputRef = useRef9(null);
|
|
12892
|
+
const [coverImageData, setCoverImageData] = useState48(() => editor?.getCoverImage?.());
|
|
12893
|
+
const [logoData, setLogoData] = useState48(() => editor?.getLogo?.());
|
|
12825
12894
|
useEffect38(() => {
|
|
12826
12895
|
if (!editor?._yRoot) {
|
|
12827
|
-
console.log("CoverImage: No yRoot available");
|
|
12828
12896
|
return;
|
|
12829
12897
|
}
|
|
12830
12898
|
const root = editor._yRoot;
|
|
12831
12899
|
const observer = () => {
|
|
12832
12900
|
const cover = root.get("coverImage");
|
|
12833
12901
|
const logo = root.get("logo");
|
|
12834
|
-
console.log("CoverImage: Observer triggered", { cover, logo });
|
|
12835
12902
|
setCoverImageData(cover);
|
|
12836
12903
|
setLogoData(logo);
|
|
12837
12904
|
};
|
|
12838
|
-
console.log("CoverImage: Setting up observer, initial values...");
|
|
12839
12905
|
observer();
|
|
12840
12906
|
root.observe(observer);
|
|
12841
12907
|
return () => {
|
|
12842
|
-
console.log("CoverImage: Cleaning up observer");
|
|
12843
12908
|
root.unobserve(observer);
|
|
12844
12909
|
};
|
|
12845
12910
|
}, [editor]);
|
|
@@ -12847,33 +12912,19 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
12847
12912
|
const logoSrc = logoData?.url || logoUrl;
|
|
12848
12913
|
const hasCover = !!coverUrl;
|
|
12849
12914
|
const hasLogo = !!logoSrc;
|
|
12850
|
-
console.log("CoverImage: Render state", {
|
|
12851
|
-
coverImageData,
|
|
12852
|
-
logoData,
|
|
12853
|
-
coverUrl,
|
|
12854
|
-
logoSrc,
|
|
12855
|
-
hasCover,
|
|
12856
|
-
editable
|
|
12857
|
-
});
|
|
12858
12915
|
const handleFileSelect = async (event, type) => {
|
|
12859
12916
|
const file = event.target.files?.[0];
|
|
12860
12917
|
if (!file || !handlers?.publicFileUpload || !editor) {
|
|
12861
|
-
console.log("CoverImage: Missing dependencies", { file: !!file, handlers: !!handlers?.publicFileUpload, editor: !!editor });
|
|
12862
12918
|
return;
|
|
12863
12919
|
}
|
|
12864
12920
|
try {
|
|
12865
|
-
console.log("CoverImage: Uploading file...", { type, fileName: file.name });
|
|
12866
12921
|
const uploadedData = await handlers.publicFileUpload(file);
|
|
12867
|
-
console.log("CoverImage: Upload successful", uploadedData);
|
|
12868
12922
|
if (type === "cover") {
|
|
12869
12923
|
editor.setCoverImage?.(uploadedData);
|
|
12870
|
-
console.log("CoverImage: setCoverImage called, checking if set...", editor.getCoverImage?.());
|
|
12871
12924
|
} else {
|
|
12872
12925
|
editor.setLogo?.(uploadedData);
|
|
12873
|
-
console.log("CoverImage: setLogo called, checking if set...", editor.getLogo?.());
|
|
12874
12926
|
}
|
|
12875
12927
|
} catch (error) {
|
|
12876
|
-
console.error("CoverImage: Failed to upload file:", error);
|
|
12877
12928
|
}
|
|
12878
12929
|
};
|
|
12879
12930
|
const handleAddCover = () => {
|
|
@@ -12887,7 +12938,6 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
12887
12938
|
};
|
|
12888
12939
|
const handleRemoveCover = () => {
|
|
12889
12940
|
if (!editor) return;
|
|
12890
|
-
console.log("CoverImage: Removing cover image...");
|
|
12891
12941
|
editor.setCoverImage?.(void 0);
|
|
12892
12942
|
};
|
|
12893
12943
|
const handleAddLogo = () => {
|
|
@@ -12898,7 +12948,6 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
12898
12948
|
};
|
|
12899
12949
|
const handleRemoveLogo = () => {
|
|
12900
12950
|
if (!editor) return;
|
|
12901
|
-
console.log("CoverImage: Removing logo...");
|
|
12902
12951
|
editor.setLogo?.(void 0);
|
|
12903
12952
|
};
|
|
12904
12953
|
const handleMouseMove = (e) => {
|
|
@@ -12912,57 +12961,80 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
12912
12961
|
return null;
|
|
12913
12962
|
}
|
|
12914
12963
|
if (!hasCover) {
|
|
12915
|
-
return /* @__PURE__ */
|
|
12916
|
-
|
|
12964
|
+
return /* @__PURE__ */ React151.createElement(
|
|
12965
|
+
Box24,
|
|
12917
12966
|
{
|
|
12918
12967
|
style: {
|
|
12919
12968
|
position: "relative",
|
|
12920
12969
|
width: "100%",
|
|
12921
|
-
minHeight: hasLogo ? "
|
|
12922
|
-
backgroundColor: "
|
|
12923
|
-
marginBottom:
|
|
12970
|
+
minHeight: hasLogo ? "140px" : "48px",
|
|
12971
|
+
backgroundColor: "transparent",
|
|
12972
|
+
marginBottom: "0"
|
|
12924
12973
|
},
|
|
12925
12974
|
onMouseEnter: () => editable && setIsHovering(true),
|
|
12926
12975
|
onMouseLeave: () => editable && setIsHovering(false)
|
|
12927
12976
|
},
|
|
12928
|
-
/* @__PURE__ */
|
|
12929
|
-
/* @__PURE__ */
|
|
12930
|
-
editable && isHovering && /* @__PURE__ */
|
|
12931
|
-
|
|
12977
|
+
/* @__PURE__ */ React151.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
|
|
12978
|
+
/* @__PURE__ */ React151.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }),
|
|
12979
|
+
editable && isHovering && !logoSrc && /* @__PURE__ */ React151.createElement(
|
|
12980
|
+
Group45,
|
|
12932
12981
|
{
|
|
12933
|
-
|
|
12934
|
-
size: "xs",
|
|
12935
|
-
onClick: handleAddCover,
|
|
12982
|
+
gap: "xs",
|
|
12936
12983
|
style: {
|
|
12937
12984
|
position: "absolute",
|
|
12938
|
-
top: "
|
|
12939
|
-
|
|
12940
|
-
zIndex: 10
|
|
12941
|
-
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
12942
|
-
color: "#37352f",
|
|
12943
|
-
fontSize: "12px",
|
|
12944
|
-
fontWeight: 500,
|
|
12945
|
-
padding: "4px 8px",
|
|
12946
|
-
height: "auto"
|
|
12985
|
+
top: "12px",
|
|
12986
|
+
left: "96px",
|
|
12987
|
+
zIndex: 10
|
|
12947
12988
|
}
|
|
12948
12989
|
},
|
|
12949
|
-
|
|
12990
|
+
/* @__PURE__ */ React151.createElement(
|
|
12991
|
+
Button32,
|
|
12992
|
+
{
|
|
12993
|
+
variant: "filled",
|
|
12994
|
+
size: "xs",
|
|
12995
|
+
onClick: handleAddLogo,
|
|
12996
|
+
style: {
|
|
12997
|
+
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
12998
|
+
color: "#37352f",
|
|
12999
|
+
fontSize: "12px",
|
|
13000
|
+
fontWeight: 500,
|
|
13001
|
+
padding: "4px 8px",
|
|
13002
|
+
height: "auto"
|
|
13003
|
+
}
|
|
13004
|
+
},
|
|
13005
|
+
"Add icon"
|
|
13006
|
+
),
|
|
13007
|
+
/* @__PURE__ */ React151.createElement(
|
|
13008
|
+
Button32,
|
|
13009
|
+
{
|
|
13010
|
+
variant: "filled",
|
|
13011
|
+
size: "xs",
|
|
13012
|
+
onClick: handleAddCover,
|
|
13013
|
+
style: {
|
|
13014
|
+
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
13015
|
+
color: "#37352f",
|
|
13016
|
+
fontSize: "12px",
|
|
13017
|
+
fontWeight: 500,
|
|
13018
|
+
padding: "4px 8px",
|
|
13019
|
+
height: "auto"
|
|
13020
|
+
}
|
|
13021
|
+
},
|
|
13022
|
+
"Add cover"
|
|
13023
|
+
)
|
|
12950
13024
|
),
|
|
12951
|
-
/* @__PURE__ */
|
|
12952
|
-
|
|
13025
|
+
logoSrc && /* @__PURE__ */ React151.createElement(
|
|
13026
|
+
Box24,
|
|
12953
13027
|
{
|
|
12954
13028
|
style: {
|
|
12955
|
-
position: "
|
|
12956
|
-
bottom: "-60px",
|
|
13029
|
+
position: "relative",
|
|
12957
13030
|
insetInlineStart: "96px",
|
|
12958
13031
|
width: "120px",
|
|
12959
13032
|
height: "120px",
|
|
13033
|
+
marginTop: "16px",
|
|
12960
13034
|
zIndex: 11
|
|
12961
|
-
}
|
|
12962
|
-
onMouseEnter: () => editable && setIsLogoHovering(true),
|
|
12963
|
-
onMouseLeave: () => editable && setIsLogoHovering(false)
|
|
13035
|
+
}
|
|
12964
13036
|
},
|
|
12965
|
-
|
|
13037
|
+
/* @__PURE__ */ React151.createElement(
|
|
12966
13038
|
"img",
|
|
12967
13039
|
{
|
|
12968
13040
|
src: logoSrc,
|
|
@@ -12977,97 +13049,57 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
12977
13049
|
}
|
|
12978
13050
|
}
|
|
12979
13051
|
),
|
|
12980
|
-
editable && isHovering && /* @__PURE__ */
|
|
12981
|
-
|
|
12982
|
-
|
|
12983
|
-
|
|
13052
|
+
editable && isHovering && /* @__PURE__ */ React151.createElement(
|
|
13053
|
+
Group45,
|
|
13054
|
+
{
|
|
13055
|
+
gap: "xs",
|
|
13056
|
+
style: {
|
|
13057
|
+
position: "absolute",
|
|
13058
|
+
top: "0",
|
|
13059
|
+
left: "130px",
|
|
13060
|
+
zIndex: 12
|
|
13061
|
+
}
|
|
13062
|
+
},
|
|
13063
|
+
/* @__PURE__ */ React151.createElement(
|
|
13064
|
+
Button32,
|
|
12984
13065
|
{
|
|
12985
|
-
|
|
13066
|
+
variant: "filled",
|
|
13067
|
+
size: "xs",
|
|
13068
|
+
onClick: handleChangeLogo,
|
|
12986
13069
|
style: {
|
|
12987
|
-
|
|
12988
|
-
|
|
12989
|
-
|
|
12990
|
-
|
|
13070
|
+
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
13071
|
+
color: "#37352f",
|
|
13072
|
+
fontSize: "12px",
|
|
13073
|
+
fontWeight: 500,
|
|
13074
|
+
padding: "4px 8px",
|
|
13075
|
+
height: "auto"
|
|
12991
13076
|
}
|
|
12992
13077
|
},
|
|
12993
|
-
|
|
12994
|
-
|
|
12995
|
-
|
|
12996
|
-
variant: "filled",
|
|
12997
|
-
size: "xs",
|
|
12998
|
-
onClick: handleChangeLogo,
|
|
12999
|
-
style: {
|
|
13000
|
-
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
13001
|
-
color: "#37352f",
|
|
13002
|
-
fontSize: "12px",
|
|
13003
|
-
fontWeight: 500,
|
|
13004
|
-
padding: "4px 8px",
|
|
13005
|
-
height: "auto"
|
|
13006
|
-
}
|
|
13007
|
-
},
|
|
13008
|
-
"Change"
|
|
13009
|
-
),
|
|
13010
|
-
/* @__PURE__ */ React147.createElement(
|
|
13011
|
-
Button32,
|
|
13012
|
-
{
|
|
13013
|
-
variant: "filled",
|
|
13014
|
-
size: "xs",
|
|
13015
|
-
onClick: handleRemoveLogo,
|
|
13016
|
-
style: {
|
|
13017
|
-
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
13018
|
-
color: "#37352f",
|
|
13019
|
-
fontSize: "12px",
|
|
13020
|
-
fontWeight: 500,
|
|
13021
|
-
padding: "4px 8px",
|
|
13022
|
-
height: "auto"
|
|
13023
|
-
}
|
|
13024
|
-
},
|
|
13025
|
-
"Remove"
|
|
13026
|
-
)
|
|
13027
|
-
)
|
|
13028
|
-
) : (
|
|
13029
|
-
// No logo: Show "Add icon" button
|
|
13030
|
-
/* @__PURE__ */ React147.createElement(
|
|
13078
|
+
"Change"
|
|
13079
|
+
),
|
|
13080
|
+
/* @__PURE__ */ React151.createElement(
|
|
13031
13081
|
Button32,
|
|
13032
13082
|
{
|
|
13033
13083
|
variant: "filled",
|
|
13034
13084
|
size: "xs",
|
|
13035
|
-
onClick:
|
|
13085
|
+
onClick: handleRemoveLogo,
|
|
13036
13086
|
style: {
|
|
13037
|
-
position: "absolute",
|
|
13038
|
-
top: "50%",
|
|
13039
|
-
left: "50%",
|
|
13040
|
-
transform: "translate(-50%, -50%)",
|
|
13041
13087
|
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
13042
13088
|
color: "#37352f",
|
|
13043
13089
|
fontSize: "12px",
|
|
13044
13090
|
fontWeight: 500,
|
|
13045
13091
|
padding: "4px 8px",
|
|
13046
|
-
height: "auto"
|
|
13047
|
-
zIndex: 12
|
|
13092
|
+
height: "auto"
|
|
13048
13093
|
}
|
|
13049
13094
|
},
|
|
13050
|
-
"
|
|
13095
|
+
"Remove"
|
|
13051
13096
|
)
|
|
13052
|
-
)),
|
|
13053
|
-
!logoSrc && /* @__PURE__ */ React147.createElement(
|
|
13054
|
-
Box23,
|
|
13055
|
-
{
|
|
13056
|
-
style: {
|
|
13057
|
-
width: "100%",
|
|
13058
|
-
height: "100%",
|
|
13059
|
-
borderRadius: "100%",
|
|
13060
|
-
border: editable && isLogoHovering ? "2px dashed rgba(255, 255, 255, 0.3)" : "none",
|
|
13061
|
-
backgroundColor: editable && isLogoHovering ? "rgba(255, 255, 255, 0.05)" : "transparent",
|
|
13062
|
-
transition: "all 0.2s ease"
|
|
13063
|
-
}
|
|
13064
|
-
}
|
|
13065
13097
|
)
|
|
13066
13098
|
)
|
|
13067
13099
|
);
|
|
13068
13100
|
}
|
|
13069
|
-
return /* @__PURE__ */
|
|
13070
|
-
|
|
13101
|
+
return /* @__PURE__ */ React151.createElement(
|
|
13102
|
+
Box24,
|
|
13071
13103
|
{
|
|
13072
13104
|
style: {
|
|
13073
13105
|
position: "relative",
|
|
@@ -13087,7 +13119,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13087
13119
|
onMouseMove: handleMouseMove,
|
|
13088
13120
|
onClick: () => isRepositioning && setIsRepositioning(false)
|
|
13089
13121
|
},
|
|
13090
|
-
/* @__PURE__ */
|
|
13122
|
+
/* @__PURE__ */ React151.createElement(
|
|
13091
13123
|
"img",
|
|
13092
13124
|
{
|
|
13093
13125
|
src: coverUrl,
|
|
@@ -13105,7 +13137,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13105
13137
|
}
|
|
13106
13138
|
}
|
|
13107
13139
|
),
|
|
13108
|
-
editable && isHovering && /* @__PURE__ */
|
|
13140
|
+
editable && isHovering && /* @__PURE__ */ React151.createElement(
|
|
13109
13141
|
Group45,
|
|
13110
13142
|
{
|
|
13111
13143
|
gap: "xs",
|
|
@@ -13116,7 +13148,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13116
13148
|
zIndex: 10
|
|
13117
13149
|
}
|
|
13118
13150
|
},
|
|
13119
|
-
/* @__PURE__ */
|
|
13151
|
+
/* @__PURE__ */ React151.createElement(
|
|
13120
13152
|
Button32,
|
|
13121
13153
|
{
|
|
13122
13154
|
variant: "filled",
|
|
@@ -13133,7 +13165,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13133
13165
|
},
|
|
13134
13166
|
"Change cover"
|
|
13135
13167
|
),
|
|
13136
|
-
/* @__PURE__ */
|
|
13168
|
+
/* @__PURE__ */ React151.createElement(
|
|
13137
13169
|
Button32,
|
|
13138
13170
|
{
|
|
13139
13171
|
variant: "filled",
|
|
@@ -13150,7 +13182,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13150
13182
|
},
|
|
13151
13183
|
isRepositioning ? "Done" : "Reposition"
|
|
13152
13184
|
),
|
|
13153
|
-
/* @__PURE__ */
|
|
13185
|
+
/* @__PURE__ */ React151.createElement(
|
|
13154
13186
|
Button32,
|
|
13155
13187
|
{
|
|
13156
13188
|
variant: "filled",
|
|
@@ -13168,8 +13200,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13168
13200
|
"Remove"
|
|
13169
13201
|
)
|
|
13170
13202
|
),
|
|
13171
|
-
/* @__PURE__ */
|
|
13172
|
-
|
|
13203
|
+
/* @__PURE__ */ React151.createElement(
|
|
13204
|
+
Box24,
|
|
13173
13205
|
{
|
|
13174
13206
|
style: {
|
|
13175
13207
|
position: "absolute",
|
|
@@ -13178,11 +13210,9 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13178
13210
|
width: "120px",
|
|
13179
13211
|
height: "120px",
|
|
13180
13212
|
zIndex: 11
|
|
13181
|
-
}
|
|
13182
|
-
onMouseEnter: () => editable && setIsLogoHovering(true),
|
|
13183
|
-
onMouseLeave: () => editable && setIsLogoHovering(false)
|
|
13213
|
+
}
|
|
13184
13214
|
},
|
|
13185
|
-
logoSrc && /* @__PURE__ */
|
|
13215
|
+
logoSrc && /* @__PURE__ */ React151.createElement(
|
|
13186
13216
|
"img",
|
|
13187
13217
|
{
|
|
13188
13218
|
src: logoSrc,
|
|
@@ -13197,9 +13227,9 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13197
13227
|
}
|
|
13198
13228
|
}
|
|
13199
13229
|
),
|
|
13200
|
-
editable && isHovering && /* @__PURE__ */
|
|
13230
|
+
editable && isHovering && /* @__PURE__ */ React151.createElement(React151.Fragment, null, logoSrc ? (
|
|
13201
13231
|
// Logo exists: Show Change/Remove buttons when hovering on cover
|
|
13202
|
-
/* @__PURE__ */
|
|
13232
|
+
/* @__PURE__ */ React151.createElement(
|
|
13203
13233
|
Group45,
|
|
13204
13234
|
{
|
|
13205
13235
|
gap: "xs",
|
|
@@ -13210,7 +13240,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13210
13240
|
zIndex: 12
|
|
13211
13241
|
}
|
|
13212
13242
|
},
|
|
13213
|
-
/* @__PURE__ */
|
|
13243
|
+
/* @__PURE__ */ React151.createElement(
|
|
13214
13244
|
Button32,
|
|
13215
13245
|
{
|
|
13216
13246
|
variant: "filled",
|
|
@@ -13227,7 +13257,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13227
13257
|
},
|
|
13228
13258
|
"Change"
|
|
13229
13259
|
),
|
|
13230
|
-
/* @__PURE__ */
|
|
13260
|
+
/* @__PURE__ */ React151.createElement(
|
|
13231
13261
|
Button32,
|
|
13232
13262
|
{
|
|
13233
13263
|
variant: "filled",
|
|
@@ -13247,7 +13277,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13247
13277
|
)
|
|
13248
13278
|
) : (
|
|
13249
13279
|
// No logo: Show "Add icon" button when hovering anywhere on cover
|
|
13250
|
-
/* @__PURE__ */
|
|
13280
|
+
/* @__PURE__ */ React151.createElement(
|
|
13251
13281
|
Button32,
|
|
13252
13282
|
{
|
|
13253
13283
|
variant: "filled",
|
|
@@ -13271,49 +13301,51 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13271
13301
|
)
|
|
13272
13302
|
))
|
|
13273
13303
|
),
|
|
13274
|
-
/* @__PURE__ */
|
|
13275
|
-
/* @__PURE__ */
|
|
13304
|
+
/* @__PURE__ */ React151.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
|
|
13305
|
+
/* @__PURE__ */ React151.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
|
|
13276
13306
|
);
|
|
13277
13307
|
}
|
|
13278
13308
|
|
|
13279
13309
|
// src/mantine/IxoEditor.tsx
|
|
13280
|
-
import
|
|
13310
|
+
import React153 from "react";
|
|
13281
13311
|
import { getDefaultReactSlashMenuItems, SuggestionMenuController } from "@blocknote/react";
|
|
13282
13312
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
13283
13313
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
13284
|
-
import { Flex as Flex25, MantineProvider, Text as
|
|
13314
|
+
import { Flex as Flex25, MantineProvider, Text as Text75 } from "@mantine/core";
|
|
13285
13315
|
|
|
13286
13316
|
// src/mantine/components/PanelContent.tsx
|
|
13287
|
-
import
|
|
13288
|
-
import { Box as
|
|
13317
|
+
import React152 from "react";
|
|
13318
|
+
import { Box as Box25 } from "@mantine/core";
|
|
13289
13319
|
var panelStyles = {
|
|
13290
13320
|
light: {
|
|
13291
13321
|
backgroundColor: "#ffffff",
|
|
13292
13322
|
// editor background
|
|
13293
13323
|
color: "#1a1a1a",
|
|
13294
13324
|
// main text color
|
|
13295
|
-
|
|
13296
|
-
// border
|
|
13297
|
-
|
|
13298
|
-
|
|
13325
|
+
borderLeft: "1px solid #e0e0e0",
|
|
13326
|
+
// left border only - seamless with editor
|
|
13327
|
+
borderTop: "none",
|
|
13328
|
+
borderRight: "none",
|
|
13329
|
+
borderBottom: "none"
|
|
13299
13330
|
},
|
|
13300
13331
|
dark: {
|
|
13301
13332
|
backgroundColor: "#1f1f1f",
|
|
13302
13333
|
// editor background
|
|
13303
13334
|
color: "#f0f0f0",
|
|
13304
13335
|
// main text color
|
|
13305
|
-
|
|
13306
|
-
// border
|
|
13307
|
-
|
|
13308
|
-
|
|
13336
|
+
borderLeft: "1px solid #3a3a3a",
|
|
13337
|
+
// left border only - seamless with editor
|
|
13338
|
+
borderTop: "none",
|
|
13339
|
+
borderRight: "none",
|
|
13340
|
+
borderBottom: "none"
|
|
13309
13341
|
}
|
|
13310
13342
|
};
|
|
13311
13343
|
function PanelContent({ theme }) {
|
|
13312
13344
|
const { activePanel, registeredPanels } = usePanelStore();
|
|
13313
13345
|
const isOpen = activePanel !== null;
|
|
13314
13346
|
const content = activePanel ? registeredPanels.get(activePanel) : null;
|
|
13315
|
-
return /* @__PURE__ */
|
|
13316
|
-
|
|
13347
|
+
return /* @__PURE__ */ React152.createElement(
|
|
13348
|
+
Box25,
|
|
13317
13349
|
{
|
|
13318
13350
|
pos: "sticky",
|
|
13319
13351
|
right: 0,
|
|
@@ -13344,34 +13376,47 @@ function IxoEditorContent({
|
|
|
13344
13376
|
coverImageUrl,
|
|
13345
13377
|
logoUrl
|
|
13346
13378
|
}) {
|
|
13347
|
-
|
|
13348
|
-
|
|
13379
|
+
const { activePanel } = usePanelStore();
|
|
13380
|
+
const isPanelOpen = activePanel !== null;
|
|
13381
|
+
return /* @__PURE__ */ React153.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React153.createElement(
|
|
13382
|
+
"div",
|
|
13349
13383
|
{
|
|
13350
|
-
editor
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
linkToolbar: config.linkToolbar,
|
|
13356
|
-
filePanel: config.filePanel,
|
|
13357
|
-
tableHandles: config.tableHandles,
|
|
13358
|
-
theme: config.theme,
|
|
13359
|
-
onChange,
|
|
13360
|
-
onSelectionChange
|
|
13384
|
+
className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`,
|
|
13385
|
+
style: {
|
|
13386
|
+
width: isPanelVisible && isPanelOpen ? "50%" : "100%",
|
|
13387
|
+
transition: "width 0.2s ease"
|
|
13388
|
+
}
|
|
13361
13389
|
},
|
|
13362
|
-
|
|
13363
|
-
|
|
13390
|
+
/* @__PURE__ */ React153.createElement(CoverImage, { coverImageUrl, logoUrl }),
|
|
13391
|
+
/* @__PURE__ */ React153.createElement(
|
|
13392
|
+
BlockNoteView,
|
|
13364
13393
|
{
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13394
|
+
editor,
|
|
13395
|
+
editable: isEditable,
|
|
13396
|
+
sideMenu: config.sideMenu,
|
|
13397
|
+
slashMenu: false,
|
|
13398
|
+
formattingToolbar: config.formattingToolbar,
|
|
13399
|
+
linkToolbar: config.linkToolbar,
|
|
13400
|
+
filePanel: config.filePanel,
|
|
13401
|
+
tableHandles: config.tableHandles,
|
|
13402
|
+
theme: config.theme,
|
|
13403
|
+
onChange,
|
|
13404
|
+
onSelectionChange
|
|
13405
|
+
},
|
|
13406
|
+
config.slashMenu && /* @__PURE__ */ React153.createElement(
|
|
13407
|
+
SuggestionMenuController,
|
|
13408
|
+
{
|
|
13409
|
+
triggerCharacter: "/",
|
|
13410
|
+
getItems: async (query) => {
|
|
13411
|
+
const defaultItems = getDefaultReactSlashMenuItems(editor);
|
|
13412
|
+
const customItems = getExtraSlashMenuItems(editor);
|
|
13413
|
+
return filterSuggestionItems([...defaultItems, ...customItems], query);
|
|
13414
|
+
}
|
|
13370
13415
|
}
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
)
|
|
13416
|
+
),
|
|
13417
|
+
children
|
|
13418
|
+
)
|
|
13419
|
+
), isPanelVisible && /* @__PURE__ */ React153.createElement(PanelContent, { theme: config.theme }));
|
|
13375
13420
|
}
|
|
13376
13421
|
function IxoEditor({
|
|
13377
13422
|
editor,
|
|
@@ -13400,7 +13445,7 @@ function IxoEditor({
|
|
|
13400
13445
|
tableHandles: true
|
|
13401
13446
|
};
|
|
13402
13447
|
const isEditable = editable;
|
|
13403
|
-
const editorContent = /* @__PURE__ */
|
|
13448
|
+
const editorContent = /* @__PURE__ */ React153.createElement(BlocknoteProvider, { editor, handlers, blockRequirements, editable: isEditable }, /* @__PURE__ */ React153.createElement(ListBlocksUIProvider, null, /* @__PURE__ */ React153.createElement(Flex25, { pr: 25, justify: "flex-end", align: "center", gap: "xs" }, /* @__PURE__ */ React153.createElement(Text75, { size: "xs", c: "dimmed", tt: "uppercase" }, "Global actions"), /* @__PURE__ */ React153.createElement(ListBlocksToolbar, null)), /* @__PURE__ */ React153.createElement(
|
|
13404
13449
|
IxoEditorContent,
|
|
13405
13450
|
{
|
|
13406
13451
|
isPanelVisible,
|
|
@@ -13416,7 +13461,7 @@ function IxoEditor({
|
|
|
13416
13461
|
children
|
|
13417
13462
|
)));
|
|
13418
13463
|
if (mantineTheme) {
|
|
13419
|
-
return /* @__PURE__ */
|
|
13464
|
+
return /* @__PURE__ */ React153.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
|
|
13420
13465
|
}
|
|
13421
13466
|
return editorContent;
|
|
13422
13467
|
}
|
|
@@ -13503,4 +13548,4 @@ export {
|
|
|
13503
13548
|
ixoGraphQLClient,
|
|
13504
13549
|
getEntity
|
|
13505
13550
|
};
|
|
13506
|
-
//# sourceMappingURL=chunk-
|
|
13551
|
+
//# sourceMappingURL=chunk-3BZ6OPAK.mjs.map
|