@ixo/editor 3.0.0-beta.1 → 3.0.0-beta.2
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-HHEGZUQF.mjs} +1023 -406
- package/dist/chunk-HHEGZUQF.mjs.map +1 -0
- package/dist/{graphql-client-B5TxlMUU.d.ts → graphql-client-Dv0q3wZe.d.ts} +1 -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: {
|
|
@@ -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 = [];
|
|
@@ -24789,11 +24865,11 @@ var FlowLinkBlockSpec = createReactBlockSpec20(
|
|
|
24789
24865
|
);
|
|
24790
24866
|
|
|
24791
24867
|
// src/mantine/blocks/action/ActionBlockSpec.tsx
|
|
24792
|
-
import
|
|
24868
|
+
import React253 from "react";
|
|
24793
24869
|
import { createReactBlockSpec as createReactBlockSpec21 } from "@blocknote/react";
|
|
24794
24870
|
|
|
24795
24871
|
// src/mantine/blocks/action/ActionBlock.tsx
|
|
24796
|
-
import
|
|
24872
|
+
import React252 from "react";
|
|
24797
24873
|
|
|
24798
24874
|
// src/mantine/blocks/action/template/TemplateView.tsx
|
|
24799
24875
|
import React237, { useMemo as useMemo85 } from "react";
|
|
@@ -25107,6 +25183,14 @@ var ActionTemplateView = ({ editor, block }) => {
|
|
|
25107
25183
|
import React238, { useMemo as useMemo86, useState as useState88 } from "react";
|
|
25108
25184
|
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
25185
|
import { IconPlayerPlay as IconPlayerPlay2, IconAlertTriangle as IconAlertTriangle3, IconUser as IconUser14, IconBolt as IconBolt9 } from "@tabler/icons-react";
|
|
25186
|
+
|
|
25187
|
+
// src/mantine/blocks/action/alertStyles.ts
|
|
25188
|
+
var actionAlertStyles = {
|
|
25189
|
+
title: { color: "white" },
|
|
25190
|
+
message: { color: "white" }
|
|
25191
|
+
};
|
|
25192
|
+
|
|
25193
|
+
// src/mantine/blocks/action/flow/FlowView.tsx
|
|
25110
25194
|
var getStatusLabel4 = (runtimeState) => {
|
|
25111
25195
|
switch (runtimeState) {
|
|
25112
25196
|
case "running":
|
|
@@ -25366,7 +25450,7 @@ function GenericFlowPanel({
|
|
|
25366
25450
|
disabled: isDisabled || isLoading || !actionType
|
|
25367
25451
|
},
|
|
25368
25452
|
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))));
|
|
25453
|
+
), 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
25454
|
}
|
|
25371
25455
|
|
|
25372
25456
|
// src/mantine/blocks/action/actionTypes/httpRequest/HttpRequestConfig.tsx
|
|
@@ -25476,7 +25560,7 @@ var HttpRequestConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
25476
25560
|
currentBlockId: blockId,
|
|
25477
25561
|
size: "sm"
|
|
25478
25562
|
}
|
|
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(
|
|
25563
|
+
), /* @__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
25564
|
BaseTextInput,
|
|
25481
25565
|
{
|
|
25482
25566
|
label: "Field Path",
|
|
@@ -25644,7 +25728,7 @@ var HttpRequestFlowDetail = ({ inputs, editor, runtime, updateRuntime, isDisable
|
|
|
25644
25728
|
disabled: isDisabled || isLoading || !endpoint
|
|
25645
25729
|
},
|
|
25646
25730
|
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(
|
|
25731
|
+
), /* @__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
25732
|
headers.reduce(
|
|
25649
25733
|
(acc, h) => {
|
|
25650
25734
|
if (h.key && h.value) acc[h.key] = h.value;
|
|
@@ -25664,7 +25748,7 @@ var HttpRequestFlowDetail = ({ inputs, editor, runtime, updateRuntime, isDisable
|
|
|
25664
25748
|
),
|
|
25665
25749
|
null,
|
|
25666
25750
|
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)))));
|
|
25751
|
+
))), 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
25752
|
};
|
|
25669
25753
|
|
|
25670
25754
|
// src/mantine/blocks/action/actionTypes/httpRequest/index.ts
|
|
@@ -25870,7 +25954,7 @@ var EmailSendConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
25870
25954
|
onChange: (e) => update({ subject: e.currentTarget.value }),
|
|
25871
25955
|
description: "Email subject line (optional \u2014 template may define its own)"
|
|
25872
25956
|
}
|
|
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(
|
|
25957
|
+
), /* @__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
25958
|
DataInput,
|
|
25875
25959
|
{
|
|
25876
25960
|
key: variable.name,
|
|
@@ -25979,7 +26063,7 @@ var BidConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
25979
26063
|
currentBlockId: blockId,
|
|
25980
26064
|
required: true
|
|
25981
26065
|
}
|
|
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(
|
|
26066
|
+
), /* @__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
26067
|
BaseSelect,
|
|
25984
26068
|
{
|
|
25985
26069
|
label: "Claim Collection",
|
|
@@ -25990,7 +26074,7 @@ var BidConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
25990
26074
|
required: true,
|
|
25991
26075
|
searchable: true
|
|
25992
26076
|
}
|
|
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.")));
|
|
26077
|
+
), /* @__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
26078
|
};
|
|
25995
26079
|
|
|
25996
26080
|
// src/mantine/blocks/action/actionTypes/bid/BidFlowDetail.tsx
|
|
@@ -26220,7 +26304,7 @@ var BidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled
|
|
|
26220
26304
|
surveyModel.onComplete.remove(handleSurveyComplete);
|
|
26221
26305
|
};
|
|
26222
26306
|
}, [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(
|
|
26307
|
+
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
26308
|
BaseSelect,
|
|
26225
26309
|
{
|
|
26226
26310
|
label: "Apply As",
|
|
@@ -26240,7 +26324,7 @@ var BidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled
|
|
|
26240
26324
|
disabled: isDisabled || loadingSurvey || submitting || statusLoading || !canSubmit
|
|
26241
26325
|
},
|
|
26242
26326
|
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 }));
|
|
26327
|
+
)), 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
26328
|
};
|
|
26245
26329
|
|
|
26246
26330
|
// src/mantine/blocks/action/actionTypes/bid/index.ts
|
|
@@ -26337,7 +26421,7 @@ var EvaluateBidConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26337
26421
|
currentBlockId: blockId,
|
|
26338
26422
|
required: true
|
|
26339
26423
|
}
|
|
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(
|
|
26424
|
+
), /* @__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
26425
|
BaseSelect,
|
|
26342
26426
|
{
|
|
26343
26427
|
label: "Claim Collection",
|
|
@@ -26357,6 +26441,13 @@ import { ActionIcon as ActionIcon33, Alert as Alert41, Badge as Badge42, Box as
|
|
|
26357
26441
|
import { IconArrowLeft as IconArrowLeft6, IconCheck as IconCheck17, IconChevronDown as IconChevronDown9, IconChevronRight as IconChevronRight11, IconFilter, IconThumbDown, IconThumbUp as IconThumbUp2 } from "@tabler/icons-react";
|
|
26358
26442
|
var USDC_DENOM4 = "ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B";
|
|
26359
26443
|
var IXO_DENOM4 = "uixo";
|
|
26444
|
+
var CUSTOM_DENOM = "__custom__";
|
|
26445
|
+
var createPaymentRow = () => ({
|
|
26446
|
+
id: `payment-${Math.random().toString(36).slice(2, 9)}`,
|
|
26447
|
+
denom: IXO_DENOM4,
|
|
26448
|
+
customDenom: "",
|
|
26449
|
+
amount: ""
|
|
26450
|
+
});
|
|
26360
26451
|
function getTimeAgo(dateString) {
|
|
26361
26452
|
if (!dateString) return "";
|
|
26362
26453
|
try {
|
|
@@ -26427,14 +26518,13 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26427
26518
|
const [submitting, setSubmitting] = useState95(false);
|
|
26428
26519
|
const [error, setError] = useState95(null);
|
|
26429
26520
|
const [rejectReason, setRejectReason] = useState95("");
|
|
26430
|
-
const [maxAmounts, setMaxAmounts] = useState95("[]");
|
|
26431
26521
|
const [adminAddress, setAdminAddress] = useState95("");
|
|
26432
|
-
const [activeFilter, setActiveFilter] = useState95("
|
|
26522
|
+
const [activeFilter, setActiveFilter] = useState95("pending");
|
|
26433
26523
|
const [detailsOpen, setDetailsOpen] = useState95(false);
|
|
26434
26524
|
const [inputsOpen, setInputsOpen] = useState95(false);
|
|
26435
26525
|
const [evaluationOpen, setEvaluationOpen] = useState95(true);
|
|
26436
|
-
const [
|
|
26437
|
-
const [
|
|
26526
|
+
const [paymentRows, setPaymentRows] = useState95([createPaymentRow()]);
|
|
26527
|
+
const [profilesByDid, setProfilesByDid] = useState95({});
|
|
26438
26528
|
const selectedBid = useMemo92(() => bids.find((bid) => bid.id === selectedBidId) || null, [bids, selectedBidId]);
|
|
26439
26529
|
const filteredBids = useMemo92(() => {
|
|
26440
26530
|
if (activeFilter === "all") return bids;
|
|
@@ -26471,8 +26561,7 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26471
26561
|
}, [deedDid, collectionId]);
|
|
26472
26562
|
useEffect77(() => {
|
|
26473
26563
|
setRejectReason("");
|
|
26474
|
-
|
|
26475
|
-
setPaymentAmount("");
|
|
26564
|
+
setPaymentRows([createPaymentRow()]);
|
|
26476
26565
|
setEvaluationOpen(true);
|
|
26477
26566
|
setDetailsOpen(false);
|
|
26478
26567
|
setInputsOpen(false);
|
|
@@ -26481,6 +26570,58 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26481
26570
|
if (!deedDid || !collectionId) return;
|
|
26482
26571
|
refreshBids();
|
|
26483
26572
|
}, [deedDid, collectionId, refreshBids]);
|
|
26573
|
+
useEffect77(() => {
|
|
26574
|
+
let mounted = true;
|
|
26575
|
+
const dids = Array.from(new Set(bids.map((bid) => bid.did).filter(Boolean)));
|
|
26576
|
+
const missing = dids.filter((did) => !profilesByDid[did]);
|
|
26577
|
+
if (missing.length === 0)
|
|
26578
|
+
return () => {
|
|
26579
|
+
mounted = false;
|
|
26580
|
+
};
|
|
26581
|
+
const loadProfiles = async () => {
|
|
26582
|
+
const results = await Promise.all(
|
|
26583
|
+
missing.map(async (did) => {
|
|
26584
|
+
try {
|
|
26585
|
+
const profile = await handlers.getMatrixInfoPerDid(did);
|
|
26586
|
+
return [did, profile];
|
|
26587
|
+
} catch {
|
|
26588
|
+
return [did, null];
|
|
26589
|
+
}
|
|
26590
|
+
})
|
|
26591
|
+
);
|
|
26592
|
+
if (!mounted) return;
|
|
26593
|
+
setProfilesByDid((prev) => {
|
|
26594
|
+
const next = { ...prev };
|
|
26595
|
+
results.forEach(([did, profile]) => {
|
|
26596
|
+
if (profile) {
|
|
26597
|
+
next[did] = profile;
|
|
26598
|
+
}
|
|
26599
|
+
});
|
|
26600
|
+
return next;
|
|
26601
|
+
});
|
|
26602
|
+
};
|
|
26603
|
+
loadProfiles();
|
|
26604
|
+
return () => {
|
|
26605
|
+
mounted = false;
|
|
26606
|
+
};
|
|
26607
|
+
}, [bids, handlers, profilesByDid]);
|
|
26608
|
+
const addPaymentRow = useCallback77(() => {
|
|
26609
|
+
setPaymentRows((prev) => [...prev, createPaymentRow()]);
|
|
26610
|
+
}, []);
|
|
26611
|
+
const removePaymentRow = useCallback77((id) => {
|
|
26612
|
+
setPaymentRows((prev) => prev.length === 1 ? prev : prev.filter((row) => row.id !== id));
|
|
26613
|
+
}, []);
|
|
26614
|
+
const updatePaymentRow = useCallback77((id, patch) => {
|
|
26615
|
+
setPaymentRows((prev) => prev.map((row) => row.id === id ? { ...row, ...patch } : row));
|
|
26616
|
+
}, []);
|
|
26617
|
+
const buildMaxAmounts = useCallback77(() => {
|
|
26618
|
+
return paymentRows.map((row) => {
|
|
26619
|
+
const denom = row.denom === CUSTOM_DENOM ? row.customDenom.trim() : row.denom || "";
|
|
26620
|
+
const amount = Number(row.amount);
|
|
26621
|
+
if (!denom || !Number.isFinite(amount) || amount <= 0) return null;
|
|
26622
|
+
return { denom, amount: String(row.amount) };
|
|
26623
|
+
}).filter((entry) => !!entry);
|
|
26624
|
+
}, [paymentRows]);
|
|
26484
26625
|
const executeEvaluation = useCallback77(
|
|
26485
26626
|
async (decision) => {
|
|
26486
26627
|
if (!selectedBid) {
|
|
@@ -26491,7 +26632,9 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26491
26632
|
setError("Admin address could not be resolved for this collection");
|
|
26492
26633
|
return;
|
|
26493
26634
|
}
|
|
26494
|
-
|
|
26635
|
+
const selectedRole = String(selectedBid.role || "").toLowerCase();
|
|
26636
|
+
const selectedBidIsEvaluator = selectedRole === "evaluation_agent" || selectedRole === "ea";
|
|
26637
|
+
if (decision === "reject" && selectedBidIsEvaluator && !rejectReason.trim()) {
|
|
26495
26638
|
setError("Rejection reason is required");
|
|
26496
26639
|
return;
|
|
26497
26640
|
}
|
|
@@ -26526,8 +26669,8 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26526
26669
|
applicantDid: selectedBid.did,
|
|
26527
26670
|
applicantAddress: selectedBid.address,
|
|
26528
26671
|
adminAddress,
|
|
26529
|
-
maxAmounts,
|
|
26530
|
-
reason: decision === "reject" ? rejectReason : ""
|
|
26672
|
+
maxAmounts: selectedBidIsEvaluator ? JSON.stringify(buildMaxAmounts()) : "[]",
|
|
26673
|
+
reason: decision === "reject" ? selectedBidIsEvaluator ? rejectReason : rejectReason.trim() || "Rejected" : ""
|
|
26531
26674
|
},
|
|
26532
26675
|
{
|
|
26533
26676
|
actorDid,
|
|
@@ -26590,7 +26733,7 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26590
26733
|
editor,
|
|
26591
26734
|
collectionId,
|
|
26592
26735
|
deedDid,
|
|
26593
|
-
|
|
26736
|
+
buildMaxAmounts,
|
|
26594
26737
|
updateRuntime,
|
|
26595
26738
|
refreshBids
|
|
26596
26739
|
]
|
|
@@ -26599,6 +26742,9 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26599
26742
|
const bidStatus = getBidStatus(selectedBid);
|
|
26600
26743
|
const bidRole = String(selectedBid.role || "").toLowerCase();
|
|
26601
26744
|
const bidIsEvaluator = bidRole === "evaluation_agent" || bidRole === "ea";
|
|
26745
|
+
const selectedBidProfile = profilesByDid[selectedBid.did];
|
|
26746
|
+
const selectedDisplayName = selectedBidProfile?.displayname || selectedBid.did || selectedBid.address;
|
|
26747
|
+
const selectedAvatarLabel = (selectedBidProfile?.displayname || selectedBid.did || selectedBid.address || "?")[0]?.toUpperCase();
|
|
26602
26748
|
let bidData = null;
|
|
26603
26749
|
try {
|
|
26604
26750
|
bidData = typeof selectedBid.data === "string" ? JSON.parse(selectedBid.data) : selectedBid.data;
|
|
@@ -26618,11 +26764,14 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26618
26764
|
flexShrink: 0,
|
|
26619
26765
|
fontSize: 16,
|
|
26620
26766
|
fontWeight: 500,
|
|
26621
|
-
color: "#adb5bd"
|
|
26767
|
+
color: "#adb5bd",
|
|
26768
|
+
backgroundImage: selectedBidProfile?.avatarUrl ? `url(${selectedBidProfile.avatarUrl})` : void 0,
|
|
26769
|
+
backgroundSize: "cover",
|
|
26770
|
+
backgroundPosition: "center"
|
|
26622
26771
|
}
|
|
26623
26772
|
},
|
|
26624
|
-
|
|
26625
|
-
), /* @__PURE__ */ React245.createElement(Stack163, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React245.createElement(Text139, { fw: 500, size: "md", truncate: true },
|
|
26773
|
+
selectedBidProfile?.avatarUrl ? null : selectedAvatarLabel
|
|
26774
|
+
), /* @__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
26775
|
Box47,
|
|
26627
26776
|
{
|
|
26628
26777
|
p: "sm",
|
|
@@ -26644,7 +26793,7 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26644
26793
|
},
|
|
26645
26794
|
/* @__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
26795
|
/* @__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(
|
|
26796
|
+
), bidIsEvaluator && /* @__PURE__ */ React245.createElement(
|
|
26648
26797
|
Box47,
|
|
26649
26798
|
{
|
|
26650
26799
|
p: "sm",
|
|
@@ -26663,28 +26812,37 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26663
26812
|
minRows: 2,
|
|
26664
26813
|
disabled: isDisabled || submitting
|
|
26665
26814
|
}
|
|
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(
|
|
26815
|
+
)), /* @__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
26816
|
BaseSelect,
|
|
26677
26817
|
{
|
|
26678
|
-
value:
|
|
26679
|
-
onChange:
|
|
26818
|
+
value: row.denom,
|
|
26819
|
+
onChange: (value) => updatePaymentRow(row.id, { denom: value }),
|
|
26680
26820
|
data: [
|
|
26681
26821
|
{ value: IXO_DENOM4, label: "IXO" },
|
|
26682
|
-
{ value: USDC_DENOM4, label: "USDC" }
|
|
26822
|
+
{ value: USDC_DENOM4, label: "USDC" },
|
|
26823
|
+
{ value: CUSTOM_DENOM, label: "Custom" }
|
|
26683
26824
|
],
|
|
26684
26825
|
clearable: false,
|
|
26685
|
-
|
|
26826
|
+
disabled: isDisabled || submitting
|
|
26827
|
+
}
|
|
26828
|
+
), row.denom === CUSTOM_DENOM && /* @__PURE__ */ React245.createElement(
|
|
26829
|
+
BaseTextInput,
|
|
26830
|
+
{
|
|
26831
|
+
placeholder: "Custom denom (e.g. ibc/... or uixo)",
|
|
26832
|
+
value: row.customDenom,
|
|
26833
|
+
onChange: (event) => updatePaymentRow(row.id, { customDenom: event.currentTarget.value }),
|
|
26834
|
+
disabled: isDisabled || submitting
|
|
26835
|
+
}
|
|
26836
|
+
), /* @__PURE__ */ React245.createElement(
|
|
26837
|
+
BaseNumberInput,
|
|
26838
|
+
{
|
|
26839
|
+
min: 0,
|
|
26840
|
+
value: row.amount,
|
|
26841
|
+
onChange: (value) => updatePaymentRow(row.id, { amount: value }),
|
|
26842
|
+
placeholder: "Amount",
|
|
26843
|
+
disabled: isDisabled || submitting
|
|
26686
26844
|
}
|
|
26687
|
-
)), /* @__PURE__ */ React245.createElement(
|
|
26845
|
+
))), /* @__PURE__ */ React245.createElement(Button44, { variant: "light", size: "xs", onClick: addPaymentRow, disabled: isDisabled || submitting }, "Add Payment")))
|
|
26688
26846
|
), /* @__PURE__ */ React245.createElement(Group90, { gap: "xs" }, /* @__PURE__ */ React245.createElement(
|
|
26689
26847
|
Button44,
|
|
26690
26848
|
{
|
|
@@ -26719,15 +26877,10 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26719
26877
|
}
|
|
26720
26878
|
},
|
|
26721
26879
|
"Reject"
|
|
26722
|
-
)), error && /* @__PURE__ */ React245.createElement(Alert41, { color: "red" }, error), runtime.error?.message && /* @__PURE__ */ React245.createElement(Alert41, { color: "red" }, runtime.error.message));
|
|
26880
|
+
)), 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
26881
|
}
|
|
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(
|
|
26882
|
+
const filterTabs = [{ value: "pending", label: "Pending" }];
|
|
26883
|
+
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
26884
|
UnstyledButton2,
|
|
26732
26885
|
{
|
|
26733
26886
|
key: tab.value,
|
|
@@ -26743,6 +26896,9 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26743
26896
|
/* @__PURE__ */ React245.createElement(Text139, { size: "sm", fw: 500, c: activeFilter === tab.value ? "white" : "dimmed" }, tab.label)
|
|
26744
26897
|
))), /* @__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
26898
|
const status = getBidStatus(bid);
|
|
26899
|
+
const profile = profilesByDid[bid.did];
|
|
26900
|
+
const displayName = profile?.displayname || bid.did || bid.address;
|
|
26901
|
+
const avatarLabel = (profile?.displayname || bid.did || bid.address || "?")[0]?.toUpperCase();
|
|
26746
26902
|
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
26903
|
Box47,
|
|
26748
26904
|
{
|
|
@@ -26757,12 +26913,15 @@ var EvaluateBidFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, is
|
|
|
26757
26913
|
flexShrink: 0,
|
|
26758
26914
|
fontSize: 14,
|
|
26759
26915
|
fontWeight: 500,
|
|
26760
|
-
color: "#adb5bd"
|
|
26916
|
+
color: "#adb5bd",
|
|
26917
|
+
backgroundImage: profile?.avatarUrl ? `url(${profile.avatarUrl})` : void 0,
|
|
26918
|
+
backgroundSize: "cover",
|
|
26919
|
+
backgroundPosition: "center"
|
|
26761
26920
|
}
|
|
26762
26921
|
},
|
|
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));
|
|
26922
|
+
profile?.avatarUrl ? null : avatarLabel
|
|
26923
|
+
), /* @__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 || ""))));
|
|
26924
|
+
}))), 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
26925
|
};
|
|
26767
26926
|
|
|
26768
26927
|
// src/mantine/blocks/action/actionTypes/evaluateBid/index.ts
|
|
@@ -26859,7 +27018,7 @@ var ClaimConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26859
27018
|
currentBlockId: blockId,
|
|
26860
27019
|
required: true
|
|
26861
27020
|
}
|
|
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(
|
|
27021
|
+
), /* @__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
27022
|
BaseSelect,
|
|
26864
27023
|
{
|
|
26865
27024
|
label: "Claim Collection",
|
|
@@ -26875,9 +27034,33 @@ var ClaimConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26875
27034
|
|
|
26876
27035
|
// src/mantine/blocks/action/actionTypes/claim/ClaimFlowDetail.tsx
|
|
26877
27036
|
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";
|
|
27037
|
+
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";
|
|
27038
|
+
import { IconCheck as IconCheck18, IconPlayerPlay as IconPlayerPlay4 } from "@tabler/icons-react";
|
|
26880
27039
|
import { Survey as Survey10, SurveyModel as SurveyModel10 } from "@ixo/surveys";
|
|
27040
|
+
function getTimeAgo2(dateString) {
|
|
27041
|
+
if (!dateString) return "";
|
|
27042
|
+
try {
|
|
27043
|
+
const date = new Date(dateString);
|
|
27044
|
+
const now = /* @__PURE__ */ new Date();
|
|
27045
|
+
const diffMs = now.getTime() - date.getTime();
|
|
27046
|
+
const diffMins = Math.floor(diffMs / 6e4);
|
|
27047
|
+
if (diffMins < 1) return "just now";
|
|
27048
|
+
if (diffMins < 60) return `${diffMins}m ago`;
|
|
27049
|
+
const diffHours = Math.floor(diffMins / 60);
|
|
27050
|
+
if (diffHours < 24) return `${diffHours}h ago`;
|
|
27051
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
27052
|
+
if (diffDays < 30) return `${diffDays} day${diffDays > 1 ? "s" : ""} ago`;
|
|
27053
|
+
const diffMonths = Math.floor(diffDays / 30);
|
|
27054
|
+
return `${diffMonths} month${diffMonths > 1 ? "s" : ""} ago`;
|
|
27055
|
+
} catch {
|
|
27056
|
+
return dateString;
|
|
27057
|
+
}
|
|
27058
|
+
}
|
|
27059
|
+
function truncateAddress2(address) {
|
|
27060
|
+
if (!address) return "";
|
|
27061
|
+
if (address.length <= 14) return address;
|
|
27062
|
+
return `${address.slice(0, 8)}...${address.slice(-3)}`;
|
|
27063
|
+
}
|
|
26881
27064
|
var ClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
26882
27065
|
const handlers = useBlocknoteHandlers();
|
|
26883
27066
|
const services = useMemo94(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
@@ -26916,6 +27099,7 @@ var ClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabl
|
|
|
26916
27099
|
const [loadingSurvey, setLoadingSurvey] = useState97(false);
|
|
26917
27100
|
const [submitting, setSubmitting] = useState97(false);
|
|
26918
27101
|
const [error, setError] = useState97(null);
|
|
27102
|
+
const [profilesByDid, setProfilesByDid] = useState97({});
|
|
26919
27103
|
const surveyModel = useMemo94(() => {
|
|
26920
27104
|
if (!surveyJson) return null;
|
|
26921
27105
|
const model = new SurveyModel10(surveyJson);
|
|
@@ -26952,6 +27136,41 @@ var ClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabl
|
|
|
26952
27136
|
if (!deedDid || !collectionId || !actorDid) return;
|
|
26953
27137
|
fetchClaimsAndAdmin();
|
|
26954
27138
|
}, [deedDid, collectionId, actorDid, fetchClaimsAndAdmin]);
|
|
27139
|
+
useEffect79(() => {
|
|
27140
|
+
let mounted = true;
|
|
27141
|
+
const dids = Array.from(new Set(claims.map((claim) => claim.agentDid).filter(Boolean)));
|
|
27142
|
+
const missing = dids.filter((did) => !profilesByDid[did]);
|
|
27143
|
+
if (missing.length === 0)
|
|
27144
|
+
return () => {
|
|
27145
|
+
mounted = false;
|
|
27146
|
+
};
|
|
27147
|
+
const loadProfiles = async () => {
|
|
27148
|
+
const results = await Promise.all(
|
|
27149
|
+
missing.map(async (did) => {
|
|
27150
|
+
try {
|
|
27151
|
+
const profile = await handlers.getMatrixInfoPerDid(did);
|
|
27152
|
+
return [did, profile];
|
|
27153
|
+
} catch {
|
|
27154
|
+
return [did, null];
|
|
27155
|
+
}
|
|
27156
|
+
})
|
|
27157
|
+
);
|
|
27158
|
+
if (!mounted) return;
|
|
27159
|
+
setProfilesByDid((prev) => {
|
|
27160
|
+
const next = { ...prev };
|
|
27161
|
+
results.forEach(([did, profile]) => {
|
|
27162
|
+
if (profile) {
|
|
27163
|
+
next[did] = profile;
|
|
27164
|
+
}
|
|
27165
|
+
});
|
|
27166
|
+
return next;
|
|
27167
|
+
});
|
|
27168
|
+
};
|
|
27169
|
+
loadProfiles();
|
|
27170
|
+
return () => {
|
|
27171
|
+
mounted = false;
|
|
27172
|
+
};
|
|
27173
|
+
}, [claims, handlers, profilesByDid]);
|
|
26955
27174
|
const startSurvey = useCallback79(async () => {
|
|
26956
27175
|
if (!deedDid) return;
|
|
26957
27176
|
setLoadingSurvey(true);
|
|
@@ -27076,14 +27295,38 @@ var ClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabl
|
|
|
27076
27295
|
}, [surveyModel, handleSurveyComplete]);
|
|
27077
27296
|
const getClaimStatus3 = (claim) => {
|
|
27078
27297
|
const payments = claim.paymentsStatus;
|
|
27079
|
-
if (payments?.approval === "PAID") return { label: "
|
|
27080
|
-
if (payments?.rejection === "PAID") return { label: "
|
|
27081
|
-
return { label: "
|
|
27298
|
+
if (payments?.approval === "PAID") return { label: "Approved", color: "green" };
|
|
27299
|
+
if (payments?.rejection === "PAID") return { label: "Rejected", color: "red" };
|
|
27300
|
+
return { label: "Pending", color: "yellow" };
|
|
27082
27301
|
};
|
|
27083
|
-
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" }, "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(Button45, { leftSection: loadingSurvey ? /* @__PURE__ */ React247.createElement(Loader42, { size: 14 }) : /* @__PURE__ */ React247.createElement(IconPlayerPlay4, { size: 14 }), onClick: startSurvey, disabled: isDisabled || loadingSurvey || submitting }, loadingSurvey ? "Loading Survey..." : "Start New Claim"), 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) => {
|
|
27302
|
+
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(Button45, { leftSection: loadingSurvey ? /* @__PURE__ */ React247.createElement(Loader42, { size: 14 }) : /* @__PURE__ */ React247.createElement(IconPlayerPlay4, { size: 14 }), onClick: startSurvey, disabled: isDisabled || loadingSurvey || submitting }, loadingSurvey ? "Loading Survey..." : "Start New Claim"), 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) => {
|
|
27084
27303
|
const status = getClaimStatus3(claim);
|
|
27085
|
-
|
|
27086
|
-
|
|
27304
|
+
const profile = profilesByDid[claim.agentDid];
|
|
27305
|
+
const displayName = profile?.displayname || claim.agentDid || claim.agentAddress;
|
|
27306
|
+
const avatarLabel = (profile?.displayname || claim.agentDid || claim.agentAddress || "?")[0]?.toUpperCase();
|
|
27307
|
+
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(
|
|
27308
|
+
Box48,
|
|
27309
|
+
{
|
|
27310
|
+
style: {
|
|
27311
|
+
width: 32,
|
|
27312
|
+
height: 32,
|
|
27313
|
+
borderRadius: "50%",
|
|
27314
|
+
background: "var(--mantine-color-neutralColor-6)",
|
|
27315
|
+
display: "flex",
|
|
27316
|
+
alignItems: "center",
|
|
27317
|
+
justifyContent: "center",
|
|
27318
|
+
flexShrink: 0,
|
|
27319
|
+
fontSize: 14,
|
|
27320
|
+
fontWeight: 500,
|
|
27321
|
+
color: "#adb5bd",
|
|
27322
|
+
backgroundImage: profile?.avatarUrl ? `url(${profile.avatarUrl})` : void 0,
|
|
27323
|
+
backgroundSize: "cover",
|
|
27324
|
+
backgroundPosition: "center"
|
|
27325
|
+
}
|
|
27326
|
+
},
|
|
27327
|
+
profile?.avatarUrl ? null : avatarLabel
|
|
27328
|
+
), /* @__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 === "green" ? "green" : status.color === "red" ? "red" : void 0, style: { lineHeight: 1.5 } }, status.color === "green" && /* @__PURE__ */ React247.createElement(IconCheck18, { size: 14, style: { verticalAlign: "middle", marginRight: 2 } }), status.label), /* @__PURE__ */ React247.createElement(Text140, { size: "xs", c: "dimmed" }, getTimeAgo2(claim.submissionDate || ""))));
|
|
27329
|
+
}))), 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
27330
|
};
|
|
27088
27331
|
|
|
27089
27332
|
// src/mantine/blocks/action/actionTypes/claim/index.ts
|
|
@@ -27180,7 +27423,7 @@ var EvaluateClaimConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
27180
27423
|
currentBlockId: blockId,
|
|
27181
27424
|
required: true
|
|
27182
27425
|
}
|
|
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(
|
|
27426
|
+
), /* @__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
27427
|
BaseSelect,
|
|
27185
27428
|
{
|
|
27186
27429
|
label: "Claim Collection",
|
|
@@ -27196,13 +27439,20 @@ var EvaluateClaimConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
27196
27439
|
|
|
27197
27440
|
// src/mantine/blocks/action/actionTypes/evaluateClaim/EvaluateClaimFlowDetail.tsx
|
|
27198
27441
|
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
|
|
27442
|
+
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";
|
|
27443
|
+
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
27444
|
import { Survey as Survey11, SurveyModel as SurveyModel11 } from "@ixo/surveys";
|
|
27202
27445
|
var USDC_DENOM5 = "ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B";
|
|
27203
27446
|
var IXO_DENOM5 = "uixo";
|
|
27447
|
+
var CUSTOM_DENOM2 = "__custom__";
|
|
27204
27448
|
var DECIMALS4 = 6;
|
|
27205
|
-
|
|
27449
|
+
var createPaymentRow2 = () => ({
|
|
27450
|
+
id: `payment-${Math.random().toString(36).slice(2, 9)}`,
|
|
27451
|
+
denom: USDC_DENOM5,
|
|
27452
|
+
customDenom: "",
|
|
27453
|
+
amount: ""
|
|
27454
|
+
});
|
|
27455
|
+
function getTimeAgo3(dateString) {
|
|
27206
27456
|
if (!dateString) return "";
|
|
27207
27457
|
try {
|
|
27208
27458
|
const date = new Date(dateString);
|
|
@@ -27221,11 +27471,16 @@ function getTimeAgo2(dateString) {
|
|
|
27221
27471
|
return dateString;
|
|
27222
27472
|
}
|
|
27223
27473
|
}
|
|
27224
|
-
function
|
|
27474
|
+
function truncateAddress3(address) {
|
|
27225
27475
|
if (!address) return "";
|
|
27226
27476
|
if (address.length <= 14) return address;
|
|
27227
27477
|
return `${address.slice(0, 8)}...${address.slice(-3)}`;
|
|
27228
27478
|
}
|
|
27479
|
+
function truncateId(value, start = 8, end = 6) {
|
|
27480
|
+
if (!value) return "";
|
|
27481
|
+
if (value.length <= start + end + 3) return value;
|
|
27482
|
+
return `${value.slice(0, start)}...${value.slice(-end)}`;
|
|
27483
|
+
}
|
|
27229
27484
|
function getClaimStatus2(claim) {
|
|
27230
27485
|
const payments = claim.paymentsStatus;
|
|
27231
27486
|
if (payments?.approval === "PAID") return { label: "Approved", color: "green" };
|
|
@@ -27269,8 +27524,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27269
27524
|
const [submitting, setSubmitting] = useState99(false);
|
|
27270
27525
|
const [error, setError] = useState99(null);
|
|
27271
27526
|
const [adminAddress, setAdminAddress] = useState99("");
|
|
27272
|
-
const [
|
|
27273
|
-
const [paymentAmount, setPaymentAmount] = useState99("");
|
|
27527
|
+
const [paymentRows, setPaymentRows] = useState99([createPaymentRow2()]);
|
|
27274
27528
|
const [createUdid, setCreateUdid] = useState99(true);
|
|
27275
27529
|
const [claimData, setClaimData] = useState99(null);
|
|
27276
27530
|
const [surveyJson, setSurveyJson] = useState99(null);
|
|
@@ -27281,6 +27535,9 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27281
27535
|
const [submissionOpen, setSubmissionOpen] = useState99(false);
|
|
27282
27536
|
const [aiEvalOpen, setAiEvalOpen] = useState99(false);
|
|
27283
27537
|
const [evaluationOpen, setEvaluationOpen] = useState99(true);
|
|
27538
|
+
const [isEvaluatorAuthorized, setIsEvaluatorAuthorized] = useState99(false);
|
|
27539
|
+
const [authChecking, setAuthChecking] = useState99(true);
|
|
27540
|
+
const [profilesByDid, setProfilesByDid] = useState99({});
|
|
27284
27541
|
const selectedClaim = useMemo96(() => claims.find((claim) => claim.claimId === selectedClaimId) || null, [claims, selectedClaimId]);
|
|
27285
27542
|
const filteredClaims = useMemo96(() => {
|
|
27286
27543
|
if (activeFilter === "all") return claims;
|
|
@@ -27367,7 +27624,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27367
27624
|
useEffect81(() => {
|
|
27368
27625
|
setSelectedClaimId("");
|
|
27369
27626
|
setError(null);
|
|
27370
|
-
|
|
27627
|
+
setPaymentRows([createPaymentRow2()]);
|
|
27371
27628
|
setClaimData(null);
|
|
27372
27629
|
setSurveyJson(null);
|
|
27373
27630
|
setEvaluationResult(null);
|
|
@@ -27376,6 +27633,85 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27376
27633
|
if (!deedDid || !collectionId) return;
|
|
27377
27634
|
refreshClaims();
|
|
27378
27635
|
}, [deedDid, collectionId, refreshClaims]);
|
|
27636
|
+
useEffect81(() => {
|
|
27637
|
+
let mounted = true;
|
|
27638
|
+
const dids = Array.from(new Set(claims.map((claim) => claim.agentDid).filter(Boolean)));
|
|
27639
|
+
const missing = dids.filter((did) => !profilesByDid[did]);
|
|
27640
|
+
if (missing.length === 0)
|
|
27641
|
+
return () => {
|
|
27642
|
+
mounted = false;
|
|
27643
|
+
};
|
|
27644
|
+
const loadProfiles = async () => {
|
|
27645
|
+
const results = await Promise.all(
|
|
27646
|
+
missing.map(async (did) => {
|
|
27647
|
+
try {
|
|
27648
|
+
const profile = await handlers.getMatrixInfoPerDid(did);
|
|
27649
|
+
return [did, profile];
|
|
27650
|
+
} catch {
|
|
27651
|
+
return [did, null];
|
|
27652
|
+
}
|
|
27653
|
+
})
|
|
27654
|
+
);
|
|
27655
|
+
if (!mounted) return;
|
|
27656
|
+
setProfilesByDid((prev) => {
|
|
27657
|
+
const next = { ...prev };
|
|
27658
|
+
results.forEach(([did, profile]) => {
|
|
27659
|
+
if (profile) {
|
|
27660
|
+
next[did] = profile;
|
|
27661
|
+
}
|
|
27662
|
+
});
|
|
27663
|
+
return next;
|
|
27664
|
+
});
|
|
27665
|
+
};
|
|
27666
|
+
loadProfiles();
|
|
27667
|
+
return () => {
|
|
27668
|
+
mounted = false;
|
|
27669
|
+
};
|
|
27670
|
+
}, [claims, handlers, profilesByDid]);
|
|
27671
|
+
useEffect81(() => {
|
|
27672
|
+
let mounted = true;
|
|
27673
|
+
const checkEvaluatorAuthorization = async () => {
|
|
27674
|
+
if (!deedDid || !collectionId || !adminAddress || !actorDid) {
|
|
27675
|
+
if (mounted) {
|
|
27676
|
+
setIsEvaluatorAuthorized(false);
|
|
27677
|
+
setAuthChecking(false);
|
|
27678
|
+
}
|
|
27679
|
+
return;
|
|
27680
|
+
}
|
|
27681
|
+
if (typeof handlers.getUserRoles !== "function") {
|
|
27682
|
+
if (mounted) {
|
|
27683
|
+
setIsEvaluatorAuthorized(false);
|
|
27684
|
+
setAuthChecking(false);
|
|
27685
|
+
}
|
|
27686
|
+
return;
|
|
27687
|
+
}
|
|
27688
|
+
setAuthChecking(true);
|
|
27689
|
+
try {
|
|
27690
|
+
const roles = await handlers.getUserRoles({
|
|
27691
|
+
userAddress: actorDid,
|
|
27692
|
+
adminAddress,
|
|
27693
|
+
deedDid,
|
|
27694
|
+
collectionIds: [collectionId]
|
|
27695
|
+
});
|
|
27696
|
+
const role = roles?.find((r) => r.collectionId === collectionId)?.role || null;
|
|
27697
|
+
if (mounted) {
|
|
27698
|
+
setIsEvaluatorAuthorized(role === "EA" /* Evaluator */);
|
|
27699
|
+
}
|
|
27700
|
+
} catch {
|
|
27701
|
+
if (mounted) {
|
|
27702
|
+
setIsEvaluatorAuthorized(false);
|
|
27703
|
+
}
|
|
27704
|
+
} finally {
|
|
27705
|
+
if (mounted) {
|
|
27706
|
+
setAuthChecking(false);
|
|
27707
|
+
}
|
|
27708
|
+
}
|
|
27709
|
+
};
|
|
27710
|
+
checkEvaluatorAuthorization();
|
|
27711
|
+
return () => {
|
|
27712
|
+
mounted = false;
|
|
27713
|
+
};
|
|
27714
|
+
}, [handlers, actorDid, adminAddress, deedDid, collectionId]);
|
|
27379
27715
|
useEffect81(() => {
|
|
27380
27716
|
if (!selectedClaim) {
|
|
27381
27717
|
setClaimData(null);
|
|
@@ -27386,7 +27722,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27386
27722
|
setSubmissionOpen(false);
|
|
27387
27723
|
setAiEvalOpen(false);
|
|
27388
27724
|
setEvaluationOpen(true);
|
|
27389
|
-
|
|
27725
|
+
setPaymentRows([createPaymentRow2()]);
|
|
27390
27726
|
loadClaimDetail(selectedClaim);
|
|
27391
27727
|
}, [selectedClaim, loadClaimDetail]);
|
|
27392
27728
|
const isClaimAlreadyEvaluated = useMemo96(() => {
|
|
@@ -27394,15 +27730,28 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27394
27730
|
const status = getClaimStatus2(selectedClaim).label;
|
|
27395
27731
|
return status === "Approved" || status === "Rejected";
|
|
27396
27732
|
}, [selectedClaim]);
|
|
27397
|
-
const
|
|
27398
|
-
|
|
27399
|
-
|
|
27400
|
-
|
|
27401
|
-
|
|
27402
|
-
|
|
27403
|
-
|
|
27404
|
-
};
|
|
27405
|
-
};
|
|
27733
|
+
const addPaymentRow = useCallback81(() => {
|
|
27734
|
+
setPaymentRows((prev) => [...prev, createPaymentRow2()]);
|
|
27735
|
+
}, []);
|
|
27736
|
+
const removePaymentRow = useCallback81((id) => {
|
|
27737
|
+
setPaymentRows((prev) => prev.length === 1 ? prev : prev.filter((row) => row.id !== id));
|
|
27738
|
+
}, []);
|
|
27739
|
+
const updatePaymentRow = useCallback81((id, patch) => {
|
|
27740
|
+
setPaymentRows((prev) => prev.map((row) => row.id === id ? { ...row, ...patch } : row));
|
|
27741
|
+
}, []);
|
|
27742
|
+
const buildPaymentCoins = useCallback81(() => {
|
|
27743
|
+
return paymentRows.map((row) => {
|
|
27744
|
+
const denom = row.denom === CUSTOM_DENOM2 ? row.customDenom.trim() : row.denom || "";
|
|
27745
|
+
const amount = Number(row.amount);
|
|
27746
|
+
if (!denom || !Number.isFinite(amount) || amount <= 0) {
|
|
27747
|
+
return null;
|
|
27748
|
+
}
|
|
27749
|
+
return {
|
|
27750
|
+
denom,
|
|
27751
|
+
amount: (amount * Math.pow(10, DECIMALS4)).toString()
|
|
27752
|
+
};
|
|
27753
|
+
}).filter((entry) => !!entry);
|
|
27754
|
+
}, [paymentRows]);
|
|
27406
27755
|
const executeEvaluation = useCallback81(
|
|
27407
27756
|
async (decision) => {
|
|
27408
27757
|
if (!selectedClaim) {
|
|
@@ -27442,7 +27791,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27442
27791
|
collectionId,
|
|
27443
27792
|
deedDid,
|
|
27444
27793
|
adminAddress,
|
|
27445
|
-
amount:
|
|
27794
|
+
amount: buildPaymentCoins(),
|
|
27446
27795
|
createUdid,
|
|
27447
27796
|
capabilityCid: capabilityId,
|
|
27448
27797
|
rubricAuthority: deedDid,
|
|
@@ -27520,15 +27869,17 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27520
27869
|
createUdid,
|
|
27521
27870
|
updateRuntime,
|
|
27522
27871
|
refreshClaims,
|
|
27523
|
-
|
|
27524
|
-
paymentAmount,
|
|
27872
|
+
buildPaymentCoins,
|
|
27525
27873
|
evaluationResult
|
|
27526
27874
|
]
|
|
27527
27875
|
);
|
|
27528
27876
|
if (selectedClaim) {
|
|
27529
27877
|
const claimStatus = getClaimStatus2(selectedClaim);
|
|
27530
|
-
|
|
27531
|
-
|
|
27878
|
+
const selectedClaimProfile = profilesByDid[selectedClaim.agentDid];
|
|
27879
|
+
const selectedDisplayName = selectedClaimProfile?.displayname || selectedClaim.agentDid || selectedClaim.agentAddress;
|
|
27880
|
+
const selectedAvatarLabel = (selectedClaimProfile?.displayname || selectedClaim.agentDid || selectedClaim.agentAddress || "?")[0]?.toUpperCase();
|
|
27881
|
+
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(
|
|
27882
|
+
Box49,
|
|
27532
27883
|
{
|
|
27533
27884
|
style: {
|
|
27534
27885
|
width: 40,
|
|
@@ -27541,12 +27892,15 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27541
27892
|
flexShrink: 0,
|
|
27542
27893
|
fontSize: 16,
|
|
27543
27894
|
fontWeight: 500,
|
|
27544
|
-
color: "#adb5bd"
|
|
27895
|
+
color: "#adb5bd",
|
|
27896
|
+
backgroundImage: selectedClaimProfile?.avatarUrl ? `url(${selectedClaimProfile.avatarUrl})` : void 0,
|
|
27897
|
+
backgroundSize: "cover",
|
|
27898
|
+
backgroundPosition: "center"
|
|
27545
27899
|
}
|
|
27546
27900
|
},
|
|
27547
|
-
|
|
27548
|
-
), /* @__PURE__ */ React249.createElement(Stack167, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React249.createElement(Text141, { fw: 500, size: "md", truncate: true },
|
|
27549
|
-
|
|
27901
|
+
selectedClaimProfile?.avatarUrl ? null : selectedAvatarLabel
|
|
27902
|
+
), /* @__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 === "green" ? "green" : claimStatus.color === "red" ? "red" : void 0 }, claimStatus.color === "green" && /* @__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(
|
|
27903
|
+
Box49,
|
|
27550
27904
|
{
|
|
27551
27905
|
p: "sm",
|
|
27552
27906
|
style: {
|
|
@@ -27555,9 +27909,9 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27555
27909
|
}
|
|
27556
27910
|
},
|
|
27557
27911
|
/* @__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(
|
|
27912
|
+
/* @__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
27913
|
), /* @__PURE__ */ React249.createElement(
|
|
27560
|
-
|
|
27914
|
+
Box49,
|
|
27561
27915
|
{
|
|
27562
27916
|
p: "sm",
|
|
27563
27917
|
style: {
|
|
@@ -27566,9 +27920,9 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27566
27920
|
}
|
|
27567
27921
|
},
|
|
27568
27922
|
/* @__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(
|
|
27923
|
+
/* @__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
27924
|
), /* @__PURE__ */ React249.createElement(
|
|
27571
|
-
|
|
27925
|
+
Box49,
|
|
27572
27926
|
{
|
|
27573
27927
|
p: "sm",
|
|
27574
27928
|
style: {
|
|
@@ -27577,27 +27931,45 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27577
27931
|
}
|
|
27578
27932
|
},
|
|
27579
27933
|
/* @__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(
|
|
27934
|
+
/* @__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
27935
|
BaseSelect,
|
|
27582
27936
|
{
|
|
27583
|
-
value:
|
|
27584
|
-
onChange:
|
|
27937
|
+
value: row.denom,
|
|
27938
|
+
onChange: (value) => updatePaymentRow(row.id, { denom: value }),
|
|
27585
27939
|
data: [
|
|
27586
27940
|
{ value: USDC_DENOM5, label: "USDC" },
|
|
27587
|
-
{ value: IXO_DENOM5, label: "IXO" }
|
|
27941
|
+
{ value: IXO_DENOM5, label: "IXO" },
|
|
27942
|
+
{ value: CUSTOM_DENOM2, label: "Custom" }
|
|
27588
27943
|
],
|
|
27589
27944
|
clearable: false,
|
|
27590
|
-
|
|
27945
|
+
disabled: isDisabled || submitting
|
|
27591
27946
|
}
|
|
27592
|
-
)
|
|
27593
|
-
|
|
27947
|
+
), row.denom === CUSTOM_DENOM2 && /* @__PURE__ */ React249.createElement(
|
|
27948
|
+
BaseTextInput,
|
|
27949
|
+
{
|
|
27950
|
+
placeholder: "Custom denom (e.g. ibc/... or uixo)",
|
|
27951
|
+
value: row.customDenom,
|
|
27952
|
+
onChange: (event) => updatePaymentRow(row.id, { customDenom: event.currentTarget.value }),
|
|
27953
|
+
disabled: isDisabled || submitting
|
|
27954
|
+
}
|
|
27955
|
+
), /* @__PURE__ */ React249.createElement(
|
|
27956
|
+
BaseNumberInput,
|
|
27957
|
+
{
|
|
27958
|
+
min: 0,
|
|
27959
|
+
value: row.amount,
|
|
27960
|
+
onChange: (value) => updatePaymentRow(row.id, { amount: value }),
|
|
27961
|
+
placeholder: "Amount",
|
|
27962
|
+
disabled: isDisabled || submitting
|
|
27963
|
+
}
|
|
27964
|
+
))), /* @__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) })))
|
|
27965
|
+
), 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
27966
|
Button46,
|
|
27595
27967
|
{
|
|
27596
27968
|
variant: "filled",
|
|
27597
27969
|
color: "dark",
|
|
27598
27970
|
leftSection: /* @__PURE__ */ React249.createElement(IconThumbUp3, { size: 16 }),
|
|
27599
27971
|
onClick: () => executeEvaluation("approve"),
|
|
27600
|
-
disabled: isDisabled || submitting || !adminAddress || isClaimAlreadyEvaluated,
|
|
27972
|
+
disabled: isDisabled || submitting || authChecking || !isEvaluatorAuthorized || !adminAddress || isClaimAlreadyEvaluated,
|
|
27601
27973
|
styles: {
|
|
27602
27974
|
root: {
|
|
27603
27975
|
backgroundColor: "var(--mantine-color-dark-6)",
|
|
@@ -27614,7 +27986,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27614
27986
|
color: "dark",
|
|
27615
27987
|
leftSection: /* @__PURE__ */ React249.createElement(IconThumbDown2, { size: 16 }),
|
|
27616
27988
|
onClick: () => executeEvaluation("reject"),
|
|
27617
|
-
disabled: isDisabled || submitting || !adminAddress || isClaimAlreadyEvaluated,
|
|
27989
|
+
disabled: isDisabled || submitting || authChecking || !isEvaluatorAuthorized || !adminAddress || isClaimAlreadyEvaluated,
|
|
27618
27990
|
styles: {
|
|
27619
27991
|
root: {
|
|
27620
27992
|
backgroundColor: "var(--mantine-color-dark-6)",
|
|
@@ -27624,7 +27996,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27624
27996
|
}
|
|
27625
27997
|
},
|
|
27626
27998
|
"Reject"
|
|
27627
|
-
)), error && /* @__PURE__ */ React249.createElement(Alert45, { color: "red" }, error), runtime.error?.message && /* @__PURE__ */ React249.createElement(Alert45, { color: "red" }, runtime.error.message));
|
|
27999
|
+
)), error && /* @__PURE__ */ React249.createElement(Alert45, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && /* @__PURE__ */ React249.createElement(Alert45, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
27628
28000
|
}
|
|
27629
28001
|
const filterTabs = [
|
|
27630
28002
|
{ value: "all", label: "All" },
|
|
@@ -27632,7 +28004,7 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27632
28004
|
{ value: "approved", label: "Approved" },
|
|
27633
28005
|
{ value: "rejected", label: "Rejected" }
|
|
27634
28006
|
];
|
|
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(
|
|
28007
|
+
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
28008
|
UnstyledButton3,
|
|
27637
28009
|
{
|
|
27638
28010
|
key: tab.value,
|
|
@@ -27648,8 +28020,11 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27648
28020
|
/* @__PURE__ */ React249.createElement(Text141, { size: "sm", fw: 500, c: activeFilter === tab.value ? "white" : "dimmed" }, tab.label)
|
|
27649
28021
|
))), /* @__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
28022
|
const status = getClaimStatus2(claim);
|
|
28023
|
+
const profile = profilesByDid[claim.agentDid];
|
|
28024
|
+
const displayName = profile?.displayname || claim.agentDid || claim.agentAddress;
|
|
28025
|
+
const avatarLabel = (profile?.displayname || claim.agentDid || claim.agentAddress || "?")[0]?.toUpperCase();
|
|
27651
28026
|
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
|
-
|
|
28027
|
+
Box49,
|
|
27653
28028
|
{
|
|
27654
28029
|
style: {
|
|
27655
28030
|
width: 32,
|
|
@@ -27662,12 +28037,15 @@ var EvaluateClaimFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27662
28037
|
flexShrink: 0,
|
|
27663
28038
|
fontSize: 14,
|
|
27664
28039
|
fontWeight: 500,
|
|
27665
|
-
color: "#adb5bd"
|
|
28040
|
+
color: "#adb5bd",
|
|
28041
|
+
backgroundImage: profile?.avatarUrl ? `url(${profile.avatarUrl})` : void 0,
|
|
28042
|
+
backgroundSize: "cover",
|
|
28043
|
+
backgroundPosition: "center"
|
|
27666
28044
|
}
|
|
27667
28045
|
},
|
|
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));
|
|
28046
|
+
profile?.avatarUrl ? null : avatarLabel
|
|
28047
|
+
), /* @__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 === "green" ? "green" : status.color === "red" ? "red" : void 0, style: { lineHeight: 1.5 } }, status.color === "green" && /* @__PURE__ */ React249.createElement(IconCheck19, { size: 14, style: { verticalAlign: "middle", marginRight: 2 } }), status.label), /* @__PURE__ */ React249.createElement(Text141, { size: "xs", c: "dimmed" }, getTimeAgo3(claim.submissionDate || ""))));
|
|
28048
|
+
}))), 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
28049
|
};
|
|
27672
28050
|
|
|
27673
28051
|
// src/mantine/blocks/action/actionTypes/evaluateClaim/index.ts
|
|
@@ -27676,12 +28054,251 @@ registerActionTypeUI("evaluateClaim", {
|
|
|
27676
28054
|
flowDetailComponent: EvaluateClaimFlowDetail
|
|
27677
28055
|
});
|
|
27678
28056
|
|
|
28057
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/FormSubmitConfig.tsx
|
|
28058
|
+
import React250, { useCallback as useCallback82, useEffect as useEffect82, useState as useState100 } from "react";
|
|
28059
|
+
import { Stack as Stack168, Text as Text142 } from "@mantine/core";
|
|
28060
|
+
|
|
28061
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/types.ts
|
|
28062
|
+
function parseFormSubmitActionInputs(json) {
|
|
28063
|
+
try {
|
|
28064
|
+
const parsed = typeof json === "string" ? JSON.parse(json) : json;
|
|
28065
|
+
const rawSchema = parsed?.surveySchema;
|
|
28066
|
+
if (typeof rawSchema === "string") {
|
|
28067
|
+
return { surveySchema: rawSchema };
|
|
28068
|
+
}
|
|
28069
|
+
if (rawSchema && typeof rawSchema === "object" && !Array.isArray(rawSchema)) {
|
|
28070
|
+
return { surveySchema: JSON.stringify(rawSchema, null, 2) };
|
|
28071
|
+
}
|
|
28072
|
+
return { surveySchema: "" };
|
|
28073
|
+
} catch {
|
|
28074
|
+
return { surveySchema: "" };
|
|
28075
|
+
}
|
|
28076
|
+
}
|
|
28077
|
+
function serializeFormSubmitActionInputs(inputs) {
|
|
28078
|
+
return JSON.stringify({
|
|
28079
|
+
surveySchema: inputs.surveySchema
|
|
28080
|
+
});
|
|
28081
|
+
}
|
|
28082
|
+
|
|
28083
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/FormSubmitConfig.tsx
|
|
28084
|
+
function isValidSchemaJson(value) {
|
|
28085
|
+
try {
|
|
28086
|
+
const parsed = JSON.parse(value);
|
|
28087
|
+
return !!parsed && typeof parsed === "object" && !Array.isArray(parsed);
|
|
28088
|
+
} catch {
|
|
28089
|
+
return false;
|
|
28090
|
+
}
|
|
28091
|
+
}
|
|
28092
|
+
var FormSubmitConfig = ({ inputs, onInputsChange }) => {
|
|
28093
|
+
const [localSchema, setLocalSchema] = useState100(() => parseFormSubmitActionInputs(inputs).surveySchema);
|
|
28094
|
+
const [error, setError] = useState100(null);
|
|
28095
|
+
useEffect82(() => {
|
|
28096
|
+
setLocalSchema(parseFormSubmitActionInputs(inputs).surveySchema);
|
|
28097
|
+
setError(null);
|
|
28098
|
+
}, [inputs]);
|
|
28099
|
+
const handleChange = useCallback82(
|
|
28100
|
+
(value) => {
|
|
28101
|
+
setLocalSchema(value);
|
|
28102
|
+
setError(null);
|
|
28103
|
+
if (!value.trim()) {
|
|
28104
|
+
onInputsChange(serializeFormSubmitActionInputs({ surveySchema: "" }));
|
|
28105
|
+
return;
|
|
28106
|
+
}
|
|
28107
|
+
if (!isValidSchemaJson(value)) {
|
|
28108
|
+
setError("Survey schema must be a valid JSON object");
|
|
28109
|
+
return;
|
|
28110
|
+
}
|
|
28111
|
+
onInputsChange(serializeFormSubmitActionInputs({ surveySchema: value }));
|
|
28112
|
+
},
|
|
28113
|
+
[onInputsChange]
|
|
28114
|
+
);
|
|
28115
|
+
return /* @__PURE__ */ React250.createElement(Stack168, { gap: "xs" }, /* @__PURE__ */ React250.createElement(
|
|
28116
|
+
BaseTextArea,
|
|
28117
|
+
{
|
|
28118
|
+
label: "Survey Schema (JSON)",
|
|
28119
|
+
description: "Paste the SurveyJS schema JSON that should be rendered in flow mode.",
|
|
28120
|
+
placeholder: '{"elements":[{"type":"text","name":"name","title":"Your name"}]}',
|
|
28121
|
+
minRows: 10,
|
|
28122
|
+
value: localSchema,
|
|
28123
|
+
onChange: (event) => handleChange(event.currentTarget.value),
|
|
28124
|
+
error
|
|
28125
|
+
}
|
|
28126
|
+
), localSchema && !error && /* @__PURE__ */ React250.createElement(Text142, { size: "xs", c: "green" }, "\u2713 Valid JSON object"));
|
|
28127
|
+
};
|
|
28128
|
+
|
|
28129
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/FormSubmitFlowDetail.tsx
|
|
28130
|
+
import React251, { useCallback as useCallback83, useEffect as useEffect83, useMemo as useMemo97, useState as useState101 } from "react";
|
|
28131
|
+
import { Alert as Alert46, Loader as Loader45, Stack as Stack169, Text as Text143 } from "@mantine/core";
|
|
28132
|
+
import { Survey as Survey12, SurveyModel as SurveyModel12 } from "@ixo/surveys";
|
|
28133
|
+
var FormSubmitFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
28134
|
+
const handlers = useBlocknoteHandlers();
|
|
28135
|
+
const services = useMemo97(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
28136
|
+
const flowNode = useMemo97(() => buildFlowNodeFromBlock(block), [block]);
|
|
28137
|
+
const runtimeManager = useMemo97(() => createRuntimeStateManager(editor), [editor]);
|
|
28138
|
+
const ucanManager = useMemo97(() => new SimpleUCANManager(), []);
|
|
28139
|
+
const delegationStore = useMemo97(() => {
|
|
28140
|
+
if (!editor?._yDelegations) return void 0;
|
|
28141
|
+
return createDelegationStore(editor._yDelegations);
|
|
28142
|
+
}, [editor?._yDelegations]);
|
|
28143
|
+
const verifySignature = useMemo97(() => {
|
|
28144
|
+
if (!handlers?.verifyCapabilitySignature) return void 0;
|
|
28145
|
+
return async (capabilityRaw, issuerDid) => handlers.verifyCapabilitySignature({ capabilityRaw, issuerDid });
|
|
28146
|
+
}, [handlers]);
|
|
28147
|
+
const flowOwnerDid = useMemo97(() => editor?.getFlowOwnerDid?.() || "", [editor]);
|
|
28148
|
+
const flowUri = useMemo97(() => {
|
|
28149
|
+
const docId = editor?.getFlowMetadata?.()?.doc_id || block.id;
|
|
28150
|
+
return `ixo:flow:${docId}`;
|
|
28151
|
+
}, [editor, block.id]);
|
|
28152
|
+
const actorDid = useMemo97(() => {
|
|
28153
|
+
try {
|
|
28154
|
+
return handlers?.getCurrentUser?.()?.address || "";
|
|
28155
|
+
} catch {
|
|
28156
|
+
return "";
|
|
28157
|
+
}
|
|
28158
|
+
}, [handlers]);
|
|
28159
|
+
const parsed = useMemo97(() => parseFormSubmitActionInputs(inputs), [inputs]);
|
|
28160
|
+
const editorDocument = editor?.document || [];
|
|
28161
|
+
const resolveOpts = useMemo97(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
28162
|
+
const resolvedSchemaString = useMemo97(() => resolveReferences(parsed.surveySchema || "", editorDocument, resolveOpts).trim(), [parsed.surveySchema, editorDocument, resolveOpts]);
|
|
28163
|
+
const [submitting, setSubmitting] = useState101(false);
|
|
28164
|
+
const [error, setError] = useState101(null);
|
|
28165
|
+
const parsedSchema = useMemo97(() => {
|
|
28166
|
+
if (!resolvedSchemaString) return null;
|
|
28167
|
+
try {
|
|
28168
|
+
const schema = JSON.parse(resolvedSchemaString);
|
|
28169
|
+
if (!schema || typeof schema !== "object" || Array.isArray(schema)) return null;
|
|
28170
|
+
return schema;
|
|
28171
|
+
} catch {
|
|
28172
|
+
return null;
|
|
28173
|
+
}
|
|
28174
|
+
}, [resolvedSchemaString]);
|
|
28175
|
+
const surveyModel = useMemo97(() => {
|
|
28176
|
+
if (!parsedSchema) return null;
|
|
28177
|
+
const model = new SurveyModel12(parsedSchema);
|
|
28178
|
+
model.applyTheme(surveyTheme);
|
|
28179
|
+
model.showQuestionNumbers = "off";
|
|
28180
|
+
model.questionsOnPageMode = "singlePage";
|
|
28181
|
+
model.completeText = "Execute";
|
|
28182
|
+
if (isDisabled || submitting) {
|
|
28183
|
+
model.mode = "display";
|
|
28184
|
+
model.showCompleteButton = false;
|
|
28185
|
+
}
|
|
28186
|
+
return model;
|
|
28187
|
+
}, [parsedSchema, isDisabled, submitting]);
|
|
28188
|
+
const handleSurveyComplete = useCallback83(
|
|
28189
|
+
async (sender) => {
|
|
28190
|
+
if (isDisabled || submitting) return;
|
|
28191
|
+
const actionType = String(block?.props?.actionType || "form.submit");
|
|
28192
|
+
const actionDef = getAction(actionType) || getAction("form.submit");
|
|
28193
|
+
if (!actionDef) {
|
|
28194
|
+
setError(`${actionType} action is not registered`);
|
|
28195
|
+
return;
|
|
28196
|
+
}
|
|
28197
|
+
setSubmitting(true);
|
|
28198
|
+
setError(null);
|
|
28199
|
+
updateRuntime({ state: "running", error: void 0 });
|
|
28200
|
+
try {
|
|
28201
|
+
const outcome = await executeNode({
|
|
28202
|
+
node: flowNode,
|
|
28203
|
+
actorDid,
|
|
28204
|
+
context: {
|
|
28205
|
+
runtime: runtimeManager,
|
|
28206
|
+
ucanManager,
|
|
28207
|
+
delegationStore,
|
|
28208
|
+
verifySignature,
|
|
28209
|
+
rootIssuer: flowOwnerDid || void 0,
|
|
28210
|
+
flowUri
|
|
28211
|
+
},
|
|
28212
|
+
action: async () => {
|
|
28213
|
+
const result = await actionDef.run(
|
|
28214
|
+
{
|
|
28215
|
+
answers: sender.data || {}
|
|
28216
|
+
},
|
|
28217
|
+
{
|
|
28218
|
+
actorDid,
|
|
28219
|
+
flowId: flowUri,
|
|
28220
|
+
nodeId: block.id,
|
|
28221
|
+
services,
|
|
28222
|
+
flowNode,
|
|
28223
|
+
runtime: runtimeManager,
|
|
28224
|
+
delegationStore,
|
|
28225
|
+
verifySignature,
|
|
28226
|
+
rootIssuer: flowOwnerDid || void 0,
|
|
28227
|
+
flowUri,
|
|
28228
|
+
handlers,
|
|
28229
|
+
editor
|
|
28230
|
+
}
|
|
28231
|
+
);
|
|
28232
|
+
return {
|
|
28233
|
+
payload: result.output,
|
|
28234
|
+
submittedByDid: actorDid || void 0
|
|
28235
|
+
};
|
|
28236
|
+
}
|
|
28237
|
+
});
|
|
28238
|
+
if (!outcome.success) {
|
|
28239
|
+
throw new Error(outcome.error || "Form submit execution failed");
|
|
28240
|
+
}
|
|
28241
|
+
updateRuntime({
|
|
28242
|
+
state: "completed",
|
|
28243
|
+
executedAt: Date.now(),
|
|
28244
|
+
output: outcome.result?.payload || {}
|
|
28245
|
+
});
|
|
28246
|
+
} catch (err) {
|
|
28247
|
+
const message = err instanceof Error ? err.message : "Failed to execute form submit";
|
|
28248
|
+
setError(message);
|
|
28249
|
+
updateRuntime({
|
|
28250
|
+
state: "failed",
|
|
28251
|
+
error: { message, at: Date.now() }
|
|
28252
|
+
});
|
|
28253
|
+
} finally {
|
|
28254
|
+
setSubmitting(false);
|
|
28255
|
+
}
|
|
28256
|
+
},
|
|
28257
|
+
[
|
|
28258
|
+
actorDid,
|
|
28259
|
+
block,
|
|
28260
|
+
delegationStore,
|
|
28261
|
+
editor,
|
|
28262
|
+
flowNode,
|
|
28263
|
+
flowOwnerDid,
|
|
28264
|
+
flowUri,
|
|
28265
|
+
handlers,
|
|
28266
|
+
isDisabled,
|
|
28267
|
+
runtimeManager,
|
|
28268
|
+
services,
|
|
28269
|
+
submitting,
|
|
28270
|
+
ucanManager,
|
|
28271
|
+
updateRuntime,
|
|
28272
|
+
verifySignature
|
|
28273
|
+
]
|
|
28274
|
+
);
|
|
28275
|
+
useEffect83(() => {
|
|
28276
|
+
if (!surveyModel) return void 0;
|
|
28277
|
+
surveyModel.onComplete.add(handleSurveyComplete);
|
|
28278
|
+
return () => {
|
|
28279
|
+
surveyModel.onComplete.remove(handleSurveyComplete);
|
|
28280
|
+
};
|
|
28281
|
+
}, [surveyModel, handleSurveyComplete]);
|
|
28282
|
+
const statusMessage = runtime.state === "completed" ? "Last execution completed." : submitting ? "Executing..." : null;
|
|
28283
|
+
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));
|
|
28284
|
+
};
|
|
28285
|
+
|
|
28286
|
+
// src/mantine/blocks/action/actionTypes/formSubmit/index.ts
|
|
28287
|
+
registerActionTypeUI("form.submit", {
|
|
28288
|
+
configComponent: FormSubmitConfig,
|
|
28289
|
+
flowDetailComponent: FormSubmitFlowDetail
|
|
28290
|
+
});
|
|
28291
|
+
registerActionTypeUI("human.form.submit", {
|
|
28292
|
+
configComponent: FormSubmitConfig,
|
|
28293
|
+
flowDetailComponent: FormSubmitFlowDetail
|
|
28294
|
+
});
|
|
28295
|
+
|
|
27679
28296
|
// src/mantine/blocks/action/ActionBlock.tsx
|
|
27680
28297
|
function ActionBlock({ editor, block }) {
|
|
27681
28298
|
const { docType } = useBlocknoteContext();
|
|
27682
28299
|
const { actions: actions2 } = useBlockConditions(block, editor);
|
|
27683
28300
|
if (docType === "template") {
|
|
27684
|
-
return /* @__PURE__ */
|
|
28301
|
+
return /* @__PURE__ */ React252.createElement(ActionTemplateView, { editor, block });
|
|
27685
28302
|
}
|
|
27686
28303
|
const conditionConfig = parseConditionConfig(block.props.conditions);
|
|
27687
28304
|
const hasVisibility = hasVisibilityConditions(conditionConfig);
|
|
@@ -27692,7 +28309,7 @@ function ActionBlock({ editor, block }) {
|
|
|
27692
28309
|
const hasEnable = hasEnableConditions(conditionConfig);
|
|
27693
28310
|
const enableActionExists = actions2.some((a) => a.action === "enable");
|
|
27694
28311
|
const shouldDisable = hasEnable && !enableActionExists;
|
|
27695
|
-
return /* @__PURE__ */
|
|
28312
|
+
return /* @__PURE__ */ React252.createElement(
|
|
27696
28313
|
ActionFlowView,
|
|
27697
28314
|
{
|
|
27698
28315
|
block,
|
|
@@ -27759,36 +28376,36 @@ var ActionBlockSpec = createReactBlockSpec21(
|
|
|
27759
28376
|
{
|
|
27760
28377
|
render: (props) => {
|
|
27761
28378
|
const ixoProps = props;
|
|
27762
|
-
return /* @__PURE__ */
|
|
28379
|
+
return /* @__PURE__ */ React253.createElement(ActionBlock, { ...ixoProps });
|
|
27763
28380
|
}
|
|
27764
28381
|
}
|
|
27765
28382
|
);
|
|
27766
28383
|
|
|
27767
28384
|
// src/mantine/blocks/location/LocationBlockSpec.tsx
|
|
27768
|
-
import
|
|
28385
|
+
import React261 from "react";
|
|
27769
28386
|
import { createReactBlockSpec as createReactBlockSpec22 } from "@blocknote/react";
|
|
27770
28387
|
|
|
27771
28388
|
// src/mantine/blocks/location/LocationBlock.tsx
|
|
27772
|
-
import
|
|
28389
|
+
import React260 from "react";
|
|
27773
28390
|
|
|
27774
28391
|
// src/mantine/blocks/location/template/TemplateView.tsx
|
|
27775
|
-
import
|
|
27776
|
-
import { Group as Group93, Stack as
|
|
28392
|
+
import React257, { useMemo as useMemo98 } from "react";
|
|
28393
|
+
import { Group as Group93, Stack as Stack171, Text as Text146 } from "@mantine/core";
|
|
27777
28394
|
import { IconMapPin } from "@tabler/icons-react";
|
|
27778
28395
|
|
|
27779
28396
|
// src/mantine/blocks/location/template/TemplateConfig.tsx
|
|
27780
|
-
import
|
|
28397
|
+
import React255, { useCallback as useCallback84 } from "react";
|
|
27781
28398
|
import { IconSettings as IconSettings20 } from "@tabler/icons-react";
|
|
27782
28399
|
|
|
27783
28400
|
// src/mantine/blocks/location/template/GeneralTab.tsx
|
|
27784
|
-
import
|
|
27785
|
-
import { Box as
|
|
28401
|
+
import React254, { useEffect as useEffect85, useRef as useRef23, useState as useState103 } from "react";
|
|
28402
|
+
import { Box as Box50, Divider as Divider27, Stack as Stack170, Text as Text144 } from "@mantine/core";
|
|
27786
28403
|
|
|
27787
28404
|
// src/core/hooks/useUnlMap.ts
|
|
27788
|
-
import { useEffect as
|
|
28405
|
+
import { useEffect as useEffect84, useState as useState102 } from "react";
|
|
27789
28406
|
function useUnlMap() {
|
|
27790
|
-
const [status, setStatus] =
|
|
27791
|
-
|
|
28407
|
+
const [status, setStatus] = useState102("loading");
|
|
28408
|
+
useEffect84(() => {
|
|
27792
28409
|
if (typeof window === "undefined") {
|
|
27793
28410
|
return;
|
|
27794
28411
|
}
|
|
@@ -27847,21 +28464,21 @@ var DEFAULT_CENTER = [0, 20];
|
|
|
27847
28464
|
var DEFAULT_ZOOM = 2;
|
|
27848
28465
|
var PLACED_ZOOM = 14;
|
|
27849
28466
|
var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, onDescriptionChange, onCoordinatesChange }) => {
|
|
27850
|
-
const [localTitle, setLocalTitle] =
|
|
27851
|
-
const [localDescription, setLocalDescription] =
|
|
27852
|
-
const [mapError, setMapError] =
|
|
28467
|
+
const [localTitle, setLocalTitle] = useState103(title);
|
|
28468
|
+
const [localDescription, setLocalDescription] = useState103(description);
|
|
28469
|
+
const [mapError, setMapError] = useState103(null);
|
|
27853
28470
|
const { status, UnlSdk } = useUnlMap();
|
|
27854
28471
|
const { mapConfig } = useBlocknoteContext();
|
|
27855
28472
|
const markerRef = useRef23(null);
|
|
27856
28473
|
const mapRef = useRef23(null);
|
|
27857
28474
|
const containerRef = useRef23(null);
|
|
27858
|
-
|
|
28475
|
+
useEffect85(() => {
|
|
27859
28476
|
setLocalTitle(title);
|
|
27860
28477
|
}, [title]);
|
|
27861
|
-
|
|
28478
|
+
useEffect85(() => {
|
|
27862
28479
|
setLocalDescription(description);
|
|
27863
28480
|
}, [description]);
|
|
27864
|
-
|
|
28481
|
+
useEffect85(() => {
|
|
27865
28482
|
if (status !== "ready" || !UnlSdk || mapRef.current || !mapConfig || !containerRef.current) return;
|
|
27866
28483
|
try {
|
|
27867
28484
|
const hasCoords = latitude && longitude;
|
|
@@ -27907,7 +28524,7 @@ var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
27907
28524
|
markerRef.current = null;
|
|
27908
28525
|
};
|
|
27909
28526
|
}, [status, UnlSdk]);
|
|
27910
|
-
return /* @__PURE__ */
|
|
28527
|
+
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
28528
|
BaseTextInput,
|
|
27912
28529
|
{
|
|
27913
28530
|
placeholder: "e.g. Project Location",
|
|
@@ -27918,7 +28535,7 @@ var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
27918
28535
|
onTitleChange(v);
|
|
27919
28536
|
}
|
|
27920
28537
|
}
|
|
27921
|
-
)), /* @__PURE__ */
|
|
28538
|
+
)), /* @__PURE__ */ React254.createElement(Stack170, { gap: "xs" }, /* @__PURE__ */ React254.createElement(Text144, { size: "sm", fw: 600 }, "Description"), /* @__PURE__ */ React254.createElement(
|
|
27922
28539
|
BaseTextInput,
|
|
27923
28540
|
{
|
|
27924
28541
|
placeholder: "e.g. Main project site coordinates",
|
|
@@ -27929,19 +28546,19 @@ var GeneralTab18 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
27929
28546
|
onDescriptionChange(v);
|
|
27930
28547
|
}
|
|
27931
28548
|
}
|
|
27932
|
-
)), /* @__PURE__ */
|
|
28549
|
+
)), /* @__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
28550
|
};
|
|
27934
28551
|
|
|
27935
28552
|
// src/mantine/blocks/location/template/TemplateConfig.tsx
|
|
27936
28553
|
var TemplateConfig18 = ({ editor, block }) => {
|
|
27937
28554
|
const { closePanel } = usePanelStore();
|
|
27938
|
-
const updateProp =
|
|
28555
|
+
const updateProp = useCallback84(
|
|
27939
28556
|
(key, value) => {
|
|
27940
28557
|
editor.updateBlock(block, { props: { ...block.props, [key]: value } });
|
|
27941
28558
|
},
|
|
27942
28559
|
[editor, block]
|
|
27943
28560
|
);
|
|
27944
|
-
const updateProps =
|
|
28561
|
+
const updateProps = useCallback84(
|
|
27945
28562
|
(updates) => {
|
|
27946
28563
|
editor.updateBlock(block, { props: { ...block.props, ...updates } });
|
|
27947
28564
|
},
|
|
@@ -27952,7 +28569,7 @@ var TemplateConfig18 = ({ editor, block }) => {
|
|
|
27952
28569
|
label: "General",
|
|
27953
28570
|
value: "general",
|
|
27954
28571
|
icon: icon(IconSettings20),
|
|
27955
|
-
content: /* @__PURE__ */
|
|
28572
|
+
content: /* @__PURE__ */ React255.createElement(
|
|
27956
28573
|
GeneralTab18,
|
|
27957
28574
|
{
|
|
27958
28575
|
title: block.props.title || "",
|
|
@@ -27966,20 +28583,20 @@ var TemplateConfig18 = ({ editor, block }) => {
|
|
|
27966
28583
|
)
|
|
27967
28584
|
}
|
|
27968
28585
|
];
|
|
27969
|
-
return /* @__PURE__ */
|
|
28586
|
+
return /* @__PURE__ */ React255.createElement(BaseRightPanelLayout, { title: "Location Settings", onClose: closePanel, tabs, context: { editor, block } });
|
|
27970
28587
|
};
|
|
27971
28588
|
|
|
27972
28589
|
// src/mantine/blocks/location/components/LocationMap.tsx
|
|
27973
|
-
import
|
|
27974
|
-
import { Box as
|
|
28590
|
+
import React256, { useEffect as useEffect86, useRef as useRef24, useState as useState104 } from "react";
|
|
28591
|
+
import { Box as Box51, Flex as Flex32, Loader as Loader46, Text as Text145 } from "@mantine/core";
|
|
27975
28592
|
var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker = true }) => {
|
|
27976
|
-
const [mapError, setMapError] =
|
|
28593
|
+
const [mapError, setMapError] = useState104(null);
|
|
27977
28594
|
const { mapConfig } = useBlocknoteContext();
|
|
27978
28595
|
const containerRef = useRef24(null);
|
|
27979
28596
|
const mapRef = useRef24(null);
|
|
27980
28597
|
const markerRef = useRef24(null);
|
|
27981
28598
|
const { status, UnlSdk } = useUnlMap();
|
|
27982
|
-
|
|
28599
|
+
useEffect86(() => {
|
|
27983
28600
|
if (status !== "ready" || !UnlSdk || mapRef.current || !containerRef.current) return;
|
|
27984
28601
|
let ro;
|
|
27985
28602
|
try {
|
|
@@ -28006,7 +28623,7 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28006
28623
|
ro?.disconnect();
|
|
28007
28624
|
};
|
|
28008
28625
|
}, [status, UnlSdk, mapConfig]);
|
|
28009
|
-
|
|
28626
|
+
useEffect86(() => {
|
|
28010
28627
|
if (!mapRef.current || !latitude || !longitude) return;
|
|
28011
28628
|
const coords = [Number(longitude), Number(latitude)];
|
|
28012
28629
|
mapRef.current.setCenter(coords);
|
|
@@ -28015,8 +28632,8 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28015
28632
|
}
|
|
28016
28633
|
}, [latitude, longitude, showMarker]);
|
|
28017
28634
|
if (status === "loading") {
|
|
28018
|
-
return /* @__PURE__ */
|
|
28019
|
-
|
|
28635
|
+
return /* @__PURE__ */ React256.createElement(
|
|
28636
|
+
Box51,
|
|
28020
28637
|
{
|
|
28021
28638
|
style: {
|
|
28022
28639
|
borderRadius: 16,
|
|
@@ -28027,12 +28644,12 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28027
28644
|
w,
|
|
28028
28645
|
h
|
|
28029
28646
|
},
|
|
28030
|
-
/* @__PURE__ */
|
|
28647
|
+
/* @__PURE__ */ React256.createElement(Loader46, null)
|
|
28031
28648
|
);
|
|
28032
28649
|
}
|
|
28033
28650
|
if (status === "error" || mapError) {
|
|
28034
|
-
return /* @__PURE__ */
|
|
28035
|
-
|
|
28651
|
+
return /* @__PURE__ */ React256.createElement(
|
|
28652
|
+
Box51,
|
|
28036
28653
|
{
|
|
28037
28654
|
style: {
|
|
28038
28655
|
borderRadius: 16,
|
|
@@ -28043,58 +28660,58 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
28043
28660
|
w,
|
|
28044
28661
|
h
|
|
28045
28662
|
},
|
|
28046
|
-
/* @__PURE__ */
|
|
28663
|
+
/* @__PURE__ */ React256.createElement(Text145, { size: "sm", c: "red" }, mapError || "Failed to load map")
|
|
28047
28664
|
);
|
|
28048
28665
|
}
|
|
28049
|
-
return /* @__PURE__ */
|
|
28666
|
+
return /* @__PURE__ */ React256.createElement(Box51, { ref: containerRef, style: { borderRadius: 16 }, w, h });
|
|
28050
28667
|
};
|
|
28051
28668
|
function LocationMap(props) {
|
|
28052
28669
|
if (props.latitude === void 0 || props.longitude === void 0)
|
|
28053
|
-
return /* @__PURE__ */
|
|
28054
|
-
return /* @__PURE__ */
|
|
28670
|
+
return /* @__PURE__ */ React256.createElement(Flex32, { w: "100%", h: 200, align: "center", justify: "center" }, /* @__PURE__ */ React256.createElement(Loader46, null));
|
|
28671
|
+
return /* @__PURE__ */ React256.createElement(UnlMap, { ...props });
|
|
28055
28672
|
}
|
|
28056
28673
|
|
|
28057
28674
|
// src/mantine/blocks/location/template/TemplateView.tsx
|
|
28058
28675
|
var LOCATION_TEMPLATE_PANEL_ID = "location-template-panel";
|
|
28059
28676
|
var LocationTemplateView = ({ editor, block }) => {
|
|
28060
28677
|
const panelId = `${LOCATION_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
28061
|
-
const panelContent =
|
|
28678
|
+
const panelContent = useMemo98(() => /* @__PURE__ */ React257.createElement(TemplateConfig18, { editor, block }), [editor, block]);
|
|
28062
28679
|
const { open } = usePanel(panelId, panelContent);
|
|
28063
28680
|
console.log("block.props:", block.props);
|
|
28064
28681
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
28065
|
-
return /* @__PURE__ */
|
|
28682
|
+
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
28683
|
};
|
|
28067
28684
|
|
|
28068
28685
|
// src/mantine/blocks/location/flow/FlowView.tsx
|
|
28069
|
-
import
|
|
28070
|
-
import { Center as Center13, Group as Group94, Stack as
|
|
28686
|
+
import React259, { useMemo as useMemo99 } from "react";
|
|
28687
|
+
import { Center as Center13, Group as Group94, Stack as Stack172, Text as Text147 } from "@mantine/core";
|
|
28071
28688
|
import { IconMapPin as IconMapPin2 } from "@tabler/icons-react";
|
|
28072
28689
|
|
|
28073
28690
|
// src/mantine/blocks/location/flow/FlowConfig.tsx
|
|
28074
|
-
import
|
|
28691
|
+
import React258 from "react";
|
|
28075
28692
|
var FlowConfig2 = ({ block }) => {
|
|
28076
28693
|
const { closePanel } = usePanelStore();
|
|
28077
28694
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
28078
|
-
return /* @__PURE__ */
|
|
28695
|
+
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
28696
|
};
|
|
28080
28697
|
|
|
28081
28698
|
// src/mantine/blocks/location/flow/FlowView.tsx
|
|
28082
28699
|
var LOCATION_FLOW_PANEL_ID = "location-flow-panel";
|
|
28083
28700
|
var LocationFlowView = ({ editor, block }) => {
|
|
28084
28701
|
const panelId = `${LOCATION_FLOW_PANEL_ID}-${block.id}`;
|
|
28085
|
-
const panelContent =
|
|
28702
|
+
const panelContent = useMemo99(() => /* @__PURE__ */ React259.createElement(FlowConfig2, { editor, block }), [editor, block]);
|
|
28086
28703
|
const { open } = usePanel(panelId, panelContent);
|
|
28087
28704
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
28088
|
-
return /* @__PURE__ */
|
|
28705
|
+
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
28706
|
};
|
|
28090
28707
|
|
|
28091
28708
|
// src/mantine/blocks/location/LocationBlock.tsx
|
|
28092
28709
|
function LocationBlock({ editor, block }) {
|
|
28093
28710
|
const { docType } = useBlocknoteContext();
|
|
28094
28711
|
if (docType === "template") {
|
|
28095
|
-
return /* @__PURE__ */
|
|
28712
|
+
return /* @__PURE__ */ React260.createElement(LocationTemplateView, { editor, block });
|
|
28096
28713
|
}
|
|
28097
|
-
return /* @__PURE__ */
|
|
28714
|
+
return /* @__PURE__ */ React260.createElement(LocationFlowView, { editor, block });
|
|
28098
28715
|
}
|
|
28099
28716
|
|
|
28100
28717
|
// src/mantine/blocks/location/LocationBlockSpec.tsx
|
|
@@ -28113,7 +28730,7 @@ var LocationBlockSpec = createReactBlockSpec22(
|
|
|
28113
28730
|
{
|
|
28114
28731
|
render: (props) => {
|
|
28115
28732
|
const ixoProps = props;
|
|
28116
|
-
return /* @__PURE__ */
|
|
28733
|
+
return /* @__PURE__ */ React261.createElement(LocationBlock, { ...ixoProps });
|
|
28117
28734
|
}
|
|
28118
28735
|
}
|
|
28119
28736
|
);
|
|
@@ -28316,10 +28933,10 @@ blockRegistry.register({
|
|
|
28316
28933
|
});
|
|
28317
28934
|
|
|
28318
28935
|
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
28319
|
-
import { useMemo as
|
|
28936
|
+
import { useMemo as useMemo100, useEffect as useEffect87, useState as useState105, useCallback as useCallback85 } from "react";
|
|
28320
28937
|
|
|
28321
28938
|
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
28322
|
-
import { useMemo as
|
|
28939
|
+
import { useMemo as useMemo101 } from "react";
|
|
28323
28940
|
|
|
28324
28941
|
// src/mantine/blocks/index.ts
|
|
28325
28942
|
var blockSpecs = {
|
|
@@ -28934,15 +29551,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
|
|
|
28934
29551
|
import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
|
|
28935
29552
|
|
|
28936
29553
|
// src/core/hooks/useMatrixProvider.ts
|
|
28937
|
-
import { useEffect as
|
|
29554
|
+
import { useEffect as useEffect88, useState as useState106, useRef as useRef25, useCallback as useCallback86, useMemo as useMemo102 } from "react";
|
|
28938
29555
|
import { MatrixProvider } from "@ixo/matrix-crdt";
|
|
28939
29556
|
function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
28940
|
-
const [matrixProvider, setProvider] =
|
|
28941
|
-
const [status, setStatus] =
|
|
29557
|
+
const [matrixProvider, setProvider] = useState106(null);
|
|
29558
|
+
const [status, setStatus] = useState106("disconnected");
|
|
28942
29559
|
const isMountedRef = useRef25(true);
|
|
28943
29560
|
const providerRef = useRef25(null);
|
|
28944
29561
|
const retryTimeoutRef = useRef25(null);
|
|
28945
|
-
const providerOptions =
|
|
29562
|
+
const providerOptions = useMemo102(
|
|
28946
29563
|
() => ({
|
|
28947
29564
|
translator: {
|
|
28948
29565
|
updateEventType: "matrix-crdt.doc_update",
|
|
@@ -28955,22 +29572,22 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
28955
29572
|
}),
|
|
28956
29573
|
[]
|
|
28957
29574
|
);
|
|
28958
|
-
const handleDocumentAvailable =
|
|
29575
|
+
const handleDocumentAvailable = useCallback86(() => {
|
|
28959
29576
|
if (isMountedRef.current) {
|
|
28960
29577
|
setStatus("connected");
|
|
28961
29578
|
}
|
|
28962
29579
|
}, []);
|
|
28963
|
-
const handleDocumentUnavailable =
|
|
29580
|
+
const handleDocumentUnavailable = useCallback86(() => {
|
|
28964
29581
|
if (isMountedRef.current) {
|
|
28965
29582
|
setStatus("failed");
|
|
28966
29583
|
}
|
|
28967
29584
|
}, []);
|
|
28968
|
-
const handleCanWriteChanged =
|
|
29585
|
+
const handleCanWriteChanged = useCallback86(() => {
|
|
28969
29586
|
if (isMountedRef.current && providerRef.current) {
|
|
28970
29587
|
setStatus(providerRef.current.canWrite ? "connected" : "failed");
|
|
28971
29588
|
}
|
|
28972
29589
|
}, []);
|
|
28973
|
-
const initProvider =
|
|
29590
|
+
const initProvider = useCallback86(async () => {
|
|
28974
29591
|
if (!isMountedRef.current) return;
|
|
28975
29592
|
if (retryTimeoutRef.current) {
|
|
28976
29593
|
clearTimeout(retryTimeoutRef.current);
|
|
@@ -29003,7 +29620,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
29003
29620
|
}
|
|
29004
29621
|
}
|
|
29005
29622
|
}, [matrixClient, providerOptions, handleDocumentAvailable, handleDocumentUnavailable, handleCanWriteChanged]);
|
|
29006
|
-
|
|
29623
|
+
useEffect88(() => {
|
|
29007
29624
|
isMountedRef.current = true;
|
|
29008
29625
|
initProvider();
|
|
29009
29626
|
return () => {
|
|
@@ -29020,7 +29637,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
29020
29637
|
setStatus("disconnected");
|
|
29021
29638
|
};
|
|
29022
29639
|
}, [initProvider]);
|
|
29023
|
-
|
|
29640
|
+
useEffect88(() => {
|
|
29024
29641
|
return () => {
|
|
29025
29642
|
isMountedRef.current = false;
|
|
29026
29643
|
};
|
|
@@ -29029,17 +29646,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
29029
29646
|
}
|
|
29030
29647
|
|
|
29031
29648
|
// src/mantine/hooks/useCollaborativeYDoc.ts
|
|
29032
|
-
import { useMemo as
|
|
29649
|
+
import { useMemo as useMemo103 } from "react";
|
|
29033
29650
|
import * as Y from "yjs";
|
|
29034
29651
|
function useCollaborativeYDoc(_options) {
|
|
29035
|
-
return
|
|
29652
|
+
return useMemo103(() => {
|
|
29036
29653
|
const doc = new Y.Doc();
|
|
29037
29654
|
return doc;
|
|
29038
29655
|
}, []);
|
|
29039
29656
|
}
|
|
29040
29657
|
|
|
29041
29658
|
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
29042
|
-
import { useMemo as
|
|
29659
|
+
import { useMemo as useMemo104, useEffect as useEffect89, useState as useState107 } from "react";
|
|
29043
29660
|
|
|
29044
29661
|
// src/core/lib/matrixMetadata.ts
|
|
29045
29662
|
var COVER_IMAGE_EVENT_TYPE = "ixo.page.cover_image";
|
|
@@ -29208,7 +29825,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29208
29825
|
matrixClient,
|
|
29209
29826
|
permissions = { write: false }
|
|
29210
29827
|
} = options || {};
|
|
29211
|
-
const memoizedUser =
|
|
29828
|
+
const memoizedUser = useMemo104(
|
|
29212
29829
|
() => ({
|
|
29213
29830
|
id: user?.id || "",
|
|
29214
29831
|
name: user?.name || "",
|
|
@@ -29223,13 +29840,13 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29223
29840
|
matrixClient,
|
|
29224
29841
|
roomId: options.roomId
|
|
29225
29842
|
});
|
|
29226
|
-
const metadataManager =
|
|
29227
|
-
|
|
29843
|
+
const metadataManager = useMemo104(() => new MatrixMetadataManager(matrixClient, options.roomId), [matrixClient, options.roomId]);
|
|
29844
|
+
useEffect89(() => {
|
|
29228
29845
|
return () => {
|
|
29229
29846
|
metadataManager.dispose();
|
|
29230
29847
|
};
|
|
29231
29848
|
}, [metadataManager]);
|
|
29232
|
-
const defaultUploadFile =
|
|
29849
|
+
const defaultUploadFile = useMemo104(
|
|
29233
29850
|
() => uploadFile || (async (file) => {
|
|
29234
29851
|
return new Promise((resolve, reject) => {
|
|
29235
29852
|
const reader = new FileReader();
|
|
@@ -29243,7 +29860,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29243
29860
|
}),
|
|
29244
29861
|
[uploadFile]
|
|
29245
29862
|
);
|
|
29246
|
-
const schema =
|
|
29863
|
+
const schema = useMemo104(
|
|
29247
29864
|
() => BlockNoteSchema2.create({
|
|
29248
29865
|
blockSpecs: {
|
|
29249
29866
|
...defaultBlockSpecs2,
|
|
@@ -29258,16 +29875,16 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29258
29875
|
}),
|
|
29259
29876
|
[]
|
|
29260
29877
|
);
|
|
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 =
|
|
29878
|
+
const root = useMemo104(() => yDoc.getMap("root"), [yDoc]);
|
|
29879
|
+
const documentFragment = useMemo104(() => yDoc.getXmlFragment("document"), [yDoc]);
|
|
29880
|
+
const flowArray = useMemo104(() => yDoc.getArray("flow"), [yDoc]);
|
|
29881
|
+
const runtimeMap = useMemo104(() => yDoc.getMap("runtime"), [yDoc]);
|
|
29882
|
+
const delegationsMap = useMemo104(() => yDoc.getMap("delegations"), [yDoc]);
|
|
29883
|
+
const invocationsMap = useMemo104(() => yDoc.getMap("invocations"), [yDoc]);
|
|
29884
|
+
const ucanDelegationStore = useMemo104(() => createUcanDelegationStore(delegationsMap), [delegationsMap]);
|
|
29885
|
+
const invocationStore = useMemo104(() => createInvocationStore(invocationsMap), [invocationsMap]);
|
|
29886
|
+
const userFragment = useMemo104(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
|
|
29887
|
+
const collaborationConfig = useMemo104(
|
|
29271
29888
|
() => ({
|
|
29272
29889
|
provider: matrixProvider,
|
|
29273
29890
|
fragment: documentFragment,
|
|
@@ -29279,7 +29896,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29279
29896
|
}),
|
|
29280
29897
|
[matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
|
|
29281
29898
|
);
|
|
29282
|
-
const ixoConfig =
|
|
29899
|
+
const ixoConfig = useMemo104(
|
|
29283
29900
|
() => ({
|
|
29284
29901
|
theme,
|
|
29285
29902
|
editable,
|
|
@@ -29298,7 +29915,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29298
29915
|
uploadFile: defaultUploadFile,
|
|
29299
29916
|
collaboration: collaborationConfig
|
|
29300
29917
|
});
|
|
29301
|
-
const titleText =
|
|
29918
|
+
const titleText = useMemo104(() => yDoc.getText("title"), [yDoc]);
|
|
29302
29919
|
let ixoEditor;
|
|
29303
29920
|
if (editor) {
|
|
29304
29921
|
ixoEditor = editor;
|
|
@@ -29476,12 +30093,12 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29476
30093
|
return void 0;
|
|
29477
30094
|
};
|
|
29478
30095
|
}
|
|
29479
|
-
|
|
30096
|
+
useEffect89(() => {
|
|
29480
30097
|
if (ixoEditor) {
|
|
29481
30098
|
ixoEditor.isEditable = editable;
|
|
29482
30099
|
}
|
|
29483
30100
|
}, [ixoEditor, editable]);
|
|
29484
|
-
|
|
30101
|
+
useEffect89(() => {
|
|
29485
30102
|
if (connectionStatus !== "connected") {
|
|
29486
30103
|
return;
|
|
29487
30104
|
}
|
|
@@ -29503,9 +30120,9 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29503
30120
|
titleText.insert(0, options.title);
|
|
29504
30121
|
}
|
|
29505
30122
|
}, [connectionStatus, root, titleText, permissions.write, options.docId, options.title, memoizedUser.id]);
|
|
29506
|
-
const [connectedUsers, setConnectedUsers] =
|
|
30123
|
+
const [connectedUsers, setConnectedUsers] = useState107([]);
|
|
29507
30124
|
const webrtcProvider = matrixProvider?.webrtcProvider;
|
|
29508
|
-
|
|
30125
|
+
useEffect89(() => {
|
|
29509
30126
|
if (!matrixProvider?.awarenessInstance || !webrtcProvider || connectionStatus !== "connected") {
|
|
29510
30127
|
return;
|
|
29511
30128
|
}
|
|
@@ -29524,7 +30141,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29524
30141
|
awareness.off("change", updateUsers);
|
|
29525
30142
|
};
|
|
29526
30143
|
}, [matrixProvider, webrtcProvider, connectionStatus]);
|
|
29527
|
-
|
|
30144
|
+
useEffect89(() => {
|
|
29528
30145
|
if (!matrixProvider?.awarenessInstance || !webrtcProvider || connectionStatus !== "connected") {
|
|
29529
30146
|
return;
|
|
29530
30147
|
}
|
|
@@ -29562,15 +30179,15 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
29562
30179
|
}
|
|
29563
30180
|
|
|
29564
30181
|
// src/mantine/IxoEditor.tsx
|
|
29565
|
-
import
|
|
30182
|
+
import React269, { useState as useState112, useEffect as useEffect94, useCallback as useCallback88 } from "react";
|
|
29566
30183
|
import { getDefaultReactSlashMenuItems, SuggestionMenuController } from "@blocknote/react";
|
|
29567
30184
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
29568
30185
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
29569
30186
|
import { MantineProvider } from "@mantine/core";
|
|
29570
30187
|
|
|
29571
30188
|
// src/mantine/components/PanelContent.tsx
|
|
29572
|
-
import
|
|
29573
|
-
import { Box as
|
|
30189
|
+
import React262 from "react";
|
|
30190
|
+
import { Box as Box52 } from "@mantine/core";
|
|
29574
30191
|
var panelStyles = {
|
|
29575
30192
|
light: {
|
|
29576
30193
|
backgroundColor: "#ffffff",
|
|
@@ -29599,8 +30216,8 @@ function PanelContent({ theme }) {
|
|
|
29599
30216
|
const { activePanel, registeredPanels } = usePanelStore();
|
|
29600
30217
|
const isOpen = activePanel !== null;
|
|
29601
30218
|
const content = activePanel ? registeredPanels.get(activePanel) : null;
|
|
29602
|
-
return /* @__PURE__ */
|
|
29603
|
-
|
|
30219
|
+
return /* @__PURE__ */ React262.createElement(
|
|
30220
|
+
Box52,
|
|
29604
30221
|
{
|
|
29605
30222
|
pos: "sticky",
|
|
29606
30223
|
right: 0,
|
|
@@ -29619,8 +30236,8 @@ function PanelContent({ theme }) {
|
|
|
29619
30236
|
}
|
|
29620
30237
|
|
|
29621
30238
|
// src/mantine/components/CoverImage.tsx
|
|
29622
|
-
import
|
|
29623
|
-
import { Box as
|
|
30239
|
+
import React266, { useState as useState109, useRef as useRef26, useEffect as useEffect91 } from "react";
|
|
30240
|
+
import { Box as Box55, Group as Group96 } from "@mantine/core";
|
|
29624
30241
|
|
|
29625
30242
|
// src/core/lib/imageTransform.ts
|
|
29626
30243
|
var CLOUDFLARE_CDN_BASE = "https://www.ixo.earth/cdn-cgi/image";
|
|
@@ -29753,9 +30370,9 @@ function transformIconImage(sourceUrl, size = "default", customOptions) {
|
|
|
29753
30370
|
}
|
|
29754
30371
|
|
|
29755
30372
|
// src/mantine/components/Base/CoverImageButton.tsx
|
|
29756
|
-
import
|
|
30373
|
+
import React263, { forwardRef } from "react";
|
|
29757
30374
|
import { Button as Button47 } from "@mantine/core";
|
|
29758
|
-
var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style, ...props }, ref) => /* @__PURE__ */
|
|
30375
|
+
var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style, ...props }, ref) => /* @__PURE__ */ React263.createElement(
|
|
29759
30376
|
Button47,
|
|
29760
30377
|
{
|
|
29761
30378
|
ref,
|
|
@@ -29778,8 +30395,8 @@ var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style,
|
|
|
29778
30395
|
CoverImageButton.displayName = "CoverImageButton";
|
|
29779
30396
|
|
|
29780
30397
|
// src/mantine/components/Base/BaseIconPicker.tsx
|
|
29781
|
-
import
|
|
29782
|
-
import { TextInput as TextInput8, Tabs as Tabs4, Box as
|
|
30398
|
+
import React264, { useState as useState108, useMemo as useMemo105, useEffect as useEffect90 } from "react";
|
|
30399
|
+
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
30400
|
import * as TablerIcons from "@tabler/icons-react";
|
|
29784
30401
|
import { IconSearch as IconSearch6, IconX as IconX13, IconChevronLeft, IconChevronRight as IconChevronRight13 } from "@tabler/icons-react";
|
|
29785
30402
|
|
|
@@ -29811,28 +30428,28 @@ var localStorageService = {
|
|
|
29811
30428
|
var iconsKey = "editor_recent_icons";
|
|
29812
30429
|
var ICONS_PER_PAGE = 500;
|
|
29813
30430
|
function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children, currentIcon }) {
|
|
29814
|
-
const [searchQuery, setSearchQuery] =
|
|
29815
|
-
const [activeTab, setActiveTab] =
|
|
29816
|
-
const [currentPage, setCurrentPage] =
|
|
29817
|
-
const allIcons =
|
|
30431
|
+
const [searchQuery, setSearchQuery] = useState108("");
|
|
30432
|
+
const [activeTab, setActiveTab] = useState108("icons");
|
|
30433
|
+
const [currentPage, setCurrentPage] = useState108(1);
|
|
30434
|
+
const allIcons = useMemo105(() => {
|
|
29818
30435
|
const iconEntries = Object.entries(TablerIcons).filter(([name]) => name.startsWith("Icon") && name !== "IconProps");
|
|
29819
30436
|
return iconEntries;
|
|
29820
30437
|
}, []);
|
|
29821
|
-
const filteredIcons =
|
|
30438
|
+
const filteredIcons = useMemo105(() => {
|
|
29822
30439
|
if (!searchQuery) return allIcons;
|
|
29823
30440
|
const query = searchQuery.toLowerCase();
|
|
29824
30441
|
return allIcons.filter(([name]) => name.toLowerCase().includes(query));
|
|
29825
30442
|
}, [allIcons, searchQuery]);
|
|
29826
|
-
|
|
30443
|
+
useEffect90(() => {
|
|
29827
30444
|
setCurrentPage(1);
|
|
29828
30445
|
}, [searchQuery]);
|
|
29829
|
-
const paginatedIcons =
|
|
30446
|
+
const paginatedIcons = useMemo105(() => {
|
|
29830
30447
|
const startIndex = (currentPage - 1) * ICONS_PER_PAGE;
|
|
29831
30448
|
const endIndex = startIndex + ICONS_PER_PAGE;
|
|
29832
30449
|
return filteredIcons.slice(startIndex, endIndex);
|
|
29833
30450
|
}, [filteredIcons, currentPage]);
|
|
29834
30451
|
const totalPages = Math.ceil(filteredIcons.length / ICONS_PER_PAGE);
|
|
29835
|
-
const recentIcons =
|
|
30452
|
+
const recentIcons = useMemo105(() => {
|
|
29836
30453
|
const recentIconNames = localStorageService.get(iconsKey);
|
|
29837
30454
|
if (!recentIconNames || recentIconNames.length === 0) return [];
|
|
29838
30455
|
return recentIconNames.slice(0, 24).map((iconName) => allIcons.find(([name]) => name === iconName)).filter((entry) => entry !== void 0);
|
|
@@ -29847,10 +30464,10 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
29847
30464
|
};
|
|
29848
30465
|
const renderIconGrid = (icons) => {
|
|
29849
30466
|
if (icons.length === 0) {
|
|
29850
|
-
return /* @__PURE__ */
|
|
30467
|
+
return /* @__PURE__ */ React264.createElement(Center14, { py: "xl" }, /* @__PURE__ */ React264.createElement(Text148, { c: "dimmed", size: "sm" }, "No icons found"));
|
|
29851
30468
|
}
|
|
29852
|
-
return /* @__PURE__ */
|
|
29853
|
-
|
|
30469
|
+
return /* @__PURE__ */ React264.createElement(
|
|
30470
|
+
Box53,
|
|
29854
30471
|
{
|
|
29855
30472
|
style: {
|
|
29856
30473
|
display: "grid",
|
|
@@ -29861,7 +30478,7 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
29861
30478
|
},
|
|
29862
30479
|
icons.map(([name, IconComponent]) => {
|
|
29863
30480
|
const isSelected = currentIcon === name.replace("Icon", "").replace(/([A-Z])/g, "-$1").toLowerCase().slice(1);
|
|
29864
|
-
return /* @__PURE__ */
|
|
30481
|
+
return /* @__PURE__ */ React264.createElement(
|
|
29865
30482
|
UnstyledButton4,
|
|
29866
30483
|
{
|
|
29867
30484
|
key: name,
|
|
@@ -29887,12 +30504,12 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
29887
30504
|
}
|
|
29888
30505
|
}
|
|
29889
30506
|
},
|
|
29890
|
-
/* @__PURE__ */
|
|
30507
|
+
/* @__PURE__ */ React264.createElement(IconComponent, { color: "white", size: 24, stroke: 1.5 })
|
|
29891
30508
|
);
|
|
29892
30509
|
})
|
|
29893
30510
|
);
|
|
29894
30511
|
};
|
|
29895
|
-
return /* @__PURE__ */
|
|
30512
|
+
return /* @__PURE__ */ React264.createElement(Popover5, { opened, onClose, position: "right", width: 500, shadow: "xl" }, /* @__PURE__ */ React264.createElement(Popover5.Target, null, children), /* @__PURE__ */ React264.createElement(
|
|
29896
30513
|
Popover5.Dropdown,
|
|
29897
30514
|
{
|
|
29898
30515
|
style: {
|
|
@@ -29902,15 +30519,15 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
29902
30519
|
},
|
|
29903
30520
|
p: 0
|
|
29904
30521
|
},
|
|
29905
|
-
/* @__PURE__ */
|
|
30522
|
+
/* @__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
30523
|
TextInput8,
|
|
29907
30524
|
{
|
|
29908
30525
|
mb: "md",
|
|
29909
30526
|
placeholder: "Filter",
|
|
29910
|
-
leftSection: /* @__PURE__ */
|
|
30527
|
+
leftSection: /* @__PURE__ */ React264.createElement(IconSearch6, { size: 18 }),
|
|
29911
30528
|
value: searchQuery,
|
|
29912
30529
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
29913
|
-
rightSection: searchQuery && /* @__PURE__ */
|
|
30530
|
+
rightSection: searchQuery && /* @__PURE__ */ React264.createElement(UnstyledButton4, { onClick: () => setSearchQuery("") }, /* @__PURE__ */ React264.createElement(IconX13, { size: 18 })),
|
|
29914
30531
|
style: { flex: 1 },
|
|
29915
30532
|
styles: {
|
|
29916
30533
|
input: {
|
|
@@ -29920,26 +30537,26 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
29920
30537
|
}
|
|
29921
30538
|
}
|
|
29922
30539
|
}
|
|
29923
|
-
), !searchQuery && /* @__PURE__ */
|
|
30540
|
+
), !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
30541
|
BaseButton,
|
|
29925
30542
|
{
|
|
29926
30543
|
size: "xs",
|
|
29927
30544
|
onClick: () => setCurrentPage((p) => Math.min(totalPages, p + 1)),
|
|
29928
30545
|
disabled: currentPage === totalPages,
|
|
29929
|
-
leftSection: /* @__PURE__ */
|
|
30546
|
+
leftSection: /* @__PURE__ */ React264.createElement(IconChevronRight13, { size: 14 })
|
|
29930
30547
|
},
|
|
29931
30548
|
"Next"
|
|
29932
|
-
))), /* @__PURE__ */
|
|
30549
|
+
))), /* @__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
30550
|
));
|
|
29934
30551
|
}
|
|
29935
30552
|
|
|
29936
30553
|
// src/mantine/components/Base/PageIcon.tsx
|
|
29937
|
-
import
|
|
29938
|
-
import { Center as Center15, Box as
|
|
30554
|
+
import React265, { useMemo as useMemo106 } from "react";
|
|
30555
|
+
import { Center as Center15, Box as Box54 } from "@mantine/core";
|
|
29939
30556
|
import * as TablerIcons2 from "@tabler/icons-react";
|
|
29940
30557
|
function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
29941
30558
|
const isIconName = src && !src.startsWith("http");
|
|
29942
|
-
const IconComponent =
|
|
30559
|
+
const IconComponent = useMemo106(() => {
|
|
29943
30560
|
if (!isIconName || !src) return null;
|
|
29944
30561
|
const iconComponent = TablerIcons2[src];
|
|
29945
30562
|
if (iconComponent) {
|
|
@@ -29947,10 +30564,10 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
29947
30564
|
}
|
|
29948
30565
|
return null;
|
|
29949
30566
|
}, [isIconName, src]);
|
|
29950
|
-
const Container = useCenter ? Center15 :
|
|
30567
|
+
const Container = useCenter ? Center15 : Box54;
|
|
29951
30568
|
if (!src) return null;
|
|
29952
30569
|
if (IconComponent) {
|
|
29953
|
-
return /* @__PURE__ */
|
|
30570
|
+
return /* @__PURE__ */ React265.createElement(
|
|
29954
30571
|
Container,
|
|
29955
30572
|
{
|
|
29956
30573
|
style: {
|
|
@@ -29962,10 +30579,10 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
29962
30579
|
...style
|
|
29963
30580
|
}
|
|
29964
30581
|
},
|
|
29965
|
-
/* @__PURE__ */
|
|
30582
|
+
/* @__PURE__ */ React265.createElement(IconComponent, { size: iconSize, color: "white", stroke: 1.5 })
|
|
29966
30583
|
);
|
|
29967
30584
|
}
|
|
29968
|
-
return /* @__PURE__ */
|
|
30585
|
+
return /* @__PURE__ */ React265.createElement(
|
|
29969
30586
|
"img",
|
|
29970
30587
|
{
|
|
29971
30588
|
src,
|
|
@@ -29986,14 +30603,14 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
29986
30603
|
import { useDisclosure as useDisclosure6 } from "@mantine/hooks";
|
|
29987
30604
|
function CoverImage({ coverImageUrl, logoUrl }) {
|
|
29988
30605
|
const { editor, handlers, editable } = useBlocknoteContext();
|
|
29989
|
-
const [isHovering, setIsHovering] =
|
|
29990
|
-
const [isRepositioning, setIsRepositioning] =
|
|
29991
|
-
const [coverPosition, setCoverPosition] =
|
|
30606
|
+
const [isHovering, setIsHovering] = useState109(false);
|
|
30607
|
+
const [isRepositioning, setIsRepositioning] = useState109(false);
|
|
30608
|
+
const [coverPosition, setCoverPosition] = useState109(50);
|
|
29992
30609
|
const coverFileInputRef = useRef26(null);
|
|
29993
30610
|
const logoFileInputRef = useRef26(null);
|
|
29994
30611
|
const [opened, { open, close }] = useDisclosure6(false);
|
|
29995
|
-
const [metadata, setMetadata] =
|
|
29996
|
-
|
|
30612
|
+
const [metadata, setMetadata] = useState109(() => editor?.getPageMetadata?.() || null);
|
|
30613
|
+
useEffect91(() => {
|
|
29997
30614
|
if (!editor?._metadataManager) {
|
|
29998
30615
|
return;
|
|
29999
30616
|
}
|
|
@@ -30075,8 +30692,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30075
30692
|
return null;
|
|
30076
30693
|
}
|
|
30077
30694
|
if (!hasCover) {
|
|
30078
|
-
return /* @__PURE__ */
|
|
30079
|
-
|
|
30695
|
+
return /* @__PURE__ */ React266.createElement(
|
|
30696
|
+
Box55,
|
|
30080
30697
|
{
|
|
30081
30698
|
style: {
|
|
30082
30699
|
position: "relative",
|
|
@@ -30088,7 +30705,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30088
30705
|
onMouseEnter: () => editable && setIsHovering(true),
|
|
30089
30706
|
onMouseLeave: () => editable && setIsHovering(false)
|
|
30090
30707
|
},
|
|
30091
|
-
/* @__PURE__ */
|
|
30708
|
+
/* @__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
30709
|
Group96,
|
|
30093
30710
|
{
|
|
30094
30711
|
gap: "xs",
|
|
@@ -30099,7 +30716,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30099
30716
|
zIndex: 10
|
|
30100
30717
|
}
|
|
30101
30718
|
},
|
|
30102
|
-
/* @__PURE__ */
|
|
30719
|
+
/* @__PURE__ */ React266.createElement(
|
|
30103
30720
|
BaseIconPicker,
|
|
30104
30721
|
{
|
|
30105
30722
|
opened,
|
|
@@ -30108,11 +30725,11 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30108
30725
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
30109
30726
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
30110
30727
|
},
|
|
30111
|
-
/* @__PURE__ */
|
|
30728
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: open }, "Add icon")
|
|
30112
30729
|
),
|
|
30113
|
-
/* @__PURE__ */
|
|
30114
|
-
), logoSrc && /* @__PURE__ */
|
|
30115
|
-
|
|
30730
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Add cover")
|
|
30731
|
+
), logoSrc && /* @__PURE__ */ React266.createElement(
|
|
30732
|
+
Box55,
|
|
30116
30733
|
{
|
|
30117
30734
|
style: {
|
|
30118
30735
|
position: "relative",
|
|
@@ -30125,8 +30742,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30125
30742
|
zIndex: 11
|
|
30126
30743
|
}
|
|
30127
30744
|
},
|
|
30128
|
-
/* @__PURE__ */
|
|
30129
|
-
editable && isHovering && /* @__PURE__ */
|
|
30745
|
+
/* @__PURE__ */ React266.createElement(PageIcon, { src: logoSrc, useCenter: true, iconSize: 64 }),
|
|
30746
|
+
editable && isHovering && /* @__PURE__ */ React266.createElement(
|
|
30130
30747
|
"div",
|
|
30131
30748
|
{
|
|
30132
30749
|
style: {
|
|
@@ -30141,7 +30758,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30141
30758
|
alignItems: "center"
|
|
30142
30759
|
}
|
|
30143
30760
|
},
|
|
30144
|
-
/* @__PURE__ */
|
|
30761
|
+
/* @__PURE__ */ React266.createElement(
|
|
30145
30762
|
BaseIconPicker,
|
|
30146
30763
|
{
|
|
30147
30764
|
opened,
|
|
@@ -30150,16 +30767,16 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30150
30767
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
30151
30768
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
30152
30769
|
},
|
|
30153
|
-
/* @__PURE__ */
|
|
30770
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: open }, "Change")
|
|
30154
30771
|
),
|
|
30155
|
-
/* @__PURE__ */
|
|
30156
|
-
/* @__PURE__ */
|
|
30772
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove"),
|
|
30773
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Add cover")
|
|
30157
30774
|
)
|
|
30158
30775
|
))
|
|
30159
30776
|
);
|
|
30160
30777
|
}
|
|
30161
|
-
return /* @__PURE__ */
|
|
30162
|
-
|
|
30778
|
+
return /* @__PURE__ */ React266.createElement(
|
|
30779
|
+
Box55,
|
|
30163
30780
|
{
|
|
30164
30781
|
style: {
|
|
30165
30782
|
position: "relative",
|
|
@@ -30178,7 +30795,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30178
30795
|
onMouseMove: handleMouseMove,
|
|
30179
30796
|
onClick: () => isRepositioning && setIsRepositioning(false)
|
|
30180
30797
|
},
|
|
30181
|
-
/* @__PURE__ */
|
|
30798
|
+
/* @__PURE__ */ React266.createElement(
|
|
30182
30799
|
"img",
|
|
30183
30800
|
{
|
|
30184
30801
|
src: coverUrl,
|
|
@@ -30196,7 +30813,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30196
30813
|
}
|
|
30197
30814
|
}
|
|
30198
30815
|
),
|
|
30199
|
-
editable && isHovering && /* @__PURE__ */
|
|
30816
|
+
editable && isHovering && /* @__PURE__ */ React266.createElement(
|
|
30200
30817
|
Group96,
|
|
30201
30818
|
{
|
|
30202
30819
|
gap: "xs",
|
|
@@ -30207,12 +30824,12 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30207
30824
|
zIndex: 10
|
|
30208
30825
|
}
|
|
30209
30826
|
},
|
|
30210
|
-
/* @__PURE__ */
|
|
30211
|
-
/* @__PURE__ */
|
|
30212
|
-
/* @__PURE__ */
|
|
30827
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Change cover"),
|
|
30828
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: () => setIsRepositioning(!isRepositioning), isActive: isRepositioning }, isRepositioning ? "Done" : "Reposition"),
|
|
30829
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: handleRemoveCover }, "Remove")
|
|
30213
30830
|
),
|
|
30214
|
-
/* @__PURE__ */
|
|
30215
|
-
|
|
30831
|
+
/* @__PURE__ */ React266.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "absolute", bottom: 0, left: -40, right: 0, height: "70px" } }, /* @__PURE__ */ React266.createElement(
|
|
30832
|
+
Box55,
|
|
30216
30833
|
{
|
|
30217
30834
|
style: {
|
|
30218
30835
|
position: "absolute",
|
|
@@ -30223,8 +30840,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30223
30840
|
zIndex: 11
|
|
30224
30841
|
}
|
|
30225
30842
|
},
|
|
30226
|
-
logoSrc && /* @__PURE__ */
|
|
30227
|
-
editable && isHovering && /* @__PURE__ */
|
|
30843
|
+
logoSrc && /* @__PURE__ */ React266.createElement(PageIcon, { src: logoSrc, iconSize: 64 }),
|
|
30844
|
+
editable && isHovering && /* @__PURE__ */ React266.createElement(React266.Fragment, null, logoSrc ? /* @__PURE__ */ React266.createElement(
|
|
30228
30845
|
Group96,
|
|
30229
30846
|
{
|
|
30230
30847
|
gap: "xs",
|
|
@@ -30235,7 +30852,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30235
30852
|
zIndex: 12
|
|
30236
30853
|
}
|
|
30237
30854
|
},
|
|
30238
|
-
/* @__PURE__ */
|
|
30855
|
+
/* @__PURE__ */ React266.createElement(
|
|
30239
30856
|
BaseIconPicker,
|
|
30240
30857
|
{
|
|
30241
30858
|
opened,
|
|
@@ -30244,10 +30861,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30244
30861
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
30245
30862
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
30246
30863
|
},
|
|
30247
|
-
/* @__PURE__ */
|
|
30864
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: open }, "Change")
|
|
30248
30865
|
),
|
|
30249
|
-
/* @__PURE__ */
|
|
30250
|
-
) : /* @__PURE__ */
|
|
30866
|
+
/* @__PURE__ */ React266.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove")
|
|
30867
|
+
) : /* @__PURE__ */ React266.createElement(
|
|
30251
30868
|
CoverImageButton,
|
|
30252
30869
|
{
|
|
30253
30870
|
onClick: open,
|
|
@@ -30262,13 +30879,13 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
30262
30879
|
"Add icon"
|
|
30263
30880
|
))
|
|
30264
30881
|
)),
|
|
30265
|
-
/* @__PURE__ */
|
|
30266
|
-
/* @__PURE__ */
|
|
30882
|
+
/* @__PURE__ */ React266.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
|
|
30883
|
+
/* @__PURE__ */ React266.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
|
|
30267
30884
|
);
|
|
30268
30885
|
}
|
|
30269
30886
|
|
|
30270
30887
|
// src/mantine/components/PageHeader.tsx
|
|
30271
|
-
import
|
|
30888
|
+
import React267, { useState as useState110, useRef as useRef27, useEffect as useEffect92 } from "react";
|
|
30272
30889
|
function PageHeader({
|
|
30273
30890
|
title = "New page",
|
|
30274
30891
|
icon: icon2,
|
|
@@ -30280,11 +30897,11 @@ function PageHeader({
|
|
|
30280
30897
|
isFavorited = false,
|
|
30281
30898
|
menuItems = []
|
|
30282
30899
|
}) {
|
|
30283
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
30284
|
-
const [isPrivacyOpen, setIsPrivacyOpen] =
|
|
30900
|
+
const [isMenuOpen, setIsMenuOpen] = useState110(false);
|
|
30901
|
+
const [isPrivacyOpen, setIsPrivacyOpen] = useState110(false);
|
|
30285
30902
|
const menuRef = useRef27(null);
|
|
30286
30903
|
const privacyRef = useRef27(null);
|
|
30287
|
-
|
|
30904
|
+
useEffect92(() => {
|
|
30288
30905
|
function handleClickOutside(event) {
|
|
30289
30906
|
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
30290
30907
|
setIsMenuOpen(false);
|
|
@@ -30306,7 +30923,7 @@ function PageHeader({
|
|
|
30306
30923
|
setIsMenuOpen(false);
|
|
30307
30924
|
}
|
|
30308
30925
|
};
|
|
30309
|
-
return /* @__PURE__ */
|
|
30926
|
+
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
30927
|
"button",
|
|
30311
30928
|
{
|
|
30312
30929
|
style: {
|
|
@@ -30318,9 +30935,9 @@ function PageHeader({
|
|
|
30318
30935
|
setIsPrivacyOpen(false);
|
|
30319
30936
|
}
|
|
30320
30937
|
},
|
|
30321
|
-
/* @__PURE__ */
|
|
30322
|
-
/* @__PURE__ */
|
|
30323
|
-
), /* @__PURE__ */
|
|
30938
|
+
/* @__PURE__ */ React267.createElement("span", { style: styles.menuItemIcon }, "\u{1F512}"),
|
|
30939
|
+
/* @__PURE__ */ React267.createElement("span", null, "Private")
|
|
30940
|
+
), /* @__PURE__ */ React267.createElement(
|
|
30324
30941
|
"button",
|
|
30325
30942
|
{
|
|
30326
30943
|
style: {
|
|
@@ -30332,9 +30949,9 @@ function PageHeader({
|
|
|
30332
30949
|
setIsPrivacyOpen(false);
|
|
30333
30950
|
}
|
|
30334
30951
|
},
|
|
30335
|
-
/* @__PURE__ */
|
|
30336
|
-
/* @__PURE__ */
|
|
30337
|
-
)))), /* @__PURE__ */
|
|
30952
|
+
/* @__PURE__ */ React267.createElement("span", { style: styles.menuItemIcon }, "\u{1F310}"),
|
|
30953
|
+
/* @__PURE__ */ React267.createElement("span", null, "Public")
|
|
30954
|
+
)))), /* @__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
30955
|
"button",
|
|
30339
30956
|
{
|
|
30340
30957
|
style: {
|
|
@@ -30344,8 +30961,8 @@ function PageHeader({
|
|
|
30344
30961
|
onClick: () => handleMenuItemClick(item),
|
|
30345
30962
|
disabled: item.disabled
|
|
30346
30963
|
},
|
|
30347
|
-
item.icon && /* @__PURE__ */
|
|
30348
|
-
/* @__PURE__ */
|
|
30964
|
+
item.icon && /* @__PURE__ */ React267.createElement("span", { style: styles.menuItemIcon }, item.icon),
|
|
30965
|
+
/* @__PURE__ */ React267.createElement("span", null, item.label)
|
|
30349
30966
|
)))))));
|
|
30350
30967
|
}
|
|
30351
30968
|
var styles = {
|
|
@@ -30482,8 +31099,8 @@ var styles = {
|
|
|
30482
31099
|
};
|
|
30483
31100
|
|
|
30484
31101
|
// src/mantine/components/ExternalDropZone.tsx
|
|
30485
|
-
import
|
|
30486
|
-
import { Box as
|
|
31102
|
+
import React268, { useCallback as useCallback87, useEffect as useEffect93, useRef as useRef28, useState as useState111 } from "react";
|
|
31103
|
+
import { Box as Box56 } from "@mantine/core";
|
|
30487
31104
|
var SCROLL_ZONE_SIZE = 80;
|
|
30488
31105
|
var SCROLL_SPEED = 12;
|
|
30489
31106
|
var ExternalDropZone = ({
|
|
@@ -30496,19 +31113,19 @@ var ExternalDropZone = ({
|
|
|
30496
31113
|
children
|
|
30497
31114
|
}) => {
|
|
30498
31115
|
const containerRef = useRef28(null);
|
|
30499
|
-
const [isValidDrag, setIsValidDrag] =
|
|
30500
|
-
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] =
|
|
30501
|
-
const [indicatorStyle, setIndicatorStyle] =
|
|
31116
|
+
const [isValidDrag, setIsValidDrag] = useState111(false);
|
|
31117
|
+
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] = useState111(false);
|
|
31118
|
+
const [indicatorStyle, setIndicatorStyle] = useState111({});
|
|
30502
31119
|
const dropPositionRef = useRef28(null);
|
|
30503
31120
|
const scrollAnimationRef = useRef28(null);
|
|
30504
31121
|
const scrollDirectionRef = useRef28(null);
|
|
30505
31122
|
const scrollContainerRef = useRef28(null);
|
|
30506
|
-
const getBlockElements =
|
|
31123
|
+
const getBlockElements = useCallback87(() => {
|
|
30507
31124
|
if (!containerRef.current) return [];
|
|
30508
31125
|
const blocks = containerRef.current.querySelectorAll('[data-node-type="blockContainer"]');
|
|
30509
31126
|
return Array.from(blocks);
|
|
30510
31127
|
}, []);
|
|
30511
|
-
const getScrollContainer =
|
|
31128
|
+
const getScrollContainer = useCallback87(() => {
|
|
30512
31129
|
if (scrollContainerRef.current) return scrollContainerRef.current;
|
|
30513
31130
|
let element = containerRef.current;
|
|
30514
31131
|
while (element) {
|
|
@@ -30523,7 +31140,7 @@ var ExternalDropZone = ({
|
|
|
30523
31140
|
scrollContainerRef.current = window;
|
|
30524
31141
|
return window;
|
|
30525
31142
|
}, []);
|
|
30526
|
-
const performScroll =
|
|
31143
|
+
const performScroll = useCallback87(() => {
|
|
30527
31144
|
const container = getScrollContainer();
|
|
30528
31145
|
const direction = scrollDirectionRef.current;
|
|
30529
31146
|
if (!direction) {
|
|
@@ -30538,7 +31155,7 @@ var ExternalDropZone = ({
|
|
|
30538
31155
|
}
|
|
30539
31156
|
scrollAnimationRef.current = requestAnimationFrame(performScroll);
|
|
30540
31157
|
}, [getScrollContainer]);
|
|
30541
|
-
const startAutoScroll =
|
|
31158
|
+
const startAutoScroll = useCallback87(
|
|
30542
31159
|
(direction) => {
|
|
30543
31160
|
if (scrollDirectionRef.current === direction) return;
|
|
30544
31161
|
scrollDirectionRef.current = direction;
|
|
@@ -30548,14 +31165,14 @@ var ExternalDropZone = ({
|
|
|
30548
31165
|
},
|
|
30549
31166
|
[performScroll]
|
|
30550
31167
|
);
|
|
30551
|
-
const stopAutoScroll =
|
|
31168
|
+
const stopAutoScroll = useCallback87(() => {
|
|
30552
31169
|
scrollDirectionRef.current = null;
|
|
30553
31170
|
if (scrollAnimationRef.current) {
|
|
30554
31171
|
cancelAnimationFrame(scrollAnimationRef.current);
|
|
30555
31172
|
scrollAnimationRef.current = null;
|
|
30556
31173
|
}
|
|
30557
31174
|
}, []);
|
|
30558
|
-
const checkAutoScroll =
|
|
31175
|
+
const checkAutoScroll = useCallback87(
|
|
30559
31176
|
(clientY) => {
|
|
30560
31177
|
const container = getScrollContainer();
|
|
30561
31178
|
let containerTop;
|
|
@@ -30578,7 +31195,7 @@ var ExternalDropZone = ({
|
|
|
30578
31195
|
},
|
|
30579
31196
|
[getScrollContainer, startAutoScroll, stopAutoScroll]
|
|
30580
31197
|
);
|
|
30581
|
-
const findDropPosition =
|
|
31198
|
+
const findDropPosition = useCallback87(
|
|
30582
31199
|
(clientY) => {
|
|
30583
31200
|
const blocks = getBlockElements();
|
|
30584
31201
|
if (blocks.length === 0 || !editor?.document) return null;
|
|
@@ -30611,7 +31228,7 @@ var ExternalDropZone = ({
|
|
|
30611
31228
|
},
|
|
30612
31229
|
[getBlockElements, editor]
|
|
30613
31230
|
);
|
|
30614
|
-
const handleDragOver =
|
|
31231
|
+
const handleDragOver = useCallback87(
|
|
30615
31232
|
(e) => {
|
|
30616
31233
|
if (!e.dataTransfer.types.includes(acceptedType)) return;
|
|
30617
31234
|
e.preventDefault();
|
|
@@ -30634,7 +31251,7 @@ var ExternalDropZone = ({
|
|
|
30634
31251
|
},
|
|
30635
31252
|
[acceptedType, findDropPosition, checkAutoScroll]
|
|
30636
31253
|
);
|
|
30637
|
-
const handleDragLeave =
|
|
31254
|
+
const handleDragLeave = useCallback87(
|
|
30638
31255
|
(e) => {
|
|
30639
31256
|
if (containerRef.current && !containerRef.current.contains(e.relatedTarget)) {
|
|
30640
31257
|
setIsValidDrag(false);
|
|
@@ -30644,7 +31261,7 @@ var ExternalDropZone = ({
|
|
|
30644
31261
|
},
|
|
30645
31262
|
[stopAutoScroll]
|
|
30646
31263
|
);
|
|
30647
|
-
const handleDrop =
|
|
31264
|
+
const handleDrop = useCallback87(
|
|
30648
31265
|
(e) => {
|
|
30649
31266
|
e.preventDefault();
|
|
30650
31267
|
e.stopPropagation();
|
|
@@ -30658,7 +31275,7 @@ var ExternalDropZone = ({
|
|
|
30658
31275
|
},
|
|
30659
31276
|
[onDrop, stopAutoScroll]
|
|
30660
31277
|
);
|
|
30661
|
-
|
|
31278
|
+
useEffect93(() => {
|
|
30662
31279
|
const handleGlobalDragEnd = () => {
|
|
30663
31280
|
setIsValidDrag(false);
|
|
30664
31281
|
dropPositionRef.current = null;
|
|
@@ -30667,7 +31284,7 @@ var ExternalDropZone = ({
|
|
|
30667
31284
|
window.addEventListener("dragend", handleGlobalDragEnd);
|
|
30668
31285
|
return () => window.removeEventListener("dragend", handleGlobalDragEnd);
|
|
30669
31286
|
}, [stopAutoScroll]);
|
|
30670
|
-
const handleOverlayMouseMove =
|
|
31287
|
+
const handleOverlayMouseMove = useCallback87(
|
|
30671
31288
|
(e) => {
|
|
30672
31289
|
setIsHoveringInPlacementMode(true);
|
|
30673
31290
|
checkAutoScroll(e.clientY);
|
|
@@ -30686,12 +31303,12 @@ var ExternalDropZone = ({
|
|
|
30686
31303
|
},
|
|
30687
31304
|
[findDropPosition, checkAutoScroll]
|
|
30688
31305
|
);
|
|
30689
|
-
const handleOverlayMouseLeave =
|
|
31306
|
+
const handleOverlayMouseLeave = useCallback87(() => {
|
|
30690
31307
|
setIsHoveringInPlacementMode(false);
|
|
30691
31308
|
dropPositionRef.current = null;
|
|
30692
31309
|
stopAutoScroll();
|
|
30693
31310
|
}, [stopAutoScroll]);
|
|
30694
|
-
const handleOverlayClick =
|
|
31311
|
+
const handleOverlayClick = useCallback87(
|
|
30695
31312
|
(e) => {
|
|
30696
31313
|
e.preventDefault();
|
|
30697
31314
|
e.stopPropagation();
|
|
@@ -30705,7 +31322,7 @@ var ExternalDropZone = ({
|
|
|
30705
31322
|
},
|
|
30706
31323
|
[onDrop, stopAutoScroll]
|
|
30707
31324
|
);
|
|
30708
|
-
const handleOverlayWheel =
|
|
31325
|
+
const handleOverlayWheel = useCallback87(
|
|
30709
31326
|
(e) => {
|
|
30710
31327
|
const container = getScrollContainer();
|
|
30711
31328
|
if (container === window) {
|
|
@@ -30716,7 +31333,7 @@ var ExternalDropZone = ({
|
|
|
30716
31333
|
},
|
|
30717
31334
|
[getScrollContainer]
|
|
30718
31335
|
);
|
|
30719
|
-
|
|
31336
|
+
useEffect93(() => {
|
|
30720
31337
|
if (!isPlacementMode) return;
|
|
30721
31338
|
const handleKeyDown = (e) => {
|
|
30722
31339
|
if (e.key === "Escape") {
|
|
@@ -30739,13 +31356,13 @@ var ExternalDropZone = ({
|
|
|
30739
31356
|
document.removeEventListener("click", handleGlobalClick, true);
|
|
30740
31357
|
};
|
|
30741
31358
|
}, [isPlacementMode, onPlacementCancel]);
|
|
30742
|
-
|
|
31359
|
+
useEffect93(() => {
|
|
30743
31360
|
if (!isPlacementMode) {
|
|
30744
31361
|
setIsHoveringInPlacementMode(false);
|
|
30745
31362
|
dropPositionRef.current = null;
|
|
30746
31363
|
}
|
|
30747
31364
|
}, [isPlacementMode]);
|
|
30748
|
-
|
|
31365
|
+
useEffect93(() => {
|
|
30749
31366
|
const isActive = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
30750
31367
|
if (isActive) {
|
|
30751
31368
|
document.body.classList.add("external-artifact-drag-active");
|
|
@@ -30756,19 +31373,19 @@ var ExternalDropZone = ({
|
|
|
30756
31373
|
document.body.classList.remove("external-artifact-drag-active");
|
|
30757
31374
|
};
|
|
30758
31375
|
}, [isValidDrag, isPlacementMode, isHoveringInPlacementMode]);
|
|
30759
|
-
|
|
31376
|
+
useEffect93(() => {
|
|
30760
31377
|
return () => {
|
|
30761
31378
|
if (scrollAnimationRef.current) {
|
|
30762
31379
|
cancelAnimationFrame(scrollAnimationRef.current);
|
|
30763
31380
|
}
|
|
30764
31381
|
};
|
|
30765
31382
|
}, []);
|
|
30766
|
-
const indicatorWithPosition = dropIndicator &&
|
|
31383
|
+
const indicatorWithPosition = dropIndicator && React268.isValidElement(dropIndicator) ? React268.cloneElement(dropIndicator, {
|
|
30767
31384
|
indicatorTop: typeof indicatorStyle.top === "number" ? indicatorStyle.top : void 0
|
|
30768
31385
|
}) : dropIndicator;
|
|
30769
31386
|
const shouldShowIndicator = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
30770
|
-
return /* @__PURE__ */
|
|
30771
|
-
|
|
31387
|
+
return /* @__PURE__ */ React268.createElement(
|
|
31388
|
+
Box56,
|
|
30772
31389
|
{
|
|
30773
31390
|
ref: containerRef,
|
|
30774
31391
|
style: {
|
|
@@ -30783,8 +31400,8 @@ var ExternalDropZone = ({
|
|
|
30783
31400
|
"data-placement-mode": isPlacementMode ? "true" : void 0
|
|
30784
31401
|
},
|
|
30785
31402
|
children,
|
|
30786
|
-
isPlacementMode && /* @__PURE__ */
|
|
30787
|
-
|
|
31403
|
+
isPlacementMode && /* @__PURE__ */ React268.createElement(
|
|
31404
|
+
Box56,
|
|
30788
31405
|
{
|
|
30789
31406
|
style: {
|
|
30790
31407
|
position: "absolute",
|
|
@@ -30803,7 +31420,7 @@ var ExternalDropZone = ({
|
|
|
30803
31420
|
onWheel: handleOverlayWheel
|
|
30804
31421
|
}
|
|
30805
31422
|
),
|
|
30806
|
-
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */
|
|
31423
|
+
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */ React268.createElement(Box56, { style: { ...indicatorStyle, background: "none", border: "none", boxShadow: "none" } }, indicatorWithPosition)
|
|
30807
31424
|
);
|
|
30808
31425
|
};
|
|
30809
31426
|
|
|
@@ -30829,8 +31446,8 @@ function IxoEditorContent({
|
|
|
30829
31446
|
}) {
|
|
30830
31447
|
const { activePanel } = usePanelStore();
|
|
30831
31448
|
const isPanelOpen = activePanel !== null;
|
|
30832
|
-
const [isRoomPrivate, setIsRoomPrivate] =
|
|
30833
|
-
|
|
31449
|
+
const [isRoomPrivate, setIsRoomPrivate] = useState112(pageHeaderProps?.isPrivate ?? true);
|
|
31450
|
+
useEffect94(() => {
|
|
30834
31451
|
const matrixClient = editor.getMatrixClient?.();
|
|
30835
31452
|
const roomId = editor.getRoomId?.();
|
|
30836
31453
|
if (!matrixClient || !roomId) return;
|
|
@@ -30846,7 +31463,7 @@ function IxoEditorContent({
|
|
|
30846
31463
|
} catch {
|
|
30847
31464
|
}
|
|
30848
31465
|
}, [editor]);
|
|
30849
|
-
const handlePrivacyChange =
|
|
31466
|
+
const handlePrivacyChange = useCallback88(
|
|
30850
31467
|
async (makePrivate) => {
|
|
30851
31468
|
const matrixClient = editor.getMatrixClient?.();
|
|
30852
31469
|
const roomId = editor.getRoomId?.();
|
|
@@ -30867,7 +31484,7 @@ function IxoEditorContent({
|
|
|
30867
31484
|
},
|
|
30868
31485
|
[editor]
|
|
30869
31486
|
);
|
|
30870
|
-
const editorContent = /* @__PURE__ */
|
|
31487
|
+
const editorContent = /* @__PURE__ */ React269.createElement(
|
|
30871
31488
|
BlockNoteView,
|
|
30872
31489
|
{
|
|
30873
31490
|
editor,
|
|
@@ -30882,7 +31499,7 @@ function IxoEditorContent({
|
|
|
30882
31499
|
onChange,
|
|
30883
31500
|
onSelectionChange
|
|
30884
31501
|
},
|
|
30885
|
-
config.slashMenu && /* @__PURE__ */
|
|
31502
|
+
config.slashMenu && /* @__PURE__ */ React269.createElement(
|
|
30886
31503
|
SuggestionMenuController,
|
|
30887
31504
|
{
|
|
30888
31505
|
triggerCharacter: "/",
|
|
@@ -30901,7 +31518,7 @@ function IxoEditorContent({
|
|
|
30901
31518
|
),
|
|
30902
31519
|
children
|
|
30903
31520
|
);
|
|
30904
|
-
return /* @__PURE__ */
|
|
31521
|
+
return /* @__PURE__ */ React269.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React269.createElement(
|
|
30905
31522
|
"div",
|
|
30906
31523
|
{
|
|
30907
31524
|
className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`,
|
|
@@ -30910,9 +31527,9 @@ function IxoEditorContent({
|
|
|
30910
31527
|
transition: "width 0.2s ease"
|
|
30911
31528
|
}
|
|
30912
31529
|
},
|
|
30913
|
-
selfNav && /* @__PURE__ */
|
|
30914
|
-
/* @__PURE__ */
|
|
30915
|
-
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */
|
|
31530
|
+
selfNav && /* @__PURE__ */ React269.createElement(PageHeader, { ...pageHeaderProps, isPrivate: isRoomPrivate, onPrivacyChange: handlePrivacyChange }),
|
|
31531
|
+
/* @__PURE__ */ React269.createElement(CoverImage, { coverImageUrl, logoUrl }),
|
|
31532
|
+
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */ React269.createElement(
|
|
30916
31533
|
ExternalDropZone,
|
|
30917
31534
|
{
|
|
30918
31535
|
editor,
|
|
@@ -30925,7 +31542,7 @@ function IxoEditorContent({
|
|
|
30925
31542
|
},
|
|
30926
31543
|
editorContent
|
|
30927
31544
|
) : editorContent
|
|
30928
|
-
), isPanelVisible && /* @__PURE__ */
|
|
31545
|
+
), isPanelVisible && /* @__PURE__ */ React269.createElement(PanelContent, { theme: config.theme }));
|
|
30929
31546
|
}
|
|
30930
31547
|
function IxoEditor({
|
|
30931
31548
|
editor,
|
|
@@ -30966,7 +31583,7 @@ function IxoEditor({
|
|
|
30966
31583
|
tableHandles: true
|
|
30967
31584
|
};
|
|
30968
31585
|
const isEditable = editable;
|
|
30969
|
-
const editorContent = /* @__PURE__ */
|
|
31586
|
+
const editorContent = /* @__PURE__ */ React269.createElement(
|
|
30970
31587
|
BlocknoteProvider,
|
|
30971
31588
|
{
|
|
30972
31589
|
editor,
|
|
@@ -30979,7 +31596,7 @@ function IxoEditor({
|
|
|
30979
31596
|
domainCardRenderer,
|
|
30980
31597
|
mapConfig
|
|
30981
31598
|
},
|
|
30982
|
-
/* @__PURE__ */
|
|
31599
|
+
/* @__PURE__ */ React269.createElement(
|
|
30983
31600
|
IxoEditorContent,
|
|
30984
31601
|
{
|
|
30985
31602
|
isPanelVisible,
|
|
@@ -31003,15 +31620,15 @@ function IxoEditor({
|
|
|
31003
31620
|
)
|
|
31004
31621
|
);
|
|
31005
31622
|
if (mantineTheme) {
|
|
31006
|
-
return /* @__PURE__ */
|
|
31623
|
+
return /* @__PURE__ */ React269.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
|
|
31007
31624
|
}
|
|
31008
31625
|
return editorContent;
|
|
31009
31626
|
}
|
|
31010
31627
|
|
|
31011
31628
|
// src/mantine/components/EntitySigningSetup.tsx
|
|
31012
|
-
import
|
|
31013
|
-
import { Modal as Modal3, Stack as
|
|
31014
|
-
import { IconAlertCircle as IconAlertCircle18, IconCheck as
|
|
31629
|
+
import React270, { useState as useState113 } from "react";
|
|
31630
|
+
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";
|
|
31631
|
+
import { IconAlertCircle as IconAlertCircle18, IconCheck as IconCheck20, IconKey as IconKey2 } from "@tabler/icons-react";
|
|
31015
31632
|
var EntitySigningSetup = ({
|
|
31016
31633
|
opened,
|
|
31017
31634
|
onClose,
|
|
@@ -31019,11 +31636,11 @@ var EntitySigningSetup = ({
|
|
|
31019
31636
|
entityName,
|
|
31020
31637
|
onSetup
|
|
31021
31638
|
}) => {
|
|
31022
|
-
const [pin, setPin] =
|
|
31023
|
-
const [confirmPin, setConfirmPin] =
|
|
31024
|
-
const [loading, setLoading] =
|
|
31025
|
-
const [error, setError] =
|
|
31026
|
-
const [success, setSuccess] =
|
|
31639
|
+
const [pin, setPin] = useState113("");
|
|
31640
|
+
const [confirmPin, setConfirmPin] = useState113("");
|
|
31641
|
+
const [loading, setLoading] = useState113(false);
|
|
31642
|
+
const [error, setError] = useState113(null);
|
|
31643
|
+
const [success, setSuccess] = useState113(false);
|
|
31027
31644
|
const handleSetup = async () => {
|
|
31028
31645
|
if (pin.length < 4) {
|
|
31029
31646
|
setError("PIN must be at least 4 characters");
|
|
@@ -31063,15 +31680,15 @@ var EntitySigningSetup = ({
|
|
|
31063
31680
|
setSuccess(false);
|
|
31064
31681
|
}
|
|
31065
31682
|
};
|
|
31066
|
-
return /* @__PURE__ */
|
|
31683
|
+
return /* @__PURE__ */ React270.createElement(
|
|
31067
31684
|
Modal3,
|
|
31068
31685
|
{
|
|
31069
31686
|
opened,
|
|
31070
31687
|
onClose: handleClose,
|
|
31071
|
-
title: /* @__PURE__ */
|
|
31688
|
+
title: /* @__PURE__ */ React270.createElement(Group97, { gap: "xs" }, /* @__PURE__ */ React270.createElement(IconKey2, { size: 20 }), /* @__PURE__ */ React270.createElement(Text149, { fw: 600 }, "Entity Signing Setup")),
|
|
31072
31689
|
size: "md"
|
|
31073
31690
|
},
|
|
31074
|
-
/* @__PURE__ */
|
|
31691
|
+
/* @__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
31692
|
TextInput9,
|
|
31076
31693
|
{
|
|
31077
31694
|
label: "Enter PIN to encrypt signing key",
|
|
@@ -31082,7 +31699,7 @@ var EntitySigningSetup = ({
|
|
|
31082
31699
|
onChange: (e) => setPin(e.currentTarget.value),
|
|
31083
31700
|
disabled: loading
|
|
31084
31701
|
}
|
|
31085
|
-
), /* @__PURE__ */
|
|
31702
|
+
), /* @__PURE__ */ React270.createElement(
|
|
31086
31703
|
TextInput9,
|
|
31087
31704
|
{
|
|
31088
31705
|
label: "Confirm PIN",
|
|
@@ -31092,12 +31709,12 @@ var EntitySigningSetup = ({
|
|
|
31092
31709
|
onChange: (e) => setConfirmPin(e.currentTarget.value),
|
|
31093
31710
|
disabled: loading
|
|
31094
31711
|
}
|
|
31095
|
-
), error && /* @__PURE__ */
|
|
31712
|
+
), 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
31713
|
Button48,
|
|
31097
31714
|
{
|
|
31098
31715
|
onClick: handleSetup,
|
|
31099
31716
|
loading,
|
|
31100
|
-
leftSection: /* @__PURE__ */
|
|
31717
|
+
leftSection: /* @__PURE__ */ React270.createElement(IconKey2, { size: 16 })
|
|
31101
31718
|
},
|
|
31102
31719
|
"Setup Entity Signing"
|
|
31103
31720
|
))))
|
|
@@ -31105,8 +31722,8 @@ var EntitySigningSetup = ({
|
|
|
31105
31722
|
};
|
|
31106
31723
|
|
|
31107
31724
|
// src/mantine/components/FlowPermissionsPanel.tsx
|
|
31108
|
-
import
|
|
31109
|
-
import { Stack as
|
|
31725
|
+
import React271, { useState as useState114, useEffect as useEffect95, useMemo as useMemo107 } from "react";
|
|
31726
|
+
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
31727
|
import { IconPlus as IconPlus10, IconTrash as IconTrash10, IconShieldCheck as IconShieldCheck14, IconUser as IconUser15, IconRobot as IconRobot4, IconBuilding as IconBuilding2 } from "@tabler/icons-react";
|
|
31111
31728
|
var FlowPermissionsPanel = ({
|
|
31112
31729
|
editor,
|
|
@@ -31116,11 +31733,11 @@ var FlowPermissionsPanel = ({
|
|
|
31116
31733
|
onRevokePermission,
|
|
31117
31734
|
getUserDisplayName
|
|
31118
31735
|
}) => {
|
|
31119
|
-
const [delegations, setDelegations] =
|
|
31120
|
-
const [loading, setLoading] =
|
|
31121
|
-
const [revoking, setRevoking] =
|
|
31122
|
-
const rootCapability =
|
|
31123
|
-
|
|
31736
|
+
const [delegations, setDelegations] = useState114([]);
|
|
31737
|
+
const [loading, setLoading] = useState114(true);
|
|
31738
|
+
const [revoking, setRevoking] = useState114(null);
|
|
31739
|
+
const rootCapability = useMemo107(() => editor.getRootCapability?.(), [editor]);
|
|
31740
|
+
useEffect95(() => {
|
|
31124
31741
|
const loadDelegations = async () => {
|
|
31125
31742
|
setLoading(true);
|
|
31126
31743
|
const allDelegations = editor.getAllDelegations?.() || [];
|
|
@@ -31159,11 +31776,11 @@ var FlowPermissionsPanel = ({
|
|
|
31159
31776
|
const getIcon2 = (type) => {
|
|
31160
31777
|
switch (type) {
|
|
31161
31778
|
case "oracle":
|
|
31162
|
-
return /* @__PURE__ */
|
|
31779
|
+
return /* @__PURE__ */ React271.createElement(IconRobot4, { size: 16 });
|
|
31163
31780
|
case "entity":
|
|
31164
|
-
return /* @__PURE__ */
|
|
31781
|
+
return /* @__PURE__ */ React271.createElement(IconBuilding2, { size: 16 });
|
|
31165
31782
|
default:
|
|
31166
|
-
return /* @__PURE__ */
|
|
31783
|
+
return /* @__PURE__ */ React271.createElement(IconUser15, { size: 16 });
|
|
31167
31784
|
}
|
|
31168
31785
|
};
|
|
31169
31786
|
const formatCapabilities = (caps) => {
|
|
@@ -31182,7 +31799,7 @@ var FlowPermissionsPanel = ({
|
|
|
31182
31799
|
if (date < /* @__PURE__ */ new Date()) return "Expired";
|
|
31183
31800
|
return date.toLocaleDateString();
|
|
31184
31801
|
};
|
|
31185
|
-
return /* @__PURE__ */
|
|
31802
|
+
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
31803
|
ActionIcon35,
|
|
31187
31804
|
{
|
|
31188
31805
|
color: "red",
|
|
@@ -31191,11 +31808,11 @@ var FlowPermissionsPanel = ({
|
|
|
31191
31808
|
loading: revoking === capability.id,
|
|
31192
31809
|
disabled: !!revoking
|
|
31193
31810
|
},
|
|
31194
|
-
/* @__PURE__ */
|
|
31195
|
-
))))), /* @__PURE__ */
|
|
31811
|
+
/* @__PURE__ */ React271.createElement(IconTrash10, { size: 16 })
|
|
31812
|
+
))))), /* @__PURE__ */ React271.createElement(
|
|
31196
31813
|
Button49,
|
|
31197
31814
|
{
|
|
31198
|
-
leftSection: /* @__PURE__ */
|
|
31815
|
+
leftSection: /* @__PURE__ */ React271.createElement(IconPlus10, { size: 16 }),
|
|
31199
31816
|
variant: "light",
|
|
31200
31817
|
onClick: onGrantPermission
|
|
31201
31818
|
},
|
|
@@ -31204,20 +31821,20 @@ var FlowPermissionsPanel = ({
|
|
|
31204
31821
|
};
|
|
31205
31822
|
|
|
31206
31823
|
// src/mantine/components/GrantPermissionModal.tsx
|
|
31207
|
-
import
|
|
31824
|
+
import React272, { useState as useState115, useCallback as useCallback89 } from "react";
|
|
31208
31825
|
import {
|
|
31209
31826
|
Modal as Modal4,
|
|
31210
|
-
Stack as
|
|
31211
|
-
Text as
|
|
31827
|
+
Stack as Stack176,
|
|
31828
|
+
Text as Text151,
|
|
31212
31829
|
TextInput as TextInput10,
|
|
31213
31830
|
Button as Button50,
|
|
31214
31831
|
Group as Group99,
|
|
31215
31832
|
Radio as Radio6,
|
|
31216
31833
|
Checkbox as Checkbox14,
|
|
31217
|
-
Alert as
|
|
31834
|
+
Alert as Alert49,
|
|
31218
31835
|
Paper as Paper19,
|
|
31219
|
-
Loader as
|
|
31220
|
-
Badge as
|
|
31836
|
+
Loader as Loader48,
|
|
31837
|
+
Badge as Badge44,
|
|
31221
31838
|
ActionIcon as ActionIcon36,
|
|
31222
31839
|
Divider as Divider29,
|
|
31223
31840
|
NumberInput as NumberInput3
|
|
@@ -31236,21 +31853,21 @@ var GrantPermissionModal = ({
|
|
|
31236
31853
|
const singleBlockMode = !!targetBlockId || blocks.length === 1;
|
|
31237
31854
|
const fixedBlockId = targetBlockId || (blocks.length === 1 ? blocks[0].id : null);
|
|
31238
31855
|
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 =
|
|
31856
|
+
const [recipientType, setRecipientType] = useState115("user");
|
|
31857
|
+
const [searchQuery, setSearchQuery] = useState115("");
|
|
31858
|
+
const [searchResults, setSearchResults] = useState115([]);
|
|
31859
|
+
const [searching, setSearching] = useState115(false);
|
|
31860
|
+
const [selectedRecipient, setSelectedRecipient] = useState115(null);
|
|
31861
|
+
const [manualDid, setManualDid] = useState115("");
|
|
31862
|
+
const [scopeType, setScopeType] = useState115("full");
|
|
31863
|
+
const [selectedBlocks, setSelectedBlocks] = useState115([]);
|
|
31864
|
+
const [expirationEnabled, setExpirationEnabled] = useState115(false);
|
|
31865
|
+
const [expirationDays, setExpirationDays] = useState115(30);
|
|
31866
|
+
const [canDelegate, setCanDelegate] = useState115(false);
|
|
31867
|
+
const [pin, setPin] = useState115("");
|
|
31868
|
+
const [loading, setLoading] = useState115(false);
|
|
31869
|
+
const [error, setError] = useState115(null);
|
|
31870
|
+
const handleSearch = useCallback89(async () => {
|
|
31254
31871
|
if (searchQuery.length < 2) return;
|
|
31255
31872
|
setSearching(true);
|
|
31256
31873
|
try {
|
|
@@ -31337,29 +31954,29 @@ var GrantPermissionModal = ({
|
|
|
31337
31954
|
resetForm();
|
|
31338
31955
|
}
|
|
31339
31956
|
};
|
|
31340
|
-
return /* @__PURE__ */
|
|
31957
|
+
return /* @__PURE__ */ React272.createElement(
|
|
31341
31958
|
Modal4,
|
|
31342
31959
|
{
|
|
31343
31960
|
opened,
|
|
31344
31961
|
onClose: handleClose,
|
|
31345
|
-
title: /* @__PURE__ */
|
|
31962
|
+
title: /* @__PURE__ */ React272.createElement(Group99, { gap: "xs" }, /* @__PURE__ */ React272.createElement(IconShieldPlus4, { size: 20 }), /* @__PURE__ */ React272.createElement(Text151, { fw: 600 }, "Grant Permission")),
|
|
31346
31963
|
size: "lg"
|
|
31347
31964
|
},
|
|
31348
|
-
/* @__PURE__ */
|
|
31965
|
+
/* @__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
31966
|
setRecipientType(v);
|
|
31350
31967
|
setSelectedRecipient(null);
|
|
31351
31968
|
setSearchResults([]);
|
|
31352
|
-
} }, /* @__PURE__ */
|
|
31969
|
+
} }, /* @__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
31970
|
TextInput10,
|
|
31354
31971
|
{
|
|
31355
31972
|
placeholder: recipientType === "oracle" ? "Search oracles..." : "Search users...",
|
|
31356
|
-
leftSection: /* @__PURE__ */
|
|
31357
|
-
rightSection: searching ? /* @__PURE__ */
|
|
31973
|
+
leftSection: /* @__PURE__ */ React272.createElement(IconSearch7, { size: 16 }),
|
|
31974
|
+
rightSection: searching ? /* @__PURE__ */ React272.createElement(Loader48, { size: 14 }) : null,
|
|
31358
31975
|
value: searchQuery,
|
|
31359
31976
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
31360
31977
|
onKeyDown: (e) => e.key === "Enter" && handleSearch()
|
|
31361
31978
|
}
|
|
31362
|
-
), selectedRecipient ? /* @__PURE__ */
|
|
31979
|
+
), 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
31980
|
Button50,
|
|
31364
31981
|
{
|
|
31365
31982
|
key: result.did,
|
|
@@ -31369,7 +31986,7 @@ var GrantPermissionModal = ({
|
|
|
31369
31986
|
onClick: () => setSelectedRecipient(result)
|
|
31370
31987
|
},
|
|
31371
31988
|
result.displayName
|
|
31372
|
-
)))) : null) : /* @__PURE__ */
|
|
31989
|
+
)))) : null) : /* @__PURE__ */ React272.createElement(
|
|
31373
31990
|
TextInput10,
|
|
31374
31991
|
{
|
|
31375
31992
|
label: "Recipient DID",
|
|
@@ -31377,12 +31994,12 @@ var GrantPermissionModal = ({
|
|
|
31377
31994
|
value: manualDid,
|
|
31378
31995
|
onChange: (e) => setManualDid(e.currentTarget.value)
|
|
31379
31996
|
}
|
|
31380
|
-
), /* @__PURE__ */
|
|
31997
|
+
), /* @__PURE__ */ React272.createElement(Divider29, null), /* @__PURE__ */ React272.createElement(Stack176, { gap: "xs" }, /* @__PURE__ */ React272.createElement(Text151, { size: "sm", fw: 500 }, "Permission Scope"), singleBlockMode && fixedBlock ? (
|
|
31381
31998
|
// Single block mode: show fixed block info
|
|
31382
|
-
/* @__PURE__ */
|
|
31999
|
+
/* @__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
32000
|
) : (
|
|
31384
32001
|
// Multi-block mode: show scope selection
|
|
31385
|
-
/* @__PURE__ */
|
|
32002
|
+
/* @__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
32003
|
Checkbox14,
|
|
31387
32004
|
{
|
|
31388
32005
|
key: block.id,
|
|
@@ -31397,14 +32014,14 @@ var GrantPermissionModal = ({
|
|
|
31397
32014
|
}
|
|
31398
32015
|
}
|
|
31399
32016
|
)))))
|
|
31400
|
-
)), /* @__PURE__ */
|
|
32017
|
+
)), /* @__PURE__ */ React272.createElement(Divider29, null), /* @__PURE__ */ React272.createElement(Stack176, { gap: "xs" }, /* @__PURE__ */ React272.createElement(
|
|
31401
32018
|
Checkbox14,
|
|
31402
32019
|
{
|
|
31403
32020
|
label: "Set expiration",
|
|
31404
32021
|
checked: expirationEnabled,
|
|
31405
32022
|
onChange: (e) => setExpirationEnabled(e.currentTarget.checked)
|
|
31406
32023
|
}
|
|
31407
|
-
), expirationEnabled && /* @__PURE__ */
|
|
32024
|
+
), expirationEnabled && /* @__PURE__ */ React272.createElement(
|
|
31408
32025
|
NumberInput3,
|
|
31409
32026
|
{
|
|
31410
32027
|
label: "Expires in (days)",
|
|
@@ -31414,7 +32031,7 @@ var GrantPermissionModal = ({
|
|
|
31414
32031
|
min: 1,
|
|
31415
32032
|
max: 365
|
|
31416
32033
|
}
|
|
31417
|
-
)), /* @__PURE__ */
|
|
32034
|
+
)), /* @__PURE__ */ React272.createElement(
|
|
31418
32035
|
Checkbox14,
|
|
31419
32036
|
{
|
|
31420
32037
|
label: "Recipient can grant permissions to others",
|
|
@@ -31422,7 +32039,7 @@ var GrantPermissionModal = ({
|
|
|
31422
32039
|
checked: canDelegate,
|
|
31423
32040
|
onChange: (e) => setCanDelegate(e.currentTarget.checked)
|
|
31424
32041
|
}
|
|
31425
|
-
), /* @__PURE__ */
|
|
32042
|
+
), /* @__PURE__ */ React272.createElement(Divider29, null), /* @__PURE__ */ React272.createElement(
|
|
31426
32043
|
TextInput10,
|
|
31427
32044
|
{
|
|
31428
32045
|
label: "Enter your PIN to sign this delegation",
|
|
@@ -31431,7 +32048,7 @@ var GrantPermissionModal = ({
|
|
|
31431
32048
|
value: pin,
|
|
31432
32049
|
onChange: (e) => setPin(e.currentTarget.value)
|
|
31433
32050
|
}
|
|
31434
|
-
), error && /* @__PURE__ */
|
|
32051
|
+
), 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
32052
|
);
|
|
31436
32053
|
};
|
|
31437
32054
|
|
|
@@ -31548,4 +32165,4 @@ export {
|
|
|
31548
32165
|
getExtraSlashMenuItems,
|
|
31549
32166
|
useCreateIxoEditor
|
|
31550
32167
|
};
|
|
31551
|
-
//# sourceMappingURL=chunk-
|
|
32168
|
+
//# sourceMappingURL=chunk-HHEGZUQF.mjs.map
|