@powerhousedao/vetra-builder-package 0.0.20 → 0.0.21

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.
Files changed (59) hide show
  1. package/dist/document-models/builder-team/gen/document-model.js +40 -18
  2. package/dist/document-models/builder-team/gen/packages/actions.d.ts +6 -2
  3. package/dist/document-models/builder-team/gen/packages/creators.d.ts +3 -2
  4. package/dist/document-models/builder-team/gen/packages/creators.js +1 -0
  5. package/dist/document-models/builder-team/gen/packages/object.d.ts +2 -1
  6. package/dist/document-models/builder-team/gen/packages/object.js +4 -1
  7. package/dist/document-models/builder-team/gen/packages/operations.d.ts +2 -1
  8. package/dist/document-models/builder-team/gen/reducer.js +8 -0
  9. package/dist/document-models/builder-team/gen/schema/types.d.ts +9 -14
  10. package/dist/document-models/builder-team/gen/schema/zod.d.ts +3 -1
  11. package/dist/document-models/builder-team/gen/schema/zod.js +13 -0
  12. package/dist/document-models/builder-team/gen/spaces/actions.d.ts +6 -2
  13. package/dist/document-models/builder-team/gen/spaces/creators.d.ts +3 -2
  14. package/dist/document-models/builder-team/gen/spaces/creators.js +1 -0
  15. package/dist/document-models/builder-team/gen/spaces/object.d.ts +2 -1
  16. package/dist/document-models/builder-team/gen/spaces/object.js +4 -1
  17. package/dist/document-models/builder-team/gen/spaces/operations.d.ts +2 -1
  18. package/dist/document-models/builder-team/index.d.ts +2 -0
  19. package/dist/document-models/builder-team/src/reducers/packages.js +21 -0
  20. package/dist/document-models/builder-team/src/reducers/spaces.js +16 -0
  21. package/dist/editors/builder-team-editor/components/MembersSection.d.ts +1 -6
  22. package/dist/editors/builder-team-editor/components/MembersSection.js +24 -88
  23. package/dist/editors/builder-team-editor/components/PackageForm.js +7 -75
  24. package/dist/editors/builder-team-editor/components/PackageItem.js +22 -83
  25. package/dist/editors/builder-team-editor/components/PackagesTable.d.ts +9 -0
  26. package/dist/editors/builder-team-editor/components/PackagesTable.js +80 -0
  27. package/dist/editors/builder-team-editor/components/ProfileSection.js +2 -2
  28. package/dist/editors/builder-team-editor/components/QuickStats.js +2 -1
  29. package/dist/editors/builder-team-editor/components/SpaceItem.d.ts +2 -1
  30. package/dist/editors/builder-team-editor/components/SpaceItem.js +4 -3
  31. package/dist/editors/builder-team-editor/components/SpacesSection.d.ts +3 -1
  32. package/dist/editors/builder-team-editor/components/SpacesSection.js +19 -3
  33. package/dist/editors/builder-team-editor/components/SpacesTable.d.ts +11 -0
  34. package/dist/editors/builder-team-editor/components/SpacesTable.js +71 -0
  35. package/dist/editors/builder-team-editor/config.d.ts +1 -0
  36. package/dist/editors/builder-team-editor/config.js +1 -0
  37. package/dist/editors/builder-team-editor/editor.js +7 -1
  38. package/dist/editors/builder-team-editor/hooks/usePackageHandlers.js +0 -1
  39. package/dist/editors/builder-team-editor/services/renown-api.d.ts +21 -0
  40. package/dist/editors/builder-team-editor/services/renown-api.js +63 -0
  41. package/dist/editors/builder-team-editor/services/vetra-api.d.ts +31 -0
  42. package/dist/editors/builder-team-editor/services/vetra-api.js +70 -0
  43. package/dist/editors/builder-team-editor/types/index.d.ts +33 -0
  44. package/dist/editors/builder-team-editor/types/index.js +1 -0
  45. package/dist/editors/builder-team-editor/utils/format.d.ts +7 -0
  46. package/dist/editors/builder-team-editor/utils/format.js +13 -0
  47. package/dist/editors/builder-team-editor/utils/graphql.d.ts +7 -0
  48. package/dist/editors/builder-team-editor/utils/graphql.js +55 -0
  49. package/dist/powerhouse.manifest.json +3 -3
  50. package/dist/processors/vetra-builder-relational-db-processor/builder-team-handlers.d.ts +2 -0
  51. package/dist/processors/vetra-builder-relational-db-processor/builder-team-handlers.js +65 -40
  52. package/dist/processors/vetra-builder-relational-db-processor/factory.js +0 -1
  53. package/dist/processors/vetra-builder-relational-db-processor/index.js +0 -1
  54. package/dist/style.css +74 -6
  55. package/dist/subgraphs/builder-team/resolvers.js +48 -4
  56. package/dist/subgraphs/builder-team/schema.js +21 -14
  57. package/dist/subgraphs/vetra-builders/resolvers.js +34 -11
  58. package/dist/subgraphs/vetra-builders/schema.js +2 -14
  59. package/package.json +1 -1
