@ixo/editor 1.27.1 → 2.0.1
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-YDHPP6BI.mjs → chunk-5JO27QWP.mjs} +1039 -1005
- package/dist/chunk-5JO27QWP.mjs.map +1 -0
- package/dist/index.d.ts +83 -8
- 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-YDHPP6BI.mjs.map +0 -1
|
@@ -8177,7 +8177,7 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
8177
8177
|
return "gray";
|
|
8178
8178
|
}
|
|
8179
8179
|
};
|
|
8180
|
-
const
|
|
8180
|
+
const getStatusColor2 = (status2) => {
|
|
8181
8181
|
switch (status2) {
|
|
8182
8182
|
case "success":
|
|
8183
8183
|
return "green";
|
|
@@ -8276,7 +8276,7 @@ var ApiRequestFlowView = ({ editor, block, isDisabled }) => {
|
|
|
8276
8276
|
},
|
|
8277
8277
|
isLoading ? "Sending..." : "Execute"
|
|
8278
8278
|
);
|
|
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:
|
|
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(
|
|
8280
8280
|
Text48,
|
|
8281
8281
|
{
|
|
8282
8282
|
size: "xs",
|
|
@@ -9323,7 +9323,7 @@ var NotifyFlowView = ({ editor, block, isDisabled }) => {
|
|
|
9323
9323
|
return "gray";
|
|
9324
9324
|
}
|
|
9325
9325
|
};
|
|
9326
|
-
const
|
|
9326
|
+
const getStatusColor2 = (status2) => {
|
|
9327
9327
|
switch (status2) {
|
|
9328
9328
|
case "sent":
|
|
9329
9329
|
return "green";
|
|
@@ -9401,7 +9401,7 @@ var NotifyFlowView = ({ editor, block, isDisabled }) => {
|
|
|
9401
9401
|
},
|
|
9402
9402
|
isLoading ? "Sending..." : status === "sent" ? "Sent" : "Send"
|
|
9403
9403
|
);
|
|
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:
|
|
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(
|
|
9405
9405
|
{
|
|
9406
9406
|
to: to.filter((e) => e.trim() !== ""),
|
|
9407
9407
|
...cc.length > 0 && { cc: cc.filter((e) => e.trim() !== "") },
|
|
@@ -9556,7 +9556,7 @@ var CollectionSelector = ({
|
|
|
9556
9556
|
const newSelected = currentSelections.includes(collectionId) ? currentSelections.filter((id) => id !== collectionId) : [...currentSelections, collectionId];
|
|
9557
9557
|
onCollectionsChange(newSelected);
|
|
9558
9558
|
};
|
|
9559
|
-
const
|
|
9559
|
+
const getCollectionName2 = (collection) => {
|
|
9560
9560
|
if (!collection) return "Unnamed Collection";
|
|
9561
9561
|
return collection.protocol?.profile?.name || collection.name || "Unnamed Collection";
|
|
9562
9562
|
};
|
|
@@ -9577,7 +9577,7 @@ var CollectionSelector = ({
|
|
|
9577
9577
|
Checkbox10,
|
|
9578
9578
|
{
|
|
9579
9579
|
key: collection.id,
|
|
9580
|
-
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)),
|
|
9581
9581
|
checked: selectedCollections?.includes(collection.id) ?? false,
|
|
9582
9582
|
onChange: () => handleToggleCollection(collection.id)
|
|
9583
9583
|
}
|
|
@@ -9744,16 +9744,178 @@ var ClaimTemplateView = ({ editor, block }) => {
|
|
|
9744
9744
|
};
|
|
9745
9745
|
|
|
9746
9746
|
// src/mantine/blocks/claim/flow/FlowView.tsx
|
|
9747
|
-
import React124, {
|
|
9747
|
+
import React124, { useMemo as useMemo25 } from "react";
|
|
9748
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
|
|
9749
9825
|
import { IconSettings as IconSettings3, IconRefresh as IconRefresh2, IconAlertCircle as IconAlertCircle3 } from "@tabler/icons-react";
|
|
9750
9826
|
|
|
9751
9827
|
// src/mantine/blocks/claim/flow/ClaimCollectionsList.tsx
|
|
9752
|
-
import React123, { useMemo as
|
|
9828
|
+
import React123, { useMemo as useMemo24 } from "react";
|
|
9753
9829
|
import { Stack as Stack87, Text as Text61, ActionIcon as ActionIcon15, Tooltip as Tooltip8, Loader as Loader10, Center as Center4 } from "@mantine/core";
|
|
9754
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
|
+
|
|
9755
9917
|
// src/mantine/blocks/claim/flow/ClaimsListSheet.tsx
|
|
9756
|
-
import React122, { useState as
|
|
9918
|
+
import React122, { useState as useState36, useEffect as useEffect25, useCallback as useCallback23, useMemo as useMemo23 } from "react";
|
|
9757
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";
|
|
9758
9920
|
import { IconArrowLeft as IconArrowLeft2, IconAlertCircle as IconAlertCircle2 } from "@tabler/icons-react";
|
|
9759
9921
|
import { Survey, SurveyModel } from "@ixo/surveys";
|
|
@@ -9921,15 +10083,15 @@ var surveyTheme = {
|
|
|
9921
10083
|
var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, userAddress, onSubmitComplete }) => {
|
|
9922
10084
|
const { closePanel } = usePanelStore();
|
|
9923
10085
|
const handlers = useBlocknoteHandlers();
|
|
9924
|
-
const [viewMode, setViewMode] =
|
|
9925
|
-
const [claims, setClaims] =
|
|
9926
|
-
const [loading, setLoading] =
|
|
9927
|
-
const [error, setError] =
|
|
9928
|
-
const [surveyJson, setSurveyJson] =
|
|
9929
|
-
const [surveyLoading, setSurveyLoading] =
|
|
9930
|
-
const [surveyError, setSurveyError] =
|
|
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);
|
|
9931
10093
|
console.log("[ClaimsListSheet] render", { collectionId, collectionName, deedId, adminAddress, userAddress, viewMode });
|
|
9932
|
-
const fetchClaims =
|
|
10094
|
+
const fetchClaims = useCallback23(async () => {
|
|
9933
10095
|
console.log("[ClaimsListSheet] fetchClaims start", { collectionId, userAddress });
|
|
9934
10096
|
try {
|
|
9935
10097
|
setLoading(true);
|
|
@@ -9952,7 +10114,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
9952
10114
|
setLoading(false);
|
|
9953
10115
|
}
|
|
9954
10116
|
}, [collectionId, userAddress]);
|
|
9955
|
-
const fetchSurveyTemplate =
|
|
10117
|
+
const fetchSurveyTemplate = useCallback23(async () => {
|
|
9956
10118
|
console.log("[ClaimsListSheet] fetchSurveyTemplate start", { deedId });
|
|
9957
10119
|
try {
|
|
9958
10120
|
setSurveyLoading(true);
|
|
@@ -9977,11 +10139,11 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
9977
10139
|
setSurveyLoading(false);
|
|
9978
10140
|
}
|
|
9979
10141
|
}, [deedId]);
|
|
9980
|
-
|
|
10142
|
+
useEffect25(() => {
|
|
9981
10143
|
console.log("[ClaimsListSheet] useEffect fetchClaims");
|
|
9982
10144
|
fetchClaims();
|
|
9983
10145
|
}, [fetchClaims]);
|
|
9984
|
-
const surveyModel =
|
|
10146
|
+
const surveyModel = useMemo23(() => {
|
|
9985
10147
|
console.log("[ClaimsListSheet] surveyModel useMemo", { hasSurveyJson: !!surveyJson });
|
|
9986
10148
|
if (!surveyJson) return null;
|
|
9987
10149
|
const model = new SurveyModel(surveyJson);
|
|
@@ -9990,7 +10152,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
9990
10152
|
model.questionsOnPageMode = "singlePage";
|
|
9991
10153
|
return model;
|
|
9992
10154
|
}, [surveyJson]);
|
|
9993
|
-
const handleSurveyComplete =
|
|
10155
|
+
const handleSurveyComplete = useCallback23(
|
|
9994
10156
|
async (sender) => {
|
|
9995
10157
|
console.log("[ClaimsListSheet] handleSurveyComplete fired", { data: sender?.data });
|
|
9996
10158
|
const surveyData = sender.data;
|
|
@@ -10045,7 +10207,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
10045
10207
|
},
|
|
10046
10208
|
[handlers, deedId, collectionId, adminAddress, closePanel, onSubmitComplete]
|
|
10047
10209
|
);
|
|
10048
|
-
|
|
10210
|
+
useEffect25(() => {
|
|
10049
10211
|
if (surveyModel) {
|
|
10050
10212
|
console.log("[ClaimsListSheet] register surveyModel.onComplete listener");
|
|
10051
10213
|
surveyModel.onComplete.add(handleSurveyComplete);
|
|
@@ -10081,7 +10243,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
10081
10243
|
}
|
|
10082
10244
|
return "pending";
|
|
10083
10245
|
};
|
|
10084
|
-
const
|
|
10246
|
+
const getStatusColor2 = (status) => {
|
|
10085
10247
|
switch (status) {
|
|
10086
10248
|
case "approved":
|
|
10087
10249
|
return "green";
|
|
@@ -10092,7 +10254,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
10092
10254
|
return "yellow";
|
|
10093
10255
|
}
|
|
10094
10256
|
};
|
|
10095
|
-
const
|
|
10257
|
+
const formatDate2 = (dateString) => {
|
|
10096
10258
|
try {
|
|
10097
10259
|
return new Date(dateString).toLocaleDateString();
|
|
10098
10260
|
} catch {
|
|
@@ -10151,7 +10313,7 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
10151
10313
|
},
|
|
10152
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) => {
|
|
10153
10315
|
const status = getClaimStatus(claim.paymentsStatus);
|
|
10154
|
-
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()));
|
|
10155
10317
|
})))
|
|
10156
10318
|
),
|
|
10157
10319
|
/* @__PURE__ */ React122.createElement(
|
|
@@ -10180,10 +10342,6 @@ var ClaimsListSheet = ({ collectionId, collectionName, deedId, adminAddress, use
|
|
|
10180
10342
|
|
|
10181
10343
|
// src/mantine/blocks/claim/flow/ClaimCollectionsList.tsx
|
|
10182
10344
|
import { IconArrowRight as IconArrowRight2 } from "@tabler/icons-react";
|
|
10183
|
-
var isClientFulfillmentError = (error) => {
|
|
10184
|
-
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
10185
|
-
return /client(?:.+)?(cannot|can't).+fulfil?/i.test(message);
|
|
10186
|
-
};
|
|
10187
10345
|
var CollectionItem = ({ collection, deedId, adminAddress, userRole, onRefresh }) => {
|
|
10188
10346
|
console.log("[CollectionItem] RENDER START", { collectionId: collection.id, userRole });
|
|
10189
10347
|
const { getCurrentUser } = useBlocknoteHandlers();
|
|
@@ -10201,14 +10359,14 @@ var CollectionItem = ({ collection, deedId, adminAddress, userRole, onRefresh })
|
|
|
10201
10359
|
alert(`Error in ClaimCollectionsList.tsx:31 - getCurrentUser() failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
10202
10360
|
currentUser = { address: "" };
|
|
10203
10361
|
}
|
|
10204
|
-
const
|
|
10362
|
+
const getCollectionName2 = (collection2) => collection2.protocol?.profile?.name || collection2.name || "Unnamed Collection";
|
|
10205
10363
|
const isServiceAgent = userRole === "SA" /* ServiceProvider */;
|
|
10206
10364
|
const canAccessClaims = isServiceAgent;
|
|
10207
10365
|
const claimsPanelId = `claims-list-${collection.id}`;
|
|
10208
|
-
const collectionName =
|
|
10366
|
+
const collectionName = getCollectionName2(collection);
|
|
10209
10367
|
console.log("[CollectionItem] Panel setup", { claimsPanelId, collectionName, canAccessClaims });
|
|
10210
10368
|
console.log("[CollectionItem] Creating claimsPanelContent useMemo...");
|
|
10211
|
-
const claimsPanelContent =
|
|
10369
|
+
const claimsPanelContent = useMemo24(() => {
|
|
10212
10370
|
console.log("[CollectionItem] claimsPanelContent useMemo EXECUTING", { collectionId: collection.id });
|
|
10213
10371
|
return /* @__PURE__ */ React123.createElement(
|
|
10214
10372
|
ClaimsListSheet,
|
|
@@ -10235,266 +10393,42 @@ var CollectionItem = ({ collection, deedId, adminAddress, userRole, onRefresh })
|
|
|
10235
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 })))));
|
|
10236
10394
|
};
|
|
10237
10395
|
var ClaimCollectionsList = ({ collections, deedId, adminAddress, userAddress, onRefresh }) => {
|
|
10238
|
-
|
|
10239
|
-
collectionsCount: collections.length,
|
|
10240
|
-
deedId,
|
|
10241
|
-
adminAddress,
|
|
10242
|
-
userAddress
|
|
10243
|
-
});
|
|
10244
|
-
const { getUserRoles } = useBlocknoteHandlers();
|
|
10245
|
-
const getUserRolesRef = useRef4(getUserRoles);
|
|
10246
|
-
useEffect23(() => {
|
|
10247
|
-
getUserRolesRef.current = getUserRoles;
|
|
10248
|
-
}, [getUserRoles]);
|
|
10249
|
-
console.log("[ClaimCollectionsList] getUserRoles handler obtained");
|
|
10250
|
-
const [userRoles, setUserRoles] = useState34({});
|
|
10251
|
-
const [loadingRoles, setLoadingRoles] = useState34(true);
|
|
10252
|
-
console.log("[ClaimCollectionsList] State:", { userRoles, loadingRoles });
|
|
10253
|
-
const failedRequestKeyRef = useRef4(null);
|
|
10254
|
-
console.log("[ClaimCollectionsList] Creating collectionIdsKey useMemo...");
|
|
10255
|
-
const collectionIdsKey = useMemo22(() => {
|
|
10256
|
-
const key = collections.map((c) => c.id).sort().join("|");
|
|
10257
|
-
console.log("[ClaimCollectionsList] collectionIdsKey computed:", key);
|
|
10258
|
-
return key;
|
|
10259
|
-
}, [collections]);
|
|
10260
|
-
console.log("[ClaimCollectionsList] Creating requestKey useMemo...");
|
|
10261
|
-
const requestKey = useMemo22(() => {
|
|
10262
|
-
const key = [userAddress, adminAddress, deedId, collectionIdsKey].filter(Boolean).join("|");
|
|
10263
|
-
console.log("[ClaimCollectionsList] requestKey computed:", key);
|
|
10264
|
-
return key;
|
|
10265
|
-
}, [userAddress, adminAddress, deedId, collectionIdsKey]);
|
|
10266
|
-
useEffect23(() => {
|
|
10267
|
-
console.log("[ClaimCollectionsList] useEffect TRIGGERED");
|
|
10268
|
-
let isMounted = true;
|
|
10269
|
-
const setEmptyRoles = () => {
|
|
10270
|
-
console.log("[ClaimCollectionsList] setEmptyRoles called");
|
|
10271
|
-
const rolesMap = {};
|
|
10272
|
-
collections.forEach((collection) => {
|
|
10273
|
-
rolesMap[collection.id] = null;
|
|
10274
|
-
});
|
|
10275
|
-
if (isMounted) {
|
|
10276
|
-
console.log("[ClaimCollectionsList] Setting empty roles map");
|
|
10277
|
-
setUserRoles(rolesMap);
|
|
10278
|
-
}
|
|
10279
|
-
};
|
|
10280
|
-
const fetchUserRoles = async () => {
|
|
10281
|
-
console.log("[ClaimCollectionsList] fetchUserRoles CALLED");
|
|
10282
|
-
if (!collections.length || !userAddress || !adminAddress) {
|
|
10283
|
-
console.log("[ClaimCollectionsList] EARLY RETURN - missing data", { collectionsLength: collections.length, userAddress, adminAddress });
|
|
10284
|
-
setLoadingRoles(false);
|
|
10285
|
-
return;
|
|
10286
|
-
}
|
|
10287
|
-
if (!requestKey || failedRequestKeyRef.current === requestKey) {
|
|
10288
|
-
console.log("[ClaimCollectionsList] EARLY RETURN - no requestKey or failed request", { requestKey, failedKey: failedRequestKeyRef.current });
|
|
10289
|
-
setLoadingRoles(false);
|
|
10290
|
-
return;
|
|
10291
|
-
}
|
|
10292
|
-
const getUserRolesFn = getUserRolesRef.current;
|
|
10293
|
-
if (typeof getUserRolesFn !== "function") {
|
|
10294
|
-
console.log("[ClaimCollectionsList] getUserRoles is not a function");
|
|
10295
|
-
setEmptyRoles();
|
|
10296
|
-
setLoadingRoles(false);
|
|
10297
|
-
return;
|
|
10298
|
-
}
|
|
10299
|
-
try {
|
|
10300
|
-
console.log("[ClaimCollectionsList] Setting loadingRoles=true");
|
|
10301
|
-
setLoadingRoles(true);
|
|
10302
|
-
console.log("[ClaimCollectionsList] Calling getUserRoles handler...");
|
|
10303
|
-
const roles = await getUserRolesFn({
|
|
10304
|
-
userAddress,
|
|
10305
|
-
adminAddress,
|
|
10306
|
-
deedDid: deedId,
|
|
10307
|
-
collectionIds: collections.map((c) => c.id)
|
|
10308
|
-
});
|
|
10309
|
-
console.log("[ClaimCollectionsList] getUserRoles response:", roles);
|
|
10310
|
-
if (!roles) {
|
|
10311
|
-
alert("Error in ClaimCollectionsList.tsx:147 - getUserRoles() returned no data");
|
|
10312
|
-
}
|
|
10313
|
-
console.log("[ClaimCollectionsList] Building roles map...");
|
|
10314
|
-
const rolesMap = {};
|
|
10315
|
-
collections.forEach((collection) => {
|
|
10316
|
-
const roleData = roles?.find((r) => r.collectionId === collection.id);
|
|
10317
|
-
rolesMap[collection.id] = roleData?.role || null;
|
|
10318
|
-
});
|
|
10319
|
-
console.log("[ClaimCollectionsList] Roles map built:", rolesMap);
|
|
10320
|
-
if (isMounted) {
|
|
10321
|
-
console.log("[ClaimCollectionsList] Setting user roles state");
|
|
10322
|
-
setUserRoles(rolesMap);
|
|
10323
|
-
}
|
|
10324
|
-
} catch (error) {
|
|
10325
|
-
console.log("[ClaimCollectionsList] getUserRoles ERROR:", error);
|
|
10326
|
-
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
10327
|
-
alert(`Error in ClaimCollectionsList.tsx:147 - getUserRoles() failed: ${errorMsg}`);
|
|
10328
|
-
if (isClientFulfillmentError(error)) {
|
|
10329
|
-
console.log("[ClaimCollectionsList] Client fulfillment error - caching failed request");
|
|
10330
|
-
failedRequestKeyRef.current = requestKey;
|
|
10331
|
-
} else {
|
|
10332
|
-
console.log("[ClaimCollectionsList] Not a client fulfillment error");
|
|
10333
|
-
failedRequestKeyRef.current = null;
|
|
10334
|
-
}
|
|
10335
|
-
setEmptyRoles();
|
|
10336
|
-
} finally {
|
|
10337
|
-
if (isMounted) {
|
|
10338
|
-
console.log("[ClaimCollectionsList] Setting loadingRoles=false");
|
|
10339
|
-
setLoadingRoles(false);
|
|
10340
|
-
}
|
|
10341
|
-
}
|
|
10342
|
-
};
|
|
10343
|
-
fetchUserRoles();
|
|
10344
|
-
return () => {
|
|
10345
|
-
console.log("[ClaimCollectionsList] useEffect CLEANUP");
|
|
10346
|
-
isMounted = false;
|
|
10347
|
-
};
|
|
10348
|
-
}, [collections, userAddress, adminAddress, deedId, requestKey]);
|
|
10396
|
+
const { userRoles, loading: loadingRoles } = useUserRoles(collections, userAddress, adminAddress, deedId);
|
|
10349
10397
|
if (!collections?.length) {
|
|
10350
|
-
console.log("[ClaimCollectionsList] RENDER: No collections found");
|
|
10351
10398
|
return /* @__PURE__ */ React123.createElement(Text61, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No claim collections found");
|
|
10352
10399
|
}
|
|
10353
10400
|
if (loadingRoles) {
|
|
10354
|
-
console.log("[ClaimCollectionsList] RENDER: Loading roles...");
|
|
10355
10401
|
return /* @__PURE__ */ React123.createElement(Center4, { py: "md" }, /* @__PURE__ */ React123.createElement(Loader10, { size: "sm" }));
|
|
10356
10402
|
}
|
|
10357
|
-
|
|
10358
|
-
return /* @__PURE__ */ React123.createElement(Stack87, { gap: "md", px: 5 }, collections.map((collection) => {
|
|
10359
|
-
console.log("[ClaimCollectionsList] Rendering CollectionItem:", collection.id);
|
|
10360
|
-
return /* @__PURE__ */ React123.createElement(
|
|
10361
|
-
CollectionItem,
|
|
10362
|
-
{
|
|
10363
|
-
key: collection.id,
|
|
10364
|
-
collection,
|
|
10365
|
-
deedId,
|
|
10366
|
-
adminAddress,
|
|
10367
|
-
userRole: userRoles[collection.id] || null,
|
|
10368
|
-
onRefresh
|
|
10369
|
-
}
|
|
10370
|
-
);
|
|
10371
|
-
}));
|
|
10403
|
+
return /* @__PURE__ */ React123.createElement(Stack87, { gap: "md", px: 5 }, collections.map((collection) => /* @__PURE__ */ React123.createElement(CollectionItem, { key: collection.id, collection, deedId, adminAddress, userRole: userRoles[collection.id] || null, onRefresh })));
|
|
10372
10404
|
};
|
|
10373
10405
|
|
|
10374
10406
|
// src/mantine/blocks/claim/flow/FlowView.tsx
|
|
10375
10407
|
var CLAIM_FLOW_PANEL_ID = "claim-flow-panel";
|
|
10376
10408
|
var ClaimFlowView = ({ editor, block }) => {
|
|
10377
|
-
console.log("[FlowView] RENDER START", { blockId: block.id });
|
|
10378
10409
|
const { editable } = useBlocknoteContext();
|
|
10379
|
-
|
|
10380
|
-
const { getCurrentUser, getClaimCollections } = useBlocknoteHandlers();
|
|
10381
|
-
console.log("[FlowView] handlers obtained");
|
|
10382
|
-
const getClaimCollectionsRef = useRef5(getClaimCollections);
|
|
10383
|
-
useEffect24(() => {
|
|
10384
|
-
getClaimCollectionsRef.current = getClaimCollections;
|
|
10385
|
-
}, [getClaimCollections]);
|
|
10386
|
-
let currentUser;
|
|
10387
|
-
try {
|
|
10388
|
-
console.log("[FlowView] Calling getCurrentUser...");
|
|
10389
|
-
currentUser = getCurrentUser();
|
|
10390
|
-
console.log("[FlowView] getCurrentUser result:", currentUser);
|
|
10391
|
-
if (!currentUser) {
|
|
10392
|
-
alert("Error in FlowView.tsx:16 - getCurrentUser() returned no data");
|
|
10393
|
-
currentUser = { address: "" };
|
|
10394
|
-
}
|
|
10395
|
-
} catch (err) {
|
|
10396
|
-
console.log("[FlowView] getCurrentUser ERROR:", err);
|
|
10397
|
-
alert(`Error in FlowView.tsx:16 - getCurrentUser() failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
10398
|
-
currentUser = { address: "" };
|
|
10399
|
-
}
|
|
10400
|
-
const [collections, setCollections] = useState35([]);
|
|
10401
|
-
const [loading, setLoading] = useState35(false);
|
|
10402
|
-
const [error, setError] = useState35(null);
|
|
10403
|
-
console.log("[FlowView] State initialized", { collectionsCount: collections.length, loading, error });
|
|
10410
|
+
const userAddress = useCurrentUser();
|
|
10404
10411
|
const panelId = `${CLAIM_FLOW_PANEL_ID}-${block.id}`;
|
|
10405
|
-
|
|
10406
|
-
const panelContent = useMemo23(() => {
|
|
10407
|
-
console.log("[FlowView] panelContent useMemo EXECUTING");
|
|
10408
|
-
return /* @__PURE__ */ React124.createElement(TemplateConfig6, { editor, block });
|
|
10409
|
-
}, [editor, block]);
|
|
10410
|
-
console.log("[FlowView] Calling usePanel with panelId:", panelId);
|
|
10412
|
+
const panelContent = useMemo25(() => /* @__PURE__ */ React124.createElement(TemplateConfig6, { editor, block }), [editor, block]);
|
|
10411
10413
|
const { open } = usePanel(panelId, panelContent);
|
|
10412
|
-
|
|
10413
|
-
const selectedCollectionIds = useMemo23(() => {
|
|
10414
|
-
console.log("[FlowView] selectedCollectionIds useMemo EXECUTING");
|
|
10414
|
+
const selectedCollectionIds = useMemo25(() => {
|
|
10415
10415
|
try {
|
|
10416
10416
|
const parsed = JSON.parse(block.props.selectedCollections || "[]");
|
|
10417
|
-
|
|
10418
|
-
return parsed;
|
|
10417
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
10419
10418
|
} catch {
|
|
10420
|
-
console.log("[FlowView] selectedCollectionIds parse error, returning []");
|
|
10421
10419
|
return [];
|
|
10422
10420
|
}
|
|
10423
10421
|
}, [block.props.selectedCollections]);
|
|
10424
|
-
const selectedCollectionIdsKey = useMemo23(() => [...selectedCollectionIds].sort().join("|"), [selectedCollectionIds]);
|
|
10425
10422
|
const did = block.props.deedDid;
|
|
10426
10423
|
const adminAddress = block.props.adminAddress || "";
|
|
10427
|
-
|
|
10428
|
-
const [fetchedAdminAddress, setFetchedAdminAddress] = useState35(null);
|
|
10429
|
-
const fetchCollections = useCallback23(async () => {
|
|
10430
|
-
console.log("[FlowView] fetchCollections CALLED", { did, selectedCollectionIdsLength: selectedCollectionIds.length });
|
|
10431
|
-
if (!did || selectedCollectionIds.length === 0) {
|
|
10432
|
-
console.log("[FlowView] fetchCollections EARLY RETURN (no did or collections)");
|
|
10433
|
-
setCollections([]);
|
|
10434
|
-
return;
|
|
10435
|
-
}
|
|
10436
|
-
console.log("[FlowView] fetchCollections setting loading=true");
|
|
10437
|
-
setLoading(true);
|
|
10438
|
-
setError(null);
|
|
10439
|
-
try {
|
|
10440
|
-
console.log("[FlowView] fetchCollections calling getClaimCollections...");
|
|
10441
|
-
const response = await getClaimCollectionsRef.current({ deedDid: did });
|
|
10442
|
-
console.log("[FlowView] getClaimCollections response:", response);
|
|
10443
|
-
if (!response) {
|
|
10444
|
-
console.log("[FlowView] getClaimCollections returned NO DATA");
|
|
10445
|
-
alert("Error in FlowView.tsx:47 - getClaimCollections() returned no data");
|
|
10446
|
-
setError("No data returned from getClaimCollections");
|
|
10447
|
-
return;
|
|
10448
|
-
}
|
|
10449
|
-
const { adminAddress: responseAdminAddress, collections: allCollections } = response || { adminAddress: "", collections: [] };
|
|
10450
|
-
console.log("[FlowView] Destructured response:", { adminAddress: responseAdminAddress, allCollectionsCount: allCollections?.length });
|
|
10451
|
-
if (responseAdminAddress) {
|
|
10452
|
-
console.log("[FlowView] Storing fetched adminAddress for block update");
|
|
10453
|
-
setFetchedAdminAddress(responseAdminAddress);
|
|
10454
|
-
}
|
|
10455
|
-
const selectedCollections = (allCollections || []).filter((c) => selectedCollectionIds.includes(c?.id));
|
|
10456
|
-
console.log("[FlowView] Filtered collections:", { selectedCount: selectedCollections.length });
|
|
10457
|
-
console.log("[FlowView] Setting collections state...");
|
|
10458
|
-
setCollections(selectedCollections);
|
|
10459
|
-
console.log("[FlowView] Collections state SET");
|
|
10460
|
-
} catch (err) {
|
|
10461
|
-
console.log("[FlowView] getClaimCollections ERROR:", err);
|
|
10462
|
-
const errorMsg = err instanceof Error ? err.message : "Failed to fetch collections";
|
|
10463
|
-
alert(`Error in FlowView.tsx:47 - getClaimCollections() failed: ${errorMsg}`);
|
|
10464
|
-
setError(errorMsg);
|
|
10465
|
-
} finally {
|
|
10466
|
-
console.log("[FlowView] fetchCollections setting loading=false");
|
|
10467
|
-
setLoading(false);
|
|
10468
|
-
}
|
|
10469
|
-
}, [did, selectedCollectionIds, selectedCollectionIdsKey]);
|
|
10470
|
-
useEffect24(() => {
|
|
10471
|
-
if (fetchedAdminAddress && (!block.props.adminAddress || block.props.adminAddress === "")) {
|
|
10472
|
-
console.log("[FlowView] useEffect updating block adminAddress:", fetchedAdminAddress);
|
|
10473
|
-
editor.updateBlock(block, {
|
|
10474
|
-
props: {
|
|
10475
|
-
...block.props,
|
|
10476
|
-
adminAddress: fetchedAdminAddress
|
|
10477
|
-
}
|
|
10478
|
-
});
|
|
10479
|
-
console.log("[FlowView] Block adminAddress updated in useEffect");
|
|
10480
|
-
setFetchedAdminAddress(null);
|
|
10481
|
-
}
|
|
10482
|
-
}, [fetchedAdminAddress, block.props.adminAddress, editor, block]);
|
|
10483
|
-
useEffect24(() => {
|
|
10484
|
-
console.log("[FlowView] useEffect TRIGGERED - calling fetchCollections");
|
|
10485
|
-
fetchCollections();
|
|
10486
|
-
console.log("[FlowView] useEffect fetchCollections call COMPLETED");
|
|
10487
|
-
}, [fetchCollections]);
|
|
10424
|
+
const { collections, loading, error, refetch } = useCollections(did, selectedCollectionIds, block, editor);
|
|
10488
10425
|
if (!did) {
|
|
10489
|
-
console.log("[FlowView] RENDER: No DID - showing config message");
|
|
10490
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"));
|
|
10491
10427
|
}
|
|
10492
10428
|
if (selectedCollectionIds.length === 0) {
|
|
10493
|
-
console.log("[FlowView] RENDER: No collections selected");
|
|
10494
10429
|
return /* @__PURE__ */ React124.createElement(Center5, { py: "xl" }, /* @__PURE__ */ React124.createElement(Text62, { size: "sm", c: "dimmed" }, "No claim collections selected"));
|
|
10495
10430
|
}
|
|
10496
|
-
|
|
10497
|
-
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: fetchCollections, 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(React124.Fragment, null, console.log("[FlowView] RENDER: Showing loader"), /* @__PURE__ */ React124.createElement(Center5, { py: "xl" }, /* @__PURE__ */ React124.createElement(Loader11, { size: "md" }))) : error ? /* @__PURE__ */ React124.createElement(React124.Fragment, null, console.log("[FlowView] RENDER: Showing 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(React124.Fragment, null, console.log("[FlowView] RENDER: Rendering ClaimCollectionsList"), /* @__PURE__ */ React124.createElement(ClaimCollectionsList, { collections, deedId: did, adminAddress, userAddress: currentUser.address, onRefresh: fetchCollections })));
|
|
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 }));
|
|
10498
10432
|
};
|
|
10499
10433
|
|
|
10500
10434
|
// src/mantine/blocks/claim/ClaimBlock.tsx
|
|
@@ -10533,14 +10467,14 @@ var ClaimBlockSpec = createReactBlockSpec8(
|
|
|
10533
10467
|
);
|
|
10534
10468
|
|
|
10535
10469
|
// src/mantine/blocks/bid/BidBlockSpec.tsx
|
|
10536
|
-
import
|
|
10470
|
+
import React141 from "react";
|
|
10537
10471
|
import { createReactBlockSpec as createReactBlockSpec9 } from "@blocknote/react";
|
|
10538
10472
|
|
|
10539
10473
|
// src/mantine/blocks/bid/BidBlock.tsx
|
|
10540
|
-
import
|
|
10474
|
+
import React140 from "react";
|
|
10541
10475
|
|
|
10542
10476
|
// src/mantine/blocks/bid/template/TemplateView.tsx
|
|
10543
|
-
import React130, { useMemo as
|
|
10477
|
+
import React130, { useMemo as useMemo27 } from "react";
|
|
10544
10478
|
import { Group as Group39, Stack as Stack89, Text as Text63, Badge as Badge17 } from "@mantine/core";
|
|
10545
10479
|
|
|
10546
10480
|
// src/mantine/blocks/bid/template/TemplateConfig.tsx
|
|
@@ -10548,14 +10482,14 @@ import React129, { useCallback as useCallback25 } from "react";
|
|
|
10548
10482
|
import { Paper as Paper14, CloseButton as CloseButton10, Title as Title12 } from "@mantine/core";
|
|
10549
10483
|
|
|
10550
10484
|
// src/mantine/blocks/bid/template/GeneralTab.tsx
|
|
10551
|
-
import React127, { useEffect as
|
|
10485
|
+
import React127, { useEffect as useEffect26, useState as useState37 } from "react";
|
|
10552
10486
|
var GeneralTab7 = ({ title, description, onTitleChange, onDescriptionChange }) => {
|
|
10553
|
-
const [localTitle, setLocalTitle] =
|
|
10554
|
-
const [localDescription, setLocalDescription] =
|
|
10555
|
-
|
|
10487
|
+
const [localTitle, setLocalTitle] = useState37(title || "");
|
|
10488
|
+
const [localDescription, setLocalDescription] = useState37(description || "");
|
|
10489
|
+
useEffect26(() => {
|
|
10556
10490
|
setLocalTitle(title || "");
|
|
10557
10491
|
}, [title]);
|
|
10558
|
-
|
|
10492
|
+
useEffect26(() => {
|
|
10559
10493
|
setLocalDescription(description || "");
|
|
10560
10494
|
}, [description]);
|
|
10561
10495
|
return /* @__PURE__ */ React127.createElement(BaseSection, null, /* @__PURE__ */ React127.createElement(
|
|
@@ -10587,9 +10521,9 @@ var GeneralTab7 = ({ title, description, onTitleChange, onDescriptionChange }) =
|
|
|
10587
10521
|
};
|
|
10588
10522
|
|
|
10589
10523
|
// src/mantine/blocks/bid/template/CollectionsTab.tsx
|
|
10590
|
-
import React128, { useCallback as useCallback24, useMemo as
|
|
10524
|
+
import React128, { useCallback as useCallback24, useMemo as useMemo26 } from "react";
|
|
10591
10525
|
var CollectionsTab = ({ did, selectedCollections, adminAddress, onDidChange, onSelectedCollectionsChange, onAdminAddressChange }) => {
|
|
10592
|
-
const parsedSelectedCollections =
|
|
10526
|
+
const parsedSelectedCollections = useMemo26(() => {
|
|
10593
10527
|
try {
|
|
10594
10528
|
return JSON.parse(selectedCollections || "[]");
|
|
10595
10529
|
} catch {
|
|
@@ -10704,9 +10638,9 @@ var TemplateConfig7 = ({ editor, block }) => {
|
|
|
10704
10638
|
var BID_TEMPLATE_PANEL_ID = "bid-template-panel";
|
|
10705
10639
|
var BidTemplateView = ({ editor, block }) => {
|
|
10706
10640
|
const panelId = `${BID_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
10707
|
-
const panelContent =
|
|
10641
|
+
const panelContent = useMemo27(() => /* @__PURE__ */ React130.createElement(TemplateConfig7, { editor, block }), [editor, block]);
|
|
10708
10642
|
const { open } = usePanel(panelId, panelContent);
|
|
10709
|
-
const selectedCollectionsCount =
|
|
10643
|
+
const selectedCollectionsCount = useMemo27(() => {
|
|
10710
10644
|
try {
|
|
10711
10645
|
const parsed = JSON.parse(block.props.selectedCollections || "[]");
|
|
10712
10646
|
return parsed.length;
|
|
@@ -10718,34 +10652,35 @@ var BidTemplateView = ({ editor, block }) => {
|
|
|
10718
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")))));
|
|
10719
10653
|
};
|
|
10720
10654
|
|
|
10721
|
-
// src/mantine/blocks/bid/flow/FlowView.tsx
|
|
10722
|
-
import
|
|
10723
|
-
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";
|
|
10724
10658
|
import { IconSettings as IconSettings4, IconRefresh as IconRefresh3, IconAlertCircle as IconAlertCircle6 } from "@tabler/icons-react";
|
|
10725
10659
|
|
|
10726
|
-
// src/mantine/blocks/bid/flow/ClaimCollectionsList.tsx
|
|
10727
|
-
import
|
|
10728
|
-
import { Stack as
|
|
10729
|
-
|
|
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";
|
|
10663
|
+
|
|
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";
|
|
10730
10668
|
|
|
10731
|
-
// src/mantine/blocks/bid/flow/BidSurveyPanel.tsx
|
|
10732
|
-
import React131, { useMemo as
|
|
10669
|
+
// src/mantine/blocks/bid/flow/components/BidSurveyPanel.tsx
|
|
10670
|
+
import React131, { useMemo as useMemo29, useEffect as useEffect28 } from "react";
|
|
10733
10671
|
import { Paper as Paper15, CloseButton as CloseButton11, Title as Title13, Loader as Loader12, Stack as Stack90, Text as Text64 } from "@mantine/core";
|
|
10734
|
-
import { Survey as Survey2
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
var SURVEY_THEME_FOREGROUND = SURVEY_THEME_VARIABLES["--sjs-general-forecolor"] ?? "#ffffff";
|
|
10741
|
-
var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
|
|
10742
|
-
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) {
|
|
10743
10678
|
const handlers = useBlocknoteHandlers();
|
|
10744
|
-
const
|
|
10745
|
-
const [
|
|
10746
|
-
const [
|
|
10747
|
-
const
|
|
10748
|
-
|
|
10679
|
+
const { closePanel } = usePanelStore();
|
|
10680
|
+
const [surveyJson, setSurveyJson] = useState38(null);
|
|
10681
|
+
const [loading, setLoading] = useState38(true);
|
|
10682
|
+
const [error, setError] = useState38(null);
|
|
10683
|
+
useEffect27(() => {
|
|
10749
10684
|
const fetchSurveyTemplate = async () => {
|
|
10750
10685
|
try {
|
|
10751
10686
|
setLoading(true);
|
|
@@ -10764,7 +10699,7 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
|
|
|
10764
10699
|
};
|
|
10765
10700
|
fetchSurveyTemplate();
|
|
10766
10701
|
}, [deedId, role, handlers]);
|
|
10767
|
-
const surveyModel =
|
|
10702
|
+
const surveyModel = useMemo28(() => {
|
|
10768
10703
|
if (!surveyJson) return null;
|
|
10769
10704
|
const model = new SurveyModel2(surveyJson);
|
|
10770
10705
|
model.applyTheme(surveyTheme);
|
|
@@ -10772,16 +10707,6 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
|
|
|
10772
10707
|
model.questionsOnPageMode = "singlePage";
|
|
10773
10708
|
return model;
|
|
10774
10709
|
}, [surveyJson]);
|
|
10775
|
-
const surveyContainerStyle = useMemo26(
|
|
10776
|
-
() => ({
|
|
10777
|
-
flex: 1,
|
|
10778
|
-
overflow: "auto",
|
|
10779
|
-
backgroundColor: SURVEY_THEME_BACKGROUND,
|
|
10780
|
-
color: SURVEY_THEME_FOREGROUND,
|
|
10781
|
-
...SURVEY_THEME_VARIABLES
|
|
10782
|
-
}),
|
|
10783
|
-
[]
|
|
10784
|
-
);
|
|
10785
10710
|
const handleSurveyComplete = useCallback26(
|
|
10786
10711
|
async (sender) => {
|
|
10787
10712
|
const surveyData = sender.data;
|
|
@@ -10800,7 +10725,49 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
|
|
|
10800
10725
|
},
|
|
10801
10726
|
[handlers, collectionId, role, closePanel, onSubmitComplete]
|
|
10802
10727
|
);
|
|
10803
|
-
|
|
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(() => {
|
|
10804
10771
|
if (surveyModel) {
|
|
10805
10772
|
surveyModel.onComplete.add(handleSurveyComplete);
|
|
10806
10773
|
return () => {
|
|
@@ -10837,33 +10804,69 @@ var BidSurveyPanel = ({ deedId, collectionId, role, onSubmitComplete }) => {
|
|
|
10837
10804
|
);
|
|
10838
10805
|
};
|
|
10839
10806
|
|
|
10840
|
-
// src/mantine/blocks/bid/flow/BidsList.tsx
|
|
10841
|
-
import
|
|
10842
|
-
import { Stack as
|
|
10843
|
-
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";
|
|
10844
10811
|
|
|
10845
|
-
// src/mantine/blocks/bid/flow/
|
|
10846
|
-
import
|
|
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";
|
|
10816
|
+
|
|
10817
|
+
// src/mantine/blocks/bid/flow/components/BidViewPanel.tsx
|
|
10818
|
+
import React132, { useMemo as useMemo31, useState as useState41 } from "react";
|
|
10847
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";
|
|
10848
|
-
import { Survey as Survey3
|
|
10820
|
+
import { Survey as Survey3 } from "@ixo/surveys";
|
|
10849
10821
|
import { IconCheck as IconCheck2, IconX as IconX4, IconAlertCircle as IconAlertCircle4 } from "@tabler/icons-react";
|
|
10850
|
-
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
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) {
|
|
10858
10865
|
const handlers = useBlocknoteHandlers();
|
|
10859
|
-
const [surveyJson, setSurveyJson] =
|
|
10860
|
-
const [loading, setLoading] =
|
|
10861
|
-
const [error, setError] =
|
|
10862
|
-
|
|
10863
|
-
const [actionError, setActionError] = useState38(null);
|
|
10864
|
-
const [rejectModalOpen, setRejectModalOpen] = useState38(false);
|
|
10865
|
-
const [rejectReason, setRejectReason] = useState38("");
|
|
10866
|
-
useEffect27(() => {
|
|
10866
|
+
const [surveyJson, setSurveyJson] = useState39(null);
|
|
10867
|
+
const [loading, setLoading] = useState39(true);
|
|
10868
|
+
const [error, setError] = useState39(null);
|
|
10869
|
+
useEffect29(() => {
|
|
10867
10870
|
const fetchSurveyTemplate = async () => {
|
|
10868
10871
|
try {
|
|
10869
10872
|
setLoading(true);
|
|
@@ -10891,51 +10894,30 @@ var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
|
|
|
10891
10894
|
};
|
|
10892
10895
|
fetchSurveyTemplate();
|
|
10893
10896
|
}, [deedId, bid.role, handlers]);
|
|
10894
|
-
const surveyModel =
|
|
10897
|
+
const surveyModel = useMemo30(() => {
|
|
10895
10898
|
if (!surveyJson) return null;
|
|
10896
10899
|
const model = new SurveyModel3(surveyJson);
|
|
10897
10900
|
model.applyTheme(surveyTheme);
|
|
10898
10901
|
model.showQuestionNumbers = "off";
|
|
10899
10902
|
model.questionsOnPageMode = "singlePage";
|
|
10900
10903
|
model.mode = "display";
|
|
10901
|
-
|
|
10902
|
-
try {
|
|
10903
|
-
bidData = typeof bid.data === "string" ? JSON.parse(bid.data) : bid.data;
|
|
10904
|
-
} catch {
|
|
10905
|
-
bidData = bid.data;
|
|
10906
|
-
}
|
|
10907
|
-
model.data = bidData;
|
|
10904
|
+
model.data = parseBidData(bid.data);
|
|
10908
10905
|
return model;
|
|
10909
10906
|
}, [surveyJson, bid.data]);
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
);
|
|
10920
|
-
const
|
|
10921
|
-
if (role === "service_agent" || role === "SA") return "Service Agent";
|
|
10922
|
-
if (role === "evaluation_agent" || role === "EA") return "Evaluation Agent";
|
|
10923
|
-
return role;
|
|
10924
|
-
};
|
|
10925
|
-
const getRoleBadge = (role) => {
|
|
10926
|
-
const roleConfig = {
|
|
10927
|
-
service_agent: { color: "blue", label: "Service Agent" },
|
|
10928
|
-
SA: { color: "blue", label: "Service Agent" },
|
|
10929
|
-
evaluation_agent: { color: "green", label: "Evaluation Agent" },
|
|
10930
|
-
EA: { color: "green", label: "Evaluation Agent" }
|
|
10931
|
-
};
|
|
10932
|
-
const config = roleConfig[role] || { color: "gray", label: role };
|
|
10933
|
-
return /* @__PURE__ */ React132.createElement(Badge18, { size: "sm", color: config.color }, config.label);
|
|
10934
|
-
};
|
|
10935
|
-
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 () => {
|
|
10936
10918
|
try {
|
|
10937
|
-
|
|
10938
|
-
|
|
10919
|
+
setLoading(true);
|
|
10920
|
+
setError(null);
|
|
10939
10921
|
if (bid.role === "service_agent" || bid.role === "SA") {
|
|
10940
10922
|
await handlers.approveServiceAgentApplication({
|
|
10941
10923
|
adminAddress,
|
|
@@ -10963,39 +10945,67 @@ var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
|
|
|
10963
10945
|
closePanel();
|
|
10964
10946
|
onRefresh?.();
|
|
10965
10947
|
} catch (err) {
|
|
10966
|
-
|
|
10967
|
-
} finally {
|
|
10968
|
-
setActionLoading(false);
|
|
10969
|
-
}
|
|
10970
|
-
};
|
|
10971
|
-
const handleRejectBid = async () => {
|
|
10972
|
-
if (!rejectReason.trim()) {
|
|
10973
|
-
setActionError("Please provide a reason for rejection");
|
|
10974
|
-
return;
|
|
10975
|
-
}
|
|
10976
|
-
try {
|
|
10977
|
-
setActionLoading(true);
|
|
10978
|
-
setActionError(null);
|
|
10979
|
-
await handlers.rejectBid({
|
|
10980
|
-
bidId: bid.id,
|
|
10981
|
-
collectionId: bid.collection,
|
|
10982
|
-
did: deedId,
|
|
10983
|
-
reason: rejectReason
|
|
10984
|
-
});
|
|
10985
|
-
setRejectModalOpen(false);
|
|
10986
|
-
closePanel();
|
|
10987
|
-
onRefresh?.();
|
|
10988
|
-
} catch (err) {
|
|
10989
|
-
setActionError(err instanceof Error ? err.message : "Failed to reject bid");
|
|
10948
|
+
setError(err instanceof Error ? err.message : "Failed to approve bid");
|
|
10990
10949
|
} finally {
|
|
10991
|
-
|
|
10950
|
+
setLoading(false);
|
|
10992
10951
|
}
|
|
10993
|
-
};
|
|
10994
|
-
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 = () => {
|
|
10995
10999
|
setRejectReason("");
|
|
10996
11000
|
setActionError(null);
|
|
10997
11001
|
setRejectModalOpen(true);
|
|
10998
11002
|
};
|
|
11003
|
+
const handleRejectConfirm = async () => {
|
|
11004
|
+
await rejectBid(rejectReason);
|
|
11005
|
+
if (!actionError) {
|
|
11006
|
+
setRejectModalOpen(false);
|
|
11007
|
+
}
|
|
11008
|
+
};
|
|
10999
11009
|
return /* @__PURE__ */ React132.createElement(
|
|
11000
11010
|
Paper16,
|
|
11001
11011
|
{
|
|
@@ -11017,81 +11027,61 @@ var BidViewPanel = ({ bid, deedId, adminAddress, onRefresh }) => {
|
|
|
11017
11027
|
marginBottom: "1rem"
|
|
11018
11028
|
}
|
|
11019
11029
|
},
|
|
11020
|
-
/* @__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))),
|
|
11021
11031
|
/* @__PURE__ */ React132.createElement(CloseButton12, { onClick: closePanel })
|
|
11022
11032
|
),
|
|
11023
|
-
!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"))),
|
|
11024
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 })),
|
|
11025
|
-
/* @__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"))))
|
|
11026
11036
|
);
|
|
11027
11037
|
};
|
|
11028
11038
|
|
|
11029
|
-
// src/mantine/
|
|
11030
|
-
|
|
11039
|
+
// src/mantine/hooks/useUserProfile.ts
|
|
11040
|
+
import { useState as useState42, useEffect as useEffect30 } from "react";
|
|
11041
|
+
function useUserProfile(did) {
|
|
11031
11042
|
const handlers = useBlocknoteHandlers();
|
|
11032
|
-
const [userProfile, setUserProfile] =
|
|
11033
|
-
const [
|
|
11034
|
-
|
|
11043
|
+
const [userProfile, setUserProfile] = useState42(null);
|
|
11044
|
+
const [loading, setLoading] = useState42(false);
|
|
11045
|
+
useEffect30(() => {
|
|
11035
11046
|
const fetchUserProfile = async () => {
|
|
11036
|
-
if (!
|
|
11047
|
+
if (!did) return;
|
|
11037
11048
|
try {
|
|
11038
|
-
|
|
11039
|
-
const profile = await handlers.getMatrixInfoPerDid(
|
|
11049
|
+
setLoading(true);
|
|
11050
|
+
const profile = await handlers.getMatrixInfoPerDid(did);
|
|
11040
11051
|
setUserProfile(profile || null);
|
|
11041
11052
|
} catch (error) {
|
|
11042
11053
|
setUserProfile(null);
|
|
11043
11054
|
} finally {
|
|
11044
|
-
|
|
11055
|
+
setLoading(false);
|
|
11045
11056
|
}
|
|
11046
11057
|
};
|
|
11047
11058
|
fetchUserProfile();
|
|
11048
|
-
}, [
|
|
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);
|
|
11049
11066
|
const bidPanelId = `bid-view-${bid.id}`;
|
|
11050
|
-
const bidPanelContent =
|
|
11067
|
+
const bidPanelContent = useMemo32(() => /* @__PURE__ */ React133.createElement(BidViewPanel, { bid, deedId, adminAddress, onRefresh }), [bid, deedId, adminAddress, onRefresh]);
|
|
11051
11068
|
const { open: openBidPanel } = usePanel(bidPanelId, bidPanelContent);
|
|
11052
11069
|
const displayName = userProfile?.displayname || bid.did;
|
|
11053
|
-
const getRoleBadge = (role) => {
|
|
11054
|
-
const roleConfig = {
|
|
11055
|
-
service_agent: { color: "blue", label: "Service Agent" },
|
|
11056
|
-
SA: { color: "blue", label: "Service Agent" },
|
|
11057
|
-
evaluation_agent: { color: "green", label: "Evaluation Agent" },
|
|
11058
|
-
EA: { color: "green", label: "Evaluation Agent" }
|
|
11059
|
-
};
|
|
11060
|
-
const config = roleConfig[role] || { color: "gray", label: role };
|
|
11061
|
-
return /* @__PURE__ */ React133.createElement(Badge19, { size: "xs", variant: "light", color: config.color }, config.label);
|
|
11062
|
-
};
|
|
11063
|
-
const getStatusBadge = (status) => {
|
|
11064
|
-
const statusConfig = {
|
|
11065
|
-
pending: { color: "yellow", label: "Pending" },
|
|
11066
|
-
approved: { color: "green", label: "Approved" },
|
|
11067
|
-
rejected: { color: "red", label: "Rejected" }
|
|
11068
|
-
};
|
|
11069
|
-
const config = statusConfig[status] || { color: "gray", label: status };
|
|
11070
|
-
return /* @__PURE__ */ React133.createElement(Badge19, { size: "sm", color: config.color }, config.label);
|
|
11071
|
-
};
|
|
11072
|
-
const formatDate = (dateString) => {
|
|
11073
|
-
try {
|
|
11074
|
-
const date = new Date(dateString);
|
|
11075
|
-
return date.toLocaleDateString(void 0, {
|
|
11076
|
-
year: "numeric",
|
|
11077
|
-
month: "short",
|
|
11078
|
-
day: "numeric"
|
|
11079
|
-
});
|
|
11080
|
-
} catch {
|
|
11081
|
-
return dateString;
|
|
11082
|
-
}
|
|
11083
|
-
};
|
|
11084
11070
|
const displayDate = bid.created || "";
|
|
11085
11071
|
const displayStatus = bid.status;
|
|
11086
11072
|
const displayReason = bid.reason;
|
|
11087
|
-
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 }))));
|
|
11088
11075
|
};
|
|
11089
|
-
|
|
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) {
|
|
11090
11080
|
const handlers = useBlocknoteHandlers();
|
|
11091
|
-
const [bids, setBids] =
|
|
11092
|
-
const [loading, setLoading] =
|
|
11093
|
-
const [error, setError] =
|
|
11094
|
-
const fetchBids =
|
|
11081
|
+
const [bids, setBids] = useState43([]);
|
|
11082
|
+
const [loading, setLoading] = useState43(true);
|
|
11083
|
+
const [error, setError] = useState43(null);
|
|
11084
|
+
const fetchBids = useCallback28(async () => {
|
|
11095
11085
|
if (!collectionId) {
|
|
11096
11086
|
setLoading(false);
|
|
11097
11087
|
return;
|
|
@@ -11108,48 +11098,116 @@ var BidsList = ({ collectionId, deedId, adminAddress, onRefresh }) => {
|
|
|
11108
11098
|
setLoading(false);
|
|
11109
11099
|
}
|
|
11110
11100
|
}, [collectionId]);
|
|
11111
|
-
|
|
11101
|
+
useEffect31(() => {
|
|
11112
11102
|
fetchBids();
|
|
11113
11103
|
}, [fetchBids]);
|
|
11114
|
-
|
|
11115
|
-
|
|
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();
|
|
11116
11113
|
onRefresh();
|
|
11117
|
-
}, [
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
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
|
+
);
|
|
11128
11153
|
};
|
|
11129
11154
|
|
|
11130
|
-
// src/
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
return
|
|
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
|
+
);
|
|
11134
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
|
|
11135
11207
|
var CollectionItem2 = ({ collection, deedId, adminAddress, userRole, onRefresh }) => {
|
|
11136
|
-
const [isExpanded, setIsExpanded] = useState40(false);
|
|
11137
|
-
const getCollectionName = (collection2) => {
|
|
11138
|
-
return collection2.protocol?.profile?.name || collection2.name || "Unnamed Collection";
|
|
11139
|
-
};
|
|
11140
|
-
const getRoleBadge = (role) => {
|
|
11141
|
-
const roleConfig = {
|
|
11142
|
-
["SA" /* ServiceProvider */]: { label: "Service Agent", color: "blue" },
|
|
11143
|
-
["EA" /* Evaluator */]: { label: "Evaluation Agent", color: "green" },
|
|
11144
|
-
["PO" /* Owner */]: { label: "Owner", color: "violet" },
|
|
11145
|
-
["IA" /* Investor */]: { label: "Investor", color: "orange" }
|
|
11146
|
-
};
|
|
11147
|
-
const config = roleConfig[role] || { label: role, color: "gray" };
|
|
11148
|
-
return /* @__PURE__ */ React134.createElement(Badge20, { size: "sm", color: config.color }, config.label);
|
|
11149
|
-
};
|
|
11150
11208
|
const serviceAgentPanelId = `bid-survey-${collection.id}-service_agent`;
|
|
11151
|
-
const serviceAgentPanelContent =
|
|
11152
|
-
() => /* @__PURE__ */
|
|
11209
|
+
const serviceAgentPanelContent = useMemo33(
|
|
11210
|
+
() => /* @__PURE__ */ React137.createElement(
|
|
11153
11211
|
BidSurveyPanel,
|
|
11154
11212
|
{
|
|
11155
11213
|
deedId,
|
|
@@ -11162,8 +11220,8 @@ var CollectionItem2 = ({ collection, deedId, adminAddress, userRole, onRefresh }
|
|
|
11162
11220
|
);
|
|
11163
11221
|
const { open: openServiceAgent } = usePanel(serviceAgentPanelId, serviceAgentPanelContent);
|
|
11164
11222
|
const evaluationAgentPanelId = `bid-survey-${collection.id}-evaluation_agent`;
|
|
11165
|
-
const evaluationAgentPanelContent =
|
|
11166
|
-
() => /* @__PURE__ */
|
|
11223
|
+
const evaluationAgentPanelContent = useMemo33(
|
|
11224
|
+
() => /* @__PURE__ */ React137.createElement(
|
|
11167
11225
|
BidSurveyPanel,
|
|
11168
11226
|
{
|
|
11169
11227
|
deedId,
|
|
@@ -11175,191 +11233,78 @@ var CollectionItem2 = ({ collection, deedId, adminAddress, userRole, onRefresh }
|
|
|
11175
11233
|
[deedId, collection.id, onRefresh]
|
|
11176
11234
|
);
|
|
11177
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);
|
|
11178
11242
|
const renderActionButton = () => {
|
|
11179
11243
|
if (userRole === "PO" /* Owner */) {
|
|
11180
|
-
return /* @__PURE__ */
|
|
11244
|
+
return /* @__PURE__ */ React137.createElement(ActionIcon18, { variant: "subtle", size: "lg", onClick: openBidsList }, /* @__PURE__ */ React137.createElement(IconArrowRight4, { size: 20 }));
|
|
11181
11245
|
} else if (userRole === "SA" /* ServiceProvider */ || userRole === "EA" /* Evaluator */) {
|
|
11182
|
-
return
|
|
11246
|
+
return /* @__PURE__ */ React137.createElement(Badge20, { size: "sm", color: getRoleColor(userRole) }, getRoleLabel(userRole));
|
|
11183
11247
|
} else {
|
|
11184
|
-
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")));
|
|
11185
11249
|
}
|
|
11186
11250
|
};
|
|
11187
|
-
|
|
11251
|
+
const getCollectionIcon = () => {
|
|
11252
|
+
if (userRole === "PO" /* Owner */) {
|
|
11253
|
+
return /* @__PURE__ */ React137.createElement(UserCheck_default, null);
|
|
11254
|
+
}
|
|
11255
|
+
return /* @__PURE__ */ React137.createElement(UserPlus_default, null);
|
|
11256
|
+
};
|
|
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());
|
|
11188
11259
|
};
|
|
11260
|
+
|
|
11261
|
+
// src/mantine/blocks/bid/flow/components/ClaimCollectionsList.tsx
|
|
11189
11262
|
var ClaimCollectionsList2 = ({ collections, deedId, adminAddress, userAddress, onRefresh }) => {
|
|
11190
|
-
const {
|
|
11191
|
-
const getUserRolesRef = useRef6(getUserRoles);
|
|
11192
|
-
useEffect29(() => {
|
|
11193
|
-
getUserRolesRef.current = getUserRoles;
|
|
11194
|
-
}, [getUserRoles]);
|
|
11195
|
-
const [userRoles, setUserRoles] = useState40({});
|
|
11196
|
-
const [loadingRoles, setLoadingRoles] = useState40(true);
|
|
11197
|
-
const failedRequestKeyRef = useRef6(null);
|
|
11198
|
-
const collectionIdsKey = useMemo29(
|
|
11199
|
-
() => collections.map((c) => c.id).sort().join("|"),
|
|
11200
|
-
[collections]
|
|
11201
|
-
);
|
|
11202
|
-
const requestKey = useMemo29(() => [userAddress, adminAddress, deedId, collectionIdsKey].filter(Boolean).join("|"), [userAddress, adminAddress, deedId, collectionIdsKey]);
|
|
11203
|
-
useEffect29(() => {
|
|
11204
|
-
let isMounted = true;
|
|
11205
|
-
const setEmptyRoles = () => {
|
|
11206
|
-
const rolesMap = {};
|
|
11207
|
-
collections.forEach((collection) => {
|
|
11208
|
-
rolesMap[collection.id] = null;
|
|
11209
|
-
});
|
|
11210
|
-
if (isMounted) {
|
|
11211
|
-
setUserRoles(rolesMap);
|
|
11212
|
-
}
|
|
11213
|
-
};
|
|
11214
|
-
const fetchUserRoles = async () => {
|
|
11215
|
-
if (!collections || collections.length === 0 || !userAddress || !adminAddress) {
|
|
11216
|
-
setLoadingRoles(false);
|
|
11217
|
-
return;
|
|
11218
|
-
}
|
|
11219
|
-
if (!requestKey || failedRequestKeyRef.current === requestKey) {
|
|
11220
|
-
setLoadingRoles(false);
|
|
11221
|
-
return;
|
|
11222
|
-
}
|
|
11223
|
-
const getUserRolesFn = getUserRolesRef.current;
|
|
11224
|
-
if (typeof getUserRolesFn !== "function") {
|
|
11225
|
-
setEmptyRoles();
|
|
11226
|
-
setLoadingRoles(false);
|
|
11227
|
-
return;
|
|
11228
|
-
}
|
|
11229
|
-
try {
|
|
11230
|
-
setLoadingRoles(true);
|
|
11231
|
-
const collectionIds = collections.map((c) => c.id);
|
|
11232
|
-
const roles = await getUserRolesFn({
|
|
11233
|
-
userAddress,
|
|
11234
|
-
adminAddress,
|
|
11235
|
-
deedDid: deedId,
|
|
11236
|
-
collectionIds
|
|
11237
|
-
});
|
|
11238
|
-
const rolesMap = {};
|
|
11239
|
-
collections.forEach((collection) => {
|
|
11240
|
-
const roleData = roles?.find((r) => r.collectionId === collection.id);
|
|
11241
|
-
rolesMap[collection.id] = roleData?.role || null;
|
|
11242
|
-
});
|
|
11243
|
-
setUserRoles(rolesMap);
|
|
11244
|
-
} catch (error) {
|
|
11245
|
-
if (isClientFulfillmentError2(error)) {
|
|
11246
|
-
failedRequestKeyRef.current = requestKey;
|
|
11247
|
-
} else {
|
|
11248
|
-
failedRequestKeyRef.current = null;
|
|
11249
|
-
}
|
|
11250
|
-
setEmptyRoles();
|
|
11251
|
-
} finally {
|
|
11252
|
-
if (isMounted) {
|
|
11253
|
-
setLoadingRoles(false);
|
|
11254
|
-
}
|
|
11255
|
-
}
|
|
11256
|
-
};
|
|
11257
|
-
fetchUserRoles();
|
|
11258
|
-
return () => {
|
|
11259
|
-
isMounted = false;
|
|
11260
|
-
};
|
|
11261
|
-
}, [collections, userAddress, adminAddress, deedId, requestKey]);
|
|
11263
|
+
const { userRoles, loading } = useUserRoles(collections, userAddress, adminAddress, deedId);
|
|
11262
11264
|
if (!collections || collections.length === 0) {
|
|
11263
|
-
return /* @__PURE__ */
|
|
11265
|
+
return /* @__PURE__ */ React138.createElement(Text69, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No claim collections found");
|
|
11264
11266
|
}
|
|
11265
|
-
if (
|
|
11266
|
-
return /* @__PURE__ */
|
|
11267
|
+
if (loading) {
|
|
11268
|
+
return /* @__PURE__ */ React138.createElement(Center7, { py: "md" }, /* @__PURE__ */ React138.createElement(Loader15, { size: "sm" }));
|
|
11267
11269
|
}
|
|
11268
|
-
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 })));
|
|
11269
11271
|
};
|
|
11270
11272
|
|
|
11271
|
-
// src/mantine/blocks/bid/flow/FlowView.tsx
|
|
11273
|
+
// src/mantine/blocks/bid/flow/components/FlowView.tsx
|
|
11272
11274
|
var BID_FLOW_PANEL_ID = "bid-flow-panel";
|
|
11273
11275
|
var BidFlowView = ({ editor, block }) => {
|
|
11274
11276
|
const { editable } = useBlocknoteContext();
|
|
11275
|
-
const
|
|
11276
|
-
const getClaimCollectionsRef = useRef7(getClaimCollections);
|
|
11277
|
-
const getCurrentUserRef = useRef7(getCurrentUser);
|
|
11278
|
-
useEffect30(() => {
|
|
11279
|
-
getClaimCollectionsRef.current = getClaimCollections;
|
|
11280
|
-
getCurrentUserRef.current = getCurrentUser;
|
|
11281
|
-
}, [getCurrentUser, getClaimCollections]);
|
|
11282
|
-
const [collections, setCollections] = useState41([]);
|
|
11283
|
-
const [loading, setLoading] = useState41(false);
|
|
11284
|
-
const [error, setError] = useState41(null);
|
|
11285
|
-
const [userAddress, setUserAddress] = useState41("");
|
|
11286
|
-
const adminAddressUpdatedRef = useRef7(false);
|
|
11277
|
+
const userAddress = useCurrentUser();
|
|
11287
11278
|
const panelId = `${BID_FLOW_PANEL_ID}-${block.id}`;
|
|
11288
|
-
const panelContent =
|
|
11279
|
+
const panelContent = useMemo34(() => /* @__PURE__ */ React139.createElement(TemplateConfig7, { editor, block }), [editor, block]);
|
|
11289
11280
|
const { open } = usePanel(panelId, panelContent);
|
|
11290
|
-
const selectedCollectionIds =
|
|
11281
|
+
const selectedCollectionIds = useMemo34(() => {
|
|
11291
11282
|
try {
|
|
11292
11283
|
const parsed = JSON.parse(block.props.selectedCollections || "[]");
|
|
11293
11284
|
return Array.isArray(parsed) ? parsed : [];
|
|
11294
|
-
} catch {
|
|
11295
|
-
return [];
|
|
11296
|
-
}
|
|
11297
|
-
}, [block.props.selectedCollections]);
|
|
11298
|
-
const selectedCollectionIdsStr = useMemo30(() => JSON.stringify(selectedCollectionIds.sort()), [selectedCollectionIds]);
|
|
11299
|
-
const did = block.props.did;
|
|
11300
|
-
const adminAddress = block.props.adminAddress || "";
|
|
11301
|
-
useEffect30(() => {
|
|
11302
|
-
const fetchUserAddress = () => {
|
|
11303
|
-
try {
|
|
11304
|
-
const user = getCurrentUserRef.current();
|
|
11305
|
-
setUserAddress(user?.address || "");
|
|
11306
|
-
} catch (err) {
|
|
11307
|
-
setUserAddress("");
|
|
11308
|
-
}
|
|
11309
|
-
};
|
|
11310
|
-
fetchUserAddress();
|
|
11311
|
-
}, []);
|
|
11312
|
-
const fetchCollections = useCallback28(async () => {
|
|
11313
|
-
if (!did || selectedCollectionIds.length === 0) {
|
|
11314
|
-
setCollections([]);
|
|
11315
|
-
return;
|
|
11316
|
-
}
|
|
11317
|
-
if (loading) {
|
|
11318
|
-
return;
|
|
11319
|
-
}
|
|
11320
|
-
setLoading(true);
|
|
11321
|
-
setError(null);
|
|
11322
|
-
try {
|
|
11323
|
-
const response = await getClaimCollectionsRef.current({ deedDid: did });
|
|
11324
|
-
const { adminAddress: fetchedAdminAddress = "", collections: allCollections = [] } = response || {};
|
|
11325
|
-
const currentAdminAddress = block.props.adminAddress || "";
|
|
11326
|
-
if (fetchedAdminAddress && !currentAdminAddress && !adminAddressUpdatedRef.current) {
|
|
11327
|
-
adminAddressUpdatedRef.current = true;
|
|
11328
|
-
editor.updateBlock(block, {
|
|
11329
|
-
props: {
|
|
11330
|
-
...block.props,
|
|
11331
|
-
adminAddress: fetchedAdminAddress
|
|
11332
|
-
}
|
|
11333
|
-
});
|
|
11334
|
-
}
|
|
11335
|
-
const selectedCollections = Array.isArray(allCollections) ? allCollections.filter((c) => c && selectedCollectionIds.includes(c.id)) : [];
|
|
11336
|
-
setCollections(selectedCollections);
|
|
11337
|
-
} catch (err) {
|
|
11338
|
-
setError(err instanceof Error ? err.message : "Failed to fetch collections");
|
|
11339
|
-
setCollections([]);
|
|
11340
|
-
} finally {
|
|
11341
|
-
setLoading(false);
|
|
11285
|
+
} catch {
|
|
11286
|
+
return [];
|
|
11342
11287
|
}
|
|
11343
|
-
}, [
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
},
|
|
11288
|
+
}, [block.props.selectedCollections]);
|
|
11289
|
+
const did = block.props.did;
|
|
11290
|
+
const adminAddress = block.props.adminAddress || "";
|
|
11291
|
+
const { collections, loading, error, refetch } = useCollections(did, selectedCollectionIds, block, editor);
|
|
11347
11292
|
if (!did) {
|
|
11348
|
-
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"));
|
|
11349
11294
|
}
|
|
11350
11295
|
if (selectedCollectionIds.length === 0) {
|
|
11351
|
-
return /* @__PURE__ */
|
|
11296
|
+
return /* @__PURE__ */ React139.createElement(Center8, { py: "xl" }, /* @__PURE__ */ React139.createElement(Text70, { size: "sm", c: "dimmed" }, "No claim collections selected"));
|
|
11352
11297
|
}
|
|
11353
|
-
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 }));
|
|
11354
11299
|
};
|
|
11355
11300
|
|
|
11356
11301
|
// src/mantine/blocks/bid/BidBlock.tsx
|
|
11357
11302
|
function BidBlock({ editor, block }) {
|
|
11358
11303
|
const { docType } = useBlocknoteContext();
|
|
11359
11304
|
if (docType === "template") {
|
|
11360
|
-
return /* @__PURE__ */
|
|
11305
|
+
return /* @__PURE__ */ React140.createElement(BidTemplateView, { editor, block });
|
|
11361
11306
|
}
|
|
11362
|
-
return /* @__PURE__ */
|
|
11307
|
+
return /* @__PURE__ */ React140.createElement(BidFlowView, { editor, block });
|
|
11363
11308
|
}
|
|
11364
11309
|
|
|
11365
11310
|
// src/mantine/blocks/bid/BidBlockSpec.tsx
|
|
@@ -11378,24 +11323,24 @@ var BidBlockSpec = createReactBlockSpec9(
|
|
|
11378
11323
|
{
|
|
11379
11324
|
render: (props) => {
|
|
11380
11325
|
const ixoProps = props;
|
|
11381
|
-
return /* @__PURE__ */
|
|
11326
|
+
return /* @__PURE__ */ React141.createElement(BidBlock, { ...ixoProps });
|
|
11382
11327
|
}
|
|
11383
11328
|
}
|
|
11384
11329
|
);
|
|
11385
11330
|
|
|
11386
11331
|
// src/mantine/blocks/evaluator/EvaluatorBlock.tsx
|
|
11387
|
-
import
|
|
11332
|
+
import React148 from "react";
|
|
11388
11333
|
|
|
11389
11334
|
// src/mantine/blocks/evaluator/template/TemplateView.tsx
|
|
11390
|
-
import
|
|
11391
|
-
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";
|
|
11392
11337
|
|
|
11393
11338
|
// src/mantine/blocks/evaluator/template/TemplateConfig.tsx
|
|
11394
|
-
import
|
|
11395
|
-
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";
|
|
11396
11341
|
|
|
11397
11342
|
// src/mantine/blocks/evaluator/template/GeneralTab.tsx
|
|
11398
|
-
import
|
|
11343
|
+
import React142, { useEffect as useEffect32, useState as useState44, useCallback as useCallback30, useMemo as useMemo35 } from "react";
|
|
11399
11344
|
var GeneralTab8 = ({
|
|
11400
11345
|
title,
|
|
11401
11346
|
description,
|
|
@@ -11408,29 +11353,29 @@ var GeneralTab8 = ({
|
|
|
11408
11353
|
onSelectedCollectionsChange,
|
|
11409
11354
|
onAdminAddressChange
|
|
11410
11355
|
}) => {
|
|
11411
|
-
const [localTitle, setLocalTitle] =
|
|
11412
|
-
const [localDescription, setLocalDescription] =
|
|
11413
|
-
|
|
11356
|
+
const [localTitle, setLocalTitle] = useState44(title || "");
|
|
11357
|
+
const [localDescription, setLocalDescription] = useState44(description || "");
|
|
11358
|
+
useEffect32(() => {
|
|
11414
11359
|
setLocalTitle(title || "");
|
|
11415
11360
|
}, [title]);
|
|
11416
|
-
|
|
11361
|
+
useEffect32(() => {
|
|
11417
11362
|
setLocalDescription(description || "");
|
|
11418
11363
|
}, [description]);
|
|
11419
|
-
const parsedSelectedCollections =
|
|
11364
|
+
const parsedSelectedCollections = useMemo35(() => {
|
|
11420
11365
|
try {
|
|
11421
11366
|
return JSON.parse(selectedCollections || "[]");
|
|
11422
11367
|
} catch {
|
|
11423
11368
|
return [];
|
|
11424
11369
|
}
|
|
11425
11370
|
}, [selectedCollections]);
|
|
11426
|
-
const handleCollectionsChange =
|
|
11371
|
+
const handleCollectionsChange = useCallback30(
|
|
11427
11372
|
(collections) => {
|
|
11428
11373
|
const stringified = JSON.stringify(collections || []);
|
|
11429
11374
|
onSelectedCollectionsChange(stringified);
|
|
11430
11375
|
},
|
|
11431
11376
|
[onSelectedCollectionsChange]
|
|
11432
11377
|
);
|
|
11433
|
-
const handleAdminAddressChange =
|
|
11378
|
+
const handleAdminAddressChange = useCallback30(
|
|
11434
11379
|
(adminAddress2) => {
|
|
11435
11380
|
if (onAdminAddressChange) {
|
|
11436
11381
|
onAdminAddressChange(adminAddress2);
|
|
@@ -11438,7 +11383,7 @@ var GeneralTab8 = ({
|
|
|
11438
11383
|
},
|
|
11439
11384
|
[onAdminAddressChange]
|
|
11440
11385
|
);
|
|
11441
|
-
return /* @__PURE__ */
|
|
11386
|
+
return /* @__PURE__ */ React142.createElement(BaseSection, null, /* @__PURE__ */ React142.createElement(
|
|
11442
11387
|
BaseTextInput,
|
|
11443
11388
|
{
|
|
11444
11389
|
label: "Title",
|
|
@@ -11450,7 +11395,7 @@ var GeneralTab8 = ({
|
|
|
11450
11395
|
onTitleChange(newTitle);
|
|
11451
11396
|
}
|
|
11452
11397
|
}
|
|
11453
|
-
), /* @__PURE__ */
|
|
11398
|
+
), /* @__PURE__ */ React142.createElement(
|
|
11454
11399
|
BaseTextArea,
|
|
11455
11400
|
{
|
|
11456
11401
|
label: "Description",
|
|
@@ -11463,7 +11408,7 @@ var GeneralTab8 = ({
|
|
|
11463
11408
|
onDescriptionChange(newDescription);
|
|
11464
11409
|
}
|
|
11465
11410
|
}
|
|
11466
|
-
), /* @__PURE__ */
|
|
11411
|
+
), /* @__PURE__ */ React142.createElement(
|
|
11467
11412
|
CollectionSelector,
|
|
11468
11413
|
{
|
|
11469
11414
|
did: deedDid,
|
|
@@ -11479,7 +11424,7 @@ var GeneralTab8 = ({
|
|
|
11479
11424
|
// src/mantine/blocks/evaluator/template/TemplateConfig.tsx
|
|
11480
11425
|
var TemplateConfig8 = ({ editor, block }) => {
|
|
11481
11426
|
const { closePanel } = usePanelStore();
|
|
11482
|
-
const updateProp =
|
|
11427
|
+
const updateProp = useCallback31(
|
|
11483
11428
|
(key, value) => {
|
|
11484
11429
|
editor.updateBlock(block, {
|
|
11485
11430
|
props: {
|
|
@@ -11490,8 +11435,8 @@ var TemplateConfig8 = ({ editor, block }) => {
|
|
|
11490
11435
|
},
|
|
11491
11436
|
[editor, block]
|
|
11492
11437
|
);
|
|
11493
|
-
return /* @__PURE__ */
|
|
11494
|
-
|
|
11438
|
+
return /* @__PURE__ */ React143.createElement(
|
|
11439
|
+
Paper18,
|
|
11495
11440
|
{
|
|
11496
11441
|
p: "md",
|
|
11497
11442
|
shadow: "sm",
|
|
@@ -11501,7 +11446,7 @@ var TemplateConfig8 = ({ editor, block }) => {
|
|
|
11501
11446
|
flexDirection: "column"
|
|
11502
11447
|
}
|
|
11503
11448
|
},
|
|
11504
|
-
/* @__PURE__ */
|
|
11449
|
+
/* @__PURE__ */ React143.createElement(
|
|
11505
11450
|
"div",
|
|
11506
11451
|
{
|
|
11507
11452
|
style: {
|
|
@@ -11511,17 +11456,17 @@ var TemplateConfig8 = ({ editor, block }) => {
|
|
|
11511
11456
|
marginBottom: "1rem"
|
|
11512
11457
|
}
|
|
11513
11458
|
},
|
|
11514
|
-
/* @__PURE__ */
|
|
11515
|
-
/* @__PURE__ */
|
|
11459
|
+
/* @__PURE__ */ React143.createElement(Title17, { order: 3 }, "Evaluator Settings"),
|
|
11460
|
+
/* @__PURE__ */ React143.createElement(CloseButton14, { onClick: closePanel })
|
|
11516
11461
|
),
|
|
11517
|
-
/* @__PURE__ */
|
|
11462
|
+
/* @__PURE__ */ React143.createElement(
|
|
11518
11463
|
ReusablePanel,
|
|
11519
11464
|
{
|
|
11520
11465
|
extraTabs: [
|
|
11521
11466
|
{
|
|
11522
11467
|
label: "General",
|
|
11523
11468
|
value: "general",
|
|
11524
|
-
content: /* @__PURE__ */
|
|
11469
|
+
content: /* @__PURE__ */ React143.createElement(
|
|
11525
11470
|
GeneralTab8,
|
|
11526
11471
|
{
|
|
11527
11472
|
title: block.props.title || "",
|
|
@@ -11548,24 +11493,24 @@ var TemplateConfig8 = ({ editor, block }) => {
|
|
|
11548
11493
|
var EVALUATOR_TEMPLATE_PANEL_ID = "evaluator-template-panel";
|
|
11549
11494
|
var EvaluatorTemplateView = ({ editor, block }) => {
|
|
11550
11495
|
const panelId = `${EVALUATOR_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
11551
|
-
const panelContent =
|
|
11496
|
+
const panelContent = useMemo36(() => /* @__PURE__ */ React144.createElement(TemplateConfig8, { editor, block }), [editor, block]);
|
|
11552
11497
|
const { open } = usePanel(panelId, panelContent);
|
|
11553
|
-
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")))));
|
|
11554
11499
|
};
|
|
11555
11500
|
|
|
11556
11501
|
// src/mantine/blocks/evaluator/flow/FlowView.tsx
|
|
11557
|
-
import
|
|
11558
|
-
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";
|
|
11559
11504
|
import { IconSettings as IconSettings5, IconRefresh as IconRefresh5, IconAlertCircle as IconAlertCircle8 } from "@tabler/icons-react";
|
|
11560
11505
|
|
|
11561
11506
|
// src/mantine/blocks/evaluator/flow/ClaimCollectionsList.tsx
|
|
11562
|
-
import
|
|
11563
|
-
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";
|
|
11564
11509
|
|
|
11565
11510
|
// src/mantine/blocks/evaluator/flow/ClaimsList.tsx
|
|
11566
|
-
import
|
|
11567
|
-
import { Paper as
|
|
11568
|
-
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";
|
|
11569
11514
|
import { Survey as Survey4, SurveyModel as SurveyModel4 } from "@ixo/surveys";
|
|
11570
11515
|
|
|
11571
11516
|
// src/mantine/blocks/evaluator/flow/theme.ts
|
|
@@ -11727,26 +11672,26 @@ var surveyTheme2 = {
|
|
|
11727
11672
|
};
|
|
11728
11673
|
|
|
11729
11674
|
// src/mantine/blocks/evaluator/flow/ClaimsList.tsx
|
|
11730
|
-
var
|
|
11675
|
+
var SURVEY_THEME_VARIABLES2 = Object.entries(surveyTheme2.cssVariables ?? {}).reduce((acc, [key, value]) => {
|
|
11731
11676
|
acc[key] = value;
|
|
11732
11677
|
return acc;
|
|
11733
11678
|
}, {});
|
|
11734
|
-
var
|
|
11735
|
-
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";
|
|
11736
11681
|
var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvaluationComplete }) => {
|
|
11737
11682
|
const { closePanel } = usePanelStore();
|
|
11738
11683
|
const handlers = useBlocknoteHandlers();
|
|
11739
|
-
const [viewMode, setViewMode] =
|
|
11740
|
-
const [claims, setClaims] =
|
|
11741
|
-
const [loading, setLoading] =
|
|
11742
|
-
const [error, setError] =
|
|
11743
|
-
const [selectedClaim, setSelectedClaim] =
|
|
11744
|
-
const [claimData, setClaimData] =
|
|
11745
|
-
const [surveyJson, setSurveyJson] =
|
|
11746
|
-
const [surveyLoading, setSurveyLoading] =
|
|
11747
|
-
const [surveyError, setSurveyError] =
|
|
11748
|
-
const [evaluating, setEvaluating] =
|
|
11749
|
-
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 () => {
|
|
11750
11695
|
try {
|
|
11751
11696
|
setLoading(true);
|
|
11752
11697
|
setError(null);
|
|
@@ -11761,10 +11706,10 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11761
11706
|
setLoading(false);
|
|
11762
11707
|
}
|
|
11763
11708
|
}, [collectionId]);
|
|
11764
|
-
|
|
11709
|
+
useEffect33(() => {
|
|
11765
11710
|
fetchClaims();
|
|
11766
11711
|
}, [fetchClaims]);
|
|
11767
|
-
const fetchClaimAndSurvey =
|
|
11712
|
+
const fetchClaimAndSurvey = useCallback32(
|
|
11768
11713
|
async (claim) => {
|
|
11769
11714
|
try {
|
|
11770
11715
|
setSurveyLoading(true);
|
|
@@ -11788,7 +11733,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11788
11733
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11789
11734
|
[collectionId, deedId]
|
|
11790
11735
|
);
|
|
11791
|
-
const handleViewClaim =
|
|
11736
|
+
const handleViewClaim = useCallback32(
|
|
11792
11737
|
(claim) => {
|
|
11793
11738
|
setSelectedClaim(claim);
|
|
11794
11739
|
fetchClaimAndSurvey(claim);
|
|
@@ -11796,7 +11741,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11796
11741
|
},
|
|
11797
11742
|
[fetchClaimAndSurvey]
|
|
11798
11743
|
);
|
|
11799
|
-
const handleBackToList =
|
|
11744
|
+
const handleBackToList = useCallback32(() => {
|
|
11800
11745
|
setViewMode("list");
|
|
11801
11746
|
setSelectedClaim(null);
|
|
11802
11747
|
setClaimData(null);
|
|
@@ -11805,7 +11750,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11805
11750
|
setEvaluating(false);
|
|
11806
11751
|
fetchClaims();
|
|
11807
11752
|
}, [fetchClaims]);
|
|
11808
|
-
const surveyModel =
|
|
11753
|
+
const surveyModel = useMemo37(() => {
|
|
11809
11754
|
if (!surveyJson || !claimData) return null;
|
|
11810
11755
|
const model = new SurveyModel4(surveyJson);
|
|
11811
11756
|
model.applyTheme(surveyTheme2);
|
|
@@ -11817,18 +11762,18 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11817
11762
|
}
|
|
11818
11763
|
return model;
|
|
11819
11764
|
}, [surveyJson, claimData]);
|
|
11820
|
-
const surveyContainerStyle =
|
|
11765
|
+
const surveyContainerStyle = useMemo37(
|
|
11821
11766
|
() => ({
|
|
11822
11767
|
flex: 1,
|
|
11823
11768
|
overflow: "auto",
|
|
11824
|
-
backgroundColor:
|
|
11825
|
-
color:
|
|
11826
|
-
...
|
|
11769
|
+
backgroundColor: SURVEY_THEME_BACKGROUND2,
|
|
11770
|
+
color: SURVEY_THEME_FOREGROUND2,
|
|
11771
|
+
...SURVEY_THEME_VARIABLES2,
|
|
11827
11772
|
padding: "1rem"
|
|
11828
11773
|
}),
|
|
11829
11774
|
[]
|
|
11830
11775
|
);
|
|
11831
|
-
const handleApprove =
|
|
11776
|
+
const handleApprove = useCallback32(async () => {
|
|
11832
11777
|
if (!selectedClaim) return;
|
|
11833
11778
|
try {
|
|
11834
11779
|
setEvaluating(true);
|
|
@@ -11857,7 +11802,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11857
11802
|
setEvaluating(false);
|
|
11858
11803
|
}
|
|
11859
11804
|
}, [selectedClaim, handlers, deedId, collectionId, adminAddress, handleBackToList]);
|
|
11860
|
-
const handleReject =
|
|
11805
|
+
const handleReject = useCallback32(async () => {
|
|
11861
11806
|
if (!selectedClaim) return;
|
|
11862
11807
|
try {
|
|
11863
11808
|
setEvaluating(true);
|
|
@@ -11869,8 +11814,8 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11869
11814
|
setEvaluating(false);
|
|
11870
11815
|
}
|
|
11871
11816
|
}, [selectedClaim, handleBackToList]);
|
|
11872
|
-
return /* @__PURE__ */
|
|
11873
|
-
|
|
11817
|
+
return /* @__PURE__ */ React145.createElement(
|
|
11818
|
+
Paper19,
|
|
11874
11819
|
{
|
|
11875
11820
|
p: "md",
|
|
11876
11821
|
shadow: "sm",
|
|
@@ -11881,7 +11826,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11881
11826
|
overflow: "hidden"
|
|
11882
11827
|
}
|
|
11883
11828
|
},
|
|
11884
|
-
/* @__PURE__ */
|
|
11829
|
+
/* @__PURE__ */ React145.createElement(
|
|
11885
11830
|
"div",
|
|
11886
11831
|
{
|
|
11887
11832
|
style: {
|
|
@@ -11891,10 +11836,10 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11891
11836
|
marginBottom: "1rem"
|
|
11892
11837
|
}
|
|
11893
11838
|
},
|
|
11894
|
-
/* @__PURE__ */
|
|
11895
|
-
/* @__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 }))
|
|
11896
11841
|
),
|
|
11897
|
-
/* @__PURE__ */
|
|
11842
|
+
/* @__PURE__ */ React145.createElement(
|
|
11898
11843
|
"div",
|
|
11899
11844
|
{
|
|
11900
11845
|
style: {
|
|
@@ -11903,7 +11848,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11903
11848
|
position: "relative"
|
|
11904
11849
|
}
|
|
11905
11850
|
},
|
|
11906
|
-
/* @__PURE__ */
|
|
11851
|
+
/* @__PURE__ */ React145.createElement(
|
|
11907
11852
|
"div",
|
|
11908
11853
|
{
|
|
11909
11854
|
style: {
|
|
@@ -11921,9 +11866,9 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11921
11866
|
pointerEvents: viewMode === "list" ? "auto" : "none"
|
|
11922
11867
|
}
|
|
11923
11868
|
},
|
|
11924
|
-
/* @__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) }))))
|
|
11925
11870
|
),
|
|
11926
|
-
/* @__PURE__ */
|
|
11871
|
+
/* @__PURE__ */ React145.createElement(
|
|
11927
11872
|
"div",
|
|
11928
11873
|
{
|
|
11929
11874
|
style: {
|
|
@@ -11941,16 +11886,16 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
11941
11886
|
pointerEvents: viewMode === "survey" ? "auto" : "none"
|
|
11942
11887
|
}
|
|
11943
11888
|
},
|
|
11944
|
-
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")))
|
|
11945
11890
|
)
|
|
11946
11891
|
)
|
|
11947
11892
|
);
|
|
11948
11893
|
};
|
|
11949
11894
|
var ClaimListItem = ({ claim, onViewClaim }) => {
|
|
11950
11895
|
const handlers = useBlocknoteHandlers();
|
|
11951
|
-
const [userProfile, setUserProfile] =
|
|
11952
|
-
const [loadingProfile, setLoadingProfile] =
|
|
11953
|
-
|
|
11896
|
+
const [userProfile, setUserProfile] = useState45(null);
|
|
11897
|
+
const [loadingProfile, setLoadingProfile] = useState45(false);
|
|
11898
|
+
useEffect33(() => {
|
|
11954
11899
|
const fetchUserProfile = async () => {
|
|
11955
11900
|
if (!claim.agentDid) return;
|
|
11956
11901
|
try {
|
|
@@ -11993,7 +11938,7 @@ var ClaimListItem = ({ claim, onViewClaim }) => {
|
|
|
11993
11938
|
}
|
|
11994
11939
|
return { status: "Pending", color: "yellow" };
|
|
11995
11940
|
};
|
|
11996
|
-
const
|
|
11941
|
+
const formatDate2 = (dateString) => {
|
|
11997
11942
|
if (!dateString) return "N/A";
|
|
11998
11943
|
try {
|
|
11999
11944
|
return new Date(dateString).toLocaleDateString();
|
|
@@ -12003,7 +11948,7 @@ var ClaimListItem = ({ claim, onViewClaim }) => {
|
|
|
12003
11948
|
};
|
|
12004
11949
|
const claimStatus = getClaimStatus(claim);
|
|
12005
11950
|
const displayName = userProfile?.displayname || (claim.agentAddress ? `${claim.agentAddress.slice(0, 12)}...` : "Unknown");
|
|
12006
|
-
return /* @__PURE__ */
|
|
11951
|
+
return /* @__PURE__ */ React145.createElement(
|
|
12007
11952
|
"div",
|
|
12008
11953
|
{
|
|
12009
11954
|
onClick: onViewClaim,
|
|
@@ -12017,32 +11962,28 @@ var ClaimListItem = ({ claim, onViewClaim }) => {
|
|
|
12017
11962
|
tabIndex: 0,
|
|
12018
11963
|
style: { cursor: "pointer" }
|
|
12019
11964
|
},
|
|
12020
|
-
/* @__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 }))))
|
|
12021
11966
|
);
|
|
12022
11967
|
};
|
|
12023
11968
|
|
|
12024
11969
|
// src/mantine/blocks/evaluator/flow/ClaimCollectionsList.tsx
|
|
12025
|
-
import { IconArrowRight as
|
|
12026
|
-
var isClientFulfillmentError3 = (error) => {
|
|
12027
|
-
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
12028
|
-
return /client(?:.+)?(cannot|can't).+fulfil?/i.test(message);
|
|
12029
|
-
};
|
|
11970
|
+
import { IconArrowRight as IconArrowRight6 } from "@tabler/icons-react";
|
|
12030
11971
|
var CollectionItem3 = ({ collection, deedId, adminAddress, userRole, onRefresh }) => {
|
|
12031
11972
|
const { getCurrentUser } = useBlocknoteHandlers();
|
|
12032
|
-
const getCurrentUserRef =
|
|
12033
|
-
|
|
11973
|
+
const getCurrentUserRef = useRef7(getCurrentUser);
|
|
11974
|
+
useEffect34(() => {
|
|
12034
11975
|
getCurrentUserRef.current = getCurrentUser;
|
|
12035
11976
|
}, [getCurrentUser]);
|
|
12036
11977
|
const currentUser = getCurrentUserRef.current();
|
|
12037
|
-
const
|
|
11978
|
+
const getCollectionName2 = (collection2) => {
|
|
12038
11979
|
return collection2.protocol?.profile?.name || collection2.name || "Unnamed Collection";
|
|
12039
11980
|
};
|
|
12040
11981
|
const isEvaluator = userRole === "EA" /* Evaluator */;
|
|
12041
11982
|
const canEvaluateClaims = isEvaluator;
|
|
12042
11983
|
const claimsPanelId = `evaluator-claims-list-${collection.id}`;
|
|
12043
|
-
const collectionName =
|
|
12044
|
-
const claimsPanelContent =
|
|
12045
|
-
() => /* @__PURE__ */
|
|
11984
|
+
const collectionName = getCollectionName2(collection);
|
|
11985
|
+
const claimsPanelContent = useMemo38(
|
|
11986
|
+
() => /* @__PURE__ */ React146.createElement(
|
|
12046
11987
|
ClaimsList,
|
|
12047
11988
|
{
|
|
12048
11989
|
collectionId: collection.id,
|
|
@@ -12061,106 +12002,24 @@ var CollectionItem3 = ({ collection, deedId, adminAddress, userRole, onRefresh }
|
|
|
12061
12002
|
openClaimsPanel();
|
|
12062
12003
|
}
|
|
12063
12004
|
};
|
|
12064
|
-
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 })))));
|
|
12065
12006
|
};
|
|
12066
12007
|
var ClaimCollectionsList3 = ({ collections, deedId, adminAddress, userAddress, onRefresh }) => {
|
|
12067
|
-
const {
|
|
12068
|
-
const getUserRolesRef = useRef8(getUserRoles);
|
|
12069
|
-
useEffect33(() => {
|
|
12070
|
-
getUserRolesRef.current = getUserRoles;
|
|
12071
|
-
}, [getUserRoles]);
|
|
12072
|
-
const [userRoles, setUserRoles] = useState44({});
|
|
12073
|
-
const [loadingRoles, setLoadingRoles] = useState44(true);
|
|
12074
|
-
const failedRequestKeyRef = useRef8(null);
|
|
12075
|
-
const collectionIdsKey = useMemo34(
|
|
12076
|
-
() => collections.map((c) => c.id).sort().join("|"),
|
|
12077
|
-
[collections]
|
|
12078
|
-
);
|
|
12079
|
-
const requestKey = useMemo34(() => [userAddress, adminAddress, deedId, collectionIdsKey].filter(Boolean).join("|"), [userAddress, adminAddress, deedId, collectionIdsKey]);
|
|
12080
|
-
useEffect33(() => {
|
|
12081
|
-
let isMounted = true;
|
|
12082
|
-
const setEmptyRoles = () => {
|
|
12083
|
-
const rolesMap = {};
|
|
12084
|
-
collections.forEach((collection) => {
|
|
12085
|
-
rolesMap[collection.id] = null;
|
|
12086
|
-
});
|
|
12087
|
-
if (isMounted) {
|
|
12088
|
-
setUserRoles(rolesMap);
|
|
12089
|
-
}
|
|
12090
|
-
};
|
|
12091
|
-
const fetchUserRoles = async () => {
|
|
12092
|
-
if (!collections || collections.length === 0 || !userAddress || !adminAddress) {
|
|
12093
|
-
setLoadingRoles(false);
|
|
12094
|
-
return;
|
|
12095
|
-
}
|
|
12096
|
-
if (!requestKey || failedRequestKeyRef.current === requestKey) {
|
|
12097
|
-
setLoadingRoles(false);
|
|
12098
|
-
return;
|
|
12099
|
-
}
|
|
12100
|
-
const getUserRolesFn = getUserRolesRef.current;
|
|
12101
|
-
if (typeof getUserRolesFn !== "function") {
|
|
12102
|
-
setEmptyRoles();
|
|
12103
|
-
setLoadingRoles(false);
|
|
12104
|
-
return;
|
|
12105
|
-
}
|
|
12106
|
-
try {
|
|
12107
|
-
setLoadingRoles(true);
|
|
12108
|
-
const collectionIds = collections.map((c) => c.id);
|
|
12109
|
-
const roles = await getUserRolesFn({
|
|
12110
|
-
userAddress,
|
|
12111
|
-
adminAddress,
|
|
12112
|
-
deedDid: deedId,
|
|
12113
|
-
collectionIds
|
|
12114
|
-
});
|
|
12115
|
-
const rolesMap = {};
|
|
12116
|
-
collections.forEach((collection) => {
|
|
12117
|
-
const roleData = roles?.find((r) => r.collectionId === collection.id);
|
|
12118
|
-
rolesMap[collection.id] = roleData?.role || null;
|
|
12119
|
-
});
|
|
12120
|
-
setUserRoles(rolesMap);
|
|
12121
|
-
} catch (error) {
|
|
12122
|
-
if (isClientFulfillmentError3(error)) {
|
|
12123
|
-
failedRequestKeyRef.current = requestKey;
|
|
12124
|
-
} else {
|
|
12125
|
-
failedRequestKeyRef.current = null;
|
|
12126
|
-
}
|
|
12127
|
-
setEmptyRoles();
|
|
12128
|
-
} finally {
|
|
12129
|
-
if (isMounted) {
|
|
12130
|
-
setLoadingRoles(false);
|
|
12131
|
-
}
|
|
12132
|
-
}
|
|
12133
|
-
};
|
|
12134
|
-
fetchUserRoles();
|
|
12135
|
-
return () => {
|
|
12136
|
-
isMounted = false;
|
|
12137
|
-
};
|
|
12138
|
-
}, [collections, userAddress, adminAddress, deedId, requestKey]);
|
|
12008
|
+
const { userRoles, loading: loadingRoles } = useUserRoles(collections, userAddress, adminAddress, deedId);
|
|
12139
12009
|
if (!collections || collections.length === 0) {
|
|
12140
|
-
return /* @__PURE__ */
|
|
12010
|
+
return /* @__PURE__ */ React146.createElement(Text73, { size: "sm", c: "dimmed", ta: "center", py: "md" }, "No claim collections found");
|
|
12141
12011
|
}
|
|
12142
12012
|
if (loadingRoles) {
|
|
12143
|
-
return /* @__PURE__ */
|
|
12013
|
+
return /* @__PURE__ */ React146.createElement(Center9, { py: "md" }, /* @__PURE__ */ React146.createElement(Loader18, { size: "sm" }));
|
|
12144
12014
|
}
|
|
12145
|
-
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 })));
|
|
12146
12016
|
};
|
|
12147
12017
|
|
|
12148
12018
|
// src/mantine/blocks/evaluator/flow/FlowView.tsx
|
|
12149
12019
|
var EvaluatorFlowView = ({ editor, block }) => {
|
|
12150
12020
|
const { editable } = useBlocknoteContext();
|
|
12151
|
-
const
|
|
12152
|
-
const
|
|
12153
|
-
const getClaimCollectionsRef = useRef9(getClaimCollections);
|
|
12154
|
-
useEffect34(() => {
|
|
12155
|
-
getCurrentUserRef.current = getCurrentUser;
|
|
12156
|
-
getClaimCollectionsRef.current = getClaimCollections;
|
|
12157
|
-
}, [getCurrentUser, getClaimCollections]);
|
|
12158
|
-
const [collections, setCollections] = useState45([]);
|
|
12159
|
-
const [loading, setLoading] = useState45(false);
|
|
12160
|
-
const [error, setError] = useState45(null);
|
|
12161
|
-
const [userAddress, setUserAddress] = useState45("");
|
|
12162
|
-
const adminAddressUpdatedRef = useRef9(false);
|
|
12163
|
-
const selectedCollectionIds = useMemo35(() => {
|
|
12021
|
+
const userAddress = useCurrentUser();
|
|
12022
|
+
const selectedCollectionIds = useMemo39(() => {
|
|
12164
12023
|
try {
|
|
12165
12024
|
const parsed = JSON.parse(block.props.selectedCollections || "[]");
|
|
12166
12025
|
return Array.isArray(parsed) ? parsed : [];
|
|
@@ -12168,72 +12027,29 @@ var EvaluatorFlowView = ({ editor, block }) => {
|
|
|
12168
12027
|
return [];
|
|
12169
12028
|
}
|
|
12170
12029
|
}, [block.props.selectedCollections]);
|
|
12171
|
-
const selectedCollectionIdsStr = useMemo35(() => JSON.stringify([...selectedCollectionIds].sort()), [selectedCollectionIds]);
|
|
12172
12030
|
const did = block.props.deedDid;
|
|
12173
12031
|
const adminAddress = block.props.adminAddress || "";
|
|
12174
|
-
|
|
12175
|
-
try {
|
|
12176
|
-
const currentUser = getCurrentUserRef.current();
|
|
12177
|
-
setUserAddress(currentUser?.address || "");
|
|
12178
|
-
} catch (err) {
|
|
12179
|
-
setUserAddress("");
|
|
12180
|
-
}
|
|
12181
|
-
}, []);
|
|
12182
|
-
const fetchCollections = useCallback32(async () => {
|
|
12183
|
-
if (!did || selectedCollectionIds.length === 0) {
|
|
12184
|
-
setCollections([]);
|
|
12185
|
-
return;
|
|
12186
|
-
}
|
|
12187
|
-
if (loading) {
|
|
12188
|
-
return;
|
|
12189
|
-
}
|
|
12190
|
-
setLoading(true);
|
|
12191
|
-
setError(null);
|
|
12192
|
-
try {
|
|
12193
|
-
const response = await getClaimCollectionsRef.current({ deedDid: did });
|
|
12194
|
-
const { adminAddress: fetchedAdminAddress = "", collections: allCollections = [] } = response || {};
|
|
12195
|
-
const currentAdminAddress = block.props.adminAddress || "";
|
|
12196
|
-
if (fetchedAdminAddress && !currentAdminAddress && !adminAddressUpdatedRef.current) {
|
|
12197
|
-
adminAddressUpdatedRef.current = true;
|
|
12198
|
-
editor.updateBlock(block, {
|
|
12199
|
-
props: {
|
|
12200
|
-
...block.props,
|
|
12201
|
-
adminAddress: fetchedAdminAddress
|
|
12202
|
-
}
|
|
12203
|
-
});
|
|
12204
|
-
}
|
|
12205
|
-
const selectedCollections = Array.isArray(allCollections) ? allCollections.filter((c) => c && selectedCollectionIds.includes(c.id)) : [];
|
|
12206
|
-
setCollections(selectedCollections);
|
|
12207
|
-
} catch (err) {
|
|
12208
|
-
setError(err instanceof Error ? err.message : "Failed to fetch collections");
|
|
12209
|
-
setCollections([]);
|
|
12210
|
-
} finally {
|
|
12211
|
-
setLoading(false);
|
|
12212
|
-
}
|
|
12213
|
-
}, [did, selectedCollectionIdsStr]);
|
|
12214
|
-
useEffect34(() => {
|
|
12215
|
-
fetchCollections();
|
|
12216
|
-
}, [fetchCollections]);
|
|
12032
|
+
const { collections, loading, error, refetch } = useCollections(did, selectedCollectionIds, block, editor);
|
|
12217
12033
|
if (!did) {
|
|
12218
|
-
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"));
|
|
12219
12035
|
}
|
|
12220
12036
|
if (selectedCollectionIds.length === 0) {
|
|
12221
|
-
return /* @__PURE__ */
|
|
12037
|
+
return /* @__PURE__ */ React147.createElement(Center10, { py: "xl" }, /* @__PURE__ */ React147.createElement(Text74, { size: "sm", c: "dimmed" }, "No claim collections selected"));
|
|
12222
12038
|
}
|
|
12223
|
-
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 }));
|
|
12224
12040
|
};
|
|
12225
12041
|
|
|
12226
12042
|
// src/mantine/blocks/evaluator/EvaluatorBlock.tsx
|
|
12227
12043
|
function EvaluatorBlock({ editor, block }) {
|
|
12228
12044
|
const { docType } = useBlocknoteContext();
|
|
12229
12045
|
if (docType === "template") {
|
|
12230
|
-
return /* @__PURE__ */
|
|
12046
|
+
return /* @__PURE__ */ React148.createElement(EvaluatorTemplateView, { editor, block });
|
|
12231
12047
|
}
|
|
12232
|
-
return /* @__PURE__ */
|
|
12048
|
+
return /* @__PURE__ */ React148.createElement(EvaluatorFlowView, { editor, block });
|
|
12233
12049
|
}
|
|
12234
12050
|
|
|
12235
12051
|
// src/mantine/blocks/evaluator/EvaluatorBlockSpec.tsx
|
|
12236
|
-
import
|
|
12052
|
+
import React149 from "react";
|
|
12237
12053
|
import { createReactBlockSpec as createReactBlockSpec10 } from "@blocknote/react";
|
|
12238
12054
|
var EvaluatorBlockSpec = createReactBlockSpec10(
|
|
12239
12055
|
{
|
|
@@ -12251,18 +12067,18 @@ var EvaluatorBlockSpec = createReactBlockSpec10(
|
|
|
12251
12067
|
{
|
|
12252
12068
|
render: (props) => {
|
|
12253
12069
|
const ixoProps = props;
|
|
12254
|
-
return /* @__PURE__ */
|
|
12070
|
+
return /* @__PURE__ */ React149.createElement(EvaluatorBlock, { ...ixoProps });
|
|
12255
12071
|
}
|
|
12256
12072
|
}
|
|
12257
12073
|
);
|
|
12258
12074
|
|
|
12259
12075
|
// src/mantine/blocks/list/ui/ListBlocksToolbar.tsx
|
|
12260
|
-
import
|
|
12076
|
+
import React150 from "react";
|
|
12261
12077
|
import { ActionIcon as ActionIcon23, Group as Group44, Tooltip as Tooltip10 } from "@mantine/core";
|
|
12262
12078
|
import { IconChevronUp as IconChevronUp4, IconChevronDown as IconChevronDown6 } from "@tabler/icons-react";
|
|
12263
12079
|
var ListBlocksToolbar = () => {
|
|
12264
12080
|
const { broadcastCollapse } = useListBlocksUI();
|
|
12265
|
-
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 }))));
|
|
12266
12082
|
};
|
|
12267
12083
|
|
|
12268
12084
|
// src/mantine/blocks/registry/blockRegistry.ts
|
|
@@ -12418,10 +12234,10 @@ blockRegistry.register({
|
|
|
12418
12234
|
});
|
|
12419
12235
|
|
|
12420
12236
|
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
12421
|
-
import { useMemo as
|
|
12237
|
+
import { useMemo as useMemo40, useEffect as useEffect35, useState as useState46, useCallback as useCallback33 } from "react";
|
|
12422
12238
|
|
|
12423
12239
|
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
12424
|
-
import { useMemo as
|
|
12240
|
+
import { useMemo as useMemo41 } from "react";
|
|
12425
12241
|
|
|
12426
12242
|
// src/mantine/blocks/index.ts
|
|
12427
12243
|
var blockSpecs = {
|
|
@@ -12750,15 +12566,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
|
|
|
12750
12566
|
import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
|
|
12751
12567
|
|
|
12752
12568
|
// src/core/hooks/useMatrixProvider.ts
|
|
12753
|
-
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";
|
|
12754
12570
|
import { MatrixProvider } from "@ixo/matrix-crdt";
|
|
12755
12571
|
function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
12756
12572
|
const [matrixProvider, setProvider] = useState47(null);
|
|
12757
12573
|
const [status, setStatus] = useState47("disconnected");
|
|
12758
|
-
const isMountedRef =
|
|
12759
|
-
const providerRef =
|
|
12760
|
-
const retryTimeoutRef =
|
|
12761
|
-
const providerOptions =
|
|
12574
|
+
const isMountedRef = useRef8(true);
|
|
12575
|
+
const providerRef = useRef8(null);
|
|
12576
|
+
const retryTimeoutRef = useRef8(null);
|
|
12577
|
+
const providerOptions = useMemo42(
|
|
12762
12578
|
() => ({
|
|
12763
12579
|
translator: {
|
|
12764
12580
|
updateEventType: "matrix-crdt.doc_update",
|
|
@@ -12845,17 +12661,166 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
12845
12661
|
}
|
|
12846
12662
|
|
|
12847
12663
|
// src/mantine/hooks/useCollaborativeYDoc.ts
|
|
12848
|
-
import { useMemo as
|
|
12664
|
+
import { useMemo as useMemo43 } from "react";
|
|
12849
12665
|
import * as Y from "yjs";
|
|
12850
12666
|
function useCollaborativeYDoc(_options) {
|
|
12851
|
-
return
|
|
12667
|
+
return useMemo43(() => {
|
|
12852
12668
|
const doc = new Y.Doc();
|
|
12853
12669
|
return doc;
|
|
12854
12670
|
}, []);
|
|
12855
12671
|
}
|
|
12856
12672
|
|
|
12857
12673
|
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
12858
|
-
import { useMemo as
|
|
12674
|
+
import { useMemo as useMemo44, useEffect as useEffect37 } from "react";
|
|
12675
|
+
|
|
12676
|
+
// src/core/lib/matrixMetadata.ts
|
|
12677
|
+
var COVER_IMAGE_EVENT_TYPE = "ixo.page.cover_image";
|
|
12678
|
+
var COVER_ICON_EVENT_TYPE = "ixo.page.cover_icon";
|
|
12679
|
+
var MatrixMetadataManager = class {
|
|
12680
|
+
constructor(matrixClient, roomId) {
|
|
12681
|
+
this.subscribers = /* @__PURE__ */ new Set();
|
|
12682
|
+
this.eventHandler = null;
|
|
12683
|
+
this.matrixClient = matrixClient;
|
|
12684
|
+
this.roomId = roomId;
|
|
12685
|
+
this.setupEventListener();
|
|
12686
|
+
}
|
|
12687
|
+
/**
|
|
12688
|
+
* Set up Matrix event listener for real-time updates
|
|
12689
|
+
*/
|
|
12690
|
+
setupEventListener() {
|
|
12691
|
+
this.eventHandler = (event) => {
|
|
12692
|
+
if (event.getRoomId() === this.roomId) {
|
|
12693
|
+
const eventType = event.getType();
|
|
12694
|
+
if (eventType === COVER_IMAGE_EVENT_TYPE || eventType === COVER_ICON_EVENT_TYPE) {
|
|
12695
|
+
const metadata = this.getMetadata();
|
|
12696
|
+
if (metadata) {
|
|
12697
|
+
this.notifySubscribers(metadata);
|
|
12698
|
+
}
|
|
12699
|
+
}
|
|
12700
|
+
}
|
|
12701
|
+
};
|
|
12702
|
+
this.matrixClient.on("RoomState.events", this.eventHandler);
|
|
12703
|
+
}
|
|
12704
|
+
/**
|
|
12705
|
+
* Notify all subscribers of metadata changes
|
|
12706
|
+
*/
|
|
12707
|
+
notifySubscribers(metadata) {
|
|
12708
|
+
this.subscribers.forEach((callback) => {
|
|
12709
|
+
try {
|
|
12710
|
+
callback(metadata);
|
|
12711
|
+
} catch (error) {
|
|
12712
|
+
console.error("Error in metadata subscriber callback:", error);
|
|
12713
|
+
}
|
|
12714
|
+
});
|
|
12715
|
+
}
|
|
12716
|
+
/**
|
|
12717
|
+
* Send metadata to Matrix state events (separate events for cover and icon)
|
|
12718
|
+
*
|
|
12719
|
+
* @param metadata - The metadata to store (only URL strings)
|
|
12720
|
+
* @param permissions - Permission check object
|
|
12721
|
+
* @returns Promise that resolves when state events are sent
|
|
12722
|
+
*/
|
|
12723
|
+
async setMetadata(metadata, permissions) {
|
|
12724
|
+
if (!permissions.write) {
|
|
12725
|
+
console.warn("Cannot set metadata: write permission denied");
|
|
12726
|
+
return;
|
|
12727
|
+
}
|
|
12728
|
+
try {
|
|
12729
|
+
const promises = [];
|
|
12730
|
+
if (metadata.cover !== void 0) {
|
|
12731
|
+
promises.push(
|
|
12732
|
+
this.matrixClient.sendStateEvent(
|
|
12733
|
+
this.roomId,
|
|
12734
|
+
COVER_IMAGE_EVENT_TYPE,
|
|
12735
|
+
{ url: metadata.cover || null },
|
|
12736
|
+
// Wrap in object - Matrix requires JSON content
|
|
12737
|
+
""
|
|
12738
|
+
// Empty state key
|
|
12739
|
+
)
|
|
12740
|
+
);
|
|
12741
|
+
}
|
|
12742
|
+
if (metadata.icon !== void 0) {
|
|
12743
|
+
promises.push(
|
|
12744
|
+
this.matrixClient.sendStateEvent(
|
|
12745
|
+
this.roomId,
|
|
12746
|
+
COVER_ICON_EVENT_TYPE,
|
|
12747
|
+
{ url: metadata.icon || null },
|
|
12748
|
+
// Wrap in object - Matrix requires JSON content
|
|
12749
|
+
""
|
|
12750
|
+
// Empty state key
|
|
12751
|
+
)
|
|
12752
|
+
);
|
|
12753
|
+
}
|
|
12754
|
+
await Promise.all(promises);
|
|
12755
|
+
} catch (error) {
|
|
12756
|
+
console.error("Failed to set page metadata:", error);
|
|
12757
|
+
throw error;
|
|
12758
|
+
}
|
|
12759
|
+
}
|
|
12760
|
+
/**
|
|
12761
|
+
* Get current metadata from Matrix state (reads from separate events)
|
|
12762
|
+
*
|
|
12763
|
+
* @returns Current metadata or null if not set
|
|
12764
|
+
*/
|
|
12765
|
+
getMetadata() {
|
|
12766
|
+
try {
|
|
12767
|
+
const room = this.matrixClient.getRoom(this.roomId);
|
|
12768
|
+
if (!room) {
|
|
12769
|
+
console.warn(`Room ${this.roomId} not found`);
|
|
12770
|
+
return null;
|
|
12771
|
+
}
|
|
12772
|
+
const coverEvent = room.currentState.getStateEvents(
|
|
12773
|
+
COVER_IMAGE_EVENT_TYPE,
|
|
12774
|
+
""
|
|
12775
|
+
// Empty state key
|
|
12776
|
+
);
|
|
12777
|
+
const coverContent = coverEvent ? coverEvent.getContent() : null;
|
|
12778
|
+
const coverUrl = coverContent?.url || null;
|
|
12779
|
+
const iconEvent = room.currentState.getStateEvents(
|
|
12780
|
+
COVER_ICON_EVENT_TYPE,
|
|
12781
|
+
""
|
|
12782
|
+
// Empty state key
|
|
12783
|
+
);
|
|
12784
|
+
const iconContent = iconEvent ? iconEvent.getContent() : null;
|
|
12785
|
+
const iconUrl = iconContent?.url || null;
|
|
12786
|
+
if (!coverUrl && !iconUrl) {
|
|
12787
|
+
return null;
|
|
12788
|
+
}
|
|
12789
|
+
return {
|
|
12790
|
+
cover: coverUrl || void 0,
|
|
12791
|
+
icon: iconUrl || void 0
|
|
12792
|
+
};
|
|
12793
|
+
} catch (error) {
|
|
12794
|
+
console.error("Failed to get page metadata:", error);
|
|
12795
|
+
return null;
|
|
12796
|
+
}
|
|
12797
|
+
}
|
|
12798
|
+
/**
|
|
12799
|
+
* Subscribe to metadata changes
|
|
12800
|
+
*
|
|
12801
|
+
* @param callback - Function to call when metadata changes
|
|
12802
|
+
* @returns Unsubscribe function
|
|
12803
|
+
*/
|
|
12804
|
+
subscribe(callback) {
|
|
12805
|
+
this.subscribers.add(callback);
|
|
12806
|
+
return () => {
|
|
12807
|
+
this.subscribers.delete(callback);
|
|
12808
|
+
};
|
|
12809
|
+
}
|
|
12810
|
+
/**
|
|
12811
|
+
* Clean up event listeners and subscriptions
|
|
12812
|
+
* Call this when the manager is no longer needed
|
|
12813
|
+
*/
|
|
12814
|
+
dispose() {
|
|
12815
|
+
if (this.eventHandler) {
|
|
12816
|
+
this.matrixClient.off("RoomState.events", this.eventHandler);
|
|
12817
|
+
this.eventHandler = null;
|
|
12818
|
+
}
|
|
12819
|
+
this.subscribers.clear();
|
|
12820
|
+
}
|
|
12821
|
+
};
|
|
12822
|
+
|
|
12823
|
+
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
12859
12824
|
function useCreateCollaborativeIxoEditor(options) {
|
|
12860
12825
|
const yDoc = useCollaborativeYDoc(options);
|
|
12861
12826
|
const {
|
|
@@ -12874,7 +12839,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12874
12839
|
matrixClient,
|
|
12875
12840
|
permissions = { write: false }
|
|
12876
12841
|
} = options || {};
|
|
12877
|
-
const memoizedUser =
|
|
12842
|
+
const memoizedUser = useMemo44(
|
|
12878
12843
|
() => ({
|
|
12879
12844
|
id: user?.id || "",
|
|
12880
12845
|
name: user?.name || "",
|
|
@@ -12889,7 +12854,13 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12889
12854
|
matrixClient,
|
|
12890
12855
|
roomId: options.roomId
|
|
12891
12856
|
});
|
|
12892
|
-
const
|
|
12857
|
+
const metadataManager = useMemo44(() => new MatrixMetadataManager(matrixClient, options.roomId), [matrixClient, options.roomId]);
|
|
12858
|
+
useEffect37(() => {
|
|
12859
|
+
return () => {
|
|
12860
|
+
metadataManager.dispose();
|
|
12861
|
+
};
|
|
12862
|
+
}, [metadataManager]);
|
|
12863
|
+
const defaultUploadFile = useMemo44(
|
|
12893
12864
|
() => uploadFile || (async (file) => {
|
|
12894
12865
|
return new Promise((resolve, reject) => {
|
|
12895
12866
|
const reader = new FileReader();
|
|
@@ -12903,7 +12874,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12903
12874
|
}),
|
|
12904
12875
|
[uploadFile]
|
|
12905
12876
|
);
|
|
12906
|
-
const schema =
|
|
12877
|
+
const schema = useMemo44(
|
|
12907
12878
|
() => BlockNoteSchema2.create({
|
|
12908
12879
|
blockSpecs: {
|
|
12909
12880
|
...defaultBlockSpecs2,
|
|
@@ -12918,11 +12889,11 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12918
12889
|
}),
|
|
12919
12890
|
[]
|
|
12920
12891
|
);
|
|
12921
|
-
const root =
|
|
12922
|
-
const documentFragment =
|
|
12923
|
-
const flowArray =
|
|
12924
|
-
const userFragment =
|
|
12925
|
-
const collaborationConfig =
|
|
12892
|
+
const root = useMemo44(() => yDoc.getMap("root"), [yDoc]);
|
|
12893
|
+
const documentFragment = useMemo44(() => yDoc.getXmlFragment("document"), [yDoc]);
|
|
12894
|
+
const flowArray = useMemo44(() => yDoc.getArray("flow"), [yDoc]);
|
|
12895
|
+
const userFragment = useMemo44(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
|
|
12896
|
+
const collaborationConfig = useMemo44(
|
|
12926
12897
|
() => ({
|
|
12927
12898
|
provider: matrixProvider,
|
|
12928
12899
|
fragment: documentFragment,
|
|
@@ -12934,7 +12905,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12934
12905
|
}),
|
|
12935
12906
|
[matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
|
|
12936
12907
|
);
|
|
12937
|
-
const ixoConfig =
|
|
12908
|
+
const ixoConfig = useMemo44(
|
|
12938
12909
|
() => ({
|
|
12939
12910
|
theme,
|
|
12940
12911
|
editable,
|
|
@@ -12953,7 +12924,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
12953
12924
|
uploadFile: defaultUploadFile,
|
|
12954
12925
|
collaboration: collaborationConfig
|
|
12955
12926
|
});
|
|
12956
|
-
const titleText =
|
|
12927
|
+
const titleText = useMemo44(() => yDoc.getText("title"), [yDoc]);
|
|
12957
12928
|
let ixoEditor;
|
|
12958
12929
|
if (editor) {
|
|
12959
12930
|
ixoEditor = editor;
|
|
@@ -13000,31 +12971,43 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
13000
12971
|
ixoEditor.getFlow = () => {
|
|
13001
12972
|
return flowArray.toArray();
|
|
13002
12973
|
};
|
|
13003
|
-
ixoEditor.
|
|
12974
|
+
ixoEditor._metadataManager = metadataManager;
|
|
12975
|
+
ixoEditor.setPageMetadata = async (updates) => {
|
|
13004
12976
|
if (!permissions.write) {
|
|
12977
|
+
console.warn("Cannot set page metadata: write permission denied");
|
|
13005
12978
|
return;
|
|
13006
12979
|
}
|
|
13007
|
-
|
|
13008
|
-
|
|
13009
|
-
|
|
13010
|
-
|
|
12980
|
+
const current = metadataManager.getMetadata() || {};
|
|
12981
|
+
await metadataManager.setMetadata({ ...current, ...updates }, permissions);
|
|
12982
|
+
};
|
|
12983
|
+
ixoEditor.getPageMetadata = () => {
|
|
12984
|
+
return metadataManager.getMetadata();
|
|
12985
|
+
};
|
|
12986
|
+
ixoEditor.setCoverImage = (imageData) => {
|
|
12987
|
+
if (!permissions.write) {
|
|
12988
|
+
return;
|
|
13011
12989
|
}
|
|
12990
|
+
const current = metadataManager.getMetadata() || {};
|
|
12991
|
+
const coverUrl = imageData?.url;
|
|
12992
|
+
metadataManager.setMetadata({ ...current, cover: coverUrl }, permissions).catch((error) => {
|
|
12993
|
+
console.error("Failed to set cover image:", error);
|
|
12994
|
+
});
|
|
13012
12995
|
};
|
|
13013
12996
|
ixoEditor.getCoverImage = () => {
|
|
13014
|
-
return
|
|
12997
|
+
return void 0;
|
|
13015
12998
|
};
|
|
13016
12999
|
ixoEditor.setLogo = (imageData) => {
|
|
13017
13000
|
if (!permissions.write) {
|
|
13018
13001
|
return;
|
|
13019
13002
|
}
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
}
|
|
13023
|
-
|
|
13024
|
-
}
|
|
13003
|
+
const current = metadataManager.getMetadata() || {};
|
|
13004
|
+
const iconUrl = imageData?.url;
|
|
13005
|
+
metadataManager.setMetadata({ ...current, icon: iconUrl }, permissions).catch((error) => {
|
|
13006
|
+
console.error("Failed to set logo:", error);
|
|
13007
|
+
});
|
|
13025
13008
|
};
|
|
13026
13009
|
ixoEditor.getLogo = () => {
|
|
13027
|
-
return
|
|
13010
|
+
return void 0;
|
|
13028
13011
|
};
|
|
13029
13012
|
}
|
|
13030
13013
|
useEffect37(() => {
|
|
@@ -13064,36 +13047,29 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
13064
13047
|
}
|
|
13065
13048
|
|
|
13066
13049
|
// src/mantine/components/CoverImage.tsx
|
|
13067
|
-
import
|
|
13068
|
-
import { Box as
|
|
13050
|
+
import React151, { useState as useState48, useRef as useRef9, useEffect as useEffect38 } from "react";
|
|
13051
|
+
import { Box as Box24, Button as Button32, Group as Group45 } from "@mantine/core";
|
|
13069
13052
|
function CoverImage({ coverImageUrl, logoUrl }) {
|
|
13070
13053
|
const { editor, handlers, editable } = useBlocknoteContext();
|
|
13071
13054
|
const [isHovering, setIsHovering] = useState48(false);
|
|
13072
13055
|
const [isRepositioning, setIsRepositioning] = useState48(false);
|
|
13073
13056
|
const [coverPosition, setCoverPosition] = useState48(50);
|
|
13074
|
-
const coverFileInputRef =
|
|
13075
|
-
const logoFileInputRef =
|
|
13076
|
-
const [
|
|
13077
|
-
const [logoData, setLogoData] = useState48(() => editor?.getLogo?.());
|
|
13057
|
+
const coverFileInputRef = useRef9(null);
|
|
13058
|
+
const logoFileInputRef = useRef9(null);
|
|
13059
|
+
const [metadata, setMetadata] = useState48(() => editor?.getPageMetadata?.() || null);
|
|
13078
13060
|
useEffect38(() => {
|
|
13079
|
-
if (!editor?.
|
|
13061
|
+
if (!editor?._metadataManager) {
|
|
13080
13062
|
return;
|
|
13081
13063
|
}
|
|
13082
|
-
const
|
|
13083
|
-
|
|
13084
|
-
|
|
13085
|
-
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
};
|
|
13089
|
-
observer();
|
|
13090
|
-
root.observe(observer);
|
|
13091
|
-
return () => {
|
|
13092
|
-
root.unobserve(observer);
|
|
13093
|
-
};
|
|
13064
|
+
const initialMetadata = editor._metadataManager.getMetadata();
|
|
13065
|
+
setMetadata(initialMetadata);
|
|
13066
|
+
const unsubscribe = editor._metadataManager.subscribe((newMetadata) => {
|
|
13067
|
+
setMetadata(newMetadata);
|
|
13068
|
+
});
|
|
13069
|
+
return unsubscribe;
|
|
13094
13070
|
}, [editor]);
|
|
13095
|
-
const coverUrl =
|
|
13096
|
-
const logoSrc =
|
|
13071
|
+
const coverUrl = metadata?.cover || coverImageUrl;
|
|
13072
|
+
const logoSrc = metadata?.icon || logoUrl;
|
|
13097
13073
|
const hasCover = !!coverUrl;
|
|
13098
13074
|
const hasLogo = !!logoSrc;
|
|
13099
13075
|
const handleFileSelect = async (event, type) => {
|
|
@@ -13103,12 +13079,21 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13103
13079
|
}
|
|
13104
13080
|
try {
|
|
13105
13081
|
const uploadedData = await handlers.publicFileUpload(file);
|
|
13082
|
+
const imageUrl = uploadedData.url;
|
|
13083
|
+
setMetadata((prev) => ({
|
|
13084
|
+
...prev,
|
|
13085
|
+
[type === "cover" ? "cover" : "icon"]: imageUrl
|
|
13086
|
+
}));
|
|
13106
13087
|
if (type === "cover") {
|
|
13107
|
-
editor.
|
|
13088
|
+
await editor.setPageMetadata?.({ cover: imageUrl });
|
|
13108
13089
|
} else {
|
|
13109
|
-
editor.
|
|
13090
|
+
await editor.setPageMetadata?.({ icon: imageUrl });
|
|
13110
13091
|
}
|
|
13111
13092
|
} catch (error) {
|
|
13093
|
+
const currentMetadata = editor?.getPageMetadata?.();
|
|
13094
|
+
if (currentMetadata) {
|
|
13095
|
+
setMetadata(currentMetadata);
|
|
13096
|
+
}
|
|
13112
13097
|
}
|
|
13113
13098
|
};
|
|
13114
13099
|
const handleAddCover = () => {
|
|
@@ -13120,9 +13105,17 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13120
13105
|
const handleReposition = () => {
|
|
13121
13106
|
setIsRepositioning(!isRepositioning);
|
|
13122
13107
|
};
|
|
13123
|
-
const handleRemoveCover = () => {
|
|
13108
|
+
const handleRemoveCover = async () => {
|
|
13124
13109
|
if (!editor) return;
|
|
13125
|
-
|
|
13110
|
+
setMetadata((prev) => ({ ...prev, cover: void 0 }));
|
|
13111
|
+
try {
|
|
13112
|
+
await editor.setPageMetadata?.({ cover: void 0 });
|
|
13113
|
+
} catch (error) {
|
|
13114
|
+
const currentMetadata = editor?.getPageMetadata?.();
|
|
13115
|
+
if (currentMetadata) {
|
|
13116
|
+
setMetadata(currentMetadata);
|
|
13117
|
+
}
|
|
13118
|
+
}
|
|
13126
13119
|
};
|
|
13127
13120
|
const handleAddLogo = () => {
|
|
13128
13121
|
logoFileInputRef.current?.click();
|
|
@@ -13130,9 +13123,17 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13130
13123
|
const handleChangeLogo = () => {
|
|
13131
13124
|
logoFileInputRef.current?.click();
|
|
13132
13125
|
};
|
|
13133
|
-
const handleRemoveLogo = () => {
|
|
13126
|
+
const handleRemoveLogo = async () => {
|
|
13134
13127
|
if (!editor) return;
|
|
13135
|
-
|
|
13128
|
+
setMetadata((prev) => ({ ...prev, icon: void 0 }));
|
|
13129
|
+
try {
|
|
13130
|
+
await editor.setPageMetadata?.({ icon: void 0 });
|
|
13131
|
+
} catch (error) {
|
|
13132
|
+
const currentMetadata = editor?.getPageMetadata?.();
|
|
13133
|
+
if (currentMetadata) {
|
|
13134
|
+
setMetadata(currentMetadata);
|
|
13135
|
+
}
|
|
13136
|
+
}
|
|
13136
13137
|
};
|
|
13137
13138
|
const handleMouseMove = (e) => {
|
|
13138
13139
|
if (!isRepositioning) return;
|
|
@@ -13145,8 +13146,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13145
13146
|
return null;
|
|
13146
13147
|
}
|
|
13147
13148
|
if (!hasCover) {
|
|
13148
|
-
return /* @__PURE__ */
|
|
13149
|
-
|
|
13149
|
+
return /* @__PURE__ */ React151.createElement(
|
|
13150
|
+
Box24,
|
|
13150
13151
|
{
|
|
13151
13152
|
style: {
|
|
13152
13153
|
position: "relative",
|
|
@@ -13158,20 +13159,18 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13158
13159
|
onMouseEnter: () => editable && setIsHovering(true),
|
|
13159
13160
|
onMouseLeave: () => editable && setIsHovering(false)
|
|
13160
13161
|
},
|
|
13161
|
-
/* @__PURE__ */
|
|
13162
|
-
/* @__PURE__ */ React147.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }),
|
|
13163
|
-
editable && isHovering && !logoSrc && /* @__PURE__ */ React147.createElement(
|
|
13162
|
+
/* @__PURE__ */ React151.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "relative", height: "100%" } }, /* @__PURE__ */ React151.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }), /* @__PURE__ */ React151.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }), editable && isHovering && !logoSrc && /* @__PURE__ */ React151.createElement(
|
|
13164
13163
|
Group45,
|
|
13165
13164
|
{
|
|
13166
13165
|
gap: "xs",
|
|
13167
13166
|
style: {
|
|
13168
13167
|
position: "absolute",
|
|
13169
13168
|
top: "12px",
|
|
13170
|
-
left: "
|
|
13169
|
+
left: "0",
|
|
13171
13170
|
zIndex: 10
|
|
13172
13171
|
}
|
|
13173
13172
|
},
|
|
13174
|
-
/* @__PURE__ */
|
|
13173
|
+
/* @__PURE__ */ React151.createElement(
|
|
13175
13174
|
Button32,
|
|
13176
13175
|
{
|
|
13177
13176
|
variant: "filled",
|
|
@@ -13188,7 +13187,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13188
13187
|
},
|
|
13189
13188
|
"Add icon"
|
|
13190
13189
|
),
|
|
13191
|
-
/* @__PURE__ */
|
|
13190
|
+
/* @__PURE__ */ React151.createElement(
|
|
13192
13191
|
Button32,
|
|
13193
13192
|
{
|
|
13194
13193
|
variant: "filled",
|
|
@@ -13205,20 +13204,19 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13205
13204
|
},
|
|
13206
13205
|
"Add cover"
|
|
13207
13206
|
)
|
|
13208
|
-
),
|
|
13209
|
-
|
|
13210
|
-
Box23,
|
|
13207
|
+
), logoSrc && /* @__PURE__ */ React151.createElement(
|
|
13208
|
+
Box24,
|
|
13211
13209
|
{
|
|
13212
13210
|
style: {
|
|
13213
13211
|
position: "relative",
|
|
13214
|
-
insetInlineStart: "
|
|
13212
|
+
insetInlineStart: "0",
|
|
13215
13213
|
width: "120px",
|
|
13216
13214
|
height: "120px",
|
|
13217
13215
|
marginTop: "16px",
|
|
13218
13216
|
zIndex: 11
|
|
13219
13217
|
}
|
|
13220
13218
|
},
|
|
13221
|
-
/* @__PURE__ */
|
|
13219
|
+
/* @__PURE__ */ React151.createElement(
|
|
13222
13220
|
"img",
|
|
13223
13221
|
{
|
|
13224
13222
|
src: logoSrc,
|
|
@@ -13233,18 +13231,22 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13233
13231
|
}
|
|
13234
13232
|
}
|
|
13235
13233
|
),
|
|
13236
|
-
editable && isHovering && /* @__PURE__ */
|
|
13237
|
-
|
|
13234
|
+
editable && isHovering && /* @__PURE__ */ React151.createElement(
|
|
13235
|
+
"div",
|
|
13238
13236
|
{
|
|
13239
|
-
gap: "xs",
|
|
13240
13237
|
style: {
|
|
13241
13238
|
position: "absolute",
|
|
13242
|
-
|
|
13243
|
-
left: "
|
|
13244
|
-
|
|
13239
|
+
bottom: "-32px",
|
|
13240
|
+
left: "50%",
|
|
13241
|
+
transform: "translateX(-50%)",
|
|
13242
|
+
zIndex: 12,
|
|
13243
|
+
display: "flex",
|
|
13244
|
+
flexDirection: "row",
|
|
13245
|
+
gap: "4px",
|
|
13246
|
+
alignItems: "center"
|
|
13245
13247
|
}
|
|
13246
13248
|
},
|
|
13247
|
-
/* @__PURE__ */
|
|
13249
|
+
/* @__PURE__ */ React151.createElement(
|
|
13248
13250
|
Button32,
|
|
13249
13251
|
{
|
|
13250
13252
|
variant: "filled",
|
|
@@ -13261,7 +13263,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13261
13263
|
},
|
|
13262
13264
|
"Change"
|
|
13263
13265
|
),
|
|
13264
|
-
/* @__PURE__ */
|
|
13266
|
+
/* @__PURE__ */ React151.createElement(
|
|
13265
13267
|
Button32,
|
|
13266
13268
|
{
|
|
13267
13269
|
variant: "filled",
|
|
@@ -13277,13 +13279,30 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13277
13279
|
}
|
|
13278
13280
|
},
|
|
13279
13281
|
"Remove"
|
|
13282
|
+
),
|
|
13283
|
+
/* @__PURE__ */ React151.createElement(
|
|
13284
|
+
Button32,
|
|
13285
|
+
{
|
|
13286
|
+
variant: "filled",
|
|
13287
|
+
size: "xs",
|
|
13288
|
+
onClick: handleAddCover,
|
|
13289
|
+
style: {
|
|
13290
|
+
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
13291
|
+
color: "#37352f",
|
|
13292
|
+
fontSize: "12px",
|
|
13293
|
+
fontWeight: 500,
|
|
13294
|
+
padding: "4px 8px",
|
|
13295
|
+
height: "auto"
|
|
13296
|
+
}
|
|
13297
|
+
},
|
|
13298
|
+
"Add cover"
|
|
13280
13299
|
)
|
|
13281
13300
|
)
|
|
13282
|
-
)
|
|
13301
|
+
))
|
|
13283
13302
|
);
|
|
13284
13303
|
}
|
|
13285
|
-
return /* @__PURE__ */
|
|
13286
|
-
|
|
13304
|
+
return /* @__PURE__ */ React151.createElement(
|
|
13305
|
+
Box24,
|
|
13287
13306
|
{
|
|
13288
13307
|
style: {
|
|
13289
13308
|
position: "relative",
|
|
@@ -13303,7 +13322,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13303
13322
|
onMouseMove: handleMouseMove,
|
|
13304
13323
|
onClick: () => isRepositioning && setIsRepositioning(false)
|
|
13305
13324
|
},
|
|
13306
|
-
/* @__PURE__ */
|
|
13325
|
+
/* @__PURE__ */ React151.createElement(
|
|
13307
13326
|
"img",
|
|
13308
13327
|
{
|
|
13309
13328
|
src: coverUrl,
|
|
@@ -13321,7 +13340,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13321
13340
|
}
|
|
13322
13341
|
}
|
|
13323
13342
|
),
|
|
13324
|
-
editable && isHovering && /* @__PURE__ */
|
|
13343
|
+
editable && isHovering && /* @__PURE__ */ React151.createElement(
|
|
13325
13344
|
Group45,
|
|
13326
13345
|
{
|
|
13327
13346
|
gap: "xs",
|
|
@@ -13332,7 +13351,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13332
13351
|
zIndex: 10
|
|
13333
13352
|
}
|
|
13334
13353
|
},
|
|
13335
|
-
/* @__PURE__ */
|
|
13354
|
+
/* @__PURE__ */ React151.createElement(
|
|
13336
13355
|
Button32,
|
|
13337
13356
|
{
|
|
13338
13357
|
variant: "filled",
|
|
@@ -13349,7 +13368,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13349
13368
|
},
|
|
13350
13369
|
"Change cover"
|
|
13351
13370
|
),
|
|
13352
|
-
/* @__PURE__ */
|
|
13371
|
+
/* @__PURE__ */ React151.createElement(
|
|
13353
13372
|
Button32,
|
|
13354
13373
|
{
|
|
13355
13374
|
variant: "filled",
|
|
@@ -13366,7 +13385,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13366
13385
|
},
|
|
13367
13386
|
isRepositioning ? "Done" : "Reposition"
|
|
13368
13387
|
),
|
|
13369
|
-
/* @__PURE__ */
|
|
13388
|
+
/* @__PURE__ */ React151.createElement(
|
|
13370
13389
|
Button32,
|
|
13371
13390
|
{
|
|
13372
13391
|
variant: "filled",
|
|
@@ -13384,19 +13403,19 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13384
13403
|
"Remove"
|
|
13385
13404
|
)
|
|
13386
13405
|
),
|
|
13387
|
-
/* @__PURE__ */
|
|
13388
|
-
|
|
13406
|
+
/* @__PURE__ */ React151.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "absolute", bottom: 0, left: 0, right: 0, height: "70px" } }, /* @__PURE__ */ React151.createElement(
|
|
13407
|
+
Box24,
|
|
13389
13408
|
{
|
|
13390
13409
|
style: {
|
|
13391
13410
|
position: "absolute",
|
|
13392
13411
|
bottom: "4px",
|
|
13393
|
-
insetInlineStart: "
|
|
13412
|
+
insetInlineStart: "0",
|
|
13394
13413
|
width: "120px",
|
|
13395
13414
|
height: "120px",
|
|
13396
13415
|
zIndex: 11
|
|
13397
13416
|
}
|
|
13398
13417
|
},
|
|
13399
|
-
logoSrc && /* @__PURE__ */
|
|
13418
|
+
logoSrc && /* @__PURE__ */ React151.createElement(
|
|
13400
13419
|
"img",
|
|
13401
13420
|
{
|
|
13402
13421
|
src: logoSrc,
|
|
@@ -13411,9 +13430,9 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13411
13430
|
}
|
|
13412
13431
|
}
|
|
13413
13432
|
),
|
|
13414
|
-
editable && isHovering && /* @__PURE__ */
|
|
13433
|
+
editable && isHovering && /* @__PURE__ */ React151.createElement(React151.Fragment, null, logoSrc ? (
|
|
13415
13434
|
// Logo exists: Show Change/Remove buttons when hovering on cover
|
|
13416
|
-
/* @__PURE__ */
|
|
13435
|
+
/* @__PURE__ */ React151.createElement(
|
|
13417
13436
|
Group45,
|
|
13418
13437
|
{
|
|
13419
13438
|
gap: "xs",
|
|
@@ -13424,7 +13443,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13424
13443
|
zIndex: 12
|
|
13425
13444
|
}
|
|
13426
13445
|
},
|
|
13427
|
-
/* @__PURE__ */
|
|
13446
|
+
/* @__PURE__ */ React151.createElement(
|
|
13428
13447
|
Button32,
|
|
13429
13448
|
{
|
|
13430
13449
|
variant: "filled",
|
|
@@ -13441,7 +13460,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13441
13460
|
},
|
|
13442
13461
|
"Change"
|
|
13443
13462
|
),
|
|
13444
|
-
/* @__PURE__ */
|
|
13463
|
+
/* @__PURE__ */ React151.createElement(
|
|
13445
13464
|
Button32,
|
|
13446
13465
|
{
|
|
13447
13466
|
variant: "filled",
|
|
@@ -13461,7 +13480,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13461
13480
|
)
|
|
13462
13481
|
) : (
|
|
13463
13482
|
// No logo: Show "Add icon" button when hovering anywhere on cover
|
|
13464
|
-
/* @__PURE__ */
|
|
13483
|
+
/* @__PURE__ */ React151.createElement(
|
|
13465
13484
|
Button32,
|
|
13466
13485
|
{
|
|
13467
13486
|
variant: "filled",
|
|
@@ -13484,50 +13503,52 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13484
13503
|
"Add icon"
|
|
13485
13504
|
)
|
|
13486
13505
|
))
|
|
13487
|
-
),
|
|
13488
|
-
/* @__PURE__ */
|
|
13489
|
-
/* @__PURE__ */
|
|
13506
|
+
)),
|
|
13507
|
+
/* @__PURE__ */ React151.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
|
|
13508
|
+
/* @__PURE__ */ React151.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
|
|
13490
13509
|
);
|
|
13491
13510
|
}
|
|
13492
13511
|
|
|
13493
13512
|
// src/mantine/IxoEditor.tsx
|
|
13494
|
-
import
|
|
13513
|
+
import React153 from "react";
|
|
13495
13514
|
import { getDefaultReactSlashMenuItems, SuggestionMenuController } from "@blocknote/react";
|
|
13496
13515
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
13497
13516
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
13498
|
-
import { Flex as Flex25, MantineProvider, Text as
|
|
13517
|
+
import { Flex as Flex25, MantineProvider, Text as Text75 } from "@mantine/core";
|
|
13499
13518
|
|
|
13500
13519
|
// src/mantine/components/PanelContent.tsx
|
|
13501
|
-
import
|
|
13502
|
-
import { Box as
|
|
13520
|
+
import React152 from "react";
|
|
13521
|
+
import { Box as Box25 } from "@mantine/core";
|
|
13503
13522
|
var panelStyles = {
|
|
13504
13523
|
light: {
|
|
13505
13524
|
backgroundColor: "#ffffff",
|
|
13506
13525
|
// editor background
|
|
13507
13526
|
color: "#1a1a1a",
|
|
13508
13527
|
// main text color
|
|
13509
|
-
|
|
13510
|
-
// border
|
|
13511
|
-
|
|
13512
|
-
|
|
13528
|
+
borderLeft: "1px solid #e0e0e0",
|
|
13529
|
+
// left border only - seamless with editor
|
|
13530
|
+
borderTop: "none",
|
|
13531
|
+
borderRight: "none",
|
|
13532
|
+
borderBottom: "none"
|
|
13513
13533
|
},
|
|
13514
13534
|
dark: {
|
|
13515
13535
|
backgroundColor: "#1f1f1f",
|
|
13516
13536
|
// editor background
|
|
13517
13537
|
color: "#f0f0f0",
|
|
13518
13538
|
// main text color
|
|
13519
|
-
|
|
13520
|
-
// border
|
|
13521
|
-
|
|
13522
|
-
|
|
13539
|
+
borderLeft: "1px solid #3a3a3a",
|
|
13540
|
+
// left border only - seamless with editor
|
|
13541
|
+
borderTop: "none",
|
|
13542
|
+
borderRight: "none",
|
|
13543
|
+
borderBottom: "none"
|
|
13523
13544
|
}
|
|
13524
13545
|
};
|
|
13525
13546
|
function PanelContent({ theme }) {
|
|
13526
13547
|
const { activePanel, registeredPanels } = usePanelStore();
|
|
13527
13548
|
const isOpen = activePanel !== null;
|
|
13528
13549
|
const content = activePanel ? registeredPanels.get(activePanel) : null;
|
|
13529
|
-
return /* @__PURE__ */
|
|
13530
|
-
|
|
13550
|
+
return /* @__PURE__ */ React152.createElement(
|
|
13551
|
+
Box25,
|
|
13531
13552
|
{
|
|
13532
13553
|
pos: "sticky",
|
|
13533
13554
|
right: 0,
|
|
@@ -13558,34 +13579,47 @@ function IxoEditorContent({
|
|
|
13558
13579
|
coverImageUrl,
|
|
13559
13580
|
logoUrl
|
|
13560
13581
|
}) {
|
|
13561
|
-
|
|
13562
|
-
|
|
13582
|
+
const { activePanel } = usePanelStore();
|
|
13583
|
+
const isPanelOpen = activePanel !== null;
|
|
13584
|
+
return /* @__PURE__ */ React153.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React153.createElement(
|
|
13585
|
+
"div",
|
|
13563
13586
|
{
|
|
13564
|
-
editor
|
|
13565
|
-
|
|
13566
|
-
|
|
13567
|
-
|
|
13568
|
-
|
|
13569
|
-
linkToolbar: config.linkToolbar,
|
|
13570
|
-
filePanel: config.filePanel,
|
|
13571
|
-
tableHandles: config.tableHandles,
|
|
13572
|
-
theme: config.theme,
|
|
13573
|
-
onChange,
|
|
13574
|
-
onSelectionChange
|
|
13587
|
+
className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`,
|
|
13588
|
+
style: {
|
|
13589
|
+
width: isPanelVisible && isPanelOpen ? "50%" : "100%",
|
|
13590
|
+
transition: "width 0.2s ease"
|
|
13591
|
+
}
|
|
13575
13592
|
},
|
|
13576
|
-
|
|
13577
|
-
|
|
13593
|
+
/* @__PURE__ */ React153.createElement(CoverImage, { coverImageUrl, logoUrl }),
|
|
13594
|
+
/* @__PURE__ */ React153.createElement(
|
|
13595
|
+
BlockNoteView,
|
|
13578
13596
|
{
|
|
13579
|
-
|
|
13580
|
-
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13597
|
+
editor,
|
|
13598
|
+
editable: isEditable,
|
|
13599
|
+
sideMenu: config.sideMenu,
|
|
13600
|
+
slashMenu: false,
|
|
13601
|
+
formattingToolbar: config.formattingToolbar,
|
|
13602
|
+
linkToolbar: config.linkToolbar,
|
|
13603
|
+
filePanel: config.filePanel,
|
|
13604
|
+
tableHandles: config.tableHandles,
|
|
13605
|
+
theme: config.theme,
|
|
13606
|
+
onChange,
|
|
13607
|
+
onSelectionChange
|
|
13608
|
+
},
|
|
13609
|
+
config.slashMenu && /* @__PURE__ */ React153.createElement(
|
|
13610
|
+
SuggestionMenuController,
|
|
13611
|
+
{
|
|
13612
|
+
triggerCharacter: "/",
|
|
13613
|
+
getItems: async (query) => {
|
|
13614
|
+
const defaultItems = getDefaultReactSlashMenuItems(editor);
|
|
13615
|
+
const customItems = getExtraSlashMenuItems(editor);
|
|
13616
|
+
return filterSuggestionItems([...defaultItems, ...customItems], query);
|
|
13617
|
+
}
|
|
13584
13618
|
}
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
)
|
|
13619
|
+
),
|
|
13620
|
+
children
|
|
13621
|
+
)
|
|
13622
|
+
), isPanelVisible && /* @__PURE__ */ React153.createElement(PanelContent, { theme: config.theme }));
|
|
13589
13623
|
}
|
|
13590
13624
|
function IxoEditor({
|
|
13591
13625
|
editor,
|
|
@@ -13614,7 +13648,7 @@ function IxoEditor({
|
|
|
13614
13648
|
tableHandles: true
|
|
13615
13649
|
};
|
|
13616
13650
|
const isEditable = editable;
|
|
13617
|
-
const editorContent = /* @__PURE__ */
|
|
13651
|
+
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(
|
|
13618
13652
|
IxoEditorContent,
|
|
13619
13653
|
{
|
|
13620
13654
|
isPanelVisible,
|
|
@@ -13630,7 +13664,7 @@ function IxoEditor({
|
|
|
13630
13664
|
children
|
|
13631
13665
|
)));
|
|
13632
13666
|
if (mantineTheme) {
|
|
13633
|
-
return /* @__PURE__ */
|
|
13667
|
+
return /* @__PURE__ */ React153.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
|
|
13634
13668
|
}
|
|
13635
13669
|
return editorContent;
|
|
13636
13670
|
}
|
|
@@ -13717,4 +13751,4 @@ export {
|
|
|
13717
13751
|
ixoGraphQLClient,
|
|
13718
13752
|
getEntity
|
|
13719
13753
|
};
|
|
13720
|
-
//# sourceMappingURL=chunk-
|
|
13754
|
+
//# sourceMappingURL=chunk-5JO27QWP.mjs.map
|