@calimero-network/mero-react 11.5.0 → 11.6.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/index.d.cts CHANGED
@@ -1126,6 +1126,8 @@ interface CalimeroLogoProps extends React__default.SVGAttributes<SVGSVGElement>
1126
1126
  }
1127
1127
  declare function CalimeroLogo({ size, color, style, ...rest }: CalimeroLogoProps): react_jsx_runtime.JSX.Element;
1128
1128
 
1129
+ type NodeConsentPhase = 'idle' | 'approving' | 'redirect' | 'creating';
1130
+
1129
1131
  /** What the app is told once the workspace exists. */
1130
1132
  interface CreatedWorkspace {
1131
1133
  orgId: string;
@@ -1133,7 +1135,7 @@ interface CreatedWorkspace {
1133
1135
  name: string;
1134
1136
  selfName: string;
1135
1137
  }
1136
- type CreatePhase = 'idle' | 'approving' | 'redirect' | 'creating';
1138
+ type CreatePhase = NodeConsentPhase;
1137
1139
  interface UseCreateWorkspaceOptions {
1138
1140
  /** Where the node's consent page sends the person back: a page of the app that mounts `ConsentPopupReturn`. */
1139
1141
  returnTo: string;
@@ -1141,19 +1143,22 @@ interface UseCreateWorkspaceOptions {
1141
1143
  }
1142
1144
  /**
1143
1145
  * Creates a workspace. A session bound to the app's frontend asks the node's
1144
- * consent page (in a pop-up, else a full-page trip); any other session creates
1145
- * the organization directly. Resolves through `onCreated`; `error` is the
1146
- * node's own message, or what happened to the approval.
1146
+ * consent page (in a pop-up, else a full-page trip after `proceed`); any other
1147
+ * session creates the organization directly. Resolves through `onCreated`;
1148
+ * `error` is the node's own message, or what happened to the approval.
1147
1149
  */
1148
1150
  declare function useCreateWorkspace({ returnTo, onCreated }: UseCreateWorkspaceOptions): {
1149
- create: (name: string, selfName: string) => void;
1150
1151
  cancel: () => void;
1151
1152
  reopen: () => void;
1152
1153
  proceed: () => void | undefined;
1153
- phase: CreatePhase;
1154
+ clearError: () => void;
1155
+ phase: NodeConsentPhase;
1154
1156
  error: string | null;
1157
+ errorCode: string | null;
1155
1158
  code: string | null;
1156
1159
  ready: boolean;
1160
+ bound: boolean | null;
1161
+ create: (name: string, selfName: string) => void;
1157
1162
  };
1158
1163
  /**
1159
1164
  * Finishes a workspace the person approved on a full-page trip to the node:
@@ -1251,4 +1256,76 @@ declare function ConsentPopupReturn({ children }: {
1251
1256
  /** The cluster a node belongs to (`eu-shared-1`), from its URL; `merod local` for a loopback node, else the host. */
1252
1257
  declare function clusterName(nodeUrl: string): string;
1253
1258
 
1254
- export { type AppEvent, type AsyncState, type BlobHookOptions, CONSENT_RETURN_MESSAGE, CalimeroLogo, type CalimeroLogoProps, type CallOptions, type Codec, ConnectButton, type ConnectButtonProps, ConsentPopupReturn, type CreateApiKeyInput, type CreateAppInput, type CreateInviteInput, type CreatePhase, type CreateTeamInput, CreateWorkspaceDialog, type CreateWorkspaceDialogProps, type CreateWorkspaceLabels, type CreatedWorkspace, type EphemeralEntry, type Failure, type FailureKind, type InviteRedemption, type InviteRedemptionStatus, LoginModal, type LoginModalProps, type LoginModalTab, MERO_CSS_VARS, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, type MutationOptions, NoAppError, NotConnectedError, type PolicyOptions, type ResolvedMeroTheme, type ResourceState, ReviewRelease, SessionReportingClient, type SessionStore, type SubscriptionEventData, type SubscriptionOptions, type TeamJoin, type TeamUpdate, UnreleasedApp, type UpgradeTarget, type UseBlobUrlOptions, type UseCreateWorkspaceOptions, type UseEphemeralOptions, type UseEphemeralResult, type UseViewOptions, type UseViewResult, type ViewOptions, type WaitOptions, WorkspaceReview, type WorkspaceReviewProps, clearAllStorage, clearAppId, clearCluster, clearNodeUrl, clusterName, cssVar, defaultMeroTheme, describeError, followEvents, getAppId, getCluster, getNodeUrl, inviteLink, isLoginRequired, jsonCodec, localStorageSessionStore, memorySessionStore, readInviteToken, reportSessions, resolveMeroTheme, resolvePolicy, setAppId, setCluster, setNodeUrl, shortAccount, themeToCssVars, useAccount, useApiKeys, useApp, useAppAbi, useApps, useBlobInfo, useBlobUrl, useBlobs, useConsent, useCreateApp, useCreateInvite, useCreateOrg, useCreateTeam, useCreateWorkspace, useCreateWorkspaceResume, useDeleteApp, useDeleteBlob, useDeleteOrg, useDeleteTeam, useEphemeral, useExecute, useInviteRedemption, useMero, useOrg, usePackages, usePasskeys, useRedeemInvite, useRemoveMember, useRemoveTeamMember, useSetAppMetadata, useSetCapabilities, useSetMember, useSetMemberMetadata, useSetOrgMetadata, useSetTeamMember, useSubscription, useTeam, useUpdateTeam, useUpgradeApp, useUploadBlob, useView };
1259
+ type InviteRole = Exclude<OrgRole, 'owner'>;
1260
+ /** An invite just created. */
1261
+ interface CreatedInvite {
1262
+ token: string;
1263
+ /** The link to share: the token in the fragment of `linkBase`. */
1264
+ link: string;
1265
+ /** The capability bits it grants; absent for the workspace's member defaults. */
1266
+ capabilities?: number;
1267
+ }
1268
+
1269
+ /** The dialog's wording, so each app keeps its own. */
1270
+ interface InviteLabels {
1271
+ title?: string;
1272
+ subtitle?: string;
1273
+ next?: string;
1274
+ }
1275
+ interface InviteDialogProps {
1276
+ open: boolean;
1277
+ onClose: () => void;
1278
+ /** The workspace (organization) people are invited to. */
1279
+ org: string;
1280
+ /** The app's team(s) the invitee joins too, e.g. its app team. */
1281
+ teams?: string[];
1282
+ /** The role the invite gives. Default `member`. */
1283
+ role?: InviteRole;
1284
+ appName?: string;
1285
+ labels?: InviteLabels;
1286
+ /** Called once the invite exists, from the dialog or from a full-page approval. */
1287
+ onInvited?: (invite: CreatedInvite) => void;
1288
+ /** The page the link opens. Default: this page. */
1289
+ linkBase?: string;
1290
+ /** Where the node's consent page sends the person back. Default: this origin's root, where the app mounts `ConsentPopupReturn`. */
1291
+ returnTo?: string;
1292
+ /** The app's own client, wrapped in a `MeroProvider` here. Without it the ambient `MeroProvider` is used. */
1293
+ client?: CalimeroClient;
1294
+ /** The passkey prompt, with `client`. */
1295
+ passkey?: PasskeyProvider;
1296
+ }
1297
+ /**
1298
+ * Invite people to a workspace: choose their permissions (the workspace's
1299
+ * defaults, or a custom set the inviter holds), create the invite (through the
1300
+ * node's consent page for a session bound to the app), then share the link.
1301
+ * Mount it once and toggle `open`: it also finishes an invite approved on a
1302
+ * full-page trip to the node. Needs a `MeroProvider`, or pass `client`.
1303
+ */
1304
+ declare function InviteDialog({ client, passkey, ...props }: InviteDialogProps): react_jsx_runtime.JSX.Element;
1305
+
1306
+ interface AcceptInviteDialogProps {
1307
+ open: boolean;
1308
+ onClose: () => void;
1309
+ /** The invite token from the link (`readInviteToken`, or `useInviteRedemption`'s `token`). */
1310
+ token: string;
1311
+ appName?: string;
1312
+ /** Called once the person has joined, from the dialog or from a full-page approval. */
1313
+ onJoined: (joined: {
1314
+ org: string;
1315
+ }) => void;
1316
+ /** Where the node's consent page sends the person back. Default: this origin's root, where the app mounts `ConsentPopupReturn`. */
1317
+ returnTo?: string;
1318
+ client?: CalimeroClient;
1319
+ passkey?: PasskeyProvider;
1320
+ }
1321
+ /**
1322
+ * Join a workspace with an invite: asks the node's consent page for a session
1323
+ * bound to the app, else redeems the invite directly. Mount it once and toggle
1324
+ * `open`; it also finishes a join approved on a full-page trip to the node.
1325
+ */
1326
+ declare function AcceptInviteDialog({ client, passkey, ...props }: AcceptInviteDialogProps): react_jsx_runtime.JSX.Element;
1327
+
1328
+ /** The labels of the bits set in `mask`, in display order. */
1329
+ declare function describeCapabilities(mask: number): string[];
1330
+
1331
+ export { AcceptInviteDialog, type AcceptInviteDialogProps, type AppEvent, type AsyncState, type BlobHookOptions, CONSENT_RETURN_MESSAGE, CalimeroLogo, type CalimeroLogoProps, type CallOptions, type Codec, ConnectButton, type ConnectButtonProps, ConsentPopupReturn, type CreateApiKeyInput, type CreateAppInput, type CreateInviteInput, type CreatePhase, type CreateTeamInput, CreateWorkspaceDialog, type CreateWorkspaceDialogProps, type CreateWorkspaceLabels, type CreatedInvite, type CreatedWorkspace, type EphemeralEntry, type Failure, type FailureKind, InviteDialog, type InviteDialogProps, type InviteLabels, type InviteRedemption, type InviteRedemptionStatus, type InviteRole, LoginModal, type LoginModalProps, type LoginModalTab, MERO_CSS_VARS, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, type MutationOptions, NoAppError, NotConnectedError, type PolicyOptions, type ResolvedMeroTheme, type ResourceState, ReviewRelease, SessionReportingClient, type SessionStore, type SubscriptionEventData, type SubscriptionOptions, type TeamJoin, type TeamUpdate, UnreleasedApp, type UpgradeTarget, type UseBlobUrlOptions, type UseCreateWorkspaceOptions, type UseEphemeralOptions, type UseEphemeralResult, type UseViewOptions, type UseViewResult, type ViewOptions, type WaitOptions, WorkspaceReview, type WorkspaceReviewProps, clearAllStorage, clearAppId, clearCluster, clearNodeUrl, clusterName, cssVar, defaultMeroTheme, describeCapabilities, describeError, followEvents, getAppId, getCluster, getNodeUrl, inviteLink, isLoginRequired, jsonCodec, localStorageSessionStore, memorySessionStore, readInviteToken, reportSessions, resolveMeroTheme, resolvePolicy, setAppId, setCluster, setNodeUrl, shortAccount, themeToCssVars, useAccount, useApiKeys, useApp, useAppAbi, useApps, useBlobInfo, useBlobUrl, useBlobs, useConsent, useCreateApp, useCreateInvite, useCreateOrg, useCreateTeam, useCreateWorkspace, useCreateWorkspaceResume, useDeleteApp, useDeleteBlob, useDeleteOrg, useDeleteTeam, useEphemeral, useExecute, useInviteRedemption, useMero, useOrg, usePackages, usePasskeys, useRedeemInvite, useRemoveMember, useRemoveTeamMember, useSetAppMetadata, useSetCapabilities, useSetMember, useSetMemberMetadata, useSetOrgMetadata, useSetTeamMember, useSubscription, useTeam, useUpdateTeam, useUpgradeApp, useUploadBlob, useView };
package/dist/index.d.ts CHANGED
@@ -1126,6 +1126,8 @@ interface CalimeroLogoProps extends React__default.SVGAttributes<SVGSVGElement>
1126
1126
  }
1127
1127
  declare function CalimeroLogo({ size, color, style, ...rest }: CalimeroLogoProps): react_jsx_runtime.JSX.Element;
1128
1128
 
1129
+ type NodeConsentPhase = 'idle' | 'approving' | 'redirect' | 'creating';
1130
+
1129
1131
  /** What the app is told once the workspace exists. */
1130
1132
  interface CreatedWorkspace {
1131
1133
  orgId: string;
@@ -1133,7 +1135,7 @@ interface CreatedWorkspace {
1133
1135
  name: string;
1134
1136
  selfName: string;
1135
1137
  }
1136
- type CreatePhase = 'idle' | 'approving' | 'redirect' | 'creating';
1138
+ type CreatePhase = NodeConsentPhase;
1137
1139
  interface UseCreateWorkspaceOptions {
1138
1140
  /** Where the node's consent page sends the person back: a page of the app that mounts `ConsentPopupReturn`. */
1139
1141
  returnTo: string;
@@ -1141,19 +1143,22 @@ interface UseCreateWorkspaceOptions {
1141
1143
  }
1142
1144
  /**
1143
1145
  * Creates a workspace. A session bound to the app's frontend asks the node's
1144
- * consent page (in a pop-up, else a full-page trip); any other session creates
1145
- * the organization directly. Resolves through `onCreated`; `error` is the
1146
- * node's own message, or what happened to the approval.
1146
+ * consent page (in a pop-up, else a full-page trip after `proceed`); any other
1147
+ * session creates the organization directly. Resolves through `onCreated`;
1148
+ * `error` is the node's own message, or what happened to the approval.
1147
1149
  */
1148
1150
  declare function useCreateWorkspace({ returnTo, onCreated }: UseCreateWorkspaceOptions): {
1149
- create: (name: string, selfName: string) => void;
1150
1151
  cancel: () => void;
1151
1152
  reopen: () => void;
1152
1153
  proceed: () => void | undefined;
1153
- phase: CreatePhase;
1154
+ clearError: () => void;
1155
+ phase: NodeConsentPhase;
1154
1156
  error: string | null;
1157
+ errorCode: string | null;
1155
1158
  code: string | null;
1156
1159
  ready: boolean;
1160
+ bound: boolean | null;
1161
+ create: (name: string, selfName: string) => void;
1157
1162
  };
1158
1163
  /**
1159
1164
  * Finishes a workspace the person approved on a full-page trip to the node:
@@ -1251,4 +1256,76 @@ declare function ConsentPopupReturn({ children }: {
1251
1256
  /** The cluster a node belongs to (`eu-shared-1`), from its URL; `merod local` for a loopback node, else the host. */
1252
1257
  declare function clusterName(nodeUrl: string): string;
1253
1258
 
1254
- export { type AppEvent, type AsyncState, type BlobHookOptions, CONSENT_RETURN_MESSAGE, CalimeroLogo, type CalimeroLogoProps, type CallOptions, type Codec, ConnectButton, type ConnectButtonProps, ConsentPopupReturn, type CreateApiKeyInput, type CreateAppInput, type CreateInviteInput, type CreatePhase, type CreateTeamInput, CreateWorkspaceDialog, type CreateWorkspaceDialogProps, type CreateWorkspaceLabels, type CreatedWorkspace, type EphemeralEntry, type Failure, type FailureKind, type InviteRedemption, type InviteRedemptionStatus, LoginModal, type LoginModalProps, type LoginModalTab, MERO_CSS_VARS, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, type MutationOptions, NoAppError, NotConnectedError, type PolicyOptions, type ResolvedMeroTheme, type ResourceState, ReviewRelease, SessionReportingClient, type SessionStore, type SubscriptionEventData, type SubscriptionOptions, type TeamJoin, type TeamUpdate, UnreleasedApp, type UpgradeTarget, type UseBlobUrlOptions, type UseCreateWorkspaceOptions, type UseEphemeralOptions, type UseEphemeralResult, type UseViewOptions, type UseViewResult, type ViewOptions, type WaitOptions, WorkspaceReview, type WorkspaceReviewProps, clearAllStorage, clearAppId, clearCluster, clearNodeUrl, clusterName, cssVar, defaultMeroTheme, describeError, followEvents, getAppId, getCluster, getNodeUrl, inviteLink, isLoginRequired, jsonCodec, localStorageSessionStore, memorySessionStore, readInviteToken, reportSessions, resolveMeroTheme, resolvePolicy, setAppId, setCluster, setNodeUrl, shortAccount, themeToCssVars, useAccount, useApiKeys, useApp, useAppAbi, useApps, useBlobInfo, useBlobUrl, useBlobs, useConsent, useCreateApp, useCreateInvite, useCreateOrg, useCreateTeam, useCreateWorkspace, useCreateWorkspaceResume, useDeleteApp, useDeleteBlob, useDeleteOrg, useDeleteTeam, useEphemeral, useExecute, useInviteRedemption, useMero, useOrg, usePackages, usePasskeys, useRedeemInvite, useRemoveMember, useRemoveTeamMember, useSetAppMetadata, useSetCapabilities, useSetMember, useSetMemberMetadata, useSetOrgMetadata, useSetTeamMember, useSubscription, useTeam, useUpdateTeam, useUpgradeApp, useUploadBlob, useView };
1259
+ type InviteRole = Exclude<OrgRole, 'owner'>;
1260
+ /** An invite just created. */
1261
+ interface CreatedInvite {
1262
+ token: string;
1263
+ /** The link to share: the token in the fragment of `linkBase`. */
1264
+ link: string;
1265
+ /** The capability bits it grants; absent for the workspace's member defaults. */
1266
+ capabilities?: number;
1267
+ }
1268
+
1269
+ /** The dialog's wording, so each app keeps its own. */
1270
+ interface InviteLabels {
1271
+ title?: string;
1272
+ subtitle?: string;
1273
+ next?: string;
1274
+ }
1275
+ interface InviteDialogProps {
1276
+ open: boolean;
1277
+ onClose: () => void;
1278
+ /** The workspace (organization) people are invited to. */
1279
+ org: string;
1280
+ /** The app's team(s) the invitee joins too, e.g. its app team. */
1281
+ teams?: string[];
1282
+ /** The role the invite gives. Default `member`. */
1283
+ role?: InviteRole;
1284
+ appName?: string;
1285
+ labels?: InviteLabels;
1286
+ /** Called once the invite exists, from the dialog or from a full-page approval. */
1287
+ onInvited?: (invite: CreatedInvite) => void;
1288
+ /** The page the link opens. Default: this page. */
1289
+ linkBase?: string;
1290
+ /** Where the node's consent page sends the person back. Default: this origin's root, where the app mounts `ConsentPopupReturn`. */
1291
+ returnTo?: string;
1292
+ /** The app's own client, wrapped in a `MeroProvider` here. Without it the ambient `MeroProvider` is used. */
1293
+ client?: CalimeroClient;
1294
+ /** The passkey prompt, with `client`. */
1295
+ passkey?: PasskeyProvider;
1296
+ }
1297
+ /**
1298
+ * Invite people to a workspace: choose their permissions (the workspace's
1299
+ * defaults, or a custom set the inviter holds), create the invite (through the
1300
+ * node's consent page for a session bound to the app), then share the link.
1301
+ * Mount it once and toggle `open`: it also finishes an invite approved on a
1302
+ * full-page trip to the node. Needs a `MeroProvider`, or pass `client`.
1303
+ */
1304
+ declare function InviteDialog({ client, passkey, ...props }: InviteDialogProps): react_jsx_runtime.JSX.Element;
1305
+
1306
+ interface AcceptInviteDialogProps {
1307
+ open: boolean;
1308
+ onClose: () => void;
1309
+ /** The invite token from the link (`readInviteToken`, or `useInviteRedemption`'s `token`). */
1310
+ token: string;
1311
+ appName?: string;
1312
+ /** Called once the person has joined, from the dialog or from a full-page approval. */
1313
+ onJoined: (joined: {
1314
+ org: string;
1315
+ }) => void;
1316
+ /** Where the node's consent page sends the person back. Default: this origin's root, where the app mounts `ConsentPopupReturn`. */
1317
+ returnTo?: string;
1318
+ client?: CalimeroClient;
1319
+ passkey?: PasskeyProvider;
1320
+ }
1321
+ /**
1322
+ * Join a workspace with an invite: asks the node's consent page for a session
1323
+ * bound to the app, else redeems the invite directly. Mount it once and toggle
1324
+ * `open`; it also finishes a join approved on a full-page trip to the node.
1325
+ */
1326
+ declare function AcceptInviteDialog({ client, passkey, ...props }: AcceptInviteDialogProps): react_jsx_runtime.JSX.Element;
1327
+
1328
+ /** The labels of the bits set in `mask`, in display order. */
1329
+ declare function describeCapabilities(mask: number): string[];
1330
+
1331
+ export { AcceptInviteDialog, type AcceptInviteDialogProps, type AppEvent, type AsyncState, type BlobHookOptions, CONSENT_RETURN_MESSAGE, CalimeroLogo, type CalimeroLogoProps, type CallOptions, type Codec, ConnectButton, type ConnectButtonProps, ConsentPopupReturn, type CreateApiKeyInput, type CreateAppInput, type CreateInviteInput, type CreatePhase, type CreateTeamInput, CreateWorkspaceDialog, type CreateWorkspaceDialogProps, type CreateWorkspaceLabels, type CreatedInvite, type CreatedWorkspace, type EphemeralEntry, type Failure, type FailureKind, InviteDialog, type InviteDialogProps, type InviteLabels, type InviteRedemption, type InviteRedemptionStatus, type InviteRole, LoginModal, type LoginModalProps, type LoginModalTab, MERO_CSS_VARS, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, type MutationOptions, NoAppError, NotConnectedError, type PolicyOptions, type ResolvedMeroTheme, type ResourceState, ReviewRelease, SessionReportingClient, type SessionStore, type SubscriptionEventData, type SubscriptionOptions, type TeamJoin, type TeamUpdate, UnreleasedApp, type UpgradeTarget, type UseBlobUrlOptions, type UseCreateWorkspaceOptions, type UseEphemeralOptions, type UseEphemeralResult, type UseViewOptions, type UseViewResult, type ViewOptions, type WaitOptions, WorkspaceReview, type WorkspaceReviewProps, clearAllStorage, clearAppId, clearCluster, clearNodeUrl, clusterName, cssVar, defaultMeroTheme, describeCapabilities, describeError, followEvents, getAppId, getCluster, getNodeUrl, inviteLink, isLoginRequired, jsonCodec, localStorageSessionStore, memorySessionStore, readInviteToken, reportSessions, resolveMeroTheme, resolvePolicy, setAppId, setCluster, setNodeUrl, shortAccount, themeToCssVars, useAccount, useApiKeys, useApp, useAppAbi, useApps, useBlobInfo, useBlobUrl, useBlobs, useConsent, useCreateApp, useCreateInvite, useCreateOrg, useCreateTeam, useCreateWorkspace, useCreateWorkspaceResume, useDeleteApp, useDeleteBlob, useDeleteOrg, useDeleteTeam, useEphemeral, useExecute, useInviteRedemption, useMero, useOrg, usePackages, usePasskeys, useRedeemInvite, useRemoveMember, useRemoveTeamMember, useSetAppMetadata, useSetCapabilities, useSetMember, useSetMemberMetadata, useSetOrgMetadata, useSetTeamMember, useSubscription, useTeam, useUpdateTeam, useUpgradeApp, useUploadBlob, useView };