@ixo/editor 3.0.0-beta.1 → 3.0.0-beta.3
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-3RGK4GAV.mjs → chunk-EE3V7B4I.mjs} +1190 -475
- package/dist/chunk-EE3V7B4I.mjs.map +1 -0
- package/dist/{graphql-client-B5TxlMUU.d.ts → graphql-client-C82HQLeC.d.ts} +7 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/mantine/index.d.ts +2 -2
- package/dist/mantine/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-3RGK4GAV.mjs.map +0 -1
|
@@ -756,15 +756,52 @@ registerAction({
|
|
|
756
756
|
});
|
|
757
757
|
|
|
758
758
|
// src/core/lib/actionRegistry/actions/humanForm.ts
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
defaultRequiresConfirmation: false,
|
|
763
|
-
requiredCapability: "flow/execute",
|
|
764
|
-
run: async (inputs) => {
|
|
765
|
-
return { output: { answers: inputs.answers } };
|
|
759
|
+
function normalizeAnswers(rawAnswers) {
|
|
760
|
+
if (rawAnswers == null) {
|
|
761
|
+
return {};
|
|
766
762
|
}
|
|
767
|
-
|
|
763
|
+
if (typeof rawAnswers === "string") {
|
|
764
|
+
try {
|
|
765
|
+
const parsed = JSON.parse(rawAnswers);
|
|
766
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
767
|
+
throw new Error();
|
|
768
|
+
}
|
|
769
|
+
return parsed;
|
|
770
|
+
} catch {
|
|
771
|
+
throw new Error("answers must be a valid JSON object");
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
if (typeof rawAnswers !== "object" || Array.isArray(rawAnswers)) {
|
|
775
|
+
throw new Error("answers must be an object");
|
|
776
|
+
}
|
|
777
|
+
return rawAnswers;
|
|
778
|
+
}
|
|
779
|
+
function registerFormSubmitAction(type) {
|
|
780
|
+
registerAction({
|
|
781
|
+
type,
|
|
782
|
+
sideEffect: true,
|
|
783
|
+
defaultRequiresConfirmation: false,
|
|
784
|
+
requiredCapability: "flow/execute",
|
|
785
|
+
outputSchema: [
|
|
786
|
+
{ path: "form.answers", displayName: "Form Answers JSON", type: "string", description: "JSON stringified form answers, matching form block runtime output." },
|
|
787
|
+
{ path: "answers", displayName: "Form Answers", type: "object", description: "Parsed form answers object for convenience." }
|
|
788
|
+
],
|
|
789
|
+
run: async (inputs) => {
|
|
790
|
+
const answers = normalizeAnswers(inputs.answers ?? inputs.form?.answers);
|
|
791
|
+
const answersJson = JSON.stringify(answers);
|
|
792
|
+
return {
|
|
793
|
+
output: {
|
|
794
|
+
form: {
|
|
795
|
+
answers: answersJson
|
|
796
|
+
},
|
|
797
|
+
answers
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
registerFormSubmitAction("form.submit");
|
|
804
|
+
registerFormSubmitAction("human.form.submit");
|
|
768
805
|
|
|
769
806
|
// src/core/lib/actionRegistry/actions/bid.ts
|
|
770
807
|
function normalizeBidRole(role) {
|
|
@@ -1030,6 +1067,10 @@ function normalizeDecision2(value) {
|
|
|
1030
1067
|
function toStatus(decision) {
|
|
1031
1068
|
return decision === "approve" ? 1 : 2;
|
|
1032
1069
|
}
|
|
1070
|
+
function isEvaluatorRole(role) {
|
|
1071
|
+
const normalized = String(role || "").trim().toLowerCase();
|
|
1072
|
+
return normalized === "ea" || normalized === "evaluation_agent";
|
|
1073
|
+
}
|
|
1033
1074
|
registerAction({
|
|
1034
1075
|
type: "evaluateClaim",
|
|
1035
1076
|
sideEffect: true,
|
|
@@ -1059,6 +1100,24 @@ registerAction({
|
|
|
1059
1100
|
if (!collectionId) throw new Error("collectionId is required");
|
|
1060
1101
|
if (!deedDid) throw new Error("deedDid is required");
|
|
1061
1102
|
if (!adminAddress) throw new Error("adminAddress is required");
|
|
1103
|
+
const handlers = ctx.handlers;
|
|
1104
|
+
const actorAddress = String(ctx.actorDid || service.getCurrentUser?.()?.address || "").trim();
|
|
1105
|
+
if (!actorAddress) {
|
|
1106
|
+
throw new Error("Unable to resolve actor address for evaluator authorization");
|
|
1107
|
+
}
|
|
1108
|
+
if (typeof handlers?.getUserRoles !== "function") {
|
|
1109
|
+
throw new Error("Evaluator authorization check unavailable (getUserRoles handler missing)");
|
|
1110
|
+
}
|
|
1111
|
+
const roles = await handlers.getUserRoles({
|
|
1112
|
+
userAddress: actorAddress,
|
|
1113
|
+
adminAddress,
|
|
1114
|
+
deedDid,
|
|
1115
|
+
collectionIds: [collectionId]
|
|
1116
|
+
});
|
|
1117
|
+
const roleForCollection = Array.isArray(roles) ? roles.find((r) => r?.collectionId === collectionId)?.role : void 0;
|
|
1118
|
+
if (!isEvaluatorRole(roleForCollection)) {
|
|
1119
|
+
throw new Error("Not authorized: evaluator role required to evaluate claims for this collection");
|
|
1120
|
+
}
|
|
1062
1121
|
let amount = inputs.amount;
|
|
1063
1122
|
if (typeof amount === "string" && amount.trim()) {
|
|
1064
1123
|
try {
|
|
@@ -1067,8 +1126,25 @@ registerAction({
|
|
|
1067
1126
|
throw new Error("amount must be valid JSON when provided as string");
|
|
1068
1127
|
}
|
|
1069
1128
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1129
|
+
const normalizeCoin = (coin) => {
|
|
1130
|
+
if (!coin || typeof coin !== "object" || Array.isArray(coin)) return null;
|
|
1131
|
+
const denom = String(coin.denom || "").trim();
|
|
1132
|
+
const tokenAmount = String(coin.amount || "").trim();
|
|
1133
|
+
if (!denom || !tokenAmount) return null;
|
|
1134
|
+
return { denom, amount: tokenAmount };
|
|
1135
|
+
};
|
|
1136
|
+
let normalizedAmounts;
|
|
1137
|
+
if (Array.isArray(amount)) {
|
|
1138
|
+
normalizedAmounts = amount.map(normalizeCoin).filter((coin) => !!coin);
|
|
1139
|
+
if (normalizedAmounts.length !== amount.length) {
|
|
1140
|
+
throw new Error("amount must contain valid coin objects with denom and amount");
|
|
1141
|
+
}
|
|
1142
|
+
} else if (amount != null) {
|
|
1143
|
+
const coin = normalizeCoin(amount);
|
|
1144
|
+
if (!coin) {
|
|
1145
|
+
throw new Error("amount must be a coin object or an array of coin objects");
|
|
1146
|
+
}
|
|
1147
|
+
normalizedAmounts = [coin];
|
|
1072
1148
|
}
|
|
1073
1149
|
let verificationProof = String(inputs.verificationProof || "").trim();
|
|
1074
1150
|
const shouldCreateUdid = Boolean(inputs.createUdid);
|
|
@@ -1108,7 +1184,7 @@ registerAction({
|
|
|
1108
1184
|
adminAddress,
|
|
1109
1185
|
status: toStatus(decision),
|
|
1110
1186
|
verificationProof,
|
|
1111
|
-
amount:
|
|
1187
|
+
amount: normalizedAmounts && normalizedAmounts.length > 0 ? normalizedAmounts.length === 1 ? normalizedAmounts[0] : normalizedAmounts : void 0
|
|
1112
1188
|
});
|
|
1113
1189
|
return {
|
|
1114
1190
|
output: {
|
|
@@ -7683,7 +7759,7 @@ var ClaimsListSheet = ({
|
|
|
7683
7759
|
setSurveyError(null);
|
|
7684
7760
|
fetchClaims();
|
|
7685
7761
|
};
|
|
7686
|
-
const
|
|
7762
|
+
const getClaimStatus2 = (paymentsStatus) => {
|
|
7687
7763
|
if (!paymentsStatus) {
|
|
7688
7764
|
return "pending";
|
|
7689
7765
|
}
|
|
@@ -7739,7 +7815,7 @@ var ClaimsListSheet = ({
|
|
|
7739
7815
|
}
|
|
7740
7816
|
},
|
|
7741
7817
|
/* @__PURE__ */ React63.createElement(Stack40, { gap: "md", h: "100%" }, /* @__PURE__ */ React63.createElement(BaseButton, { onClick: handleNewClaim, fullWidth: true }, "New Claim"), loading ? /* @__PURE__ */ React63.createElement(Stack40, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React63.createElement(Loader5, { size: "lg" }), /* @__PURE__ */ React63.createElement(Text39, { size: "sm", c: "dimmed" }, "Loading claims...")) : error ? /* @__PURE__ */ React63.createElement(Alert7, { color: "red", title: "Failed to load claims", icon: /* @__PURE__ */ React63.createElement(IconAlertCircle2, { size: 18 }) }, /* @__PURE__ */ React63.createElement(Text39, { size: "sm" }, error)) : claims.length === 0 ? /* @__PURE__ */ React63.createElement(Stack40, { align: "center", justify: "center", style: { flex: 1 } }, /* @__PURE__ */ React63.createElement(Text39, { size: "sm", c: "dimmed", ta: "center" }, 'No claims found. Click "New Claim" to submit your first claim.')) : /* @__PURE__ */ React63.createElement(Stack40, { gap: "xs" }, claims.map((claim) => {
|
|
7742
|
-
const status =
|
|
7818
|
+
const status = getClaimStatus2(claim.paymentsStatus);
|
|
7743
7819
|
return /* @__PURE__ */ React63.createElement(ListItemContainer, { key: claim.claimId, isChecked: false }, /* @__PURE__ */ React63.createElement(Stack40, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React63.createElement(Text39, { size: "sm", fw: 500 }, "Claim #", claim.claimId), /* @__PURE__ */ React63.createElement(Text39, { size: "xs", c: "dimmed" }, "Submitted: ", formatDate(claim.submissionDate))), /* @__PURE__ */ React63.createElement(Text39, { size: "xs", fw: 500, c: getStatusColor5(status) }, status.toUpperCase()));
|
|
7744
7820
|
})))
|
|
7745
7821
|
),
|
|
@@ -8166,7 +8242,7 @@ function useBidActions(bid, deedId, adminAddress, execution, onRefresh, executeH
|
|
|
8166
8242
|
var USDC_DENOM2 = "ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B";
|
|
8167
8243
|
var IXO_DENOM2 = "uixo";
|
|
8168
8244
|
var DECIMALS2 = 6;
|
|
8169
|
-
var
|
|
8245
|
+
var isEvaluatorRole2 = (role) => {
|
|
8170
8246
|
return role === "evaluation_agent" || role === "EA";
|
|
8171
8247
|
};
|
|
8172
8248
|
var BidViewPanel = ({ editor, block, bid, deedId, adminAddress, onRefresh, execution, executeHookedActions }) => {
|
|
@@ -8183,7 +8259,7 @@ var BidViewPanel = ({ editor, block, bid, deedId, adminAddress, onRefresh, execu
|
|
|
8183
8259
|
const [rejectReason, setRejectReason] = useState25("");
|
|
8184
8260
|
const [maxUsdcAmount, setMaxUsdcAmount] = useState25("");
|
|
8185
8261
|
const [maxIxoAmount, setMaxIxoAmount] = useState25("");
|
|
8186
|
-
const isEvaluator =
|
|
8262
|
+
const isEvaluator = isEvaluatorRole2(bid.role);
|
|
8187
8263
|
const buildMaxAmounts = () => {
|
|
8188
8264
|
if (!isEvaluator) return void 0;
|
|
8189
8265
|
const coins = [];
|
|
@@ -8707,6 +8783,89 @@ import { Group as Group21, Stack as Stack49, Text as Text49 } from "@mantine/cor
|
|
|
8707
8783
|
// src/mantine/blocks/evaluator/flow/ClaimsList.tsx
|
|
8708
8784
|
import React72, { useState as useState30, useEffect as useEffect27, useCallback as useCallback28, useMemo as useMemo31 } from "react";
|
|
8709
8785
|
import { Paper as Paper7, CloseButton as CloseButton2, Title as Title5, Loader as Loader11, Stack as Stack48, Text as Text48, ActionIcon as ActionIcon8, Alert as Alert11, Badge as Badge8, Group as Group20, Button as Button8, Divider as Divider7, Tabs, ScrollArea, Box as Box24, Select as Select3 } from "@mantine/core";
|
|
8786
|
+
|
|
8787
|
+
// src/mantine/utils/claimStatus.ts
|
|
8788
|
+
var STATUS_META = {
|
|
8789
|
+
pending: { label: "Pending", color: "yellow", isTerminal: false },
|
|
8790
|
+
approved: { label: "Approved", color: "green", isTerminal: true },
|
|
8791
|
+
rejected: { label: "Rejected", color: "red", isTerminal: true },
|
|
8792
|
+
disputed: { label: "Disputed", color: "orange", isTerminal: false },
|
|
8793
|
+
invalidated: { label: "Invalidated", color: "gray", isTerminal: true },
|
|
8794
|
+
unknown: { label: "Unknown", color: "gray", isTerminal: false }
|
|
8795
|
+
};
|
|
8796
|
+
function asStatusInfo(key) {
|
|
8797
|
+
return { key, ...STATUS_META[key] };
|
|
8798
|
+
}
|
|
8799
|
+
function parseEnumStatus(value) {
|
|
8800
|
+
const numeric = typeof value === "number" ? value : Number(value);
|
|
8801
|
+
if (!Number.isFinite(numeric)) return null;
|
|
8802
|
+
switch (numeric) {
|
|
8803
|
+
case 0:
|
|
8804
|
+
return "pending";
|
|
8805
|
+
case 1:
|
|
8806
|
+
return "approved";
|
|
8807
|
+
case 2:
|
|
8808
|
+
return "rejected";
|
|
8809
|
+
case 3:
|
|
8810
|
+
return "disputed";
|
|
8811
|
+
case 4:
|
|
8812
|
+
return "invalidated";
|
|
8813
|
+
case -1:
|
|
8814
|
+
return "unknown";
|
|
8815
|
+
default:
|
|
8816
|
+
return null;
|
|
8817
|
+
}
|
|
8818
|
+
}
|
|
8819
|
+
function parseStringStatus(value) {
|
|
8820
|
+
const normalized = String(value || "").trim().toLowerCase();
|
|
8821
|
+
switch (normalized) {
|
|
8822
|
+
case "pending":
|
|
8823
|
+
return "pending";
|
|
8824
|
+
case "approved":
|
|
8825
|
+
return "approved";
|
|
8826
|
+
case "rejected":
|
|
8827
|
+
return "rejected";
|
|
8828
|
+
case "disputed":
|
|
8829
|
+
return "disputed";
|
|
8830
|
+
case "invalidated":
|
|
8831
|
+
return "invalidated";
|
|
8832
|
+
case "unknown":
|
|
8833
|
+
return "unknown";
|
|
8834
|
+
default:
|
|
8835
|
+
return null;
|
|
8836
|
+
}
|
|
8837
|
+
}
|
|
8838
|
+
function getClaimStatusInfo(claim) {
|
|
8839
|
+
const evaluationStatusKey = parseEnumStatus(claim?.evaluationByClaimId?.status);
|
|
8840
|
+
if (evaluationStatusKey) {
|
|
8841
|
+
return asStatusInfo(evaluationStatusKey);
|
|
8842
|
+
}
|
|
8843
|
+
const directEnumStatusKey = parseEnumStatus(claim?.status);
|
|
8844
|
+
if (directEnumStatusKey) {
|
|
8845
|
+
return asStatusInfo(directEnumStatusKey);
|
|
8846
|
+
}
|
|
8847
|
+
const directStringStatusKey = parseStringStatus(claim?.status);
|
|
8848
|
+
if (directStringStatusKey) {
|
|
8849
|
+
return asStatusInfo(directStringStatusKey);
|
|
8850
|
+
}
|
|
8851
|
+
const paymentsStatus = claim?.paymentsStatus;
|
|
8852
|
+
if (paymentsStatus?.approval === "PAID") {
|
|
8853
|
+
return asStatusInfo("approved");
|
|
8854
|
+
}
|
|
8855
|
+
if (paymentsStatus?.rejection === "PAID") {
|
|
8856
|
+
return asStatusInfo("rejected");
|
|
8857
|
+
}
|
|
8858
|
+
if (paymentsStatus?.evaluation === "PAID" || paymentsStatus?.submission === "PAID") {
|
|
8859
|
+
return asStatusInfo("pending");
|
|
8860
|
+
}
|
|
8861
|
+
return asStatusInfo("pending");
|
|
8862
|
+
}
|
|
8863
|
+
function isClaimEvaluated(claim) {
|
|
8864
|
+
const status = getClaimStatusInfo(claim);
|
|
8865
|
+
return status.key === "approved" || status.key === "rejected" || status.key === "invalidated";
|
|
8866
|
+
}
|
|
8867
|
+
|
|
8868
|
+
// src/mantine/blocks/evaluator/flow/ClaimsList.tsx
|
|
8710
8869
|
import { IconAlertCircle as IconAlertCircle6, IconArrowRight as IconArrowRight2, IconRefresh, IconArrowLeft as IconArrowLeft3, IconFileText as IconFileText4, IconRobot as IconRobot3, IconChecklist as IconChecklist3 } from "@tabler/icons-react";
|
|
8711
8870
|
import { Survey as Survey5, SurveyModel as SurveyModel5 } from "@ixo/surveys";
|
|
8712
8871
|
|
|
@@ -9482,19 +9641,7 @@ var ClaimsList = ({ collectionId, collectionName, deedId, adminAddress, onEvalua
|
|
|
9482
9641
|
}, [selectedClaim, handlers, deedId, collectionId, adminAddress, evaluationResult, handleBackToList, onEvaluationComplete, editor, buildPaymentCoin]);
|
|
9483
9642
|
const isClaimAlreadyEvaluated = useMemo31(() => {
|
|
9484
9643
|
if (!selectedClaim) return false;
|
|
9485
|
-
|
|
9486
|
-
const status = String(selectedClaim.status).toLowerCase();
|
|
9487
|
-
if (status === "approved" || status === "rejected") {
|
|
9488
|
-
return true;
|
|
9489
|
-
}
|
|
9490
|
-
}
|
|
9491
|
-
if ("paymentsStatus" in selectedClaim && selectedClaim.paymentsStatus) {
|
|
9492
|
-
const paymentsStatus = selectedClaim.paymentsStatus;
|
|
9493
|
-
if (paymentsStatus.approval === "PAID" || paymentsStatus.rejection === "PAID") {
|
|
9494
|
-
return true;
|
|
9495
|
-
}
|
|
9496
|
-
}
|
|
9497
|
-
return false;
|
|
9644
|
+
return isClaimEvaluated(selectedClaim);
|
|
9498
9645
|
}, [selectedClaim]);
|
|
9499
9646
|
return /* @__PURE__ */ React72.createElement(
|
|
9500
9647
|
Paper7,
|
|
@@ -9615,35 +9762,7 @@ var ClaimListItem = ({ claim, onViewClaim }) => {
|
|
|
9615
9762
|
};
|
|
9616
9763
|
fetchUserProfile();
|
|
9617
9764
|
}, [claim.agentDid]);
|
|
9618
|
-
const
|
|
9619
|
-
if ("status" in claim2 && claim2.status) {
|
|
9620
|
-
const status = String(claim2.status).toLowerCase();
|
|
9621
|
-
switch (status) {
|
|
9622
|
-
case "approved":
|
|
9623
|
-
return { status: "Approved", color: "green" };
|
|
9624
|
-
case "rejected":
|
|
9625
|
-
return { status: "Rejected", color: "red" };
|
|
9626
|
-
case "pending":
|
|
9627
|
-
return { status: "Pending", color: "yellow" };
|
|
9628
|
-
default:
|
|
9629
|
-
return { status: "Unknown", color: "gray" };
|
|
9630
|
-
}
|
|
9631
|
-
}
|
|
9632
|
-
if ("paymentsStatus" in claim2 && claim2.paymentsStatus) {
|
|
9633
|
-
const paymentsStatus = claim2.paymentsStatus;
|
|
9634
|
-
if (paymentsStatus.approval === "PAID") {
|
|
9635
|
-
return { status: "Approved", color: "green" };
|
|
9636
|
-
}
|
|
9637
|
-
if (paymentsStatus.rejection === "PAID") {
|
|
9638
|
-
return { status: "Rejected", color: "red" };
|
|
9639
|
-
}
|
|
9640
|
-
if (paymentsStatus.evaluation === "PAID" || paymentsStatus.submission === "PAID") {
|
|
9641
|
-
return { status: "Pending", color: "yellow" };
|
|
9642
|
-
}
|
|
9643
|
-
}
|
|
9644
|
-
return { status: "Pending", color: "yellow" };
|
|
9645
|
-
};
|
|
9646
|
-
const claimStatus = getClaimStatus3(claim);
|
|
9765
|
+
const claimStatus = getClaimStatusInfo(claim);
|
|
9647
9766
|
const displayName = userProfile?.displayname || (claim.agentAddress ? `${claim.agentAddress.slice(0, 12)}...` : "Unknown");
|
|
9648
9767
|
return /* @__PURE__ */ React72.createElement(
|
|
9649
9768
|
"div",
|
|
@@ -9659,7 +9778,7 @@ var ClaimListItem = ({ claim, onViewClaim }) => {
|
|
|
9659
9778
|
tabIndex: 0,
|
|
9660
9779
|
style: { cursor: "pointer" }
|
|
9661
9780
|
},
|
|
9662
|
-
/* @__PURE__ */ React72.createElement(ListItemContainer, { isChecked: false }, /* @__PURE__ */ React72.createElement(Stack48, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React72.createElement(Text48, { size: "sm", fw: 500 }, "Claim #", claim.claimId), /* @__PURE__ */ React72.createElement(Text48, { size: "xs", c: "dimmed" }, "Submitted: ", formatDate(claim.submissionDate || claim.submittedAt)), claim.agentDid && /* @__PURE__ */ React72.createElement(Group20, { gap: 4 }, /* @__PURE__ */ React72.createElement(Text48, { size: "xs", c: "dimmed" }, "Agent: ", loadingProfile ? "Loading..." : displayName), userProfile?.verified && /* @__PURE__ */ React72.createElement(Text48, { size: "xs", c: "blue", fw: 600, title: "Verified user" }, "\u2713"))), /* @__PURE__ */ React72.createElement(Stack48, { gap: 4, align: "flex-end" }, /* @__PURE__ */ React72.createElement(Badge8, { color: claimStatus.color, size: "sm" }, claimStatus.
|
|
9781
|
+
/* @__PURE__ */ React72.createElement(ListItemContainer, { isChecked: false }, /* @__PURE__ */ React72.createElement(Stack48, { gap: 4, style: { flex: 1 } }, /* @__PURE__ */ React72.createElement(Text48, { size: "sm", fw: 500 }, "Claim #", claim.claimId), /* @__PURE__ */ React72.createElement(Text48, { size: "xs", c: "dimmed" }, "Submitted: ", formatDate(claim.submissionDate || claim.submittedAt)), claim.agentDid && /* @__PURE__ */ React72.createElement(Group20, { gap: 4 }, /* @__PURE__ */ React72.createElement(Text48, { size: "xs", c: "dimmed" }, "Agent: ", loadingProfile ? "Loading..." : displayName), userProfile?.verified && /* @__PURE__ */ React72.createElement(Text48, { size: "xs", c: "blue", fw: 600, title: "Verified user" }, "\u2713"))), /* @__PURE__ */ React72.createElement(Stack48, { gap: 4, align: "flex-end" }, /* @__PURE__ */ React72.createElement(Badge8, { color: claimStatus.color, size: "sm" }, claimStatus.label), /* @__PURE__ */ React72.createElement(ActionIcon8, { variant: "subtle", size: "sm" }, /* @__PURE__ */ React72.createElement(IconArrowRight2, { size: 16 }))))
|
|
9663
9782
|
);
|
|
9664
9783
|
};
|
|
9665
9784
|
|
|
@@ -24789,11 +24908,11 @@ var FlowLinkBlockSpec = createReactBlockSpec20(
|
|
|
24789
24908
|
);
|
|
24790
24909
|
|
|
24791
24910
|
// src/mantine/blocks/action/ActionBlockSpec.tsx
|
|
24792
|
-
import
|
|
24911
|
+
import React253 from "react";
|
|
24793
24912
|
import { createReactBlockSpec as createReactBlockSpec21 } from "@blocknote/react";
|
|
24794
24913
|
|
|
24795
24914
|
// src/mantine/blocks/action/ActionBlock.tsx
|
|
24796
|
-
import
|
|
24915
|
+
import React252 from "react";
|
|
24797
24916
|
|
|
24798
24917
|
// src/mantine/blocks/action/template/TemplateView.tsx
|
|
24799
24918
|
import React237, { useMemo as useMemo85 } from "react";
|
|
@@ -25064,7 +25183,7 @@ var ACTION_COMMITMENT_PANEL_ID = "action-template-commitment-panel";
|
|
|
25064
25183
|
var ActionTemplateView = ({ editor, block }) => {
|
|
25065
25184
|
const panelId = `${ACTION_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
25066
25185
|
const assignmentPanelId = `${ACTION_ASSIGNMENT_PANEL_ID}-${block.id}`;
|
|
25067
|
-
const { closePanel } = usePanelStore();
|
|
25186
|
+
const { closePanel, activePanel } = usePanelStore();
|
|
25068
25187
|
const panelContent = useMemo85(() => /* @__PURE__ */ React237.createElement(TemplateConfig17, { editor, block }), [editor, block]);
|
|
25069
25188
|
const assignmentPanelContent = useMemo85(
|
|
25070
25189
|
() => /* @__PURE__ */ React237.createElement(
|
|
@@ -25085,6 +25204,7 @@ var ActionTemplateView = ({ editor, block }) => {
|
|
|
25085
25204
|
[editor, block, closePanel]
|
|
25086
25205
|
);
|
|
25087
25206
|
const { open: openCommitment } = usePanel(commitmentPanelId, commitmentPanelContent);
|
|
25207
|
+
const isPanelOpenForBlock = activePanel === panelId || activePanel === assignmentPanelId || activePanel === commitmentPanelId;
|
|
25088
25208
|
const actionType = block.props.actionType || "";
|
|
25089
25209
|
const dueDate = block.props.ttlAbsoluteDueDate;
|
|
25090
25210
|
const dueDateDisplay = dueDate ? formatDate(dueDate) : "";
|
|
@@ -25095,8 +25215,10 @@ var ActionTemplateView = ({ editor, block }) => {
|
|
|
25095
25215
|
onClick: open,
|
|
25096
25216
|
style: {
|
|
25097
25217
|
padding: 20,
|
|
25098
|
-
borderColor: "var(--mantine-color-
|
|
25099
|
-
background: "rgba(255, 255, 255, 0.02)"
|
|
25218
|
+
borderColor: isPanelOpenForBlock ? "#2AEAB3" : "var(--mantine-color-neutralColor-6)",
|
|
25219
|
+
background: "rgba(255, 255, 255, 0.02)",
|
|
25220
|
+
boxShadow: "none",
|
|
25221
|
+
transition: "border-color 140ms ease"
|
|
25100
25222
|
}
|
|
25101
25223
|
},
|
|
25102
25224
|
/* @__PURE__ */ React237.createElement(Group85, { wrap: "nowrap", gap: 24, align: "center", style: { width: "100%" } }, /* @__PURE__ */ React237.createElement(Group85, { wrap: "nowrap", gap: 16, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React237.createElement(Box45, { style: { flexShrink: 0, width: 32, height: 32, display: "flex", alignItems: "center", justifyContent: "center" } }, getIcon("bolt", block.props.icon, "white", 24)), /* @__PURE__ */ React237.createElement(Stack155, { gap: 0, style: { flex: 1, minWidth: 0, overflow: "hidden" } }, /* @__PURE__ */ React237.createElement(Text132, { fw: 500, size: "md", c: "white", truncate: true, contentEditable: false, style: { letterSpacing: "0.16px", lineHeight: 1.5 } }, block.props.title || "Title of the action"), /* @__PURE__ */ React237.createElement(Text132, { size: "sm", c: "dimmed", truncate: true, contentEditable: false, style: { letterSpacing: "0.14px" } }, subtitle))), /* @__PURE__ */ React237.createElement(Stack155, { gap: 2, align: "flex-end", style: { flexShrink: 0, minWidth: 100 } }, /* @__PURE__ */ React237.createElement(Text132, { fw: 500, size: "md", c: "white", style: { letterSpacing: "0.16px", lineHeight: 1.5, textAlign: "right" } }, "Pending"), /* @__PURE__ */ React237.createElement(Group85, { gap: 4, justify: "flex-end" }, /* @__PURE__ */ React237.createElement(CommitmentDisplay, { block, onClick: openCommitment }), /* @__PURE__ */ React237.createElement(AssignmentDisplay, { onClick: openAssignment, block }))))
|
|
@@ -25107,6 +25229,14 @@ var ActionTemplateView = ({ editor, block }) => {
|
|
|
25107
25229
|
import React238, { useMemo as useMemo86, useState as useState88 } from "react";
|
|
25108
25230
|
import { Group as Group86, Stack as Stack156, Text as Text133, Button as Button40, Code as Code7, Loader as Loader34, Alert as Alert34, Box as Box46, Badge as Badge39, Divider as Divider22 } from "@mantine/core";
|
|
25109
25231
|
import { IconPlayerPlay as IconPlayerPlay2, IconAlertTriangle as IconAlertTriangle3, IconUser as IconUser14, IconBolt as IconBolt9 } from "@tabler/icons-react";
|
|
25232
|
+
|
|
25233
|
+
// src/mantine/blocks/action/alertStyles.ts
|
|
25234
|
+
var actionAlertStyles = {
|
|
25235
|
+
title: { color: "white" },
|
|
25236
|
+
message: { color: "white" }
|
|
25237
|
+
};
|
|
25238
|
+
|
|
25239
|
+
// src/mantine/blocks/action/flow/FlowView.tsx
|
|
25110
25240
|
var getStatusLabel4 = (runtimeState) => {
|
|
25111
25241
|
switch (runtimeState) {
|
|
25112
25242
|
case "running":
|
|
@@ -25135,7 +25265,7 @@ var ActionFlowView = ({ editor, block, isDisabled }) => {
|
|
|
25135
25265
|
const disabled = isDisabled?.isDisabled === "disable";
|
|
25136
25266
|
const [runtime] = useNodeRuntime(editor, block.id);
|
|
25137
25267
|
const panelId = `action-flow-panel-${block.id}`;
|
|
25138
|
-
const { closePanel } = usePanelStore();
|
|
25268
|
+
const { closePanel, activePanel } = usePanelStore();
|
|
25139
25269
|
const actionType = block.props.actionType || "";
|
|
25140
25270
|
const actionTypeUI = actionType ? getActionTypeUI(actionType) : void 0;
|
|
25141
25271
|
const FlowDetailComponent = actionTypeUI?.flowDetailComponent;
|
|
@@ -25178,14 +25308,17 @@ var ActionFlowView = ({ editor, block, isDisabled }) => {
|
|
|
25178
25308
|
[editor, block, closePanel]
|
|
25179
25309
|
);
|
|
25180
25310
|
const { open: openCommitment } = usePanel(commitmentPanelId, commitmentPanelContent);
|
|
25311
|
+
const isPanelOpenForBlock = activePanel === panelId || activePanel === commitmentPanelId;
|
|
25181
25312
|
return /* @__PURE__ */ React238.createElement(
|
|
25182
25313
|
BaseContainer,
|
|
25183
25314
|
{
|
|
25184
25315
|
onClick: open,
|
|
25185
25316
|
style: {
|
|
25186
25317
|
padding: 20,
|
|
25187
|
-
borderColor: "var(--mantine-color-
|
|
25188
|
-
background: "rgba(255, 255, 255, 0.02)"
|
|
25318
|
+
borderColor: isPanelOpenForBlock ? "#2AEAB3" : "var(--mantine-color-neutralColor-6)",
|
|
25319
|
+
background: "rgba(255, 255, 255, 0.02)",
|
|
25320
|
+
boxShadow: "none",
|
|
25321
|
+
transition: "border-color 140ms ease"
|
|
25189
25322
|
}
|
|
25190
25323
|
},
|
|
25191
25324
|
/* @__PURE__ */ React238.createElement(Group86, { wrap: "nowrap", gap: 24, align: "center", style: { width: "100%" } }, /* @__PURE__ */ React238.createElement(Group86, { wrap: "nowrap", gap: 16, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React238.createElement(Box46, { style: { flexShrink: 0, width: 32, height: 32, display: "flex", alignItems: "center", justifyContent: "center" } }, getIcon("bolt", block.props.icon, "white", 24)), /* @__PURE__ */ React238.createElement(Stack156, { gap: 0, style: { flex: 1, minWidth: 0, overflow: "hidden" } }, /* @__PURE__ */ React238.createElement(Text133, { fw: 500, size: "md", c: "white", truncate: true, contentEditable: false, style: { letterSpacing: "0.16px", lineHeight: 1.5 } }, block.props.title || "Title of the action"), /* @__PURE__ */ React238.createElement(Text133, { size: "sm", c: "dimmed", truncate: true, contentEditable: false, style: { letterSpacing: "0.14px" } }, dueDateDisplay || block.props.description || "Due Date"))), /* @__PURE__ */ React238.createElement(Stack156, { gap: 2, align: "flex-end", style: { flexShrink: 0, minWidth: 100 } }, /* @__PURE__ */ React238.createElement(Badge39, { size: "sm", variant: "light", color: getStatusColor4(runtimeState) }, statusLabel), /* @__PURE__ */ React238.createElement(Group86, { gap: 4, justify: "flex-end" }, /* @__PURE__ */ React238.createElement(CommitmentDisplay, { block, onClick: openCommitment }), /* @__PURE__ */ React238.createElement(AssignmentDisplay, { block, onClick: open }))))
|
|
@@ -25366,7 +25499,7 @@ function GenericFlowPanel({
|
|
|
25366
25499
|
disabled: isDisabled || isLoading || !actionType
|
|
25367
25500
|
},
|
|
25368
25501
|
isLoading ? "Running..." : "Execute"
|
|
25369
|
-
), isDisabled && disabledMessage && /* @__PURE__ */ React238.createElement(Text133, { size: "xs", c: "dimmed" }, disabledMessage), runtime.error && /* @__PURE__ */ React238.createElement(Alert34, { icon: /* @__PURE__ */ React238.createElement(IconAlertTriangle3, { size: 16 }), title: "Execution Error", color: "red" }, /* @__PURE__ */ React238.createElement(Text133, { size: "xs" }, runtime.error.message)), Object.keys(parsedInputs).length > 0 && /* @__PURE__ */ React238.createElement(React238.Fragment, null, /* @__PURE__ */ React238.createElement(Divider22, null), /* @__PURE__ */ React238.createElement(Stack156, { gap: "xs" }, /* @__PURE__ */ React238.createElement(Text133, { size: "xs", fw: 600, c: "dimmed" }, "Inputs"), /* @__PURE__ */ React238.createElement(Code7, { block: true, style: { fontSize: "11px" } }, JSON.stringify(parsedInputs, null, 2)))), outputJson && /* @__PURE__ */ React238.createElement(React238.Fragment, null, /* @__PURE__ */ React238.createElement(Divider22, null), /* @__PURE__ */ React238.createElement(Stack156, { gap: "xs" }, /* @__PURE__ */ React238.createElement(Text133, { size: "xs", fw: 600, c: "dimmed" }, "Output"), /* @__PURE__ */ React238.createElement(Code7, { block: true, style: { fontSize: "11px", maxHeight: "300px", overflow: "auto" } }, outputJson))));
|
|
25502
|
+
), isDisabled && disabledMessage && /* @__PURE__ */ React238.createElement(Text133, { size: "xs", c: "dimmed" }, disabledMessage), runtime.error && /* @__PURE__ */ React238.createElement(Alert34, { icon: /* @__PURE__ */ React238.createElement(IconAlertTriangle3, { size: 16 }), title: "Execution Error", color: "red", styles: actionAlertStyles }, /* @__PURE__ */ React238.createElement(Text133, { size: "xs" }, runtime.error.message)), Object.keys(parsedInputs).length > 0 && /* @__PURE__ */ React238.createElement(React238.Fragment, null, /* @__PURE__ */ React238.createElement(Divider22, null), /* @__PURE__ */ React238.createElement(Stack156, { gap: "xs" }, /* @__PURE__ */ React238.createElement(Text133, { size: "xs", fw: 600, c: "dimmed" }, "Inputs"), /* @__PURE__ */ React238.createElement(Code7, { block: true, style: { fontSize: "11px" } }, JSON.stringify(parsedInputs, null, 2)))), outputJson && /* @__PURE__ */ React238.createElement(React238.Fragment, null, /* @__PURE__ */ React238.createElement(Divider22, null), /* @__PURE__ */ React238.createElement(Stack156, { gap: "xs" }, /* @__PURE__ */ React238.createElement(Text133, { size: "xs", fw: 600, c: "dimmed" }, "Output"), /* @__PURE__ */ React238.createElement(Code7, { block: true, style: { fontSize: "11px", maxHeight: "300px", overflow: "auto" } }, outputJson))));
|
|
25370
25503
|
}
|
|
25371
25504
|
|
|
25372
25505
|
// src/mantine/blocks/action/actionTypes/httpRequest/HttpRequestConfig.tsx
|
|
@@ -25476,7 +25609,7 @@ var HttpRequestConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
25476
25609
|
currentBlockId: blockId,
|
|
25477
25610
|
size: "sm"
|
|
25478
25611
|
}
|
|
25479
|
-
), /* @__PURE__ */ React239.createElement(ActionIcon31, { color: "red", variant: "subtle", onClick: () => handleRemoveBodyField(index) }, /* @__PURE__ */ React239.createElement(IconTrash9, { size: 16 }))))))), /* @__PURE__ */ React239.createElement(Divider23, { variant: "dashed" }), /* @__PURE__ */ React239.createElement(Alert35, { icon: /* @__PURE__ */ React239.createElement(IconInfoCircle5, { size: 16 }), title: "Response Schema", color: "blue" }, /* @__PURE__ */ React239.createElement(Text134, { size: "xs" }, "Define the expected structure of your API response. This allows other blocks to reference specific fields from the response data using the DataInput component.")), /* @__PURE__ */ React239.createElement(Stack157, { gap: "xs" }, /* @__PURE__ */ React239.createElement(Text134, { size: "sm", fw: 600 }, "How it works"), /* @__PURE__ */ React239.createElement(Text134, { size: "xs", c: "dimmed" }, "1. Define response fields using dot notation (e.g., ", /* @__PURE__ */ React239.createElement(Code8, null, "customer.email"), ")"), /* @__PURE__ */ React239.createElement(Text134, { size: "xs", c: "dimmed" }, "2. Fields become available in DataInput selectors across other blocks"), /* @__PURE__ */ React239.createElement(Text134, { size: "xs", c: "dimmed" }, "3. Reference them like: ", /* @__PURE__ */ React239.createElement(Code8, null, `{{${blockId}.response.customer.email}}`))), /* @__PURE__ */ React239.createElement(Stack157, { gap: "xs" }, /* @__PURE__ */ React239.createElement(Group87, { justify: "space-between" }, /* @__PURE__ */ React239.createElement(Text134, { size: "sm", fw: 600 }, "Response Fields"), /* @__PURE__ */ React239.createElement(Button41, { size: "xs", variant: "light", leftSection: /* @__PURE__ */ React239.createElement(IconPlus9, { size: 14 }), onClick: handleAddSchemaField }, "Add Field")), schemaFields.length === 0 ? /* @__PURE__ */ React239.createElement(Code8, { p: "md" }, 'No response fields defined yet. Click "Add Field" to start defining your response structure.') : /* @__PURE__ */ React239.createElement(Stack157, { gap: "md" }, schemaFields.map((field, index) => /* @__PURE__ */ React239.createElement(Paper17, { key: index, p: "md", withBorder: true }, /* @__PURE__ */ React239.createElement(Stack157, { gap: "sm" }, /* @__PURE__ */ React239.createElement(Group87, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React239.createElement(Text134, { size: "sm", fw: 500 }, "Field ", index + 1), /* @__PURE__ */ React239.createElement(ActionIcon31, { color: "red", variant: "subtle", onClick: () => handleRemoveSchemaField(index) }, /* @__PURE__ */ React239.createElement(IconTrash9, { size: 16 }))), /* @__PURE__ */ React239.createElement(
|
|
25612
|
+
), /* @__PURE__ */ React239.createElement(ActionIcon31, { color: "red", variant: "subtle", onClick: () => handleRemoveBodyField(index) }, /* @__PURE__ */ React239.createElement(IconTrash9, { size: 16 }))))))), /* @__PURE__ */ React239.createElement(Divider23, { variant: "dashed" }), /* @__PURE__ */ React239.createElement(Alert35, { icon: /* @__PURE__ */ React239.createElement(IconInfoCircle5, { size: 16 }), title: "Response Schema", color: "blue", styles: actionAlertStyles }, /* @__PURE__ */ React239.createElement(Text134, { size: "xs" }, "Define the expected structure of your API response. This allows other blocks to reference specific fields from the response data using the DataInput component.")), /* @__PURE__ */ React239.createElement(Stack157, { gap: "xs" }, /* @__PURE__ */ React239.createElement(Text134, { size: "sm", fw: 600 }, "How it works"), /* @__PURE__ */ React239.createElement(Text134, { size: "xs", c: "dimmed" }, "1. Define response fields using dot notation (e.g., ", /* @__PURE__ */ React239.createElement(Code8, null, "customer.email"), ")"), /* @__PURE__ */ React239.createElement(Text134, { size: "xs", c: "dimmed" }, "2. Fields become available in DataInput selectors across other blocks"), /* @__PURE__ */ React239.createElement(Text134, { size: "xs", c: "dimmed" }, "3. Reference them like: ", /* @__PURE__ */ React239.createElement(Code8, null, `{{${blockId}.response.customer.email}}`))), /* @__PURE__ */ React239.createElement(Stack157, { gap: "xs" }, /* @__PURE__ */ React239.createElement(Group87, { justify: "space-between" }, /* @__PURE__ */ React239.createElement(Text134, { size: "sm", fw: 600 }, "Response Fields"), /* @__PURE__ */ React239.createElement(Button41, { size: "xs", variant: "light", leftSection: /* @__PURE__ */ React239.createElement(IconPlus9, { size: 14 }), onClick: handleAddSchemaField }, "Add Field")), schemaFields.length === 0 ? /* @__PURE__ */ React239.createElement(Code8, { p: "md" }, 'No response fields defined yet. Click "Add Field" to start defining your response structure.') : /* @__PURE__ */ React239.createElement(Stack157, { gap: "md" }, schemaFields.map((field, index) => /* @__PURE__ */ React239.createElement(Paper17, { key: index, p: "md", withBorder: true }, /* @__PURE__ */ React239.createElement(Stack157, { gap: "sm" }, /* @__PURE__ */ React239.createElement(Group87, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React239.createElement(Text134, { size: "sm", fw: 500 }, "Field ", index + 1), /* @__PURE__ */ React239.createElement(ActionIcon31, { color: "red", variant: "subtle", onClick: () => handleRemoveSchemaField(index) }, /* @__PURE__ */ React239.createElement(IconTrash9, { size: 16 }))), /* @__PURE__ */ React239.createElement(
|
|
25480
25613
|
BaseTextInput,
|
|
25481
25614
|
{
|
|
25482
25615
|
label: "Field Path",
|
|
@@ -25644,7 +25777,7 @@ var HttpRequestFlowDetail = ({ inputs, editor, runtime, updateRuntime, isDisable
|
|
|
25644
25777
|
disabled: isDisabled || isLoading || !endpoint
|
|
25645
25778
|
},
|
|
25646
25779
|
isLoading ? "Sending..." : "Execute"
|
|
25647
|
-
), /* @__PURE__ */ React240.createElement(ActionIcon32, { variant: "subtle", onClick: () => setShowDetails(!showDetails), disabled: !hasDetails }, showDetails ? /* @__PURE__ */ React240.createElement(IconChevronUp4, { size: 16 }) : /* @__PURE__ */ React240.createElement(IconChevronDown8, { size: 16 }))), /* @__PURE__ */ React240.createElement(Collapse7, { in: showDetails }, /* @__PURE__ */ React240.createElement(Stack158, { gap: "md" }, validationWarnings.length > 0 && /* @__PURE__ */ React240.createElement(Alert36, { icon: /* @__PURE__ */ React240.createElement(IconAlertTriangle4, { size: 16 }), title: "Schema Validation Warnings", color: "yellow" }, /* @__PURE__ */ React240.createElement(Stack158, { gap: "xs" }, /* @__PURE__ */ React240.createElement(Text135, { size: "xs" }, "The API response does not match the defined schema:"), validationWarnings.map((warning, index) => /* @__PURE__ */ React240.createElement(Text135, { key: index, size: "xs", c: "dimmed" }, "\u2022 ", warning)))), headers.length > 0 && /* @__PURE__ */ React240.createElement(Stack158, { gap: "xs" }, /* @__PURE__ */ React240.createElement(Text135, { size: "xs", fw: 600, c: "dimmed" }, "Headers:"), /* @__PURE__ */ React240.createElement(Code9, { block: true, style: { fontSize: "11px" } }, JSON.stringify(
|
|
25780
|
+
), /* @__PURE__ */ React240.createElement(ActionIcon32, { variant: "subtle", onClick: () => setShowDetails(!showDetails), disabled: !hasDetails }, showDetails ? /* @__PURE__ */ React240.createElement(IconChevronUp4, { size: 16 }) : /* @__PURE__ */ React240.createElement(IconChevronDown8, { size: 16 }))), /* @__PURE__ */ React240.createElement(Collapse7, { in: showDetails }, /* @__PURE__ */ React240.createElement(Stack158, { gap: "md" }, validationWarnings.length > 0 && /* @__PURE__ */ React240.createElement(Alert36, { icon: /* @__PURE__ */ React240.createElement(IconAlertTriangle4, { size: 16 }), title: "Schema Validation Warnings", color: "yellow", styles: actionAlertStyles }, /* @__PURE__ */ React240.createElement(Stack158, { gap: "xs" }, /* @__PURE__ */ React240.createElement(Text135, { size: "xs" }, "The API response does not match the defined schema:"), validationWarnings.map((warning, index) => /* @__PURE__ */ React240.createElement(Text135, { key: index, size: "xs", c: "dimmed" }, "\u2022 ", warning)))), headers.length > 0 && /* @__PURE__ */ React240.createElement(Stack158, { gap: "xs" }, /* @__PURE__ */ React240.createElement(Text135, { size: "xs", fw: 600, c: "dimmed" }, "Headers:"), /* @__PURE__ */ React240.createElement(Code9, { block: true, style: { fontSize: "11px" } }, JSON.stringify(
|
|
25648
25781
|
headers.reduce(
|
|
25649
25782
|
(acc, h) => {
|
|
25650
25783
|
if (h.key && h.value) acc[h.key] = h.value;
|
|
@@ -25664,7 +25797,7 @@ var HttpRequestFlowDetail = ({ inputs, editor, runtime, updateRuntime, isDisable
|
|
|
25664
25797
|
),
|
|
25665
25798
|
null,
|
|
25666
25799
|
2
|
|
25667
|
-
))), response && /* @__PURE__ */ React240.createElement(Stack158, { gap: "xs" }, /* @__PURE__ */ React240.createElement(Text135, { size: "xs", fw: 600, c: "dimmed" }, "Response:"), status === "error" ? /* @__PURE__ */ React240.createElement(Alert36, { color: "red", title: "Error", styles: { message: { fontSize: "11px" } } }, /* @__PURE__ */ React240.createElement(Code9, { block: true, style: { fontSize: "11px" } }, response)) : /* @__PURE__ */ React240.createElement(Code9, { block: true, style: { fontSize: "11px", maxHeight: "300px", overflow: "auto" } }, response)))));
|
|
25800
|
+
))), response && /* @__PURE__ */ React240.createElement(Stack158, { gap: "xs" }, /* @__PURE__ */ React240.createElement(Text135, { size: "xs", fw: 600, c: "dimmed" }, "Response:"), status === "error" ? /* @__PURE__ */ React240.createElement(Alert36, { color: "red", title: "Error", styles: { ...actionAlertStyles, message: { ...actionAlertStyles.message, fontSize: "11px" } } }, /* @__PURE__ */ React240.createElement(Code9, { block: true, style: { fontSize: "11px" } }, response)) : /* @__PURE__ */ React240.createElement(Code9, { block: true, style: { fontSize: "11px", maxHeight: "300px", overflow: "auto" } }, response)))));
|
|
25668
25801
|
};
|
|
25669
25802
|
|
|
25670
25803
|
// src/mantine/blocks/action/actionTypes/httpRequest/index.ts
|
|
@@ -25870,7 +26003,7 @@ var EmailSendConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
25870
26003
|
onChange: (e) => update({ subject: e.currentTarget.value }),
|
|
25871
26004
|
description: "Email subject line (optional \u2014 template may define its own)"
|
|
25872
26005
|
}
|
|
25873
|
-
), /* @__PURE__ */ React241.createElement(Divider24, { variant: "dashed" }), /* @__PURE__ */ React241.createElement(Stack159, { gap: "md" }, /* @__PURE__ */ React241.createElement(Text136, { size: "sm", fw: 600 }, "Template Variables"), !local.templateName ? /* @__PURE__ */ React241.createElement(Alert37, { color: "blue", icon: /* @__PURE__ */ React241.createElement(IconInfoCircle6, { size: 16 }) }, "Select a template above to see available variables.") : parsedExtractedVariables.length === 0 ? /* @__PURE__ */ React241.createElement(Alert37, { color: "green", icon: /* @__PURE__ */ React241.createElement(IconCheck16, { size: 16 }) }, "This template has no handlebars variables to configure.") : /* @__PURE__ */ React241.createElement(Stack159, { gap: "md" }, /* @__PURE__ */ React241.createElement(Group89, { justify: "space-between" }, /* @__PURE__ */ React241.createElement(Text136, { size: "xs", c: "dimmed" }, "Map template variables to block data or static values"), /* @__PURE__ */ React241.createElement(Badge41, { color: mappedCount === parsedExtractedVariables.length ? "green" : "orange" }, mappedCount, "/", parsedExtractedVariables.length, " mapped")), parsedExtractedVariables.map((variable) => /* @__PURE__ */ React241.createElement(
|
|
26006
|
+
), /* @__PURE__ */ React241.createElement(Divider24, { variant: "dashed" }), /* @__PURE__ */ React241.createElement(Stack159, { gap: "md" }, /* @__PURE__ */ React241.createElement(Text136, { size: "sm", fw: 600 }, "Template Variables"), !local.templateName ? /* @__PURE__ */ React241.createElement(Alert37, { color: "blue", icon: /* @__PURE__ */ React241.createElement(IconInfoCircle6, { size: 16 }), styles: actionAlertStyles }, "Select a template above to see available variables.") : parsedExtractedVariables.length === 0 ? /* @__PURE__ */ React241.createElement(Alert37, { color: "green", icon: /* @__PURE__ */ React241.createElement(IconCheck16, { size: 16 }), styles: actionAlertStyles }, "This template has no handlebars variables to configure.") : /* @__PURE__ */ React241.createElement(Stack159, { gap: "md" }, /* @__PURE__ */ React241.createElement(Group89, { justify: "space-between" }, /* @__PURE__ */ React241.createElement(Text136, { size: "xs", c: "dimmed" }, "Map template variables to block data or static values"), /* @__PURE__ */ React241.createElement(Badge41, { color: mappedCount === parsedExtractedVariables.length ? "green" : "orange" }, mappedCount, "/", parsedExtractedVariables.length, " mapped")), parsedExtractedVariables.map((variable) => /* @__PURE__ */ React241.createElement(
|
|
25874
26007
|
DataInput,
|
|
25875
26008
|
{
|
|
25876
26009
|
key: variable.name,
|
|
@@ -25979,7 +26112,7 @@ var BidConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
25979
26112
|
currentBlockId: blockId,
|
|
25980
26113
|
required: true
|
|
25981
26114
|
}
|
|
25982
|
-
), /* @__PURE__ */ React242.createElement(BaseButton, { onClick: fetchCollections, disabled: !local.deedDid.trim() || loadingCollections }, loadingCollections ? /* @__PURE__ */ React242.createElement(Loader37, { size: "xs", color: "white" }) : "Get Collections"), error && /* @__PURE__ */ React242.createElement(Alert38, { color: "red" }, error), collectionOptions.length > 0 && /* @__PURE__ */ React242.createElement(
|
|
26115
|
+
), /* @__PURE__ */ React242.createElement(BaseButton, { onClick: fetchCollections, disabled: !local.deedDid.trim() || loadingCollections }, loadingCollections ? /* @__PURE__ */ React242.createElement(Loader37, { size: "xs", color: "white" }) : "Get Collections"), error && /* @__PURE__ */ React242.createElement(Alert38, { color: "red", styles: actionAlertStyles }, error), collectionOptions.length > 0 && /* @__PURE__ */ React242.createElement(
|
|
25983
26116
|
BaseSelect,
|
|
25984
26117
|
{
|
|
25985
26118
|
label: "Claim Collection",
|
|
@@ -25990,7 +26123,7 @@ var BidConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
25990
26123
|
required: true,
|
|
25991
26124
|
searchable: true
|
|
25992
26125
|
}
|
|
25993
|
-
), /* @__PURE__ */ React242.createElement(Alert38, { icon: /* @__PURE__ */ React242.createElement(IconInfoCircle7, { size: 16 }), color: "blue", title: "Input format" }, /* @__PURE__ */ React242.createElement(Text137, { size: "xs" }, "Role selection and survey answers are collected from the user at flow runtime and are not stored in template configuration.")));
|
|
26126
|
+
), /* @__PURE__ */ React242.createElement(Alert38, { icon: /* @__PURE__ */ React242.createElement(IconInfoCircle7, { size: 16 }), color: "blue", title: "Input format", styles: actionAlertStyles }, /* @__PURE__ */ React242.createElement(Text137, { size: "xs" }, "Role selection and survey answers are collected from the user at flow runtime and are not stored in template configuration.")));
|
|
25994
26127
|
};
|
|
25995
26128
|
|
|
25996
26129
|
// src/mantine/blocks/action/actionTypes/bid/BidFlowDetail.tsx
|
|
@@ -26220,7 +26353,7 @@ var BidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled
|
|
|
26220
26353
|
surveyModel.onComplete.remove(handleSurveyComplete);
|
|
26221
26354
|
};
|
|
26222
26355
|
}, [surveyModel, handleSurveyComplete]);
|
|
26223
|
-
return /* @__PURE__ */ React243.createElement(Stack161, { gap: "md" }, /* @__PURE__ */ React243.createElement(Stack161, { gap: 2 }, /* @__PURE__ */ React243.createElement(Text138, { fw: 600 }, block?.props?.title || "Bid Action"), /* @__PURE__ */ React243.createElement(Text138, { size: "sm", c: "dimmed" }, block?.props?.description || "Submit a bid application.")), !deedDid || !collectionId ? /* @__PURE__ */ React243.createElement(Alert39, { color: "yellow" }, "Configure DID and claim collection in template mode before running this action.") : /* @__PURE__ */ React243.createElement(React243.Fragment, null, /* @__PURE__ */ React243.createElement(Text138, { size: "xs", c: "dimmed" }, "Collection: ", collectionId), statusLoading && /* @__PURE__ */ React243.createElement(Text138, { size: "xs", c: "dimmed" }, "Checking application state..."), isPending && /* @__PURE__ */ React243.createElement(Alert39, { color: "yellow", title: "Application Status" }, "Your application is pending review. Resubmission is disabled."), isApproved && /* @__PURE__ */ React243.createElement(Alert39, { color: "green", title: "Application Status" }, "Your application was approved. You already have the required role."), /* @__PURE__ */ React243.createElement(
|
|
26356
|
+
return /* @__PURE__ */ React243.createElement(Stack161, { gap: "md" }, /* @__PURE__ */ React243.createElement(Stack161, { gap: 2 }, /* @__PURE__ */ React243.createElement(Text138, { fw: 600 }, block?.props?.title || "Bid Action"), /* @__PURE__ */ React243.createElement(Text138, { size: "sm", c: "dimmed" }, block?.props?.description || "Submit a bid application.")), !deedDid || !collectionId ? /* @__PURE__ */ React243.createElement(Alert39, { color: "yellow", styles: actionAlertStyles }, "Configure DID and claim collection in template mode before running this action.") : /* @__PURE__ */ React243.createElement(React243.Fragment, null, /* @__PURE__ */ React243.createElement(Text138, { size: "xs", c: "dimmed" }, "Collection: ", collectionId), statusLoading && /* @__PURE__ */ React243.createElement(Text138, { size: "xs", c: "dimmed" }, "Checking application state..."), isPending && /* @__PURE__ */ React243.createElement(Alert39, { color: "yellow", title: "Application Status", styles: actionAlertStyles }, "Your application is pending review. Resubmission is disabled."), isApproved && /* @__PURE__ */ React243.createElement(Alert39, { color: "green", title: "Application Status", styles: actionAlertStyles }, "Your application was approved. You already have the required role."), /* @__PURE__ */ React243.createElement(
|
|
26224
26357
|
BaseSelect,
|
|
26225
26358
|
{
|
|
26226
26359
|
label: "Apply As",
|
|
@@ -26240,7 +26373,7 @@ var BidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled
|
|
|
26240
26373
|
disabled: isDisabled || loadingSurvey || submitting || statusLoading || !canSubmit
|
|
26241
26374
|
},
|
|
26242
26375
|
loadingSurvey ? "Loading Survey..." : "Start Bid Survey"
|
|
26243
|
-
)), error && /* @__PURE__ */ React243.createElement(Alert39, { color: "red" }, error), runtime.error?.message && /* @__PURE__ */ React243.createElement(Alert39, { color: "red" }, runtime.error.message), submitting && /* @__PURE__ */ React243.createElement(Text138, { size: "xs", c: "dimmed" }, "Submitting bid..."), surveyModel && !loadingSurvey && canSubmit && /* @__PURE__ */ React243.createElement(Survey9, { model: surveyModel }));
|
|
26376
|
+
)), error && /* @__PURE__ */ React243.createElement(Alert39, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && /* @__PURE__ */ React243.createElement(Alert39, { color: "red", styles: actionAlertStyles }, runtime.error.message), submitting && /* @__PURE__ */ React243.createElement(Text138, { size: "xs", c: "dimmed" }, "Submitting bid..."), surveyModel && !loadingSurvey && canSubmit && /* @__PURE__ */ React243.createElement(Survey9, { model: surveyModel }));
|
|
26244
26377
|
};
|
|
26245
26378
|
|
|
26246
26379
|
// src/mantine/blocks/action/actionTypes/bid/index.ts
|
|
@@ -26337,7 +26470,7 @@ var EvaluateBidConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26337
26470
|
currentBlockId: blockId,
|
|
26338
26471
|
required: true
|
|
26339
26472
|
}
|
|
26340
|
-
), /* @__PURE__ */ React244.createElement(BaseButton, { onClick: fetchCollections, disabled: !local.deedDid.trim() || loadingCollections }, loadingCollections ? /* @__PURE__ */ React244.createElement(Loader39, { size: "xs", color: "white" }) : "Get Collections"), error && /* @__PURE__ */ React244.createElement(Alert40, { color: "red" }, error), collectionOptions.length > 0 && /* @__PURE__ */ React244.createElement(
|
|
26473
|
+
), /* @__PURE__ */ React244.createElement(BaseButton, { onClick: fetchCollections, disabled: !local.deedDid.trim() || loadingCollections }, loadingCollections ? /* @__PURE__ */ React244.createElement(Loader39, { size: "xs", color: "white" }) : "Get Collections"), error && /* @__PURE__ */ React244.createElement(Alert40, { color: "red", styles: actionAlertStyles }, error), collectionOptions.length > 0 && /* @__PURE__ */ React244.createElement(
|
|
26341
26474
|
BaseSelect,
|
|
26342
26475
|
{
|
|
26343
26476
|
label: "Claim Collection",
|
|
@@ -26357,6 +26490,13 @@ import { ActionIcon as ActionIcon33, Alert as Alert41, Badge as Badge42, Box as
|
|
|
26357
26490
|
import { IconArrowLeft as IconArrowLeft6, IconCheck as IconCheck17, IconChevronDown as IconChevronDown9, IconChevronRight as IconChevronRight11, IconFilter, IconThumbDown, IconThumbUp as IconThumbUp2 } from "@tabler/icons-react";
|
|
26358
26491
|
var USDC_DENOM4 = "ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B";
|
|
26359
26492
|
var IXO_DENOM4 = "uixo";
|
|
26493
|
+
var CUSTOM_DENOM = "__custom__";
|
|
26494
|
+
var createPaymentRow = () => ({
|
|
26495
|
+
id: `payment-${Math.random().toString(36).slice(2, 9)}`,
|
|
26496
|
+
denom: IXO_DENOM4,
|
|
26497
|
+
customDenom: "",
|
|
26498
|
+
amount: ""
|
|
26499
|
+
});
|
|
26360
26500
|
function getTimeAgo(dateString) {
|
|
26361
26501
|
if (!dateString) return "";
|
|
26362
26502
|
try {
|
|
@@ -26427,14 +26567,13 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26427
26567
|
const [submitting, setSubmitting] = useState95(false);
|
|
26428
26568
|
const [error, setError] = useState95(null);
|
|
26429
26569
|
const [rejectReason, setRejectReason] = useState95("");
|
|
26430
|
-
const [maxAmounts, setMaxAmounts] = useState95("[]");
|
|
26431
26570
|
const [adminAddress, setAdminAddress] = useState95("");
|
|
26432
|
-
const [activeFilter, setActiveFilter] = useState95("
|
|
26571
|
+
const [activeFilter, setActiveFilter] = useState95("pending");
|
|
26433
26572
|
const [detailsOpen, setDetailsOpen] = useState95(false);
|
|
26434
26573
|
const [inputsOpen, setInputsOpen] = useState95(false);
|
|
26435
26574
|
const [evaluationOpen, setEvaluationOpen] = useState95(true);
|
|
26436
|
-
const [
|
|
26437
|
-
const [
|
|
26575
|
+
const [paymentRows, setPaymentRows] = useState95([createPaymentRow()]);
|
|
26576
|
+
const [profilesByDid, setProfilesByDid] = useState95({});
|
|
26438
26577
|
const selectedBid = useMemo92(() => bids.find((bid) => bid.id === selectedBidId) || null, [bids, selectedBidId]);
|
|
26439
26578
|
const filteredBids = useMemo92(() => {
|
|
26440
26579
|
if (activeFilter === "all") return bids;
|
|
@@ -26471,8 +26610,7 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26471
26610
|
}, [deedDid, collectionId]);
|
|
26472
26611
|
useEffect77(() => {
|
|
26473
26612
|
setRejectReason("");
|
|
26474
|
-
|
|
26475
|
-
setPaymentAmount("");
|
|
26613
|
+
setPaymentRows([createPaymentRow()]);
|
|
26476
26614
|
setEvaluationOpen(true);
|
|
26477
26615
|
setDetailsOpen(false);
|
|
26478
26616
|
setInputsOpen(false);
|
|
@@ -26481,6 +26619,58 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26481
26619
|
if (!deedDid || !collectionId) return;
|
|
26482
26620
|
refreshBids();
|
|
26483
26621
|
}, [deedDid, collectionId, refreshBids]);
|
|
26622
|
+
useEffect77(() => {
|
|
26623
|
+
let mounted = true;
|
|
26624
|
+
const dids = Array.from(new Set(bids.map((bid) => bid.did).filter(Boolean)));
|
|
26625
|
+
const missing = dids.filter((did) => !profilesByDid[did]);
|
|
26626
|
+
if (missing.length === 0)
|
|
26627
|
+
return () => {
|
|
26628
|
+
mounted = false;
|
|
26629
|
+
};
|
|
26630
|
+
const loadProfiles = async () => {
|
|
26631
|
+
const results = await Promise.all(
|
|
26632
|
+
missing.map(async (did) => {
|
|
26633
|
+
try {
|
|
26634
|
+
const profile = await handlers.getMatrixInfoPerDid(did);
|
|
26635
|
+
return [did, profile];
|
|
26636
|
+
} catch {
|
|
26637
|
+
return [did, null];
|
|
26638
|
+
}
|
|
26639
|
+
})
|
|
26640
|
+
);
|
|
26641
|
+
if (!mounted) return;
|
|
26642
|
+
setProfilesByDid((prev) => {
|
|
26643
|
+
const next = { ...prev };
|
|
26644
|
+
results.forEach(([did, profile]) => {
|
|
26645
|
+
if (profile) {
|
|
26646
|
+
next[did] = profile;
|
|
26647
|
+
}
|
|
26648
|
+
});
|
|
26649
|
+
return next;
|
|
26650
|
+
});
|
|
26651
|
+
};
|
|
26652
|
+
loadProfiles();
|
|
26653
|
+
return () => {
|
|
26654
|
+
mounted = false;
|
|
26655
|
+
};
|
|
26656
|
+
}, [bids, handlers, profilesByDid]);
|
|
26657
|
+
const addPaymentRow = useCallback77(() => {
|
|
26658
|
+
setPaymentRows((prev) => [...prev, createPaymentRow()]);
|
|
26659
|
+
}, []);
|
|
26660
|
+
const removePaymentRow = useCallback77((id) => {
|
|
26661
|
+
setPaymentRows((prev) => prev.length === 1 ? prev : prev.filter((row) => row.id !== id));
|
|
26662
|
+
}, []);
|
|
26663
|
+
const updatePaymentRow = useCallback77((id, patch) => {
|
|
26664
|
+
setPaymentRows((prev) => prev.map((row) => row.id === id ? { ...row, ...patch } : row));
|
|
26665
|
+
}, []);
|
|
26666
|
+
const buildMaxAmounts = useCallback77(() => {
|
|
26667
|
+
return paymentRows.map((row) => {
|
|
26668
|
+
const denom = row.denom === CUSTOM_DENOM ? row.customDenom.trim() : row.denom || "";
|
|
26669
|
+
const amount = Number(row.amount);
|
|
26670
|
+
if (!denom || !Number.isFinite(amount) || amount <= 0) return null;
|
|
26671
|
+
return { denom, amount: String(row.amount) };
|
|
26672
|
+
}).filter((entry) => !!entry);
|
|
26673
|
+
}, [paymentRows]);
|
|
26484
26674
|
const executeEvaluation = useCallback77(
|
|
26485
26675
|
async (decision) => {
|
|
26486
26676
|
if (!selectedBid) {
|
|
@@ -26491,7 +26681,9 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26491
26681
|
setError("Admin address could not be resolved for this collection");
|
|
26492
26682
|
return;
|
|
26493
26683
|
}
|
|
26494
|
-
|
|
26684
|
+
const selectedRole = String(selectedBid.role || "").toLowerCase();
|
|
26685
|
+
const selectedBidIsEvaluator = selectedRole === "evaluation_agent" || selectedRole === "ea";
|
|
26686
|
+
if (decision === "reject" && selectedBidIsEvaluator && !rejectReason.trim()) {
|
|
26495
26687
|
setError("Rejection reason is required");
|
|
26496
26688
|
return;
|
|
26497
26689
|
}
|
|
@@ -26526,8 +26718,8 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26526
26718
|
applicantDid: selectedBid.did,
|
|
26527
26719
|
applicantAddress: selectedBid.address,
|
|
26528
26720
|
adminAddress,
|
|
26529
|
-
maxAmounts,
|
|
26530
|
-
reason: decision === "reject" ? rejectReason : ""
|
|
26721
|
+
maxAmounts: selectedBidIsEvaluator ? JSON.stringify(buildMaxAmounts()) : "[]",
|
|
26722
|
+
reason: decision === "reject" ? selectedBidIsEvaluator ? rejectReason : rejectReason.trim() || "Rejected" : ""
|
|
26531
26723
|
},
|
|
26532
26724
|
{
|
|
26533
26725
|
actorDid,
|
|
@@ -26590,7 +26782,7 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26590
26782
|
editor,
|
|
26591
26783
|
collectionId,
|
|
26592
26784
|
deedDid,
|
|
26593
|
-
|
|
26785
|
+
buildMaxAmounts,
|
|
26594
26786
|
updateRuntime,
|
|
26595
26787
|
refreshBids
|
|
26596
26788
|
]
|
|
@@ -26599,6 +26791,9 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26599
26791
|
const bidStatus = getBidStatus(selectedBid);
|
|
26600
26792
|
const bidRole = String(selectedBid.role || "").toLowerCase();
|
|
26601
26793
|
const bidIsEvaluator = bidRole === "evaluation_agent" || bidRole === "ea";
|
|
26794
|
+
const selectedBidProfile = profilesByDid[selectedBid.did];
|
|
26795
|
+
const selectedDisplayName = selectedBidProfile?.displayname || selectedBid.did || selectedBid.address;
|
|
26796
|
+
const selectedAvatarLabel = (selectedBidProfile?.displayname || selectedBid.did || selectedBid.address || "?")[0]?.toUpperCase();
|
|
26602
26797
|
let bidData = null;
|
|
26603
26798
|
try {
|
|
26604
26799
|
bidData = typeof selectedBid.data === "string" ? JSON.parse(selectedBid.data) : selectedBid.data;
|
|
@@ -26618,11 +26813,14 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26618
26813
|
flexShrink: 0,
|
|
26619
26814
|
fontSize: 16,
|
|
26620
26815
|
fontWeight: 500,
|
|
26621
|
-
color: "#adb5bd"
|
|
26816
|
+
color: "#adb5bd",
|
|
26817
|
+
backgroundImage: selectedBidProfile?.avatarUrl ? `url(${selectedBidProfile.avatarUrl})` : void 0,
|
|
26818
|
+
backgroundSize: "cover",
|
|
26819
|
+
backgroundPosition: "center"
|
|
26622
26820
|
}
|
|
26623
26821
|
},
|
|
26624
|
-
|
|
26625
|
-
), /* @__PURE__ */ React245.createElement(Stack163, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React245.createElement(Text139, { fw: 500, size: "md", truncate: true },
|
|
26822
|
+
selectedBidProfile?.avatarUrl ? null : selectedAvatarLabel
|
|
26823
|
+
), /* @__PURE__ */ React245.createElement(Stack163, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React245.createElement(Text139, { fw: 500, size: "md", truncate: true }, selectedDisplayName), /* @__PURE__ */ React245.createElement(Text139, { size: "xs", c: "dimmed", truncate: true }, truncateAddress(selectedBid.address))), /* @__PURE__ */ React245.createElement(Stack163, { gap: 0, align: "flex-end", style: { flexShrink: 0 } }, /* @__PURE__ */ React245.createElement(Text139, { fw: 500, size: "md", c: bidStatus.color === "green" ? "green" : bidStatus.color === "red" ? "red" : void 0 }, bidStatus.color === "green" && /* @__PURE__ */ React245.createElement(IconCheck17, { size: 14, style: { verticalAlign: "middle", marginRight: 4 } }), bidStatus.label), /* @__PURE__ */ React245.createElement(Text139, { size: "xs", c: "dimmed" }, getTimeAgo(selectedBid.created || "")))), /* @__PURE__ */ React245.createElement(
|
|
26626
26824
|
Box47,
|
|
26627
26825
|
{
|
|
26628
26826
|
p: "sm",
|
|
@@ -26644,7 +26842,7 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26644
26842
|
},
|
|
26645
26843
|
/* @__PURE__ */ React245.createElement(UnstyledButton2, { onClick: () => setInputsOpen((v) => !v), style: { width: "100%" } }, /* @__PURE__ */ React245.createElement(Group90, { gap: "xs", align: "center" }, inputsOpen ? /* @__PURE__ */ React245.createElement(IconChevronDown9, { size: 16 }) : /* @__PURE__ */ React245.createElement(IconChevronRight11, { size: 16 }), /* @__PURE__ */ React245.createElement(Text139, { fw: 500, size: "sm" }, "Inputs"))),
|
|
26646
26844
|
/* @__PURE__ */ React245.createElement(Collapse8, { in: inputsOpen }, /* @__PURE__ */ React245.createElement(Stack163, { gap: "xs", mt: "sm" }, bidData && typeof bidData === "object" ? Object.entries(bidData).map(([key, value]) => /* @__PURE__ */ React245.createElement(Group90, { key, justify: "space-between" }, /* @__PURE__ */ React245.createElement(Text139, { size: "xs", c: "dimmed" }, key), /* @__PURE__ */ React245.createElement(Text139, { size: "xs", style: { maxWidth: "60%", wordBreak: "break-all", textAlign: "right" } }, typeof value === "string" ? value : JSON.stringify(value)))) : /* @__PURE__ */ React245.createElement(Text139, { size: "xs", c: "dimmed" }, "No input data available.")))
|
|
26647
|
-
), /* @__PURE__ */ React245.createElement(
|
|
26845
|
+
), bidIsEvaluator && /* @__PURE__ */ React245.createElement(
|
|
26648
26846
|
Box47,
|
|
26649
26847
|
{
|
|
26650
26848
|
p: "sm",
|
|
@@ -26663,28 +26861,37 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26663
26861
|
minRows: 2,
|
|
26664
26862
|
disabled: isDisabled || submitting
|
|
26665
26863
|
}
|
|
26666
|
-
)),
|
|
26667
|
-
BaseTextArea,
|
|
26668
|
-
{
|
|
26669
|
-
placeholder: 'e.g. [{"denom":"uixo","amount":"1000"}]',
|
|
26670
|
-
value: maxAmounts,
|
|
26671
|
-
onChange: (event) => setMaxAmounts(event.currentTarget.value),
|
|
26672
|
-
minRows: 2,
|
|
26673
|
-
disabled: isDisabled || submitting
|
|
26674
|
-
}
|
|
26675
|
-
)), /* @__PURE__ */ React245.createElement(Divider25, { color: "rgba(255,255,255,0.06)" }), /* @__PURE__ */ React245.createElement(Text139, { size: "xs", c: "dimmed" }, "Payment"), /* @__PURE__ */ React245.createElement(Group90, { justify: "space-between", align: "center" }, /* @__PURE__ */ React245.createElement(Text139, { size: "sm" }, "Token"), /* @__PURE__ */ React245.createElement(
|
|
26864
|
+
)), /* @__PURE__ */ React245.createElement(Divider25, { color: "rgba(255,255,255,0.06)" }), /* @__PURE__ */ React245.createElement(Text139, { size: "xs", c: "dimmed" }, "Payment (used as evaluator max amount)"), paymentRows.map((row, index) => /* @__PURE__ */ React245.createElement(Stack163, { key: row.id, gap: 8 }, /* @__PURE__ */ React245.createElement(Group90, { justify: "space-between", align: "center" }, /* @__PURE__ */ React245.createElement(Text139, { size: "sm" }, "Token ", index + 1), /* @__PURE__ */ React245.createElement(Group90, { gap: "xs" }, paymentRows.length > 1 && /* @__PURE__ */ React245.createElement(Button44, { variant: "subtle", size: "compact-xs", color: "red", onClick: () => removePaymentRow(row.id), disabled: isDisabled || submitting }, "Remove"))), /* @__PURE__ */ React245.createElement(
|
|
26676
26865
|
BaseSelect,
|
|
26677
26866
|
{
|
|
26678
|
-
value:
|
|
26679
|
-
onChange:
|
|
26867
|
+
value: row.denom,
|
|
26868
|
+
onChange: (value) => updatePaymentRow(row.id, { denom: value }),
|
|
26680
26869
|
data: [
|
|
26681
26870
|
{ value: IXO_DENOM4, label: "IXO" },
|
|
26682
|
-
{ value: USDC_DENOM4, label: "USDC" }
|
|
26871
|
+
{ value: USDC_DENOM4, label: "USDC" },
|
|
26872
|
+
{ value: CUSTOM_DENOM, label: "Custom" }
|
|
26683
26873
|
],
|
|
26684
26874
|
clearable: false,
|
|
26685
|
-
|
|
26875
|
+
disabled: isDisabled || submitting
|
|
26686
26876
|
}
|
|
26687
|
-
)
|
|
26877
|
+
), row.denom === CUSTOM_DENOM && /* @__PURE__ */ React245.createElement(
|
|
26878
|
+
BaseTextInput,
|
|
26879
|
+
{
|
|
26880
|
+
placeholder: "Custom denom (e.g. ibc/... or uixo)",
|
|
26881
|
+
value: row.customDenom,
|
|
26882
|
+
onChange: (event) => updatePaymentRow(row.id, { customDenom: event.currentTarget.value }),
|
|
26883
|
+
disabled: isDisabled || submitting
|
|
26884
|
+
}
|
|
26885
|
+
), /* @__PURE__ */ React245.createElement(
|
|
26886
|
+
BaseNumberInput,
|
|
26887
|
+
{
|
|
26888
|
+
min: 0,
|
|
26889
|
+
value: row.amount,
|
|
26890
|
+
onChange: (value) => updatePaymentRow(row.id, { amount: value }),
|
|
26891
|
+
placeholder: "Amount",
|
|
26892
|
+
disabled: isDisabled || submitting
|
|
26893
|
+
}
|
|
26894
|
+
))), /* @__PURE__ */ React245.createElement(Button44, { variant: "light", size: "xs", onClick: addPaymentRow, disabled: isDisabled || submitting }, "Add Payment")))
|
|
26688
26895
|
), /* @__PURE__ */ React245.createElement(Group90, { gap: "xs" }, /* @__PURE__ */ React245.createElement(
|
|
26689
26896
|
Button44,
|
|
26690
26897
|
{
|
|
@@ -26719,15 +26926,10 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26719
26926
|
}
|
|
26720
26927
|
},
|
|
26721
26928
|
"Reject"
|
|
26722
|
-
)), error && /* @__PURE__ */ React245.createElement(Alert41, { color: "red" }, error), runtime.error?.message && /* @__PURE__ */ React245.createElement(Alert41, { color: "red" }, runtime.error.message));
|
|
26929
|
+
)), error && /* @__PURE__ */ React245.createElement(Alert41, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && /* @__PURE__ */ React245.createElement(Alert41, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
26723
26930
|
}
|
|
26724
|
-
const filterTabs = [
|
|
26725
|
-
|
|
26726
|
-
{ value: "pending", label: "Pending" },
|
|
26727
|
-
{ value: "approved", label: "Approved" },
|
|
26728
|
-
{ value: "rejected", label: "Rejected" }
|
|
26729
|
-
];
|
|
26730
|
-
return /* @__PURE__ */ React245.createElement(Stack163, { gap: "md" }, !deedDid || !collectionId ? /* @__PURE__ */ React245.createElement(Alert41, { color: "yellow" }, "Configure DID and claim collection in template mode before running this action.") : /* @__PURE__ */ React245.createElement(React245.Fragment, null, /* @__PURE__ */ React245.createElement(Group90, { justify: "space-between", align: "center" }, /* @__PURE__ */ React245.createElement(Group90, { gap: 0 }, filterTabs.map((tab) => /* @__PURE__ */ React245.createElement(
|
|
26931
|
+
const filterTabs = [{ value: "pending", label: "Pending" }];
|
|
26932
|
+
return /* @__PURE__ */ React245.createElement(Stack163, { gap: "md" }, !deedDid || !collectionId ? /* @__PURE__ */ React245.createElement(Alert41, { color: "yellow", styles: actionAlertStyles }, "Configure DID and claim collection in template mode before running this action.") : /* @__PURE__ */ React245.createElement(React245.Fragment, null, /* @__PURE__ */ React245.createElement(Group90, { justify: "space-between", align: "center" }, /* @__PURE__ */ React245.createElement(Group90, { gap: 0 }, filterTabs.map((tab) => /* @__PURE__ */ React245.createElement(
|
|
26731
26933
|
UnstyledButton2,
|
|
26732
26934
|
{
|
|
26733
26935
|
key: tab.value,
|
|
@@ -26743,6 +26945,9 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26743
26945
|
/* @__PURE__ */ React245.createElement(Text139, { size: "sm", fw: 500, c: activeFilter === tab.value ? "white" : "dimmed" }, tab.label)
|
|
26744
26946
|
))), /* @__PURE__ */ React245.createElement(ActionIcon33, { variant: "subtle", color: "gray", size: "sm" }, /* @__PURE__ */ React245.createElement(IconFilter, { size: 16 }))), loadingBids && /* @__PURE__ */ React245.createElement(Group90, { gap: "xs", justify: "center", py: "md" }, /* @__PURE__ */ React245.createElement(Loader40, { size: "xs" }), /* @__PURE__ */ React245.createElement(Text139, { size: "xs", c: "dimmed" }, "Loading bids...")), !loadingBids && filteredBids.length === 0 && /* @__PURE__ */ React245.createElement(Text139, { size: "sm", c: "dimmed", ta: "center", py: "md" }, bids.length === 0 ? "No bids available for this collection." : `No ${activeFilter} bids found.`), filteredBids.length > 0 && /* @__PURE__ */ React245.createElement(Stack163, { gap: 12 }, filteredBids.map((bid) => {
|
|
26745
26947
|
const status = getBidStatus(bid);
|
|
26948
|
+
const profile = profilesByDid[bid.did];
|
|
26949
|
+
const displayName = profile?.displayname || bid.did || bid.address;
|
|
26950
|
+
const avatarLabel = (profile?.displayname || bid.did || bid.address || "?")[0]?.toUpperCase();
|
|
26746
26951
|
return /* @__PURE__ */ React245.createElement(ListItemContainer, { key: bid.id, isChecked: false, onClick: () => setSelectedBidId(bid.id) }, /* @__PURE__ */ React245.createElement(Group90, { gap: 16, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React245.createElement(
|
|
26747
26952
|
Box47,
|
|
26748
26953
|
{
|
|
@@ -26757,12 +26962,15 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26757
26962
|
flexShrink: 0,
|
|
26758
26963
|
fontSize: 14,
|
|
26759
26964
|
fontWeight: 500,
|
|
26760
|
-
color: "#adb5bd"
|
|
26965
|
+
color: "#adb5bd",
|
|
26966
|
+
backgroundImage: profile?.avatarUrl ? `url(${profile.avatarUrl})` : void 0,
|
|
26967
|
+
backgroundSize: "cover",
|
|
26968
|
+
backgroundPosition: "center"
|
|
26761
26969
|
}
|
|
26762
26970
|
},
|
|
26763
|
-
|
|
26764
|
-
), /* @__PURE__ */ React245.createElement(Stack163, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React245.createElement(Text139, { fw: 500, size: "md", truncate: true, style: { lineHeight: 1.5 } },
|
|
26765
|
-
}))), error && /* @__PURE__ */ React245.createElement(Alert41, { color: "red" }, error), runtime.error?.message && /* @__PURE__ */ React245.createElement(Alert41, { color: "red" }, runtime.error.message));
|
|
26971
|
+
profile?.avatarUrl ? null : avatarLabel
|
|
26972
|
+
), /* @__PURE__ */ React245.createElement(Stack163, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React245.createElement(Text139, { fw: 500, size: "md", truncate: true, style: { lineHeight: 1.5 } }, displayName), /* @__PURE__ */ React245.createElement(Text139, { size: "xs", c: "dimmed", truncate: true }, truncateAddress(bid.address)))), /* @__PURE__ */ React245.createElement(Stack163, { gap: 0, align: "flex-end", style: { flexShrink: 0, minWidth: 80 } }, /* @__PURE__ */ React245.createElement(Text139, { fw: 500, size: "md", c: status.color === "green" ? "green" : status.color === "red" ? "red" : void 0, style: { lineHeight: 1.5 } }, status.color === "green" && /* @__PURE__ */ React245.createElement(IconCheck17, { size: 14, style: { verticalAlign: "middle", marginRight: 2 } }), status.label), /* @__PURE__ */ React245.createElement(Text139, { size: "xs", c: "dimmed" }, getTimeAgo(bid.created || ""))));
|
|
26973
|
+
}))), error && /* @__PURE__ */ React245.createElement(Alert41, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && /* @__PURE__ */ React245.createElement(Alert41, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
26766
26974
|
};
|
|
26767
26975
|
|
|
26768
26976
|
// src/mantine/blocks/action/actionTypes/evaluateBid/index.ts
|
|
@@ -26859,7 +27067,7 @@ var ClaimConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26859
27067
|
currentBlockId: blockId,
|
|
26860
27068
|
required: true
|
|
26861
27069
|
}
|
|
26862
|
-
), /* @__PURE__ */ React246.createElement(BaseButton, { onClick: fetchCollections, disabled: !local.deedDid.trim() || loadingCollections }, loadingCollections ? /* @__PURE__ */ React246.createElement(Loader41, { size: "xs", color: "white" }) : "Get Collections"), error && /* @__PURE__ */ React246.createElement(Alert42, { color: "red" }, error), collectionOptions.length > 0 && /* @__PURE__ */ React246.createElement(
|
|
27070
|
+
), /* @__PURE__ */ React246.createElement(BaseButton, { onClick: fetchCollections, disabled: !local.deedDid.trim() || loadingCollections }, loadingCollections ? /* @__PURE__ */ React246.createElement(Loader41, { size: "xs", color: "white" }) : "Get Collections"), error && /* @__PURE__ */ React246.createElement(Alert42, { color: "red", styles: actionAlertStyles }, error), collectionOptions.length > 0 && /* @__PURE__ */ React246.createElement(
|
|
26863
27071
|
BaseSelect,
|
|
26864
27072
|
{
|
|
26865
27073
|
label: "Claim Collection",
|
|
@@ -26875,9 +27083,33 @@ var ClaimConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26875
27083
|
|
|
26876
27084
|
// src/mantine/blocks/action/actionTypes/claim/ClaimFlowDetail.tsx
|
|
26877
27085
|
import React247, { useCallback as useCallback79, useEffect as useEffect79, useMemo as useMemo94, useState as useState97 } from "react";
|
|
26878
|
-
import { Alert as Alert43,
|
|
26879
|
-
import { IconPlayerPlay as IconPlayerPlay4 } from "@tabler/icons-react";
|
|
27086
|
+
import { Alert as Alert43, Box as Box48, Button as Button45, Group as Group91, Loader as Loader42, Stack as Stack165, Text as Text140 } from "@mantine/core";
|
|
27087
|
+
import { IconCheck as IconCheck18, IconPlayerPlay as IconPlayerPlay4 } from "@tabler/icons-react";
|
|
26880
27088
|
import { Survey as Survey10, SurveyModel as SurveyModel10 } from "@ixo/surveys";
|
|
27089
|
+
function getTimeAgo2(dateString) {
|
|
27090
|
+
if (!dateString) return "";
|
|
27091
|
+
try {
|
|
27092
|
+
const date = new Date(dateString);
|
|
27093
|
+
const now = /* @__PURE__ */ new Date();
|
|
27094
|
+
const diffMs = now.getTime() - date.getTime();
|
|
27095
|
+
const diffMins = Math.floor(diffMs / 6e4);
|
|
27096
|
+
if (diffMins < 1) return "just now";
|
|
27097
|
+
if (diffMins < 60) return `${diffMins}m ago`;
|
|
27098
|
+
const diffHours = Math.floor(diffMins / 60);
|
|
27099
|
+
if (diffHours < 24) return `${diffHours}h ago`;
|
|
27100
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
27101
|
+
if (diffDays < 30) return `${diffDays} day${diffDays > 1 ? "s" : ""} ago`;
|
|
27102
|
+
const diffMonths = Math.floor(diffDays / 30);
|
|
27103
|
+
return `${diffMonths} month${diffMonths > 1 ? "s" : ""} ago`;
|
|
27104
|
+
} catch {
|
|
27105
|
+
return dateString;
|
|
27106
|
+
}
|
|
27107
|
+
}
|
|
27108
|
+
function truncateAddress2(address) {
|
|
27109
|
+
if (!address) return "";
|
|
27110
|
+
if (address.length <= 14) return address;
|
|
27111
|
+
return `${address.slice(0, 8)}...${address.slice(-3)}`;
|
|
27112
|
+
}
|
|
26881
27113
|
var ClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
26882
27114
|
const handlers = useBlocknoteHandlers();
|
|
26883
27115
|
const services = useMemo94(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
@@ -26916,6 +27148,9 @@ var ClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabl
|
|
|
26916
27148
|
const [loadingSurvey, setLoadingSurvey] = useState97(false);
|
|
26917
27149
|
const [submitting, setSubmitting] = useState97(false);
|
|
26918
27150
|
const [error, setError] = useState97(null);
|
|
27151
|
+
const [profilesByDid, setProfilesByDid] = useState97({});
|
|
27152
|
+
const [isServiceAgentAuthorized, setIsServiceAgentAuthorized] = useState97(false);
|
|
27153
|
+
const [authChecking, setAuthChecking] = useState97(true);
|
|
26919
27154
|
const surveyModel = useMemo94(() => {
|
|
26920
27155
|
if (!surveyJson) return null;
|
|
26921
27156
|
const model = new SurveyModel10(surveyJson);
|
|
@@ -26952,6 +27187,85 @@ var ClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabl
|
|
|
26952
27187
|
if (!deedDid || !collectionId || !actorDid) return;
|
|
26953
27188
|
fetchClaimsAndAdmin();
|
|
26954
27189
|
}, [deedDid, collectionId, actorDid, fetchClaimsAndAdmin]);
|
|
27190
|
+
useEffect79(() => {
|
|
27191
|
+
let mounted = true;
|
|
27192
|
+
const dids = Array.from(new Set(claims.map((claim) => claim.agentDid).filter(Boolean)));
|
|
27193
|
+
const missing = dids.filter((did) => !profilesByDid[did]);
|
|
27194
|
+
if (missing.length === 0)
|
|
27195
|
+
return () => {
|
|
27196
|
+
mounted = false;
|
|
27197
|
+
};
|
|
27198
|
+
const loadProfiles = async () => {
|
|
27199
|
+
const results = await Promise.all(
|
|
27200
|
+
missing.map(async (did) => {
|
|
27201
|
+
try {
|
|
27202
|
+
const profile = await handlers.getMatrixInfoPerDid(did);
|
|
27203
|
+
return [did, profile];
|
|
27204
|
+
} catch {
|
|
27205
|
+
return [did, null];
|
|
27206
|
+
}
|
|
27207
|
+
})
|
|
27208
|
+
);
|
|
27209
|
+
if (!mounted) return;
|
|
27210
|
+
setProfilesByDid((prev) => {
|
|
27211
|
+
const next = { ...prev };
|
|
27212
|
+
results.forEach(([did, profile]) => {
|
|
27213
|
+
if (profile) {
|
|
27214
|
+
next[did] = profile;
|
|
27215
|
+
}
|
|
27216
|
+
});
|
|
27217
|
+
return next;
|
|
27218
|
+
});
|
|
27219
|
+
};
|
|
27220
|
+
loadProfiles();
|
|
27221
|
+
return () => {
|
|
27222
|
+
mounted = false;
|
|
27223
|
+
};
|
|
27224
|
+
}, [claims, handlers, profilesByDid]);
|
|
27225
|
+
useEffect79(() => {
|
|
27226
|
+
let mounted = true;
|
|
27227
|
+
const checkServiceAgentAuthorization = async () => {
|
|
27228
|
+
if (!deedDid || !collectionId || !adminAddress || !actorDid) {
|
|
27229
|
+
if (mounted) {
|
|
27230
|
+
setIsServiceAgentAuthorized(false);
|
|
27231
|
+
setAuthChecking(false);
|
|
27232
|
+
}
|
|
27233
|
+
return;
|
|
27234
|
+
}
|
|
27235
|
+
if (typeof handlers.getUserRoles !== "function") {
|
|
27236
|
+
if (mounted) {
|
|
27237
|
+
setIsServiceAgentAuthorized(false);
|
|
27238
|
+
setAuthChecking(false);
|
|
27239
|
+
}
|
|
27240
|
+
return;
|
|
27241
|
+
}
|
|
27242
|
+
setAuthChecking(true);
|
|
27243
|
+
try {
|
|
27244
|
+
const roles = await handlers.getUserRoles({
|
|
27245
|
+
userAddress: actorDid,
|
|
27246
|
+
adminAddress,
|
|
27247
|
+
deedDid,
|
|
27248
|
+
collectionIds: [collectionId]
|
|
27249
|
+
});
|
|
27250
|
+
const role = roles?.find((r) => r.collectionId === collectionId)?.role || null;
|
|
27251
|
+
if (mounted) {
|
|
27252
|
+
setIsServiceAgentAuthorized(role === "SA" /* ServiceProvider */);
|
|
27253
|
+
}
|
|
27254
|
+
} catch {
|
|
27255
|
+
if (mounted) {
|
|
27256
|
+
setIsServiceAgentAuthorized(false);
|
|
27257
|
+
}
|
|
27258
|
+
} finally {
|
|
27259
|
+
if (mounted) {
|
|
27260
|
+
setAuthChecking(false);
|
|
27261
|
+
}
|
|
27262
|
+
}
|
|
27263
|
+
};
|
|
27264
|
+
checkServiceAgentAuthorization();
|
|
27265
|
+
return () => {
|
|
27266
|
+
mounted = false;
|
|
27267
|
+
};
|
|
27268
|
+
}, [handlers, actorDid, adminAddress, deedDid, collectionId]);
|
|
26955
27269
|
const startSurvey = useCallback79(async () => {
|
|
26956
27270
|
if (!deedDid) return;
|
|
26957
27271
|
setLoadingSurvey(true);
|
|
@@ -26973,6 +27287,10 @@ var ClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabl
|
|
|
26973
27287
|
}, [handlers, deedDid]);
|
|
26974
27288
|
const handleSurveyComplete = useCallback79(
|
|
26975
27289
|
async (sender) => {
|
|
27290
|
+
if (authChecking || !isServiceAgentAuthorized) {
|
|
27291
|
+
setError("You need service agent authorization for this collection to submit claims.");
|
|
27292
|
+
return;
|
|
27293
|
+
}
|
|
26976
27294
|
if (!adminAddress) {
|
|
26977
27295
|
setError("Admin address could not be resolved for this collection");
|
|
26978
27296
|
return;
|
|
@@ -27064,7 +27382,9 @@ var ClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabl
|
|
|
27064
27382
|
services,
|
|
27065
27383
|
ucanManager,
|
|
27066
27384
|
updateRuntime,
|
|
27067
|
-
verifySignature
|
|
27385
|
+
verifySignature,
|
|
27386
|
+
authChecking,
|
|
27387
|
+
isServiceAgentAuthorized
|
|
27068
27388
|
]
|
|
27069
27389
|
);
|
|
27070
27390
|
useEffect79(() => {
|
|
@@ -27074,16 +27394,42 @@ var ClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabl
|
|
|
27074
27394
|
surveyModel.onComplete.remove(handleSurveyComplete);
|
|
27075
27395
|
};
|
|
27076
27396
|
}, [surveyModel, handleSurveyComplete]);
|
|
27077
|
-
|
|
27078
|
-
|
|
27079
|
-
|
|
27080
|
-
|
|
27081
|
-
|
|
27082
|
-
|
|
27083
|
-
|
|
27084
|
-
|
|
27085
|
-
|
|
27086
|
-
|
|
27397
|
+
return /* @__PURE__ */ React247.createElement(Stack165, { gap: "md" }, /* @__PURE__ */ React247.createElement(Stack165, { gap: 2 }, /* @__PURE__ */ React247.createElement(Text140, { fw: 600 }, block?.props?.title || "Claim Action"), /* @__PURE__ */ React247.createElement(Text140, { size: "sm", c: "dimmed" }, block?.props?.description || "Submit a claim using the deed survey template.")), !deedDid || !collectionId ? /* @__PURE__ */ React247.createElement(Alert43, { color: "yellow", styles: actionAlertStyles }, "Configure DID and claim collection in template mode before running this action.") : /* @__PURE__ */ React247.createElement(React247.Fragment, null, /* @__PURE__ */ React247.createElement(Text140, { size: "xs", c: "dimmed" }, "Collection: ", collectionId), /* @__PURE__ */ React247.createElement(
|
|
27398
|
+
Button45,
|
|
27399
|
+
{
|
|
27400
|
+
leftSection: loadingSurvey ? /* @__PURE__ */ React247.createElement(Loader42, { size: 14 }) : /* @__PURE__ */ React247.createElement(IconPlayerPlay4, { size: 14 }),
|
|
27401
|
+
onClick: startSurvey,
|
|
27402
|
+
disabled: isDisabled || loadingSurvey || submitting || authChecking || !isServiceAgentAuthorized || !adminAddress
|
|
27403
|
+
},
|
|
27404
|
+
loadingSurvey ? "Loading Survey..." : "Start New Claim"
|
|
27405
|
+
), !authChecking && !isServiceAgentAuthorized && /* @__PURE__ */ React247.createElement(Alert43, { color: "yellow", styles: actionAlertStyles }, "You need service agent authorization for this collection to submit claims."), loadingClaims ? /* @__PURE__ */ React247.createElement(Text140, { size: "xs", c: "dimmed" }, "Loading your claims...") : claims.length === 0 ? /* @__PURE__ */ React247.createElement(Text140, { size: "sm", c: "dimmed" }, "No claims submitted for this collection yet.") : /* @__PURE__ */ React247.createElement(Stack165, { gap: "xs" }, /* @__PURE__ */ React247.createElement(Text140, { size: "sm", fw: 600 }, "Your Claims"), claims.map((claim) => {
|
|
27406
|
+
const status = getClaimStatusInfo(claim);
|
|
27407
|
+
const profile = profilesByDid[claim.agentDid];
|
|
27408
|
+
const displayName = profile?.displayname || claim.agentDid || claim.agentAddress;
|
|
27409
|
+
const avatarLabel = (profile?.displayname || claim.agentDid || claim.agentAddress || "?")[0]?.toUpperCase();
|
|
27410
|
+
return /* @__PURE__ */ React247.createElement(ListItemContainer, { key: claim.claimId, isChecked: false }, /* @__PURE__ */ React247.createElement(Group91, { gap: 16, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React247.createElement(
|
|
27411
|
+
Box48,
|
|
27412
|
+
{
|
|
27413
|
+
style: {
|
|
27414
|
+
width: 32,
|
|
27415
|
+
height: 32,
|
|
27416
|
+
borderRadius: "50%",
|
|
27417
|
+
background: "var(--mantine-color-neutralColor-6)",
|
|
27418
|
+
display: "flex",
|
|
27419
|
+
alignItems: "center",
|
|
27420
|
+
justifyContent: "center",
|
|
27421
|
+
flexShrink: 0,
|
|
27422
|
+
fontSize: 14,
|
|
27423
|
+
fontWeight: 500,
|
|
27424
|
+
color: "#adb5bd",
|
|
27425
|
+
backgroundImage: profile?.avatarUrl ? `url(${profile.avatarUrl})` : void 0,
|
|
27426
|
+
backgroundSize: "cover",
|
|
27427
|
+
backgroundPosition: "center"
|
|
27428
|
+
}
|
|
27429
|
+
},
|
|
27430
|
+
profile?.avatarUrl ? null : avatarLabel
|
|
27431
|
+
), /* @__PURE__ */ React247.createElement(Stack165, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React247.createElement(Text140, { fw: 500, size: "md", truncate: true, style: { lineHeight: 1.5 } }, displayName), /* @__PURE__ */ React247.createElement(Text140, { size: "xs", c: "dimmed", truncate: true }, truncateAddress2(claim.agentAddress)))), /* @__PURE__ */ React247.createElement(Stack165, { gap: 0, align: "flex-end", style: { flexShrink: 0, minWidth: 80 } }, /* @__PURE__ */ React247.createElement(Text140, { fw: 500, size: "md", c: status.color, style: { lineHeight: 1.5 } }, status.key === "approved" && /* @__PURE__ */ React247.createElement(IconCheck18, { size: 14, style: { verticalAlign: "middle", marginRight: 2 } }), status.label), /* @__PURE__ */ React247.createElement(Text140, { size: "xs", c: "dimmed" }, getTimeAgo2(claim.submissionDate || ""))));
|
|
27432
|
+
}))), surveyModel && !loadingSurvey && /* @__PURE__ */ React247.createElement(Survey10, { model: surveyModel }), submitting && /* @__PURE__ */ React247.createElement(Group91, { gap: "xs" }, /* @__PURE__ */ React247.createElement(Loader42, { size: "xs" }), /* @__PURE__ */ React247.createElement(Text140, { size: "xs", c: "dimmed" }, "Submitting claim...")), error && /* @__PURE__ */ React247.createElement(Alert43, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && /* @__PURE__ */ React247.createElement(Alert43, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
27087
27433
|
};
|
|
27088
27434
|
|
|
27089
27435
|
// src/mantine/blocks/action/actionTypes/claim/index.ts
|
|
@@ -27180,7 +27526,7 @@ var EvaluateClaimConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
27180
27526
|
currentBlockId: blockId,
|
|
27181
27527
|
required: true
|
|
27182
27528
|
}
|
|
27183
|
-
), /* @__PURE__ */ React248.createElement(BaseButton, { onClick: fetchCollections, disabled: !local.deedDid.trim() || loadingCollections }, loadingCollections ? /* @__PURE__ */ React248.createElement(Loader43, { size: "xs", color: "white" }) : "Get Collections"), error && /* @__PURE__ */ React248.createElement(Alert44, { color: "red" }, error), collectionOptions.length > 0 && /* @__PURE__ */ React248.createElement(
|
|
27529
|
+
), /* @__PURE__ */ React248.createElement(BaseButton, { onClick: fetchCollections, disabled: !local.deedDid.trim() || loadingCollections }, loadingCollections ? /* @__PURE__ */ React248.createElement(Loader43, { size: "xs", color: "white" }) : "Get Collections"), error && /* @__PURE__ */ React248.createElement(Alert44, { color: "red", styles: actionAlertStyles }, error), collectionOptions.length > 0 && /* @__PURE__ */ React248.createElement(
|
|
27184
27530
|
BaseSelect,
|
|
27185
27531
|
{
|
|
27186
27532
|
label: "Claim Collection",
|
|
@@ -27196,13 +27542,20 @@ var EvaluateClaimConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
27196
27542
|
|
|
27197
27543
|
// src/mantine/blocks/action/actionTypes/evaluateClaim/EvaluateClaimFlowDetail.tsx
|
|
27198
27544
|
import React249, { useCallback as useCallback81, useEffect as useEffect81, useMemo as useMemo96, useState as useState99 } from "react";
|
|
27199
|
-
import { ActionIcon as ActionIcon34, Alert as Alert45, Box as
|
|
27200
|
-
import { IconArrowLeft as IconArrowLeft7, IconCheck as
|
|
27545
|
+
import { ActionIcon as ActionIcon34, Alert as Alert45, Box as Box49, Button as Button46, Checkbox as Checkbox13, Collapse as Collapse9, Divider as Divider26, Group as Group92, Loader as Loader44, ScrollArea as ScrollArea8, Stack as Stack167, Text as Text141, UnstyledButton as UnstyledButton3 } from "@mantine/core";
|
|
27546
|
+
import { IconArrowLeft as IconArrowLeft7, IconCheck as IconCheck19, IconChevronDown as IconChevronDown10, IconChevronRight as IconChevronRight12, IconFilter as IconFilter2, IconThumbDown as IconThumbDown2, IconThumbUp as IconThumbUp3 } from "@tabler/icons-react";
|
|
27201
27547
|
import { Survey as Survey11, SurveyModel as SurveyModel11 } from "@ixo/surveys";
|
|
27202
27548
|
var USDC_DENOM5 = "ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B";
|
|
27203
27549
|
var IXO_DENOM5 = "uixo";
|
|
27550
|
+
var CUSTOM_DENOM2 = "__custom__";
|
|
27204
27551
|
var DECIMALS4 = 6;
|
|
27205
|
-
|
|
27552
|
+
var createPaymentRow2 = () => ({
|
|
27553
|
+
id: `payment-${Math.random().toString(36).slice(2, 9)}`,
|
|
27554
|
+
denom: USDC_DENOM5,
|
|
27555
|
+
customDenom: "",
|
|
27556
|
+
amount: ""
|
|
27557
|
+
});
|
|
27558
|
+
function getTimeAgo3(dateString) {
|
|
27206
27559
|
if (!dateString) return "";
|
|
27207
27560
|
try {
|
|
27208
27561
|
const date = new Date(dateString);
|
|
@@ -27221,16 +27574,15 @@ function getTimeAgo2(dateString) {
|
|
|
27221
27574
|
return dateString;
|
|
27222
27575
|
}
|
|
27223
27576
|
}
|
|
27224
|
-
function
|
|
27577
|
+
function truncateAddress3(address) {
|
|
27225
27578
|
if (!address) return "";
|
|
27226
27579
|
if (address.length <= 14) return address;
|
|
27227
27580
|
return `${address.slice(0, 8)}...${address.slice(-3)}`;
|
|
27228
27581
|
}
|
|
27229
|
-
function
|
|
27230
|
-
|
|
27231
|
-
if (
|
|
27232
|
-
|
|
27233
|
-
return { label: "Pending", color: "yellow" };
|
|
27582
|
+
function truncateId(value, start = 8, end = 6) {
|
|
27583
|
+
if (!value) return "";
|
|
27584
|
+
if (value.length <= start + end + 3) return value;
|
|
27585
|
+
return `${value.slice(0, start)}...${value.slice(-end)}`;
|
|
27234
27586
|
}
|
|
27235
27587
|
var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
27236
27588
|
const handlers = useBlocknoteHandlers();
|
|
@@ -27269,8 +27621,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27269
27621
|
const [submitting, setSubmitting] = useState99(false);
|
|
27270
27622
|
const [error, setError] = useState99(null);
|
|
27271
27623
|
const [adminAddress, setAdminAddress] = useState99("");
|
|
27272
|
-
const [
|
|
27273
|
-
const [paymentAmount, setPaymentAmount] = useState99("");
|
|
27624
|
+
const [paymentRows, setPaymentRows] = useState99([createPaymentRow2()]);
|
|
27274
27625
|
const [createUdid, setCreateUdid] = useState99(true);
|
|
27275
27626
|
const [claimData, setClaimData] = useState99(null);
|
|
27276
27627
|
const [surveyJson, setSurveyJson] = useState99(null);
|
|
@@ -27281,11 +27632,14 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27281
27632
|
const [submissionOpen, setSubmissionOpen] = useState99(false);
|
|
27282
27633
|
const [aiEvalOpen, setAiEvalOpen] = useState99(false);
|
|
27283
27634
|
const [evaluationOpen, setEvaluationOpen] = useState99(true);
|
|
27635
|
+
const [isEvaluatorAuthorized, setIsEvaluatorAuthorized] = useState99(false);
|
|
27636
|
+
const [authChecking, setAuthChecking] = useState99(true);
|
|
27637
|
+
const [profilesByDid, setProfilesByDid] = useState99({});
|
|
27284
27638
|
const selectedClaim = useMemo96(() => claims.find((claim) => claim.claimId === selectedClaimId) || null, [claims, selectedClaimId]);
|
|
27285
27639
|
const filteredClaims = useMemo96(() => {
|
|
27286
27640
|
if (activeFilter === "all") return claims;
|
|
27287
27641
|
return claims.filter((claim) => {
|
|
27288
|
-
const status =
|
|
27642
|
+
const status = getClaimStatusInfo(claim).key;
|
|
27289
27643
|
return status === activeFilter;
|
|
27290
27644
|
});
|
|
27291
27645
|
}, [claims, activeFilter]);
|
|
@@ -27367,7 +27721,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27367
27721
|
useEffect81(() => {
|
|
27368
27722
|
setSelectedClaimId("");
|
|
27369
27723
|
setError(null);
|
|
27370
|
-
|
|
27724
|
+
setPaymentRows([createPaymentRow2()]);
|
|
27371
27725
|
setClaimData(null);
|
|
27372
27726
|
setSurveyJson(null);
|
|
27373
27727
|
setEvaluationResult(null);
|
|
@@ -27376,6 +27730,85 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27376
27730
|
if (!deedDid || !collectionId) return;
|
|
27377
27731
|
refreshClaims();
|
|
27378
27732
|
}, [deedDid, collectionId, refreshClaims]);
|
|
27733
|
+
useEffect81(() => {
|
|
27734
|
+
let mounted = true;
|
|
27735
|
+
const dids = Array.from(new Set(claims.map((claim) => claim.agentDid).filter(Boolean)));
|
|
27736
|
+
const missing = dids.filter((did) => !profilesByDid[did]);
|
|
27737
|
+
if (missing.length === 0)
|
|
27738
|
+
return () => {
|
|
27739
|
+
mounted = false;
|
|
27740
|
+
};
|
|
27741
|
+
const loadProfiles = async () => {
|
|
27742
|
+
const results = await Promise.all(
|
|
27743
|
+
missing.map(async (did) => {
|
|
27744
|
+
try {
|
|
27745
|
+
const profile = await handlers.getMatrixInfoPerDid(did);
|
|
27746
|
+
return [did, profile];
|
|
27747
|
+
} catch {
|
|
27748
|
+
return [did, null];
|
|
27749
|
+
}
|
|
27750
|
+
})
|
|
27751
|
+
);
|
|
27752
|
+
if (!mounted) return;
|
|
27753
|
+
setProfilesByDid((prev) => {
|
|
27754
|
+
const next = { ...prev };
|
|
27755
|
+
results.forEach(([did, profile]) => {
|
|
27756
|
+
if (profile) {
|
|
27757
|
+
next[did] = profile;
|
|
27758
|
+
}
|
|
27759
|
+
});
|
|
27760
|
+
return next;
|
|
27761
|
+
});
|
|
27762
|
+
};
|
|
27763
|
+
loadProfiles();
|
|
27764
|
+
return () => {
|
|
27765
|
+
mounted = false;
|
|
27766
|
+
};
|
|
27767
|
+
}, [claims, handlers, profilesByDid]);
|
|
27768
|
+
useEffect81(() => {
|
|
27769
|
+
let mounted = true;
|
|
27770
|
+
const checkEvaluatorAuthorization = async () => {
|
|
27771
|
+
if (!deedDid || !collectionId || !adminAddress || !actorDid) {
|
|
27772
|
+
if (mounted) {
|
|
27773
|
+
setIsEvaluatorAuthorized(false);
|
|
27774
|
+
setAuthChecking(false);
|
|
27775
|
+
}
|
|
27776
|
+
return;
|
|
27777
|
+
}
|
|
27778
|
+
if (typeof handlers.getUserRoles !== "function") {
|
|
27779
|
+
if (mounted) {
|
|
27780
|
+
setIsEvaluatorAuthorized(false);
|
|
27781
|
+
setAuthChecking(false);
|
|
27782
|
+
}
|
|
27783
|
+
return;
|
|
27784
|
+
}
|
|
27785
|
+
setAuthChecking(true);
|
|
27786
|
+
try {
|
|
27787
|
+
const roles = await handlers.getUserRoles({
|
|
27788
|
+
userAddress: actorDid,
|
|
27789
|
+
adminAddress,
|
|
27790
|
+
deedDid,
|
|
27791
|
+
collectionIds: [collectionId]
|
|
27792
|
+
});
|
|
27793
|
+
const role = roles?.find((r) => r.collectionId === collectionId)?.role || null;
|
|
27794
|
+
if (mounted) {
|
|
27795
|
+
setIsEvaluatorAuthorized(role === "EA" /* Evaluator */);
|
|
27796
|
+
}
|
|
27797
|
+
} catch {
|
|
27798
|
+
if (mounted) {
|
|
27799
|
+
setIsEvaluatorAuthorized(false);
|
|
27800
|
+
}
|
|
27801
|
+
} finally {
|
|
27802
|
+
if (mounted) {
|
|
27803
|
+
setAuthChecking(false);
|
|
27804
|
+
}
|
|
27805
|
+
}
|
|
27806
|
+
};
|
|
27807
|
+
checkEvaluatorAuthorization();
|
|
27808
|
+
return () => {
|
|
27809
|
+
mounted = false;
|
|
27810
|
+
};
|
|
27811
|
+
}, [handlers, actorDid, adminAddress, deedDid, collectionId]);
|
|
27379
27812
|
useEffect81(() => {
|
|
27380
27813
|
if (!selectedClaim) {
|
|
27381
27814
|
setClaimData(null);
|
|
@@ -27386,23 +27819,35 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27386
27819
|
setSubmissionOpen(false);
|
|
27387
27820
|
setAiEvalOpen(false);
|
|
27388
27821
|
setEvaluationOpen(true);
|
|
27389
|
-
|
|
27822
|
+
setPaymentRows([createPaymentRow2()]);
|
|
27390
27823
|
loadClaimDetail(selectedClaim);
|
|
27391
27824
|
}, [selectedClaim, loadClaimDetail]);
|
|
27392
27825
|
const isClaimAlreadyEvaluated = useMemo96(() => {
|
|
27393
27826
|
if (!selectedClaim) return false;
|
|
27394
|
-
|
|
27395
|
-
return status === "Approved" || status === "Rejected";
|
|
27827
|
+
return isClaimEvaluated(selectedClaim);
|
|
27396
27828
|
}, [selectedClaim]);
|
|
27397
|
-
const
|
|
27398
|
-
|
|
27399
|
-
|
|
27400
|
-
|
|
27401
|
-
|
|
27402
|
-
|
|
27403
|
-
|
|
27404
|
-
};
|
|
27405
|
-
};
|
|
27829
|
+
const addPaymentRow = useCallback81(() => {
|
|
27830
|
+
setPaymentRows((prev) => [...prev, createPaymentRow2()]);
|
|
27831
|
+
}, []);
|
|
27832
|
+
const removePaymentRow = useCallback81((id) => {
|
|
27833
|
+
setPaymentRows((prev) => prev.length === 1 ? prev : prev.filter((row) => row.id !== id));
|
|
27834
|
+
}, []);
|
|
27835
|
+
const updatePaymentRow = useCallback81((id, patch) => {
|
|
27836
|
+
setPaymentRows((prev) => prev.map((row) => row.id === id ? { ...row, ...patch } : row));
|
|
27837
|
+
}, []);
|
|
27838
|
+
const buildPaymentCoins = useCallback81(() => {
|
|
27839
|
+
return paymentRows.map((row) => {
|
|
27840
|
+
const denom = row.denom === CUSTOM_DENOM2 ? row.customDenom.trim() : row.denom || "";
|
|
27841
|
+
const amount = Number(row.amount);
|
|
27842
|
+
if (!denom || !Number.isFinite(amount) || amount <= 0) {
|
|
27843
|
+
return null;
|
|
27844
|
+
}
|
|
27845
|
+
return {
|
|
27846
|
+
denom,
|
|
27847
|
+
amount: (amount * Math.pow(10, DECIMALS4)).toString()
|
|
27848
|
+
};
|
|
27849
|
+
}).filter((entry) => !!entry);
|
|
27850
|
+
}, [paymentRows]);
|
|
27406
27851
|
const executeEvaluation = useCallback81(
|
|
27407
27852
|
async (decision) => {
|
|
27408
27853
|
if (!selectedClaim) {
|
|
@@ -27420,7 +27865,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27420
27865
|
}
|
|
27421
27866
|
setSubmitting(true);
|
|
27422
27867
|
setError(null);
|
|
27423
|
-
updateRuntime({ state: "running"
|
|
27868
|
+
updateRuntime({ state: "running" });
|
|
27424
27869
|
try {
|
|
27425
27870
|
const capabilityId = deedDid;
|
|
27426
27871
|
const outcome = await executeNode({
|
|
@@ -27442,7 +27887,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27442
27887
|
collectionId,
|
|
27443
27888
|
deedDid,
|
|
27444
27889
|
adminAddress,
|
|
27445
|
-
amount:
|
|
27890
|
+
amount: buildPaymentCoins(),
|
|
27446
27891
|
createUdid,
|
|
27447
27892
|
capabilityCid: capabilityId,
|
|
27448
27893
|
rubricAuthority: deedDid,
|
|
@@ -27493,8 +27938,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27493
27938
|
const message = err instanceof Error ? err.message : "Failed to evaluate claim";
|
|
27494
27939
|
setError(message);
|
|
27495
27940
|
updateRuntime({
|
|
27496
|
-
state: "failed"
|
|
27497
|
-
error: { message, at: Date.now() }
|
|
27941
|
+
state: "failed"
|
|
27498
27942
|
});
|
|
27499
27943
|
} finally {
|
|
27500
27944
|
setSubmitting(false);
|
|
@@ -27520,15 +27964,17 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27520
27964
|
createUdid,
|
|
27521
27965
|
updateRuntime,
|
|
27522
27966
|
refreshClaims,
|
|
27523
|
-
|
|
27524
|
-
paymentAmount,
|
|
27967
|
+
buildPaymentCoins,
|
|
27525
27968
|
evaluationResult
|
|
27526
27969
|
]
|
|
27527
27970
|
);
|
|
27528
27971
|
if (selectedClaim) {
|
|
27529
|
-
const claimStatus =
|
|
27530
|
-
|
|
27531
|
-
|
|
27972
|
+
const claimStatus = getClaimStatusInfo(selectedClaim);
|
|
27973
|
+
const selectedClaimProfile = profilesByDid[selectedClaim.agentDid];
|
|
27974
|
+
const selectedDisplayName = selectedClaimProfile?.displayname || selectedClaim.agentDid || selectedClaim.agentAddress;
|
|
27975
|
+
const selectedAvatarLabel = (selectedClaimProfile?.displayname || selectedClaim.agentDid || selectedClaim.agentAddress || "?")[0]?.toUpperCase();
|
|
27976
|
+
return /* @__PURE__ */ React249.createElement(Stack167, { gap: "md" }, /* @__PURE__ */ React249.createElement(Group92, { gap: "xs", align: "center" }, /* @__PURE__ */ React249.createElement(ActionIcon34, { variant: "subtle", color: "gray", size: "sm", onClick: () => setSelectedClaimId("") }, /* @__PURE__ */ React249.createElement(IconArrowLeft7, { size: 16 })), /* @__PURE__ */ React249.createElement(Text141, { fw: 500, size: "sm", title: selectedClaim.claimId }, "Claim #", truncateId(selectedClaim.claimId))), /* @__PURE__ */ React249.createElement(Group92, { gap: 16, align: "center", style: { width: "100%" } }, /* @__PURE__ */ React249.createElement(
|
|
27977
|
+
Box49,
|
|
27532
27978
|
{
|
|
27533
27979
|
style: {
|
|
27534
27980
|
width: 40,
|
|
@@ -27541,12 +27987,15 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27541
27987
|
flexShrink: 0,
|
|
27542
27988
|
fontSize: 16,
|
|
27543
27989
|
fontWeight: 500,
|
|
27544
|
-
color: "#adb5bd"
|
|
27990
|
+
color: "#adb5bd",
|
|
27991
|
+
backgroundImage: selectedClaimProfile?.avatarUrl ? `url(${selectedClaimProfile.avatarUrl})` : void 0,
|
|
27992
|
+
backgroundSize: "cover",
|
|
27993
|
+
backgroundPosition: "center"
|
|
27545
27994
|
}
|
|
27546
27995
|
},
|
|
27547
|
-
|
|
27548
|
-
), /* @__PURE__ */ React249.createElement(Stack167, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React249.createElement(Text141, { fw: 500, size: "md", truncate: true },
|
|
27549
|
-
|
|
27996
|
+
selectedClaimProfile?.avatarUrl ? null : selectedAvatarLabel
|
|
27997
|
+
), /* @__PURE__ */ React249.createElement(Stack167, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React249.createElement(Text141, { fw: 500, size: "md", truncate: true }, selectedDisplayName), /* @__PURE__ */ React249.createElement(Text141, { size: "xs", c: "dimmed", truncate: true }, truncateAddress3(selectedClaim.agentAddress))), /* @__PURE__ */ React249.createElement(Stack167, { gap: 0, align: "flex-end", style: { flexShrink: 0 } }, /* @__PURE__ */ React249.createElement(Text141, { fw: 500, size: "md", c: claimStatus.color }, claimStatus.key === "approved" && /* @__PURE__ */ React249.createElement(IconCheck19, { size: 14, style: { verticalAlign: "middle", marginRight: 4 } }), claimStatus.label), /* @__PURE__ */ React249.createElement(Text141, { size: "xs", c: "dimmed" }, getTimeAgo3(selectedClaim.submissionDate || "")))), /* @__PURE__ */ React249.createElement(
|
|
27998
|
+
Box49,
|
|
27550
27999
|
{
|
|
27551
28000
|
p: "sm",
|
|
27552
28001
|
style: {
|
|
@@ -27555,9 +28004,9 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27555
28004
|
}
|
|
27556
28005
|
},
|
|
27557
28006
|
/* @__PURE__ */ React249.createElement(UnstyledButton3, { onClick: () => setSubmissionOpen((v) => !v), style: { width: "100%" } }, /* @__PURE__ */ React249.createElement(Group92, { gap: "xs", align: "center" }, submissionOpen ? /* @__PURE__ */ React249.createElement(IconChevronDown10, { size: 16 }) : /* @__PURE__ */ React249.createElement(IconChevronRight12, { size: 16 }), /* @__PURE__ */ React249.createElement(Text141, { fw: 500, size: "sm" }, "Submission"))),
|
|
27558
|
-
/* @__PURE__ */ React249.createElement(Collapse9, { in: submissionOpen }, /* @__PURE__ */ React249.createElement(
|
|
28007
|
+
/* @__PURE__ */ React249.createElement(Collapse9, { in: submissionOpen }, /* @__PURE__ */ React249.createElement(Box49, { mt: "sm" }, surveyLoading ? /* @__PURE__ */ React249.createElement(Group92, { gap: "xs" }, /* @__PURE__ */ React249.createElement(Loader44, { size: "xs" }), /* @__PURE__ */ React249.createElement(Text141, { size: "xs", c: "dimmed" }, "Loading submission details...")) : surveyModel ? /* @__PURE__ */ React249.createElement(ScrollArea8, { h: 280 }, /* @__PURE__ */ React249.createElement(Survey11, { model: surveyModel })) : /* @__PURE__ */ React249.createElement(Text141, { size: "xs", c: "dimmed" }, "No submission template/data available.")))
|
|
27559
28008
|
), /* @__PURE__ */ React249.createElement(
|
|
27560
|
-
|
|
28009
|
+
Box49,
|
|
27561
28010
|
{
|
|
27562
28011
|
p: "sm",
|
|
27563
28012
|
style: {
|
|
@@ -27566,9 +28015,9 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27566
28015
|
}
|
|
27567
28016
|
},
|
|
27568
28017
|
/* @__PURE__ */ React249.createElement(UnstyledButton3, { onClick: () => setAiEvalOpen((v) => !v), style: { width: "100%" } }, /* @__PURE__ */ React249.createElement(Group92, { gap: "xs", align: "center" }, aiEvalOpen ? /* @__PURE__ */ React249.createElement(IconChevronDown10, { size: 16 }) : /* @__PURE__ */ React249.createElement(IconChevronRight12, { size: 16 }), /* @__PURE__ */ React249.createElement(Text141, { fw: 500, size: "sm" }, "AI Evaluation"))),
|
|
27569
|
-
/* @__PURE__ */ React249.createElement(Collapse9, { in: aiEvalOpen }, /* @__PURE__ */ React249.createElement(
|
|
28018
|
+
/* @__PURE__ */ React249.createElement(Collapse9, { in: aiEvalOpen }, /* @__PURE__ */ React249.createElement(Box49, { mt: "sm" }, evaluationLoading ? /* @__PURE__ */ React249.createElement(Group92, { gap: "xs" }, /* @__PURE__ */ React249.createElement(Loader44, { size: "xs" }), /* @__PURE__ */ React249.createElement(Text141, { size: "xs", c: "dimmed" }, "Running rubric evaluation...")) : evaluationResult ? /* @__PURE__ */ React249.createElement(ScrollArea8, { h: 280 }, /* @__PURE__ */ React249.createElement(RubricEvaluationResults, { evaluation: evaluationResult })) : /* @__PURE__ */ React249.createElement(Text141, { size: "xs", c: "dimmed" }, "No rubric evaluation available for this claim.")))
|
|
27570
28019
|
), /* @__PURE__ */ React249.createElement(
|
|
27571
|
-
|
|
28020
|
+
Box49,
|
|
27572
28021
|
{
|
|
27573
28022
|
p: "sm",
|
|
27574
28023
|
style: {
|
|
@@ -27577,27 +28026,45 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27577
28026
|
}
|
|
27578
28027
|
},
|
|
27579
28028
|
/* @__PURE__ */ React249.createElement(UnstyledButton3, { onClick: () => setEvaluationOpen((v) => !v), style: { width: "100%" } }, /* @__PURE__ */ React249.createElement(Group92, { gap: "xs", align: "center" }, evaluationOpen ? /* @__PURE__ */ React249.createElement(IconChevronDown10, { size: 16 }) : /* @__PURE__ */ React249.createElement(IconChevronRight12, { size: 16 }), /* @__PURE__ */ React249.createElement(Text141, { fw: 500, size: "sm" }, "Evaluation"))),
|
|
27580
|
-
/* @__PURE__ */ React249.createElement(Collapse9, { in: evaluationOpen }, /* @__PURE__ */ React249.createElement(Stack167, { gap: "md", mt: "sm" }, /* @__PURE__ */ React249.createElement(Divider26, { color: "rgba(255,255,255,0.06)" }), /* @__PURE__ */ React249.createElement(Text141, { size: "xs", c: "dimmed" }, "Payment"), /* @__PURE__ */ React249.createElement(Group92, { justify: "space-between", align: "center" }, /* @__PURE__ */ React249.createElement(Text141, { size: "sm" }, "Token"), /* @__PURE__ */ React249.createElement(
|
|
28029
|
+
/* @__PURE__ */ React249.createElement(Collapse9, { in: evaluationOpen }, /* @__PURE__ */ React249.createElement(Stack167, { gap: "md", mt: "sm" }, /* @__PURE__ */ React249.createElement(Divider26, { color: "rgba(255,255,255,0.06)" }), /* @__PURE__ */ React249.createElement(Text141, { size: "xs", c: "dimmed" }, "Payment (optional custom payouts)"), paymentRows.map((row, index) => /* @__PURE__ */ React249.createElement(Stack167, { key: row.id, gap: 8 }, /* @__PURE__ */ React249.createElement(Group92, { justify: "space-between", align: "center" }, /* @__PURE__ */ React249.createElement(Text141, { size: "sm" }, "Token ", index + 1), paymentRows.length > 1 && /* @__PURE__ */ React249.createElement(Button46, { variant: "subtle", size: "compact-xs", color: "red", onClick: () => removePaymentRow(row.id), disabled: isDisabled || submitting }, "Remove")), /* @__PURE__ */ React249.createElement(
|
|
27581
28030
|
BaseSelect,
|
|
27582
28031
|
{
|
|
27583
|
-
value:
|
|
27584
|
-
onChange:
|
|
28032
|
+
value: row.denom,
|
|
28033
|
+
onChange: (value) => updatePaymentRow(row.id, { denom: value }),
|
|
27585
28034
|
data: [
|
|
27586
28035
|
{ value: USDC_DENOM5, label: "USDC" },
|
|
27587
|
-
{ value: IXO_DENOM5, label: "IXO" }
|
|
28036
|
+
{ value: IXO_DENOM5, label: "IXO" },
|
|
28037
|
+
{ value: CUSTOM_DENOM2, label: "Custom" }
|
|
27588
28038
|
],
|
|
27589
28039
|
clearable: false,
|
|
27590
|
-
|
|
28040
|
+
disabled: isDisabled || submitting
|
|
28041
|
+
}
|
|
28042
|
+
), row.denom === CUSTOM_DENOM2 && /* @__PURE__ */ React249.createElement(
|
|
28043
|
+
BaseTextInput,
|
|
28044
|
+
{
|
|
28045
|
+
placeholder: "Custom denom (e.g. ibc/... or uixo)",
|
|
28046
|
+
value: row.customDenom,
|
|
28047
|
+
onChange: (event) => updatePaymentRow(row.id, { customDenom: event.currentTarget.value }),
|
|
28048
|
+
disabled: isDisabled || submitting
|
|
28049
|
+
}
|
|
28050
|
+
), /* @__PURE__ */ React249.createElement(
|
|
28051
|
+
BaseNumberInput,
|
|
28052
|
+
{
|
|
28053
|
+
min: 0,
|
|
28054
|
+
value: row.amount,
|
|
28055
|
+
onChange: (value) => updatePaymentRow(row.id, { amount: value }),
|
|
28056
|
+
placeholder: "Amount",
|
|
28057
|
+
disabled: isDisabled || submitting
|
|
27591
28058
|
}
|
|
27592
|
-
)), /* @__PURE__ */ React249.createElement(
|
|
27593
|
-
), isClaimAlreadyEvaluated && /* @__PURE__ */ React249.createElement(Alert45, { color: "yellow" }, "This claim is already evaluated. Re-evaluation is disabled."), /* @__PURE__ */ React249.createElement(Group92, { gap: "xs" }, /* @__PURE__ */ React249.createElement(
|
|
28059
|
+
))), /* @__PURE__ */ React249.createElement(Button46, { variant: "light", size: "xs", onClick: addPaymentRow, disabled: isDisabled || submitting }, "Add Payment"), /* @__PURE__ */ React249.createElement(Checkbox13, { label: "Generate UDID proof before evaluation", checked: createUdid, onChange: (event) => setCreateUdid(event.currentTarget.checked) })))
|
|
28060
|
+
), isClaimAlreadyEvaluated && /* @__PURE__ */ React249.createElement(Alert45, { color: "yellow", styles: actionAlertStyles }, "This claim is already evaluated. Re-evaluation is disabled."), !authChecking && !isEvaluatorAuthorized && /* @__PURE__ */ React249.createElement(Alert45, { color: "yellow", styles: actionAlertStyles }, "You need evaluator authorization for this collection to approve or reject claims."), /* @__PURE__ */ React249.createElement(Group92, { gap: "xs" }, /* @__PURE__ */ React249.createElement(
|
|
27594
28061
|
Button46,
|
|
27595
28062
|
{
|
|
27596
28063
|
variant: "filled",
|
|
27597
28064
|
color: "dark",
|
|
27598
28065
|
leftSection: /* @__PURE__ */ React249.createElement(IconThumbUp3, { size: 16 }),
|
|
27599
28066
|
onClick: () => executeEvaluation("approve"),
|
|
27600
|
-
disabled: isDisabled || submitting || !adminAddress || isClaimAlreadyEvaluated,
|
|
28067
|
+
disabled: isDisabled || submitting || authChecking || !isEvaluatorAuthorized || !adminAddress || isClaimAlreadyEvaluated,
|
|
27601
28068
|
styles: {
|
|
27602
28069
|
root: {
|
|
27603
28070
|
backgroundColor: "var(--mantine-color-dark-6)",
|
|
@@ -27614,7 +28081,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27614
28081
|
color: "dark",
|
|
27615
28082
|
leftSection: /* @__PURE__ */ React249.createElement(IconThumbDown2, { size: 16 }),
|
|
27616
28083
|
onClick: () => executeEvaluation("reject"),
|
|
27617
|
-
disabled: isDisabled || submitting || !adminAddress || isClaimAlreadyEvaluated,
|
|
28084
|
+
disabled: isDisabled || submitting || authChecking || !isEvaluatorAuthorized || !adminAddress || isClaimAlreadyEvaluated,
|
|
27618
28085
|
styles: {
|
|
27619
28086
|
root: {
|
|
27620
28087
|
backgroundColor: "var(--mantine-color-dark-6)",
|
|
@@ -27624,7 +28091,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27624
28091
|
}
|
|
27625
28092
|
},
|
|
27626
28093
|
"Reject"
|
|
27627
|
-
)), error && /* @__PURE__ */ React249.createElement(Alert45, { color: "red"
|
|
28094
|
+
)), error && /* @__PURE__ */ React249.createElement(Alert45, { color: "red", styles: actionAlertStyles }, error));
|
|
27628
28095
|
}
|
|
27629
28096
|
const filterTabs = [
|
|
27630
28097
|
{ value: "all", label: "All" },
|
|
@@ -27632,7 +28099,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27632
28099
|
{ value: "approved", label: "Approved" },
|
|
27633
28100
|
{ value: "rejected", label: "Rejected" }
|
|
27634
28101
|
];
|
|
27635
|
-
return /* @__PURE__ */ React249.createElement(Stack167, { gap: "md" }, !deedDid || !collectionId ? /* @__PURE__ */ React249.createElement(Alert45, { color: "yellow" }, "Configure DID and claim collection in template mode before running this action.") : /* @__PURE__ */ React249.createElement(React249.Fragment, null, /* @__PURE__ */ React249.createElement(Group92, { justify: "space-between", align: "center" }, /* @__PURE__ */ React249.createElement(Group92, { gap: 0 }, filterTabs.map((tab) => /* @__PURE__ */ React249.createElement(
|
|
28102
|
+
return /* @__PURE__ */ React249.createElement(Stack167, { gap: "md" }, !deedDid || !collectionId ? /* @__PURE__ */ React249.createElement(Alert45, { color: "yellow", styles: actionAlertStyles }, "Configure DID and claim collection in template mode before running this action.") : /* @__PURE__ */ React249.createElement(React249.Fragment, null, /* @__PURE__ */ React249.createElement(Group92, { justify: "space-between", align: "center" }, /* @__PURE__ */ React249.createElement(Group92, { gap: 0 }, filterTabs.map((tab) => /* @__PURE__ */ React249.createElement(
|
|
27636
28103
|
UnstyledButton3,
|
|
27637
28104
|
{
|
|
27638
28105
|
key: tab.value,
|
|
@@ -27647,9 +28114,12 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27647
28114
|
},
|
|
27648
28115
|
/* @__PURE__ */ React249.createElement(Text141, { size: "sm", fw: 500, c: activeFilter === tab.value ? "white" : "dimmed" }, tab.label)
|
|
27649
28116
|
))), /* @__PURE__ */ React249.createElement(ActionIcon34, { variant: "subtle", color: "gray", size: "sm" }, /* @__PURE__ */ React249.createElement(IconFilter2, { size: 16 }))), loadingClaims && /* @__PURE__ */ React249.createElement(Group92, { gap: "xs", justify: "center", py: "md" }, /* @__PURE__ */ React249.createElement(Loader44, { size: "xs" }), /* @__PURE__ */ React249.createElement(Text141, { size: "xs", c: "dimmed" }, "Loading claims...")), !loadingClaims && filteredClaims.length === 0 && /* @__PURE__ */ React249.createElement(Text141, { size: "sm", c: "dimmed", ta: "center", py: "md" }, claims.length === 0 ? "No claims available for this collection." : `No ${activeFilter} claims found.`), filteredClaims.length > 0 && /* @__PURE__ */ React249.createElement(Stack167, { gap: 12 }, filteredClaims.map((claim) => {
|
|
27650
|
-
const status =
|
|
28117
|
+
const status = getClaimStatusInfo(claim);
|
|
28118
|
+
const profile = profilesByDid[claim.agentDid];
|
|
28119
|
+
const displayName = profile?.displayname || claim.agentDid || claim.agentAddress;
|
|
28120
|
+
const avatarLabel = (profile?.displayname || claim.agentDid || claim.agentAddress || "?")[0]?.toUpperCase();
|
|
27651
28121
|
return /* @__PURE__ */ React249.createElement(ListItemContainer, { key: claim.claimId, isChecked: false, onClick: () => setSelectedClaimId(claim.claimId) }, /* @__PURE__ */ React249.createElement(Group92, { gap: 16, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React249.createElement(
|
|
27652
|
-
|
|
28122
|
+
Box49,
|
|
27653
28123
|
{
|
|
27654
28124
|
style: {
|
|
27655
28125
|
width: 32,
|
|
@@ -27662,12 +28132,15 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27662
28132
|
flexShrink: 0,
|
|
27663
28133
|
fontSize: 14,
|
|
27664
28134
|
fontWeight: 500,
|
|
27665
|
-
color: "#adb5bd"
|
|
28135
|
+
color: "#adb5bd",
|
|
28136
|
+
backgroundImage: profile?.avatarUrl ? `url(${profile.avatarUrl})` : void 0,
|
|
28137
|
+
backgroundSize: "cover",
|
|
28138
|
+
backgroundPosition: "center"
|
|
27666
28139
|
}
|
|
27667
28140
|
},
|
|
27668
|
-
|
|
27669
|
-
), /* @__PURE__ */ React249.createElement(Stack167, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React249.createElement(Text141, { fw: 500, size: "md", truncate: true, style: { lineHeight: 1.5 } },
|
|
27670
|
-
}))), error && /* @__PURE__ */ React249.createElement(Alert45, { color: "red" }, error), runtime.error?.message && /* @__PURE__ */ React249.createElement(Alert45, { color: "red" }, runtime.error.message));
|
|
28141
|
+
profile?.avatarUrl ? null : avatarLabel
|
|
28142
|
+
), /* @__PURE__ */ React249.createElement(Stack167, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React249.createElement(Text141, { fw: 500, size: "md", truncate: true, style: { lineHeight: 1.5 } }, displayName), /* @__PURE__ */ React249.createElement(Text141, { size: "xs", c: "dimmed", truncate: true }, truncateAddress3(claim.agentAddress)))), /* @__PURE__ */ React249.createElement(Stack167, { gap: 0, align: "flex-end", style: { flexShrink: 0, minWidth: 80 } }, /* @__PURE__ */ React249.createElement(Text141, { fw: 500, size: "md", c: status.color, style: { lineHeight: 1.5 } }, status.key === "approved" && /* @__PURE__ */ React249.createElement(IconCheck19, { size: 14, style: { verticalAlign: "middle", marginRight: 2 } }), status.label), /* @__PURE__ */ React249.createElement(Text141, { size: "xs", c: "dimmed" }, getTimeAgo3(claim.submissionDate || ""))));
|
|
28143
|
+
}))), error && /* @__PURE__ */ React249.createElement(Alert45, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && /* @__PURE__ */ React249.createElement(Alert45, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
27671
28144
|
};
|
|
27672
28145
|
|
|
27673
28146
|
// src/mantine/blocks/action/actionTypes/evaluateClaim/index.ts
|
|
@@ -27676,12 +28149,251 @@ registerActionTypeUI("evaluateClaim", {
|
|
|
27676
28149
|
flowDetailComponent: EvaluateClaimFlowDetail
|
|
27677
28150
|
});
|
|
27678
28151
|
|
|
28152
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/FormSubmitConfig.tsx
|
|
28153
|
+
import React250, { useCallback as useCallback82, useEffect as useEffect82, useState as useState100 } from "react";
|
|
28154
|
+
import { Stack as Stack168, Text as Text142 } from "@mantine/core";
|
|
28155
|
+
|
|
28156
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/types.ts
|
|
28157
|
+
function parseFormSubmitActionInputs(json) {
|
|
28158
|
+
try {
|
|
28159
|
+
const parsed = typeof json === "string" ? JSON.parse(json) : json;
|
|
28160
|
+
const rawSchema = parsed?.surveySchema;
|
|
28161
|
+
if (typeof rawSchema === "string") {
|
|
28162
|
+
return { surveySchema: rawSchema };
|
|
28163
|
+
}
|
|
28164
|
+
if (rawSchema && typeof rawSchema === "object" && !Array.isArray(rawSchema)) {
|
|
28165
|
+
return { surveySchema: JSON.stringify(rawSchema, null, 2) };
|
|
28166
|
+
}
|
|
28167
|
+
return { surveySchema: "" };
|
|
28168
|
+
} catch {
|
|
28169
|
+
return { surveySchema: "" };
|
|
28170
|
+
}
|
|
28171
|
+
}
|
|
28172
|
+
function serializeFormSubmitActionInputs(inputs) {
|
|
28173
|
+
return JSON.stringify({
|
|
28174
|
+
surveySchema: inputs.surveySchema
|
|
28175
|
+
});
|
|
28176
|
+
}
|
|
28177
|
+
|
|
28178
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/FormSubmitConfig.tsx
|
|
28179
|
+
function isValidSchemaJson(value) {
|
|
28180
|
+
try {
|
|
28181
|
+
const parsed = JSON.parse(value);
|
|
28182
|
+
return !!parsed && typeof parsed === "object" && !Array.isArray(parsed);
|
|
28183
|
+
} catch {
|
|
28184
|
+
return false;
|
|
28185
|
+
}
|
|
28186
|
+
}
|
|
28187
|
+
var FormSubmitConfig = ({ inputs, onInputsChange }) => {
|
|
28188
|
+
const [localSchema, setLocalSchema] = useState100(() => parseFormSubmitActionInputs(inputs).surveySchema);
|
|
28189
|
+
const [error, setError] = useState100(null);
|
|
28190
|
+
useEffect82(() => {
|
|
28191
|
+
setLocalSchema(parseFormSubmitActionInputs(inputs).surveySchema);
|
|
28192
|
+
setError(null);
|
|
28193
|
+
}, [inputs]);
|
|
28194
|
+
const handleChange = useCallback82(
|
|
28195
|
+
(value) => {
|
|
28196
|
+
setLocalSchema(value);
|
|
28197
|
+
setError(null);
|
|
28198
|
+
if (!value.trim()) {
|
|
28199
|
+
onInputsChange(serializeFormSubmitActionInputs({ surveySchema: "" }));
|
|
28200
|
+
return;
|
|
28201
|
+
}
|
|
28202
|
+
if (!isValidSchemaJson(value)) {
|
|
28203
|
+
setError("Survey schema must be a valid JSON object");
|
|
28204
|
+
return;
|
|
28205
|
+
}
|
|
28206
|
+
onInputsChange(serializeFormSubmitActionInputs({ surveySchema: value }));
|
|
28207
|
+
},
|
|
28208
|
+
[onInputsChange]
|
|
28209
|
+
);
|
|
28210
|
+
return /* @__PURE__ */ React250.createElement(Stack168, { gap: "xs" }, /* @__PURE__ */ React250.createElement(
|
|
28211
|
+
BaseTextArea,
|
|
28212
|
+
{
|
|
28213
|
+
label: "Survey Schema (JSON)",
|
|
28214
|
+
description: "Paste the SurveyJS schema JSON that should be rendered in flow mode.",
|
|
28215
|
+
placeholder: '{"elements":[{"type":"text","name":"name","title":"Your name"}]}',
|
|
28216
|
+
minRows: 10,
|
|
28217
|
+
value: localSchema,
|
|
28218
|
+
onChange: (event) => handleChange(event.currentTarget.value),
|
|
28219
|
+
error
|
|
28220
|
+
}
|
|
28221
|
+
), localSchema && !error && /* @__PURE__ */ React250.createElement(Text142, { size: "xs", c: "green" }, "\u2713 Valid JSON object"));
|
|
28222
|
+
};
|
|
28223
|
+
|
|
28224
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/FormSubmitFlowDetail.tsx
|
|
28225
|
+
import React251, { useCallback as useCallback83, useEffect as useEffect83, useMemo as useMemo97, useState as useState101 } from "react";
|
|
28226
|
+
import { Alert as Alert46, Loader as Loader45, Stack as Stack169, Text as Text143 } from "@mantine/core";
|
|
28227
|
+
import { Survey as Survey12, SurveyModel as SurveyModel12 } from "@ixo/surveys";
|
|
28228
|
+
var FormSubmitFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
28229
|
+
const handlers = useBlocknoteHandlers();
|
|
28230
|
+
const services = useMemo97(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
28231
|
+
const flowNode = useMemo97(() => buildFlowNodeFromBlock(block), [block]);
|
|
28232
|
+
const runtimeManager = useMemo97(() => createRuntimeStateManager(editor), [editor]);
|
|
28233
|
+
const ucanManager = useMemo97(() => new SimpleUCANManager(), []);
|
|
28234
|
+
const delegationStore = useMemo97(() => {
|
|
28235
|
+
if (!editor?._yDelegations) return void 0;
|
|
28236
|
+
return createDelegationStore(editor._yDelegations);
|
|
28237
|
+
}, [editor?._yDelegations]);
|
|
28238
|
+
const verifySignature = useMemo97(() => {
|
|
28239
|
+
if (!handlers?.verifyCapabilitySignature) return void 0;
|
|
28240
|
+
return async (capabilityRaw, issuerDid) => handlers.verifyCapabilitySignature({ capabilityRaw, issuerDid });
|
|
28241
|
+
}, [handlers]);
|
|
28242
|
+
const flowOwnerDid = useMemo97(() => editor?.getFlowOwnerDid?.() || "", [editor]);
|
|
28243
|
+
const flowUri = useMemo97(() => {
|
|
28244
|
+
const docId = editor?.getFlowMetadata?.()?.doc_id || block.id;
|
|
28245
|
+
return `ixo:flow:${docId}`;
|
|
28246
|
+
}, [editor, block.id]);
|
|
28247
|
+
const actorDid = useMemo97(() => {
|
|
28248
|
+
try {
|
|
28249
|
+
return handlers?.getCurrentUser?.()?.address || "";
|
|
28250
|
+
} catch {
|
|
28251
|
+
return "";
|
|
28252
|
+
}
|
|
28253
|
+
}, [handlers]);
|
|
28254
|
+
const parsed = useMemo97(() => parseFormSubmitActionInputs(inputs), [inputs]);
|
|
28255
|
+
const editorDocument = editor?.document || [];
|
|
28256
|
+
const resolveOpts = useMemo97(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
28257
|
+
const resolvedSchemaString = useMemo97(() => resolveReferences(parsed.surveySchema || "", editorDocument, resolveOpts).trim(), [parsed.surveySchema, editorDocument, resolveOpts]);
|
|
28258
|
+
const [submitting, setSubmitting] = useState101(false);
|
|
28259
|
+
const [error, setError] = useState101(null);
|
|
28260
|
+
const parsedSchema = useMemo97(() => {
|
|
28261
|
+
if (!resolvedSchemaString) return null;
|
|
28262
|
+
try {
|
|
28263
|
+
const schema = JSON.parse(resolvedSchemaString);
|
|
28264
|
+
if (!schema || typeof schema !== "object" || Array.isArray(schema)) return null;
|
|
28265
|
+
return schema;
|
|
28266
|
+
} catch {
|
|
28267
|
+
return null;
|
|
28268
|
+
}
|
|
28269
|
+
}, [resolvedSchemaString]);
|
|
28270
|
+
const surveyModel = useMemo97(() => {
|
|
28271
|
+
if (!parsedSchema) return null;
|
|
28272
|
+
const model = new SurveyModel12(parsedSchema);
|
|
28273
|
+
model.applyTheme(surveyTheme);
|
|
28274
|
+
model.showQuestionNumbers = "off";
|
|
28275
|
+
model.questionsOnPageMode = "singlePage";
|
|
28276
|
+
model.completeText = "Execute";
|
|
28277
|
+
if (isDisabled || submitting) {
|
|
28278
|
+
model.mode = "display";
|
|
28279
|
+
model.showCompleteButton = false;
|
|
28280
|
+
}
|
|
28281
|
+
return model;
|
|
28282
|
+
}, [parsedSchema, isDisabled, submitting]);
|
|
28283
|
+
const handleSurveyComplete = useCallback83(
|
|
28284
|
+
async (sender) => {
|
|
28285
|
+
if (isDisabled || submitting) return;
|
|
28286
|
+
const actionType = String(block?.props?.actionType || "form.submit");
|
|
28287
|
+
const actionDef = getAction(actionType) || getAction("form.submit");
|
|
28288
|
+
if (!actionDef) {
|
|
28289
|
+
setError(`${actionType} action is not registered`);
|
|
28290
|
+
return;
|
|
28291
|
+
}
|
|
28292
|
+
setSubmitting(true);
|
|
28293
|
+
setError(null);
|
|
28294
|
+
updateRuntime({ state: "running", error: void 0 });
|
|
28295
|
+
try {
|
|
28296
|
+
const outcome = await executeNode({
|
|
28297
|
+
node: flowNode,
|
|
28298
|
+
actorDid,
|
|
28299
|
+
context: {
|
|
28300
|
+
runtime: runtimeManager,
|
|
28301
|
+
ucanManager,
|
|
28302
|
+
delegationStore,
|
|
28303
|
+
verifySignature,
|
|
28304
|
+
rootIssuer: flowOwnerDid || void 0,
|
|
28305
|
+
flowUri
|
|
28306
|
+
},
|
|
28307
|
+
action: async () => {
|
|
28308
|
+
const result = await actionDef.run(
|
|
28309
|
+
{
|
|
28310
|
+
answers: sender.data || {}
|
|
28311
|
+
},
|
|
28312
|
+
{
|
|
28313
|
+
actorDid,
|
|
28314
|
+
flowId: flowUri,
|
|
28315
|
+
nodeId: block.id,
|
|
28316
|
+
services,
|
|
28317
|
+
flowNode,
|
|
28318
|
+
runtime: runtimeManager,
|
|
28319
|
+
delegationStore,
|
|
28320
|
+
verifySignature,
|
|
28321
|
+
rootIssuer: flowOwnerDid || void 0,
|
|
28322
|
+
flowUri,
|
|
28323
|
+
handlers,
|
|
28324
|
+
editor
|
|
28325
|
+
}
|
|
28326
|
+
);
|
|
28327
|
+
return {
|
|
28328
|
+
payload: result.output,
|
|
28329
|
+
submittedByDid: actorDid || void 0
|
|
28330
|
+
};
|
|
28331
|
+
}
|
|
28332
|
+
});
|
|
28333
|
+
if (!outcome.success) {
|
|
28334
|
+
throw new Error(outcome.error || "Form submit execution failed");
|
|
28335
|
+
}
|
|
28336
|
+
updateRuntime({
|
|
28337
|
+
state: "completed",
|
|
28338
|
+
executedAt: Date.now(),
|
|
28339
|
+
output: outcome.result?.payload || {}
|
|
28340
|
+
});
|
|
28341
|
+
} catch (err) {
|
|
28342
|
+
const message = err instanceof Error ? err.message : "Failed to execute form submit";
|
|
28343
|
+
setError(message);
|
|
28344
|
+
updateRuntime({
|
|
28345
|
+
state: "failed",
|
|
28346
|
+
error: { message, at: Date.now() }
|
|
28347
|
+
});
|
|
28348
|
+
} finally {
|
|
28349
|
+
setSubmitting(false);
|
|
28350
|
+
}
|
|
28351
|
+
},
|
|
28352
|
+
[
|
|
28353
|
+
actorDid,
|
|
28354
|
+
block,
|
|
28355
|
+
delegationStore,
|
|
28356
|
+
editor,
|
|
28357
|
+
flowNode,
|
|
28358
|
+
flowOwnerDid,
|
|
28359
|
+
flowUri,
|
|
28360
|
+
handlers,
|
|
28361
|
+
isDisabled,
|
|
28362
|
+
runtimeManager,
|
|
28363
|
+
services,
|
|
28364
|
+
submitting,
|
|
28365
|
+
ucanManager,
|
|
28366
|
+
updateRuntime,
|
|
28367
|
+
verifySignature
|
|
28368
|
+
]
|
|
28369
|
+
);
|
|
28370
|
+
useEffect83(() => {
|
|
28371
|
+
if (!surveyModel) return void 0;
|
|
28372
|
+
surveyModel.onComplete.add(handleSurveyComplete);
|
|
28373
|
+
return () => {
|
|
28374
|
+
surveyModel.onComplete.remove(handleSurveyComplete);
|
|
28375
|
+
};
|
|
28376
|
+
}, [surveyModel, handleSurveyComplete]);
|
|
28377
|
+
const statusMessage = runtime.state === "completed" ? "Last execution completed." : submitting ? "Executing..." : null;
|
|
28378
|
+
return /* @__PURE__ */ React251.createElement(Stack169, { gap: "md" }, /* @__PURE__ */ React251.createElement(Stack169, { gap: 2 }, /* @__PURE__ */ React251.createElement(Text143, { fw: 600 }, block?.props?.title || "Form Submit Action"), /* @__PURE__ */ React251.createElement(Text143, { size: "sm", c: "dimmed" }, block?.props?.description || "Complete the form to execute this action.")), !resolvedSchemaString ? /* @__PURE__ */ React251.createElement(Alert46, { color: "yellow", styles: actionAlertStyles }, "Configure Survey Schema JSON in template mode before running this action.") : !parsedSchema ? /* @__PURE__ */ React251.createElement(Alert46, { color: "red", styles: actionAlertStyles }, "Survey schema is invalid JSON. Fix it in template mode.") : /* @__PURE__ */ React251.createElement(Survey12, { model: surveyModel }), statusMessage && /* @__PURE__ */ React251.createElement(Stack169, { gap: 4 }, submitting && /* @__PURE__ */ React251.createElement(Loader45, { size: "xs" }), /* @__PURE__ */ React251.createElement(Text143, { size: "xs", c: "dimmed" }, statusMessage)), error && /* @__PURE__ */ React251.createElement(Alert46, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && /* @__PURE__ */ React251.createElement(Alert46, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
28379
|
+
};
|
|
28380
|
+
|
|
28381
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/index.ts
|
|
28382
|
+
registerActionTypeUI("form.submit", {
|
|
28383
|
+
configComponent: FormSubmitConfig,
|
|
28384
|
+
flowDetailComponent: FormSubmitFlowDetail
|
|
28385
|
+
});
|
|
28386
|
+
registerActionTypeUI("human.form.submit", {
|
|
28387
|
+
configComponent: FormSubmitConfig,
|
|
28388
|
+
flowDetailComponent: FormSubmitFlowDetail
|
|
28389
|
+
});
|
|
28390
|
+
|
|
27679
28391
|
// src/mantine/blocks/action/ActionBlock.tsx
|
|
27680
28392
|
function ActionBlock({ editor, block }) {
|
|
27681
28393
|
const { docType } = useBlocknoteContext();
|
|
27682
28394
|
const { actions: actions2 } = useBlockConditions(block, editor);
|
|
27683
28395
|
if (docType === "template") {
|
|
27684
|
-
return /* @__PURE__ */
|
|
28396
|
+
return /* @__PURE__ */ React252.createElement(ActionTemplateView, { editor, block });
|
|
27685
28397
|
}
|
|
27686
28398
|
const conditionConfig = parseConditionConfig(block.props.conditions);
|
|
27687
28399
|
const hasVisibility = hasVisibilityConditions(conditionConfig);
|
|
@@ -27692,7 +28404,7 @@ function ActionBlock({ editor, block }) {
|
|
|
27692
28404
|
const hasEnable = hasEnableConditions(conditionConfig);
|
|
27693
28405
|
const enableActionExists = actions2.some((a) => a.action === "enable");
|
|
27694
28406
|
const shouldDisable = hasEnable && !enableActionExists;
|
|
27695
|
-
return /* @__PURE__ */
|
|
28407
|
+
return /* @__PURE__ */ React252.createElement(
|
|
27696
28408
|
ActionFlowView,
|
|
27697
28409
|
{
|
|
27698
28410
|
block,
|
|
@@ -27728,6 +28440,9 @@ var ActionBlockSpec = createReactBlockSpec21(
|
|
|
27728
28440
|
requiresConfirmation: {
|
|
27729
28441
|
default: ""
|
|
27730
28442
|
},
|
|
28443
|
+
skill: {
|
|
28444
|
+
default: ""
|
|
28445
|
+
},
|
|
27731
28446
|
conditions: {
|
|
27732
28447
|
default: ""
|
|
27733
28448
|
},
|
|
@@ -27759,36 +28474,36 @@ var ActionBlockSpec = createReactBlockSpec21(
|
|
|
27759
28474
|
{
|
|
27760
28475
|
render: (props) => {
|
|
27761
28476
|
const ixoProps = props;
|
|
27762
|
-
return /* @__PURE__ */
|
|
28477
|
+
return /* @__PURE__ */ React253.createElement(ActionBlock, { ...ixoProps });
|
|
27763
28478
|
}
|
|
27764
28479
|
}
|
|
27765
28480
|
);
|
|
27766
28481
|
|
|
27767
28482
|
// src/mantine/blocks/location/LocationBlockSpec.tsx
|
|
27768
|
-
import
|
|
28483
|
+
import React261 from "react";
|
|
27769
28484
|
import { createReactBlockSpec as createReactBlockSpec22 } from "@blocknote/react";
|
|
27770
28485
|
|
|
27771
28486
|
// src/mantine/blocks/location/LocationBlock.tsx
|
|
27772
|
-
import
|
|
28487
|
+
import React260 from "react";
|
|
27773
28488
|
|
|
27774
28489
|
// src/mantine/blocks/location/template/TemplateView.tsx
|
|
27775
|
-
import
|
|
27776
|
-
import { Group as Group93, Stack as
|
|
28490
|
+
import React257, { useMemo as useMemo98 } from "react";
|
|
28491
|
+
import { Group as Group93, Stack as Stack171, Text as Text146 } from "@mantine/core";
|
|
27777
28492
|
import { IconMapPin } from "@tabler/icons-react";
|
|
27778
28493
|
|
|
27779
28494
|
// src/mantine/blocks/location/template/TemplateConfig.tsx
|
|
27780
|
-
import
|
|
28495
|
+
import React255, { useCallback as useCallback84 } from "react";
|
|
27781
28496
|
import { IconSettings as IconSettings20 } from "@tabler/icons-react";
|
|
27782
28497
|
|
|
27783
28498
|
// src/mantine/blocks/location/template/GeneralTab.tsx
|
|
27784
|
-
import
|
|
27785
|
-
import { Box as
|
|
28499
|
+
import React254, { useEffect as useEffect85, useRef as useRef23, useState as useState103 } from "react";
|
|
28500
|
+
import { Box as Box50, Divider as Divider27, Stack as Stack170, Text as Text144 } from "@mantine/core";
|
|
27786
28501
|
|
|
27787
28502
|
// src/core/hooks/useUnlMap.ts
|
|
27788
|
-
import { useEffect as
|
|
28503
|
+
import { useEffect as useEffect84, useState as useState102 } from "react";
|
|
27789
28504
|
function useUnlMap() {
|
|
27790
|
-
const [status, setStatus] =
|
|
27791
|
-
|
|
28505
|
+
const [status, setStatus] = useState102("loading");
|
|
28506
|
+
useEffect84(() => {
|
|
27792
28507
|
if (typeof window === "undefined") {
|
|
27793
28508
|
return;
|
|
27794
28509
|
}
|
|
@@ -27847,21 +28562,21 @@ var DEFAULT_CENTER = [0, 20];
|
|
|
27847
28562
|
var DEFAULT_ZOOM = 2;
|
|
27848
28563
|
var PLACED_ZOOM = 14;
|
|
27849
28564
|
var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, onDescriptionChange, onCoordinatesChange }) => {
|
|
27850
|
-
const [localTitle, setLocalTitle] =
|
|
27851
|
-
const [localDescription, setLocalDescription] =
|
|
27852
|
-
const [mapError, setMapError] =
|
|
28565
|
+
const [localTitle, setLocalTitle] = useState103(title);
|
|
28566
|
+
const [localDescription, setLocalDescription] = useState103(description);
|
|
28567
|
+
const [mapError, setMapError] = useState103(null);
|
|
27853
28568
|
const { status, UnlSdk } = useUnlMap();
|
|
27854
28569
|
const { mapConfig } = useBlocknoteContext();
|
|
27855
28570
|
const markerRef = useRef23(null);
|
|
27856
28571
|
const mapRef = useRef23(null);
|
|
27857
28572
|
const containerRef = useRef23(null);
|
|
27858
|
-
|
|
28573
|
+
useEffect85(() => {
|
|
27859
28574
|
setLocalTitle(title);
|
|
27860
28575
|
}, [title]);
|
|
27861
|
-
|
|
28576
|
+
useEffect85(() => {
|
|
27862
28577
|
setLocalDescription(description);
|
|
27863
28578
|
}, [description]);
|
|
27864
|
-
|
|
28579
|
+
useEffect85(() => {
|
|
27865
28580
|
if (status !== "ready" || !UnlSdk || mapRef.current || !mapConfig || !containerRef.current) return;
|
|
27866
28581
|
try {
|
|
27867
28582
|
const hasCoords = latitude && longitude;
|
|
@@ -27907,7 +28622,7 @@ var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
27907
28622
|
markerRef.current = null;
|
|
27908
28623
|
};
|
|
27909
28624
|
}, [status, UnlSdk]);
|
|
27910
|
-
return /* @__PURE__ */
|
|
28625
|
+
return /* @__PURE__ */ React254.createElement(Stack170, { gap: "lg" }, /* @__PURE__ */ React254.createElement(Stack170, { gap: "xs" }, /* @__PURE__ */ React254.createElement(Text144, { size: "sm", fw: 600 }, "Title"), /* @__PURE__ */ React254.createElement(
|
|
27911
28626
|
BaseTextInput,
|
|
27912
28627
|
{
|
|
27913
28628
|
placeholder: "e.g. Project Location",
|
|
@@ -27918,7 +28633,7 @@ var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
27918
28633
|
onTitleChange(v);
|
|
27919
28634
|
}
|
|
27920
28635
|
}
|
|
27921
|
-
)), /* @__PURE__ */
|
|
28636
|
+
)), /* @__PURE__ */ React254.createElement(Stack170, { gap: "xs" }, /* @__PURE__ */ React254.createElement(Text144, { size: "sm", fw: 600 }, "Description"), /* @__PURE__ */ React254.createElement(
|
|
27922
28637
|
BaseTextInput,
|
|
27923
28638
|
{
|
|
27924
28639
|
placeholder: "e.g. Main project site coordinates",
|
|
@@ -27929,19 +28644,19 @@ var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
27929
28644
|
onDescriptionChange(v);
|
|
27930
28645
|
}
|
|
27931
28646
|
}
|
|
27932
|
-
)), /* @__PURE__ */
|
|
28647
|
+
)), /* @__PURE__ */ React254.createElement(Divider27, { variant: "dashed" }), /* @__PURE__ */ React254.createElement(Stack170, { gap: "xs" }, /* @__PURE__ */ React254.createElement(Text144, { size: "sm", fw: 600 }, "Location"), /* @__PURE__ */ React254.createElement(Text144, { size: "xs", c: "dimmed" }, "Click on the map to set the location."), mapError ? /* @__PURE__ */ React254.createElement(Text144, { size: "sm", c: "red" }, mapError) : /* @__PURE__ */ React254.createElement(Box50, { mx: "auto", w: "100%", miw: 280, h: 300, ref: containerRef, style: { borderRadius: 12 } })), /* @__PURE__ */ React254.createElement(Stack170, { gap: "xs" }, /* @__PURE__ */ React254.createElement(BaseTextInput, { label: "Latitude", value: latitude, readOnly: true, placeholder: "Not set" }), /* @__PURE__ */ React254.createElement(BaseTextInput, { label: "Longitude", value: longitude, readOnly: true, placeholder: "Not set" })));
|
|
27933
28648
|
};
|
|
27934
28649
|
|
|
27935
28650
|
// src/mantine/blocks/location/template/TemplateConfig.tsx
|
|
27936
28651
|
var TemplateConfig18 = ({ editor, block }) => {
|
|
27937
28652
|
const { closePanel } = usePanelStore();
|
|
27938
|
-
const updateProp =
|
|
28653
|
+
const updateProp = useCallback84(
|
|
27939
28654
|
(key, value) => {
|
|
27940
28655
|
editor.updateBlock(block, { props: { ...block.props, [key]: value } });
|
|
27941
28656
|
},
|
|
27942
28657
|
[editor, block]
|
|
27943
28658
|
);
|
|
27944
|
-
const updateProps =
|
|
28659
|
+
const updateProps = useCallback84(
|
|
27945
28660
|
(updates) => {
|
|
27946
28661
|
editor.updateBlock(block, { props: { ...block.props, ...updates } });
|
|
27947
28662
|
},
|
|
@@ -27952,7 +28667,7 @@ var TemplateConfig18 = ({ editor, block }) => {
|
|
|
27952
28667
|
label: "General",
|
|
27953
28668
|
value: "general",
|
|
27954
28669
|
icon: icon(IconSettings20),
|
|
27955
|
-
content: /* @__PURE__ */
|
|
28670
|
+
content: /* @__PURE__ */ React255.createElement(
|
|
27956
28671
|
GeneralTab18,
|
|
27957
28672
|
{
|
|
27958
28673
|
title: block.props.title || "",
|
|
@@ -27966,20 +28681,20 @@ var TemplateConfig18 = ({ editor, block }) => {
|
|
|
27966
28681
|
)
|
|
27967
28682
|
}
|
|
27968
28683
|
];
|
|
27969
|
-
return /* @__PURE__ */
|
|
28684
|
+
return /* @__PURE__ */ React255.createElement(BaseRightPanelLayout, { title: "Location Settings", onClose: closePanel, tabs, context: { editor, block } });
|
|
27970
28685
|
};
|
|
27971
28686
|
|
|
27972
28687
|
// src/mantine/blocks/location/components/LocationMap.tsx
|
|
27973
|
-
import
|
|
27974
|
-
import { Box as
|
|
28688
|
+
import React256, { useEffect as useEffect86, useRef as useRef24, useState as useState104 } from "react";
|
|
28689
|
+
import { Box as Box51, Flex as Flex32, Loader as Loader46, Text as Text145 } from "@mantine/core";
|
|
27975
28690
|
var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker = true }) => {
|
|
27976
|
-
const [mapError, setMapError] =
|
|
28691
|
+
const [mapError, setMapError] = useState104(null);
|
|
27977
28692
|
const { mapConfig } = useBlocknoteContext();
|
|
27978
28693
|
const containerRef = useRef24(null);
|
|
27979
28694
|
const mapRef = useRef24(null);
|
|
27980
28695
|
const markerRef = useRef24(null);
|
|
27981
28696
|
const { status, UnlSdk } = useUnlMap();
|
|
27982
|
-
|
|
28697
|
+
useEffect86(() => {
|
|
27983
28698
|
if (status !== "ready" || !UnlSdk || mapRef.current || !containerRef.current) return;
|
|
27984
28699
|
let ro;
|
|
27985
28700
|
try {
|
|
@@ -28006,7 +28721,7 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28006
28721
|
ro?.disconnect();
|
|
28007
28722
|
};
|
|
28008
28723
|
}, [status, UnlSdk, mapConfig]);
|
|
28009
|
-
|
|
28724
|
+
useEffect86(() => {
|
|
28010
28725
|
if (!mapRef.current || !latitude || !longitude) return;
|
|
28011
28726
|
const coords = [Number(longitude), Number(latitude)];
|
|
28012
28727
|
mapRef.current.setCenter(coords);
|
|
@@ -28015,8 +28730,8 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28015
28730
|
}
|
|
28016
28731
|
}, [latitude, longitude, showMarker]);
|
|
28017
28732
|
if (status === "loading") {
|
|
28018
|
-
return /* @__PURE__ */
|
|
28019
|
-
|
|
28733
|
+
return /* @__PURE__ */ React256.createElement(
|
|
28734
|
+
Box51,
|
|
28020
28735
|
{
|
|
28021
28736
|
style: {
|
|
28022
28737
|
borderRadius: 16,
|
|
@@ -28027,12 +28742,12 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28027
28742
|
w,
|
|
28028
28743
|
h
|
|
28029
28744
|
},
|
|
28030
|
-
/* @__PURE__ */
|
|
28745
|
+
/* @__PURE__ */ React256.createElement(Loader46, null)
|
|
28031
28746
|
);
|
|
28032
28747
|
}
|
|
28033
28748
|
if (status === "error" || mapError) {
|
|
28034
|
-
return /* @__PURE__ */
|
|
28035
|
-
|
|
28749
|
+
return /* @__PURE__ */ React256.createElement(
|
|
28750
|
+
Box51,
|
|
28036
28751
|
{
|
|
28037
28752
|
style: {
|
|
28038
28753
|
borderRadius: 16,
|
|
@@ -28043,58 +28758,58 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28043
28758
|
w,
|
|
28044
28759
|
h
|
|
28045
28760
|
},
|
|
28046
|
-
/* @__PURE__ */
|
|
28761
|
+
/* @__PURE__ */ React256.createElement(Text145, { size: "sm", c: "red" }, mapError || "Failed to load map")
|
|
28047
28762
|
);
|
|
28048
28763
|
}
|
|
28049
|
-
return /* @__PURE__ */
|
|
28764
|
+
return /* @__PURE__ */ React256.createElement(Box51, { ref: containerRef, style: { borderRadius: 16 }, w, h });
|
|
28050
28765
|
};
|
|
28051
28766
|
function LocationMap(props) {
|
|
28052
28767
|
if (props.latitude === void 0 || props.longitude === void 0)
|
|
28053
|
-
return /* @__PURE__ */
|
|
28054
|
-
return /* @__PURE__ */
|
|
28768
|
+
return /* @__PURE__ */ React256.createElement(Flex32, { w: "100%", h: 200, align: "center", justify: "center" }, /* @__PURE__ */ React256.createElement(Loader46, null));
|
|
28769
|
+
return /* @__PURE__ */ React256.createElement(UnlMap, { ...props });
|
|
28055
28770
|
}
|
|
28056
28771
|
|
|
28057
28772
|
// src/mantine/blocks/location/template/TemplateView.tsx
|
|
28058
28773
|
var LOCATION_TEMPLATE_PANEL_ID = "location-template-panel";
|
|
28059
28774
|
var LocationTemplateView = ({ editor, block }) => {
|
|
28060
28775
|
const panelId = `${LOCATION_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
28061
|
-
const panelContent =
|
|
28776
|
+
const panelContent = useMemo98(() => /* @__PURE__ */ React257.createElement(TemplateConfig18, { editor, block }), [editor, block]);
|
|
28062
28777
|
const { open } = usePanel(panelId, panelContent);
|
|
28063
28778
|
console.log("block.props:", block.props);
|
|
28064
28779
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
28065
|
-
return /* @__PURE__ */
|
|
28780
|
+
return /* @__PURE__ */ React257.createElement(BaseContainer, { onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React257.createElement(Stack171, { gap: "xs", justify: "center" }, /* @__PURE__ */ React257.createElement(Group93, { wrap: "nowrap", align: "center" }, /* @__PURE__ */ React257.createElement(IconMapPin, { color: "white", size: 26, stroke: 1.5 }), /* @__PURE__ */ React257.createElement(Stack171, { gap: 2 }, /* @__PURE__ */ React257.createElement(Text146, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Location"), block.props.description && /* @__PURE__ */ React257.createElement(Text146, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), hasLocation && /* @__PURE__ */ React257.createElement(LocationMap, { latitude: block.props.latitude, longitude: block.props.longitude, mapId: `location-template-map-${block.id}`, zoom: 14 })));
|
|
28066
28781
|
};
|
|
28067
28782
|
|
|
28068
28783
|
// src/mantine/blocks/location/flow/FlowView.tsx
|
|
28069
|
-
import
|
|
28070
|
-
import { Center as Center13, Group as Group94, Stack as
|
|
28784
|
+
import React259, { useMemo as useMemo99 } from "react";
|
|
28785
|
+
import { Center as Center13, Group as Group94, Stack as Stack172, Text as Text147 } from "@mantine/core";
|
|
28071
28786
|
import { IconMapPin as IconMapPin2 } from "@tabler/icons-react";
|
|
28072
28787
|
|
|
28073
28788
|
// src/mantine/blocks/location/flow/FlowConfig.tsx
|
|
28074
|
-
import
|
|
28789
|
+
import React258 from "react";
|
|
28075
28790
|
var FlowConfig2 = ({ block }) => {
|
|
28076
28791
|
const { closePanel } = usePanelStore();
|
|
28077
28792
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
28078
|
-
return /* @__PURE__ */
|
|
28793
|
+
return /* @__PURE__ */ React258.createElement(BaseRightPanelLayout, { title: block.props.title || "Location", onClose: closePanel, isTemplate: false }, hasLocation ? /* @__PURE__ */ React258.createElement(LocationMap, { latitude: block.props.latitude, longitude: block.props.longitude, h: 400, zoom: 14 }) : null);
|
|
28079
28794
|
};
|
|
28080
28795
|
|
|
28081
28796
|
// src/mantine/blocks/location/flow/FlowView.tsx
|
|
28082
28797
|
var LOCATION_FLOW_PANEL_ID = "location-flow-panel";
|
|
28083
28798
|
var LocationFlowView = ({ editor, block }) => {
|
|
28084
28799
|
const panelId = `${LOCATION_FLOW_PANEL_ID}-${block.id}`;
|
|
28085
|
-
const panelContent =
|
|
28800
|
+
const panelContent = useMemo99(() => /* @__PURE__ */ React259.createElement(FlowConfig2, { editor, block }), [editor, block]);
|
|
28086
28801
|
const { open } = usePanel(panelId, panelContent);
|
|
28087
28802
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
28088
|
-
return /* @__PURE__ */
|
|
28803
|
+
return /* @__PURE__ */ React259.createElement(BaseContainer, { onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React259.createElement(Stack172, { gap: "xs", justify: "center" }, /* @__PURE__ */ React259.createElement(Group94, { wrap: "nowrap", align: "center" }, /* @__PURE__ */ React259.createElement(IconMapPin2, { color: "white", size: 26, stroke: 1.5 }), /* @__PURE__ */ React259.createElement(Stack172, { gap: 2 }, /* @__PURE__ */ React259.createElement(Text147, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Location"), block.props.description && /* @__PURE__ */ React259.createElement(Text147, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), hasLocation ? /* @__PURE__ */ React259.createElement(LocationMap, { latitude: block.props.latitude, longitude: block.props.longitude, mapId: `location-flow-map-${block.id}`, zoom: 14 }) : /* @__PURE__ */ React259.createElement(Center13, { py: "md" }, /* @__PURE__ */ React259.createElement(Text147, { size: "sm", c: "dimmed" }, "Location not configured"))));
|
|
28089
28804
|
};
|
|
28090
28805
|
|
|
28091
28806
|
// src/mantine/blocks/location/LocationBlock.tsx
|
|
28092
28807
|
function LocationBlock({ editor, block }) {
|
|
28093
28808
|
const { docType } = useBlocknoteContext();
|
|
28094
28809
|
if (docType === "template") {
|
|
28095
|
-
return /* @__PURE__ */
|
|
28810
|
+
return /* @__PURE__ */ React260.createElement(LocationTemplateView, { editor, block });
|
|
28096
28811
|
}
|
|
28097
|
-
return /* @__PURE__ */
|
|
28812
|
+
return /* @__PURE__ */ React260.createElement(LocationFlowView, { editor, block });
|
|
28098
28813
|
}
|
|
28099
28814
|
|
|
28100
28815
|
// src/mantine/blocks/location/LocationBlockSpec.tsx
|
|
@@ -28113,7 +28828,7 @@ var LocationBlockSpec = createReactBlockSpec22(
|
|
|
28113
28828
|
{
|
|
28114
28829
|
render: (props) => {
|
|
28115
28830
|
const ixoProps = props;
|
|
28116
|
-
return /* @__PURE__ */
|
|
28831
|
+
return /* @__PURE__ */ React261.createElement(LocationBlock, { ...ixoProps });
|
|
28117
28832
|
}
|
|
28118
28833
|
}
|
|
28119
28834
|
);
|
|
@@ -28316,10 +29031,10 @@ blockRegistry.register({
|
|
|
28316
29031
|
});
|
|
28317
29032
|
|
|
28318
29033
|
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
28319
|
-
import { useMemo as
|
|
29034
|
+
import { useMemo as useMemo100, useEffect as useEffect87, useState as useState105, useCallback as useCallback85 } from "react";
|
|
28320
29035
|
|
|
28321
29036
|
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
28322
|
-
import { useMemo as
|
|
29037
|
+
import { useMemo as useMemo101 } from "react";
|
|
28323
29038
|
|
|
28324
29039
|
// src/mantine/blocks/index.ts
|
|
28325
29040
|
var blockSpecs = {
|
|
@@ -28934,15 +29649,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
|
|
|
28934
29649
|
import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
|
|
28935
29650
|
|
|
28936
29651
|
// src/core/hooks/useMatrixProvider.ts
|
|
28937
|
-
import { useEffect as
|
|
29652
|
+
import { useEffect as useEffect88, useState as useState106, useRef as useRef25, useCallback as useCallback86, useMemo as useMemo102 } from "react";
|
|
28938
29653
|
import { MatrixProvider } from "@ixo/matrix-crdt";
|
|
28939
29654
|
function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
28940
|
-
const [matrixProvider, setProvider] =
|
|
28941
|
-
const [status, setStatus] =
|
|
29655
|
+
const [matrixProvider, setProvider] = useState106(null);
|
|
29656
|
+
const [status, setStatus] = useState106("disconnected");
|
|
28942
29657
|
const isMountedRef = useRef25(true);
|
|
28943
29658
|
const providerRef = useRef25(null);
|
|
28944
29659
|
const retryTimeoutRef = useRef25(null);
|
|
28945
|
-
const providerOptions =
|
|
29660
|
+
const providerOptions = useMemo102(
|
|
28946
29661
|
() => ({
|
|
28947
29662
|
translator: {
|
|
28948
29663
|
updateEventType: "matrix-crdt.doc_update",
|
|
@@ -28955,22 +29670,22 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
28955
29670
|
}),
|
|
28956
29671
|
[]
|
|
28957
29672
|
);
|
|
28958
|
-
const handleDocumentAvailable =
|
|
29673
|
+
const handleDocumentAvailable = useCallback86(() => {
|
|
28959
29674
|
if (isMountedRef.current) {
|
|
28960
29675
|
setStatus("connected");
|
|
28961
29676
|
}
|
|
28962
29677
|
}, []);
|
|
28963
|
-
const handleDocumentUnavailable =
|
|
29678
|
+
const handleDocumentUnavailable = useCallback86(() => {
|
|
28964
29679
|
if (isMountedRef.current) {
|
|
28965
29680
|
setStatus("failed");
|
|
28966
29681
|
}
|
|
28967
29682
|
}, []);
|
|
28968
|
-
const handleCanWriteChanged =
|
|
29683
|
+
const handleCanWriteChanged = useCallback86(() => {
|
|
28969
29684
|
if (isMountedRef.current && providerRef.current) {
|
|
28970
29685
|
setStatus(providerRef.current.canWrite ? "connected" : "failed");
|
|
28971
29686
|
}
|
|
28972
29687
|
}, []);
|
|
28973
|
-
const initProvider =
|
|
29688
|
+
const initProvider = useCallback86(async () => {
|
|
28974
29689
|
if (!isMountedRef.current) return;
|
|
28975
29690
|
if (retryTimeoutRef.current) {
|
|
28976
29691
|
clearTimeout(retryTimeoutRef.current);
|
|
@@ -29003,7 +29718,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
29003
29718
|
}
|
|
29004
29719
|
}
|
|
29005
29720
|
}, [matrixClient, providerOptions, handleDocumentAvailable, handleDocumentUnavailable, handleCanWriteChanged]);
|
|
29006
|
-
|
|
29721
|
+
useEffect88(() => {
|
|
29007
29722
|
isMountedRef.current = true;
|
|
29008
29723
|
initProvider();
|
|
29009
29724
|
return () => {
|
|
@@ -29020,7 +29735,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
29020
29735
|
setStatus("disconnected");
|
|
29021
29736
|
};
|
|
29022
29737
|
}, [initProvider]);
|
|
29023
|
-
|
|
29738
|
+
useEffect88(() => {
|
|
29024
29739
|
return () => {
|
|
29025
29740
|
isMountedRef.current = false;
|
|
29026
29741
|
};
|
|
@@ -29029,17 +29744,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
29029
29744
|
}
|
|
29030
29745
|
|
|
29031
29746
|
// src/mantine/hooks/useCollaborativeYDoc.ts
|
|
29032
|
-
import { useMemo as
|
|
29747
|
+
import { useMemo as useMemo103 } from "react";
|
|
29033
29748
|
import * as Y from "yjs";
|
|
29034
29749
|
function useCollaborativeYDoc(_options) {
|
|
29035
|
-
return
|
|
29750
|
+
return useMemo103(() => {
|
|
29036
29751
|
const doc = new Y.Doc();
|
|
29037
29752
|
return doc;
|
|
29038
29753
|
}, []);
|
|
29039
29754
|
}
|
|
29040
29755
|
|
|
29041
29756
|
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
29042
|
-
import { useMemo as
|
|
29757
|
+
import { useMemo as useMemo104, useEffect as useEffect89, useState as useState107 } from "react";
|
|
29043
29758
|
|
|
29044
29759
|
// src/core/lib/matrixMetadata.ts
|
|
29045
29760
|
var COVER_IMAGE_EVENT_TYPE = "ixo.page.cover_image";
|
|
@@ -29208,7 +29923,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29208
29923
|
matrixClient,
|
|
29209
29924
|
permissions = { write: false }
|
|
29210
29925
|
} = options || {};
|
|
29211
|
-
const memoizedUser =
|
|
29926
|
+
const memoizedUser = useMemo104(
|
|
29212
29927
|
() => ({
|
|
29213
29928
|
id: user?.id || "",
|
|
29214
29929
|
name: user?.name || "",
|
|
@@ -29223,13 +29938,13 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29223
29938
|
matrixClient,
|
|
29224
29939
|
roomId: options.roomId
|
|
29225
29940
|
});
|
|
29226
|
-
const metadataManager =
|
|
29227
|
-
|
|
29941
|
+
const metadataManager = useMemo104(() => new MatrixMetadataManager(matrixClient, options.roomId), [matrixClient, options.roomId]);
|
|
29942
|
+
useEffect89(() => {
|
|
29228
29943
|
return () => {
|
|
29229
29944
|
metadataManager.dispose();
|
|
29230
29945
|
};
|
|
29231
29946
|
}, [metadataManager]);
|
|
29232
|
-
const defaultUploadFile =
|
|
29947
|
+
const defaultUploadFile = useMemo104(
|
|
29233
29948
|
() => uploadFile || (async (file) => {
|
|
29234
29949
|
return new Promise((resolve, reject) => {
|
|
29235
29950
|
const reader = new FileReader();
|
|
@@ -29243,7 +29958,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29243
29958
|
}),
|
|
29244
29959
|
[uploadFile]
|
|
29245
29960
|
);
|
|
29246
|
-
const schema =
|
|
29961
|
+
const schema = useMemo104(
|
|
29247
29962
|
() => BlockNoteSchema2.create({
|
|
29248
29963
|
blockSpecs: {
|
|
29249
29964
|
...defaultBlockSpecs2,
|
|
@@ -29258,16 +29973,16 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29258
29973
|
}),
|
|
29259
29974
|
[]
|
|
29260
29975
|
);
|
|
29261
|
-
const root =
|
|
29262
|
-
const documentFragment =
|
|
29263
|
-
const flowArray =
|
|
29264
|
-
const runtimeMap =
|
|
29265
|
-
const delegationsMap =
|
|
29266
|
-
const invocationsMap =
|
|
29267
|
-
const ucanDelegationStore =
|
|
29268
|
-
const invocationStore =
|
|
29269
|
-
const userFragment =
|
|
29270
|
-
const collaborationConfig =
|
|
29976
|
+
const root = useMemo104(() => yDoc.getMap("root"), [yDoc]);
|
|
29977
|
+
const documentFragment = useMemo104(() => yDoc.getXmlFragment("document"), [yDoc]);
|
|
29978
|
+
const flowArray = useMemo104(() => yDoc.getArray("flow"), [yDoc]);
|
|
29979
|
+
const runtimeMap = useMemo104(() => yDoc.getMap("runtime"), [yDoc]);
|
|
29980
|
+
const delegationsMap = useMemo104(() => yDoc.getMap("delegations"), [yDoc]);
|
|
29981
|
+
const invocationsMap = useMemo104(() => yDoc.getMap("invocations"), [yDoc]);
|
|
29982
|
+
const ucanDelegationStore = useMemo104(() => createUcanDelegationStore(delegationsMap), [delegationsMap]);
|
|
29983
|
+
const invocationStore = useMemo104(() => createInvocationStore(invocationsMap), [invocationsMap]);
|
|
29984
|
+
const userFragment = useMemo104(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
|
|
29985
|
+
const collaborationConfig = useMemo104(
|
|
29271
29986
|
() => ({
|
|
29272
29987
|
provider: matrixProvider,
|
|
29273
29988
|
fragment: documentFragment,
|
|
@@ -29279,7 +29994,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29279
29994
|
}),
|
|
29280
29995
|
[matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
|
|
29281
29996
|
);
|
|
29282
|
-
const ixoConfig =
|
|
29997
|
+
const ixoConfig = useMemo104(
|
|
29283
29998
|
() => ({
|
|
29284
29999
|
theme,
|
|
29285
30000
|
editable,
|
|
@@ -29298,7 +30013,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29298
30013
|
uploadFile: defaultUploadFile,
|
|
29299
30014
|
collaboration: collaborationConfig
|
|
29300
30015
|
});
|
|
29301
|
-
const titleText =
|
|
30016
|
+
const titleText = useMemo104(() => yDoc.getText("title"), [yDoc]);
|
|
29302
30017
|
let ixoEditor;
|
|
29303
30018
|
if (editor) {
|
|
29304
30019
|
ixoEditor = editor;
|
|
@@ -29476,12 +30191,12 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29476
30191
|
return void 0;
|
|
29477
30192
|
};
|
|
29478
30193
|
}
|
|
29479
|
-
|
|
30194
|
+
useEffect89(() => {
|
|
29480
30195
|
if (ixoEditor) {
|
|
29481
30196
|
ixoEditor.isEditable = editable;
|
|
29482
30197
|
}
|
|
29483
30198
|
}, [ixoEditor, editable]);
|
|
29484
|
-
|
|
30199
|
+
useEffect89(() => {
|
|
29485
30200
|
if (connectionStatus !== "connected") {
|
|
29486
30201
|
return;
|
|
29487
30202
|
}
|
|
@@ -29503,9 +30218,9 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29503
30218
|
titleText.insert(0, options.title);
|
|
29504
30219
|
}
|
|
29505
30220
|
}, [connectionStatus, root, titleText, permissions.write, options.docId, options.title, memoizedUser.id]);
|
|
29506
|
-
const [connectedUsers, setConnectedUsers] =
|
|
30221
|
+
const [connectedUsers, setConnectedUsers] = useState107([]);
|
|
29507
30222
|
const webrtcProvider = matrixProvider?.webrtcProvider;
|
|
29508
|
-
|
|
30223
|
+
useEffect89(() => {
|
|
29509
30224
|
if (!matrixProvider?.awarenessInstance || !webrtcProvider || connectionStatus !== "connected") {
|
|
29510
30225
|
return;
|
|
29511
30226
|
}
|
|
@@ -29524,7 +30239,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29524
30239
|
awareness.off("change", updateUsers);
|
|
29525
30240
|
};
|
|
29526
30241
|
}, [matrixProvider, webrtcProvider, connectionStatus]);
|
|
29527
|
-
|
|
30242
|
+
useEffect89(() => {
|
|
29528
30243
|
if (!matrixProvider?.awarenessInstance || !webrtcProvider || connectionStatus !== "connected") {
|
|
29529
30244
|
return;
|
|
29530
30245
|
}
|
|
@@ -29562,15 +30277,15 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29562
30277
|
}
|
|
29563
30278
|
|
|
29564
30279
|
// src/mantine/IxoEditor.tsx
|
|
29565
|
-
import
|
|
30280
|
+
import React269, { useState as useState112, useEffect as useEffect94, useCallback as useCallback88 } from "react";
|
|
29566
30281
|
import { getDefaultReactSlashMenuItems, SuggestionMenuController } from "@blocknote/react";
|
|
29567
30282
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
29568
30283
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
29569
30284
|
import { MantineProvider } from "@mantine/core";
|
|
29570
30285
|
|
|
29571
30286
|
// src/mantine/components/PanelContent.tsx
|
|
29572
|
-
import
|
|
29573
|
-
import { Box as
|
|
30287
|
+
import React262 from "react";
|
|
30288
|
+
import { Box as Box52 } from "@mantine/core";
|
|
29574
30289
|
var panelStyles = {
|
|
29575
30290
|
light: {
|
|
29576
30291
|
backgroundColor: "#ffffff",
|
|
@@ -29599,8 +30314,8 @@ function PanelContent({ theme }) {
|
|
|
29599
30314
|
const { activePanel, registeredPanels } = usePanelStore();
|
|
29600
30315
|
const isOpen = activePanel !== null;
|
|
29601
30316
|
const content = activePanel ? registeredPanels.get(activePanel) : null;
|
|
29602
|
-
return /* @__PURE__ */
|
|
29603
|
-
|
|
30317
|
+
return /* @__PURE__ */ React262.createElement(
|
|
30318
|
+
Box52,
|
|
29604
30319
|
{
|
|
29605
30320
|
pos: "sticky",
|
|
29606
30321
|
right: 0,
|
|
@@ -29619,8 +30334,8 @@ function PanelContent({ theme }) {
|
|
|
29619
30334
|
}
|
|
29620
30335
|
|
|
29621
30336
|
// src/mantine/components/CoverImage.tsx
|
|
29622
|
-
import
|
|
29623
|
-
import { Box as
|
|
30337
|
+
import React266, { useState as useState109, useRef as useRef26, useEffect as useEffect91 } from "react";
|
|
30338
|
+
import { Box as Box55, Group as Group96 } from "@mantine/core";
|
|
29624
30339
|
|
|
29625
30340
|
// src/core/lib/imageTransform.ts
|
|
29626
30341
|
var CLOUDFLARE_CDN_BASE = "https://www.ixo.earth/cdn-cgi/image";
|
|
@@ -29753,9 +30468,9 @@ function transformIconImage(sourceUrl, size = "default", customOptions) {
|
|
|
29753
30468
|
}
|
|
29754
30469
|
|
|
29755
30470
|
// src/mantine/components/Base/CoverImageButton.tsx
|
|
29756
|
-
import
|
|
30471
|
+
import React263, { forwardRef } from "react";
|
|
29757
30472
|
import { Button as Button47 } from "@mantine/core";
|
|
29758
|
-
var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style, ...props }, ref) => /* @__PURE__ */
|
|
30473
|
+
var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style, ...props }, ref) => /* @__PURE__ */ React263.createElement(
|
|
29759
30474
|
Button47,
|
|
29760
30475
|
{
|
|
29761
30476
|
ref,
|
|
@@ -29778,8 +30493,8 @@ var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style,
|
|
|
29778
30493
|
CoverImageButton.displayName = "CoverImageButton";
|
|
29779
30494
|
|
|
29780
30495
|
// src/mantine/components/Base/BaseIconPicker.tsx
|
|
29781
|
-
import
|
|
29782
|
-
import { TextInput as TextInput8, Tabs as Tabs4, Box as
|
|
30496
|
+
import React264, { useState as useState108, useMemo as useMemo105, useEffect as useEffect90 } from "react";
|
|
30497
|
+
import { TextInput as TextInput8, Tabs as Tabs4, Box as Box53, Stack as Stack173, UnstyledButton as UnstyledButton4, Text as Text148, Center as Center14, ScrollArea as ScrollArea9, Group as Group95, Popover as Popover5 } from "@mantine/core";
|
|
29783
30498
|
import * as TablerIcons from "@tabler/icons-react";
|
|
29784
30499
|
import { IconSearch as IconSearch6, IconX as IconX13, IconChevronLeft, IconChevronRight as IconChevronRight13 } from "@tabler/icons-react";
|
|
29785
30500
|
|
|
@@ -29811,28 +30526,28 @@ var localStorageService = {
|
|
|
29811
30526
|
var iconsKey = "editor_recent_icons";
|
|
29812
30527
|
var ICONS_PER_PAGE = 500;
|
|
29813
30528
|
function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children, currentIcon }) {
|
|
29814
|
-
const [searchQuery, setSearchQuery] =
|
|
29815
|
-
const [activeTab, setActiveTab] =
|
|
29816
|
-
const [currentPage, setCurrentPage] =
|
|
29817
|
-
const allIcons =
|
|
30529
|
+
const [searchQuery, setSearchQuery] = useState108("");
|
|
30530
|
+
const [activeTab, setActiveTab] = useState108("icons");
|
|
30531
|
+
const [currentPage, setCurrentPage] = useState108(1);
|
|
30532
|
+
const allIcons = useMemo105(() => {
|
|
29818
30533
|
const iconEntries = Object.entries(TablerIcons).filter(([name]) => name.startsWith("Icon") && name !== "IconProps");
|
|
29819
30534
|
return iconEntries;
|
|
29820
30535
|
}, []);
|
|
29821
|
-
const filteredIcons =
|
|
30536
|
+
const filteredIcons = useMemo105(() => {
|
|
29822
30537
|
if (!searchQuery) return allIcons;
|
|
29823
30538
|
const query = searchQuery.toLowerCase();
|
|
29824
30539
|
return allIcons.filter(([name]) => name.toLowerCase().includes(query));
|
|
29825
30540
|
}, [allIcons, searchQuery]);
|
|
29826
|
-
|
|
30541
|
+
useEffect90(() => {
|
|
29827
30542
|
setCurrentPage(1);
|
|
29828
30543
|
}, [searchQuery]);
|
|
29829
|
-
const paginatedIcons =
|
|
30544
|
+
const paginatedIcons = useMemo105(() => {
|
|
29830
30545
|
const startIndex = (currentPage - 1) * ICONS_PER_PAGE;
|
|
29831
30546
|
const endIndex = startIndex + ICONS_PER_PAGE;
|
|
29832
30547
|
return filteredIcons.slice(startIndex, endIndex);
|
|
29833
30548
|
}, [filteredIcons, currentPage]);
|
|
29834
30549
|
const totalPages = Math.ceil(filteredIcons.length / ICONS_PER_PAGE);
|
|
29835
|
-
const recentIcons =
|
|
30550
|
+
const recentIcons = useMemo105(() => {
|
|
29836
30551
|
const recentIconNames = localStorageService.get(iconsKey);
|
|
29837
30552
|
if (!recentIconNames || recentIconNames.length === 0) return [];
|
|
29838
30553
|
return recentIconNames.slice(0, 24).map((iconName) => allIcons.find(([name]) => name === iconName)).filter((entry) => entry !== void 0);
|
|
@@ -29847,10 +30562,10 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
29847
30562
|
};
|
|
29848
30563
|
const renderIconGrid = (icons) => {
|
|
29849
30564
|
if (icons.length === 0) {
|
|
29850
|
-
return /* @__PURE__ */
|
|
30565
|
+
return /* @__PURE__ */ React264.createElement(Center14, { py: "xl" }, /* @__PURE__ */ React264.createElement(Text148, { c: "dimmed", size: "sm" }, "No icons found"));
|
|
29851
30566
|
}
|
|
29852
|
-
return /* @__PURE__ */
|
|
29853
|
-
|
|
30567
|
+
return /* @__PURE__ */ React264.createElement(
|
|
30568
|
+
Box53,
|
|
29854
30569
|
{
|
|
29855
30570
|
style: {
|
|
29856
30571
|
display: "grid",
|
|
@@ -29861,7 +30576,7 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
29861
30576
|
},
|
|
29862
30577
|
icons.map(([name, IconComponent]) => {
|
|
29863
30578
|
const isSelected = currentIcon === name.replace("Icon", "").replace(/([A-Z])/g, "-$1").toLowerCase().slice(1);
|
|
29864
|
-
return /* @__PURE__ */
|
|
30579
|
+
return /* @__PURE__ */ React264.createElement(
|
|
29865
30580
|
UnstyledButton4,
|
|
29866
30581
|
{
|
|
29867
30582
|
key: name,
|
|
@@ -29887,12 +30602,12 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
29887
30602
|
}
|
|
29888
30603
|
}
|
|
29889
30604
|
},
|
|
29890
|
-
/* @__PURE__ */
|
|
30605
|
+
/* @__PURE__ */ React264.createElement(IconComponent, { color: "white", size: 24, stroke: 1.5 })
|
|
29891
30606
|
);
|
|
29892
30607
|
})
|
|
29893
30608
|
);
|
|
29894
30609
|
};
|
|
29895
|
-
return /* @__PURE__ */
|
|
30610
|
+
return /* @__PURE__ */ React264.createElement(Popover5, { opened, onClose, position: "right", width: 500, shadow: "xl" }, /* @__PURE__ */ React264.createElement(Popover5.Target, null, children), /* @__PURE__ */ React264.createElement(
|
|
29896
30611
|
Popover5.Dropdown,
|
|
29897
30612
|
{
|
|
29898
30613
|
style: {
|
|
@@ -29902,15 +30617,15 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
29902
30617
|
},
|
|
29903
30618
|
p: 0
|
|
29904
30619
|
},
|
|
29905
|
-
/* @__PURE__ */
|
|
30620
|
+
/* @__PURE__ */ React264.createElement(Stack173, { gap: "md", p: "md" }, /* @__PURE__ */ React264.createElement(Tabs4, { value: activeTab, onChange: setActiveTab, variant: "pills" }, /* @__PURE__ */ React264.createElement(Tabs4.List, null, /* @__PURE__ */ React264.createElement(Tabs4.Tab, { value: "icons" }, "Icons"), /* @__PURE__ */ React264.createElement(Tabs4.Tab, { value: "upload" }, "Upload")), /* @__PURE__ */ React264.createElement(Tabs4.Panel, { value: "icons", pt: "md" }, /* @__PURE__ */ React264.createElement(
|
|
29906
30621
|
TextInput8,
|
|
29907
30622
|
{
|
|
29908
30623
|
mb: "md",
|
|
29909
30624
|
placeholder: "Filter",
|
|
29910
|
-
leftSection: /* @__PURE__ */
|
|
30625
|
+
leftSection: /* @__PURE__ */ React264.createElement(IconSearch6, { size: 18 }),
|
|
29911
30626
|
value: searchQuery,
|
|
29912
30627
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
29913
|
-
rightSection: searchQuery && /* @__PURE__ */
|
|
30628
|
+
rightSection: searchQuery && /* @__PURE__ */ React264.createElement(UnstyledButton4, { onClick: () => setSearchQuery("") }, /* @__PURE__ */ React264.createElement(IconX13, { size: 18 })),
|
|
29914
30629
|
style: { flex: 1 },
|
|
29915
30630
|
styles: {
|
|
29916
30631
|
input: {
|
|
@@ -29920,26 +30635,26 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
29920
30635
|
}
|
|
29921
30636
|
}
|
|
29922
30637
|
}
|
|
29923
|
-
), !searchQuery && /* @__PURE__ */
|
|
30638
|
+
), !searchQuery && /* @__PURE__ */ React264.createElement(Box53, { mb: "md" }, /* @__PURE__ */ React264.createElement(Text148, { size: "sm", fw: 500, mb: "xs", px: "xs" }, "Recent"), /* @__PURE__ */ React264.createElement(ScrollArea9.Autosize, { scrollbarSize: 0, mah: 60 }, renderIconGrid(recentIcons))), /* @__PURE__ */ React264.createElement(Box53, null, /* @__PURE__ */ React264.createElement(Group95, { justify: "space-between", mb: "xs", px: "xs" }, /* @__PURE__ */ React264.createElement(Text148, { size: "sm", fw: 500 }, searchQuery ? "Results" : "Icons"), totalPages > 1 && /* @__PURE__ */ React264.createElement(Group95, { gap: "xs" }, /* @__PURE__ */ React264.createElement(Text148, { size: "xs", c: "dimmed" }, "Page ", currentPage, " of ", totalPages, " (", filteredIcons.length, " total)"), /* @__PURE__ */ React264.createElement(BaseButton, { size: "xs", onClick: () => setCurrentPage((p) => Math.max(1, p - 1)), disabled: currentPage === 1, leftSection: /* @__PURE__ */ React264.createElement(IconChevronLeft, { size: 14 }) }, "Prev"), /* @__PURE__ */ React264.createElement(
|
|
29924
30639
|
BaseButton,
|
|
29925
30640
|
{
|
|
29926
30641
|
size: "xs",
|
|
29927
30642
|
onClick: () => setCurrentPage((p) => Math.min(totalPages, p + 1)),
|
|
29928
30643
|
disabled: currentPage === totalPages,
|
|
29929
|
-
leftSection: /* @__PURE__ */
|
|
30644
|
+
leftSection: /* @__PURE__ */ React264.createElement(IconChevronRight13, { size: 14 })
|
|
29930
30645
|
},
|
|
29931
30646
|
"Next"
|
|
29932
|
-
))), /* @__PURE__ */
|
|
30647
|
+
))), /* @__PURE__ */ React264.createElement(ScrollArea9.Autosize, { scrollbarSize: 0, mah: 200 }, renderIconGrid(paginatedIcons)))), /* @__PURE__ */ React264.createElement(Tabs4.Panel, { value: "upload", pt: "md" }, /* @__PURE__ */ React264.createElement(Center14, { py: "xl" }, /* @__PURE__ */ React264.createElement(Stack173, { align: "center", gap: "md" }, /* @__PURE__ */ React264.createElement(Text148, { size: "sm", c: "dimmed", ta: "center" }, "Upload a custom icon image", /* @__PURE__ */ React264.createElement("br", null), "(PNG, JPG, SVG)"), /* @__PURE__ */ React264.createElement(CoverImageButton, { onClick: onUploadClick }, "Choose File"))))))
|
|
29933
30648
|
));
|
|
29934
30649
|
}
|
|
29935
30650
|
|
|
29936
30651
|
// src/mantine/components/Base/PageIcon.tsx
|
|
29937
|
-
import
|
|
29938
|
-
import { Center as Center15, Box as
|
|
30652
|
+
import React265, { useMemo as useMemo106 } from "react";
|
|
30653
|
+
import { Center as Center15, Box as Box54 } from "@mantine/core";
|
|
29939
30654
|
import * as TablerIcons2 from "@tabler/icons-react";
|
|
29940
30655
|
function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
29941
30656
|
const isIconName = src && !src.startsWith("http");
|
|
29942
|
-
const IconComponent =
|
|
30657
|
+
const IconComponent = useMemo106(() => {
|
|
29943
30658
|
if (!isIconName || !src) return null;
|
|
29944
30659
|
const iconComponent = TablerIcons2[src];
|
|
29945
30660
|
if (iconComponent) {
|
|
@@ -29947,10 +30662,10 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
29947
30662
|
}
|
|
29948
30663
|
return null;
|
|
29949
30664
|
}, [isIconName, src]);
|
|
29950
|
-
const Container = useCenter ? Center15 :
|
|
30665
|
+
const Container = useCenter ? Center15 : Box54;
|
|
29951
30666
|
if (!src) return null;
|
|
29952
30667
|
if (IconComponent) {
|
|
29953
|
-
return /* @__PURE__ */
|
|
30668
|
+
return /* @__PURE__ */ React265.createElement(
|
|
29954
30669
|
Container,
|
|
29955
30670
|
{
|
|
29956
30671
|
style: {
|
|
@@ -29962,10 +30677,10 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
29962
30677
|
...style
|
|
29963
30678
|
}
|
|
29964
30679
|
},
|
|
29965
|
-
/* @__PURE__ */
|
|
30680
|
+
/* @__PURE__ */ React265.createElement(IconComponent, { size: iconSize, color: "white", stroke: 1.5 })
|
|
29966
30681
|
);
|
|
29967
30682
|
}
|
|
29968
|
-
return /* @__PURE__ */
|
|
30683
|
+
return /* @__PURE__ */ React265.createElement(
|
|
29969
30684
|
"img",
|
|
29970
30685
|
{
|
|
29971
30686
|
src,
|
|
@@ -29986,14 +30701,14 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
29986
30701
|
import { useDisclosure as useDisclosure6 } from "@mantine/hooks";
|
|
29987
30702
|
function CoverImage({ coverImageUrl, logoUrl }) {
|
|
29988
30703
|
const { editor, handlers, editable } = useBlocknoteContext();
|
|
29989
|
-
const [isHovering, setIsHovering] =
|
|
29990
|
-
const [isRepositioning, setIsRepositioning] =
|
|
29991
|
-
const [coverPosition, setCoverPosition] =
|
|
30704
|
+
const [isHovering, setIsHovering] = useState109(false);
|
|
30705
|
+
const [isRepositioning, setIsRepositioning] = useState109(false);
|
|
30706
|
+
const [coverPosition, setCoverPosition] = useState109(50);
|
|
29992
30707
|
const coverFileInputRef = useRef26(null);
|
|
29993
30708
|
const logoFileInputRef = useRef26(null);
|
|
29994
30709
|
const [opened, { open, close }] = useDisclosure6(false);
|
|
29995
|
-
const [metadata, setMetadata] =
|
|
29996
|
-
|
|
30710
|
+
const [metadata, setMetadata] = useState109(() => editor?.getPageMetadata?.() || null);
|
|
30711
|
+
useEffect91(() => {
|
|
29997
30712
|
if (!editor?._metadataManager) {
|
|
29998
30713
|
return;
|
|
29999
30714
|
}
|
|
@@ -30075,8 +30790,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30075
30790
|
return null;
|
|
30076
30791
|
}
|
|
30077
30792
|
if (!hasCover) {
|
|
30078
|
-
return /* @__PURE__ */
|
|
30079
|
-
|
|
30793
|
+
return /* @__PURE__ */ React266.createElement(
|
|
30794
|
+
Box55,
|
|
30080
30795
|
{
|
|
30081
30796
|
style: {
|
|
30082
30797
|
position: "relative",
|
|
@@ -30088,7 +30803,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30088
30803
|
onMouseEnter: () => editable && setIsHovering(true),
|
|
30089
30804
|
onMouseLeave: () => editable && setIsHovering(false)
|
|
30090
30805
|
},
|
|
30091
|
-
/* @__PURE__ */
|
|
30806
|
+
/* @__PURE__ */ React266.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "relative", height: "100%" } }, /* @__PURE__ */ React266.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }), /* @__PURE__ */ React266.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }), editable && isHovering && !logoSrc && /* @__PURE__ */ React266.createElement(
|
|
30092
30807
|
Group96,
|
|
30093
30808
|
{
|
|
30094
30809
|
gap: "xs",
|
|
@@ -30099,7 +30814,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30099
30814
|
zIndex: 10
|
|
30100
30815
|
}
|
|
30101
30816
|
},
|
|
30102
|
-
/* @__PURE__ */
|
|
30817
|
+
/* @__PURE__ */ React266.createElement(
|
|
30103
30818
|
BaseIconPicker,
|
|
30104
30819
|
{
|
|
30105
30820
|
opened,
|
|
@@ -30108,11 +30823,11 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30108
30823
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
30109
30824
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
30110
30825
|
},
|
|
30111
|
-
/* @__PURE__ */
|
|
30826
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: open }, "Add icon")
|
|
30112
30827
|
),
|
|
30113
|
-
/* @__PURE__ */
|
|
30114
|
-
), logoSrc && /* @__PURE__ */
|
|
30115
|
-
|
|
30828
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Add cover")
|
|
30829
|
+
), logoSrc && /* @__PURE__ */ React266.createElement(
|
|
30830
|
+
Box55,
|
|
30116
30831
|
{
|
|
30117
30832
|
style: {
|
|
30118
30833
|
position: "relative",
|
|
@@ -30125,8 +30840,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30125
30840
|
zIndex: 11
|
|
30126
30841
|
}
|
|
30127
30842
|
},
|
|
30128
|
-
/* @__PURE__ */
|
|
30129
|
-
editable && isHovering && /* @__PURE__ */
|
|
30843
|
+
/* @__PURE__ */ React266.createElement(PageIcon, { src: logoSrc, useCenter: true, iconSize: 64 }),
|
|
30844
|
+
editable && isHovering && /* @__PURE__ */ React266.createElement(
|
|
30130
30845
|
"div",
|
|
30131
30846
|
{
|
|
30132
30847
|
style: {
|
|
@@ -30141,7 +30856,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30141
30856
|
alignItems: "center"
|
|
30142
30857
|
}
|
|
30143
30858
|
},
|
|
30144
|
-
/* @__PURE__ */
|
|
30859
|
+
/* @__PURE__ */ React266.createElement(
|
|
30145
30860
|
BaseIconPicker,
|
|
30146
30861
|
{
|
|
30147
30862
|
opened,
|
|
@@ -30150,16 +30865,16 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30150
30865
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
30151
30866
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
30152
30867
|
},
|
|
30153
|
-
/* @__PURE__ */
|
|
30868
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: open }, "Change")
|
|
30154
30869
|
),
|
|
30155
|
-
/* @__PURE__ */
|
|
30156
|
-
/* @__PURE__ */
|
|
30870
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove"),
|
|
30871
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Add cover")
|
|
30157
30872
|
)
|
|
30158
30873
|
))
|
|
30159
30874
|
);
|
|
30160
30875
|
}
|
|
30161
|
-
return /* @__PURE__ */
|
|
30162
|
-
|
|
30876
|
+
return /* @__PURE__ */ React266.createElement(
|
|
30877
|
+
Box55,
|
|
30163
30878
|
{
|
|
30164
30879
|
style: {
|
|
30165
30880
|
position: "relative",
|
|
@@ -30178,7 +30893,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30178
30893
|
onMouseMove: handleMouseMove,
|
|
30179
30894
|
onClick: () => isRepositioning && setIsRepositioning(false)
|
|
30180
30895
|
},
|
|
30181
|
-
/* @__PURE__ */
|
|
30896
|
+
/* @__PURE__ */ React266.createElement(
|
|
30182
30897
|
"img",
|
|
30183
30898
|
{
|
|
30184
30899
|
src: coverUrl,
|
|
@@ -30196,7 +30911,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30196
30911
|
}
|
|
30197
30912
|
}
|
|
30198
30913
|
),
|
|
30199
|
-
editable && isHovering && /* @__PURE__ */
|
|
30914
|
+
editable && isHovering && /* @__PURE__ */ React266.createElement(
|
|
30200
30915
|
Group96,
|
|
30201
30916
|
{
|
|
30202
30917
|
gap: "xs",
|
|
@@ -30207,12 +30922,12 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30207
30922
|
zIndex: 10
|
|
30208
30923
|
}
|
|
30209
30924
|
},
|
|
30210
|
-
/* @__PURE__ */
|
|
30211
|
-
/* @__PURE__ */
|
|
30212
|
-
/* @__PURE__ */
|
|
30925
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Change cover"),
|
|
30926
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: () => setIsRepositioning(!isRepositioning), isActive: isRepositioning }, isRepositioning ? "Done" : "Reposition"),
|
|
30927
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: handleRemoveCover }, "Remove")
|
|
30213
30928
|
),
|
|
30214
|
-
/* @__PURE__ */
|
|
30215
|
-
|
|
30929
|
+
/* @__PURE__ */ React266.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "absolute", bottom: 0, left: -40, right: 0, height: "70px" } }, /* @__PURE__ */ React266.createElement(
|
|
30930
|
+
Box55,
|
|
30216
30931
|
{
|
|
30217
30932
|
style: {
|
|
30218
30933
|
position: "absolute",
|
|
@@ -30223,8 +30938,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30223
30938
|
zIndex: 11
|
|
30224
30939
|
}
|
|
30225
30940
|
},
|
|
30226
|
-
logoSrc && /* @__PURE__ */
|
|
30227
|
-
editable && isHovering && /* @__PURE__ */
|
|
30941
|
+
logoSrc && /* @__PURE__ */ React266.createElement(PageIcon, { src: logoSrc, iconSize: 64 }),
|
|
30942
|
+
editable && isHovering && /* @__PURE__ */ React266.createElement(React266.Fragment, null, logoSrc ? /* @__PURE__ */ React266.createElement(
|
|
30228
30943
|
Group96,
|
|
30229
30944
|
{
|
|
30230
30945
|
gap: "xs",
|
|
@@ -30235,7 +30950,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30235
30950
|
zIndex: 12
|
|
30236
30951
|
}
|
|
30237
30952
|
},
|
|
30238
|
-
/* @__PURE__ */
|
|
30953
|
+
/* @__PURE__ */ React266.createElement(
|
|
30239
30954
|
BaseIconPicker,
|
|
30240
30955
|
{
|
|
30241
30956
|
opened,
|
|
@@ -30244,10 +30959,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30244
30959
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
30245
30960
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
30246
30961
|
},
|
|
30247
|
-
/* @__PURE__ */
|
|
30962
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: open }, "Change")
|
|
30248
30963
|
),
|
|
30249
|
-
/* @__PURE__ */
|
|
30250
|
-
) : /* @__PURE__ */
|
|
30964
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove")
|
|
30965
|
+
) : /* @__PURE__ */ React266.createElement(
|
|
30251
30966
|
CoverImageButton,
|
|
30252
30967
|
{
|
|
30253
30968
|
onClick: open,
|
|
@@ -30262,13 +30977,13 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30262
30977
|
"Add icon"
|
|
30263
30978
|
))
|
|
30264
30979
|
)),
|
|
30265
|
-
/* @__PURE__ */
|
|
30266
|
-
/* @__PURE__ */
|
|
30980
|
+
/* @__PURE__ */ React266.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
|
|
30981
|
+
/* @__PURE__ */ React266.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
|
|
30267
30982
|
);
|
|
30268
30983
|
}
|
|
30269
30984
|
|
|
30270
30985
|
// src/mantine/components/PageHeader.tsx
|
|
30271
|
-
import
|
|
30986
|
+
import React267, { useState as useState110, useRef as useRef27, useEffect as useEffect92 } from "react";
|
|
30272
30987
|
function PageHeader({
|
|
30273
30988
|
title = "New page",
|
|
30274
30989
|
icon: icon2,
|
|
@@ -30280,11 +30995,11 @@ function PageHeader({
|
|
|
30280
30995
|
isFavorited = false,
|
|
30281
30996
|
menuItems = []
|
|
30282
30997
|
}) {
|
|
30283
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
30284
|
-
const [isPrivacyOpen, setIsPrivacyOpen] =
|
|
30998
|
+
const [isMenuOpen, setIsMenuOpen] = useState110(false);
|
|
30999
|
+
const [isPrivacyOpen, setIsPrivacyOpen] = useState110(false);
|
|
30285
31000
|
const menuRef = useRef27(null);
|
|
30286
31001
|
const privacyRef = useRef27(null);
|
|
30287
|
-
|
|
31002
|
+
useEffect92(() => {
|
|
30288
31003
|
function handleClickOutside(event) {
|
|
30289
31004
|
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
30290
31005
|
setIsMenuOpen(false);
|
|
@@ -30306,7 +31021,7 @@ function PageHeader({
|
|
|
30306
31021
|
setIsMenuOpen(false);
|
|
30307
31022
|
}
|
|
30308
31023
|
};
|
|
30309
|
-
return /* @__PURE__ */
|
|
31024
|
+
return /* @__PURE__ */ React267.createElement("div", { style: styles.container }, /* @__PURE__ */ React267.createElement("div", { style: styles.leftSection }, /* @__PURE__ */ React267.createElement("span", { style: styles.icon }, icon2 || "\u{1F4C4}"), /* @__PURE__ */ React267.createElement("span", { style: styles.title }, title), /* @__PURE__ */ React267.createElement("div", { style: styles.privacyContainer, ref: privacyRef }, /* @__PURE__ */ React267.createElement("button", { style: styles.privacyBadge, onClick: () => onPrivacyChange && setIsPrivacyOpen(!isPrivacyOpen) }, /* @__PURE__ */ React267.createElement("span", { style: styles.lockIcon }, isPrivate ? "\u{1F512}" : "\u{1F310}"), /* @__PURE__ */ React267.createElement("span", null, isPrivate ? "Private" : "Public"), onPrivacyChange && /* @__PURE__ */ React267.createElement("span", { style: styles.chevron }, "\u25BE")), isPrivacyOpen && onPrivacyChange && /* @__PURE__ */ React267.createElement("div", { style: styles.dropdown }, /* @__PURE__ */ React267.createElement(
|
|
30310
31025
|
"button",
|
|
30311
31026
|
{
|
|
30312
31027
|
style: {
|
|
@@ -30318,9 +31033,9 @@ function PageHeader({
|
|
|
30318
31033
|
setIsPrivacyOpen(false);
|
|
30319
31034
|
}
|
|
30320
31035
|
},
|
|
30321
|
-
/* @__PURE__ */
|
|
30322
|
-
/* @__PURE__ */
|
|
30323
|
-
), /* @__PURE__ */
|
|
31036
|
+
/* @__PURE__ */ React267.createElement("span", { style: styles.menuItemIcon }, "\u{1F512}"),
|
|
31037
|
+
/* @__PURE__ */ React267.createElement("span", null, "Private")
|
|
31038
|
+
), /* @__PURE__ */ React267.createElement(
|
|
30324
31039
|
"button",
|
|
30325
31040
|
{
|
|
30326
31041
|
style: {
|
|
@@ -30332,9 +31047,9 @@ function PageHeader({
|
|
|
30332
31047
|
setIsPrivacyOpen(false);
|
|
30333
31048
|
}
|
|
30334
31049
|
},
|
|
30335
|
-
/* @__PURE__ */
|
|
30336
|
-
/* @__PURE__ */
|
|
30337
|
-
)))), /* @__PURE__ */
|
|
31050
|
+
/* @__PURE__ */ React267.createElement("span", { style: styles.menuItemIcon }, "\u{1F310}"),
|
|
31051
|
+
/* @__PURE__ */ React267.createElement("span", null, "Public")
|
|
31052
|
+
)))), /* @__PURE__ */ React267.createElement("div", { style: styles.rightSection }, lastEdited && /* @__PURE__ */ React267.createElement("span", { style: styles.editedText }, lastEdited), onShare && /* @__PURE__ */ React267.createElement("button", { style: styles.shareButton, onClick: onShare }, "Share"), onFavorite && /* @__PURE__ */ React267.createElement("button", { style: styles.iconButton, onClick: onFavorite }, isFavorited ? "\u2605" : "\u2606"), menuItems.length > 0 && /* @__PURE__ */ React267.createElement("div", { style: styles.menuContainer, ref: menuRef }, /* @__PURE__ */ React267.createElement("button", { style: styles.menuButton, onClick: () => setIsMenuOpen(!isMenuOpen), "aria-label": "Menu" }, /* @__PURE__ */ React267.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor" }, /* @__PURE__ */ React267.createElement("circle", { cx: "3", cy: "8", r: "1.5" }), /* @__PURE__ */ React267.createElement("circle", { cx: "8", cy: "8", r: "1.5" }), /* @__PURE__ */ React267.createElement("circle", { cx: "13", cy: "8", r: "1.5" }))), isMenuOpen && /* @__PURE__ */ React267.createElement("div", { style: styles.dropdown }, menuItems.map((item, index) => /* @__PURE__ */ React267.createElement(React267.Fragment, { key: index }, item.divider && index > 0 && /* @__PURE__ */ React267.createElement("div", { style: styles.divider }), /* @__PURE__ */ React267.createElement(
|
|
30338
31053
|
"button",
|
|
30339
31054
|
{
|
|
30340
31055
|
style: {
|
|
@@ -30344,8 +31059,8 @@ function PageHeader({
|
|
|
30344
31059
|
onClick: () => handleMenuItemClick(item),
|
|
30345
31060
|
disabled: item.disabled
|
|
30346
31061
|
},
|
|
30347
|
-
item.icon && /* @__PURE__ */
|
|
30348
|
-
/* @__PURE__ */
|
|
31062
|
+
item.icon && /* @__PURE__ */ React267.createElement("span", { style: styles.menuItemIcon }, item.icon),
|
|
31063
|
+
/* @__PURE__ */ React267.createElement("span", null, item.label)
|
|
30349
31064
|
)))))));
|
|
30350
31065
|
}
|
|
30351
31066
|
var styles = {
|
|
@@ -30482,8 +31197,8 @@ var styles = {
|
|
|
30482
31197
|
};
|
|
30483
31198
|
|
|
30484
31199
|
// src/mantine/components/ExternalDropZone.tsx
|
|
30485
|
-
import
|
|
30486
|
-
import { Box as
|
|
31200
|
+
import React268, { useCallback as useCallback87, useEffect as useEffect93, useRef as useRef28, useState as useState111 } from "react";
|
|
31201
|
+
import { Box as Box56 } from "@mantine/core";
|
|
30487
31202
|
var SCROLL_ZONE_SIZE = 80;
|
|
30488
31203
|
var SCROLL_SPEED = 12;
|
|
30489
31204
|
var ExternalDropZone = ({
|
|
@@ -30496,19 +31211,19 @@ var ExternalDropZone = ({
|
|
|
30496
31211
|
children
|
|
30497
31212
|
}) => {
|
|
30498
31213
|
const containerRef = useRef28(null);
|
|
30499
|
-
const [isValidDrag, setIsValidDrag] =
|
|
30500
|
-
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] =
|
|
30501
|
-
const [indicatorStyle, setIndicatorStyle] =
|
|
31214
|
+
const [isValidDrag, setIsValidDrag] = useState111(false);
|
|
31215
|
+
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] = useState111(false);
|
|
31216
|
+
const [indicatorStyle, setIndicatorStyle] = useState111({});
|
|
30502
31217
|
const dropPositionRef = useRef28(null);
|
|
30503
31218
|
const scrollAnimationRef = useRef28(null);
|
|
30504
31219
|
const scrollDirectionRef = useRef28(null);
|
|
30505
31220
|
const scrollContainerRef = useRef28(null);
|
|
30506
|
-
const getBlockElements =
|
|
31221
|
+
const getBlockElements = useCallback87(() => {
|
|
30507
31222
|
if (!containerRef.current) return [];
|
|
30508
31223
|
const blocks = containerRef.current.querySelectorAll('[data-node-type="blockContainer"]');
|
|
30509
31224
|
return Array.from(blocks);
|
|
30510
31225
|
}, []);
|
|
30511
|
-
const getScrollContainer =
|
|
31226
|
+
const getScrollContainer = useCallback87(() => {
|
|
30512
31227
|
if (scrollContainerRef.current) return scrollContainerRef.current;
|
|
30513
31228
|
let element = containerRef.current;
|
|
30514
31229
|
while (element) {
|
|
@@ -30523,7 +31238,7 @@ var ExternalDropZone = ({
|
|
|
30523
31238
|
scrollContainerRef.current = window;
|
|
30524
31239
|
return window;
|
|
30525
31240
|
}, []);
|
|
30526
|
-
const performScroll =
|
|
31241
|
+
const performScroll = useCallback87(() => {
|
|
30527
31242
|
const container = getScrollContainer();
|
|
30528
31243
|
const direction = scrollDirectionRef.current;
|
|
30529
31244
|
if (!direction) {
|
|
@@ -30538,7 +31253,7 @@ var ExternalDropZone = ({
|
|
|
30538
31253
|
}
|
|
30539
31254
|
scrollAnimationRef.current = requestAnimationFrame(performScroll);
|
|
30540
31255
|
}, [getScrollContainer]);
|
|
30541
|
-
const startAutoScroll =
|
|
31256
|
+
const startAutoScroll = useCallback87(
|
|
30542
31257
|
(direction) => {
|
|
30543
31258
|
if (scrollDirectionRef.current === direction) return;
|
|
30544
31259
|
scrollDirectionRef.current = direction;
|
|
@@ -30548,14 +31263,14 @@ var ExternalDropZone = ({
|
|
|
30548
31263
|
},
|
|
30549
31264
|
[performScroll]
|
|
30550
31265
|
);
|
|
30551
|
-
const stopAutoScroll =
|
|
31266
|
+
const stopAutoScroll = useCallback87(() => {
|
|
30552
31267
|
scrollDirectionRef.current = null;
|
|
30553
31268
|
if (scrollAnimationRef.current) {
|
|
30554
31269
|
cancelAnimationFrame(scrollAnimationRef.current);
|
|
30555
31270
|
scrollAnimationRef.current = null;
|
|
30556
31271
|
}
|
|
30557
31272
|
}, []);
|
|
30558
|
-
const checkAutoScroll =
|
|
31273
|
+
const checkAutoScroll = useCallback87(
|
|
30559
31274
|
(clientY) => {
|
|
30560
31275
|
const container = getScrollContainer();
|
|
30561
31276
|
let containerTop;
|
|
@@ -30578,7 +31293,7 @@ var ExternalDropZone = ({
|
|
|
30578
31293
|
},
|
|
30579
31294
|
[getScrollContainer, startAutoScroll, stopAutoScroll]
|
|
30580
31295
|
);
|
|
30581
|
-
const findDropPosition =
|
|
31296
|
+
const findDropPosition = useCallback87(
|
|
30582
31297
|
(clientY) => {
|
|
30583
31298
|
const blocks = getBlockElements();
|
|
30584
31299
|
if (blocks.length === 0 || !editor?.document) return null;
|
|
@@ -30611,7 +31326,7 @@ var ExternalDropZone = ({
|
|
|
30611
31326
|
},
|
|
30612
31327
|
[getBlockElements, editor]
|
|
30613
31328
|
);
|
|
30614
|
-
const handleDragOver =
|
|
31329
|
+
const handleDragOver = useCallback87(
|
|
30615
31330
|
(e) => {
|
|
30616
31331
|
if (!e.dataTransfer.types.includes(acceptedType)) return;
|
|
30617
31332
|
e.preventDefault();
|
|
@@ -30634,7 +31349,7 @@ var ExternalDropZone = ({
|
|
|
30634
31349
|
},
|
|
30635
31350
|
[acceptedType, findDropPosition, checkAutoScroll]
|
|
30636
31351
|
);
|
|
30637
|
-
const handleDragLeave =
|
|
31352
|
+
const handleDragLeave = useCallback87(
|
|
30638
31353
|
(e) => {
|
|
30639
31354
|
if (containerRef.current && !containerRef.current.contains(e.relatedTarget)) {
|
|
30640
31355
|
setIsValidDrag(false);
|
|
@@ -30644,7 +31359,7 @@ var ExternalDropZone = ({
|
|
|
30644
31359
|
},
|
|
30645
31360
|
[stopAutoScroll]
|
|
30646
31361
|
);
|
|
30647
|
-
const handleDrop =
|
|
31362
|
+
const handleDrop = useCallback87(
|
|
30648
31363
|
(e) => {
|
|
30649
31364
|
e.preventDefault();
|
|
30650
31365
|
e.stopPropagation();
|
|
@@ -30658,7 +31373,7 @@ var ExternalDropZone = ({
|
|
|
30658
31373
|
},
|
|
30659
31374
|
[onDrop, stopAutoScroll]
|
|
30660
31375
|
);
|
|
30661
|
-
|
|
31376
|
+
useEffect93(() => {
|
|
30662
31377
|
const handleGlobalDragEnd = () => {
|
|
30663
31378
|
setIsValidDrag(false);
|
|
30664
31379
|
dropPositionRef.current = null;
|
|
@@ -30667,7 +31382,7 @@ var ExternalDropZone = ({
|
|
|
30667
31382
|
window.addEventListener("dragend", handleGlobalDragEnd);
|
|
30668
31383
|
return () => window.removeEventListener("dragend", handleGlobalDragEnd);
|
|
30669
31384
|
}, [stopAutoScroll]);
|
|
30670
|
-
const handleOverlayMouseMove =
|
|
31385
|
+
const handleOverlayMouseMove = useCallback87(
|
|
30671
31386
|
(e) => {
|
|
30672
31387
|
setIsHoveringInPlacementMode(true);
|
|
30673
31388
|
checkAutoScroll(e.clientY);
|
|
@@ -30686,12 +31401,12 @@ var ExternalDropZone = ({
|
|
|
30686
31401
|
},
|
|
30687
31402
|
[findDropPosition, checkAutoScroll]
|
|
30688
31403
|
);
|
|
30689
|
-
const handleOverlayMouseLeave =
|
|
31404
|
+
const handleOverlayMouseLeave = useCallback87(() => {
|
|
30690
31405
|
setIsHoveringInPlacementMode(false);
|
|
30691
31406
|
dropPositionRef.current = null;
|
|
30692
31407
|
stopAutoScroll();
|
|
30693
31408
|
}, [stopAutoScroll]);
|
|
30694
|
-
const handleOverlayClick =
|
|
31409
|
+
const handleOverlayClick = useCallback87(
|
|
30695
31410
|
(e) => {
|
|
30696
31411
|
e.preventDefault();
|
|
30697
31412
|
e.stopPropagation();
|
|
@@ -30705,7 +31420,7 @@ var ExternalDropZone = ({
|
|
|
30705
31420
|
},
|
|
30706
31421
|
[onDrop, stopAutoScroll]
|
|
30707
31422
|
);
|
|
30708
|
-
const handleOverlayWheel =
|
|
31423
|
+
const handleOverlayWheel = useCallback87(
|
|
30709
31424
|
(e) => {
|
|
30710
31425
|
const container = getScrollContainer();
|
|
30711
31426
|
if (container === window) {
|
|
@@ -30716,7 +31431,7 @@ var ExternalDropZone = ({
|
|
|
30716
31431
|
},
|
|
30717
31432
|
[getScrollContainer]
|
|
30718
31433
|
);
|
|
30719
|
-
|
|
31434
|
+
useEffect93(() => {
|
|
30720
31435
|
if (!isPlacementMode) return;
|
|
30721
31436
|
const handleKeyDown = (e) => {
|
|
30722
31437
|
if (e.key === "Escape") {
|
|
@@ -30739,13 +31454,13 @@ var ExternalDropZone = ({
|
|
|
30739
31454
|
document.removeEventListener("click", handleGlobalClick, true);
|
|
30740
31455
|
};
|
|
30741
31456
|
}, [isPlacementMode, onPlacementCancel]);
|
|
30742
|
-
|
|
31457
|
+
useEffect93(() => {
|
|
30743
31458
|
if (!isPlacementMode) {
|
|
30744
31459
|
setIsHoveringInPlacementMode(false);
|
|
30745
31460
|
dropPositionRef.current = null;
|
|
30746
31461
|
}
|
|
30747
31462
|
}, [isPlacementMode]);
|
|
30748
|
-
|
|
31463
|
+
useEffect93(() => {
|
|
30749
31464
|
const isActive = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
30750
31465
|
if (isActive) {
|
|
30751
31466
|
document.body.classList.add("external-artifact-drag-active");
|
|
@@ -30756,19 +31471,19 @@ var ExternalDropZone = ({
|
|
|
30756
31471
|
document.body.classList.remove("external-artifact-drag-active");
|
|
30757
31472
|
};
|
|
30758
31473
|
}, [isValidDrag, isPlacementMode, isHoveringInPlacementMode]);
|
|
30759
|
-
|
|
31474
|
+
useEffect93(() => {
|
|
30760
31475
|
return () => {
|
|
30761
31476
|
if (scrollAnimationRef.current) {
|
|
30762
31477
|
cancelAnimationFrame(scrollAnimationRef.current);
|
|
30763
31478
|
}
|
|
30764
31479
|
};
|
|
30765
31480
|
}, []);
|
|
30766
|
-
const indicatorWithPosition = dropIndicator &&
|
|
31481
|
+
const indicatorWithPosition = dropIndicator && React268.isValidElement(dropIndicator) ? React268.cloneElement(dropIndicator, {
|
|
30767
31482
|
indicatorTop: typeof indicatorStyle.top === "number" ? indicatorStyle.top : void 0
|
|
30768
31483
|
}) : dropIndicator;
|
|
30769
31484
|
const shouldShowIndicator = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
30770
|
-
return /* @__PURE__ */
|
|
30771
|
-
|
|
31485
|
+
return /* @__PURE__ */ React268.createElement(
|
|
31486
|
+
Box56,
|
|
30772
31487
|
{
|
|
30773
31488
|
ref: containerRef,
|
|
30774
31489
|
style: {
|
|
@@ -30783,8 +31498,8 @@ var ExternalDropZone = ({
|
|
|
30783
31498
|
"data-placement-mode": isPlacementMode ? "true" : void 0
|
|
30784
31499
|
},
|
|
30785
31500
|
children,
|
|
30786
|
-
isPlacementMode && /* @__PURE__ */
|
|
30787
|
-
|
|
31501
|
+
isPlacementMode && /* @__PURE__ */ React268.createElement(
|
|
31502
|
+
Box56,
|
|
30788
31503
|
{
|
|
30789
31504
|
style: {
|
|
30790
31505
|
position: "absolute",
|
|
@@ -30803,7 +31518,7 @@ var ExternalDropZone = ({
|
|
|
30803
31518
|
onWheel: handleOverlayWheel
|
|
30804
31519
|
}
|
|
30805
31520
|
),
|
|
30806
|
-
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */
|
|
31521
|
+
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */ React268.createElement(Box56, { style: { ...indicatorStyle, background: "none", border: "none", boxShadow: "none" } }, indicatorWithPosition)
|
|
30807
31522
|
);
|
|
30808
31523
|
};
|
|
30809
31524
|
|
|
@@ -30829,8 +31544,8 @@ function IxoEditorContent({
|
|
|
30829
31544
|
}) {
|
|
30830
31545
|
const { activePanel } = usePanelStore();
|
|
30831
31546
|
const isPanelOpen = activePanel !== null;
|
|
30832
|
-
const [isRoomPrivate, setIsRoomPrivate] =
|
|
30833
|
-
|
|
31547
|
+
const [isRoomPrivate, setIsRoomPrivate] = useState112(pageHeaderProps?.isPrivate ?? true);
|
|
31548
|
+
useEffect94(() => {
|
|
30834
31549
|
const matrixClient = editor.getMatrixClient?.();
|
|
30835
31550
|
const roomId = editor.getRoomId?.();
|
|
30836
31551
|
if (!matrixClient || !roomId) return;
|
|
@@ -30846,7 +31561,7 @@ function IxoEditorContent({
|
|
|
30846
31561
|
} catch {
|
|
30847
31562
|
}
|
|
30848
31563
|
}, [editor]);
|
|
30849
|
-
const handlePrivacyChange =
|
|
31564
|
+
const handlePrivacyChange = useCallback88(
|
|
30850
31565
|
async (makePrivate) => {
|
|
30851
31566
|
const matrixClient = editor.getMatrixClient?.();
|
|
30852
31567
|
const roomId = editor.getRoomId?.();
|
|
@@ -30867,7 +31582,7 @@ function IxoEditorContent({
|
|
|
30867
31582
|
},
|
|
30868
31583
|
[editor]
|
|
30869
31584
|
);
|
|
30870
|
-
const editorContent = /* @__PURE__ */
|
|
31585
|
+
const editorContent = /* @__PURE__ */ React269.createElement(
|
|
30871
31586
|
BlockNoteView,
|
|
30872
31587
|
{
|
|
30873
31588
|
editor,
|
|
@@ -30882,7 +31597,7 @@ function IxoEditorContent({
|
|
|
30882
31597
|
onChange,
|
|
30883
31598
|
onSelectionChange
|
|
30884
31599
|
},
|
|
30885
|
-
config.slashMenu && /* @__PURE__ */
|
|
31600
|
+
config.slashMenu && /* @__PURE__ */ React269.createElement(
|
|
30886
31601
|
SuggestionMenuController,
|
|
30887
31602
|
{
|
|
30888
31603
|
triggerCharacter: "/",
|
|
@@ -30901,7 +31616,7 @@ function IxoEditorContent({
|
|
|
30901
31616
|
),
|
|
30902
31617
|
children
|
|
30903
31618
|
);
|
|
30904
|
-
return /* @__PURE__ */
|
|
31619
|
+
return /* @__PURE__ */ React269.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React269.createElement(
|
|
30905
31620
|
"div",
|
|
30906
31621
|
{
|
|
30907
31622
|
className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`,
|
|
@@ -30910,9 +31625,9 @@ function IxoEditorContent({
|
|
|
30910
31625
|
transition: "width 0.2s ease"
|
|
30911
31626
|
}
|
|
30912
31627
|
},
|
|
30913
|
-
selfNav && /* @__PURE__ */
|
|
30914
|
-
/* @__PURE__ */
|
|
30915
|
-
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */
|
|
31628
|
+
selfNav && /* @__PURE__ */ React269.createElement(PageHeader, { ...pageHeaderProps, isPrivate: isRoomPrivate, onPrivacyChange: handlePrivacyChange }),
|
|
31629
|
+
/* @__PURE__ */ React269.createElement(CoverImage, { coverImageUrl, logoUrl }),
|
|
31630
|
+
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */ React269.createElement(
|
|
30916
31631
|
ExternalDropZone,
|
|
30917
31632
|
{
|
|
30918
31633
|
editor,
|
|
@@ -30925,7 +31640,7 @@ function IxoEditorContent({
|
|
|
30925
31640
|
},
|
|
30926
31641
|
editorContent
|
|
30927
31642
|
) : editorContent
|
|
30928
|
-
), isPanelVisible && /* @__PURE__ */
|
|
31643
|
+
), isPanelVisible && /* @__PURE__ */ React269.createElement(PanelContent, { theme: config.theme }));
|
|
30929
31644
|
}
|
|
30930
31645
|
function IxoEditor({
|
|
30931
31646
|
editor,
|
|
@@ -30966,7 +31681,7 @@ function IxoEditor({
|
|
|
30966
31681
|
tableHandles: true
|
|
30967
31682
|
};
|
|
30968
31683
|
const isEditable = editable;
|
|
30969
|
-
const editorContent = /* @__PURE__ */
|
|
31684
|
+
const editorContent = /* @__PURE__ */ React269.createElement(
|
|
30970
31685
|
BlocknoteProvider,
|
|
30971
31686
|
{
|
|
30972
31687
|
editor,
|
|
@@ -30979,7 +31694,7 @@ function IxoEditor({
|
|
|
30979
31694
|
domainCardRenderer,
|
|
30980
31695
|
mapConfig
|
|
30981
31696
|
},
|
|
30982
|
-
/* @__PURE__ */
|
|
31697
|
+
/* @__PURE__ */ React269.createElement(
|
|
30983
31698
|
IxoEditorContent,
|
|
30984
31699
|
{
|
|
30985
31700
|
isPanelVisible,
|
|
@@ -31003,15 +31718,15 @@ function IxoEditor({
|
|
|
31003
31718
|
)
|
|
31004
31719
|
);
|
|
31005
31720
|
if (mantineTheme) {
|
|
31006
|
-
return /* @__PURE__ */
|
|
31721
|
+
return /* @__PURE__ */ React269.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
|
|
31007
31722
|
}
|
|
31008
31723
|
return editorContent;
|
|
31009
31724
|
}
|
|
31010
31725
|
|
|
31011
31726
|
// src/mantine/components/EntitySigningSetup.tsx
|
|
31012
|
-
import
|
|
31013
|
-
import { Modal as Modal3, Stack as
|
|
31014
|
-
import { IconAlertCircle as IconAlertCircle18, IconCheck as
|
|
31727
|
+
import React270, { useState as useState113 } from "react";
|
|
31728
|
+
import { Modal as Modal3, Stack as Stack174, Text as Text149, TextInput as TextInput9, Button as Button48, Alert as Alert47, Group as Group97 } from "@mantine/core";
|
|
31729
|
+
import { IconAlertCircle as IconAlertCircle18, IconCheck as IconCheck20, IconKey as IconKey2 } from "@tabler/icons-react";
|
|
31015
31730
|
var EntitySigningSetup = ({
|
|
31016
31731
|
opened,
|
|
31017
31732
|
onClose,
|
|
@@ -31019,11 +31734,11 @@ var EntitySigningSetup = ({
|
|
|
31019
31734
|
entityName,
|
|
31020
31735
|
onSetup
|
|
31021
31736
|
}) => {
|
|
31022
|
-
const [pin, setPin] =
|
|
31023
|
-
const [confirmPin, setConfirmPin] =
|
|
31024
|
-
const [loading, setLoading] =
|
|
31025
|
-
const [error, setError] =
|
|
31026
|
-
const [success, setSuccess] =
|
|
31737
|
+
const [pin, setPin] = useState113("");
|
|
31738
|
+
const [confirmPin, setConfirmPin] = useState113("");
|
|
31739
|
+
const [loading, setLoading] = useState113(false);
|
|
31740
|
+
const [error, setError] = useState113(null);
|
|
31741
|
+
const [success, setSuccess] = useState113(false);
|
|
31027
31742
|
const handleSetup = async () => {
|
|
31028
31743
|
if (pin.length < 4) {
|
|
31029
31744
|
setError("PIN must be at least 4 characters");
|
|
@@ -31063,15 +31778,15 @@ var EntitySigningSetup = ({
|
|
|
31063
31778
|
setSuccess(false);
|
|
31064
31779
|
}
|
|
31065
31780
|
};
|
|
31066
|
-
return /* @__PURE__ */
|
|
31781
|
+
return /* @__PURE__ */ React270.createElement(
|
|
31067
31782
|
Modal3,
|
|
31068
31783
|
{
|
|
31069
31784
|
opened,
|
|
31070
31785
|
onClose: handleClose,
|
|
31071
|
-
title: /* @__PURE__ */
|
|
31786
|
+
title: /* @__PURE__ */ React270.createElement(Group97, { gap: "xs" }, /* @__PURE__ */ React270.createElement(IconKey2, { size: 20 }), /* @__PURE__ */ React270.createElement(Text149, { fw: 600 }, "Entity Signing Setup")),
|
|
31072
31787
|
size: "md"
|
|
31073
31788
|
},
|
|
31074
|
-
/* @__PURE__ */
|
|
31789
|
+
/* @__PURE__ */ React270.createElement(Stack174, { gap: "md" }, success ? /* @__PURE__ */ React270.createElement(Alert47, { color: "green", icon: /* @__PURE__ */ React270.createElement(IconCheck20, { size: 16 }) }, "Entity signing key set up successfully!") : /* @__PURE__ */ React270.createElement(React270.Fragment, null, /* @__PURE__ */ React270.createElement(Text149, { size: "sm", c: "dimmed" }, "Flow authorization requires a signing key for", " ", /* @__PURE__ */ React270.createElement(Text149, { span: true, fw: 500 }, entityName || entityDid), "."), /* @__PURE__ */ React270.createElement(Alert47, { color: "blue", variant: "light" }, /* @__PURE__ */ React270.createElement(Text149, { size: "sm" }, "This is a ", /* @__PURE__ */ React270.createElement("strong", null, "one-time setup"), " that allows flows to grant permissions without requiring wallet signatures for each delegation.")), /* @__PURE__ */ React270.createElement(Stack174, { gap: "xs" }, /* @__PURE__ */ React270.createElement(Text149, { size: "sm", fw: 500 }, "What happens:"), /* @__PURE__ */ React270.createElement(Text149, { size: "sm", c: "dimmed" }, "1. A new signing key is generated"), /* @__PURE__ */ React270.createElement(Text149, { size: "sm", c: "dimmed" }, "2. Key is registered on the entity's DID document (requires wallet)"), /* @__PURE__ */ React270.createElement(Text149, { size: "sm", c: "dimmed" }, "3. Key is stored encrypted in the entity's Matrix room")), /* @__PURE__ */ React270.createElement(
|
|
31075
31790
|
TextInput9,
|
|
31076
31791
|
{
|
|
31077
31792
|
label: "Enter PIN to encrypt signing key",
|
|
@@ -31082,7 +31797,7 @@ var EntitySigningSetup = ({
|
|
|
31082
31797
|
onChange: (e) => setPin(e.currentTarget.value),
|
|
31083
31798
|
disabled: loading
|
|
31084
31799
|
}
|
|
31085
|
-
), /* @__PURE__ */
|
|
31800
|
+
), /* @__PURE__ */ React270.createElement(
|
|
31086
31801
|
TextInput9,
|
|
31087
31802
|
{
|
|
31088
31803
|
label: "Confirm PIN",
|
|
@@ -31092,12 +31807,12 @@ var EntitySigningSetup = ({
|
|
|
31092
31807
|
onChange: (e) => setConfirmPin(e.currentTarget.value),
|
|
31093
31808
|
disabled: loading
|
|
31094
31809
|
}
|
|
31095
|
-
), error && /* @__PURE__ */
|
|
31810
|
+
), error && /* @__PURE__ */ React270.createElement(Alert47, { color: "red", icon: /* @__PURE__ */ React270.createElement(IconAlertCircle18, { size: 16 }) }, error), /* @__PURE__ */ React270.createElement(Group97, { justify: "flex-end", mt: "md" }, /* @__PURE__ */ React270.createElement(Button48, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React270.createElement(
|
|
31096
31811
|
Button48,
|
|
31097
31812
|
{
|
|
31098
31813
|
onClick: handleSetup,
|
|
31099
31814
|
loading,
|
|
31100
|
-
leftSection: /* @__PURE__ */
|
|
31815
|
+
leftSection: /* @__PURE__ */ React270.createElement(IconKey2, { size: 16 })
|
|
31101
31816
|
},
|
|
31102
31817
|
"Setup Entity Signing"
|
|
31103
31818
|
))))
|
|
@@ -31105,8 +31820,8 @@ var EntitySigningSetup = ({
|
|
|
31105
31820
|
};
|
|
31106
31821
|
|
|
31107
31822
|
// src/mantine/components/FlowPermissionsPanel.tsx
|
|
31108
|
-
import
|
|
31109
|
-
import { Stack as
|
|
31823
|
+
import React271, { useState as useState114, useEffect as useEffect95, useMemo as useMemo107 } from "react";
|
|
31824
|
+
import { Stack as Stack175, Text as Text150, Paper as Paper18, Group as Group98, Badge as Badge43, Button as Button49, ActionIcon as ActionIcon35, Loader as Loader47, Alert as Alert48, Divider as Divider28 } from "@mantine/core";
|
|
31110
31825
|
import { IconPlus as IconPlus10, IconTrash as IconTrash10, IconShieldCheck as IconShieldCheck14, IconUser as IconUser15, IconRobot as IconRobot4, IconBuilding as IconBuilding2 } from "@tabler/icons-react";
|
|
31111
31826
|
var FlowPermissionsPanel = ({
|
|
31112
31827
|
editor,
|
|
@@ -31116,11 +31831,11 @@ var FlowPermissionsPanel = ({
|
|
|
31116
31831
|
onRevokePermission,
|
|
31117
31832
|
getUserDisplayName
|
|
31118
31833
|
}) => {
|
|
31119
|
-
const [delegations, setDelegations] =
|
|
31120
|
-
const [loading, setLoading] =
|
|
31121
|
-
const [revoking, setRevoking] =
|
|
31122
|
-
const rootCapability =
|
|
31123
|
-
|
|
31834
|
+
const [delegations, setDelegations] = useState114([]);
|
|
31835
|
+
const [loading, setLoading] = useState114(true);
|
|
31836
|
+
const [revoking, setRevoking] = useState114(null);
|
|
31837
|
+
const rootCapability = useMemo107(() => editor.getRootCapability?.(), [editor]);
|
|
31838
|
+
useEffect95(() => {
|
|
31124
31839
|
const loadDelegations = async () => {
|
|
31125
31840
|
setLoading(true);
|
|
31126
31841
|
const allDelegations = editor.getAllDelegations?.() || [];
|
|
@@ -31159,11 +31874,11 @@ var FlowPermissionsPanel = ({
|
|
|
31159
31874
|
const getIcon2 = (type) => {
|
|
31160
31875
|
switch (type) {
|
|
31161
31876
|
case "oracle":
|
|
31162
|
-
return /* @__PURE__ */
|
|
31877
|
+
return /* @__PURE__ */ React271.createElement(IconRobot4, { size: 16 });
|
|
31163
31878
|
case "entity":
|
|
31164
|
-
return /* @__PURE__ */
|
|
31879
|
+
return /* @__PURE__ */ React271.createElement(IconBuilding2, { size: 16 });
|
|
31165
31880
|
default:
|
|
31166
|
-
return /* @__PURE__ */
|
|
31881
|
+
return /* @__PURE__ */ React271.createElement(IconUser15, { size: 16 });
|
|
31167
31882
|
}
|
|
31168
31883
|
};
|
|
31169
31884
|
const formatCapabilities = (caps) => {
|
|
@@ -31182,7 +31897,7 @@ var FlowPermissionsPanel = ({
|
|
|
31182
31897
|
if (date < /* @__PURE__ */ new Date()) return "Expired";
|
|
31183
31898
|
return date.toLocaleDateString();
|
|
31184
31899
|
};
|
|
31185
|
-
return /* @__PURE__ */
|
|
31900
|
+
return /* @__PURE__ */ React271.createElement(Stack175, { gap: "md" }, /* @__PURE__ */ React271.createElement(Stack175, { gap: "xs" }, /* @__PURE__ */ React271.createElement(Text150, { fw: 600, size: "sm" }, "Root Authority"), /* @__PURE__ */ React271.createElement(Paper18, { p: "sm", withBorder: true }, /* @__PURE__ */ React271.createElement(Group98, { gap: "xs" }, /* @__PURE__ */ React271.createElement(IconShieldCheck14, { size: 20, color: "var(--mantine-color-green-6)" }), /* @__PURE__ */ React271.createElement(Stack175, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React271.createElement(Text150, { size: "sm", fw: 500 }, entityName || entityDid), /* @__PURE__ */ React271.createElement(Text150, { size: "xs", c: "dimmed" }, rootCapability ? `Granted: ${new Date(rootCapability.issuedAt).toLocaleDateString()}` : "Root capability not set up")), /* @__PURE__ */ React271.createElement(Badge43, { color: "green", variant: "light" }, "Entity")))), /* @__PURE__ */ React271.createElement(Divider28, { label: "Delegated Permissions", labelPosition: "center" }), loading ? /* @__PURE__ */ React271.createElement(Group98, { justify: "center", py: "xl" }, /* @__PURE__ */ React271.createElement(Loader47, { size: "sm" })) : delegations.length === 0 ? /* @__PURE__ */ React271.createElement(Alert48, { color: "gray", variant: "light" }, /* @__PURE__ */ React271.createElement(Text150, { size: "sm" }, "No permissions have been granted yet.")) : /* @__PURE__ */ React271.createElement(Stack175, { gap: "xs" }, delegations.map(({ capability, displayName, type }) => /* @__PURE__ */ React271.createElement(Paper18, { key: capability.id, p: "sm", withBorder: true }, /* @__PURE__ */ React271.createElement(Group98, { justify: "space-between" }, /* @__PURE__ */ React271.createElement(Group98, { gap: "xs" }, getIcon2(type), /* @__PURE__ */ React271.createElement(Stack175, { gap: 2 }, /* @__PURE__ */ React271.createElement(Text150, { size: "sm", fw: 500 }, displayName), /* @__PURE__ */ React271.createElement(Text150, { size: "xs", c: "dimmed" }, formatCapabilities(capability.capabilities)), /* @__PURE__ */ React271.createElement(Group98, { gap: "xs" }, /* @__PURE__ */ React271.createElement(Text150, { size: "xs", c: "dimmed" }, "Expires: ", formatExpiration(capability.expiration)), /* @__PURE__ */ React271.createElement(Text150, { size: "xs", c: "dimmed" }, "\u2022"), /* @__PURE__ */ React271.createElement(Text150, { size: "xs", c: "dimmed" }, "Granted by: ", capability.issuer === entityDid ? "Entity" : capability.issuer.slice(-8))))), /* @__PURE__ */ React271.createElement(
|
|
31186
31901
|
ActionIcon35,
|
|
31187
31902
|
{
|
|
31188
31903
|
color: "red",
|
|
@@ -31191,11 +31906,11 @@ var FlowPermissionsPanel = ({
|
|
|
31191
31906
|
loading: revoking === capability.id,
|
|
31192
31907
|
disabled: !!revoking
|
|
31193
31908
|
},
|
|
31194
|
-
/* @__PURE__ */
|
|
31195
|
-
))))), /* @__PURE__ */
|
|
31909
|
+
/* @__PURE__ */ React271.createElement(IconTrash10, { size: 16 })
|
|
31910
|
+
))))), /* @__PURE__ */ React271.createElement(
|
|
31196
31911
|
Button49,
|
|
31197
31912
|
{
|
|
31198
|
-
leftSection: /* @__PURE__ */
|
|
31913
|
+
leftSection: /* @__PURE__ */ React271.createElement(IconPlus10, { size: 16 }),
|
|
31199
31914
|
variant: "light",
|
|
31200
31915
|
onClick: onGrantPermission
|
|
31201
31916
|
},
|
|
@@ -31204,20 +31919,20 @@ var FlowPermissionsPanel = ({
|
|
|
31204
31919
|
};
|
|
31205
31920
|
|
|
31206
31921
|
// src/mantine/components/GrantPermissionModal.tsx
|
|
31207
|
-
import
|
|
31922
|
+
import React272, { useState as useState115, useCallback as useCallback89 } from "react";
|
|
31208
31923
|
import {
|
|
31209
31924
|
Modal as Modal4,
|
|
31210
|
-
Stack as
|
|
31211
|
-
Text as
|
|
31925
|
+
Stack as Stack176,
|
|
31926
|
+
Text as Text151,
|
|
31212
31927
|
TextInput as TextInput10,
|
|
31213
31928
|
Button as Button50,
|
|
31214
31929
|
Group as Group99,
|
|
31215
31930
|
Radio as Radio6,
|
|
31216
31931
|
Checkbox as Checkbox14,
|
|
31217
|
-
Alert as
|
|
31932
|
+
Alert as Alert49,
|
|
31218
31933
|
Paper as Paper19,
|
|
31219
|
-
Loader as
|
|
31220
|
-
Badge as
|
|
31934
|
+
Loader as Loader48,
|
|
31935
|
+
Badge as Badge44,
|
|
31221
31936
|
ActionIcon as ActionIcon36,
|
|
31222
31937
|
Divider as Divider29,
|
|
31223
31938
|
NumberInput as NumberInput3
|
|
@@ -31236,21 +31951,21 @@ var GrantPermissionModal = ({
|
|
|
31236
31951
|
const singleBlockMode = !!targetBlockId || blocks.length === 1;
|
|
31237
31952
|
const fixedBlockId = targetBlockId || (blocks.length === 1 ? blocks[0].id : null);
|
|
31238
31953
|
const fixedBlock = fixedBlockId ? blocks.find((b) => b.id === fixedBlockId) || blocks[0] : null;
|
|
31239
|
-
const [recipientType, setRecipientType] =
|
|
31240
|
-
const [searchQuery, setSearchQuery] =
|
|
31241
|
-
const [searchResults, setSearchResults] =
|
|
31242
|
-
const [searching, setSearching] =
|
|
31243
|
-
const [selectedRecipient, setSelectedRecipient] =
|
|
31244
|
-
const [manualDid, setManualDid] =
|
|
31245
|
-
const [scopeType, setScopeType] =
|
|
31246
|
-
const [selectedBlocks, setSelectedBlocks] =
|
|
31247
|
-
const [expirationEnabled, setExpirationEnabled] =
|
|
31248
|
-
const [expirationDays, setExpirationDays] =
|
|
31249
|
-
const [canDelegate, setCanDelegate] =
|
|
31250
|
-
const [pin, setPin] =
|
|
31251
|
-
const [loading, setLoading] =
|
|
31252
|
-
const [error, setError] =
|
|
31253
|
-
const handleSearch =
|
|
31954
|
+
const [recipientType, setRecipientType] = useState115("user");
|
|
31955
|
+
const [searchQuery, setSearchQuery] = useState115("");
|
|
31956
|
+
const [searchResults, setSearchResults] = useState115([]);
|
|
31957
|
+
const [searching, setSearching] = useState115(false);
|
|
31958
|
+
const [selectedRecipient, setSelectedRecipient] = useState115(null);
|
|
31959
|
+
const [manualDid, setManualDid] = useState115("");
|
|
31960
|
+
const [scopeType, setScopeType] = useState115("full");
|
|
31961
|
+
const [selectedBlocks, setSelectedBlocks] = useState115([]);
|
|
31962
|
+
const [expirationEnabled, setExpirationEnabled] = useState115(false);
|
|
31963
|
+
const [expirationDays, setExpirationDays] = useState115(30);
|
|
31964
|
+
const [canDelegate, setCanDelegate] = useState115(false);
|
|
31965
|
+
const [pin, setPin] = useState115("");
|
|
31966
|
+
const [loading, setLoading] = useState115(false);
|
|
31967
|
+
const [error, setError] = useState115(null);
|
|
31968
|
+
const handleSearch = useCallback89(async () => {
|
|
31254
31969
|
if (searchQuery.length < 2) return;
|
|
31255
31970
|
setSearching(true);
|
|
31256
31971
|
try {
|
|
@@ -31337,29 +32052,29 @@ var GrantPermissionModal = ({
|
|
|
31337
32052
|
resetForm();
|
|
31338
32053
|
}
|
|
31339
32054
|
};
|
|
31340
|
-
return /* @__PURE__ */
|
|
32055
|
+
return /* @__PURE__ */ React272.createElement(
|
|
31341
32056
|
Modal4,
|
|
31342
32057
|
{
|
|
31343
32058
|
opened,
|
|
31344
32059
|
onClose: handleClose,
|
|
31345
|
-
title: /* @__PURE__ */
|
|
32060
|
+
title: /* @__PURE__ */ React272.createElement(Group99, { gap: "xs" }, /* @__PURE__ */ React272.createElement(IconShieldPlus4, { size: 20 }), /* @__PURE__ */ React272.createElement(Text151, { fw: 600 }, "Grant Permission")),
|
|
31346
32061
|
size: "lg"
|
|
31347
32062
|
},
|
|
31348
|
-
/* @__PURE__ */
|
|
32063
|
+
/* @__PURE__ */ React272.createElement(Stack176, { gap: "md" }, /* @__PURE__ */ React272.createElement(Stack176, { gap: "xs" }, /* @__PURE__ */ React272.createElement(Text151, { size: "sm", fw: 500 }, "Recipient Type"), /* @__PURE__ */ React272.createElement(Radio6.Group, { value: recipientType, onChange: (v) => {
|
|
31349
32064
|
setRecipientType(v);
|
|
31350
32065
|
setSelectedRecipient(null);
|
|
31351
32066
|
setSearchResults([]);
|
|
31352
|
-
} }, /* @__PURE__ */
|
|
32067
|
+
} }, /* @__PURE__ */ React272.createElement(Group99, null, /* @__PURE__ */ React272.createElement(Radio6, { value: "user", label: "User" }), /* @__PURE__ */ React272.createElement(Radio6, { value: "oracle", label: "Oracle" }), /* @__PURE__ */ React272.createElement(Radio6, { value: "manual", label: "Enter DID" })))), recipientType !== "manual" ? /* @__PURE__ */ React272.createElement(Stack176, { gap: "xs" }, /* @__PURE__ */ React272.createElement(
|
|
31353
32068
|
TextInput10,
|
|
31354
32069
|
{
|
|
31355
32070
|
placeholder: recipientType === "oracle" ? "Search oracles..." : "Search users...",
|
|
31356
|
-
leftSection: /* @__PURE__ */
|
|
31357
|
-
rightSection: searching ? /* @__PURE__ */
|
|
32071
|
+
leftSection: /* @__PURE__ */ React272.createElement(IconSearch7, { size: 16 }),
|
|
32072
|
+
rightSection: searching ? /* @__PURE__ */ React272.createElement(Loader48, { size: 14 }) : null,
|
|
31358
32073
|
value: searchQuery,
|
|
31359
32074
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
31360
32075
|
onKeyDown: (e) => e.key === "Enter" && handleSearch()
|
|
31361
32076
|
}
|
|
31362
|
-
), selectedRecipient ? /* @__PURE__ */
|
|
32077
|
+
), selectedRecipient ? /* @__PURE__ */ React272.createElement(Paper19, { p: "sm", withBorder: true }, /* @__PURE__ */ React272.createElement(Group99, { justify: "space-between" }, /* @__PURE__ */ React272.createElement(Group99, { gap: "xs" }, recipientType === "oracle" ? /* @__PURE__ */ React272.createElement(IconRobot5, { size: 16 }) : /* @__PURE__ */ React272.createElement(IconUser16, { size: 16 }), /* @__PURE__ */ React272.createElement(Text151, { size: "sm" }, selectedRecipient.displayName), /* @__PURE__ */ React272.createElement(Badge44, { size: "xs", variant: "light" }, selectedRecipient.did.slice(-12))), /* @__PURE__ */ React272.createElement(ActionIcon36, { size: "sm", variant: "subtle", onClick: () => setSelectedRecipient(null) }, /* @__PURE__ */ React272.createElement(IconX14, { size: 14 })))) : searchResults.length > 0 ? /* @__PURE__ */ React272.createElement(Paper19, { p: "xs", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React272.createElement(Stack176, { gap: 4 }, searchResults.map((result) => /* @__PURE__ */ React272.createElement(
|
|
31363
32078
|
Button50,
|
|
31364
32079
|
{
|
|
31365
32080
|
key: result.did,
|
|
@@ -31369,7 +32084,7 @@ var GrantPermissionModal = ({
|
|
|
31369
32084
|
onClick: () => setSelectedRecipient(result)
|
|
31370
32085
|
},
|
|
31371
32086
|
result.displayName
|
|
31372
|
-
)))) : null) : /* @__PURE__ */
|
|
32087
|
+
)))) : null) : /* @__PURE__ */ React272.createElement(
|
|
31373
32088
|
TextInput10,
|
|
31374
32089
|
{
|
|
31375
32090
|
label: "Recipient DID",
|
|
@@ -31377,12 +32092,12 @@ var GrantPermissionModal = ({
|
|
|
31377
32092
|
value: manualDid,
|
|
31378
32093
|
onChange: (e) => setManualDid(e.currentTarget.value)
|
|
31379
32094
|
}
|
|
31380
|
-
), /* @__PURE__ */
|
|
32095
|
+
), /* @__PURE__ */ React272.createElement(Divider29, null), /* @__PURE__ */ React272.createElement(Stack176, { gap: "xs" }, /* @__PURE__ */ React272.createElement(Text151, { size: "sm", fw: 500 }, "Permission Scope"), singleBlockMode && fixedBlock ? (
|
|
31381
32096
|
// Single block mode: show fixed block info
|
|
31382
|
-
/* @__PURE__ */
|
|
32097
|
+
/* @__PURE__ */ React272.createElement(Paper19, { p: "sm", withBorder: true }, /* @__PURE__ */ React272.createElement(Group99, { gap: "xs" }, /* @__PURE__ */ React272.createElement(Badge44, { variant: "light", color: "blue" }, fixedBlock.type), /* @__PURE__ */ React272.createElement(Text151, { size: "sm" }, fixedBlock.name || `Block ${fixedBlock.id.slice(-8)}`)), /* @__PURE__ */ React272.createElement(Text151, { size: "xs", c: "dimmed", mt: "xs" }, "Permission will be granted to execute this specific block."))
|
|
31383
32098
|
) : (
|
|
31384
32099
|
// Multi-block mode: show scope selection
|
|
31385
|
-
/* @__PURE__ */
|
|
32100
|
+
/* @__PURE__ */ React272.createElement(React272.Fragment, null, /* @__PURE__ */ React272.createElement(Radio6.Group, { value: scopeType, onChange: (v) => setScopeType(v) }, /* @__PURE__ */ React272.createElement(Stack176, { gap: "xs" }, /* @__PURE__ */ React272.createElement(Radio6, { value: "full", label: "Full flow access (can execute any block)" }), /* @__PURE__ */ React272.createElement(Radio6, { value: "blocks", label: "Specific blocks only" }))), scopeType === "blocks" && /* @__PURE__ */ React272.createElement(Paper19, { p: "sm", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React272.createElement(Stack176, { gap: "xs" }, blocks.map((block) => /* @__PURE__ */ React272.createElement(
|
|
31386
32101
|
Checkbox14,
|
|
31387
32102
|
{
|
|
31388
32103
|
key: block.id,
|
|
@@ -31397,14 +32112,14 @@ var GrantPermissionModal = ({
|
|
|
31397
32112
|
}
|
|
31398
32113
|
}
|
|
31399
32114
|
)))))
|
|
31400
|
-
)), /* @__PURE__ */
|
|
32115
|
+
)), /* @__PURE__ */ React272.createElement(Divider29, null), /* @__PURE__ */ React272.createElement(Stack176, { gap: "xs" }, /* @__PURE__ */ React272.createElement(
|
|
31401
32116
|
Checkbox14,
|
|
31402
32117
|
{
|
|
31403
32118
|
label: "Set expiration",
|
|
31404
32119
|
checked: expirationEnabled,
|
|
31405
32120
|
onChange: (e) => setExpirationEnabled(e.currentTarget.checked)
|
|
31406
32121
|
}
|
|
31407
|
-
), expirationEnabled && /* @__PURE__ */
|
|
32122
|
+
), expirationEnabled && /* @__PURE__ */ React272.createElement(
|
|
31408
32123
|
NumberInput3,
|
|
31409
32124
|
{
|
|
31410
32125
|
label: "Expires in (days)",
|
|
@@ -31414,7 +32129,7 @@ var GrantPermissionModal = ({
|
|
|
31414
32129
|
min: 1,
|
|
31415
32130
|
max: 365
|
|
31416
32131
|
}
|
|
31417
|
-
)), /* @__PURE__ */
|
|
32132
|
+
)), /* @__PURE__ */ React272.createElement(
|
|
31418
32133
|
Checkbox14,
|
|
31419
32134
|
{
|
|
31420
32135
|
label: "Recipient can grant permissions to others",
|
|
@@ -31422,7 +32137,7 @@ var GrantPermissionModal = ({
|
|
|
31422
32137
|
checked: canDelegate,
|
|
31423
32138
|
onChange: (e) => setCanDelegate(e.currentTarget.checked)
|
|
31424
32139
|
}
|
|
31425
|
-
), /* @__PURE__ */
|
|
32140
|
+
), /* @__PURE__ */ React272.createElement(Divider29, null), /* @__PURE__ */ React272.createElement(
|
|
31426
32141
|
TextInput10,
|
|
31427
32142
|
{
|
|
31428
32143
|
label: "Enter your PIN to sign this delegation",
|
|
@@ -31431,7 +32146,7 @@ var GrantPermissionModal = ({
|
|
|
31431
32146
|
value: pin,
|
|
31432
32147
|
onChange: (e) => setPin(e.currentTarget.value)
|
|
31433
32148
|
}
|
|
31434
|
-
), error && /* @__PURE__ */
|
|
32149
|
+
), error && /* @__PURE__ */ React272.createElement(Alert49, { color: "red" }, error), /* @__PURE__ */ React272.createElement(Group99, { justify: "flex-end" }, /* @__PURE__ */ React272.createElement(Button50, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React272.createElement(Button50, { onClick: handleGrant, loading }, "Grant Permission")))
|
|
31435
32150
|
);
|
|
31436
32151
|
};
|
|
31437
32152
|
|
|
@@ -31548,4 +32263,4 @@ export {
|
|
|
31548
32263
|
getExtraSlashMenuItems,
|
|
31549
32264
|
useCreateIxoEditor
|
|
31550
32265
|
};
|
|
31551
|
-
//# sourceMappingURL=chunk-
|
|
32266
|
+
//# sourceMappingURL=chunk-EE3V7B4I.mjs.map
|