@@ -17,6 +17,8 @@ interface SpacesSectionProps {
17
17
  onDeletePackage: (packageId: string) => void;
18
18
  onSavePackage: (packageInfo: VetraPackageInfo) => void;
19
19
  onCancelPackageEdit: () => void;
20
+ onReorderSpaces: (spaceIds: string[], targetIndex: number) => void;
21
+ onReorderPackages: (spaceId: string, packageIds: string[], targetIndex: number) => void;
20
22
  }
21
- export declare function SpacesSection({ spaces, editingSpaceId, editingSpaceTitle, editingSpaceDescription, editingPackageId, onAddSpace, onDeleteSpace, onStartEditingSpace, onSaveSpaceEdit, onCancelSpaceEdit, onSetEditingSpaceTitle, onSetEditingSpaceDescription, onAddPackageToSpace, onEditPackage, onDeletePackage, onSavePackage, onCancelPackageEdit, }: SpacesSectionProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function SpacesSection({ spaces, editingSpaceId, editingSpaceTitle, editingSpaceDescription, editingPackageId, onAddSpace, onDeleteSpace, onStartEditingSpace, onSaveSpaceEdit, onCancelSpaceEdit, onSetEditingSpaceTitle, onSetEditingSpaceDescription, onAddPackageToSpace, onEditPackage, onDeletePackage, onSavePackage, onCancelPackageEdit, onReorderSpaces, onReorderPackages, }: SpacesSectionProps): import("react/jsx-runtime").JSX.Element;
22
24
  export {};
@@ -1,14 +1,30 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Button } from "@powerhousedao/document-engineering";
3
3
  import { useState } from "react";
4
4
  import { SpaceForm } from "./SpaceForm.js";
5
5
  import { SpaceItem } from "./SpaceItem.js";
