@calimero-network/mero-react 11.3.0 → 11.4.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
@@ -1,9 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { CSSProperties } from 'react';
3
+ import React__default, { CSSProperties, ReactNode } from 'react';
4
4
  import * as _calimero_network_mero_js from '@calimero-network/mero-js';
5
5
  import { NodePolicy, CalimeroClient, CalimeroClientOptions, CalimeroSession, PasskeyProvider, RetryOptions, CallResult, ViewResult, OrgRole, TeamRole, ConsentRequest, OpenConsentOptions, ConsentResult } from '@calimero-network/mero-js';
6
6
  export * from '@calimero-network/mero-js';
7
+ import { R as ReviewRelease, U as UnreleasedApp } from './nodeChecks-B_vMN73N.cjs';
7
8
 
8
9
  /**
9
10
  * The `CalimeroClient` the provider holds, and the policy it verifies nodes
@@ -1125,4 +1126,121 @@ interface CalimeroLogoProps extends React__default.SVGAttributes<SVGSVGElement>
1125
1126
  }
1126
1127
  declare function CalimeroLogo({ size, color, style, ...rest }: CalimeroLogoProps): react_jsx_runtime.JSX.Element;
1127
1128
 
1128
- export { type AppEvent, type AsyncState, type BlobHookOptions, CalimeroLogo, type CalimeroLogoProps, type CallOptions, type Codec, ConnectButton, type ConnectButtonProps, type CreateApiKeyInput, type CreateAppInput, type CreateInviteInput, type CreateTeamInput, 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, SessionReportingClient, type SessionStore, type SubscriptionEventData, type SubscriptionOptions, type TeamJoin, type TeamUpdate, type UpgradeTarget, type UseBlobUrlOptions, type UseEphemeralOptions, type UseEphemeralResult, type UseViewOptions, type UseViewResult, type ViewOptions, type WaitOptions, clearAllStorage, clearAppId, clearCluster, clearNodeUrl, 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, 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 };
1129
+ /** What the app is told once the workspace exists. */
1130
+ interface CreatedWorkspace {
1131
+ orgId: string;
1132
+ /** The workspace's name, as the person typed it. */
1133
+ name: string;
1134
+ selfName: string;
1135
+ }
1136
+ type CreatePhase = 'idle' | 'approving' | 'redirect' | 'creating';
1137
+ interface UseCreateWorkspaceOptions {
1138
+ /** Where the node's consent page sends the person back: a page of the app that mounts `ConsentPopupReturn`. */
1139
+ returnTo: string;
1140
+ onCreated: (workspace: CreatedWorkspace) => void;
1141
+ }
1142
+ /**
1143
+ * 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.
1147
+ */
1148
+ declare function useCreateWorkspace({ returnTo, onCreated }: UseCreateWorkspaceOptions): {
1149
+ create: (name: string, selfName: string) => void;
1150
+ cancel: () => void;
1151
+ reopen: () => void;
1152
+ proceed: () => void | undefined;
1153
+ phase: CreatePhase;
1154
+ error: string | null;
1155
+ code: string | null;
1156
+ ready: boolean;
1157
+ };
1158
+ /**
1159
+ * Finishes a workspace the person approved on a full-page trip to the node:
1160
+ * call it where the app starts, with the same `onCreated`. `message` says why
1161
+ * nothing was created (declined, or a return that is not this tab's request).
1162
+ */
1163
+ declare function useCreateWorkspaceResume({ onCreated }: Pick<UseCreateWorkspaceOptions, 'onCreated'>): {
1164
+ message: string | null;
1165
+ };
1166
+
1167
+ /** The dialog's wording, so each app keeps its own. */
1168
+ interface CreateWorkspaceLabels {
1169
+ title?: string;
1170
+ subtitle?: string;
1171
+ nameLabel?: string;
1172
+ namePlaceholder?: string;
1173
+ selfLabel?: string;
1174
+ selfPlaceholder?: string;
1175
+ next?: string;
1176
+ }
1177
+ interface CreateWorkspaceDialogProps {
1178
+ open: boolean;
1179
+ onClose: () => void;
1180
+ /**
1181
+ * The release the workspace will run, reviewed before creating. `null`
1182
+ * while the newest release is still being read; `{ package }` for a build
1183
+ * with no published release.
1184
+ */
1185
+ release: ReviewRelease | UnreleasedApp | null;
1186
+ /** Called once the workspace exists, from the dialog or from a full-page approval. The app does its own follow-ups. */
1187
+ onCreated: (workspace: CreatedWorkspace) => void;
1188
+ /** Where the node's consent page sends the person back. Default: this origin's root, where the app mounts `ConsentPopupReturn`. */
1189
+ returnTo?: string;
1190
+ labels?: CreateWorkspaceLabels;
1191
+ /** Prefills "your name" (an app's last used name). */
1192
+ defaultSelfName?: string;
1193
+ /** The label under "Where it runs". Default: the cluster named by the node in use. */
1194
+ cluster?: string | null;
1195
+ /** The app's own client, wrapped in a `MeroProvider` here. Without it the ambient `MeroProvider` is used. */
1196
+ client?: CalimeroClient;
1197
+ /** The passkey prompt, with `client`. */
1198
+ passkey?: PasskeyProvider;
1199
+ }
1200
+ /**
1201
+ * Create a workspace in three steps: names, review, and (on a session bound to
1202
+ * the app's frontend) approval on the node's own page. Mount it once under
1203
+ * sign-in and toggle `open`: it also finishes a workspace approved on a
1204
+ * full-page trip to the node. Needs a `MeroProvider`, or pass `client`.
1205
+ */
1206
+ declare function CreateWorkspaceDialog({ client, passkey, ...props }: CreateWorkspaceDialogProps): react_jsx_runtime.JSX.Element;
1207
+
1208
+ interface WorkspaceReviewProps {
1209
+ /** The client of the node the workspace will be created on; `null` while there is none. */
1210
+ client: CalimeroClient | null;
1211
+ /** The cluster's name, as shown under "Where it runs". */
1212
+ cluster?: string;
1213
+ /** A local development node: its label already says how many nodes there are. */
1214
+ local?: boolean;
1215
+ /** The package release the workspace will run. */
1216
+ release: ReviewRelease | UnreleasedApp;
1217
+ /** The workspace is being created: both buttons wait. */
1218
+ creating?: boolean;
1219
+ /** Create waits for something else (the app is still finding out how to ask the node). */
1220
+ disabled?: boolean;
1221
+ onBack: () => void;
1222
+ onCreate: () => void;
1223
+ }
1224
+ /**
1225
+ * Step 2 of creating a workspace: what the app is, what it can do, where it
1226
+ * runs and what that means for the data, from the release's signed capability
1227
+ * card and the node's own check. Read by the person before "Create workspace",
1228
+ * which stays disabled while the node has refused its check.
1229
+ */
1230
+ declare function WorkspaceReview({ client, cluster, local, release, creating, disabled, onBack, onCreate }: WorkspaceReviewProps): react_jsx_runtime.JSX.Element;
1231
+
1232
+ /** The `postMessage` type the consent pop-up sends its opener when the node sends it back. */
1233
+ declare const CONSENT_RETURN_MESSAGE = "mero:consent-return";
1234
+ /**
1235
+ * Mount at the app's root. In the pop-up the node's consent page sends back to
1236
+ * the app, it tells the opener (which confirms with the node) and closes the
1237
+ * window, rendering nothing; anywhere else it renders `children`.
1238
+ */
1239
+ declare function ConsentPopupReturn({ children }: {
1240
+ children?: ReactNode;
1241
+ }): react_jsx_runtime.JSX.Element | null;
1242
+
1243
+ /** The cluster a node belongs to (`eu-shared-1`), from its URL; `merod local` for a loopback node, else the host. */
1244
+ declare function clusterName(nodeUrl: string): string;
1245
+
1246
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { CSSProperties } from 'react';
3
+ import React__default, { CSSProperties, ReactNode } from 'react';
4
4
  import * as _calimero_network_mero_js from '@calimero-network/mero-js';
