@ixo/editor 2.22.0 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-NBT2P6S5.mjs → chunk-75HEM77J.mjs} +1981 -447
- package/dist/chunk-75HEM77J.mjs.map +1 -0
- package/dist/{graphql-client-CQA7MoaR.d.ts → graphql-client-Coy2wjmn.d.ts} +108 -0
- 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-NBT2P6S5.mjs.map +0 -1
|
@@ -1160,6 +1160,44 @@ var CONDITIONABLE_PROPERTIES = {
|
|
|
1160
1160
|
type: "string",
|
|
1161
1161
|
description: "Error message if sending failed"
|
|
1162
1162
|
}
|
|
1163
|
+
],
|
|
1164
|
+
governanceGroup: [
|
|
1165
|
+
{
|
|
1166
|
+
name: "coreAddress",
|
|
1167
|
+
displayName: "Core Address",
|
|
1168
|
+
type: "string",
|
|
1169
|
+
description: "The DAO core contract address"
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
name: "groupAddress",
|
|
1173
|
+
displayName: "Group Address",
|
|
1174
|
+
type: "string",
|
|
1175
|
+
description: "The voting group contract address"
|
|
1176
|
+
},
|
|
1177
|
+
{
|
|
1178
|
+
name: "groupType",
|
|
1179
|
+
displayName: "Group Type",
|
|
1180
|
+
type: "select",
|
|
1181
|
+
selectOptions: [
|
|
1182
|
+
{ value: "categorical", label: "Categorical" },
|
|
1183
|
+
{ value: "multisig", label: "Multisig" },
|
|
1184
|
+
{ value: "nftStaking", label: "NFT Staking" },
|
|
1185
|
+
{ value: "tokenStaking", label: "Token Staking" }
|
|
1186
|
+
],
|
|
1187
|
+
description: "Type of governance group"
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
name: "title",
|
|
1191
|
+
displayName: "Title",
|
|
1192
|
+
type: "string",
|
|
1193
|
+
description: "Title of the governance group block"
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
name: "description",
|
|
1197
|
+
displayName: "Description",
|
|
1198
|
+
type: "string",
|
|
1199
|
+
description: "Description of the governance group block"
|
|
1200
|
+
}
|
|
1163
1201
|
]
|
|
1164
1202
|
};
|
|
1165
1203
|
function getConditionableProperties(blockType, block) {
|
|
@@ -1977,7 +2015,8 @@ import {
|
|
|
1977
2015
|
IconBell,
|
|
1978
2016
|
IconMail,
|
|
1979
2017
|
IconFeather,
|
|
1980
|
-
IconDotsCircleHorizontal
|
|
2018
|
+
IconDotsCircleHorizontal,
|
|
2019
|
+
IconUsers as IconUsers2
|
|
1981
2020
|
} from "@tabler/icons-react";
|
|
1982
2021
|
var ICON_MAP = {
|
|
1983
2022
|
"square-check": IconSquareCheck,
|
|
@@ -1991,7 +2030,8 @@ var ICON_MAP = {
|
|
|
1991
2030
|
"dollar-sign": IconUserDollar,
|
|
1992
2031
|
mail: IconMail,
|
|
1993
2032
|
feather: IconFeather,
|
|
1994
|
-
"dots-circle": IconDotsCircleHorizontal
|
|
2033
|
+
"dots-circle": IconDotsCircleHorizontal,
|
|
2034
|
+
users: IconUsers2
|
|
1995
2035
|
};
|
|
1996
2036
|
var getIcon = (fallback = "square-check", key, color = "white", size = 26, stroke = 1.5) => {
|
|
1997
2037
|
const validKey = key in ICON_MAP ? key : fallback;
|
|
@@ -18099,9 +18139,27 @@ import { Alert as Alert26, Button as Button33, Group as Group62, Loader as Loade
|
|
|
18099
18139
|
import { IconAlertCircle as IconAlertCircle12, IconCheck as IconCheck8 } from "@tabler/icons-react";
|
|
18100
18140
|
import React196, { useCallback as useCallback51, useState as useState68 } from "react";
|
|
18101
18141
|
|
|
18142
|
+
// src/mantine/blocks/domainCreatorSign/utils/buildLinkedEntityResource.ts
|
|
18143
|
+
function parseLinkedEntities(entitiesString) {
|
|
18144
|
+
if (!entitiesString || entitiesString === "[]") return [];
|
|
18145
|
+
try {
|
|
18146
|
+
return JSON.parse(entitiesString);
|
|
18147
|
+
} catch {
|
|
18148
|
+
return [];
|
|
18149
|
+
}
|
|
18150
|
+
}
|
|
18151
|
+
function buildGovernanceGroupLinkedEntities(linkedEntities) {
|
|
18152
|
+
return linkedEntities.filter((entity) => entity.type === "governanceGroup" && entity.coreAddress).map((entity) => ({
|
|
18153
|
+
id: entity.coreAddress,
|
|
18154
|
+
type: "group",
|
|
18155
|
+
relationship: "governs",
|
|
18156
|
+
service: ""
|
|
18157
|
+
}));
|
|
18158
|
+
}
|
|
18159
|
+
|
|
18102
18160
|
// src/mantine/components/Base/BaseSigning.tsx
|
|
18103
18161
|
import { Badge as Badge31, Box as Box38, Flex as Flex29, Group as Group61, Slider, Stack as Stack127, Tabs as Tabs4, Text as Text103, Tooltip as Tooltip20 } from "@mantine/core";
|
|
18104
|
-
import { IconClock as IconClock2, IconFeather as IconFeather2, IconUsers as
|
|
18162
|
+
import { IconClock as IconClock2, IconFeather as IconFeather2, IconUsers as IconUsers3, IconArrowsExchange, IconCalendar as IconCalendar2, IconLeaf, IconBolt } from "@tabler/icons-react";
|
|
18105
18163
|
import React195, { useState as useState67 } from "react";
|
|
18106
18164
|
function BaseSigning({ handleSign }) {
|
|
18107
18165
|
const [value, setValue] = useState67(23);
|
|
@@ -18173,7 +18231,7 @@ function BaseSigning({ handleSign }) {
|
|
|
18173
18231
|
}
|
|
18174
18232
|
}
|
|
18175
18233
|
},
|
|
18176
|
-
/* @__PURE__ */ React195.createElement(Tabs4.List, null, /* @__PURE__ */ React195.createElement(Tooltip20, { label: "Agents" }, /* @__PURE__ */ React195.createElement(Tabs4.Tab, { value: "agents", leftSection: /* @__PURE__ */ React195.createElement(
|
|
18234
|
+
/* @__PURE__ */ React195.createElement(Tabs4.List, null, /* @__PURE__ */ React195.createElement(Tooltip20, { label: "Agents" }, /* @__PURE__ */ React195.createElement(Tabs4.Tab, { value: "agents", leftSection: /* @__PURE__ */ React195.createElement(IconUsers3, { size: 18, color: "white" }) })), /* @__PURE__ */ React195.createElement(Tooltip20, { label: "Transactions" }, /* @__PURE__ */ React195.createElement(Tabs4.Tab, { value: "transactions", leftSection: /* @__PURE__ */ React195.createElement(IconArrowsExchange, { size: 18, color: "white" }) })), /* @__PURE__ */ React195.createElement(Tooltip20, { label: "Date" }, /* @__PURE__ */ React195.createElement(Tabs4.Tab, { value: "date", leftSection: /* @__PURE__ */ React195.createElement(IconCalendar2, { size: 18, color: "white" }) })), /* @__PURE__ */ React195.createElement(Tooltip20, { label: "Charge" }, /* @__PURE__ */ React195.createElement(Tabs4.Tab, { value: "charge", leftSection: /* @__PURE__ */ React195.createElement(IconBolt, { size: 18, color: "white" }) })), /* @__PURE__ */ React195.createElement(Tooltip20, { label: "Impact" }, /* @__PURE__ */ React195.createElement(Tabs4.Tab, { value: "impact", leftSection: /* @__PURE__ */ React195.createElement(IconLeaf, { size: 18, color: "white" }) }))),
|
|
18177
18235
|
/* @__PURE__ */ React195.createElement(Tabs4.Panel, { value: "agents" }, /* @__PURE__ */ React195.createElement(Text103, { c: "white", size: "sm" }, "Agents content")),
|
|
18178
18236
|
/* @__PURE__ */ React195.createElement(Tabs4.Panel, { value: "transactions" }, /* @__PURE__ */ React195.createElement(Text103, { c: "white", size: "sm" }, "Transactions content")),
|
|
18179
18237
|
/* @__PURE__ */ React195.createElement(Tabs4.Panel, { value: "date" }, /* @__PURE__ */ React195.createElement(Text103, { c: "white", size: "sm" }, "Date content")),
|
|
@@ -18305,12 +18363,15 @@ var SignPanel = ({ editor, block, onComplete, onError }) => {
|
|
|
18305
18363
|
serviceEndpoint: uploadResult.url,
|
|
18306
18364
|
description: `Domain Card for ${domainCardData2.credentialSubject?.name || "Domain"}`
|
|
18307
18365
|
});
|
|
18366
|
+
const linkedEntitiesData = parseLinkedEntities(block.props.linkedEntities || "[]");
|
|
18367
|
+
const governanceGroupLinkedEntities = buildGovernanceGroupLinkedEntities(linkedEntitiesData);
|
|
18308
18368
|
setFlowStep("creating");
|
|
18309
18369
|
editor.updateBlock(block, { props: { ...block.props, status: "creating" } });
|
|
18310
18370
|
const endDate = domainCardData2.endDate || validUntil;
|
|
18311
18371
|
const { entityDid: newEntityDid, transactionHash } = await handlers.createDomain({
|
|
18312
18372
|
entityType,
|
|
18313
18373
|
linkedResource: [domainCardLinkedResource],
|
|
18374
|
+
linkedEntity: governanceGroupLinkedEntities.length > 0 ? governanceGroupLinkedEntities : void 0,
|
|
18314
18375
|
startDate: validFrom,
|
|
18315
18376
|
endDate
|
|
18316
18377
|
});
|
|
@@ -18508,6 +18569,8 @@ var DomainCreatorSignBlockSpec = createReactBlockSpec17(
|
|
|
18508
18569
|
transactionHash: { default: "" },
|
|
18509
18570
|
// Error message if failed
|
|
18510
18571
|
errorMessage: { default: "" },
|
|
18572
|
+
// JSON array of LinkedEntityData from governance groups and other sources
|
|
18573
|
+
linkedEntities: { default: "[]" },
|
|
18511
18574
|
assignment: {
|
|
18512
18575
|
default: JSON.stringify({
|
|
18513
18576
|
assignedActor: { did: "", avatar: "", displayName: "" },
|
|
@@ -19120,219 +19183,1662 @@ var DomainCardViewerBlockSpec = createReactBlockSpec18(
|
|
|
19120
19183
|
}
|
|
19121
19184
|
);
|
|
19122
19185
|
|
|
19123
|
-
// src/mantine/blocks/
|
|
19124
|
-
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19128
|
-
|
|
19129
|
-
|
|
19130
|
-
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19134
|
-
|
|
19135
|
-
|
|
19136
|
-
|
|
19137
|
-
|
|
19138
|
-
|
|
19139
|
-
|
|
19140
|
-
|
|
19141
|
-
|
|
19142
|
-
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
};
|
|
19150
|
-
var blockRegistry = new BlockRegistry();
|
|
19151
|
-
blockRegistry.register({
|
|
19152
|
-
type: "proposal",
|
|
19153
|
-
propSchema: {
|
|
19154
|
-
title: "",
|
|
19155
|
-
description: "",
|
|
19156
|
-
icon: "\u{1F4DD}",
|
|
19157
|
-
proposalId: "",
|
|
19158
|
-
status: "draft",
|
|
19159
|
-
contractAddress: "",
|
|
19160
|
-
coreAddress: "",
|
|
19161
|
-
createdProposalId: ""
|
|
19162
|
-
},
|
|
19163
|
-
validDependencies: [],
|
|
19164
|
-
defaultProps: {
|
|
19165
|
-
icon: "\u{1F4DD}",
|
|
19166
|
-
status: "draft"
|
|
19167
|
-
}
|
|
19168
|
-
});
|
|
19169
|
-
blockRegistry.register({
|
|
19170
|
-
type: "proposalVote",
|
|
19171
|
-
propSchema: {
|
|
19172
|
-
title: "",
|
|
19173
|
-
subtitle: "",
|
|
19174
|
-
icon: "\u{1F5F3}\uFE0F",
|
|
19175
|
-
status: "open",
|
|
19176
|
-
daysLeft: 0,
|
|
19177
|
-
proposalId: "",
|
|
19178
|
-
proposalBlockId: "",
|
|
19179
|
-
proposalContractAddress: ""
|
|
19180
|
-
},
|
|
19181
|
-
validDependencies: ["proposal"],
|
|
19182
|
-
defaultProps: {
|
|
19183
|
-
icon: "\u{1F5F3}\uFE0F",
|
|
19184
|
-
status: "open",
|
|
19185
|
-
daysLeft: 0,
|
|
19186
|
-
proposalBlockId: ""
|
|
19187
|
-
}
|
|
19188
|
-
});
|
|
19189
|
-
blockRegistry.register({
|
|
19190
|
-
type: "list",
|
|
19191
|
-
propSchema: {
|
|
19192
|
-
title: "",
|
|
19193
|
-
did: "",
|
|
19194
|
-
fragmentIdentifier: ""
|
|
19195
|
-
},
|
|
19196
|
-
validDependencies: [],
|
|
19197
|
-
defaultProps: {}
|
|
19198
|
-
});
|
|
19199
|
-
blockRegistry.register({
|
|
19200
|
-
type: "overview",
|
|
19201
|
-
propSchema: {
|
|
19202
|
-
did: ""
|
|
19203
|
-
},
|
|
19204
|
-
validDependencies: [],
|
|
19205
|
-
defaultProps: {}
|
|
19206
|
-
});
|
|
19207
|
-
blockRegistry.register({
|
|
19208
|
-
type: "enumChecklist",
|
|
19209
|
-
propSchema: {
|
|
19210
|
-
listType: "",
|
|
19211
|
-
listConfig: "{}"
|
|
19212
|
-
},
|
|
19213
|
-
validDependencies: [],
|
|
19214
|
-
defaultProps: {}
|
|
19215
|
-
});
|
|
19216
|
-
blockRegistry.register({
|
|
19217
|
-
type: "notify",
|
|
19218
|
-
propSchema: {
|
|
19219
|
-
title: "",
|
|
19220
|
-
description: "",
|
|
19221
|
-
icon: "bell",
|
|
19222
|
-
channel: "email",
|
|
19223
|
-
to: "[]",
|
|
19224
|
-
cc: "[]",
|
|
19225
|
-
bcc: "[]",
|
|
19226
|
-
subject: "",
|
|
19227
|
-
body: "",
|
|
19228
|
-
bodyType: "text",
|
|
19229
|
-
from: "",
|
|
19230
|
-
replyTo: "",
|
|
19231
|
-
templateId: "",
|
|
19232
|
-
templateVariables: "{}",
|
|
19233
|
-
status: "idle",
|
|
19234
|
-
messageId: "",
|
|
19235
|
-
sentAt: "",
|
|
19236
|
-
errorMessage: "",
|
|
19237
|
-
conditions: ""
|
|
19238
|
-
},
|
|
19239
|
-
validDependencies: [],
|
|
19240
|
-
defaultProps: {
|
|
19241
|
-
icon: "bell",
|
|
19242
|
-
channel: "email",
|
|
19243
|
-
bodyType: "text",
|
|
19244
|
-
status: "idle"
|
|
19245
|
-
}
|
|
19246
|
-
});
|
|
19247
|
-
blockRegistry.register({
|
|
19248
|
-
type: "bid",
|
|
19249
|
-
propSchema: {
|
|
19250
|
-
title: "",
|
|
19251
|
-
description: "",
|
|
19252
|
-
did: "",
|
|
19253
|
-
selectedCollections: "[]",
|
|
19254
|
-
adminAddress: ""
|
|
19186
|
+
// src/mantine/blocks/governanceGroup/GovernanceGroupBlockSpec.tsx
|
|
19187
|
+
import React214 from "react";
|
|
19188
|
+
import { createReactBlockSpec as createReactBlockSpec19 } from "@blocknote/react";
|
|
19189
|
+
|
|
19190
|
+
// src/mantine/blocks/governanceGroup/GovernanceGroupBlock.tsx
|
|
19191
|
+
import React213 from "react";
|
|
19192
|
+
|
|
19193
|
+
// src/mantine/blocks/governanceGroup/template/TemplateView.tsx
|
|
19194
|
+
import React210, { useMemo as useMemo67 } from "react";
|
|
19195
|
+
import { Badge as Badge36, Group as Group67, Stack as Stack135, Text as Text111 } from "@mantine/core";
|
|
19196
|
+
|
|
19197
|
+
// src/mantine/blocks/governanceGroup/template/TemplateConfig.tsx
|
|
19198
|
+
import React209, { useCallback as useCallback56 } from "react";
|
|
19199
|
+
|
|
19200
|
+
// src/mantine/blocks/governanceGroup/template/GeneralTab.tsx
|
|
19201
|
+
import React207, { useEffect as useEffect52, useState as useState70 } from "react";
|
|
19202
|
+
import { Card as Card17, SimpleGrid as SimpleGrid2, Stack as Stack133, Text as Text109, ThemeIcon as ThemeIcon2 } from "@mantine/core";
|
|
19203
|
+
import { IconUsers as IconUsers4, IconSignature, IconPhoto as IconPhoto2, IconCoin } from "@tabler/icons-react";
|
|
19204
|
+
|
|
19205
|
+
// src/mantine/blocks/governanceGroup/types.ts
|
|
19206
|
+
var GROUP_TYPE_CONFIGS = [
|
|
19207
|
+
{
|
|
19208
|
+
type: "categorical",
|
|
19209
|
+
title: "Categorical Group",
|
|
19210
|
+
description: "Weight-based voting where members have assigned voting power",
|
|
19211
|
+
icon: "users"
|
|
19255
19212
|
},
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
propSchema: {
|
|
19262
|
-
title: "",
|
|
19263
|
-
description: "",
|
|
19264
|
-
icon: "square-check",
|
|
19265
|
-
deedDid: "",
|
|
19266
|
-
selectedCollections: "[]",
|
|
19267
|
-
adminAddress: ""
|
|
19213
|
+
{
|
|
19214
|
+
type: "multisig",
|
|
19215
|
+
title: "Multisig Group",
|
|
19216
|
+
description: "Requires multiple signatures for proposals to pass",
|
|
19217
|
+
icon: "signature"
|
|
19268
19218
|
},
|
|
19269
|
-
|
|
19270
|
-
|
|
19271
|
-
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
blockRegistry.register({
|
|
19275
|
-
type: "domainCreator",
|
|
19276
|
-
propSchema: {
|
|
19277
|
-
title: "",
|
|
19278
|
-
description: "",
|
|
19279
|
-
icon: "file-text",
|
|
19280
|
-
surveySchema: "",
|
|
19281
|
-
answers: "",
|
|
19282
|
-
lastSubmission: ""
|
|
19219
|
+
{
|
|
19220
|
+
type: "nftStaking",
|
|
19221
|
+
title: "NFT Staking Group",
|
|
19222
|
+
description: "Voting power based on staked NFTs",
|
|
19223
|
+
icon: "photo"
|
|
19283
19224
|
},
|
|
19284
|
-
|
|
19285
|
-
|
|
19286
|
-
|
|
19287
|
-
|
|
19288
|
-
|
|
19289
|
-
lastSubmission: ""
|
|
19225
|
+
{
|
|
19226
|
+
type: "tokenStaking",
|
|
19227
|
+
title: "Token Staking Group",
|
|
19228
|
+
description: "Voting power based on staked tokens",
|
|
19229
|
+
icon: "coin"
|
|
19290
19230
|
}
|
|
19291
|
-
|
|
19292
|
-
|
|
19293
|
-
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
19294
|
-
import { useMemo as useMemo66, useEffect as useEffect52, useState as useState70, useCallback as useCallback55 } from "react";
|
|
19295
|
-
|
|
19296
|
-
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
19297
|
-
import { useMemo as useMemo67 } from "react";
|
|
19231
|
+
];
|
|
19298
19232
|
|
|
19299
|
-
// src/mantine/blocks/
|
|
19300
|
-
var
|
|
19301
|
-
|
|
19302
|
-
|
|
19303
|
-
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
|
|
19310
|
-
|
|
19311
|
-
|
|
19312
|
-
|
|
19313
|
-
|
|
19314
|
-
|
|
19315
|
-
|
|
19316
|
-
|
|
19317
|
-
|
|
19318
|
-
|
|
19319
|
-
|
|
19320
|
-
|
|
19321
|
-
|
|
19233
|
+
// src/mantine/blocks/governanceGroup/template/GeneralTab.tsx
|
|
19234
|
+
var GROUP_TYPE_ICONS = {
|
|
19235
|
+
categorical: /* @__PURE__ */ React207.createElement(IconUsers4, { size: 20 }),
|
|
19236
|
+
multisig: /* @__PURE__ */ React207.createElement(IconSignature, { size: 20 }),
|
|
19237
|
+
nftStaking: /* @__PURE__ */ React207.createElement(IconPhoto2, { size: 20 }),
|
|
19238
|
+
tokenStaking: /* @__PURE__ */ React207.createElement(IconCoin, { size: 20 })
|
|
19239
|
+
};
|
|
19240
|
+
var GeneralTab15 = ({ title, description, icon, groupType, onTitleChange, onDescriptionChange, onIconChange, onGroupTypeChange }) => {
|
|
19241
|
+
const [localTitle, setLocalTitle] = useState70(title || "");
|
|
19242
|
+
const [localDescription, setLocalDescription] = useState70(description || "");
|
|
19243
|
+
const [localIcon, setLocalIcon] = useState70(icon || "users");
|
|
19244
|
+
useEffect52(() => setLocalTitle(title || ""), [title]);
|
|
19245
|
+
useEffect52(() => setLocalDescription(description || ""), [description]);
|
|
19246
|
+
useEffect52(() => setLocalIcon(icon || "users"), [icon]);
|
|
19247
|
+
return /* @__PURE__ */ React207.createElement(BaseSection, null, /* @__PURE__ */ React207.createElement(Stack133, { gap: "md" }, /* @__PURE__ */ React207.createElement(Text109, { size: "sm", fw: 500 }, "Group Type"), /* @__PURE__ */ React207.createElement(SimpleGrid2, { cols: 2, spacing: "sm" }, GROUP_TYPE_CONFIGS.map((config) => {
|
|
19248
|
+
const isSelected = groupType === config.type;
|
|
19249
|
+
return /* @__PURE__ */ React207.createElement(
|
|
19250
|
+
Card17,
|
|
19251
|
+
{
|
|
19252
|
+
key: config.type,
|
|
19253
|
+
shadow: "sm",
|
|
19254
|
+
padding: "md",
|
|
19255
|
+
radius: "md",
|
|
19256
|
+
withBorder: true,
|
|
19257
|
+
style: {
|
|
19258
|
+
cursor: "pointer",
|
|
19259
|
+
borderColor: isSelected ? "var(--mantine-color-blue-6)" : void 0,
|
|
19260
|
+
backgroundColor: isSelected ? "var(--mantine-color-blue-0)" : void 0
|
|
19261
|
+
},
|
|
19262
|
+
onClick: () => onGroupTypeChange(config.type)
|
|
19263
|
+
},
|
|
19264
|
+
/* @__PURE__ */ React207.createElement(Stack133, { align: "center", gap: "xs" }, /* @__PURE__ */ React207.createElement(ThemeIcon2, { size: "lg", radius: "md", variant: isSelected ? "filled" : "light", color: "blue" }, GROUP_TYPE_ICONS[config.type]), /* @__PURE__ */ React207.createElement(Text109, { fw: 500, size: "xs", ta: "center" }, config.title), /* @__PURE__ */ React207.createElement(Text109, { size: "xs", c: "dimmed", ta: "center", lineClamp: 2 }, config.description))
|
|
19265
|
+
);
|
|
19266
|
+
}))), /* @__PURE__ */ React207.createElement(
|
|
19267
|
+
BaseTextInput,
|
|
19322
19268
|
{
|
|
19323
|
-
|
|
19324
|
-
|
|
19325
|
-
|
|
19326
|
-
|
|
19327
|
-
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19335
|
-
|
|
19269
|
+
label: "Title",
|
|
19270
|
+
placeholder: "e.g. Create Governance Group",
|
|
19271
|
+
value: localTitle,
|
|
19272
|
+
onChange: (event) => {
|
|
19273
|
+
const newValue = event.currentTarget.value;
|
|
19274
|
+
setLocalTitle(newValue);
|
|
19275
|
+
onTitleChange(newValue);
|
|
19276
|
+
}
|
|
19277
|
+
}
|
|
19278
|
+
), /* @__PURE__ */ React207.createElement(
|
|
19279
|
+
BaseTextArea,
|
|
19280
|
+
{
|
|
19281
|
+
label: "Description",
|
|
19282
|
+
placeholder: "Short summary for the governance group creation flow",
|
|
19283
|
+
minRows: 3,
|
|
19284
|
+
value: localDescription,
|
|
19285
|
+
onChange: (event) => {
|
|
19286
|
+
const newValue = event.currentTarget.value;
|
|
19287
|
+
setLocalDescription(newValue);
|
|
19288
|
+
onDescriptionChange(newValue);
|
|
19289
|
+
}
|
|
19290
|
+
}
|
|
19291
|
+
), /* @__PURE__ */ React207.createElement(
|
|
19292
|
+
BaseTextInput,
|
|
19293
|
+
{
|
|
19294
|
+
label: "Icon",
|
|
19295
|
+
description: "Use a supported icon key (e.g. users, signature, coin)",
|
|
19296
|
+
placeholder: "users",
|
|
19297
|
+
value: localIcon,
|
|
19298
|
+
onChange: (event) => {
|
|
19299
|
+
const newValue = event.currentTarget.value;
|
|
19300
|
+
setLocalIcon(newValue);
|
|
19301
|
+
onIconChange(newValue);
|
|
19302
|
+
}
|
|
19303
|
+
}
|
|
19304
|
+
));
|
|
19305
|
+
};
|
|
19306
|
+
|
|
19307
|
+
// src/mantine/blocks/governanceGroup/template/AfterCreateTab.tsx
|
|
19308
|
+
import React208, { useCallback as useCallback55, useMemo as useMemo66 } from "react";
|
|
19309
|
+
import { Stack as Stack134, Text as Text110, Alert as Alert28, Card as Card18, Group as Group66, ActionIcon as ActionIcon30, Badge as Badge35, Switch as Switch6, Select as Select5 } from "@mantine/core";
|
|
19310
|
+
import { IconPlus as IconPlus5, IconTrash as IconTrash6, IconLink } from "@tabler/icons-react";
|
|
19311
|
+
function parseAfterCreateConfig(configString) {
|
|
19312
|
+
if (!configString) {
|
|
19313
|
+
return { enabled: false, actions: [] };
|
|
19314
|
+
}
|
|
19315
|
+
try {
|
|
19316
|
+
return JSON.parse(configString);
|
|
19317
|
+
} catch {
|
|
19318
|
+
return { enabled: false, actions: [] };
|
|
19319
|
+
}
|
|
19320
|
+
}
|
|
19321
|
+
function stringifyAfterCreateConfig(config) {
|
|
19322
|
+
return JSON.stringify(config);
|
|
19323
|
+
}
|
|
19324
|
+
function generateActionId() {
|
|
19325
|
+
return `action_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
19326
|
+
}
|
|
19327
|
+
var AfterCreateTab = ({ editor, block, afterCreate, onAfterCreateChange }) => {
|
|
19328
|
+
const config = useMemo66(() => parseAfterCreateConfig(afterCreate), [afterCreate]);
|
|
19329
|
+
const availableTargetBlocks = useMemo66(() => {
|
|
19330
|
+
if (!editor?.document) return [];
|
|
19331
|
+
return editor.document.filter((docBlock) => docBlock.type === "domainCreatorSign" && docBlock.id !== block.id).map((docBlock) => ({
|
|
19332
|
+
id: docBlock.id,
|
|
19333
|
+
type: docBlock.type,
|
|
19334
|
+
title: docBlock.props?.title || "Sign to Create"
|
|
19335
|
+
}));
|
|
19336
|
+
}, [editor?.document, block.id]);
|
|
19337
|
+
const updateConfig = useCallback55(
|
|
19338
|
+
(newConfig) => {
|
|
19339
|
+
onAfterCreateChange(stringifyAfterCreateConfig(newConfig));
|
|
19340
|
+
},
|
|
19341
|
+
[onAfterCreateChange]
|
|
19342
|
+
);
|
|
19343
|
+
const handleAddAction = useCallback55(() => {
|
|
19344
|
+
const firstAvailableBlock = availableTargetBlocks[0];
|
|
19345
|
+
if (!firstAvailableBlock) return;
|
|
19346
|
+
const newAction = {
|
|
19347
|
+
id: generateActionId(),
|
|
19348
|
+
type: "addLinkedEntity",
|
|
19349
|
+
targetBlockId: firstAvailableBlock.id,
|
|
19350
|
+
targetBlockType: firstAvailableBlock.type,
|
|
19351
|
+
enabled: true
|
|
19352
|
+
};
|
|
19353
|
+
updateConfig({
|
|
19354
|
+
enabled: true,
|
|
19355
|
+
actions: [...config.actions, newAction]
|
|
19356
|
+
});
|
|
19357
|
+
}, [availableTargetBlocks, config, updateConfig]);
|
|
19358
|
+
const handleRemoveAction = useCallback55(
|
|
19359
|
+
(actionId) => {
|
|
19360
|
+
const newActions = config.actions.filter((a) => a.id !== actionId);
|
|
19361
|
+
updateConfig({
|
|
19362
|
+
...config,
|
|
19363
|
+
enabled: newActions.length > 0,
|
|
19364
|
+
actions: newActions
|
|
19365
|
+
});
|
|
19366
|
+
},
|
|
19367
|
+
[config, updateConfig]
|
|
19368
|
+
);
|
|
19369
|
+
const handleUpdateAction = useCallback55(
|
|
19370
|
+
(actionId, updates) => {
|
|
19371
|
+
const newActions = config.actions.map((a) => a.id === actionId ? { ...a, ...updates } : a);
|
|
19372
|
+
updateConfig({ ...config, actions: newActions });
|
|
19373
|
+
},
|
|
19374
|
+
[config, updateConfig]
|
|
19375
|
+
);
|
|
19376
|
+
const handleTargetBlockChange = useCallback55(
|
|
19377
|
+
(actionId, targetBlockId) => {
|
|
19378
|
+
const targetBlock = availableTargetBlocks.find((b) => b.id === targetBlockId);
|
|
19379
|
+
if (!targetBlock) return;
|
|
19380
|
+
handleUpdateAction(actionId, {
|
|
19381
|
+
targetBlockId,
|
|
19382
|
+
targetBlockType: targetBlock.type
|
|
19383
|
+
});
|
|
19384
|
+
},
|
|
19385
|
+
[availableTargetBlocks, handleUpdateAction]
|
|
19386
|
+
);
|
|
19387
|
+
if (availableTargetBlocks.length === 0) {
|
|
19388
|
+
return /* @__PURE__ */ React208.createElement(BaseSection, null, /* @__PURE__ */ React208.createElement(Stack134, { gap: "md" }, /* @__PURE__ */ React208.createElement(Text110, { size: "sm", c: "dimmed" }, "Configure actions to execute after the governance group is successfully created."), /* @__PURE__ */ React208.createElement(Alert28, { color: "blue", title: "No target blocks available" }, `Add a "Sign to Create" block to the document to configure after-create actions. The governance group's core address can be added as a linked entity to the domain.`)));
|
|
19389
|
+
}
|
|
19390
|
+
return /* @__PURE__ */ React208.createElement(BaseSection, null, /* @__PURE__ */ React208.createElement(Stack134, { gap: "md" }, /* @__PURE__ */ React208.createElement(Text110, { size: "sm", c: "dimmed" }, "Configure actions to execute after the governance group is successfully created. The group's core address will be added as a linked entity to the target domain."), /* @__PURE__ */ React208.createElement(Stack134, { gap: "sm" }, config.actions.map((action) => {
|
|
19391
|
+
const targetBlock = availableTargetBlocks.find((b) => b.id === action.targetBlockId);
|
|
19392
|
+
const isTargetMissing = !targetBlock;
|
|
19393
|
+
return /* @__PURE__ */ React208.createElement(Card18, { key: action.id, withBorder: true, padding: "sm", radius: "md" }, /* @__PURE__ */ React208.createElement(Stack134, { gap: "xs" }, /* @__PURE__ */ React208.createElement(Group66, { justify: "space-between", align: "center" }, /* @__PURE__ */ React208.createElement(Group66, { gap: "xs" }, /* @__PURE__ */ React208.createElement(IconLink, { size: 16 }), /* @__PURE__ */ React208.createElement(Text110, { size: "sm", fw: 500 }, "Add as Linked Entity"), /* @__PURE__ */ React208.createElement(Badge35, { size: "xs", variant: "light", color: "blue" }, "Governance Group")), /* @__PURE__ */ React208.createElement(Group66, { gap: "xs" }, /* @__PURE__ */ React208.createElement(Switch6, { size: "xs", checked: action.enabled, onChange: (e) => handleUpdateAction(action.id, { enabled: e.currentTarget.checked }) }), /* @__PURE__ */ React208.createElement(ActionIcon30, { variant: "subtle", color: "red", size: "sm", onClick: () => handleRemoveAction(action.id) }, /* @__PURE__ */ React208.createElement(IconTrash6, { size: 14 })))), isTargetMissing && /* @__PURE__ */ React208.createElement(Alert28, { color: "orange", variant: "light", title: "Target block not found", p: "xs" }, /* @__PURE__ */ React208.createElement(Text110, { size: "xs" }, "The configured target block no longer exists. Please select a new target.")), /* @__PURE__ */ React208.createElement(
|
|
19394
|
+
Select5,
|
|
19395
|
+
{
|
|
19396
|
+
label: "Target Block",
|
|
19397
|
+
description: "Select the Sign to Create block to receive the linked entity",
|
|
19398
|
+
placeholder: "Select target block",
|
|
19399
|
+
value: action.targetBlockId,
|
|
19400
|
+
onChange: (value) => value && handleTargetBlockChange(action.id, value),
|
|
19401
|
+
data: availableTargetBlocks.map((b) => ({
|
|
19402
|
+
value: b.id,
|
|
19403
|
+
label: b.title || `Sign to Create (${b.id.slice(0, 8)}...)`
|
|
19404
|
+
})),
|
|
19405
|
+
size: "xs"
|
|
19406
|
+
}
|
|
19407
|
+
), targetBlock && /* @__PURE__ */ React208.createElement(Text110, { size: "xs", c: "dimmed" }, 'After creation, the governance group address will be linked to "', targetBlock.title, '"')));
|
|
19408
|
+
})), /* @__PURE__ */ React208.createElement(BaseButton, { onClick: handleAddAction, leftSection: /* @__PURE__ */ React208.createElement(IconPlus5, { size: 16 }), variant: "light", fullWidth: true }, "Add After-Create Action")));
|
|
19409
|
+
};
|
|
19410
|
+
|
|
19411
|
+
// src/mantine/blocks/governanceGroup/flow/surveys/categoricalGroupSurvey.ts
|
|
19412
|
+
var categoricalGroupSurvey = {
|
|
19413
|
+
title: "Create Member-Based Group",
|
|
19414
|
+
logoPosition: "right",
|
|
19415
|
+
pages: [
|
|
19416
|
+
{
|
|
19417
|
+
name: "page1",
|
|
19418
|
+
elements: [
|
|
19419
|
+
{
|
|
19420
|
+
type: "text",
|
|
19421
|
+
name: "groupType",
|
|
19422
|
+
title: "Group Type",
|
|
19423
|
+
defaultValue: "member-based",
|
|
19424
|
+
hideNumber: true,
|
|
19425
|
+
visible: false
|
|
19426
|
+
},
|
|
19427
|
+
{
|
|
19428
|
+
type: "text",
|
|
19429
|
+
name: "groupName",
|
|
19430
|
+
title: "Group Name",
|
|
19431
|
+
hideNumber: true,
|
|
19432
|
+
isRequired: true
|
|
19433
|
+
},
|
|
19434
|
+
{
|
|
19435
|
+
type: "text",
|
|
19436
|
+
name: "description",
|
|
19437
|
+
title: "Description",
|
|
19438
|
+
hideNumber: true
|
|
19439
|
+
},
|
|
19440
|
+
{
|
|
19441
|
+
type: "boolean",
|
|
19442
|
+
name: "voteSwitching",
|
|
19443
|
+
title: "Allow vote switching",
|
|
19444
|
+
titleLocation: "left",
|
|
19445
|
+
description: "Members will be allowed to change their vote before the voting deadline has expired. This will result in all proposals having to complete the full voting duration, even if consensus is reached early.",
|
|
19446
|
+
hideNumber: true
|
|
19447
|
+
},
|
|
19448
|
+
{
|
|
19449
|
+
type: "boolean",
|
|
19450
|
+
name: "proposalDeposit",
|
|
19451
|
+
title: "Proposal Deposit",
|
|
19452
|
+
description: "The number of tokens that must be deposited to create a proposal. Setting this may deter spam, but setting it too high may limit broad participation.",
|
|
19453
|
+
hideNumber: true
|
|
19454
|
+
},
|
|
19455
|
+
{
|
|
19456
|
+
type: "dropdown",
|
|
19457
|
+
name: "quorum",
|
|
19458
|
+
title: "Quorum",
|
|
19459
|
+
description: "The minimum percentage of voting power that must vote on a proposal for it to be considered a valid vote. If the group has many inactive members, setting this value too high may make it difficult to pass proposals.",
|
|
19460
|
+
hideNumber: true,
|
|
19461
|
+
defaultValue: "majority",
|
|
19462
|
+
choices: [
|
|
19463
|
+
{
|
|
19464
|
+
value: "majority",
|
|
19465
|
+
text: "Majority"
|
|
19466
|
+
},
|
|
19467
|
+
{
|
|
19468
|
+
value: "pecentage",
|
|
19469
|
+
text: "%"
|
|
19470
|
+
}
|
|
19471
|
+
]
|
|
19472
|
+
},
|
|
19473
|
+
{
|
|
19474
|
+
type: "text",
|
|
19475
|
+
name: "quorumPercentage",
|
|
19476
|
+
visibleIf: "{quorum} = 'pecentage'",
|
|
19477
|
+
startWithNewLine: false,
|
|
19478
|
+
title: "Quorum Percentage",
|
|
19479
|
+
hideNumber: true
|
|
19480
|
+
},
|
|
19481
|
+
{
|
|
19482
|
+
type: "dropdown",
|
|
19483
|
+
name: "passingThreshold",
|
|
19484
|
+
title: "Passing Threshold",
|
|
19485
|
+
description: "A majority passing threshold is recommended. Without a majority threshold, the quorum is set by those who voted. A proposal could therefore pass with only a minority of the group voting \u2018yes.\u2019 With a majority threshold, as least 50% of the whole group must vote \u2018yes\u2019.",
|
|
19486
|
+
hideNumber: true,
|
|
19487
|
+
defaultValue: "majority",
|
|
19488
|
+
choices: [
|
|
19489
|
+
{
|
|
19490
|
+
value: "majority",
|
|
19491
|
+
text: "Majority"
|
|
19492
|
+
},
|
|
19493
|
+
{
|
|
19494
|
+
value: "percentage",
|
|
19495
|
+
text: "%"
|
|
19496
|
+
}
|
|
19497
|
+
]
|
|
19498
|
+
},
|
|
19499
|
+
{
|
|
19500
|
+
type: "text",
|
|
19501
|
+
name: "passingThresholdPercentage",
|
|
19502
|
+
visibleIf: "{passingThreshold} = 'percentage'",
|
|
19503
|
+
startWithNewLine: false,
|
|
19504
|
+
title: "Passing Threshold Percentage",
|
|
19505
|
+
hideNumber: true,
|
|
19506
|
+
inputType: "number"
|
|
19507
|
+
},
|
|
19508
|
+
{
|
|
19509
|
+
type: "dropdown",
|
|
19510
|
+
name: "proposalSubmissionPolicy",
|
|
19511
|
+
title: "Proposal Submission Policy",
|
|
19512
|
+
description: "Who is allowed to submit proposals to the Group?",
|
|
19513
|
+
hideNumber: true,
|
|
19514
|
+
choices: [
|
|
19515
|
+
{
|
|
19516
|
+
value: "members",
|
|
19517
|
+
text: "Members "
|
|
19518
|
+
},
|
|
19519
|
+
{
|
|
19520
|
+
value: "anyone",
|
|
19521
|
+
text: "Anyone"
|
|
19522
|
+
}
|
|
19523
|
+
]
|
|
19524
|
+
},
|
|
19525
|
+
{
|
|
19526
|
+
type: "text",
|
|
19527
|
+
name: "proposalDurationAmount",
|
|
19528
|
+
title: "Voting Duration",
|
|
19529
|
+
description: "The duration for which proposals are open for voting. A low proposal duration may increase the speed at which your Group can pass proposals. Setting the duration too low may make it difficult for proposals to pass as voters will have limited time to vote. After this time elapses, the proposal will either pass or fail.",
|
|
19530
|
+
hideNumber: true,
|
|
19531
|
+
defaultValue: 1,
|
|
19532
|
+
inputType: "number"
|
|
19533
|
+
},
|
|
19534
|
+
{
|
|
19535
|
+
type: "dropdown",
|
|
19536
|
+
name: "proposalDurationUnit",
|
|
19537
|
+
startWithNewLine: false,
|
|
19538
|
+
title: "Unit",
|
|
19539
|
+
hideNumber: true,
|
|
19540
|
+
defaultValue: "weeks",
|
|
19541
|
+
choices: [
|
|
19542
|
+
{
|
|
19543
|
+
value: "seconds",
|
|
19544
|
+
text: "Seconds"
|
|
19545
|
+
},
|
|
19546
|
+
{
|
|
19547
|
+
value: "minutes",
|
|
19548
|
+
text: "Minutes"
|
|
19549
|
+
},
|
|
19550
|
+
{
|
|
19551
|
+
value: "hours",
|
|
19552
|
+
text: "Hours"
|
|
19553
|
+
},
|
|
19554
|
+
{
|
|
19555
|
+
value: "days",
|
|
19556
|
+
text: "Days"
|
|
19557
|
+
},
|
|
19558
|
+
{
|
|
19559
|
+
value: "weeks",
|
|
19560
|
+
text: "Weeks"
|
|
19561
|
+
},
|
|
19562
|
+
{
|
|
19563
|
+
value: "months",
|
|
19564
|
+
text: "Months"
|
|
19565
|
+
},
|
|
19566
|
+
{
|
|
19567
|
+
value: "years",
|
|
19568
|
+
text: "Years"
|
|
19569
|
+
}
|
|
19570
|
+
]
|
|
19571
|
+
},
|
|
19572
|
+
{
|
|
19573
|
+
type: "paneldynamic",
|
|
19574
|
+
name: "membershipCategory",
|
|
19575
|
+
title: "Membership Category",
|
|
19576
|
+
hideNumber: true,
|
|
19577
|
+
templateElements: [
|
|
19578
|
+
{
|
|
19579
|
+
type: "text",
|
|
19580
|
+
name: "categoryName",
|
|
19581
|
+
title: "Category Name"
|
|
19582
|
+
},
|
|
19583
|
+
{
|
|
19584
|
+
type: "text",
|
|
19585
|
+
name: "weightPerMember",
|
|
19586
|
+
title: "Voting Weight Per Member",
|
|
19587
|
+
defaultValue: 1,
|
|
19588
|
+
inputType: "number",
|
|
19589
|
+
isRequired: true
|
|
19590
|
+
},
|
|
19591
|
+
{
|
|
19592
|
+
type: "paneldynamic",
|
|
19593
|
+
name: "members",
|
|
19594
|
+
title: "Members",
|
|
19595
|
+
templateElements: [
|
|
19596
|
+
{
|
|
19597
|
+
type: "text",
|
|
19598
|
+
name: "memberAddress",
|
|
19599
|
+
title: "Member Address",
|
|
19600
|
+
isRequired: true
|
|
19601
|
+
}
|
|
19602
|
+
],
|
|
19603
|
+
panelCount: 1
|
|
19604
|
+
}
|
|
19605
|
+
],
|
|
19606
|
+
panelCount: 1
|
|
19607
|
+
}
|
|
19608
|
+
]
|
|
19609
|
+
}
|
|
19610
|
+
],
|
|
19611
|
+
completeText: "Complete",
|
|
19612
|
+
showNavigationButtons: true,
|
|
19613
|
+
complete: false,
|
|
19614
|
+
focusFirstQuestionAutomatic: true,
|
|
19615
|
+
pageNextText: "Continue",
|
|
19616
|
+
pagePrevText: "Back",
|
|
19617
|
+
showCompletedPage: false
|
|
19618
|
+
};
|
|
19619
|
+
|
|
19620
|
+
// src/mantine/blocks/governanceGroup/flow/surveys/multisigGroupSurvey.ts
|
|
19621
|
+
var multisigGroupSurvey = {
|
|
19622
|
+
title: "Create Multi-Sig Group",
|
|
19623
|
+
logoPosition: "right",
|
|
19624
|
+
pages: [
|
|
19625
|
+
{
|
|
19626
|
+
name: "page1",
|
|
19627
|
+
elements: [
|
|
19628
|
+
{
|
|
19629
|
+
type: "text",
|
|
19630
|
+
name: "groupName",
|
|
19631
|
+
title: "Group Name",
|
|
19632
|
+
hideNumber: true
|
|
19633
|
+
},
|
|
19634
|
+
{
|
|
19635
|
+
type: "text",
|
|
19636
|
+
name: "description",
|
|
19637
|
+
title: "Description",
|
|
19638
|
+
hideNumber: true
|
|
19639
|
+
},
|
|
19640
|
+
{
|
|
19641
|
+
type: "text",
|
|
19642
|
+
name: "threshold",
|
|
19643
|
+
title: "Minimum Number of Signatories Required",
|
|
19644
|
+
description: "The minimum number of members who must approve for a proposal to pass",
|
|
19645
|
+
hideNumber: true,
|
|
19646
|
+
inputType: "number"
|
|
19647
|
+
},
|
|
19648
|
+
{
|
|
19649
|
+
type: "paneldynamic",
|
|
19650
|
+
name: "memberships",
|
|
19651
|
+
title: "Multi-Sig Group Members",
|
|
19652
|
+
hideNumber: true,
|
|
19653
|
+
templateElements: [
|
|
19654
|
+
{
|
|
19655
|
+
type: "paneldynamic",
|
|
19656
|
+
name: "members",
|
|
19657
|
+
templateElements: [
|
|
19658
|
+
{
|
|
19659
|
+
type: "text",
|
|
19660
|
+
name: "memberAddress",
|
|
19661
|
+
title: "Member Address"
|
|
19662
|
+
}
|
|
19663
|
+
],
|
|
19664
|
+
panelCount: 1,
|
|
19665
|
+
minPanelCount: 1
|
|
19666
|
+
}
|
|
19667
|
+
],
|
|
19668
|
+
panelCount: 1,
|
|
19669
|
+
showQuestionNumbers: "off"
|
|
19670
|
+
}
|
|
19671
|
+
]
|
|
19672
|
+
}
|
|
19673
|
+
],
|
|
19674
|
+
completeText: "Create Multi-Sig Group",
|
|
19675
|
+
showNavigationButtons: true,
|
|
19676
|
+
complete: false,
|
|
19677
|
+
focusFirstQuestionAutomatic: true,
|
|
19678
|
+
pageNextText: "Continue",
|
|
19679
|
+
pagePrevText: "Back",
|
|
19680
|
+
showCompletedPage: false
|
|
19681
|
+
};
|
|
19682
|
+
|
|
19683
|
+
// src/mantine/blocks/governanceGroup/flow/surveys/nftStakingGroupSurvey.ts
|
|
19684
|
+
var nftStakingGroupSurvey = {
|
|
19685
|
+
title: "Create NFT-Based Group",
|
|
19686
|
+
logoPosition: "right",
|
|
19687
|
+
pages: [
|
|
19688
|
+
{
|
|
19689
|
+
name: "page1",
|
|
19690
|
+
elements: [
|
|
19691
|
+
{
|
|
19692
|
+
type: "file",
|
|
19693
|
+
name: "groupImage",
|
|
19694
|
+
title: "Group Image"
|
|
19695
|
+
},
|
|
19696
|
+
{
|
|
19697
|
+
type: "text",
|
|
19698
|
+
name: "groupType",
|
|
19699
|
+
title: "Group Type",
|
|
19700
|
+
defaultValue: "nft-based",
|
|
19701
|
+
hideNumber: true,
|
|
19702
|
+
visible: false
|
|
19703
|
+
},
|
|
19704
|
+
{
|
|
19705
|
+
type: "text",
|
|
19706
|
+
name: "groupName",
|
|
19707
|
+
title: "Group Name",
|
|
19708
|
+
hideNumber: true
|
|
19709
|
+
},
|
|
19710
|
+
{
|
|
19711
|
+
type: "text",
|
|
19712
|
+
name: "description",
|
|
19713
|
+
title: "Description",
|
|
19714
|
+
hideNumber: true
|
|
19715
|
+
},
|
|
19716
|
+
{
|
|
19717
|
+
type: "text",
|
|
19718
|
+
name: "nftContractAddress",
|
|
19719
|
+
title: "NFT Contract Address",
|
|
19720
|
+
description: "The address of the NFT contract used for voting.",
|
|
19721
|
+
hideNumber: true
|
|
19722
|
+
},
|
|
19723
|
+
{
|
|
19724
|
+
type: "boolean",
|
|
19725
|
+
name: "voteSwitching",
|
|
19726
|
+
title: "Allow Vote Switching",
|
|
19727
|
+
titleLocation: "left",
|
|
19728
|
+
description: "Members will be allowed to change their vote before the voting deadline has expired.",
|
|
19729
|
+
hideNumber: true
|
|
19730
|
+
},
|
|
19731
|
+
{
|
|
19732
|
+
type: "dropdown",
|
|
19733
|
+
name: "quorum",
|
|
19734
|
+
title: "Quorum",
|
|
19735
|
+
description: "The minimum percentage of voting power that must vote on a proposal for it to be considered a valid vote.",
|
|
19736
|
+
hideNumber: true,
|
|
19737
|
+
defaultValue: "majority",
|
|
19738
|
+
choices: [
|
|
19739
|
+
{
|
|
19740
|
+
value: "majority",
|
|
19741
|
+
text: "Majority"
|
|
19742
|
+
},
|
|
19743
|
+
{
|
|
19744
|
+
value: "percentage",
|
|
19745
|
+
text: "%"
|
|
19746
|
+
}
|
|
19747
|
+
]
|
|
19748
|
+
},
|
|
19749
|
+
{
|
|
19750
|
+
type: "text",
|
|
19751
|
+
name: "quorumPercentage",
|
|
19752
|
+
visibleIf: "{quorum} = 'percentage'",
|
|
19753
|
+
startWithNewLine: false,
|
|
19754
|
+
title: "Quorum Percentage",
|
|
19755
|
+
hideNumber: true
|
|
19756
|
+
},
|
|
19757
|
+
{
|
|
19758
|
+
type: "dropdown",
|
|
19759
|
+
name: "passingThreshold",
|
|
19760
|
+
title: "Passing Threshold",
|
|
19761
|
+
description: "A majority passing threshold is recommended. Without a majority threshold, the quorum is set by those who voted.",
|
|
19762
|
+
hideNumber: true,
|
|
19763
|
+
defaultValue: "majority",
|
|
19764
|
+
choices: [
|
|
19765
|
+
{
|
|
19766
|
+
value: "majority",
|
|
19767
|
+
text: "Majority"
|
|
19768
|
+
},
|
|
19769
|
+
{
|
|
19770
|
+
value: "percentage",
|
|
19771
|
+
text: "%"
|
|
19772
|
+
}
|
|
19773
|
+
]
|
|
19774
|
+
},
|
|
19775
|
+
{
|
|
19776
|
+
type: "text",
|
|
19777
|
+
name: "passingThresholdPercentage",
|
|
19778
|
+
visibleIf: "{passingThreshold} = 'percentage'",
|
|
19779
|
+
startWithNewLine: false,
|
|
19780
|
+
title: "Passing Threshold Percentage",
|
|
19781
|
+
hideNumber: true,
|
|
19782
|
+
inputType: "number"
|
|
19783
|
+
},
|
|
19784
|
+
{
|
|
19785
|
+
type: "dropdown",
|
|
19786
|
+
name: "proposalSubmissionPolicy",
|
|
19787
|
+
title: "Proposal Submission Policy",
|
|
19788
|
+
description: "Who is allowed to submit proposals to the Group?",
|
|
19789
|
+
hideNumber: true,
|
|
19790
|
+
choices: [
|
|
19791
|
+
{
|
|
19792
|
+
value: "members",
|
|
19793
|
+
text: "Members"
|
|
19794
|
+
},
|
|
19795
|
+
{
|
|
19796
|
+
value: "anyone",
|
|
19797
|
+
text: "Anyone"
|
|
19798
|
+
}
|
|
19799
|
+
]
|
|
19800
|
+
},
|
|
19801
|
+
{
|
|
19802
|
+
type: "text",
|
|
19803
|
+
name: "proposalDurationAmount",
|
|
19804
|
+
title: "Voting Duration",
|
|
19805
|
+
description: "The duration for which proposals are open for voting.",
|
|
19806
|
+
hideNumber: true,
|
|
19807
|
+
defaultValue: 1,
|
|
19808
|
+
inputType: "number"
|
|
19809
|
+
},
|
|
19810
|
+
{
|
|
19811
|
+
type: "dropdown",
|
|
19812
|
+
name: "proposalDurationUnit",
|
|
19813
|
+
startWithNewLine: false,
|
|
19814
|
+
title: "Unit",
|
|
19815
|
+
hideNumber: true,
|
|
19816
|
+
defaultValue: "weeks",
|
|
19817
|
+
choices: [
|
|
19818
|
+
{
|
|
19819
|
+
value: "seconds",
|
|
19820
|
+
text: "Seconds"
|
|
19821
|
+
},
|
|
19822
|
+
{
|
|
19823
|
+
value: "minutes",
|
|
19824
|
+
text: "Minutes"
|
|
19825
|
+
},
|
|
19826
|
+
{
|
|
19827
|
+
value: "hours",
|
|
19828
|
+
text: "Hours"
|
|
19829
|
+
},
|
|
19830
|
+
{
|
|
19831
|
+
value: "days",
|
|
19832
|
+
text: "Days"
|
|
19833
|
+
},
|
|
19834
|
+
{
|
|
19835
|
+
value: "weeks",
|
|
19836
|
+
text: "Weeks"
|
|
19837
|
+
},
|
|
19838
|
+
{
|
|
19839
|
+
value: "months",
|
|
19840
|
+
text: "Months"
|
|
19841
|
+
},
|
|
19842
|
+
{
|
|
19843
|
+
value: "years",
|
|
19844
|
+
text: "Years"
|
|
19845
|
+
}
|
|
19846
|
+
]
|
|
19847
|
+
}
|
|
19848
|
+
]
|
|
19849
|
+
}
|
|
19850
|
+
],
|
|
19851
|
+
completeText: "Sign and Submit",
|
|
19852
|
+
showNavigationButtons: true,
|
|
19853
|
+
complete: false,
|
|
19854
|
+
focusFirstQuestionAutomatic: true,
|
|
19855
|
+
pageNextText: "Continue",
|
|
19856
|
+
pagePrevText: "Back",
|
|
19857
|
+
showCompletedPage: false
|
|
19858
|
+
};
|
|
19859
|
+
|
|
19860
|
+
// src/mantine/blocks/governanceGroup/flow/surveys/tokenStakingGroupSurvey.ts
|
|
19861
|
+
var tokenStakingGroupSurvey = {
|
|
19862
|
+
title: "Create Token-Based Staking Group",
|
|
19863
|
+
logoPosition: "right",
|
|
19864
|
+
pages: [
|
|
19865
|
+
{
|
|
19866
|
+
name: "page1",
|
|
19867
|
+
elements: [
|
|
19868
|
+
{
|
|
19869
|
+
type: "file",
|
|
19870
|
+
name: "groupImage",
|
|
19871
|
+
title: "groupImage"
|
|
19872
|
+
},
|
|
19873
|
+
{
|
|
19874
|
+
type: "text",
|
|
19875
|
+
name: "groupType",
|
|
19876
|
+
title: "Group Type",
|
|
19877
|
+
defaultValue: "member-based",
|
|
19878
|
+
hideNumber: true,
|
|
19879
|
+
visible: false
|
|
19880
|
+
},
|
|
19881
|
+
{
|
|
19882
|
+
type: "text",
|
|
19883
|
+
name: "groupName",
|
|
19884
|
+
title: "Group Name",
|
|
19885
|
+
hideNumber: true
|
|
19886
|
+
},
|
|
19887
|
+
{
|
|
19888
|
+
type: "text",
|
|
19889
|
+
name: "description",
|
|
19890
|
+
title: "Description",
|
|
19891
|
+
hideNumber: true
|
|
19892
|
+
},
|
|
19893
|
+
{
|
|
19894
|
+
type: "boolean",
|
|
19895
|
+
name: "voteSwitching",
|
|
19896
|
+
title: "Allow vote switching",
|
|
19897
|
+
titleLocation: "left",
|
|
19898
|
+
description: "Members will be allowed to change their vote before the voting deadline has expired. This will result in all proposals having to complete the full voting duration, even if consensus is reached early.",
|
|
19899
|
+
hideNumber: true
|
|
19900
|
+
},
|
|
19901
|
+
{
|
|
19902
|
+
type: "boolean",
|
|
19903
|
+
name: "proposalDeposit",
|
|
19904
|
+
title: "Proposal Deposit",
|
|
19905
|
+
description: "The number of tokens that must be deposited to create a proposal. Setting this may deter spam, but setting it too high may limit broad participation.",
|
|
19906
|
+
hideNumber: true
|
|
19907
|
+
},
|
|
19908
|
+
{
|
|
19909
|
+
type: "dropdown",
|
|
19910
|
+
name: "quorum",
|
|
19911
|
+
title: "Quorum",
|
|
19912
|
+
description: "The minimum percentage of voting power that must vote on a proposal for it to be considered a valid vote. If the group has many inactive members, setting this value too high may make it difficult to pass proposals.",
|
|
19913
|
+
hideNumber: true,
|
|
19914
|
+
defaultValue: "majority",
|
|
19915
|
+
choices: [
|
|
19916
|
+
{
|
|
19917
|
+
value: "majority",
|
|
19918
|
+
text: "Majority"
|
|
19919
|
+
},
|
|
19920
|
+
{
|
|
19921
|
+
value: "pecentage",
|
|
19922
|
+
text: "%"
|
|
19923
|
+
}
|
|
19924
|
+
]
|
|
19925
|
+
},
|
|
19926
|
+
{
|
|
19927
|
+
type: "text",
|
|
19928
|
+
name: "quorumPercentage",
|
|
19929
|
+
visibleIf: "{quorum} = 'pecentage'",
|
|
19930
|
+
startWithNewLine: false,
|
|
19931
|
+
title: "Quorum Percentage",
|
|
19932
|
+
hideNumber: true
|
|
19933
|
+
},
|
|
19934
|
+
{
|
|
19935
|
+
type: "dropdown",
|
|
19936
|
+
name: "passingThreshold",
|
|
19937
|
+
title: "Passing Threshold",
|
|
19938
|
+
description: "A majority passing threshold is recommended. Without a majority threshold, the quorum is set by those who voted. A proposal could therefore pass with only a minority of the group voting \u2018yes.\u2019 With a majority threshold, as least 50% of the whole group must vote \u2018yes\u2019.",
|
|
19939
|
+
hideNumber: true,
|
|
19940
|
+
defaultValue: "majority",
|
|
19941
|
+
choices: [
|
|
19942
|
+
{
|
|
19943
|
+
value: "majority",
|
|
19944
|
+
text: "Majority"
|
|
19945
|
+
},
|
|
19946
|
+
{
|
|
19947
|
+
value: "percentage",
|
|
19948
|
+
text: "%"
|
|
19949
|
+
}
|
|
19950
|
+
]
|
|
19951
|
+
},
|
|
19952
|
+
{
|
|
19953
|
+
type: "text",
|
|
19954
|
+
name: "passingThresholdPercentage",
|
|
19955
|
+
visibleIf: "{passingThreshold} = 'percentage'",
|
|
19956
|
+
startWithNewLine: false,
|
|
19957
|
+
title: "Passing Threshold Percentage",
|
|
19958
|
+
hideNumber: true,
|
|
19959
|
+
inputType: "number"
|
|
19960
|
+
},
|
|
19961
|
+
{
|
|
19962
|
+
type: "dropdown",
|
|
19963
|
+
name: "proposalSubmissionPolicy",
|
|
19964
|
+
title: "Proposal Submission Policy",
|
|
19965
|
+
description: "Who is allowed to submit proposals to the Group?",
|
|
19966
|
+
hideNumber: true,
|
|
19967
|
+
choices: [
|
|
19968
|
+
{
|
|
19969
|
+
value: "members",
|
|
19970
|
+
text: "Members "
|
|
19971
|
+
},
|
|
19972
|
+
{
|
|
19973
|
+
value: "anyone",
|
|
19974
|
+
text: "Anyone"
|
|
19975
|
+
}
|
|
19976
|
+
]
|
|
19977
|
+
},
|
|
19978
|
+
{
|
|
19979
|
+
type: "text",
|
|
19980
|
+
name: "proposalDurationAmount",
|
|
19981
|
+
title: "Voting Duration",
|
|
19982
|
+
description: "The duration for which proposals are open for voting. A low proposal duration may increase the speed at which your Group can pass proposals. Setting the duration too low may make it difficult for proposals to pass as voters will have limited time to vote. After this time elapses, the proposal will either pass or fail.",
|
|
19983
|
+
hideNumber: true,
|
|
19984
|
+
defaultValue: 1,
|
|
19985
|
+
inputType: "number"
|
|
19986
|
+
},
|
|
19987
|
+
{
|
|
19988
|
+
type: "dropdown",
|
|
19989
|
+
name: "proposalDurationUnit",
|
|
19990
|
+
startWithNewLine: false,
|
|
19991
|
+
title: "Unit",
|
|
19992
|
+
hideNumber: true,
|
|
19993
|
+
defaultValue: "weeks",
|
|
19994
|
+
choices: [
|
|
19995
|
+
{
|
|
19996
|
+
value: "seconds",
|
|
19997
|
+
text: "Seconds"
|
|
19998
|
+
},
|
|
19999
|
+
{
|
|
20000
|
+
value: "minutes",
|
|
20001
|
+
text: "Minutes"
|
|
20002
|
+
},
|
|
20003
|
+
{
|
|
20004
|
+
value: "hours",
|
|
20005
|
+
text: "Hours"
|
|
20006
|
+
},
|
|
20007
|
+
{
|
|
20008
|
+
value: "days",
|
|
20009
|
+
text: "Days"
|
|
20010
|
+
},
|
|
20011
|
+
{
|
|
20012
|
+
value: "weeks",
|
|
20013
|
+
text: "Weeks"
|
|
20014
|
+
},
|
|
20015
|
+
{
|
|
20016
|
+
value: "months",
|
|
20017
|
+
text: "Months"
|
|
20018
|
+
},
|
|
20019
|
+
{
|
|
20020
|
+
value: "years",
|
|
20021
|
+
text: "Years"
|
|
20022
|
+
}
|
|
20023
|
+
]
|
|
20024
|
+
},
|
|
20025
|
+
{
|
|
20026
|
+
type: "boolean",
|
|
20027
|
+
name: "isExistingToken",
|
|
20028
|
+
title: "Use an existing staking token",
|
|
20029
|
+
defaultValue: "true"
|
|
20030
|
+
},
|
|
20031
|
+
{
|
|
20032
|
+
type: "text",
|
|
20033
|
+
name: "tokenAddress",
|
|
20034
|
+
visibleIf: "{isExistingToken} = true",
|
|
20035
|
+
title: "Token Address"
|
|
20036
|
+
},
|
|
20037
|
+
{
|
|
20038
|
+
type: "panel",
|
|
20039
|
+
name: "tokenCreation",
|
|
20040
|
+
visibleIf: "{isExistingToken} = false",
|
|
20041
|
+
title: "Token Creation",
|
|
20042
|
+
elements: [
|
|
20043
|
+
{
|
|
20044
|
+
type: "file",
|
|
20045
|
+
name: "tokenIcon",
|
|
20046
|
+
title: "Token Icon"
|
|
20047
|
+
},
|
|
20048
|
+
{
|
|
20049
|
+
type: "text",
|
|
20050
|
+
name: "tokenSymbol",
|
|
20051
|
+
title: "Token Symbol"
|
|
20052
|
+
},
|
|
20053
|
+
{
|
|
20054
|
+
type: "text",
|
|
20055
|
+
name: "tokenName",
|
|
20056
|
+
title: "Token Name"
|
|
20057
|
+
},
|
|
20058
|
+
{
|
|
20059
|
+
type: "text",
|
|
20060
|
+
name: "tokenSupply",
|
|
20061
|
+
title: "Token Supply",
|
|
20062
|
+
defaultValue: 1e7,
|
|
20063
|
+
inputType: "number"
|
|
20064
|
+
},
|
|
20065
|
+
{
|
|
20066
|
+
type: "text",
|
|
20067
|
+
name: "treasuryPercent",
|
|
20068
|
+
title: "Treasury Percent",
|
|
20069
|
+
defaultValue: 90,
|
|
20070
|
+
inputType: "number",
|
|
20071
|
+
min: 0,
|
|
20072
|
+
max: 100,
|
|
20073
|
+
step: 1
|
|
20074
|
+
}
|
|
20075
|
+
]
|
|
20076
|
+
},
|
|
20077
|
+
{
|
|
20078
|
+
type: "paneldynamic",
|
|
20079
|
+
name: "distributionCategory",
|
|
20080
|
+
visibleIf: "{isExistingToken} = false",
|
|
20081
|
+
title: "Distribution Category",
|
|
20082
|
+
templateElements: [
|
|
20083
|
+
{
|
|
20084
|
+
type: "text",
|
|
20085
|
+
name: "categoryName",
|
|
20086
|
+
title: "Category Name"
|
|
20087
|
+
},
|
|
20088
|
+
{
|
|
20089
|
+
type: "text",
|
|
20090
|
+
name: "percentOfTotalSupply",
|
|
20091
|
+
title: "Percent Of Total Supply"
|
|
20092
|
+
},
|
|
20093
|
+
{
|
|
20094
|
+
type: "paneldynamic",
|
|
20095
|
+
name: "members",
|
|
20096
|
+
title: "Members",
|
|
20097
|
+
templateElements: [
|
|
20098
|
+
{
|
|
20099
|
+
type: "text",
|
|
20100
|
+
name: "memberAccount",
|
|
20101
|
+
title: "Member Account"
|
|
20102
|
+
}
|
|
20103
|
+
]
|
|
20104
|
+
}
|
|
20105
|
+
]
|
|
20106
|
+
}
|
|
20107
|
+
]
|
|
20108
|
+
}
|
|
20109
|
+
],
|
|
20110
|
+
completeText: "Sign and Submit",
|
|
20111
|
+
showNavigationButtons: true,
|
|
20112
|
+
complete: false,
|
|
20113
|
+
focusFirstQuestionAutomatic: true,
|
|
20114
|
+
pageNextText: "Continue",
|
|
20115
|
+
pagePrevText: "Back",
|
|
20116
|
+
showCompletedPage: false
|
|
20117
|
+
};
|
|
20118
|
+
|
|
20119
|
+
// src/mantine/blocks/governanceGroup/flow/surveys/index.ts
|
|
20120
|
+
var getSurveyForGroupType = (groupType) => {
|
|
20121
|
+
switch (groupType) {
|
|
20122
|
+
case "categorical":
|
|
20123
|
+
return categoricalGroupSurvey;
|
|
20124
|
+
case "multisig":
|
|
20125
|
+
return multisigGroupSurvey;
|
|
20126
|
+
case "nftStaking":
|
|
20127
|
+
return nftStakingGroupSurvey;
|
|
20128
|
+
case "tokenStaking":
|
|
20129
|
+
return tokenStakingGroupSurvey;
|
|
20130
|
+
default:
|
|
20131
|
+
return null;
|
|
20132
|
+
}
|
|
20133
|
+
};
|
|
20134
|
+
|
|
20135
|
+
// src/mantine/blocks/governanceGroup/template/TemplateConfig.tsx
|
|
20136
|
+
var TemplateConfig15 = ({ editor, block }) => {
|
|
20137
|
+
const { closePanel } = usePanelStore();
|
|
20138
|
+
const updateProp = useCallback56(
|
|
20139
|
+
(key, value) => {
|
|
20140
|
+
editor.updateBlock(block, {
|
|
20141
|
+
props: {
|
|
20142
|
+
...block.props,
|
|
20143
|
+
[key]: value
|
|
20144
|
+
}
|
|
20145
|
+
});
|
|
20146
|
+
},
|
|
20147
|
+
[editor, block]
|
|
20148
|
+
);
|
|
20149
|
+
const handleGroupTypeChange = useCallback56(
|
|
20150
|
+
(groupType) => {
|
|
20151
|
+
const surveySchema = getSurveyForGroupType(groupType);
|
|
20152
|
+
editor.updateBlock(block, {
|
|
20153
|
+
props: {
|
|
20154
|
+
...block.props,
|
|
20155
|
+
groupType,
|
|
20156
|
+
surveySchema: JSON.stringify(surveySchema),
|
|
20157
|
+
answers: ""
|
|
20158
|
+
}
|
|
20159
|
+
});
|
|
20160
|
+
},
|
|
20161
|
+
[editor, block]
|
|
20162
|
+
);
|
|
20163
|
+
return /* @__PURE__ */ React209.createElement(BaseRightPanelLayout, { title: "Governance Group Settings", onClose: closePanel }, /* @__PURE__ */ React209.createElement(
|
|
20164
|
+
ReusablePanel,
|
|
20165
|
+
{
|
|
20166
|
+
extraTabs: [
|
|
20167
|
+
{
|
|
20168
|
+
label: "General",
|
|
20169
|
+
value: "general",
|
|
20170
|
+
content: /* @__PURE__ */ React209.createElement(
|
|
20171
|
+
GeneralTab15,
|
|
20172
|
+
{
|
|
20173
|
+
title: block.props.title || "",
|
|
20174
|
+
description: block.props.description || "",
|
|
20175
|
+
icon: block.props.icon || "users",
|
|
20176
|
+
groupType: block.props.groupType || "",
|
|
20177
|
+
onTitleChange: (value) => updateProp("title", value),
|
|
20178
|
+
onDescriptionChange: (value) => updateProp("description", value),
|
|
20179
|
+
onIconChange: (value) => updateProp("icon", value),
|
|
20180
|
+
onGroupTypeChange: handleGroupTypeChange
|
|
20181
|
+
}
|
|
20182
|
+
)
|
|
20183
|
+
},
|
|
20184
|
+
{
|
|
20185
|
+
label: "After Create",
|
|
20186
|
+
value: "afterCreate",
|
|
20187
|
+
content: /* @__PURE__ */ React209.createElement(AfterCreateTab, { editor, block, afterCreate: block.props.afterCreate || "", onAfterCreateChange: (value) => updateProp("afterCreate", value) })
|
|
20188
|
+
},
|
|
20189
|
+
{
|
|
20190
|
+
label: "Authorization",
|
|
20191
|
+
value: "authorization",
|
|
20192
|
+
content: /* @__PURE__ */ React209.createElement(AuthorizationTab, { editor, block })
|
|
20193
|
+
}
|
|
20194
|
+
],
|
|
20195
|
+
context: { editor, block }
|
|
20196
|
+
}
|
|
20197
|
+
));
|
|
20198
|
+
};
|
|
20199
|
+
|
|
20200
|
+
// src/mantine/blocks/governanceGroup/template/TemplateView.tsx
|
|
20201
|
+
var GOVERNANCE_GROUP_TEMPLATE_PANEL_ID = "governance-group-template-panel";
|
|
20202
|
+
var GovernanceGroupTemplateView = ({ editor, block }) => {
|
|
20203
|
+
const panelId = `${GOVERNANCE_GROUP_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
20204
|
+
const panelContent = useMemo67(() => /* @__PURE__ */ React210.createElement(TemplateConfig15, { editor, block }), [editor, block]);
|
|
20205
|
+
const { open } = usePanel(panelId, panelContent);
|
|
20206
|
+
return /* @__PURE__ */ React210.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React210.createElement(Badge36, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React210.createElement(Group67, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React210.createElement(Group67, { wrap: "nowrap", align: "center" }, getIcon("users", block.props.icon), /* @__PURE__ */ React210.createElement(Stack135, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React210.createElement(Text111, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Governance Group"), /* @__PURE__ */ React210.createElement(Text111, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description || "Configure the governance group creation flow")))));
|
|
20207
|
+
};
|
|
20208
|
+
|
|
20209
|
+
// src/mantine/blocks/governanceGroup/flow/FlowView.tsx
|
|
20210
|
+
import React212, { useCallback as useCallback58, useMemo as useMemo69, useState as useState72 } from "react";
|
|
20211
|
+
import { ActionIcon as ActionIcon31, Badge as Badge37, Group as Group69, Stack as Stack137, Text as Text113, Tooltip as Tooltip23 } from "@mantine/core";
|
|
20212
|
+
import { IconChevronRight as IconChevronRight10 } from "@tabler/icons-react";
|
|
20213
|
+
|
|
20214
|
+
// src/mantine/blocks/governanceGroup/flow/GovernanceGroupPanel.tsx
|
|
20215
|
+
import React211, { useCallback as useCallback57, useEffect as useEffect53, useMemo as useMemo68, useRef as useRef11, useState as useState71 } from "react";
|
|
20216
|
+
import { Alert as Alert29, Button as Button36, Card as Card19, Group as Group68, Loader as Loader26, SimpleGrid as SimpleGrid3, Stack as Stack136, Text as Text112, ThemeIcon as ThemeIcon3 } from "@mantine/core";
|
|
20217
|
+
import { useDebouncedCallback as useDebouncedCallback3 } from "@mantine/hooks";
|
|
20218
|
+
import { IconAlertCircle as IconAlertCircle14, IconCheck as IconCheck10, IconUsers as IconUsers5, IconSignature as IconSignature2, IconPhoto as IconPhoto3, IconCoin as IconCoin2, IconArrowLeft as IconArrowLeft5 } from "@tabler/icons-react";
|
|
20219
|
+
import { Survey as Survey7, SurveyModel as SurveyModel7 } from "@ixo/surveys";
|
|
20220
|
+
|
|
20221
|
+
// src/mantine/blocks/governanceGroup/utils/afterCreateExecutor.ts
|
|
20222
|
+
function parseAfterCreateConfig2(configString) {
|
|
20223
|
+
if (!configString) return null;
|
|
20224
|
+
try {
|
|
20225
|
+
const config = JSON.parse(configString);
|
|
20226
|
+
if (!config.enabled || !config.actions?.length) return null;
|
|
20227
|
+
return config;
|
|
20228
|
+
} catch {
|
|
20229
|
+
return null;
|
|
20230
|
+
}
|
|
20231
|
+
}
|
|
20232
|
+
function parseLinkedEntities2(entitiesString) {
|
|
20233
|
+
if (!entitiesString || entitiesString === "[]") return [];
|
|
20234
|
+
try {
|
|
20235
|
+
return JSON.parse(entitiesString);
|
|
20236
|
+
} catch {
|
|
20237
|
+
return [];
|
|
20238
|
+
}
|
|
20239
|
+
}
|
|
20240
|
+
function buildLinkedEntityData(params) {
|
|
20241
|
+
return {
|
|
20242
|
+
sourceBlockId: params.sourceBlockId,
|
|
20243
|
+
type: "governanceGroup",
|
|
20244
|
+
coreAddress: params.coreAddress,
|
|
20245
|
+
name: params.name,
|
|
20246
|
+
groupType: params.groupType,
|
|
20247
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
20248
|
+
};
|
|
20249
|
+
}
|
|
20250
|
+
function executeAfterCreateActions(params) {
|
|
20251
|
+
const { editor, sourceBlock, coreAddress, groupType, afterCreateConfig } = params;
|
|
20252
|
+
const errors = [];
|
|
20253
|
+
if (!afterCreateConfig.enabled || !afterCreateConfig.actions?.length) {
|
|
20254
|
+
return { success: true, errors: [] };
|
|
20255
|
+
}
|
|
20256
|
+
for (const action of afterCreateConfig.actions) {
|
|
20257
|
+
if (!action.enabled) continue;
|
|
20258
|
+
try {
|
|
20259
|
+
if (action.type === "addLinkedEntity" && action.targetBlockType === "domainCreatorSign") {
|
|
20260
|
+
const targetBlock = editor.document.find((block) => block.id === action.targetBlockId && block.type === action.targetBlockType);
|
|
20261
|
+
if (!targetBlock) {
|
|
20262
|
+
errors.push(`Target block not found: ${action.targetBlockId}`);
|
|
20263
|
+
continue;
|
|
20264
|
+
}
|
|
20265
|
+
const linkedEntity = buildLinkedEntityData({
|
|
20266
|
+
sourceBlockId: sourceBlock.id,
|
|
20267
|
+
coreAddress,
|
|
20268
|
+
name: sourceBlock.props?.title,
|
|
20269
|
+
groupType
|
|
20270
|
+
});
|
|
20271
|
+
const existingEntities = parseLinkedEntities2(targetBlock.props?.linkedEntities || "[]");
|
|
20272
|
+
const existingIndex = existingEntities.findIndex((e) => e.sourceBlockId === sourceBlock.id);
|
|
20273
|
+
if (existingIndex >= 0) {
|
|
20274
|
+
existingEntities[existingIndex] = linkedEntity;
|
|
20275
|
+
} else {
|
|
20276
|
+
existingEntities.push(linkedEntity);
|
|
20277
|
+
}
|
|
20278
|
+
editor.updateBlock(targetBlock, {
|
|
20279
|
+
props: {
|
|
20280
|
+
...targetBlock.props,
|
|
20281
|
+
linkedEntities: JSON.stringify(existingEntities)
|
|
20282
|
+
}
|
|
20283
|
+
});
|
|
20284
|
+
}
|
|
20285
|
+
} catch (err) {
|
|
20286
|
+
errors.push(`Action failed: ${err instanceof Error ? err.message : "Unknown error"}`);
|
|
20287
|
+
}
|
|
20288
|
+
}
|
|
20289
|
+
return { success: errors.length === 0, errors };
|
|
20290
|
+
}
|
|
20291
|
+
|
|
20292
|
+
// src/mantine/blocks/governanceGroup/flow/GovernanceGroupPanel.tsx
|
|
20293
|
+
var SYNC_DEBOUNCE_MS3 = 300;
|
|
20294
|
+
function deepEqual3(a, b) {
|
|
20295
|
+
if (a === b) return true;
|
|
20296
|
+
if (a === null || b === null) return a === b;
|
|
20297
|
+
if (typeof a !== typeof b) return false;
|
|
20298
|
+
if (typeof a !== "object") return false;
|
|
20299
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
20300
|
+
if (a.length !== b.length) return false;
|
|
20301
|
+
return a.every((item, index) => deepEqual3(item, b[index]));
|
|
20302
|
+
}
|
|
20303
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
20304
|
+
const aObj = a;
|
|
20305
|
+
const bObj = b;
|
|
20306
|
+
const aKeys = Object.keys(aObj);
|
|
20307
|
+
const bKeys = Object.keys(bObj);
|
|
20308
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
20309
|
+
return aKeys.every((key) => deepEqual3(aObj[key], bObj[key]));
|
|
20310
|
+
}
|
|
20311
|
+
var GROUP_TYPE_ICONS2 = {
|
|
20312
|
+
categorical: /* @__PURE__ */ React211.createElement(IconUsers5, { size: 24 }),
|
|
20313
|
+
multisig: /* @__PURE__ */ React211.createElement(IconSignature2, { size: 24 }),
|
|
20314
|
+
nftStaking: /* @__PURE__ */ React211.createElement(IconPhoto3, { size: 24 }),
|
|
20315
|
+
tokenStaking: /* @__PURE__ */ React211.createElement(IconCoin2, { size: 24 })
|
|
20316
|
+
};
|
|
20317
|
+
var GovernanceGroupPanel = ({ editor, block, onComplete }) => {
|
|
20318
|
+
const { closePanel } = usePanelStore();
|
|
20319
|
+
const { handlers } = useBlocknoteContext();
|
|
20320
|
+
const existingCoreAddress = block.props.coreAddress;
|
|
20321
|
+
const existingGroupType = block.props.groupType;
|
|
20322
|
+
const getInitialFlowStep = () => {
|
|
20323
|
+
if (existingCoreAddress) return "success";
|
|
20324
|
+
if (existingGroupType) return "survey";
|
|
20325
|
+
return "typeSelection";
|
|
20326
|
+
};
|
|
20327
|
+
const [flowStep, setFlowStep] = useState71(getInitialFlowStep);
|
|
20328
|
+
const [selectedGroupType, setSelectedGroupType] = useState71(existingGroupType || null);
|
|
20329
|
+
const [error, setError] = useState71(null);
|
|
20330
|
+
const [createdCoreAddress, setCreatedCoreAddress] = useState71(existingCoreAddress || null);
|
|
20331
|
+
const [createdGroupAddress, setCreatedGroupAddress] = useState71(block.props.groupAddress || null);
|
|
20332
|
+
const isUpdatingFromProp = useRef11(false);
|
|
20333
|
+
const lastSyncedAnswers = useRef11("");
|
|
20334
|
+
const surveyModel = useMemo68(() => {
|
|
20335
|
+
if (!selectedGroupType) return null;
|
|
20336
|
+
const surveySchema = getSurveyForGroupType(selectedGroupType);
|
|
20337
|
+
if (!surveySchema) return null;
|
|
20338
|
+
const model = new SurveyModel7(surveySchema);
|
|
20339
|
+
model.applyTheme(surveyTheme);
|
|
20340
|
+
model.showQuestionNumbers = "off";
|
|
20341
|
+
model.questionsOnPageMode = "singlePage";
|
|
20342
|
+
return model;
|
|
20343
|
+
}, [selectedGroupType]);
|
|
20344
|
+
const syncPropToSurvey = useCallback57(
|
|
20345
|
+
(answersJson) => {
|
|
20346
|
+
if (!answersJson || answersJson === lastSyncedAnswers.current || !surveyModel) return;
|
|
20347
|
+
try {
|
|
20348
|
+
const answers = JSON.parse(answersJson);
|
|
20349
|
+
isUpdatingFromProp.current = true;
|
|
20350
|
+
Object.entries(answers).forEach(([key, value]) => {
|
|
20351
|
+
const currentValue = surveyModel.getValue(key);
|
|
20352
|
+
if (!deepEqual3(currentValue, value)) {
|
|
20353
|
+
surveyModel.setValue(key, value);
|
|
20354
|
+
}
|
|
20355
|
+
});
|
|
20356
|
+
lastSyncedAnswers.current = answersJson;
|
|
20357
|
+
} catch (err) {
|
|
20358
|
+
console.error("Failed to parse answers prop:", err);
|
|
20359
|
+
} finally {
|
|
20360
|
+
isUpdatingFromProp.current = false;
|
|
20361
|
+
}
|
|
20362
|
+
},
|
|
20363
|
+
[surveyModel]
|
|
20364
|
+
);
|
|
20365
|
+
const syncSurveyToProp = useDebouncedCallback3((data) => {
|
|
20366
|
+
const newAnswersJson = JSON.stringify(data);
|
|
20367
|
+
if (newAnswersJson === lastSyncedAnswers.current) return;
|
|
20368
|
+
lastSyncedAnswers.current = newAnswersJson;
|
|
20369
|
+
editor.updateBlock(block, {
|
|
20370
|
+
props: {
|
|
20371
|
+
...block.props,
|
|
20372
|
+
answers: newAnswersJson
|
|
20373
|
+
}
|
|
20374
|
+
});
|
|
20375
|
+
}, SYNC_DEBOUNCE_MS3);
|
|
20376
|
+
useEffect53(() => {
|
|
20377
|
+
const answersJson = block.props.answers;
|
|
20378
|
+
if (answersJson && surveyModel) {
|
|
20379
|
+
syncPropToSurvey(answersJson);
|
|
20380
|
+
}
|
|
20381
|
+
}, [block.props.answers, syncPropToSurvey, surveyModel]);
|
|
20382
|
+
useEffect53(() => {
|
|
20383
|
+
if (!surveyModel) return;
|
|
20384
|
+
const handleValueChanged = () => {
|
|
20385
|
+
if (isUpdatingFromProp.current) return;
|
|
20386
|
+
syncSurveyToProp(surveyModel.data);
|
|
20387
|
+
};
|
|
20388
|
+
surveyModel.onValueChanged.add(handleValueChanged);
|
|
20389
|
+
return () => {
|
|
20390
|
+
surveyModel.onValueChanged.remove(handleValueChanged);
|
|
20391
|
+
};
|
|
20392
|
+
}, [surveyModel, syncSurveyToProp]);
|
|
20393
|
+
const handleGroupTypeSelect = (groupType) => {
|
|
20394
|
+
setSelectedGroupType(groupType);
|
|
20395
|
+
const surveySchema = getSurveyForGroupType(groupType);
|
|
20396
|
+
editor.updateBlock(block, {
|
|
20397
|
+
props: {
|
|
20398
|
+
...block.props,
|
|
20399
|
+
groupType,
|
|
20400
|
+
surveySchema: JSON.stringify(surveySchema),
|
|
20401
|
+
answers: ""
|
|
20402
|
+
}
|
|
20403
|
+
});
|
|
20404
|
+
lastSyncedAnswers.current = "";
|
|
20405
|
+
setFlowStep("survey");
|
|
20406
|
+
};
|
|
20407
|
+
const processGroupCreation = useCallback57(
|
|
20408
|
+
async (data) => {
|
|
20409
|
+
if (!handlers) {
|
|
20410
|
+
throw new Error("Handlers not available");
|
|
20411
|
+
}
|
|
20412
|
+
if (!handlers.createGovernanceGroup) {
|
|
20413
|
+
throw new Error("createGovernanceGroup handler not implemented");
|
|
20414
|
+
}
|
|
20415
|
+
if (!selectedGroupType) {
|
|
20416
|
+
throw new Error("No group type selected");
|
|
20417
|
+
}
|
|
20418
|
+
setFlowStep("creating");
|
|
20419
|
+
const result = await handlers.createGovernanceGroup({
|
|
20420
|
+
groupType: selectedGroupType,
|
|
20421
|
+
name: data.name,
|
|
20422
|
+
description: data.description,
|
|
20423
|
+
config: data
|
|
20424
|
+
});
|
|
20425
|
+
return result;
|
|
20426
|
+
},
|
|
20427
|
+
[handlers, selectedGroupType]
|
|
20428
|
+
);
|
|
20429
|
+
const handleSurveyComplete = useCallback57(
|
|
20430
|
+
async (sender) => {
|
|
20431
|
+
const data = sender.data || {};
|
|
20432
|
+
try {
|
|
20433
|
+
const result = await processGroupCreation(data);
|
|
20434
|
+
setCreatedCoreAddress(result.coreAddress);
|
|
20435
|
+
setCreatedGroupAddress(result.groupAddress);
|
|
20436
|
+
setFlowStep("success");
|
|
20437
|
+
editor.updateBlock(block, {
|
|
20438
|
+
props: {
|
|
20439
|
+
...block.props,
|
|
20440
|
+
coreAddress: result.coreAddress,
|
|
20441
|
+
groupAddress: result.groupAddress
|
|
20442
|
+
}
|
|
20443
|
+
});
|
|
20444
|
+
const afterCreateConfig = parseAfterCreateConfig2(block.props.afterCreate);
|
|
20445
|
+
if (afterCreateConfig) {
|
|
20446
|
+
const { errors } = executeAfterCreateActions({
|
|
20447
|
+
editor,
|
|
20448
|
+
sourceBlock: block,
|
|
20449
|
+
coreAddress: result.coreAddress,
|
|
20450
|
+
groupType: selectedGroupType || void 0,
|
|
20451
|
+
afterCreateConfig
|
|
20452
|
+
});
|
|
20453
|
+
if (errors.length > 0) {
|
|
20454
|
+
console.warn("After-create action errors:", errors);
|
|
20455
|
+
}
|
|
20456
|
+
}
|
|
20457
|
+
onComplete?.({
|
|
20458
|
+
surveyData: data,
|
|
20459
|
+
coreAddress: result.coreAddress,
|
|
20460
|
+
groupAddress: result.groupAddress,
|
|
20461
|
+
transactionHash: result.transactionHash,
|
|
20462
|
+
groupType: selectedGroupType || void 0
|
|
20463
|
+
});
|
|
20464
|
+
} catch (err) {
|
|
20465
|
+
console.error("Group creation failed:", err);
|
|
20466
|
+
setError(err instanceof Error ? err.message : "Group creation failed");
|
|
20467
|
+
setFlowStep("error");
|
|
20468
|
+
}
|
|
20469
|
+
},
|
|
20470
|
+
[processGroupCreation, onComplete, editor, block, selectedGroupType]
|
|
20471
|
+
);
|
|
20472
|
+
useEffect53(() => {
|
|
20473
|
+
if (!surveyModel) return;
|
|
20474
|
+
surveyModel.onComplete.add(handleSurveyComplete);
|
|
20475
|
+
return () => {
|
|
20476
|
+
surveyModel.onComplete.remove(handleSurveyComplete);
|
|
20477
|
+
};
|
|
20478
|
+
}, [handleSurveyComplete, surveyModel]);
|
|
20479
|
+
const handleRetry = useCallback57(() => {
|
|
20480
|
+
setFlowStep("survey");
|
|
20481
|
+
setError(null);
|
|
20482
|
+
surveyModel?.clear();
|
|
20483
|
+
}, [surveyModel]);
|
|
20484
|
+
const handleBackToTypeSelection = useCallback57(() => {
|
|
20485
|
+
setSelectedGroupType(null);
|
|
20486
|
+
setFlowStep("typeSelection");
|
|
20487
|
+
editor.updateBlock(block, {
|
|
20488
|
+
props: {
|
|
20489
|
+
...block.props,
|
|
20490
|
+
groupType: "",
|
|
20491
|
+
surveySchema: "",
|
|
20492
|
+
answers: ""
|
|
20493
|
+
}
|
|
20494
|
+
});
|
|
20495
|
+
}, [editor, block]);
|
|
20496
|
+
const handleClose = useCallback57(() => {
|
|
20497
|
+
closePanel();
|
|
20498
|
+
}, [closePanel]);
|
|
20499
|
+
if (flowStep === "typeSelection") {
|
|
20500
|
+
return /* @__PURE__ */ React211.createElement(
|
|
20501
|
+
BaseRightPanelLayout,
|
|
20502
|
+
{
|
|
20503
|
+
title: "Create Governance Group",
|
|
20504
|
+
onClose: handleClose,
|
|
20505
|
+
captionContent: /* @__PURE__ */ React211.createElement(Text112, { size: "sm", mb: "md", px: "xl", c: "dimmed" }, "Select the type of governance group you want to create.")
|
|
20506
|
+
},
|
|
20507
|
+
/* @__PURE__ */ React211.createElement(Stack136, { p: "md", gap: "md" }, /* @__PURE__ */ React211.createElement(SimpleGrid3, { cols: 2, spacing: "md" }, GROUP_TYPE_CONFIGS.map((config) => /* @__PURE__ */ React211.createElement(Card19, { key: config.type, shadow: "sm", padding: "lg", radius: "md", withBorder: true, style: { cursor: "pointer" }, onClick: () => handleGroupTypeSelect(config.type) }, /* @__PURE__ */ React211.createElement(Stack136, { align: "center", gap: "sm" }, /* @__PURE__ */ React211.createElement(ThemeIcon3, { size: "xl", radius: "md", variant: "light", color: "blue" }, GROUP_TYPE_ICONS2[config.type]), /* @__PURE__ */ React211.createElement(Text112, { fw: 500, size: "sm", ta: "center" }, config.title), /* @__PURE__ */ React211.createElement(Text112, { size: "xs", c: "dimmed", ta: "center" }, config.description))))))
|
|
20508
|
+
);
|
|
20509
|
+
}
|
|
20510
|
+
if (flowStep === "creating") {
|
|
20511
|
+
return /* @__PURE__ */ React211.createElement(Stack136, { gap: "md", p: "md", align: "center", justify: "center", style: { minHeight: 300 } }, /* @__PURE__ */ React211.createElement(Loader26, { size: "lg" }), /* @__PURE__ */ React211.createElement(Text112, { size: "sm", c: "dimmed" }, "Creating governance group..."));
|
|
20512
|
+
}
|
|
20513
|
+
if (flowStep === "success") {
|
|
20514
|
+
const groupTypeName = selectedGroupType ? GROUP_TYPE_CONFIGS.find((c) => c.type === selectedGroupType)?.title || "Group" : "Group";
|
|
20515
|
+
return /* @__PURE__ */ React211.createElement(Stack136, { gap: "md", p: "md" }, /* @__PURE__ */ React211.createElement(Alert29, { icon: /* @__PURE__ */ React211.createElement(IconCheck10, { size: 16 }), title: "Group Created Successfully", color: "green" }, /* @__PURE__ */ React211.createElement(Stack136, { gap: "xs" }, /* @__PURE__ */ React211.createElement(Text112, { size: "sm" }, "Your ", groupTypeName, " has been created successfully."), createdCoreAddress && /* @__PURE__ */ React211.createElement(Text112, { size: "xs", c: "dimmed" }, "Core Address: ", createdCoreAddress), createdGroupAddress && /* @__PURE__ */ React211.createElement(Text112, { size: "xs", c: "dimmed" }, "Group Address: ", createdGroupAddress))), /* @__PURE__ */ React211.createElement(Button36, { onClick: handleClose }, "Close"));
|
|
20516
|
+
}
|
|
20517
|
+
if (flowStep === "error") {
|
|
20518
|
+
return /* @__PURE__ */ React211.createElement(Stack136, { gap: "md", p: "md" }, /* @__PURE__ */ React211.createElement(Alert29, { icon: /* @__PURE__ */ React211.createElement(IconAlertCircle14, { size: 16 }), title: "Group Creation Failed", color: "red" }, /* @__PURE__ */ React211.createElement(Text112, { size: "sm" }, error || "An unexpected error occurred")), /* @__PURE__ */ React211.createElement(Group68, null, /* @__PURE__ */ React211.createElement(Button36, { variant: "outline", onClick: handleRetry }, "Try Again"), /* @__PURE__ */ React211.createElement(Button36, { variant: "subtle", onClick: handleClose }, "Close")));
|
|
20519
|
+
}
|
|
20520
|
+
if (flowStep === "survey" && surveyModel) {
|
|
20521
|
+
const groupTypeName = selectedGroupType ? GROUP_TYPE_CONFIGS.find((c) => c.type === selectedGroupType)?.title || "Group" : "Group";
|
|
20522
|
+
const showChangeTypeButton = !existingGroupType;
|
|
20523
|
+
return /* @__PURE__ */ React211.createElement(
|
|
20524
|
+
BaseRightPanelLayout,
|
|
20525
|
+
{
|
|
20526
|
+
title: `Create ${groupTypeName}`,
|
|
20527
|
+
onClose: handleClose,
|
|
20528
|
+
captionContent: showChangeTypeButton ? /* @__PURE__ */ React211.createElement(Group68, { mb: "md", px: "xl" }, /* @__PURE__ */ React211.createElement(Button36, { variant: "subtle", size: "xs", leftSection: /* @__PURE__ */ React211.createElement(IconArrowLeft5, { size: 14 }), onClick: handleBackToTypeSelection }, "Change Type")) : void 0
|
|
20529
|
+
},
|
|
20530
|
+
/* @__PURE__ */ React211.createElement(Survey7, { model: surveyModel })
|
|
20531
|
+
);
|
|
20532
|
+
}
|
|
20533
|
+
return null;
|
|
20534
|
+
};
|
|
20535
|
+
|
|
20536
|
+
// src/mantine/blocks/governanceGroup/flow/FlowView.tsx
|
|
20537
|
+
var GOVERNANCE_GROUP_FLOW_PANEL_ID = "governance-group-flow-panel";
|
|
20538
|
+
var GovernanceGroupFlowView = ({ editor, block }) => {
|
|
20539
|
+
const [hasOpened, setHasOpened] = useState72(false);
|
|
20540
|
+
const [submissionStatus, setSubmissionStatus] = useState72("idle");
|
|
20541
|
+
const lastSubmission = block.props.lastSubmission ? JSON.parse(block.props.lastSubmission) : null;
|
|
20542
|
+
const hasExistingSubmission = lastSubmission?.coreAddress;
|
|
20543
|
+
const handleComplete = useCallback58(
|
|
20544
|
+
(data) => {
|
|
20545
|
+
editor.updateBlock(block, {
|
|
20546
|
+
props: {
|
|
20547
|
+
...block.props,
|
|
20548
|
+
lastSubmission: JSON.stringify({
|
|
20549
|
+
surveyData: data.surveyData,
|
|
20550
|
+
coreAddress: data.coreAddress,
|
|
20551
|
+
groupAddress: data.groupAddress,
|
|
20552
|
+
transactionHash: data.transactionHash,
|
|
20553
|
+
groupType: data.groupType,
|
|
20554
|
+
completedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
20555
|
+
}),
|
|
20556
|
+
coreAddress: data.coreAddress || "",
|
|
20557
|
+
groupAddress: data.groupAddress || ""
|
|
20558
|
+
}
|
|
20559
|
+
});
|
|
20560
|
+
setSubmissionStatus("success");
|
|
20561
|
+
},
|
|
20562
|
+
[block, editor]
|
|
20563
|
+
);
|
|
20564
|
+
const panelId = `${GOVERNANCE_GROUP_FLOW_PANEL_ID}-${block.id}`;
|
|
20565
|
+
const panelContent = useMemo69(() => /* @__PURE__ */ React212.createElement(GovernanceGroupPanel, { editor, block, onComplete: handleComplete }), [editor, block, handleComplete]);
|
|
20566
|
+
const { open } = usePanel(panelId, panelContent);
|
|
20567
|
+
const handleOpen = () => {
|
|
20568
|
+
setHasOpened(true);
|
|
20569
|
+
open();
|
|
20570
|
+
};
|
|
20571
|
+
const getBadgeProps = () => {
|
|
20572
|
+
if (hasExistingSubmission || submissionStatus === "success") {
|
|
20573
|
+
return { color: "green", text: "Created" };
|
|
20574
|
+
}
|
|
20575
|
+
if (submissionStatus === "error") {
|
|
20576
|
+
return { color: "red", text: "Error" };
|
|
20577
|
+
}
|
|
20578
|
+
if (hasOpened) {
|
|
20579
|
+
return { color: "blue", text: "In Progress" };
|
|
20580
|
+
}
|
|
20581
|
+
return { color: "gray", text: "Click to start" };
|
|
20582
|
+
};
|
|
20583
|
+
const badgeProps = getBadgeProps();
|
|
20584
|
+
const getSubmissionDisplay = () => {
|
|
20585
|
+
if (!lastSubmission) return "";
|
|
20586
|
+
const groupTypeName = lastSubmission.groupType ? lastSubmission.groupType.charAt(0).toUpperCase() + lastSubmission.groupType.slice(1).replace(/([A-Z])/g, " $1") : "Group";
|
|
20587
|
+
return `${groupTypeName} created: ${lastSubmission.coreAddress?.slice(0, 12)}...`;
|
|
20588
|
+
};
|
|
20589
|
+
return /* @__PURE__ */ React212.createElement(BaseContainer, { onClick: handleOpen }, /* @__PURE__ */ React212.createElement(Group69, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React212.createElement(Group69, { wrap: "nowrap", align: "center", style: { flex: 1 } }, getIcon("users", block.props.icon), /* @__PURE__ */ React212.createElement(Stack137, { gap: 4, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React212.createElement(Group69, { gap: "xs", align: "center" }, /* @__PURE__ */ React212.createElement(Text113, { fw: 600, size: "sm", contentEditable: false }, block.props.title || "Governance Group"), /* @__PURE__ */ React212.createElement(Badge37, { size: "xs", variant: "filled", color: badgeProps.color, styles: { root: { backgroundColor: `var(--mantine-color-${badgeProps.color}-6)`, color: "white" } } }, badgeProps.text)), /* @__PURE__ */ React212.createElement(Text113, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 2 }, hasExistingSubmission ? getSubmissionDisplay() : block.props.description || "Open the panel to create a new governance group."))), /* @__PURE__ */ React212.createElement(Tooltip23, { label: hasExistingSubmission ? "View/Edit group" : "Create group", withArrow: true }, /* @__PURE__ */ React212.createElement(ActionIcon31, { variant: "subtle", color: "blue" }, /* @__PURE__ */ React212.createElement(IconChevronRight10, { size: 18 })))));
|
|
20590
|
+
};
|
|
20591
|
+
|
|
20592
|
+
// src/mantine/blocks/governanceGroup/GovernanceGroupBlock.tsx
|
|
20593
|
+
function GovernanceGroupBlock({ editor, block }) {
|
|
20594
|
+
const { docType } = useBlocknoteContext();
|
|
20595
|
+
if (docType === "template") {
|
|
20596
|
+
return /* @__PURE__ */ React213.createElement(GovernanceGroupTemplateView, { editor, block });
|
|
20597
|
+
}
|
|
20598
|
+
return /* @__PURE__ */ React213.createElement(GovernanceGroupFlowView, { editor, block });
|
|
20599
|
+
}
|
|
20600
|
+
|
|
20601
|
+
// src/mantine/blocks/governanceGroup/GovernanceGroupBlockSpec.tsx
|
|
20602
|
+
var GovernanceGroupBlockSpec = createReactBlockSpec19(
|
|
20603
|
+
{
|
|
20604
|
+
type: "governanceGroup",
|
|
20605
|
+
propSchema: {
|
|
20606
|
+
title: { default: "" },
|
|
20607
|
+
description: { default: "" },
|
|
20608
|
+
icon: { default: "users" },
|
|
20609
|
+
groupType: { default: "" },
|
|
20610
|
+
surveySchema: { default: "" },
|
|
20611
|
+
answers: { default: "" },
|
|
20612
|
+
lastSubmission: { default: "" },
|
|
20613
|
+
coreAddress: { default: "" },
|
|
20614
|
+
groupAddress: { default: "" },
|
|
20615
|
+
// After-create hook configuration (JSON string of AfterCreateConfig)
|
|
20616
|
+
afterCreate: { default: "" }
|
|
20617
|
+
},
|
|
20618
|
+
content: "none"
|
|
20619
|
+
},
|
|
20620
|
+
{
|
|
20621
|
+
render: (props) => {
|
|
20622
|
+
const ixoProps = props;
|
|
20623
|
+
return /* @__PURE__ */ React214.createElement(GovernanceGroupBlock, { ...ixoProps });
|
|
20624
|
+
}
|
|
20625
|
+
}
|
|
20626
|
+
);
|
|
20627
|
+
|
|
20628
|
+
// src/mantine/blocks/registry/blockRegistry.ts
|
|
20629
|
+
var BlockRegistry = class {
|
|
20630
|
+
constructor() {
|
|
20631
|
+
this.blocks = /* @__PURE__ */ new Map();
|
|
20632
|
+
}
|
|
20633
|
+
register(entry) {
|
|
20634
|
+
this.blocks.set(entry.type, entry);
|
|
20635
|
+
}
|
|
20636
|
+
get(type) {
|
|
20637
|
+
return this.blocks.get(type);
|
|
20638
|
+
}
|
|
20639
|
+
getAll() {
|
|
20640
|
+
return new Map(this.blocks);
|
|
20641
|
+
}
|
|
20642
|
+
getValidDependencies(type) {
|
|
20643
|
+
const entry = this.get(type);
|
|
20644
|
+
return entry?.validDependencies || [];
|
|
20645
|
+
}
|
|
20646
|
+
getPropSchema(type) {
|
|
20647
|
+
const entry = this.get(type);
|
|
20648
|
+
return entry?.propSchema;
|
|
20649
|
+
}
|
|
20650
|
+
isValidDependency(blockType, dependencyType) {
|
|
20651
|
+
const validDeps = this.getValidDependencies(blockType);
|
|
20652
|
+
return validDeps.includes(dependencyType);
|
|
20653
|
+
}
|
|
20654
|
+
};
|
|
20655
|
+
var blockRegistry = new BlockRegistry();
|
|
20656
|
+
blockRegistry.register({
|
|
20657
|
+
type: "proposal",
|
|
20658
|
+
propSchema: {
|
|
20659
|
+
title: "",
|
|
20660
|
+
description: "",
|
|
20661
|
+
icon: "\u{1F4DD}",
|
|
20662
|
+
proposalId: "",
|
|
20663
|
+
status: "draft",
|
|
20664
|
+
contractAddress: "",
|
|
20665
|
+
coreAddress: "",
|
|
20666
|
+
createdProposalId: ""
|
|
20667
|
+
},
|
|
20668
|
+
validDependencies: [],
|
|
20669
|
+
defaultProps: {
|
|
20670
|
+
icon: "\u{1F4DD}",
|
|
20671
|
+
status: "draft"
|
|
20672
|
+
}
|
|
20673
|
+
});
|
|
20674
|
+
blockRegistry.register({
|
|
20675
|
+
type: "proposalVote",
|
|
20676
|
+
propSchema: {
|
|
20677
|
+
title: "",
|
|
20678
|
+
subtitle: "",
|
|
20679
|
+
icon: "\u{1F5F3}\uFE0F",
|
|
20680
|
+
status: "open",
|
|
20681
|
+
daysLeft: 0,
|
|
20682
|
+
proposalId: "",
|
|
20683
|
+
proposalBlockId: "",
|
|
20684
|
+
proposalContractAddress: ""
|
|
20685
|
+
},
|
|
20686
|
+
validDependencies: ["proposal"],
|
|
20687
|
+
defaultProps: {
|
|
20688
|
+
icon: "\u{1F5F3}\uFE0F",
|
|
20689
|
+
status: "open",
|
|
20690
|
+
daysLeft: 0,
|
|
20691
|
+
proposalBlockId: ""
|
|
20692
|
+
}
|
|
20693
|
+
});
|
|
20694
|
+
blockRegistry.register({
|
|
20695
|
+
type: "list",
|
|
20696
|
+
propSchema: {
|
|
20697
|
+
title: "",
|
|
20698
|
+
did: "",
|
|
20699
|
+
fragmentIdentifier: ""
|
|
20700
|
+
},
|
|
20701
|
+
validDependencies: [],
|
|
20702
|
+
defaultProps: {}
|
|
20703
|
+
});
|
|
20704
|
+
blockRegistry.register({
|
|
20705
|
+
type: "overview",
|
|
20706
|
+
propSchema: {
|
|
20707
|
+
did: ""
|
|
20708
|
+
},
|
|
20709
|
+
validDependencies: [],
|
|
20710
|
+
defaultProps: {}
|
|
20711
|
+
});
|
|
20712
|
+
blockRegistry.register({
|
|
20713
|
+
type: "enumChecklist",
|
|
20714
|
+
propSchema: {
|
|
20715
|
+
listType: "",
|
|
20716
|
+
listConfig: "{}"
|
|
20717
|
+
},
|
|
20718
|
+
validDependencies: [],
|
|
20719
|
+
defaultProps: {}
|
|
20720
|
+
});
|
|
20721
|
+
blockRegistry.register({
|
|
20722
|
+
type: "notify",
|
|
20723
|
+
propSchema: {
|
|
20724
|
+
title: "",
|
|
20725
|
+
description: "",
|
|
20726
|
+
icon: "bell",
|
|
20727
|
+
channel: "email",
|
|
20728
|
+
to: "[]",
|
|
20729
|
+
cc: "[]",
|
|
20730
|
+
bcc: "[]",
|
|
20731
|
+
subject: "",
|
|
20732
|
+
body: "",
|
|
20733
|
+
bodyType: "text",
|
|
20734
|
+
from: "",
|
|
20735
|
+
replyTo: "",
|
|
20736
|
+
templateId: "",
|
|
20737
|
+
templateVariables: "{}",
|
|
20738
|
+
status: "idle",
|
|
20739
|
+
messageId: "",
|
|
20740
|
+
sentAt: "",
|
|
20741
|
+
errorMessage: "",
|
|
20742
|
+
conditions: ""
|
|
20743
|
+
},
|
|
20744
|
+
validDependencies: [],
|
|
20745
|
+
defaultProps: {
|
|
20746
|
+
icon: "bell",
|
|
20747
|
+
channel: "email",
|
|
20748
|
+
bodyType: "text",
|
|
20749
|
+
status: "idle"
|
|
20750
|
+
}
|
|
20751
|
+
});
|
|
20752
|
+
blockRegistry.register({
|
|
20753
|
+
type: "bid",
|
|
20754
|
+
propSchema: {
|
|
20755
|
+
title: "",
|
|
20756
|
+
description: "",
|
|
20757
|
+
did: "",
|
|
20758
|
+
selectedCollections: "[]",
|
|
20759
|
+
adminAddress: ""
|
|
20760
|
+
},
|
|
20761
|
+
validDependencies: [],
|
|
20762
|
+
defaultProps: {}
|
|
20763
|
+
});
|
|
20764
|
+
blockRegistry.register({
|
|
20765
|
+
type: "claim",
|
|
20766
|
+
propSchema: {
|
|
20767
|
+
title: "",
|
|
20768
|
+
description: "",
|
|
20769
|
+
icon: "square-check",
|
|
20770
|
+
deedDid: "",
|
|
20771
|
+
selectedCollections: "[]",
|
|
20772
|
+
adminAddress: ""
|
|
20773
|
+
},
|
|
20774
|
+
validDependencies: [],
|
|
20775
|
+
defaultProps: {
|
|
20776
|
+
icon: "square-check"
|
|
20777
|
+
}
|
|
20778
|
+
});
|
|
20779
|
+
blockRegistry.register({
|
|
20780
|
+
type: "domainCreator",
|
|
20781
|
+
propSchema: {
|
|
20782
|
+
title: "",
|
|
20783
|
+
description: "",
|
|
20784
|
+
icon: "file-text",
|
|
20785
|
+
surveySchema: "",
|
|
20786
|
+
answers: "",
|
|
20787
|
+
lastSubmission: ""
|
|
20788
|
+
},
|
|
20789
|
+
validDependencies: [],
|
|
20790
|
+
defaultProps: {
|
|
20791
|
+
icon: "file-text",
|
|
20792
|
+
surveySchema: "",
|
|
20793
|
+
answers: "",
|
|
20794
|
+
lastSubmission: ""
|
|
20795
|
+
}
|
|
20796
|
+
});
|
|
20797
|
+
|
|
20798
|
+
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
20799
|
+
import { useMemo as useMemo70, useEffect as useEffect54, useState as useState73, useCallback as useCallback59 } from "react";
|
|
20800
|
+
|
|
20801
|
+
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
20802
|
+
import { useMemo as useMemo71 } from "react";
|
|
20803
|
+
|
|
20804
|
+
// src/mantine/blocks/index.ts
|
|
20805
|
+
var blockSpecs = {
|
|
20806
|
+
checkbox: CheckboxBlockSpec,
|
|
20807
|
+
list: ListBlockSpec,
|
|
20808
|
+
enumChecklist: EnumChecklistBlock,
|
|
20809
|
+
overview: OverviewBlock,
|
|
20810
|
+
proposal: ProposalBlockSpec,
|
|
20811
|
+
apiRequest: ApiRequestBlockSpec,
|
|
20812
|
+
notify: NotifyBlockSpec,
|
|
20813
|
+
claim: ClaimBlockSpec,
|
|
20814
|
+
bid: BidBlockSpec,
|
|
20815
|
+
evaluator: EvaluatorBlockSpec,
|
|
20816
|
+
domainCreator: DomainCreatorBlockSpec,
|
|
20817
|
+
email: EmailBlockSpec,
|
|
20818
|
+
visualization: VisualizationBlockSpec,
|
|
20819
|
+
dynamicList: DynamicListBlockSpec,
|
|
20820
|
+
protocolSelector: ProtocolSelectorBlockSpec,
|
|
20821
|
+
form: FormBlockSpec,
|
|
20822
|
+
domainCreatorSign: DomainCreatorSignBlockSpec,
|
|
20823
|
+
domainCardViewer: DomainCardViewerBlockSpec,
|
|
20824
|
+
governanceGroup: GovernanceGroupBlockSpec
|
|
20825
|
+
};
|
|
20826
|
+
var getExtraSlashMenuItems = (editor) => {
|
|
20827
|
+
const slashMenuList = [
|
|
20828
|
+
{
|
|
20829
|
+
title: "Checkbox",
|
|
20830
|
+
onItemClick: () => {
|
|
20831
|
+
editor.insertBlocks(
|
|
20832
|
+
[
|
|
20833
|
+
{
|
|
20834
|
+
type: "checkbox",
|
|
20835
|
+
props: {
|
|
20836
|
+
checked: false,
|
|
20837
|
+
allowedCheckers: "all",
|
|
20838
|
+
initialChecked: false,
|
|
20839
|
+
title: "",
|
|
20840
|
+
description: "",
|
|
20841
|
+
visibility: "all",
|
|
19336
20842
|
dependencies: "",
|
|
19337
20843
|
conditions: ""
|
|
19338
20844
|
}
|
|
@@ -19369,6 +20875,34 @@ var getExtraSlashMenuItems = (editor) => {
|
|
|
19369
20875
|
group: "Domains",
|
|
19370
20876
|
subtext: "Launch a survey-driven domain creation flow"
|
|
19371
20877
|
},
|
|
20878
|
+
{
|
|
20879
|
+
title: "Governance Group",
|
|
20880
|
+
onItemClick: () => {
|
|
20881
|
+
editor.insertBlocks(
|
|
20882
|
+
[
|
|
20883
|
+
{
|
|
20884
|
+
type: "governanceGroup",
|
|
20885
|
+
props: {
|
|
20886
|
+
title: "",
|
|
20887
|
+
description: "",
|
|
20888
|
+
icon: "users",
|
|
20889
|
+
groupType: "",
|
|
20890
|
+
surveySchema: "",
|
|
20891
|
+
answers: "",
|
|
20892
|
+
lastSubmission: "",
|
|
20893
|
+
coreAddress: "",
|
|
20894
|
+
groupAddress: ""
|
|
20895
|
+
}
|
|
20896
|
+
}
|
|
20897
|
+
],
|
|
20898
|
+
editor.getTextCursorPosition().block,
|
|
20899
|
+
"after"
|
|
20900
|
+
);
|
|
20901
|
+
},
|
|
20902
|
+
aliases: ["governance", "group", "dao-group", "multisig", "staking"],
|
|
20903
|
+
group: "DAO",
|
|
20904
|
+
subtext: "Create a governance group (categorical, multisig, or staking)"
|
|
20905
|
+
},
|
|
19372
20906
|
{
|
|
19373
20907
|
title: "List",
|
|
19374
20908
|
onItemClick: () => {
|
|
@@ -19807,15 +21341,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
|
|
|
19807
21341
|
import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
|
|
19808
21342
|
|
|
19809
21343
|
// src/core/hooks/useMatrixProvider.ts
|
|
19810
|
-
import { useEffect as
|
|
21344
|
+
import { useEffect as useEffect55, useState as useState74, useRef as useRef12, useCallback as useCallback60, useMemo as useMemo72 } from "react";
|
|
19811
21345
|
import { MatrixProvider } from "@ixo/matrix-crdt";
|
|
19812
21346
|
function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
19813
|
-
const [matrixProvider, setProvider] =
|
|
19814
|
-
const [status, setStatus] =
|
|
19815
|
-
const isMountedRef =
|
|
19816
|
-
const providerRef =
|
|
19817
|
-
const retryTimeoutRef =
|
|
19818
|
-
const providerOptions =
|
|
21347
|
+
const [matrixProvider, setProvider] = useState74(null);
|
|
21348
|
+
const [status, setStatus] = useState74("disconnected");
|
|
21349
|
+
const isMountedRef = useRef12(true);
|
|
21350
|
+
const providerRef = useRef12(null);
|
|
21351
|
+
const retryTimeoutRef = useRef12(null);
|
|
21352
|
+
const providerOptions = useMemo72(
|
|
19819
21353
|
() => ({
|
|
19820
21354
|
translator: {
|
|
19821
21355
|
updateEventType: "matrix-crdt.doc_update",
|
|
@@ -19828,22 +21362,22 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
19828
21362
|
}),
|
|
19829
21363
|
[]
|
|
19830
21364
|
);
|
|
19831
|
-
const handleDocumentAvailable =
|
|
21365
|
+
const handleDocumentAvailable = useCallback60(() => {
|
|
19832
21366
|
if (isMountedRef.current) {
|
|
19833
21367
|
setStatus("connected");
|
|
19834
21368
|
}
|
|
19835
21369
|
}, []);
|
|
19836
|
-
const handleDocumentUnavailable =
|
|
21370
|
+
const handleDocumentUnavailable = useCallback60(() => {
|
|
19837
21371
|
if (isMountedRef.current) {
|
|
19838
21372
|
setStatus("failed");
|
|
19839
21373
|
}
|
|
19840
21374
|
}, []);
|
|
19841
|
-
const handleCanWriteChanged =
|
|
21375
|
+
const handleCanWriteChanged = useCallback60(() => {
|
|
19842
21376
|
if (isMountedRef.current && providerRef.current) {
|
|
19843
21377
|
setStatus(providerRef.current.canWrite ? "connected" : "failed");
|
|
19844
21378
|
}
|
|
19845
21379
|
}, []);
|
|
19846
|
-
const initProvider =
|
|
21380
|
+
const initProvider = useCallback60(async () => {
|
|
19847
21381
|
if (!isMountedRef.current) return;
|
|
19848
21382
|
if (retryTimeoutRef.current) {
|
|
19849
21383
|
clearTimeout(retryTimeoutRef.current);
|
|
@@ -19876,7 +21410,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
19876
21410
|
}
|
|
19877
21411
|
}
|
|
19878
21412
|
}, [matrixClient, providerOptions, handleDocumentAvailable, handleDocumentUnavailable, handleCanWriteChanged]);
|
|
19879
|
-
|
|
21413
|
+
useEffect55(() => {
|
|
19880
21414
|
isMountedRef.current = true;
|
|
19881
21415
|
initProvider();
|
|
19882
21416
|
return () => {
|
|
@@ -19893,7 +21427,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
19893
21427
|
setStatus("disconnected");
|
|
19894
21428
|
};
|
|
19895
21429
|
}, [initProvider]);
|
|
19896
|
-
|
|
21430
|
+
useEffect55(() => {
|
|
19897
21431
|
return () => {
|
|
19898
21432
|
isMountedRef.current = false;
|
|
19899
21433
|
};
|
|
@@ -19902,17 +21436,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
19902
21436
|
}
|
|
19903
21437
|
|
|
19904
21438
|
// src/mantine/hooks/useCollaborativeYDoc.ts
|
|
19905
|
-
import { useMemo as
|
|
21439
|
+
import { useMemo as useMemo73 } from "react";
|
|
19906
21440
|
import * as Y from "yjs";
|
|
19907
21441
|
function useCollaborativeYDoc(_options) {
|
|
19908
|
-
return
|
|
21442
|
+
return useMemo73(() => {
|
|
19909
21443
|
const doc = new Y.Doc();
|
|
19910
21444
|
return doc;
|
|
19911
21445
|
}, []);
|
|
19912
21446
|
}
|
|
19913
21447
|
|
|
19914
21448
|
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
19915
|
-
import { useMemo as
|
|
21449
|
+
import { useMemo as useMemo74, useEffect as useEffect56, useState as useState75 } from "react";
|
|
19916
21450
|
|
|
19917
21451
|
// src/core/lib/matrixMetadata.ts
|
|
19918
21452
|
var COVER_IMAGE_EVENT_TYPE = "ixo.page.cover_image";
|
|
@@ -20081,7 +21615,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
20081
21615
|
matrixClient,
|
|
20082
21616
|
permissions = { write: false }
|
|
20083
21617
|
} = options || {};
|
|
20084
|
-
const memoizedUser =
|
|
21618
|
+
const memoizedUser = useMemo74(
|
|
20085
21619
|
() => ({
|
|
20086
21620
|
id: user?.id || "",
|
|
20087
21621
|
name: user?.name || "",
|
|
@@ -20096,13 +21630,13 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
20096
21630
|
matrixClient,
|
|
20097
21631
|
roomId: options.roomId
|
|
20098
21632
|
});
|
|
20099
|
-
const metadataManager =
|
|
20100
|
-
|
|
21633
|
+
const metadataManager = useMemo74(() => new MatrixMetadataManager(matrixClient, options.roomId), [matrixClient, options.roomId]);
|
|
21634
|
+
useEffect56(() => {
|
|
20101
21635
|
return () => {
|
|
20102
21636
|
metadataManager.dispose();
|
|
20103
21637
|
};
|
|
20104
21638
|
}, [metadataManager]);
|
|
20105
|
-
const defaultUploadFile =
|
|
21639
|
+
const defaultUploadFile = useMemo74(
|
|
20106
21640
|
() => uploadFile || (async (file) => {
|
|
20107
21641
|
return new Promise((resolve, reject) => {
|
|
20108
21642
|
const reader = new FileReader();
|
|
@@ -20116,7 +21650,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
20116
21650
|
}),
|
|
20117
21651
|
[uploadFile]
|
|
20118
21652
|
);
|
|
20119
|
-
const schema =
|
|
21653
|
+
const schema = useMemo74(
|
|
20120
21654
|
() => BlockNoteSchema2.create({
|
|
20121
21655
|
blockSpecs: {
|
|
20122
21656
|
...defaultBlockSpecs2,
|
|
@@ -20131,13 +21665,13 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
20131
21665
|
}),
|
|
20132
21666
|
[]
|
|
20133
21667
|
);
|
|
20134
|
-
const root =
|
|
20135
|
-
const documentFragment =
|
|
20136
|
-
const flowArray =
|
|
20137
|
-
const runtimeMap =
|
|
20138
|
-
const delegationsMap =
|
|
20139
|
-
const userFragment =
|
|
20140
|
-
const collaborationConfig =
|
|
21668
|
+
const root = useMemo74(() => yDoc.getMap("root"), [yDoc]);
|
|
21669
|
+
const documentFragment = useMemo74(() => yDoc.getXmlFragment("document"), [yDoc]);
|
|
21670
|
+
const flowArray = useMemo74(() => yDoc.getArray("flow"), [yDoc]);
|
|
21671
|
+
const runtimeMap = useMemo74(() => yDoc.getMap("runtime"), [yDoc]);
|
|
21672
|
+
const delegationsMap = useMemo74(() => yDoc.getMap("delegations"), [yDoc]);
|
|
21673
|
+
const userFragment = useMemo74(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
|
|
21674
|
+
const collaborationConfig = useMemo74(
|
|
20141
21675
|
() => ({
|
|
20142
21676
|
provider: matrixProvider,
|
|
20143
21677
|
fragment: documentFragment,
|
|
@@ -20149,7 +21683,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
20149
21683
|
}),
|
|
20150
21684
|
[matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
|
|
20151
21685
|
);
|
|
20152
|
-
const ixoConfig =
|
|
21686
|
+
const ixoConfig = useMemo74(
|
|
20153
21687
|
() => ({
|
|
20154
21688
|
theme,
|
|
20155
21689
|
editable,
|
|
@@ -20168,7 +21702,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
20168
21702
|
uploadFile: defaultUploadFile,
|
|
20169
21703
|
collaboration: collaborationConfig
|
|
20170
21704
|
});
|
|
20171
|
-
const titleText =
|
|
21705
|
+
const titleText = useMemo74(() => yDoc.getText("title"), [yDoc]);
|
|
20172
21706
|
let ixoEditor;
|
|
20173
21707
|
if (editor) {
|
|
20174
21708
|
ixoEditor = editor;
|
|
@@ -20324,12 +21858,12 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
20324
21858
|
return void 0;
|
|
20325
21859
|
};
|
|
20326
21860
|
}
|
|
20327
|
-
|
|
21861
|
+
useEffect56(() => {
|
|
20328
21862
|
if (ixoEditor) {
|
|
20329
21863
|
ixoEditor.isEditable = editable;
|
|
20330
21864
|
}
|
|
20331
21865
|
}, [ixoEditor, editable]);
|
|
20332
|
-
|
|
21866
|
+
useEffect56(() => {
|
|
20333
21867
|
if (connectionStatus !== "connected") {
|
|
20334
21868
|
return;
|
|
20335
21869
|
}
|
|
@@ -20351,9 +21885,9 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
20351
21885
|
titleText.insert(0, options.title);
|
|
20352
21886
|
}
|
|
20353
21887
|
}, [connectionStatus, root, titleText, permissions.write, options.docId, options.title, memoizedUser.id]);
|
|
20354
|
-
const [connectedUsers, setConnectedUsers] =
|
|
21888
|
+
const [connectedUsers, setConnectedUsers] = useState75([]);
|
|
20355
21889
|
const webrtcProvider = matrixProvider?.webrtcProvider;
|
|
20356
|
-
|
|
21890
|
+
useEffect56(() => {
|
|
20357
21891
|
if (!matrixProvider?.awarenessInstance || !webrtcProvider || connectionStatus !== "connected") {
|
|
20358
21892
|
return;
|
|
20359
21893
|
}
|
|
@@ -20372,7 +21906,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
20372
21906
|
awareness.off("change", updateUsers);
|
|
20373
21907
|
};
|
|
20374
21908
|
}, [matrixProvider, webrtcProvider, connectionStatus]);
|
|
20375
|
-
|
|
21909
|
+
useEffect56(() => {
|
|
20376
21910
|
if (!matrixProvider?.awarenessInstance || !webrtcProvider || connectionStatus !== "connected") {
|
|
20377
21911
|
return;
|
|
20378
21912
|
}
|
|
@@ -20410,16 +21944,16 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
20410
21944
|
}
|
|
20411
21945
|
|
|
20412
21946
|
// src/mantine/components/Base/BaseIconPicker.tsx
|
|
20413
|
-
import
|
|
20414
|
-
import { TextInput as TextInput6, Tabs as Tabs5, Box as Box40, Stack as
|
|
21947
|
+
import React216, { useState as useState76, useMemo as useMemo75, useEffect as useEffect57 } from "react";
|
|
21948
|
+
import { TextInput as TextInput6, Tabs as Tabs5, Box as Box40, Stack as Stack138, UnstyledButton as UnstyledButton2, Text as Text114, Center as Center12, ScrollArea as ScrollArea8, Group as Group70, Popover as Popover3 } from "@mantine/core";
|
|
20415
21949
|
import * as TablerIcons from "@tabler/icons-react";
|
|
20416
|
-
import { IconSearch as IconSearch5, IconX as IconX9, IconChevronLeft, IconChevronRight as
|
|
21950
|
+
import { IconSearch as IconSearch5, IconX as IconX9, IconChevronLeft, IconChevronRight as IconChevronRight11 } from "@tabler/icons-react";
|
|
20417
21951
|
|
|
20418
21952
|
// src/mantine/components/Base/CoverImageButton.tsx
|
|
20419
|
-
import
|
|
20420
|
-
import { Button as
|
|
20421
|
-
var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style, ...props }, ref) => /* @__PURE__ */
|
|
20422
|
-
|
|
21953
|
+
import React215, { forwardRef } from "react";
|
|
21954
|
+
import { Button as Button37 } from "@mantine/core";
|
|
21955
|
+
var CoverImageButton = forwardRef(({ isActive = false, onClick, children, style, ...props }, ref) => /* @__PURE__ */ React215.createElement(
|
|
21956
|
+
Button37,
|
|
20423
21957
|
{
|
|
20424
21958
|
ref,
|
|
20425
21959
|
variant: "filled",
|
|
@@ -20468,28 +22002,28 @@ var localStorageService = {
|
|
|
20468
22002
|
var iconsKey = "editor_recent_icons";
|
|
20469
22003
|
var ICONS_PER_PAGE = 500;
|
|
20470
22004
|
function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children, currentIcon }) {
|
|
20471
|
-
const [searchQuery, setSearchQuery] =
|
|
20472
|
-
const [activeTab, setActiveTab] =
|
|
20473
|
-
const [currentPage, setCurrentPage] =
|
|
20474
|
-
const allIcons =
|
|
22005
|
+
const [searchQuery, setSearchQuery] = useState76("");
|
|
22006
|
+
const [activeTab, setActiveTab] = useState76("icons");
|
|
22007
|
+
const [currentPage, setCurrentPage] = useState76(1);
|
|
22008
|
+
const allIcons = useMemo75(() => {
|
|
20475
22009
|
const iconEntries = Object.entries(TablerIcons).filter(([name]) => name.startsWith("Icon") && name !== "IconProps");
|
|
20476
22010
|
return iconEntries;
|
|
20477
22011
|
}, []);
|
|
20478
|
-
const filteredIcons =
|
|
22012
|
+
const filteredIcons = useMemo75(() => {
|
|
20479
22013
|
if (!searchQuery) return allIcons;
|
|
20480
22014
|
const query = searchQuery.toLowerCase();
|
|
20481
22015
|
return allIcons.filter(([name]) => name.toLowerCase().includes(query));
|
|
20482
22016
|
}, [allIcons, searchQuery]);
|
|
20483
|
-
|
|
22017
|
+
useEffect57(() => {
|
|
20484
22018
|
setCurrentPage(1);
|
|
20485
22019
|
}, [searchQuery]);
|
|
20486
|
-
const paginatedIcons =
|
|
22020
|
+
const paginatedIcons = useMemo75(() => {
|
|
20487
22021
|
const startIndex = (currentPage - 1) * ICONS_PER_PAGE;
|
|
20488
22022
|
const endIndex = startIndex + ICONS_PER_PAGE;
|
|
20489
22023
|
return filteredIcons.slice(startIndex, endIndex);
|
|
20490
22024
|
}, [filteredIcons, currentPage]);
|
|
20491
22025
|
const totalPages = Math.ceil(filteredIcons.length / ICONS_PER_PAGE);
|
|
20492
|
-
const recentIcons =
|
|
22026
|
+
const recentIcons = useMemo75(() => {
|
|
20493
22027
|
const recentIconNames = localStorageService.get(iconsKey);
|
|
20494
22028
|
if (!recentIconNames || recentIconNames.length === 0) return [];
|
|
20495
22029
|
return recentIconNames.slice(0, 24).map((iconName) => allIcons.find(([name]) => name === iconName)).filter((entry) => entry !== void 0);
|
|
@@ -20504,9 +22038,9 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
20504
22038
|
};
|
|
20505
22039
|
const renderIconGrid = (icons) => {
|
|
20506
22040
|
if (icons.length === 0) {
|
|
20507
|
-
return /* @__PURE__ */
|
|
22041
|
+
return /* @__PURE__ */ React216.createElement(Center12, { py: "xl" }, /* @__PURE__ */ React216.createElement(Text114, { c: "dimmed", size: "sm" }, "No icons found"));
|
|
20508
22042
|
}
|
|
20509
|
-
return /* @__PURE__ */
|
|
22043
|
+
return /* @__PURE__ */ React216.createElement(
|
|
20510
22044
|
Box40,
|
|
20511
22045
|
{
|
|
20512
22046
|
style: {
|
|
@@ -20518,7 +22052,7 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
20518
22052
|
},
|
|
20519
22053
|
icons.map(([name, IconComponent]) => {
|
|
20520
22054
|
const isSelected = currentIcon === name.replace("Icon", "").replace(/([A-Z])/g, "-$1").toLowerCase().slice(1);
|
|
20521
|
-
return /* @__PURE__ */
|
|
22055
|
+
return /* @__PURE__ */ React216.createElement(
|
|
20522
22056
|
UnstyledButton2,
|
|
20523
22057
|
{
|
|
20524
22058
|
key: name,
|
|
@@ -20544,12 +22078,12 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
20544
22078
|
}
|
|
20545
22079
|
}
|
|
20546
22080
|
},
|
|
20547
|
-
/* @__PURE__ */
|
|
22081
|
+
/* @__PURE__ */ React216.createElement(IconComponent, { color: "white", size: 24, stroke: 1.5 })
|
|
20548
22082
|
);
|
|
20549
22083
|
})
|
|
20550
22084
|
);
|
|
20551
22085
|
};
|
|
20552
|
-
return /* @__PURE__ */
|
|
22086
|
+
return /* @__PURE__ */ React216.createElement(Popover3, { opened, onClose, position: "right", width: 500, shadow: "xl" }, /* @__PURE__ */ React216.createElement(Popover3.Target, null, children), /* @__PURE__ */ React216.createElement(
|
|
20553
22087
|
Popover3.Dropdown,
|
|
20554
22088
|
{
|
|
20555
22089
|
style: {
|
|
@@ -20559,15 +22093,15 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
20559
22093
|
},
|
|
20560
22094
|
p: 0
|
|
20561
22095
|
},
|
|
20562
|
-
/* @__PURE__ */
|
|
22096
|
+
/* @__PURE__ */ React216.createElement(Stack138, { gap: "md", p: "md" }, /* @__PURE__ */ React216.createElement(Tabs5, { value: activeTab, onChange: setActiveTab, variant: "pills" }, /* @__PURE__ */ React216.createElement(Tabs5.List, null, /* @__PURE__ */ React216.createElement(Tabs5.Tab, { value: "icons" }, "Icons"), /* @__PURE__ */ React216.createElement(Tabs5.Tab, { value: "upload" }, "Upload")), /* @__PURE__ */ React216.createElement(Tabs5.Panel, { value: "icons", pt: "md" }, /* @__PURE__ */ React216.createElement(
|
|
20563
22097
|
TextInput6,
|
|
20564
22098
|
{
|
|
20565
22099
|
mb: "md",
|
|
20566
22100
|
placeholder: "Filter",
|
|
20567
|
-
leftSection: /* @__PURE__ */
|
|
22101
|
+
leftSection: /* @__PURE__ */ React216.createElement(IconSearch5, { size: 18 }),
|
|
20568
22102
|
value: searchQuery,
|
|
20569
22103
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
20570
|
-
rightSection: searchQuery && /* @__PURE__ */
|
|
22104
|
+
rightSection: searchQuery && /* @__PURE__ */ React216.createElement(UnstyledButton2, { onClick: () => setSearchQuery("") }, /* @__PURE__ */ React216.createElement(IconX9, { size: 18 })),
|
|
20571
22105
|
style: { flex: 1 },
|
|
20572
22106
|
styles: {
|
|
20573
22107
|
input: {
|
|
@@ -20577,22 +22111,22 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
|
|
|
20577
22111
|
}
|
|
20578
22112
|
}
|
|
20579
22113
|
}
|
|
20580
|
-
), !searchQuery && /* @__PURE__ */
|
|
22114
|
+
), !searchQuery && /* @__PURE__ */ React216.createElement(Box40, { mb: "md" }, /* @__PURE__ */ React216.createElement(Text114, { size: "sm", fw: 500, mb: "xs", px: "xs" }, "Recent"), /* @__PURE__ */ React216.createElement(ScrollArea8.Autosize, { scrollbarSize: 0, mah: 60 }, renderIconGrid(recentIcons))), /* @__PURE__ */ React216.createElement(Box40, null, /* @__PURE__ */ React216.createElement(Group70, { justify: "space-between", mb: "xs", px: "xs" }, /* @__PURE__ */ React216.createElement(Text114, { size: "sm", fw: 500 }, searchQuery ? "Results" : "Icons"), totalPages > 1 && /* @__PURE__ */ React216.createElement(Group70, { gap: "xs" }, /* @__PURE__ */ React216.createElement(Text114, { size: "xs", c: "dimmed" }, "Page ", currentPage, " of ", totalPages, " (", filteredIcons.length, " total)"), /* @__PURE__ */ React216.createElement(BaseButton, { size: "xs", onClick: () => setCurrentPage((p) => Math.max(1, p - 1)), disabled: currentPage === 1, leftSection: /* @__PURE__ */ React216.createElement(IconChevronLeft, { size: 14 }) }, "Prev"), /* @__PURE__ */ React216.createElement(
|
|
20581
22115
|
BaseButton,
|
|
20582
22116
|
{
|
|
20583
22117
|
size: "xs",
|
|
20584
22118
|
onClick: () => setCurrentPage((p) => Math.min(totalPages, p + 1)),
|
|
20585
22119
|
disabled: currentPage === totalPages,
|
|
20586
|
-
leftSection: /* @__PURE__ */
|
|
22120
|
+
leftSection: /* @__PURE__ */ React216.createElement(IconChevronRight11, { size: 14 })
|
|
20587
22121
|
},
|
|
20588
22122
|
"Next"
|
|
20589
|
-
))), /* @__PURE__ */
|
|
22123
|
+
))), /* @__PURE__ */ React216.createElement(ScrollArea8.Autosize, { scrollbarSize: 0, mah: 200 }, renderIconGrid(paginatedIcons)))), /* @__PURE__ */ React216.createElement(Tabs5.Panel, { value: "upload", pt: "md" }, /* @__PURE__ */ React216.createElement(Center12, { py: "xl" }, /* @__PURE__ */ React216.createElement(Stack138, { align: "center", gap: "md" }, /* @__PURE__ */ React216.createElement(Text114, { size: "sm", c: "dimmed", ta: "center" }, "Upload a custom icon image", /* @__PURE__ */ React216.createElement("br", null), "(PNG, JPG, SVG)"), /* @__PURE__ */ React216.createElement(CoverImageButton, { onClick: onUploadClick }, "Choose File"))))))
|
|
20590
22124
|
));
|
|
20591
22125
|
}
|
|
20592
22126
|
|
|
20593
22127
|
// src/mantine/components/CoverImage.tsx
|
|
20594
|
-
import
|
|
20595
|
-
import { Box as Box42, Group as
|
|
22128
|
+
import React218, { useState as useState77, useRef as useRef13, useEffect as useEffect58 } from "react";
|
|
22129
|
+
import { Box as Box42, Group as Group71 } from "@mantine/core";
|
|
20596
22130
|
|
|
20597
22131
|
// src/core/lib/imageTransform.ts
|
|
20598
22132
|
var CLOUDFLARE_CDN_BASE = "https://www.ixo.earth/cdn-cgi/image";
|
|
@@ -20725,12 +22259,12 @@ function transformIconImage(sourceUrl, size = "default", customOptions) {
|
|
|
20725
22259
|
}
|
|
20726
22260
|
|
|
20727
22261
|
// src/mantine/components/Base/PageIcon.tsx
|
|
20728
|
-
import
|
|
22262
|
+
import React217, { useMemo as useMemo76 } from "react";
|
|
20729
22263
|
import { Center as Center13, Box as Box41 } from "@mantine/core";
|
|
20730
22264
|
import * as TablerIcons2 from "@tabler/icons-react";
|
|
20731
22265
|
function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
20732
22266
|
const isIconName = src && !src.startsWith("http");
|
|
20733
|
-
const IconComponent =
|
|
22267
|
+
const IconComponent = useMemo76(() => {
|
|
20734
22268
|
if (!isIconName || !src) return null;
|
|
20735
22269
|
const iconComponent = TablerIcons2[src];
|
|
20736
22270
|
if (iconComponent) {
|
|
@@ -20741,7 +22275,7 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
20741
22275
|
const Container = useCenter ? Center13 : Box41;
|
|
20742
22276
|
if (!src) return null;
|
|
20743
22277
|
if (IconComponent) {
|
|
20744
|
-
return /* @__PURE__ */
|
|
22278
|
+
return /* @__PURE__ */ React217.createElement(
|
|
20745
22279
|
Container,
|
|
20746
22280
|
{
|
|
20747
22281
|
style: {
|
|
@@ -20753,10 +22287,10 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
20753
22287
|
...style
|
|
20754
22288
|
}
|
|
20755
22289
|
},
|
|
20756
|
-
/* @__PURE__ */
|
|
22290
|
+
/* @__PURE__ */ React217.createElement(IconComponent, { size: iconSize, color: "white", stroke: 1.5 })
|
|
20757
22291
|
);
|
|
20758
22292
|
}
|
|
20759
|
-
return /* @__PURE__ */
|
|
22293
|
+
return /* @__PURE__ */ React217.createElement(
|
|
20760
22294
|
"img",
|
|
20761
22295
|
{
|
|
20762
22296
|
src,
|
|
@@ -20777,14 +22311,14 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
20777
22311
|
import { useDisclosure as useDisclosure5 } from "@mantine/hooks";
|
|
20778
22312
|
function CoverImage({ coverImageUrl, logoUrl }) {
|
|
20779
22313
|
const { editor, handlers, editable } = useBlocknoteContext();
|
|
20780
|
-
const [isHovering, setIsHovering] =
|
|
20781
|
-
const [isRepositioning, setIsRepositioning] =
|
|
20782
|
-
const [coverPosition, setCoverPosition] =
|
|
20783
|
-
const coverFileInputRef =
|
|
20784
|
-
const logoFileInputRef =
|
|
22314
|
+
const [isHovering, setIsHovering] = useState77(false);
|
|
22315
|
+
const [isRepositioning, setIsRepositioning] = useState77(false);
|
|
22316
|
+
const [coverPosition, setCoverPosition] = useState77(50);
|
|
22317
|
+
const coverFileInputRef = useRef13(null);
|
|
22318
|
+
const logoFileInputRef = useRef13(null);
|
|
20785
22319
|
const [opened, { open, close }] = useDisclosure5(false);
|
|
20786
|
-
const [metadata, setMetadata] =
|
|
20787
|
-
|
|
22320
|
+
const [metadata, setMetadata] = useState77(() => editor?.getPageMetadata?.() || null);
|
|
22321
|
+
useEffect58(() => {
|
|
20788
22322
|
if (!editor?._metadataManager) {
|
|
20789
22323
|
return;
|
|
20790
22324
|
}
|
|
@@ -20866,7 +22400,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
20866
22400
|
return null;
|
|
20867
22401
|
}
|
|
20868
22402
|
if (!hasCover) {
|
|
20869
|
-
return /* @__PURE__ */
|
|
22403
|
+
return /* @__PURE__ */ React218.createElement(
|
|
20870
22404
|
Box42,
|
|
20871
22405
|
{
|
|
20872
22406
|
style: {
|
|
@@ -20879,8 +22413,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
20879
22413
|
onMouseEnter: () => editable && setIsHovering(true),
|
|
20880
22414
|
onMouseLeave: () => editable && setIsHovering(false)
|
|
20881
22415
|
},
|
|
20882
|
-
/* @__PURE__ */
|
|
20883
|
-
|
|
22416
|
+
/* @__PURE__ */ React218.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "relative", height: "100%" } }, /* @__PURE__ */ React218.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }), /* @__PURE__ */ React218.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }), editable && isHovering && !logoSrc && /* @__PURE__ */ React218.createElement(
|
|
22417
|
+
Group71,
|
|
20884
22418
|
{
|
|
20885
22419
|
gap: "xs",
|
|
20886
22420
|
style: {
|
|
@@ -20890,7 +22424,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
20890
22424
|
zIndex: 10
|
|
20891
22425
|
}
|
|
20892
22426
|
},
|
|
20893
|
-
/* @__PURE__ */
|
|
22427
|
+
/* @__PURE__ */ React218.createElement(
|
|
20894
22428
|
BaseIconPicker,
|
|
20895
22429
|
{
|
|
20896
22430
|
opened,
|
|
@@ -20899,10 +22433,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
20899
22433
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
20900
22434
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
20901
22435
|
},
|
|
20902
|
-
/* @__PURE__ */
|
|
22436
|
+
/* @__PURE__ */ React218.createElement(CoverImageButton, { onClick: open }, "Add icon")
|
|
20903
22437
|
),
|
|
20904
|
-
/* @__PURE__ */
|
|
20905
|
-
), logoSrc && /* @__PURE__ */
|
|
22438
|
+
/* @__PURE__ */ React218.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Add cover")
|
|
22439
|
+
), logoSrc && /* @__PURE__ */ React218.createElement(
|
|
20906
22440
|
Box42,
|
|
20907
22441
|
{
|
|
20908
22442
|
style: {
|
|
@@ -20916,8 +22450,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
20916
22450
|
zIndex: 11
|
|
20917
22451
|
}
|
|
20918
22452
|
},
|
|
20919
|
-
/* @__PURE__ */
|
|
20920
|
-
editable && isHovering && /* @__PURE__ */
|
|
22453
|
+
/* @__PURE__ */ React218.createElement(PageIcon, { src: logoSrc, useCenter: true, iconSize: 64 }),
|
|
22454
|
+
editable && isHovering && /* @__PURE__ */ React218.createElement(
|
|
20921
22455
|
"div",
|
|
20922
22456
|
{
|
|
20923
22457
|
style: {
|
|
@@ -20932,7 +22466,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
20932
22466
|
alignItems: "center"
|
|
20933
22467
|
}
|
|
20934
22468
|
},
|
|
20935
|
-
/* @__PURE__ */
|
|
22469
|
+
/* @__PURE__ */ React218.createElement(
|
|
20936
22470
|
BaseIconPicker,
|
|
20937
22471
|
{
|
|
20938
22472
|
opened,
|
|
@@ -20941,15 +22475,15 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
20941
22475
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
20942
22476
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
20943
22477
|
},
|
|
20944
|
-
/* @__PURE__ */
|
|
22478
|
+
/* @__PURE__ */ React218.createElement(CoverImageButton, { onClick: open }, "Change")
|
|
20945
22479
|
),
|
|
20946
|
-
/* @__PURE__ */
|
|
20947
|
-
/* @__PURE__ */
|
|
22480
|
+
/* @__PURE__ */ React218.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove"),
|
|
22481
|
+
/* @__PURE__ */ React218.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Add cover")
|
|
20948
22482
|
)
|
|
20949
22483
|
))
|
|
20950
22484
|
);
|
|
20951
22485
|
}
|
|
20952
|
-
return /* @__PURE__ */
|
|
22486
|
+
return /* @__PURE__ */ React218.createElement(
|
|
20953
22487
|
Box42,
|
|
20954
22488
|
{
|
|
20955
22489
|
style: {
|
|
@@ -20969,7 +22503,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
20969
22503
|
onMouseMove: handleMouseMove,
|
|
20970
22504
|
onClick: () => isRepositioning && setIsRepositioning(false)
|
|
20971
22505
|
},
|
|
20972
|
-
/* @__PURE__ */
|
|
22506
|
+
/* @__PURE__ */ React218.createElement(
|
|
20973
22507
|
"img",
|
|
20974
22508
|
{
|
|
20975
22509
|
src: coverUrl,
|
|
@@ -20987,8 +22521,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
20987
22521
|
}
|
|
20988
22522
|
}
|
|
20989
22523
|
),
|
|
20990
|
-
editable && isHovering && /* @__PURE__ */
|
|
20991
|
-
|
|
22524
|
+
editable && isHovering && /* @__PURE__ */ React218.createElement(
|
|
22525
|
+
Group71,
|
|
20992
22526
|
{
|
|
20993
22527
|
gap: "xs",
|
|
20994
22528
|
style: {
|
|
@@ -20998,11 +22532,11 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
20998
22532
|
zIndex: 10
|
|
20999
22533
|
}
|
|
21000
22534
|
},
|
|
21001
|
-
/* @__PURE__ */
|
|
21002
|
-
/* @__PURE__ */
|
|
21003
|
-
/* @__PURE__ */
|
|
22535
|
+
/* @__PURE__ */ React218.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Change cover"),
|
|
22536
|
+
/* @__PURE__ */ React218.createElement(CoverImageButton, { onClick: () => setIsRepositioning(!isRepositioning), isActive: isRepositioning }, isRepositioning ? "Done" : "Reposition"),
|
|
22537
|
+
/* @__PURE__ */ React218.createElement(CoverImageButton, { onClick: handleRemoveCover }, "Remove")
|
|
21004
22538
|
),
|
|
21005
|
-
/* @__PURE__ */
|
|
22539
|
+
/* @__PURE__ */ React218.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "absolute", bottom: 0, left: -40, right: 0, height: "70px" } }, /* @__PURE__ */ React218.createElement(
|
|
21006
22540
|
Box42,
|
|
21007
22541
|
{
|
|
21008
22542
|
style: {
|
|
@@ -21014,9 +22548,9 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
21014
22548
|
zIndex: 11
|
|
21015
22549
|
}
|
|
21016
22550
|
},
|
|
21017
|
-
logoSrc && /* @__PURE__ */
|
|
21018
|
-
editable && isHovering && /* @__PURE__ */
|
|
21019
|
-
|
|
22551
|
+
logoSrc && /* @__PURE__ */ React218.createElement(PageIcon, { src: logoSrc, iconSize: 64 }),
|
|
22552
|
+
editable && isHovering && /* @__PURE__ */ React218.createElement(React218.Fragment, null, logoSrc ? /* @__PURE__ */ React218.createElement(
|
|
22553
|
+
Group71,
|
|
21020
22554
|
{
|
|
21021
22555
|
gap: "xs",
|
|
21022
22556
|
style: {
|
|
@@ -21026,7 +22560,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
21026
22560
|
zIndex: 12
|
|
21027
22561
|
}
|
|
21028
22562
|
},
|
|
21029
|
-
/* @__PURE__ */
|
|
22563
|
+
/* @__PURE__ */ React218.createElement(
|
|
21030
22564
|
BaseIconPicker,
|
|
21031
22565
|
{
|
|
21032
22566
|
opened,
|
|
@@ -21035,10 +22569,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
21035
22569
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
21036
22570
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
21037
22571
|
},
|
|
21038
|
-
/* @__PURE__ */
|
|
22572
|
+
/* @__PURE__ */ React218.createElement(CoverImageButton, { onClick: open }, "Change")
|
|
21039
22573
|
),
|
|
21040
|
-
/* @__PURE__ */
|
|
21041
|
-
) : /* @__PURE__ */
|
|
22574
|
+
/* @__PURE__ */ React218.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove")
|
|
22575
|
+
) : /* @__PURE__ */ React218.createElement(
|
|
21042
22576
|
CoverImageButton,
|
|
21043
22577
|
{
|
|
21044
22578
|
onClick: open,
|
|
@@ -21053,13 +22587,13 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
21053
22587
|
"Add icon"
|
|
21054
22588
|
))
|
|
21055
22589
|
)),
|
|
21056
|
-
/* @__PURE__ */
|
|
21057
|
-
/* @__PURE__ */
|
|
22590
|
+
/* @__PURE__ */ React218.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
|
|
22591
|
+
/* @__PURE__ */ React218.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
|
|
21058
22592
|
);
|
|
21059
22593
|
}
|
|
21060
22594
|
|
|
21061
22595
|
// src/mantine/components/PageHeader.tsx
|
|
21062
|
-
import
|
|
22596
|
+
import React219, { useState as useState78, useRef as useRef14, useEffect as useEffect59 } from "react";
|
|
21063
22597
|
function PageHeader({
|
|
21064
22598
|
title = "New page",
|
|
21065
22599
|
icon,
|
|
@@ -21070,9 +22604,9 @@ function PageHeader({
|
|
|
21070
22604
|
isFavorited = false,
|
|
21071
22605
|
menuItems = []
|
|
21072
22606
|
}) {
|
|
21073
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
21074
|
-
const menuRef =
|
|
21075
|
-
|
|
22607
|
+
const [isMenuOpen, setIsMenuOpen] = useState78(false);
|
|
22608
|
+
const menuRef = useRef14(null);
|
|
22609
|
+
useEffect59(() => {
|
|
21076
22610
|
function handleClickOutside(event) {
|
|
21077
22611
|
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
21078
22612
|
setIsMenuOpen(false);
|
|
@@ -21091,14 +22625,14 @@ function PageHeader({
|
|
|
21091
22625
|
setIsMenuOpen(false);
|
|
21092
22626
|
}
|
|
21093
22627
|
};
|
|
21094
|
-
return /* @__PURE__ */
|
|
22628
|
+
return /* @__PURE__ */ React219.createElement("div", { style: styles.container }, /* @__PURE__ */ React219.createElement("div", { style: styles.leftSection }, /* @__PURE__ */ React219.createElement("span", { style: styles.icon }, icon || "\u{1F4C4}"), /* @__PURE__ */ React219.createElement("span", { style: styles.title }, title), isPrivate && /* @__PURE__ */ React219.createElement("button", { style: styles.privacyBadge }, /* @__PURE__ */ React219.createElement("span", { style: styles.lockIcon }, "\u{1F512}"), /* @__PURE__ */ React219.createElement("span", null, "Private"), /* @__PURE__ */ React219.createElement("span", { style: styles.chevron }, "\u25BE"))), /* @__PURE__ */ React219.createElement("div", { style: styles.rightSection }, lastEdited && /* @__PURE__ */ React219.createElement("span", { style: styles.editedText }, lastEdited), onShare && /* @__PURE__ */ React219.createElement("button", { style: styles.shareButton, onClick: onShare }, "Share"), onFavorite && /* @__PURE__ */ React219.createElement("button", { style: styles.iconButton, onClick: onFavorite }, isFavorited ? "\u2605" : "\u2606"), menuItems.length > 0 && /* @__PURE__ */ React219.createElement("div", { style: styles.menuContainer, ref: menuRef }, /* @__PURE__ */ React219.createElement(
|
|
21095
22629
|
"button",
|
|
21096
22630
|
{
|
|
21097
22631
|
style: styles.menuButton,
|
|
21098
22632
|
onClick: () => setIsMenuOpen(!isMenuOpen),
|
|
21099
22633
|
"aria-label": "Menu"
|
|
21100
22634
|
},
|
|
21101
|
-
/* @__PURE__ */
|
|
22635
|
+
/* @__PURE__ */ React219.createElement(
|
|
21102
22636
|
"svg",
|
|
21103
22637
|
{
|
|
21104
22638
|
width: "16",
|
|
@@ -21106,11 +22640,11 @@ function PageHeader({
|
|
|
21106
22640
|
viewBox: "0 0 16 16",
|
|
21107
22641
|
fill: "currentColor"
|
|
21108
22642
|
},
|
|
21109
|
-
/* @__PURE__ */
|
|
21110
|
-
/* @__PURE__ */
|
|
21111
|
-
/* @__PURE__ */
|
|
22643
|
+
/* @__PURE__ */ React219.createElement("circle", { cx: "3", cy: "8", r: "1.5" }),
|
|
22644
|
+
/* @__PURE__ */ React219.createElement("circle", { cx: "8", cy: "8", r: "1.5" }),
|
|
22645
|
+
/* @__PURE__ */ React219.createElement("circle", { cx: "13", cy: "8", r: "1.5" })
|
|
21112
22646
|
)
|
|
21113
|
-
), isMenuOpen && /* @__PURE__ */
|
|
22647
|
+
), isMenuOpen && /* @__PURE__ */ React219.createElement("div", { style: styles.dropdown }, menuItems.map((item, index) => /* @__PURE__ */ React219.createElement(React219.Fragment, { key: index }, item.divider && index > 0 && /* @__PURE__ */ React219.createElement("div", { style: styles.divider }), /* @__PURE__ */ React219.createElement(
|
|
21114
22648
|
"button",
|
|
21115
22649
|
{
|
|
21116
22650
|
style: {
|
|
@@ -21120,8 +22654,8 @@ function PageHeader({
|
|
|
21120
22654
|
onClick: () => handleMenuItemClick(item),
|
|
21121
22655
|
disabled: item.disabled
|
|
21122
22656
|
},
|
|
21123
|
-
item.icon && /* @__PURE__ */
|
|
21124
|
-
/* @__PURE__ */
|
|
22657
|
+
item.icon && /* @__PURE__ */ React219.createElement("span", { style: styles.menuItemIcon }, item.icon),
|
|
22658
|
+
/* @__PURE__ */ React219.createElement("span", null, item.label)
|
|
21125
22659
|
)))))));
|
|
21126
22660
|
}
|
|
21127
22661
|
var styles = {
|
|
@@ -21252,7 +22786,7 @@ var styles = {
|
|
|
21252
22786
|
};
|
|
21253
22787
|
|
|
21254
22788
|
// src/mantine/components/ExternalDropZone.tsx
|
|
21255
|
-
import
|
|
22789
|
+
import React220, { useCallback as useCallback61, useEffect as useEffect60, useRef as useRef15, useState as useState79 } from "react";
|
|
21256
22790
|
import { Box as Box43 } from "@mantine/core";
|
|
21257
22791
|
var SCROLL_ZONE_SIZE = 80;
|
|
21258
22792
|
var SCROLL_SPEED = 12;
|
|
@@ -21265,20 +22799,20 @@ var ExternalDropZone = ({
|
|
|
21265
22799
|
onPlacementCancel,
|
|
21266
22800
|
children
|
|
21267
22801
|
}) => {
|
|
21268
|
-
const containerRef =
|
|
21269
|
-
const [isValidDrag, setIsValidDrag] =
|
|
21270
|
-
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] =
|
|
21271
|
-
const [indicatorStyle, setIndicatorStyle] =
|
|
21272
|
-
const dropPositionRef =
|
|
21273
|
-
const scrollAnimationRef =
|
|
21274
|
-
const scrollDirectionRef =
|
|
21275
|
-
const scrollContainerRef =
|
|
21276
|
-
const getBlockElements =
|
|
22802
|
+
const containerRef = useRef15(null);
|
|
22803
|
+
const [isValidDrag, setIsValidDrag] = useState79(false);
|
|
22804
|
+
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] = useState79(false);
|
|
22805
|
+
const [indicatorStyle, setIndicatorStyle] = useState79({});
|
|
22806
|
+
const dropPositionRef = useRef15(null);
|
|
22807
|
+
const scrollAnimationRef = useRef15(null);
|
|
22808
|
+
const scrollDirectionRef = useRef15(null);
|
|
22809
|
+
const scrollContainerRef = useRef15(null);
|
|
22810
|
+
const getBlockElements = useCallback61(() => {
|
|
21277
22811
|
if (!containerRef.current) return [];
|
|
21278
22812
|
const blocks = containerRef.current.querySelectorAll('[data-node-type="blockContainer"]');
|
|
21279
22813
|
return Array.from(blocks);
|
|
21280
22814
|
}, []);
|
|
21281
|
-
const getScrollContainer =
|
|
22815
|
+
const getScrollContainer = useCallback61(() => {
|
|
21282
22816
|
if (scrollContainerRef.current) return scrollContainerRef.current;
|
|
21283
22817
|
let element = containerRef.current;
|
|
21284
22818
|
while (element) {
|
|
@@ -21293,7 +22827,7 @@ var ExternalDropZone = ({
|
|
|
21293
22827
|
scrollContainerRef.current = window;
|
|
21294
22828
|
return window;
|
|
21295
22829
|
}, []);
|
|
21296
|
-
const performScroll =
|
|
22830
|
+
const performScroll = useCallback61(() => {
|
|
21297
22831
|
const container = getScrollContainer();
|
|
21298
22832
|
const direction = scrollDirectionRef.current;
|
|
21299
22833
|
if (!direction) {
|
|
@@ -21308,7 +22842,7 @@ var ExternalDropZone = ({
|
|
|
21308
22842
|
}
|
|
21309
22843
|
scrollAnimationRef.current = requestAnimationFrame(performScroll);
|
|
21310
22844
|
}, [getScrollContainer]);
|
|
21311
|
-
const startAutoScroll =
|
|
22845
|
+
const startAutoScroll = useCallback61(
|
|
21312
22846
|
(direction) => {
|
|
21313
22847
|
if (scrollDirectionRef.current === direction) return;
|
|
21314
22848
|
scrollDirectionRef.current = direction;
|
|
@@ -21318,14 +22852,14 @@ var ExternalDropZone = ({
|
|
|
21318
22852
|
},
|
|
21319
22853
|
[performScroll]
|
|
21320
22854
|
);
|
|
21321
|
-
const stopAutoScroll =
|
|
22855
|
+
const stopAutoScroll = useCallback61(() => {
|
|
21322
22856
|
scrollDirectionRef.current = null;
|
|
21323
22857
|
if (scrollAnimationRef.current) {
|
|
21324
22858
|
cancelAnimationFrame(scrollAnimationRef.current);
|
|
21325
22859
|
scrollAnimationRef.current = null;
|
|
21326
22860
|
}
|
|
21327
22861
|
}, []);
|
|
21328
|
-
const checkAutoScroll =
|
|
22862
|
+
const checkAutoScroll = useCallback61(
|
|
21329
22863
|
(clientY) => {
|
|
21330
22864
|
const container = getScrollContainer();
|
|
21331
22865
|
let containerTop;
|
|
@@ -21348,7 +22882,7 @@ var ExternalDropZone = ({
|
|
|
21348
22882
|
},
|
|
21349
22883
|
[getScrollContainer, startAutoScroll, stopAutoScroll]
|
|
21350
22884
|
);
|
|
21351
|
-
const findDropPosition =
|
|
22885
|
+
const findDropPosition = useCallback61(
|
|
21352
22886
|
(clientY) => {
|
|
21353
22887
|
const blocks = getBlockElements();
|
|
21354
22888
|
if (blocks.length === 0 || !editor?.document) return null;
|
|
@@ -21381,7 +22915,7 @@ var ExternalDropZone = ({
|
|
|
21381
22915
|
},
|
|
21382
22916
|
[getBlockElements, editor]
|
|
21383
22917
|
);
|
|
21384
|
-
const handleDragOver =
|
|
22918
|
+
const handleDragOver = useCallback61(
|
|
21385
22919
|
(e) => {
|
|
21386
22920
|
if (!e.dataTransfer.types.includes(acceptedType)) return;
|
|
21387
22921
|
e.preventDefault();
|
|
@@ -21404,7 +22938,7 @@ var ExternalDropZone = ({
|
|
|
21404
22938
|
},
|
|
21405
22939
|
[acceptedType, findDropPosition, checkAutoScroll]
|
|
21406
22940
|
);
|
|
21407
|
-
const handleDragLeave =
|
|
22941
|
+
const handleDragLeave = useCallback61(
|
|
21408
22942
|
(e) => {
|
|
21409
22943
|
if (containerRef.current && !containerRef.current.contains(e.relatedTarget)) {
|
|
21410
22944
|
setIsValidDrag(false);
|
|
@@ -21414,7 +22948,7 @@ var ExternalDropZone = ({
|
|
|
21414
22948
|
},
|
|
21415
22949
|
[stopAutoScroll]
|
|
21416
22950
|
);
|
|
21417
|
-
const handleDrop =
|
|
22951
|
+
const handleDrop = useCallback61(
|
|
21418
22952
|
(e) => {
|
|
21419
22953
|
e.preventDefault();
|
|
21420
22954
|
e.stopPropagation();
|
|
@@ -21428,7 +22962,7 @@ var ExternalDropZone = ({
|
|
|
21428
22962
|
},
|
|
21429
22963
|
[onDrop, stopAutoScroll]
|
|
21430
22964
|
);
|
|
21431
|
-
|
|
22965
|
+
useEffect60(() => {
|
|
21432
22966
|
const handleGlobalDragEnd = () => {
|
|
21433
22967
|
setIsValidDrag(false);
|
|
21434
22968
|
dropPositionRef.current = null;
|
|
@@ -21437,7 +22971,7 @@ var ExternalDropZone = ({
|
|
|
21437
22971
|
window.addEventListener("dragend", handleGlobalDragEnd);
|
|
21438
22972
|
return () => window.removeEventListener("dragend", handleGlobalDragEnd);
|
|
21439
22973
|
}, [stopAutoScroll]);
|
|
21440
|
-
const handleOverlayMouseMove =
|
|
22974
|
+
const handleOverlayMouseMove = useCallback61(
|
|
21441
22975
|
(e) => {
|
|
21442
22976
|
setIsHoveringInPlacementMode(true);
|
|
21443
22977
|
checkAutoScroll(e.clientY);
|
|
@@ -21456,12 +22990,12 @@ var ExternalDropZone = ({
|
|
|
21456
22990
|
},
|
|
21457
22991
|
[findDropPosition, checkAutoScroll]
|
|
21458
22992
|
);
|
|
21459
|
-
const handleOverlayMouseLeave =
|
|
22993
|
+
const handleOverlayMouseLeave = useCallback61(() => {
|
|
21460
22994
|
setIsHoveringInPlacementMode(false);
|
|
21461
22995
|
dropPositionRef.current = null;
|
|
21462
22996
|
stopAutoScroll();
|
|
21463
22997
|
}, [stopAutoScroll]);
|
|
21464
|
-
const handleOverlayClick =
|
|
22998
|
+
const handleOverlayClick = useCallback61(
|
|
21465
22999
|
(e) => {
|
|
21466
23000
|
e.preventDefault();
|
|
21467
23001
|
e.stopPropagation();
|
|
@@ -21475,7 +23009,7 @@ var ExternalDropZone = ({
|
|
|
21475
23009
|
},
|
|
21476
23010
|
[onDrop, stopAutoScroll]
|
|
21477
23011
|
);
|
|
21478
|
-
const handleOverlayWheel =
|
|
23012
|
+
const handleOverlayWheel = useCallback61(
|
|
21479
23013
|
(e) => {
|
|
21480
23014
|
const container = getScrollContainer();
|
|
21481
23015
|
if (container === window) {
|
|
@@ -21486,7 +23020,7 @@ var ExternalDropZone = ({
|
|
|
21486
23020
|
},
|
|
21487
23021
|
[getScrollContainer]
|
|
21488
23022
|
);
|
|
21489
|
-
|
|
23023
|
+
useEffect60(() => {
|
|
21490
23024
|
if (!isPlacementMode) return;
|
|
21491
23025
|
const handleKeyDown = (e) => {
|
|
21492
23026
|
if (e.key === "Escape") {
|
|
@@ -21509,13 +23043,13 @@ var ExternalDropZone = ({
|
|
|
21509
23043
|
document.removeEventListener("click", handleGlobalClick, true);
|
|
21510
23044
|
};
|
|
21511
23045
|
}, [isPlacementMode, onPlacementCancel]);
|
|
21512
|
-
|
|
23046
|
+
useEffect60(() => {
|
|
21513
23047
|
if (!isPlacementMode) {
|
|
21514
23048
|
setIsHoveringInPlacementMode(false);
|
|
21515
23049
|
dropPositionRef.current = null;
|
|
21516
23050
|
}
|
|
21517
23051
|
}, [isPlacementMode]);
|
|
21518
|
-
|
|
23052
|
+
useEffect60(() => {
|
|
21519
23053
|
const isActive = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
21520
23054
|
if (isActive) {
|
|
21521
23055
|
document.body.classList.add("external-artifact-drag-active");
|
|
@@ -21526,18 +23060,18 @@ var ExternalDropZone = ({
|
|
|
21526
23060
|
document.body.classList.remove("external-artifact-drag-active");
|
|
21527
23061
|
};
|
|
21528
23062
|
}, [isValidDrag, isPlacementMode, isHoveringInPlacementMode]);
|
|
21529
|
-
|
|
23063
|
+
useEffect60(() => {
|
|
21530
23064
|
return () => {
|
|
21531
23065
|
if (scrollAnimationRef.current) {
|
|
21532
23066
|
cancelAnimationFrame(scrollAnimationRef.current);
|
|
21533
23067
|
}
|
|
21534
23068
|
};
|
|
21535
23069
|
}, []);
|
|
21536
|
-
const indicatorWithPosition = dropIndicator &&
|
|
23070
|
+
const indicatorWithPosition = dropIndicator && React220.isValidElement(dropIndicator) ? React220.cloneElement(dropIndicator, {
|
|
21537
23071
|
indicatorTop: typeof indicatorStyle.top === "number" ? indicatorStyle.top : void 0
|
|
21538
23072
|
}) : dropIndicator;
|
|
21539
23073
|
const shouldShowIndicator = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
21540
|
-
return /* @__PURE__ */
|
|
23074
|
+
return /* @__PURE__ */ React220.createElement(
|
|
21541
23075
|
Box43,
|
|
21542
23076
|
{
|
|
21543
23077
|
ref: containerRef,
|
|
@@ -21553,7 +23087,7 @@ var ExternalDropZone = ({
|
|
|
21553
23087
|
"data-placement-mode": isPlacementMode ? "true" : void 0
|
|
21554
23088
|
},
|
|
21555
23089
|
children,
|
|
21556
|
-
isPlacementMode && /* @__PURE__ */
|
|
23090
|
+
isPlacementMode && /* @__PURE__ */ React220.createElement(
|
|
21557
23091
|
Box43,
|
|
21558
23092
|
{
|
|
21559
23093
|
style: {
|
|
@@ -21573,19 +23107,19 @@ var ExternalDropZone = ({
|
|
|
21573
23107
|
onWheel: handleOverlayWheel
|
|
21574
23108
|
}
|
|
21575
23109
|
),
|
|
21576
|
-
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */
|
|
23110
|
+
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */ React220.createElement(Box43, { style: { ...indicatorStyle, background: "none", border: "none", boxShadow: "none" } }, indicatorWithPosition)
|
|
21577
23111
|
);
|
|
21578
23112
|
};
|
|
21579
23113
|
|
|
21580
23114
|
// src/mantine/IxoEditor.tsx
|
|
21581
|
-
import
|
|
23115
|
+
import React222 from "react";
|
|
21582
23116
|
import { getDefaultReactSlashMenuItems, SuggestionMenuController } from "@blocknote/react";
|
|
21583
23117
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
21584
23118
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
21585
23119
|
import { MantineProvider } from "@mantine/core";
|
|
21586
23120
|
|
|
21587
23121
|
// src/mantine/components/PanelContent.tsx
|
|
21588
|
-
import
|
|
23122
|
+
import React221 from "react";
|
|
21589
23123
|
import { Box as Box44 } from "@mantine/core";
|
|
21590
23124
|
var panelStyles = {
|
|
21591
23125
|
light: {
|
|
@@ -21615,7 +23149,7 @@ function PanelContent({ theme }) {
|
|
|
21615
23149
|
const { activePanel, registeredPanels } = usePanelStore();
|
|
21616
23150
|
const isOpen = activePanel !== null;
|
|
21617
23151
|
const content = activePanel ? registeredPanels.get(activePanel) : null;
|
|
21618
|
-
return /* @__PURE__ */
|
|
23152
|
+
return /* @__PURE__ */ React221.createElement(
|
|
21619
23153
|
Box44,
|
|
21620
23154
|
{
|
|
21621
23155
|
pos: "sticky",
|
|
@@ -21656,7 +23190,7 @@ function IxoEditorContent({
|
|
|
21656
23190
|
}) {
|
|
21657
23191
|
const { activePanel } = usePanelStore();
|
|
21658
23192
|
const isPanelOpen = activePanel !== null;
|
|
21659
|
-
const editorContent = /* @__PURE__ */
|
|
23193
|
+
const editorContent = /* @__PURE__ */ React222.createElement(
|
|
21660
23194
|
BlockNoteView,
|
|
21661
23195
|
{
|
|
21662
23196
|
editor,
|
|
@@ -21671,7 +23205,7 @@ function IxoEditorContent({
|
|
|
21671
23205
|
onChange,
|
|
21672
23206
|
onSelectionChange
|
|
21673
23207
|
},
|
|
21674
|
-
config.slashMenu && /* @__PURE__ */
|
|
23208
|
+
config.slashMenu && /* @__PURE__ */ React222.createElement(
|
|
21675
23209
|
SuggestionMenuController,
|
|
21676
23210
|
{
|
|
21677
23211
|
triggerCharacter: "/",
|
|
@@ -21684,7 +23218,7 @@ function IxoEditorContent({
|
|
|
21684
23218
|
),
|
|
21685
23219
|
children
|
|
21686
23220
|
);
|
|
21687
|
-
return /* @__PURE__ */
|
|
23221
|
+
return /* @__PURE__ */ React222.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React222.createElement(
|
|
21688
23222
|
"div",
|
|
21689
23223
|
{
|
|
21690
23224
|
className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`,
|
|
@@ -21693,9 +23227,9 @@ function IxoEditorContent({
|
|
|
21693
23227
|
transition: "width 0.2s ease"
|
|
21694
23228
|
}
|
|
21695
23229
|
},
|
|
21696
|
-
selfNav && /* @__PURE__ */
|
|
21697
|
-
/* @__PURE__ */
|
|
21698
|
-
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */
|
|
23230
|
+
selfNav && /* @__PURE__ */ React222.createElement(PageHeader, { ...pageHeaderProps }),
|
|
23231
|
+
/* @__PURE__ */ React222.createElement(CoverImage, { coverImageUrl, logoUrl }),
|
|
23232
|
+
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */ React222.createElement(
|
|
21699
23233
|
ExternalDropZone,
|
|
21700
23234
|
{
|
|
21701
23235
|
editor,
|
|
@@ -21708,7 +23242,7 @@ function IxoEditorContent({
|
|
|
21708
23242
|
},
|
|
21709
23243
|
editorContent
|
|
21710
23244
|
) : editorContent
|
|
21711
|
-
), isPanelVisible && /* @__PURE__ */
|
|
23245
|
+
), isPanelVisible && /* @__PURE__ */ React222.createElement(PanelContent, { theme: config.theme }));
|
|
21712
23246
|
}
|
|
21713
23247
|
function IxoEditor({
|
|
21714
23248
|
editor,
|
|
@@ -21748,7 +23282,7 @@ function IxoEditor({
|
|
|
21748
23282
|
tableHandles: true
|
|
21749
23283
|
};
|
|
21750
23284
|
const isEditable = editable;
|
|
21751
|
-
const editorContent = /* @__PURE__ */
|
|
23285
|
+
const editorContent = /* @__PURE__ */ React222.createElement(
|
|
21752
23286
|
BlocknoteProvider,
|
|
21753
23287
|
{
|
|
21754
23288
|
editor,
|
|
@@ -21760,7 +23294,7 @@ function IxoEditor({
|
|
|
21760
23294
|
dynamicListPanelRenderer,
|
|
21761
23295
|
domainCardRenderer
|
|
21762
23296
|
},
|
|
21763
|
-
/* @__PURE__ */
|
|
23297
|
+
/* @__PURE__ */ React222.createElement(
|
|
21764
23298
|
IxoEditorContent,
|
|
21765
23299
|
{
|
|
21766
23300
|
isPanelVisible,
|
|
@@ -21784,15 +23318,15 @@ function IxoEditor({
|
|
|
21784
23318
|
)
|
|
21785
23319
|
);
|
|
21786
23320
|
if (mantineTheme) {
|
|
21787
|
-
return /* @__PURE__ */
|
|
23321
|
+
return /* @__PURE__ */ React222.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
|
|
21788
23322
|
}
|
|
21789
23323
|
return editorContent;
|
|
21790
23324
|
}
|
|
21791
23325
|
|
|
21792
23326
|
// src/mantine/components/EntitySigningSetup.tsx
|
|
21793
|
-
import
|
|
21794
|
-
import { Modal as Modal3, Stack as
|
|
21795
|
-
import { IconAlertCircle as
|
|
23327
|
+
import React223, { useState as useState80 } from "react";
|
|
23328
|
+
import { Modal as Modal3, Stack as Stack139, Text as Text115, TextInput as TextInput7, Button as Button38, Alert as Alert30, Group as Group72 } from "@mantine/core";
|
|
23329
|
+
import { IconAlertCircle as IconAlertCircle15, IconCheck as IconCheck11, IconKey as IconKey2 } from "@tabler/icons-react";
|
|
21796
23330
|
var EntitySigningSetup = ({
|
|
21797
23331
|
opened,
|
|
21798
23332
|
onClose,
|
|
@@ -21800,11 +23334,11 @@ var EntitySigningSetup = ({
|
|
|
21800
23334
|
entityName,
|
|
21801
23335
|
onSetup
|
|
21802
23336
|
}) => {
|
|
21803
|
-
const [pin, setPin] =
|
|
21804
|
-
const [confirmPin, setConfirmPin] =
|
|
21805
|
-
const [loading, setLoading] =
|
|
21806
|
-
const [error, setError] =
|
|
21807
|
-
const [success, setSuccess] =
|
|
23337
|
+
const [pin, setPin] = useState80("");
|
|
23338
|
+
const [confirmPin, setConfirmPin] = useState80("");
|
|
23339
|
+
const [loading, setLoading] = useState80(false);
|
|
23340
|
+
const [error, setError] = useState80(null);
|
|
23341
|
+
const [success, setSuccess] = useState80(false);
|
|
21808
23342
|
const handleSetup = async () => {
|
|
21809
23343
|
if (pin.length < 4) {
|
|
21810
23344
|
setError("PIN must be at least 4 characters");
|
|
@@ -21844,15 +23378,15 @@ var EntitySigningSetup = ({
|
|
|
21844
23378
|
setSuccess(false);
|
|
21845
23379
|
}
|
|
21846
23380
|
};
|
|
21847
|
-
return /* @__PURE__ */
|
|
23381
|
+
return /* @__PURE__ */ React223.createElement(
|
|
21848
23382
|
Modal3,
|
|
21849
23383
|
{
|
|
21850
23384
|
opened,
|
|
21851
23385
|
onClose: handleClose,
|
|
21852
|
-
title: /* @__PURE__ */
|
|
23386
|
+
title: /* @__PURE__ */ React223.createElement(Group72, { gap: "xs" }, /* @__PURE__ */ React223.createElement(IconKey2, { size: 20 }), /* @__PURE__ */ React223.createElement(Text115, { fw: 600 }, "Entity Signing Setup")),
|
|
21853
23387
|
size: "md"
|
|
21854
23388
|
},
|
|
21855
|
-
/* @__PURE__ */
|
|
23389
|
+
/* @__PURE__ */ React223.createElement(Stack139, { gap: "md" }, success ? /* @__PURE__ */ React223.createElement(Alert30, { color: "green", icon: /* @__PURE__ */ React223.createElement(IconCheck11, { size: 16 }) }, "Entity signing key set up successfully!") : /* @__PURE__ */ React223.createElement(React223.Fragment, null, /* @__PURE__ */ React223.createElement(Text115, { size: "sm", c: "dimmed" }, "Flow authorization requires a signing key for", " ", /* @__PURE__ */ React223.createElement(Text115, { span: true, fw: 500 }, entityName || entityDid), "."), /* @__PURE__ */ React223.createElement(Alert30, { color: "blue", variant: "light" }, /* @__PURE__ */ React223.createElement(Text115, { size: "sm" }, "This is a ", /* @__PURE__ */ React223.createElement("strong", null, "one-time setup"), " that allows flows to grant permissions without requiring wallet signatures for each delegation.")), /* @__PURE__ */ React223.createElement(Stack139, { gap: "xs" }, /* @__PURE__ */ React223.createElement(Text115, { size: "sm", fw: 500 }, "What happens:"), /* @__PURE__ */ React223.createElement(Text115, { size: "sm", c: "dimmed" }, "1. A new signing key is generated"), /* @__PURE__ */ React223.createElement(Text115, { size: "sm", c: "dimmed" }, "2. Key is registered on the entity's DID document (requires wallet)"), /* @__PURE__ */ React223.createElement(Text115, { size: "sm", c: "dimmed" }, "3. Key is stored encrypted in the entity's Matrix room")), /* @__PURE__ */ React223.createElement(
|
|
21856
23390
|
TextInput7,
|
|
21857
23391
|
{
|
|
21858
23392
|
label: "Enter PIN to encrypt signing key",
|
|
@@ -21863,7 +23397,7 @@ var EntitySigningSetup = ({
|
|
|
21863
23397
|
onChange: (e) => setPin(e.currentTarget.value),
|
|
21864
23398
|
disabled: loading
|
|
21865
23399
|
}
|
|
21866
|
-
), /* @__PURE__ */
|
|
23400
|
+
), /* @__PURE__ */ React223.createElement(
|
|
21867
23401
|
TextInput7,
|
|
21868
23402
|
{
|
|
21869
23403
|
label: "Confirm PIN",
|
|
@@ -21873,12 +23407,12 @@ var EntitySigningSetup = ({
|
|
|
21873
23407
|
onChange: (e) => setConfirmPin(e.currentTarget.value),
|
|
21874
23408
|
disabled: loading
|
|
21875
23409
|
}
|
|
21876
|
-
), error && /* @__PURE__ */
|
|
21877
|
-
|
|
23410
|
+
), error && /* @__PURE__ */ React223.createElement(Alert30, { color: "red", icon: /* @__PURE__ */ React223.createElement(IconAlertCircle15, { size: 16 }) }, error), /* @__PURE__ */ React223.createElement(Group72, { justify: "flex-end", mt: "md" }, /* @__PURE__ */ React223.createElement(Button38, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React223.createElement(
|
|
23411
|
+
Button38,
|
|
21878
23412
|
{
|
|
21879
23413
|
onClick: handleSetup,
|
|
21880
23414
|
loading,
|
|
21881
|
-
leftSection: /* @__PURE__ */
|
|
23415
|
+
leftSection: /* @__PURE__ */ React223.createElement(IconKey2, { size: 16 })
|
|
21882
23416
|
},
|
|
21883
23417
|
"Setup Entity Signing"
|
|
21884
23418
|
))))
|
|
@@ -21886,9 +23420,9 @@ var EntitySigningSetup = ({
|
|
|
21886
23420
|
};
|
|
21887
23421
|
|
|
21888
23422
|
// src/mantine/components/FlowPermissionsPanel.tsx
|
|
21889
|
-
import
|
|
21890
|
-
import { Stack as
|
|
21891
|
-
import { IconPlus as
|
|
23423
|
+
import React224, { useState as useState81, useEffect as useEffect61, useMemo as useMemo77 } from "react";
|
|
23424
|
+
import { Stack as Stack140, Text as Text116, Paper as Paper18, Group as Group73, Badge as Badge38, Button as Button39, ActionIcon as ActionIcon32, Loader as Loader27, Alert as Alert31, Divider as Divider15 } from "@mantine/core";
|
|
23425
|
+
import { IconPlus as IconPlus6, IconTrash as IconTrash7, IconShieldCheck as IconShieldCheck2, IconUser as IconUser5, IconRobot as IconRobot4, IconBuilding } from "@tabler/icons-react";
|
|
21892
23426
|
var FlowPermissionsPanel = ({
|
|
21893
23427
|
editor,
|
|
21894
23428
|
entityDid,
|
|
@@ -21897,11 +23431,11 @@ var FlowPermissionsPanel = ({
|
|
|
21897
23431
|
onRevokePermission,
|
|
21898
23432
|
getUserDisplayName
|
|
21899
23433
|
}) => {
|
|
21900
|
-
const [delegations, setDelegations] =
|
|
21901
|
-
const [loading, setLoading] =
|
|
21902
|
-
const [revoking, setRevoking] =
|
|
21903
|
-
const rootCapability =
|
|
21904
|
-
|
|
23434
|
+
const [delegations, setDelegations] = useState81([]);
|
|
23435
|
+
const [loading, setLoading] = useState81(true);
|
|
23436
|
+
const [revoking, setRevoking] = useState81(null);
|
|
23437
|
+
const rootCapability = useMemo77(() => editor.getRootCapability?.(), [editor]);
|
|
23438
|
+
useEffect61(() => {
|
|
21905
23439
|
const loadDelegations = async () => {
|
|
21906
23440
|
setLoading(true);
|
|
21907
23441
|
const allDelegations = editor.getAllDelegations?.() || [];
|
|
@@ -21940,11 +23474,11 @@ var FlowPermissionsPanel = ({
|
|
|
21940
23474
|
const getIcon2 = (type) => {
|
|
21941
23475
|
switch (type) {
|
|
21942
23476
|
case "oracle":
|
|
21943
|
-
return /* @__PURE__ */
|
|
23477
|
+
return /* @__PURE__ */ React224.createElement(IconRobot4, { size: 16 });
|
|
21944
23478
|
case "entity":
|
|
21945
|
-
return /* @__PURE__ */
|
|
23479
|
+
return /* @__PURE__ */ React224.createElement(IconBuilding, { size: 16 });
|
|
21946
23480
|
default:
|
|
21947
|
-
return /* @__PURE__ */
|
|
23481
|
+
return /* @__PURE__ */ React224.createElement(IconUser5, { size: 16 });
|
|
21948
23482
|
}
|
|
21949
23483
|
};
|
|
21950
23484
|
const formatCapabilities = (caps) => {
|
|
@@ -21963,8 +23497,8 @@ var FlowPermissionsPanel = ({
|
|
|
21963
23497
|
if (date < /* @__PURE__ */ new Date()) return "Expired";
|
|
21964
23498
|
return date.toLocaleDateString();
|
|
21965
23499
|
};
|
|
21966
|
-
return /* @__PURE__ */
|
|
21967
|
-
|
|
23500
|
+
return /* @__PURE__ */ React224.createElement(Stack140, { gap: "md" }, /* @__PURE__ */ React224.createElement(Stack140, { gap: "xs" }, /* @__PURE__ */ React224.createElement(Text116, { fw: 600, size: "sm" }, "Root Authority"), /* @__PURE__ */ React224.createElement(Paper18, { p: "sm", withBorder: true }, /* @__PURE__ */ React224.createElement(Group73, { gap: "xs" }, /* @__PURE__ */ React224.createElement(IconShieldCheck2, { size: 20, color: "var(--mantine-color-green-6)" }), /* @__PURE__ */ React224.createElement(Stack140, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React224.createElement(Text116, { size: "sm", fw: 500 }, entityName || entityDid), /* @__PURE__ */ React224.createElement(Text116, { size: "xs", c: "dimmed" }, rootCapability ? `Granted: ${new Date(rootCapability.issuedAt).toLocaleDateString()}` : "Root capability not set up")), /* @__PURE__ */ React224.createElement(Badge38, { color: "green", variant: "light" }, "Entity")))), /* @__PURE__ */ React224.createElement(Divider15, { label: "Delegated Permissions", labelPosition: "center" }), loading ? /* @__PURE__ */ React224.createElement(Group73, { justify: "center", py: "xl" }, /* @__PURE__ */ React224.createElement(Loader27, { size: "sm" })) : delegations.length === 0 ? /* @__PURE__ */ React224.createElement(Alert31, { color: "gray", variant: "light" }, /* @__PURE__ */ React224.createElement(Text116, { size: "sm" }, "No permissions have been granted yet.")) : /* @__PURE__ */ React224.createElement(Stack140, { gap: "xs" }, delegations.map(({ capability, displayName, type }) => /* @__PURE__ */ React224.createElement(Paper18, { key: capability.id, p: "sm", withBorder: true }, /* @__PURE__ */ React224.createElement(Group73, { justify: "space-between" }, /* @__PURE__ */ React224.createElement(Group73, { gap: "xs" }, getIcon2(type), /* @__PURE__ */ React224.createElement(Stack140, { gap: 2 }, /* @__PURE__ */ React224.createElement(Text116, { size: "sm", fw: 500 }, displayName), /* @__PURE__ */ React224.createElement(Text116, { size: "xs", c: "dimmed" }, formatCapabilities(capability.capabilities)), /* @__PURE__ */ React224.createElement(Group73, { gap: "xs" }, /* @__PURE__ */ React224.createElement(Text116, { size: "xs", c: "dimmed" }, "Expires: ", formatExpiration(capability.expiration)), /* @__PURE__ */ React224.createElement(Text116, { size: "xs", c: "dimmed" }, "\u2022"), /* @__PURE__ */ React224.createElement(Text116, { size: "xs", c: "dimmed" }, "Granted by: ", capability.issuer === entityDid ? "Entity" : capability.issuer.slice(-8))))), /* @__PURE__ */ React224.createElement(
|
|
23501
|
+
ActionIcon32,
|
|
21968
23502
|
{
|
|
21969
23503
|
color: "red",
|
|
21970
23504
|
variant: "subtle",
|
|
@@ -21972,11 +23506,11 @@ var FlowPermissionsPanel = ({
|
|
|
21972
23506
|
loading: revoking === capability.id,
|
|
21973
23507
|
disabled: !!revoking
|
|
21974
23508
|
},
|
|
21975
|
-
/* @__PURE__ */
|
|
21976
|
-
))))), /* @__PURE__ */
|
|
21977
|
-
|
|
23509
|
+
/* @__PURE__ */ React224.createElement(IconTrash7, { size: 16 })
|
|
23510
|
+
))))), /* @__PURE__ */ React224.createElement(
|
|
23511
|
+
Button39,
|
|
21978
23512
|
{
|
|
21979
|
-
leftSection: /* @__PURE__ */
|
|
23513
|
+
leftSection: /* @__PURE__ */ React224.createElement(IconPlus6, { size: 16 }),
|
|
21980
23514
|
variant: "light",
|
|
21981
23515
|
onClick: onGrantPermission
|
|
21982
23516
|
},
|
|
@@ -21985,21 +23519,21 @@ var FlowPermissionsPanel = ({
|
|
|
21985
23519
|
};
|
|
21986
23520
|
|
|
21987
23521
|
// src/mantine/components/GrantPermissionModal.tsx
|
|
21988
|
-
import
|
|
23522
|
+
import React225, { useState as useState82, useCallback as useCallback62 } from "react";
|
|
21989
23523
|
import {
|
|
21990
23524
|
Modal as Modal4,
|
|
21991
|
-
Stack as
|
|
21992
|
-
Text as
|
|
23525
|
+
Stack as Stack141,
|
|
23526
|
+
Text as Text117,
|
|
21993
23527
|
TextInput as TextInput8,
|
|
21994
|
-
Button as
|
|
21995
|
-
Group as
|
|
23528
|
+
Button as Button40,
|
|
23529
|
+
Group as Group74,
|
|
21996
23530
|
Radio as Radio6,
|
|
21997
23531
|
Checkbox as Checkbox12,
|
|
21998
|
-
Alert as
|
|
23532
|
+
Alert as Alert32,
|
|
21999
23533
|
Paper as Paper19,
|
|
22000
|
-
Loader as
|
|
22001
|
-
Badge as
|
|
22002
|
-
ActionIcon as
|
|
23534
|
+
Loader as Loader28,
|
|
23535
|
+
Badge as Badge39,
|
|
23536
|
+
ActionIcon as ActionIcon33,
|
|
22003
23537
|
Divider as Divider16,
|
|
22004
23538
|
NumberInput as NumberInput3
|
|
22005
23539
|
} from "@mantine/core";
|
|
@@ -22017,21 +23551,21 @@ var GrantPermissionModal = ({
|
|
|
22017
23551
|
const singleBlockMode = !!targetBlockId || blocks.length === 1;
|
|
22018
23552
|
const fixedBlockId = targetBlockId || (blocks.length === 1 ? blocks[0].id : null);
|
|
22019
23553
|
const fixedBlock = fixedBlockId ? blocks.find((b) => b.id === fixedBlockId) || blocks[0] : null;
|
|
22020
|
-
const [recipientType, setRecipientType] =
|
|
22021
|
-
const [searchQuery, setSearchQuery] =
|
|
22022
|
-
const [searchResults, setSearchResults] =
|
|
22023
|
-
const [searching, setSearching] =
|
|
22024
|
-
const [selectedRecipient, setSelectedRecipient] =
|
|
22025
|
-
const [manualDid, setManualDid] =
|
|
22026
|
-
const [scopeType, setScopeType] =
|
|
22027
|
-
const [selectedBlocks, setSelectedBlocks] =
|
|
22028
|
-
const [expirationEnabled, setExpirationEnabled] =
|
|
22029
|
-
const [expirationDays, setExpirationDays] =
|
|
22030
|
-
const [canDelegate, setCanDelegate] =
|
|
22031
|
-
const [pin, setPin] =
|
|
22032
|
-
const [loading, setLoading] =
|
|
22033
|
-
const [error, setError] =
|
|
22034
|
-
const handleSearch =
|
|
23554
|
+
const [recipientType, setRecipientType] = useState82("user");
|
|
23555
|
+
const [searchQuery, setSearchQuery] = useState82("");
|
|
23556
|
+
const [searchResults, setSearchResults] = useState82([]);
|
|
23557
|
+
const [searching, setSearching] = useState82(false);
|
|
23558
|
+
const [selectedRecipient, setSelectedRecipient] = useState82(null);
|
|
23559
|
+
const [manualDid, setManualDid] = useState82("");
|
|
23560
|
+
const [scopeType, setScopeType] = useState82("full");
|
|
23561
|
+
const [selectedBlocks, setSelectedBlocks] = useState82([]);
|
|
23562
|
+
const [expirationEnabled, setExpirationEnabled] = useState82(false);
|
|
23563
|
+
const [expirationDays, setExpirationDays] = useState82(30);
|
|
23564
|
+
const [canDelegate, setCanDelegate] = useState82(false);
|
|
23565
|
+
const [pin, setPin] = useState82("");
|
|
23566
|
+
const [loading, setLoading] = useState82(false);
|
|
23567
|
+
const [error, setError] = useState82(null);
|
|
23568
|
+
const handleSearch = useCallback62(async () => {
|
|
22035
23569
|
if (searchQuery.length < 2) return;
|
|
22036
23570
|
setSearching(true);
|
|
22037
23571
|
try {
|
|
@@ -22118,30 +23652,30 @@ var GrantPermissionModal = ({
|
|
|
22118
23652
|
resetForm();
|
|
22119
23653
|
}
|
|
22120
23654
|
};
|
|
22121
|
-
return /* @__PURE__ */
|
|
23655
|
+
return /* @__PURE__ */ React225.createElement(
|
|
22122
23656
|
Modal4,
|
|
22123
23657
|
{
|
|
22124
23658
|
opened,
|
|
22125
23659
|
onClose: handleClose,
|
|
22126
|
-
title: /* @__PURE__ */
|
|
23660
|
+
title: /* @__PURE__ */ React225.createElement(Group74, { gap: "xs" }, /* @__PURE__ */ React225.createElement(IconShieldPlus3, { size: 20 }), /* @__PURE__ */ React225.createElement(Text117, { fw: 600 }, "Grant Permission")),
|
|
22127
23661
|
size: "lg"
|
|
22128
23662
|
},
|
|
22129
|
-
/* @__PURE__ */
|
|
23663
|
+
/* @__PURE__ */ React225.createElement(Stack141, { gap: "md" }, /* @__PURE__ */ React225.createElement(Stack141, { gap: "xs" }, /* @__PURE__ */ React225.createElement(Text117, { size: "sm", fw: 500 }, "Recipient Type"), /* @__PURE__ */ React225.createElement(Radio6.Group, { value: recipientType, onChange: (v) => {
|
|
22130
23664
|
setRecipientType(v);
|
|
22131
23665
|
setSelectedRecipient(null);
|
|
22132
23666
|
setSearchResults([]);
|
|
22133
|
-
} }, /* @__PURE__ */
|
|
23667
|
+
} }, /* @__PURE__ */ React225.createElement(Group74, null, /* @__PURE__ */ React225.createElement(Radio6, { value: "user", label: "User" }), /* @__PURE__ */ React225.createElement(Radio6, { value: "oracle", label: "Oracle" }), /* @__PURE__ */ React225.createElement(Radio6, { value: "manual", label: "Enter DID" })))), recipientType !== "manual" ? /* @__PURE__ */ React225.createElement(Stack141, { gap: "xs" }, /* @__PURE__ */ React225.createElement(
|
|
22134
23668
|
TextInput8,
|
|
22135
23669
|
{
|
|
22136
23670
|
placeholder: recipientType === "oracle" ? "Search oracles..." : "Search users...",
|
|
22137
|
-
leftSection: /* @__PURE__ */
|
|
22138
|
-
rightSection: searching ? /* @__PURE__ */
|
|
23671
|
+
leftSection: /* @__PURE__ */ React225.createElement(IconSearch6, { size: 16 }),
|
|
23672
|
+
rightSection: searching ? /* @__PURE__ */ React225.createElement(Loader28, { size: 14 }) : null,
|
|
22139
23673
|
value: searchQuery,
|
|
22140
23674
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
22141
23675
|
onKeyDown: (e) => e.key === "Enter" && handleSearch()
|
|
22142
23676
|
}
|
|
22143
|
-
), selectedRecipient ? /* @__PURE__ */
|
|
22144
|
-
|
|
23677
|
+
), selectedRecipient ? /* @__PURE__ */ React225.createElement(Paper19, { p: "sm", withBorder: true }, /* @__PURE__ */ React225.createElement(Group74, { justify: "space-between" }, /* @__PURE__ */ React225.createElement(Group74, { gap: "xs" }, recipientType === "oracle" ? /* @__PURE__ */ React225.createElement(IconRobot5, { size: 16 }) : /* @__PURE__ */ React225.createElement(IconUser6, { size: 16 }), /* @__PURE__ */ React225.createElement(Text117, { size: "sm" }, selectedRecipient.displayName), /* @__PURE__ */ React225.createElement(Badge39, { size: "xs", variant: "light" }, selectedRecipient.did.slice(-12))), /* @__PURE__ */ React225.createElement(ActionIcon33, { size: "sm", variant: "subtle", onClick: () => setSelectedRecipient(null) }, /* @__PURE__ */ React225.createElement(IconX10, { size: 14 })))) : searchResults.length > 0 ? /* @__PURE__ */ React225.createElement(Paper19, { p: "xs", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React225.createElement(Stack141, { gap: 4 }, searchResults.map((result) => /* @__PURE__ */ React225.createElement(
|
|
23678
|
+
Button40,
|
|
22145
23679
|
{
|
|
22146
23680
|
key: result.did,
|
|
22147
23681
|
variant: "subtle",
|
|
@@ -22150,7 +23684,7 @@ var GrantPermissionModal = ({
|
|
|
22150
23684
|
onClick: () => setSelectedRecipient(result)
|
|
22151
23685
|
},
|
|
22152
23686
|
result.displayName
|
|
22153
|
-
)))) : null) : /* @__PURE__ */
|
|
23687
|
+
)))) : null) : /* @__PURE__ */ React225.createElement(
|
|
22154
23688
|
TextInput8,
|
|
22155
23689
|
{
|
|
22156
23690
|
label: "Recipient DID",
|
|
@@ -22158,12 +23692,12 @@ var GrantPermissionModal = ({
|
|
|
22158
23692
|
value: manualDid,
|
|
22159
23693
|
onChange: (e) => setManualDid(e.currentTarget.value)
|
|
22160
23694
|
}
|
|
22161
|
-
), /* @__PURE__ */
|
|
23695
|
+
), /* @__PURE__ */ React225.createElement(Divider16, null), /* @__PURE__ */ React225.createElement(Stack141, { gap: "xs" }, /* @__PURE__ */ React225.createElement(Text117, { size: "sm", fw: 500 }, "Permission Scope"), singleBlockMode && fixedBlock ? (
|
|
22162
23696
|
// Single block mode: show fixed block info
|
|
22163
|
-
/* @__PURE__ */
|
|
23697
|
+
/* @__PURE__ */ React225.createElement(Paper19, { p: "sm", withBorder: true }, /* @__PURE__ */ React225.createElement(Group74, { gap: "xs" }, /* @__PURE__ */ React225.createElement(Badge39, { variant: "light", color: "blue" }, fixedBlock.type), /* @__PURE__ */ React225.createElement(Text117, { size: "sm" }, fixedBlock.name || `Block ${fixedBlock.id.slice(-8)}`)), /* @__PURE__ */ React225.createElement(Text117, { size: "xs", c: "dimmed", mt: "xs" }, "Permission will be granted to execute this specific block."))
|
|
22164
23698
|
) : (
|
|
22165
23699
|
// Multi-block mode: show scope selection
|
|
22166
|
-
/* @__PURE__ */
|
|
23700
|
+
/* @__PURE__ */ React225.createElement(React225.Fragment, null, /* @__PURE__ */ React225.createElement(Radio6.Group, { value: scopeType, onChange: (v) => setScopeType(v) }, /* @__PURE__ */ React225.createElement(Stack141, { gap: "xs" }, /* @__PURE__ */ React225.createElement(Radio6, { value: "full", label: "Full flow access (can execute any block)" }), /* @__PURE__ */ React225.createElement(Radio6, { value: "blocks", label: "Specific blocks only" }))), scopeType === "blocks" && /* @__PURE__ */ React225.createElement(Paper19, { p: "sm", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React225.createElement(Stack141, { gap: "xs" }, blocks.map((block) => /* @__PURE__ */ React225.createElement(
|
|
22167
23701
|
Checkbox12,
|
|
22168
23702
|
{
|
|
22169
23703
|
key: block.id,
|
|
@@ -22178,14 +23712,14 @@ var GrantPermissionModal = ({
|
|
|
22178
23712
|
}
|
|
22179
23713
|
}
|
|
22180
23714
|
)))))
|
|
22181
|
-
)), /* @__PURE__ */
|
|
23715
|
+
)), /* @__PURE__ */ React225.createElement(Divider16, null), /* @__PURE__ */ React225.createElement(Stack141, { gap: "xs" }, /* @__PURE__ */ React225.createElement(
|
|
22182
23716
|
Checkbox12,
|
|
22183
23717
|
{
|
|
22184
23718
|
label: "Set expiration",
|
|
22185
23719
|
checked: expirationEnabled,
|
|
22186
23720
|
onChange: (e) => setExpirationEnabled(e.currentTarget.checked)
|
|
22187
23721
|
}
|
|
22188
|
-
), expirationEnabled && /* @__PURE__ */
|
|
23722
|
+
), expirationEnabled && /* @__PURE__ */ React225.createElement(
|
|
22189
23723
|
NumberInput3,
|
|
22190
23724
|
{
|
|
22191
23725
|
label: "Expires in (days)",
|
|
@@ -22195,7 +23729,7 @@ var GrantPermissionModal = ({
|
|
|
22195
23729
|
min: 1,
|
|
22196
23730
|
max: 365
|
|
22197
23731
|
}
|
|
22198
|
-
)), /* @__PURE__ */
|
|
23732
|
+
)), /* @__PURE__ */ React225.createElement(
|
|
22199
23733
|
Checkbox12,
|
|
22200
23734
|
{
|
|
22201
23735
|
label: "Recipient can grant permissions to others",
|
|
@@ -22203,7 +23737,7 @@ var GrantPermissionModal = ({
|
|
|
22203
23737
|
checked: canDelegate,
|
|
22204
23738
|
onChange: (e) => setCanDelegate(e.currentTarget.checked)
|
|
22205
23739
|
}
|
|
22206
|
-
), /* @__PURE__ */
|
|
23740
|
+
), /* @__PURE__ */ React225.createElement(Divider16, null), /* @__PURE__ */ React225.createElement(
|
|
22207
23741
|
TextInput8,
|
|
22208
23742
|
{
|
|
22209
23743
|
label: "Enter your PIN to sign this delegation",
|
|
@@ -22212,7 +23746,7 @@ var GrantPermissionModal = ({
|
|
|
22212
23746
|
value: pin,
|
|
22213
23747
|
onChange: (e) => setPin(e.currentTarget.value)
|
|
22214
23748
|
}
|
|
22215
|
-
), error && /* @__PURE__ */
|
|
23749
|
+
), error && /* @__PURE__ */ React225.createElement(Alert32, { color: "red" }, error), /* @__PURE__ */ React225.createElement(Group74, { justify: "flex-end" }, /* @__PURE__ */ React225.createElement(Button40, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React225.createElement(Button40, { onClick: handleGrant, loading }, "Grant Permission")))
|
|
22216
23750
|
);
|
|
22217
23751
|
};
|
|
22218
23752
|
|
|
@@ -22319,4 +23853,4 @@ export {
|
|
|
22319
23853
|
ixoGraphQLClient,
|
|
22320
23854
|
getEntity
|
|
22321
23855
|
};
|
|
22322
|
-
//# sourceMappingURL=chunk-
|
|
23856
|
+
//# sourceMappingURL=chunk-75HEM77J.mjs.map
|