6
- export function SpacesSection({ spaces, editingSpaceId, editingSpaceTitle, editingSpaceDescription, editingPackageId, onAddSpace, onDeleteSpace, onStartEditingSpace, onSaveSpaceEdit, onCancelSpaceEdit, onSetEditingSpaceTitle, onSetEditingSpaceDescription, onAddPackageToSpace, onEditPackage, onDeletePackage, onSavePackage, onCancelPackageEdit, }) {
6
+ import { SpacesTable } from "./SpacesTable.js";
7
+ export function SpacesSection({ spaces, editingSpaceId, editingSpaceTitle, editingSpaceDescription, editingPackageId, onAddSpace, onDeleteSpace, onStartEditingSpace, onSaveSpaceEdit, onCancelSpaceEdit, onSetEditingSpaceTitle, onSetEditingSpaceDescription, onAddPackageToSpace, onEditPackage, onDeletePackage, onSavePackage, onCancelPackageEdit, onReorderSpaces, onReorderPackages, }) {
7
8
  const [isAddingSpace, setIsAddingSpace] = useState(false);
9
+ const [viewMode, setViewMode] = useState("table");
10
+ const [selectedSpaceId, setSelectedSpaceId] = useState(null);
8
11
  const handleAddSpace = (title, description) => {
9
12
  if (onAddSpace(title, description)) {
10
13
  setIsAddingSpace(false);
11
14
  }
12
15
  };
13
- return (_jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-5 border-b border-gray-200 bg-gray-50", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-2xl font-bold text-gray-900", children: "Spaces" }), _jsx("p", { className: "text-sm text-gray-600 mt-1", children: "Organize your packages into logical workspaces" })] }), _jsx(Button, { onClick: () => setIsAddingSpace(true), children: _jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) }), "Add Space"] }) })] }) }), _jsxs("div", { className: "p-6", children: [isAddingSpace && (_jsx(SpaceForm, { onSave: handleAddSpace, onCancel: () => setIsAddingSpace(false) })), _jsx("div", { className: "space-y-5", children: spaces.length > 0 ? (spaces.map((space) => (_jsx(SpaceItem, { space: space, isEditing: editingSpaceId === space.id, editingSpaceTitle: editingSpaceTitle, editingSpaceDescription: editingSpaceDescription, editingPackageId: editingPackageId, onEdit: () => onStartEditingSpace(space.id), onDelete: () => onDeleteSpace(space.id), onSaveEdit: onSaveSpaceEdit, onCancelEdit: onCancelSpaceEdit, onSetEditingTitle: onSetEditingSpaceTitle, onSetEditingDescription: onSetEditingSpaceDescription, onAddPackage: onAddPackageToSpace, onEditPackage: onEditPackage, onDeletePackage: onDeletePackage, onSavePackage: onSavePackage, onCancelPackageEdit: onCancelPackageEdit }, space.id)))) : (_jsxs("div", { className: "text-center py-12 px-4", children: [_jsx("div", { className: "inline-flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 mb-4", children: _jsx("svg", { className: "w-8 h-8 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" }) }) }), _jsx("h3", { className: "text-lg font-semibold text-gray-900 mb-2", children: "No spaces yet" }), _jsx("p", { className: "text-gray-600 mb-4", children: "Create a space to organize your packages" }), _jsx(Button, { onClick: () => setIsAddingSpace(true), children: "Create your first space" })] })) })] })] }));
16
+ const handleEditSpace = (spaceId) => {
17
+ // When editing in table view, make the space visible by selecting it
18
+ if (viewMode === "table") {
19
+ setSelectedSpaceId(spaceId);
20
+ }
21
+ onStartEditingSpace(spaceId);
22
+ };
23
+ const selectedSpace = selectedSpaceId
24
+ ? spaces.find((s) => s.id === selectedSpaceId)
25
+ : null;
26
+ return (_jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-5 border-b border-gray-200 bg-white", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-2xl font-bold text-gray-900", children: "Spaces" }), _jsx("p", { className: "text-sm text-gray-600 mt-1", children: "Organize your packages into logical workspaces" })] }), _jsx(Button, { onClick: () => setIsAddingSpace(true), children: _jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) }), "Add Space"] }) })] }) }), _jsx("div", { className: "px-6 py-3 border-b border-gray-200 bg-gray-50 flex justify-end", children: _jsxs("select", { value: viewMode, onChange: (e) => setViewMode(e.target.value), className: "px-3 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500", children: [_jsx("option", { value: "table", children: "Table View" }), _jsx("option", { value: "cards", children: "Cards View" })] }) }), _jsxs("div", { className: "p-6", children: [isAddingSpace && (_jsx("div", { className: "mb-6", children: _jsx(SpaceForm, { onSave: handleAddSpace, onCancel: () => setIsAddingSpace(false) }) })), spaces.length > 0 ? (_jsx(_Fragment, { children: viewMode === "table" ? (_jsx(SpacesTable, { spaces: spaces, onEdit: handleEditSpace, onDelete: onDeleteSpace, onAddPackage: onAddPackageToSpace, onViewPackages: (spaceId) => setSelectedSpaceId(spaceId), onReorder: onReorderSpaces })) : (_jsx("div", { className: "space-y-5", children: spaces.map((space) => (_jsx(SpaceItem, { space: space, isEditing: editingSpaceId === space.id, editingSpaceTitle: editingSpaceTitle, editingSpaceDescription: editingSpaceDescription, editingPackageId: editingPackageId, onEdit: () => onStartEditingSpace(space.id), onDelete: () => onDeleteSpace(space.id), onSaveEdit: onSaveSpaceEdit, onCancelEdit: onCancelSpaceEdit, onSetEditingTitle: onSetEditingSpaceTitle, onSetEditingDescription: onSetEditingSpaceDescription, onAddPackage: onAddPackageToSpace, onEditPackage: onEditPackage, onDeletePackage: onDeletePackage, onSavePackage: onSavePackage, onCancelPackageEdit: onCancelPackageEdit, onReorderPackages: (packageIds, targetIndex) => onReorderPackages(space.id, packageIds, targetIndex) }, space.id))) })) })) : (_jsxs("div", { className: "text-center py-12 px-4", children: [_jsx("div", { className: "inline-flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 mb-4", children: _jsx("svg", { className: "w-8 h-8 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" }) }) }), _jsx("h3", { className: "text-lg font-semibold text-gray-900 mb-2", children: "No spaces yet" }), _jsx("p", { className: "text-gray-600 mb-4", children: "Create a space to organize your packages" }), _jsx(Button, { onClick: () => setIsAddingSpace(true), children: "Create your first space" })] })), selectedSpace && viewMode === "table" && (_jsxs("div", { className: "mt-6 p-4 bg-gray-50 rounded-lg border border-gray-200", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { children: [_jsxs("h3", { className: "text-lg font-semibold text-gray-900", children: [selectedSpace.title, " - Packages"] }), selectedSpace.description && (_jsx("p", { className: "text-sm text-gray-600 mt-1", children: selectedSpace.description }))] }), _jsx(Button, { color: "light", size: "sm", onClick: () => setSelectedSpaceId(null), children: "Close" })] }), _jsx(SpaceItem, { space: selectedSpace, isEditing: editingSpaceId === selectedSpace.id, editingSpaceTitle: editingSpaceTitle, editingSpaceDescription: editingSpaceDescription, editingPackageId: editingPackageId, onEdit: () => onStartEditingSpace(selectedSpace.id), onDelete: () => {
27
+ onDeleteSpace(selectedSpace.id);
28
+ setSelectedSpaceId(null);
29
+ }, onSaveEdit: onSaveSpaceEdit, onCancelEdit: onCancelSpaceEdit, onSetEditingTitle: onSetEditingSpaceTitle, onSetEditingDescription: onSetEditingSpaceDescription, onAddPackage: onAddPackageToSpace, onEditPackage: onEditPackage, onDeletePackage: onDeletePackage, onSavePackage: onSavePackage, onCancelPackageEdit: onCancelPackageEdit, onReorderPackages: (packageIds, targetIndex) => onReorderPackages(selectedSpace.id, packageIds, targetIndex) })] }))] })] }));
14
30
  }