5
5
  import { NodePolicy, CalimeroClient, CalimeroClientOptions, CalimeroSession, PasskeyProvider, RetryOptions, CallResult, ViewResult, OrgRole, TeamRole, ConsentRequest, OpenConsentOptions, ConsentResult } from '@calimero-network/mero-js';
6
6
  export * from '@calimero-network/mero-js';
7
+ import { R as ReviewRelease, U as UnreleasedApp } from './nodeChecks-B_vMN73N.js';
7
8
 
8
9
  /**
9
10
  * The `CalimeroClient` the provider holds, and the policy it verifies nodes
@@ -1125,4 +1126,121 @@ interface CalimeroLogoProps extends React__default.SVGAttributes<SVGSVGElement>
1125
1126
  }
1126
1127
  declare function CalimeroLogo({ size, color, style, ...rest }: CalimeroLogoProps): react_jsx_runtime.JSX.Element;
1127
1128
 
1128
- export { type AppEvent, type AsyncState, type BlobHookOptions, CalimeroLogo, type CalimeroLogoProps, type CallOptions, type Codec, ConnectButton, type ConnectButtonProps, type CreateApiKeyInput, type CreateAppInput, type CreateInviteInput, type CreateTeamInput, 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, SessionReportingClient, type SessionStore, type SubscriptionEventData, type SubscriptionOptions, type TeamJoin, type TeamUpdate, type UpgradeTarget, type UseBlobUrlOptions, type UseEphemeralOptions, type UseEphemeralResult, type UseViewOptions, type UseViewResult, type ViewOptions, type WaitOptions, clearAllStorage, clearAppId, clearCluster, clearNodeUrl, 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, 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 };
1129
+ /** What the app is told once the workspace exists. */
1130
+ interface CreatedWorkspace {
1131
+ orgId: string;
1132
+ /** The workspace's name, as the person typed it. */
1133
+ name: string;
1134
+ selfName: string;
1135
+ }
1136
+ type CreatePhase = 'idle' | 'approving' | 'redirect' | 'creating';
1137
+ interface UseCreateWorkspaceOptions {
1138
+ /** Where the node's consent page sends the person back: a page of the app that mounts `ConsentPopupReturn`. */
1139
+ returnTo: string;
1140
+ onCreated: (workspace: CreatedWorkspace) => void;
1141
+ }
1142
+ /**
1143
+ * 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.
1147
+ */
1148
+ declare function useCreateWorkspace({ returnTo, onCreated }: UseCreateWorkspaceOptions): {
1149
+ create: (name: string, selfName: string) => void;
1150
+ cancel: () => void;
1151
+ reopen: () => void;
1152
+ proceed: () => void | undefined;
1153
+ phase: CreatePhase;
1154
+ error: string | null;
1155
+ code: string | null;
1156
+ ready: boolean;
1157
+ };
1158
+ /**
1159
+ * Finishes a workspace the person approved on a full-page trip to the node:
1160
+ * call it where the app starts, with the same `onCreated`. `message` says why
1161
+ * nothing was created (declined, or a return that is not this tab's request).
1162
+ */
1163
+ declare function useCreateWorkspaceResume({ onCreated }: Pick<UseCreateWorkspaceOptions, 'onCreated'>): {
1164
+ message: string | null;
1165
+ };
1166
+
1167
+ /** The dialog's wording, so each app keeps its own. */
1168
+ interface CreateWorkspaceLabels {
1169
+ title?: string;
1170
+ subtitle?: string;
1171
+ nameLabel?: string;
1172
+ namePlaceholder?: string;
1173
+ selfLabel?: string;
1174
+ selfPlaceholder?: string;
1175
+ next?: string;
1176
+ }
1177
+ interface CreateWorkspaceDialogProps {
1178
+ open: boolean;
1179
+ onClose: () => void;
1180
+ /**
1181
+ * The release the workspace will run, reviewed before creating. `null`
1182
+ * while the newest release is still being read; `{ package }` for a build
1183
+ * with no published release.
1184
+ */
1185
+ release: ReviewRelease | UnreleasedApp | null;
1186
+ /** Called once the workspace exists, from the dialog or from a full-page approval. The app does its own follow-ups. */
1187
+ onCreated: (workspace: CreatedWorkspace) => void;
1188
+ /** Where the node's consent page sends the person back. Default: this origin's root, where the app mounts `ConsentPopupReturn`. */
1189
+ returnTo?: string;
1190
+ labels?: CreateWorkspaceLabels;
1191
+ /** Prefills "your name" (an app's last used name). */
1192
+ defaultSelfName?: string;
1193
+ /** The label under "Where it runs". Default: the cluster named by the node in use. */
1194
+ cluster?: string | null;
1195
+ /** The app's own client, wrapped in a `MeroProvider` here. Without it the ambient `MeroProvider` is used. */
1196
+ client?: CalimeroClient;
1197
+ /** The passkey prompt, with `client`. */
1198
+ passkey?: PasskeyProvider;
1199
+ }
1200
+ /**
1201
+ * Create a workspace in three steps: names, review, and (on a session bound to
1202
+ * the app's frontend) approval on the node's own page. Mount it once under
1203
+ * sign-in and toggle `open`: it also finishes a workspace approved on a
1204
+ * full-page trip to the node. Needs a `MeroProvider`, or pass `client`.
1205
+ */
1206
+ declare function CreateWorkspaceDialog({ client, passkey, ...props }: CreateWorkspaceDialogProps): react_jsx_runtime.JSX.Element;
1207
+
1208
+ interface WorkspaceReviewProps {
1209
+ /** The client of the node the workspace will be created on; `null` while there is none. */
1210
+ client: CalimeroClient | null;
1211
+ /** The cluster's name, as shown under "Where it runs". */
1212
+ cluster?: string;
1213
+ /** A local development node: its label already says how many nodes there are. */
1214
+ local?: boolean;
1215
+ /** The package release the workspace will run. */
1216
+ release: ReviewRelease | UnreleasedApp;
1217
+ /** The workspace is being created: both buttons wait. */
1218
+ creating?: boolean;
1219
+ /** Create waits for something else (the app is still finding out how to ask the node). */
1220
+ disabled?: boolean;
1221
+ onBack: () => void;
1222
+ onCreate: () => void;
1223
+ }
1224
+ /**
1225
+ * Step 2 of creating a workspace: what the app is, what it can do, where it
1226
+ * runs and what that means for the data, from the release's signed capability
1227
+ * card and the node's own check. Read by the person before "Create workspace",
1228
+ * which stays disabled while the node has refused its check.
1229
+ */
1230
+ declare function WorkspaceReview({ client, cluster, local, release, creating, disabled, onBack, onCreate }: WorkspaceReviewProps): react_jsx_runtime.JSX.Element;
1231
+
1232
+ /** The `postMessage` type the consent pop-up sends its opener when the node sends it back. */
1233
+ declare const CONSENT_RETURN_MESSAGE = "mero:consent-return";
1234
+ /**
1235
+ * Mount at the app's root. In the pop-up the node's consent page sends back to
1236
+ * the app, it tells the opener (which confirms with the node) and closes the
1237
+ * window, rendering nothing; anywhere else it renders `children`.
1238
+ */
1239
+ declare function ConsentPopupReturn({ children }: {
1240
+ children?: ReactNode;
1241
+ }): react_jsx_runtime.JSX.Element | null;
1242
+
1243
+ /** The cluster a node belongs to (`eu-shared-1`), from its URL; `merod local` for a loopback node, else the host. */
1244
+ declare function clusterName(nodeUrl: string): string;
1245
+
1246
+ 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 };