@@ -0,0 +1,11 @@
1
+ import type { VetraBuilderSpace } from "../../../document-models/builder-team/index.js";
2
+ interface SpacesTableProps {
3
+ spaces: VetraBuilderSpace[];
4
+ onEdit: (spaceId: string) => void;
5
+ onDelete: (spaceId: string) => void;
6
+ onAddPackage: (spaceId: string) => void;
7
+ onViewPackages: (spaceId: string) => void;
8
+ onReorder: (spaceIds: string[], targetIndex: number) => void;
9
+ }
10
+ export declare function SpacesTable({ spaces, onEdit, onDelete, onAddPackage, onViewPackages, onReorder, }: SpacesTableProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,71 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ObjectSetTable } from "@powerhousedao/document-engineering";
3
+ import { useMemo } from "react";
4
+ export function SpacesTable({ spaces, onEdit, onDelete, onAddPackage, onViewPackages, onReorder, }) {
5
+ const columns = useMemo(() => [
6
+ {
7
+ field: "title",
8
+ title: "Space Title",
9
+ type: "string",
10
+ width: "300px",
11
+ renderHeader: () => _jsx("div", { className: "px-4", children: "Space Title" }),
12
+ renderCell: (value, context) => {
13
+ return (_jsx("div", { className: "cursor-pointer hover:text-blue-600 font-medium px-4", onClick: () => onViewPackages(context.row.id), children: value }));
14
+ },
15
+ },
16
+ {
17
+ field: "description",
18
+ title: "Description",
19
+ type: "string",
20
+ width: "400px",
21
+ renderHeader: () => _jsx("div", { className: "px-4", children: "Description" }),
22
+ renderCell: (value) => {
23
+ return _jsx("div", { className: "px-4", children: value });
24
+ },
25
+ },
26
+ {
27
+ field: "packages",
28
+ title: "Packages",
29
+ type: "number",
30
+ width: "120px",
31
+ align: "center",
32
+ renderHeader: () => _jsx("div", { className: "px-4", children: "Packages" }),
33
+ valueGetter: (row) => row.packages.length,
34
+ renderCell: (value) => {
35
+ const count = value;
36
+ return (_jsx("div", { className: "px-4", children: _jsx("span", { className: "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800", children: count }) }));
37
+ },
38
+ },
39
+ ], [onViewPackages]);
40
+ return (_jsx("div", { className: "w-full spaces-table", children: _jsx(ObjectSetTable, { data: spaces, columns: columns, allowRowSelection: false, showRowNumbers: false, width: "100%", minRowHeight: 60, onReorder: (rows, targetIndex) => {
41
+ const spaceIds = rows.map((row) => row.id);
42
+ onReorder(spaceIds, targetIndex);
43
+ }, actions: {
44
+ secondary: [
45
+ {
46
+ label: "View Packages",
47
+ callback: ({ row }) => {
48
+ onViewPackages(row.id);
49
+ },
50
+ },
51
+ {
52
+ label: "Edit Space",
53
+ callback: ({ row }) => {
54
+ onEdit(row.id);
55
+ },
56
+ },
57
+ {
58
+ label: "Add Package",
59
+ callback: ({ row }) => {
60
+ onAddPackage(row.id);
61
+ },
62
+ },
63
+ {
64
+ label: "Remove",
65
+ callback: ({ row }) => {
66
+ onDelete(row.id);
67
+ },
68
+ }
69
+ ],
70
+ } }) }));
71
+ }
@@ -3,4 +3,5 @@ export declare const config: {
3
3
  vetraGraphqlEndpoint: string;
4
4
  renownProfileBasePath: string;
5
5
  vetraPackageBasePath: string;
6
+ vetraDriveBaseUrl: string;
6
7
  };
@@ -24,4 +24,5 @@ export const config = {
24
24
  vetraGraphqlEndpoint: getEnvVar("VETRA_VETRA_GRAPHQL_ENDPOINT", "https://switchboard.staging.vetra.io/graphql"),
25
25
  renownProfileBasePath: getEnvVar("VETRA_RENOWN_PROFILE_BASE_PATH", "phd://renown-staging.vetra.to"),
26
26
  vetraPackageBasePath: getEnvVar("VETRA_VETRA_PACKAGE_BASE_PATH", "phd://staging.vetra.to"),
27
+ vetraDriveBaseUrl: getEnvVar("VETRA_DRIVE_BASE_URL", "https://switchboard.staging.vetra.io/d"),
27
28
  };
@@ -57,6 +57,12 @@ export function Editor(props) {
57
57
  setIsAddingPackage(false);
58
58
  setSelectedSpaceForPackage("");
59
59
  };
60
+ const handleReorderSpaces = (spaceIds, targetIndex) => {
61
+ dispatch(actions.reorderSpaces({ spaceIds, targetIndex }));
62
+ };
63
+ const handleReorderPackages = (spaceId, packageIds, targetIndex) => {
64
+ dispatch(actions.reorderPackages({ spaceId, packageIds, targetIndex }));
65
+ };
60
66
  return (_jsxs("div", { className: "html-defaults-container min-h-screen bg-gray-50", children: [_jsx(Header, { profile: profile, isEditingProfile: isEditingProfile, onToggleEdit: () => setIsEditingProfile(!isEditingProfile) }), _jsx("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8", children: _jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-8", children: [_jsxs("div", { className: "lg:col-span-2 space-y-8", children: [_jsx(ProfileSection, { profile: profile, isEditing: isEditingProfile, onSetProfileName: profileHandlers.handleSetProfileName, onSetSlug: profileHandlers.handleSetSlug, onSetDescription: profileHandlers.handleSetProfileDescription, onSetLogo: profileHandlers.handleSetLogo, onUpdateSocials: profileHandlers.handleUpdateSocials, onClose: () => setIsEditingProfile(false) }), _jsx(SpacesSection, { spaces: spaces, editingSpaceId: spaceHandlers.editingSpaceId, editingSpaceTitle: spaceHandlers.editingSpaceTitle, editingSpaceDescription: spaceHandlers.editingSpaceDescription, editingPackageId: packageHandlers.editingPackageId, onAddSpace: spaceHandlers.handleAddSpace, onDeleteSpace: spaceHandlers.handleDeleteSpace, onStartEditingSpace: spaceHandlers.handleStartEditingSpace, onSaveSpaceEdit: spaceHandlers.handleSaveSpaceEdit, onCancelSpaceEdit: spaceHandlers.handleCancelSpaceEdit, onSetEditingSpaceTitle: spaceHandlers.setEditingSpaceTitle, onSetEditingSpaceDescription: spaceHandlers.setEditingSpaceDescription, onAddPackageToSpace: handleAddPackageToSpace, onEditPackage: packageHandlers.handleStartEditingPackage, onDeletePackage: packageHandlers.handleDeletePackage, onSavePackage: (packageInfo) => {
61
67
  // Update the package with info
62
68
  dispatch(actions.updatePackageInfo({
@@ -69,5 +75,5 @@ export function Editor(props) {
69
75
  vetraDriveUrl: packageInfo.vetraDriveUrl,
70
76
  }));
71
77
  packageHandlers.handleCancelPackageEdit();
72
- }, onCancelPackageEdit: packageHandlers.handleCancelPackageEdit }), isAddingPackage && (_jsx(PackageForm, { spaceId: selectedSpaceForPackage, onSave: handleSavePackage, onCancel: handleCancelAddPackage }))] }), _jsxs("div", { className: "space-y-6", children: [_jsx(MembersSection, { members: members, onAddMember: memberHandlers.handleAddMember, onRemoveMember: memberHandlers.handleRemoveMember }), _jsx(QuickStats, { spaces: spaces, members: members })] })] }) })] }));
78
+ }, onCancelPackageEdit: packageHandlers.handleCancelPackageEdit, onReorderSpaces: handleReorderSpaces, onReorderPackages: handleReorderPackages }), isAddingPackage && (_jsx(PackageForm, { spaceId: selectedSpaceForPackage, onSave: handleSavePackage, onCancel: handleCancelAddPackage }))] }), _jsxs("div", { className: "space-y-6", children: [_jsx(MembersSection, { members: members, onAddMember: memberHandlers.handleAddMember, onRemoveMember: memberHandlers.handleRemoveMember }), _jsx(QuickStats, { spaces: spaces, members: members })] })] }) })] }));
73
79
  }
@@ -23,7 +23,6 @@ export function usePackageHandlers(spaces, dispatch) {
23
23
  setEditingPackageId(packageId);
24
24
  }, []);
25
25
  const handleSavePackageEdit = useCallback((packageId, name, description) => {
26
- console.log("handleSavePackageEdit", packageId, name, description);
27
26
  if (packageId && name.trim()) {
28
27
  dispatch(actions.updatePackageInfo({
29
28
  id: packageId,
@@ -0,0 +1,21 @@
1
+ import type { RenownProfile, PHIDOption } from "../types/index.js";
2
+ /**
3
+ * Search for profiles by username or ENS name
4
+ */
5
+ export declare function searchProfiles(searchString: string): Promise<RenownProfile[]>;
6
+ /**
7
+ * Get a single profile by document ID
8
+ */
9
+ export declare function getProfile(documentId: string): Promise<RenownProfile | null>;
10
+ /**
11
+ * Convert a profile to a PHID option for the PHIDField component
12
+ */
13
+ export declare function profileToOption(profile: RenownProfile): PHIDOption;
14
+ /**
15
+ * Search for profiles and convert to PHID options
16
+ */
17
+ export declare function searchProfileOptions(searchString: string): Promise<PHIDOption[]>;
18
+ /**
19
+ * Get a profile and convert to PHID option
20
+ */
21
+ export declare function getProfileOption(documentId: string): Promise<PHIDOption | undefined>;
@@ -0,0 +1,63 @@
1
+ import { renownClient, SEARCH_PROFILES_QUERY, GET_PROFILE_QUERY } from "../utils/graphql.js";
2
+ import { config } from "../config.js";
3
+ import { truncateAddress } from "../utils/format.js";
4
+ /**
5
+ * Search for profiles by username or ENS name
6
+ */
7
+ export async function searchProfiles(searchString) {
8
+ const data = await renownClient.request(SEARCH_PROFILES_QUERY, {
9
+ input: {
10
+ driveId: "renown-profiles",
11
+ searchString,
12
+ },
13
+ });
14
+ return data.getProfiles;
15
+ }
16
+ /**
17
+ * Get a single profile by document ID
18
+ */
19
+ export async function getProfile(documentId) {
20
+ try {
21
+ const data = await renownClient.request(GET_PROFILE_QUERY, {
22
+ input: {
23
+ id: documentId,
24
+ driveId: "renown-profiles",
25
+ },
26
+ });
27
+ return data.getProfile;
28
+ }
29
+ catch (error) {
30
+ console.error("Failed to fetch profile:", error);
31
+ return null;
32
+ }
33
+ }
34
+ /**
35
+ * Convert a profile to a PHID option for the PHIDField component
36
+ */
37
+ export function profileToOption(profile) {
38
+ return {
39
+ id: profile.documentId,
40
+ title: profile.username,
41
+ value: profile.documentId,
42
+ description: truncateAddress(profile.ethAddress),
43
+ path: {
44
+ text: `${config.renownProfileBasePath}/${profile.documentId}`,
45
+ url: `${config.renownProfileBasePath}/${profile.documentId}`,
46
+ },
47
+ icon: "Person",
48
+ };
49
+ }
50
+ /**
51
+ * Search for profiles and convert to PHID options
52
+ */
53
+ export async function searchProfileOptions(searchString) {
54
+ const profiles = await searchProfiles(searchString);
55
+ return profiles.map(profileToOption);
56
+ }
57
+ /**
58
+ * Get a profile and convert to PHID option
59
+ */
60
+ export async function getProfileOption(documentId) {
61
+ const profile = await getProfile(documentId);
62
+ return profile ? profileToOption(profile) : undefined;
63
+ }
@@ -0,0 +1,31 @@
1
+ import type { VetraPackageData, PHIDOption } from "../types/index.js";
2
+ import type { VetraPackageInfo } from "../../../document-models/builder-team/index.js";
3
+ /**
4
+ * Search for packages by name
5
+ */
6
+ export declare function searchPackages(search: string): Promise<VetraPackageData[]>;
7
+ /**
8
+ * Get package(s) by document ID(s)
9
+ */
10
+ export declare function getPackagesByIds(documentIds: string[]): Promise<VetraPackageData[]>;
11
+ /**
12
+ * Get a single package by document ID
13
+ */
14
+ export declare function getPackage(documentId: string): Promise<VetraPackageData | null>;
15
+ /**
16
+ * Convert a package to a PHID option for the PHIDField component
17
+ */
18
+ export declare function packageToOption(pkg: VetraPackageData): PHIDOption;
19
+ /**
20
+ * Search for packages and convert to PHID options
21
+ */
22
+ export declare function searchPackageOptions(search: string): Promise<PHIDOption[]>;
23
+ /**
24
+ * Get a package and convert to PHID option
25
+ */
26
+ export declare function getPackageOption(documentId: string): Promise<PHIDOption | undefined>;
27
+ /**
28
+ * Convert VetraPackageData to VetraPackageInfo
29
+ * Used when selecting packages in forms
30
+ */
31
+ export declare function packageDataToPackageInfo(pkg: VetraPackageData, id?: string): VetraPackageInfo;
@@ -0,0 +1,70 @@
1
+ import { vetraClient, SEARCH_PACKAGES_QUERY, SEARCH_PACKAGES_BY_DOCUMENT_ID_QUERY } from "../utils/graphql.js";
2
+ import { config } from "../config.js";
3
+ /**
4
+ * Search for packages by name
5
+ */
6
+ export async function searchPackages(search) {
7
+ const data = await vetraClient.request(SEARCH_PACKAGES_QUERY, {
8
+ search,
9
+ });
10
+ return data.vetraPackages;
11
+ }
12
+ /**
13
+ * Get package(s) by document ID(s)
14
+ */
15
+ export async function getPackagesByIds(documentIds) {
16
+ const data = await vetraClient.request(SEARCH_PACKAGES_BY_DOCUMENT_ID_QUERY, { documentIds });
17
+ return data.vetraPackages;
18
+ }
19
+ /**
20
+ * Get a single package by document ID
21
+ */
22
+ export async function getPackage(documentId) {
23
+ const packages = await getPackagesByIds([documentId]);
24
+ return packages.length > 0 ? packages[0] : null;
25
+ }
26
+ /**
27
+ * Convert a package to a PHID option for the PHIDField component
28
+ */
29
+ export function packageToOption(pkg) {
30
+ return {
31
+ id: pkg.documentId,
32
+ title: pkg.name,
33
+ value: pkg.documentId,
34
+ description: pkg.description,
35
+ path: {
36
+ text: `${config.vetraDriveBaseUrl}/${pkg.driveId}`,
37
+ url: `${config.vetraDriveBaseUrl}/${pkg.driveId}`,
38
+ },
39
+ icon: "PackageManager",
40
+ };
41
+ }
42
+ /**
43
+ * Search for packages and convert to PHID options
44
+ */
45
+ export async function searchPackageOptions(search) {
46
+ const packages = await searchPackages(search);
47
+ return packages.map(packageToOption);
48
+ }
49
+ /**
50
+ * Get a package and convert to PHID option
51
+ */
52
+ export async function getPackageOption(documentId) {
53
+ const pkg = await getPackage(documentId);
54
+ return pkg ? packageToOption(pkg) : undefined;
55
+ }
56
+ /**
57
+ * Convert VetraPackageData to VetraPackageInfo
58
+ * Used when selecting packages in forms
59
+ */
60
+ export function packageDataToPackageInfo(pkg, id = "") {
61
+ return {
62
+ id,
63
+ phid: pkg.documentId,
64
+ title: pkg.name,
65
+ description: pkg.description,
66
+ github: pkg.githubUrl || null,
67
+ npm: pkg.npmUrl || null,
68
+ vetraDriveUrl: `${config.vetraDriveBaseUrl}/${pkg.driveId}`,
69
+ };
70
+ }
@@ -0,0 +1,33 @@
1
+ export interface RenownProfile {
2
+ documentId: string;
3
+ ethAddress: string;
4
+ username: string;
5
+ userImage?: string;
6
+ updatedAt: string;
7
+ }
8
+ export interface MemberProfileData {
9
+ phid: string;
10
+ ethAddress: string;
11
+ name: string;
12
+ profileImage?: string;
13
+ }
14
+ export interface VetraPackageData {
15
+ documentId: string;
16
+ driveId: string;
17
+ name: string;
18
+ description: string;
19
+ authorName: string;
20
+ githubUrl: string;
21
+ npmUrl?: string;
22
+ }
23
+ export interface PHIDOption {
24
+ id: string;
25
+ title: string;
26
+ value: string;
27
+ description: string;
28
+ path: {
29
+ text: string;
30
+ url: string;
31
+ };
32
+ icon?: "Person" | "PackageManager";
33
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Truncate an Ethereum address to format: 0xabcd...xyz
3
+ * @param address - Full ethereum address
4
+ * @param prefixLength - Number of characters to show after 0x (default: 4)
5
+ * @param suffixLength - Number of characters to show at the end (default: 4)
6
+ */
7
+ export declare function truncateAddress(address: string, prefixLength?: number, suffixLength?: number): string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Truncate an Ethereum address to format: 0xabcd...xyz
3
+ * @param address - Full ethereum address
4
+ * @param prefixLength - Number of characters to show after 0x (default: 4)
5
+ * @param suffixLength - Number of characters to show at the end (default: 4)
6
+ */
7
+ export function truncateAddress(address, prefixLength = 4, suffixLength = 4) {
8
+ if (!address)
9
+ return "";
10
+ if (address.length <= prefixLength + suffixLength + 2)
11
+ return address;
12
+ return `${address.slice(0, prefixLength + 2)}...${address.slice(-suffixLength)}`;
13
+ }
@@ -0,0 +1,7 @@
1
+ import { GraphQLClient } from "graphql-request";
2
+ export declare const renownClient: GraphQLClient;
3
+ export declare const vetraClient: GraphQLClient;
4
+ export declare const SEARCH_PROFILES_QUERY = "\n query ($input: GetProfilesInput!) {\n getProfiles(input: $input) {\n documentId\n ethAddress\n updatedAt\n userImage\n username\n }\n }\n";
5
+ export declare const GET_PROFILE_QUERY = "\n query ($input: GetProfileInput!) {\n getProfile(input: $input) {\n documentId\n ethAddress\n updatedAt\n userImage\n username\n }\n }\n";
6
+ export declare const SEARCH_PACKAGES_QUERY = "\n query SearchPackages($search: String!) {\n vetraPackages(search: $search) {\n authorName\n name\n githubUrl\n npmUrl\n documentId\n driveId\n description\n }\n }\n";
7
+ export declare const SEARCH_PACKAGES_BY_DOCUMENT_ID_QUERY = "\n query SearchPackagesByDocumentId($documentIds: [PHID!]) {\n vetraPackages(documentId_in: $documentIds) {\n authorName\n name\n githubUrl\n npmUrl\n documentId\n driveId\n description\n }\n }\n";
@@ -0,0 +1,55 @@
1
+ import { GraphQLClient } from "graphql-request";
2
+ import { config } from "../config.js";
3
+ // GraphQL Clients
4
+ export const renownClient = new GraphQLClient(config.renownGraphqlEndpoint);
5
+ export const vetraClient = new GraphQLClient(config.vetraGraphqlEndpoint);
6
+ // Renown Profile Queries
7
+ export const SEARCH_PROFILES_QUERY = `
8
+ query ($input: GetProfilesInput!) {
9
+ getProfiles(input: $input) {
10
+ documentId
11
+ ethAddress
12
+ updatedAt
13
+ userImage
14
+ username
15
+ }
16
+ }
17
+ `;
18
+ export const GET_PROFILE_QUERY = `
19
+ query ($input: GetProfileInput!) {
20
+ getProfile(input: $input) {
21
+ documentId
22
+ ethAddress
23
+ updatedAt
24
+ userImage
25
+ username
26
+ }
27
+ }
28
+ `;
29
+ // Vetra Package Queries
30
+ export const SEARCH_PACKAGES_QUERY = `
31
+ query SearchPackages($search: String!) {
32
+ vetraPackages(search: $search) {
33
+ authorName
34
+ name
35
+ githubUrl
36
+ npmUrl
37
+ documentId
38
+ driveId
39
+ description
40
+ }
41
+ }
42
+ `;
43
+ export const SEARCH_PACKAGES_BY_DOCUMENT_ID_QUERY = `
44
+ query SearchPackagesByDocumentId($documentIds: [PHID!]) {
45
+ vetraPackages(documentId_in: $documentIds) {
46
+ authorName
47
+ name
48
+ githubUrl
49
+ npmUrl
50
+ documentId
51
+ driveId
52
+ description
53
+ }
54
+ }
55
+ `;
@@ -1,10 +1,10 @@
1
1
  {
2
- "name": "powerhouse/vetra-builder-package",
3
- "description": "",
2
+ "name": "Vetra Builder Package",
3
+ "description": "a short description",
4
4
  "category": "People & Culture",
5
5
  "publisher": {
6
6
  "name": "Powerhouse Inc.",
7
- "url": "https://www.powerhouse.inc"
7
+ "url": "https://powerhouse.inc"
8
8
  },
9
9
  "documentModels": [
10
10
  {
@@ -16,7 +16,9 @@ export declare class BuilderTeamHandlers {
16
16
  private handleAddSpace;
17
17
  private handleDeleteSpace;
18
18
  private handleUpdateSpaceInfo;
19
+ private handleReorderSpaces;
19
20
  private handleAddPackage;
20
21
  private handleUpdatePackageInfo;
22
+ private handleReorderPackages;
21
23
  private handleDeletePackage;
22
24
  }