@calimero-network/mero-react 9.15.0 → 9.16.1
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/README.md +14 -3
- package/dist/index.cjs +224 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +222 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -680,6 +680,15 @@ declare function onInvitation(listener: Listener): () => void;
|
|
|
680
680
|
* to know, such as a bootstrap deciding where to land the user.
|
|
681
681
|
*/
|
|
682
682
|
declare function peekInvitation(): CapturedInvitation | null;
|
|
683
|
+
/**
|
|
684
|
+
* Be told when the captured invitation changes: one arrives, or it is acked.
|
|
685
|
+
*
|
|
686
|
+
* Unlike `onInvitation` this takes nothing: the invitation stays buffered for
|
|
687
|
+
* whoever redeems it. It is for UI that only needs to know one is pending — the
|
|
688
|
+
* logged-out invitation screen — and pairs with `peekInvitation` as a
|
|
689
|
+
* `useSyncExternalStore` source.
|
|
690
|
+
*/
|
|
691
|
+
declare function subscribeInvitation(watcher: () => void): () => void;
|
|
683
692
|
/** Test seam: drop the controller and any buffered intent. */
|
|
684
693
|
declare function resetInvitationCaptureForTests(): void;
|
|
685
694
|
|
|
@@ -927,6 +936,31 @@ interface JoinSyncBannerProps {
|
|
|
927
936
|
*/
|
|
928
937
|
declare function JoinSyncBanner({ show, what, onDismiss, className, style, children, }: JoinSyncBannerProps): react_jsx_runtime.JSX.Element | null;
|
|
929
938
|
|
|
939
|
+
interface InvitationGateProps {
|
|
940
|
+
/**
|
|
941
|
+
* The app, shown as usual unless an invitation is waiting on a login. Leave
|
|
942
|
+
* out to mount the gate beside the app instead, as a full-page layer.
|
|
943
|
+
*/
|
|
944
|
+
children?: ReactNode;
|
|
945
|
+
/**
|
|
946
|
+
* The app's invitation codec, the same `parse` it gives `useInviteRedemption`.
|
|
947
|
+
* Decoding needs no session, so the screen can name what is being joined.
|
|
948
|
+
* Without it the screen falls back to the noun.
|
|
949
|
+
*/
|
|
950
|
+
parse?: (token: string, params: Record<string, string>) => ParsedInvitation | null;
|
|
951
|
+
/** What the app calls the thing being joined: "team", "workspace", "vault". */
|
|
952
|
+
noun?: string;
|
|
953
|
+
/** The app's name, so a person knows where the invitation is taking them. */
|
|
954
|
+
appName?: string;
|
|
955
|
+
/** Optional: the app's own words about what joining gives you. */
|
|
956
|
+
detail?: string;
|
|
957
|
+
/** Passed to the login button (theme, `cloud`, `connectionType`). */
|
|
958
|
+
connectButtonProps?: Omit<ConnectButtonProps, 'label'>;
|
|
959
|
+
}
|
|
960
|
+
/** The captured invitation, re-rendering when one arrives or is acked. */
|
|
961
|
+
declare function usePendingInvitation(): CapturedInvitation | null;
|
|
962
|
+
declare function InvitationGate({ children, parse, noun, appName, detail, connectButtonProps, }: InvitationGateProps): react_jsx_runtime.JSX.Element | null;
|
|
963
|
+
|
|
930
964
|
interface JoinInvitationInput {
|
|
931
965
|
readonly namespaceId: string;
|
|
932
966
|
/** The context the invitation was for, when it names one; a workspace invitation names none. */
|
|
@@ -1815,4 +1849,4 @@ declare function clearAllStorage(): void;
|
|
|
1815
1849
|
*/
|
|
1816
1850
|
declare function isDesktopWindow(): boolean;
|
|
1817
1851
|
|
|
1818
|
-
export { type AccountEnrolment, AccountSignInPanel, type AccountSignInPanelProps, type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, CalimeroLogo, type CalimeroLogoProps, type CapturedInvitation, ConnectButton, ConnectButtonAccount, type ConnectButtonAccountProps, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CreatePrivateContextRequest, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type ExecutionResult, INVITATION_PARAM, INVITATION_READY_MS, InvitationDialog, type InvitationDialogProps, type InvitationDialogStage, type InviteRedemption, type InviteState, JOIN_ACTION, JOIN_SYNC_MAX_MS, JOIN_SYNC_POLL_MS, JOIN_SYNC_WATCHDOG_MS, type JoinInvitationInput, type JoinInvitationResult, type JoinInvitationStep, JoinSyncBanner, type JoinSyncBannerProps, type JoinSyncOptions, type JoinSyncState, LoginModal, type LoginModalProps, type LoginModalTab, MAX_AUTO_JOIN_ATTEMPTS, MERO_CSS_VARS, type MeroCapabilities, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, type ParsedInvitation, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseAccountEnrolmentOptions, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, type UseInviteRedemptionOptions, buildInviteLink, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNamespaceJustJoined, clearNodeUrl, clearTokenNodeUrl, cssVar, defaultMeroTheme, describeInviteFailure, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getPermissionsForMode, getTokenNodeUrl, invitationFromRaw, isDesktopWindow, isFinalInvitationError, isNamespaceJustJoined, isReturningFromWallet, localStorageTokenStorage, markNamespaceJustJoined, onInvitation, peekInvitation, primeInvitationCapture, resetInvitationCaptureForTests, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, subscribeJustJoined, themeToCssVars, urlWithoutInvitation, useAccountEnrolment, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useInviteRedemption, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useJoinSync, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
|
|
1852
|
+
export { type AccountEnrolment, AccountSignInPanel, type AccountSignInPanelProps, type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, CalimeroLogo, type CalimeroLogoProps, type CapturedInvitation, ConnectButton, ConnectButtonAccount, type ConnectButtonAccountProps, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CreatePrivateContextRequest, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type ExecutionResult, INVITATION_PARAM, INVITATION_READY_MS, InvitationDialog, type InvitationDialogProps, type InvitationDialogStage, InvitationGate, type InvitationGateProps, type InviteRedemption, type InviteState, JOIN_ACTION, JOIN_SYNC_MAX_MS, JOIN_SYNC_POLL_MS, JOIN_SYNC_WATCHDOG_MS, type JoinInvitationInput, type JoinInvitationResult, type JoinInvitationStep, JoinSyncBanner, type JoinSyncBannerProps, type JoinSyncOptions, type JoinSyncState, LoginModal, type LoginModalProps, type LoginModalTab, MAX_AUTO_JOIN_ATTEMPTS, MERO_CSS_VARS, type MeroCapabilities, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, type ParsedInvitation, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseAccountEnrolmentOptions, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, type UseInviteRedemptionOptions, buildInviteLink, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNamespaceJustJoined, clearNodeUrl, clearTokenNodeUrl, cssVar, defaultMeroTheme, describeInviteFailure, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getPermissionsForMode, getTokenNodeUrl, invitationFromRaw, isDesktopWindow, isFinalInvitationError, isNamespaceJustJoined, isReturningFromWallet, localStorageTokenStorage, markNamespaceJustJoined, onInvitation, peekInvitation, primeInvitationCapture, resetInvitationCaptureForTests, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, subscribeInvitation, subscribeJustJoined, themeToCssVars, urlWithoutInvitation, useAccountEnrolment, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useInviteRedemption, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useJoinSync, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, usePendingInvitation, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
|
package/dist/index.d.ts
CHANGED
|
@@ -680,6 +680,15 @@ declare function onInvitation(listener: Listener): () => void;
|
|
|
680
680
|
* to know, such as a bootstrap deciding where to land the user.
|
|
681
681
|
*/
|
|
682
682
|
declare function peekInvitation(): CapturedInvitation | null;
|
|
683
|
+
/**
|
|
684
|
+
* Be told when the captured invitation changes: one arrives, or it is acked.
|
|
685
|
+
*
|
|
686
|
+
* Unlike `onInvitation` this takes nothing: the invitation stays buffered for
|
|
687
|
+
* whoever redeems it. It is for UI that only needs to know one is pending — the
|
|
688
|
+
* logged-out invitation screen — and pairs with `peekInvitation` as a
|
|
689
|
+
* `useSyncExternalStore` source.
|
|
690
|
+
*/
|
|
691
|
+
declare function subscribeInvitation(watcher: () => void): () => void;
|
|
683
692
|
/** Test seam: drop the controller and any buffered intent. */
|
|
684
693
|
declare function resetInvitationCaptureForTests(): void;
|
|
685
694
|
|
|
@@ -927,6 +936,31 @@ interface JoinSyncBannerProps {
|
|
|
927
936
|
*/
|
|
928
937
|
declare function JoinSyncBanner({ show, what, onDismiss, className, style, children, }: JoinSyncBannerProps): react_jsx_runtime.JSX.Element | null;
|
|
929
938
|
|
|
939
|
+
interface InvitationGateProps {
|
|
940
|
+
/**
|
|
941
|
+
* The app, shown as usual unless an invitation is waiting on a login. Leave
|
|
942
|
+
* out to mount the gate beside the app instead, as a full-page layer.
|
|
943
|
+
*/
|
|
944
|
+
children?: ReactNode;
|
|
945
|
+
/**
|
|
946
|
+
* The app's invitation codec, the same `parse` it gives `useInviteRedemption`.
|
|
947
|
+
* Decoding needs no session, so the screen can name what is being joined.
|
|
948
|
+
* Without it the screen falls back to the noun.
|
|
949
|
+
*/
|
|
950
|
+
parse?: (token: string, params: Record<string, string>) => ParsedInvitation | null;
|
|
951
|
+
/** What the app calls the thing being joined: "team", "workspace", "vault". */
|
|
952
|
+
noun?: string;
|
|
953
|
+
/** The app's name, so a person knows where the invitation is taking them. */
|
|
954
|
+
appName?: string;
|
|
955
|
+
/** Optional: the app's own words about what joining gives you. */
|
|
956
|
+
detail?: string;
|
|
957
|
+
/** Passed to the login button (theme, `cloud`, `connectionType`). */
|
|
958
|
+
connectButtonProps?: Omit<ConnectButtonProps, 'label'>;
|
|
959
|
+
}
|
|
960
|
+
/** The captured invitation, re-rendering when one arrives or is acked. */
|
|
961
|
+
declare function usePendingInvitation(): CapturedInvitation | null;
|
|
962
|
+
declare function InvitationGate({ children, parse, noun, appName, detail, connectButtonProps, }: InvitationGateProps): react_jsx_runtime.JSX.Element | null;
|
|
963
|
+
|
|
930
964
|
interface JoinInvitationInput {
|
|
931
965
|
readonly namespaceId: string;
|
|
932
966
|
/** The context the invitation was for, when it names one; a workspace invitation names none. */
|
|
@@ -1815,4 +1849,4 @@ declare function clearAllStorage(): void;
|
|
|
1815
1849
|
*/
|
|
1816
1850
|
declare function isDesktopWindow(): boolean;
|
|
1817
1851
|
|
|
1818
|
-
export { type AccountEnrolment, AccountSignInPanel, type AccountSignInPanelProps, type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, CalimeroLogo, type CalimeroLogoProps, type CapturedInvitation, ConnectButton, ConnectButtonAccount, type ConnectButtonAccountProps, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CreatePrivateContextRequest, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type ExecutionResult, INVITATION_PARAM, INVITATION_READY_MS, InvitationDialog, type InvitationDialogProps, type InvitationDialogStage, type InviteRedemption, type InviteState, JOIN_ACTION, JOIN_SYNC_MAX_MS, JOIN_SYNC_POLL_MS, JOIN_SYNC_WATCHDOG_MS, type JoinInvitationInput, type JoinInvitationResult, type JoinInvitationStep, JoinSyncBanner, type JoinSyncBannerProps, type JoinSyncOptions, type JoinSyncState, LoginModal, type LoginModalProps, type LoginModalTab, MAX_AUTO_JOIN_ATTEMPTS, MERO_CSS_VARS, type MeroCapabilities, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, type ParsedInvitation, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseAccountEnrolmentOptions, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, type UseInviteRedemptionOptions, buildInviteLink, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNamespaceJustJoined, clearNodeUrl, clearTokenNodeUrl, cssVar, defaultMeroTheme, describeInviteFailure, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getPermissionsForMode, getTokenNodeUrl, invitationFromRaw, isDesktopWindow, isFinalInvitationError, isNamespaceJustJoined, isReturningFromWallet, localStorageTokenStorage, markNamespaceJustJoined, onInvitation, peekInvitation, primeInvitationCapture, resetInvitationCaptureForTests, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, subscribeJustJoined, themeToCssVars, urlWithoutInvitation, useAccountEnrolment, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useInviteRedemption, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useJoinSync, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
|
|
1852
|
+
export { type AccountEnrolment, AccountSignInPanel, type AccountSignInPanelProps, type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, CalimeroLogo, type CalimeroLogoProps, type CapturedInvitation, ConnectButton, ConnectButtonAccount, type ConnectButtonAccountProps, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CreatePrivateContextRequest, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type ExecutionResult, INVITATION_PARAM, INVITATION_READY_MS, InvitationDialog, type InvitationDialogProps, type InvitationDialogStage, InvitationGate, type InvitationGateProps, type InviteRedemption, type InviteState, JOIN_ACTION, JOIN_SYNC_MAX_MS, JOIN_SYNC_POLL_MS, JOIN_SYNC_WATCHDOG_MS, type JoinInvitationInput, type JoinInvitationResult, type JoinInvitationStep, JoinSyncBanner, type JoinSyncBannerProps, type JoinSyncOptions, type JoinSyncState, LoginModal, type LoginModalProps, type LoginModalTab, MAX_AUTO_JOIN_ATTEMPTS, MERO_CSS_VARS, type MeroCapabilities, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, type ParsedInvitation, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseAccountEnrolmentOptions, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, type UseInviteRedemptionOptions, buildInviteLink, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNamespaceJustJoined, clearNodeUrl, clearTokenNodeUrl, cssVar, defaultMeroTheme, describeInviteFailure, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getPermissionsForMode, getTokenNodeUrl, invitationFromRaw, isDesktopWindow, isFinalInvitationError, isNamespaceJustJoined, isReturningFromWallet, localStorageTokenStorage, markNamespaceJustJoined, onInvitation, peekInvitation, primeInvitationCapture, resetInvitationCaptureForTests, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, subscribeInvitation, subscribeJustJoined, themeToCssVars, urlWithoutInvitation, useAccountEnrolment, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useInviteRedemption, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useJoinSync, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, usePendingInvitation, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ function styleInject(css, { insertAt } = {}) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// src/components/styles.css
|
|
31
|
-
styleInject(':root {\n --mero-bg: #0d1117;\n --mero-bg-secondary: #161b22;\n --mero-bg-tertiary: #1c2128;\n --mero-text: #e6edf3;\n --mero-text-secondary: #8b949e;\n --mero-accent: #a5ff11;\n --mero-accent-hover: #8ed40d;\n --mero-on-primary: #0d1117;\n --mero-error: #ff6b6b;\n --mero-border: #30363d;\n --mero-disabled: #555555;\n --mero-shadow: rgba(0, 0, 0, 0.5);\n --mero-overlay: rgba(0, 0, 0, 0.75);\n --mero-radius: 8px;\n}\n.mero-connect-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 10px 20px;\n background-color: var(--mero-accent);\n border: 1px solid var(--mero-accent);\n border-radius: var(--mero-radius);\n cursor: pointer;\n font-size: 14px;\n font-weight: 600;\n letter-spacing: 0.01em;\n color: var(--mero-on-primary);\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n box-shadow 0.15s ease,\n transform 0.1s ease;\n min-width: 140px;\n box-sizing: border-box;\n font-family:\n "Inter",\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n Oxygen,\n Ubuntu,\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n line-height: 1;\n}\n.mero-connect-button:hover:not(.mero-connected):not(.mero-reconnecting) {\n background-color: var(--mero-accent-hover);\n border-color: var(--mero-accent-hover);\n box-shadow: 0 0 0 4px rgba(165, 255, 17, 0.18);\n box-shadow: 0 0 0 4px color-mix(in srgb, var(--mero-accent) 18%, transparent);\n}\n.mero-connect-button:active:not(.mero-connected):not(.mero-reconnecting) {\n transform: translateY(1px);\n}\n.mero-connect-button:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px rgba(165, 255, 17, 0.45);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mero-accent) 45%, transparent);\n}\n.mero-connect-button.mero-logo-only {\n min-width: 0;\n width: 40px;\n height: 40px;\n padding: 0;\n gap: 0;\n}\n.mero-connect-button.mero-connected {\n background-color: var(--mero-accent);\n color: var(--mero-on-primary);\n border-color: var(--mero-accent);\n}\n.mero-connect-button.mero-connected:hover {\n background-color: var(--mero-accent-hover);\n border-color: var(--mero-accent-hover);\n}\n.mero-connect-button.mero-reconnecting {\n background-color: var(--mero-bg-secondary);\n color: var(--mero-text-secondary);\n border-color: var(--mero-border);\n cursor: not-allowed;\n}\n.mero-connect-container {\n position: relative;\n display: inline-block;\n}\n.mero-dropdown {\n position: absolute;\n top: 100%;\n left: 0;\n background-color: var(--mero-bg-secondary);\n border: 1px solid var(--mero-border);\n border-radius: var(--mero-radius);\n margin-top: 6px;\n padding: 0;\n z-index: 1001;\n width: 100%;\n min-width: 180px;\n overflow: hidden;\n box-shadow: 0 8px 24px var(--mero-shadow);\n}\n.mero-dropdown-info {\n padding: 10px 16px;\n color: var(--mero-text-secondary);\n font-size: 13px;\n border-bottom: 1px solid var(--mero-border);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 220px;\n}\n.mero-dropdown-item {\n display: block;\n width: 100%;\n padding: 10px 16px;\n background: none;\n border: none;\n color: var(--mero-text);\n text-align: left;\n cursor: pointer;\n font-size: 14px;\n text-decoration: none;\n font-family: inherit;\n}\n.mero-dropdown-item:hover {\n background-color: var(--mero-accent);\n color: var(--mero-on-primary);\n}\n.mero-logo {\n width: 24px;\n height: 24px;\n color: currentColor;\n}\n@keyframes meroFadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes meroSlideIn {\n from {\n transform: translateY(-12px);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}\n@keyframes meroSpin {\n to {\n transform: rotate(360deg);\n }\n}\n.mero-invite-overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483646;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n background: var(--mero-overlay);\n font-family:\n "Inter",\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n Oxygen,\n Ubuntu,\n sans-serif;\n -webkit-font-smoothing: antialiased;\n}\n.mero-invite-dialog {\n box-sizing: border-box;\n width: min(420px, 100%);\n padding: 24px;\n border: 1px solid var(--mero-border);\n border-radius: calc(var(--mero-radius) * 1.5);\n background: var(--mero-bg-secondary);\n color: var(--mero-text);\n box-shadow: 0 16px 48px var(--mero-shadow);\n outline: none;\n animation: mero-invite-in 0.16s ease-out;\n}\n.mero-invite-app {\n margin: 0 0 12px;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--mero-text-secondary);\n}\n.mero-invite-head {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.mero-invite-title {\n margin: 0;\n min-width: 0;\n font-size: 18px;\n font-weight: 600;\n line-height: 1.3;\n overflow-wrap: anywhere;\n}\n.mero-invite-body {\n margin: 12px 0 0;\n font-size: 14px;\n line-height: 1.5;\n color: var(--mero-text-secondary);\n}\n.mero-invite-body-error {\n color: var(--mero-error);\n}\n.mero-invite-icon {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n border-radius: 50%;\n background: var(--mero-bg-tertiary);\n color: var(--mero-accent);\n}\n.mero-invite-icon-error {\n color: var(--mero-error);\n}\n.mero-invite-spinner {\n box-sizing: border-box;\n width: 36px;\n height: 36px;\n border: 3px solid var(--mero-bg-tertiary);\n border-top-color: var(--mero-accent);\n background: none;\n animation: mero-invite-spin 0.8s linear infinite;\n}\n.mero-invite-progress {\n position: relative;\n height: 3px;\n margin-top: 16px;\n overflow: hidden;\n border-radius: 2px;\n background: var(--mero-bg-tertiary);\n}\n.mero-invite-progress-bar {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 40%;\n border-radius: 2px;\n background: var(--mero-accent);\n animation: mero-invite-progress 1.4s ease-in-out infinite;\n}\n.mero-invite-actions {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: 8px;\n margin-top: 20px;\n}\n.mero-invite-actions:empty {\n display: none;\n}\n.mero-invite-button {\n padding: 9px 16px;\n border-radius: var(--mero-radius);\n font: inherit;\n font-size: 14px;\n font-weight: 600;\n line-height: 1.2;\n cursor: pointer;\n transition: background-color 0.15s ease, border-color 0.15s ease;\n}\n.mero-invite-button:focus-visible {\n outline: 2px solid var(--mero-accent);\n outline-offset: 2px;\n}\n.mero-invite-primary {\n border: 1px solid var(--mero-accent);\n background: var(--mero-accent);\n color: var(--mero-on-primary);\n}\n.mero-invite-primary:hover {\n border-color: var(--mero-accent-hover);\n background: var(--mero-accent-hover);\n}\n.mero-invite-secondary {\n border: 1px solid var(--mero-border);\n background: transparent;\n color: var(--mero-text);\n}\n.mero-invite-secondary:hover {\n background: var(--mero-bg-tertiary);\n}\n@keyframes mero-invite-spin {\n to {\n transform: rotate(360deg);\n }\n}\n@keyframes mero-invite-progress {\n from {\n left: -40%;\n }\n to {\n left: 100%;\n }\n}\n@keyframes mero-invite-in {\n from {\n opacity: 0;\n transform: translateY(6px) scale(0.98);\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .mero-invite-dialog,\n .mero-invite-spinner,\n .mero-invite-progress-bar {\n animation: none;\n }\n}\n');
|
|
31
|
+
styleInject(':root {\n --mero-bg: #0d1117;\n --mero-bg-secondary: #161b22;\n --mero-bg-tertiary: #1c2128;\n --mero-text: #e6edf3;\n --mero-text-secondary: #8b949e;\n --mero-accent: #a5ff11;\n --mero-accent-hover: #8ed40d;\n --mero-on-primary: #0d1117;\n --mero-error: #ff6b6b;\n --mero-border: #30363d;\n --mero-disabled: #555555;\n --mero-shadow: rgba(0, 0, 0, 0.5);\n --mero-overlay: rgba(0, 0, 0, 0.75);\n --mero-radius: 8px;\n}\n.mero-connect-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 10px 20px;\n background-color: var(--mero-accent);\n border: 1px solid var(--mero-accent);\n border-radius: var(--mero-radius);\n cursor: pointer;\n font-size: 14px;\n font-weight: 600;\n letter-spacing: 0.01em;\n color: var(--mero-on-primary);\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n box-shadow 0.15s ease,\n transform 0.1s ease;\n min-width: 140px;\n box-sizing: border-box;\n font-family:\n "Inter",\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n Oxygen,\n Ubuntu,\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n line-height: 1;\n}\n.mero-connect-button:hover:not(.mero-connected):not(.mero-reconnecting) {\n background-color: var(--mero-accent-hover);\n border-color: var(--mero-accent-hover);\n box-shadow: 0 0 0 4px rgba(165, 255, 17, 0.18);\n box-shadow: 0 0 0 4px color-mix(in srgb, var(--mero-accent) 18%, transparent);\n}\n.mero-connect-button:active:not(.mero-connected):not(.mero-reconnecting) {\n transform: translateY(1px);\n}\n.mero-connect-button:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px rgba(165, 255, 17, 0.45);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mero-accent) 45%, transparent);\n}\n.mero-connect-button.mero-logo-only {\n min-width: 0;\n width: 40px;\n height: 40px;\n padding: 0;\n gap: 0;\n}\n.mero-connect-button.mero-connected {\n background-color: var(--mero-accent);\n color: var(--mero-on-primary);\n border-color: var(--mero-accent);\n}\n.mero-connect-button.mero-connected:hover {\n background-color: var(--mero-accent-hover);\n border-color: var(--mero-accent-hover);\n}\n.mero-connect-button.mero-reconnecting {\n background-color: var(--mero-bg-secondary);\n color: var(--mero-text-secondary);\n border-color: var(--mero-border);\n cursor: not-allowed;\n}\n.mero-connect-container {\n position: relative;\n display: inline-block;\n}\n.mero-dropdown {\n position: absolute;\n top: 100%;\n left: 0;\n background-color: var(--mero-bg-secondary);\n border: 1px solid var(--mero-border);\n border-radius: var(--mero-radius);\n margin-top: 6px;\n padding: 0;\n z-index: 1001;\n width: 100%;\n min-width: 180px;\n overflow: hidden;\n box-shadow: 0 8px 24px var(--mero-shadow);\n}\n.mero-dropdown-info {\n padding: 10px 16px;\n color: var(--mero-text-secondary);\n font-size: 13px;\n border-bottom: 1px solid var(--mero-border);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 220px;\n}\n.mero-dropdown-item {\n display: block;\n width: 100%;\n padding: 10px 16px;\n background: none;\n border: none;\n color: var(--mero-text);\n text-align: left;\n cursor: pointer;\n font-size: 14px;\n text-decoration: none;\n font-family: inherit;\n}\n.mero-dropdown-item:hover {\n background-color: var(--mero-accent);\n color: var(--mero-on-primary);\n}\n.mero-logo {\n width: 24px;\n height: 24px;\n color: currentColor;\n}\n@keyframes meroFadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes meroSlideIn {\n from {\n transform: translateY(-12px);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}\n@keyframes meroSpin {\n to {\n transform: rotate(360deg);\n }\n}\n.mero-invite-overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483646;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n background: var(--mero-overlay);\n font-family:\n "Inter",\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n Oxygen,\n Ubuntu,\n sans-serif;\n -webkit-font-smoothing: antialiased;\n}\n.mero-invite-dialog {\n box-sizing: border-box;\n width: min(420px, 100%);\n padding: 24px;\n border: 1px solid var(--mero-border);\n border-radius: calc(var(--mero-radius) * 1.5);\n background: var(--mero-bg-secondary);\n color: var(--mero-text);\n box-shadow: 0 16px 48px var(--mero-shadow);\n outline: none;\n animation: mero-invite-in 0.16s ease-out;\n}\n.mero-invite-app {\n margin: 0 0 12px;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--mero-text-secondary);\n}\n.mero-invite-head {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.mero-invite-title {\n margin: 0;\n min-width: 0;\n font-size: 18px;\n font-weight: 600;\n line-height: 1.3;\n overflow-wrap: anywhere;\n}\n.mero-invite-body {\n margin: 12px 0 0;\n font-size: 14px;\n line-height: 1.5;\n color: var(--mero-text-secondary);\n}\n.mero-invite-body-error {\n color: var(--mero-error);\n}\n.mero-invite-icon {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n border-radius: 50%;\n background: var(--mero-bg-tertiary);\n color: var(--mero-accent);\n}\n.mero-invite-icon-error {\n color: var(--mero-error);\n}\n.mero-invite-spinner {\n box-sizing: border-box;\n width: 36px;\n height: 36px;\n border: 3px solid var(--mero-bg-tertiary);\n border-top-color: var(--mero-accent);\n background: none;\n animation: mero-invite-spin 0.8s linear infinite;\n}\n.mero-invite-progress {\n position: relative;\n height: 3px;\n margin-top: 16px;\n overflow: hidden;\n border-radius: 2px;\n background: var(--mero-bg-tertiary);\n}\n.mero-invite-progress-bar {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 40%;\n border-radius: 2px;\n background: var(--mero-accent);\n animation: mero-invite-progress 1.4s ease-in-out infinite;\n}\n.mero-invite-actions {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: 8px;\n margin-top: 20px;\n}\n.mero-invite-actions:empty {\n display: none;\n}\n.mero-invite-button {\n padding: 9px 16px;\n border-radius: var(--mero-radius);\n font: inherit;\n font-size: 14px;\n font-weight: 600;\n line-height: 1.2;\n cursor: pointer;\n transition: background-color 0.15s ease, border-color 0.15s ease;\n}\n.mero-invite-button:focus-visible {\n outline: 2px solid var(--mero-accent);\n outline-offset: 2px;\n}\n.mero-invite-primary {\n border: 1px solid var(--mero-accent);\n background: var(--mero-accent);\n color: var(--mero-on-primary);\n}\n.mero-invite-primary:hover {\n border-color: var(--mero-accent-hover);\n background: var(--mero-accent-hover);\n}\n.mero-invite-secondary {\n border: 1px solid var(--mero-border);\n background: transparent;\n color: var(--mero-text);\n}\n.mero-invite-secondary:hover {\n background: var(--mero-bg-tertiary);\n}\n.mero-invite-landing {\n position: fixed;\n inset: 0;\n z-index: 9999;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n overflow-y: auto;\n background: var(--mero-bg);\n color: var(--mero-text);\n font-family:\n "Inter",\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n Oxygen,\n Ubuntu,\n sans-serif;\n -webkit-font-smoothing: antialiased;\n}\n.mero-invite-landing-card {\n width: min(460px, 100%);\n}\n.mero-invite-landing-card .mero-invite-title {\n font-size: 22px;\n}\n.mero-invite-landing-login {\n display: inline-flex;\n}\n.mero-invite-landing-login .mero-connect-button {\n min-width: 0;\n padding: 9px 16px;\n line-height: 1.2;\n}\n@keyframes mero-invite-spin {\n to {\n transform: rotate(360deg);\n }\n}\n@keyframes mero-invite-progress {\n from {\n left: -40%;\n }\n to {\n left: 100%;\n }\n}\n@keyframes mero-invite-in {\n from {\n opacity: 0;\n transform: translateY(6px) scale(0.98);\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .mero-invite-dialog,\n .mero-invite-spinner,\n .mero-invite-progress-bar {\n animation: none;\n }\n}\n');
|
|
32
32
|
|
|
33
33
|
// src/types.ts
|
|
34
34
|
var AppMode = /* @__PURE__ */ ((AppMode2) => {
|
|
@@ -4051,6 +4051,10 @@ function buildInviteLink(slug, token, extra = {}) {
|
|
|
4051
4051
|
}
|
|
4052
4052
|
return createLink(slug, JOIN_ACTION, params);
|
|
4053
4053
|
}
|
|
4054
|
+
var watchers = /* @__PURE__ */ new Set();
|
|
4055
|
+
function notifyWatchers() {
|
|
4056
|
+
for (const watcher of watchers) watcher();
|
|
4057
|
+
}
|
|
4054
4058
|
var MAX_AUTO_JOIN_ATTEMPTS = 3;
|
|
4055
4059
|
var listeners = /* @__PURE__ */ new Set();
|
|
4056
4060
|
var buffered = null;
|
|
@@ -4136,6 +4140,7 @@ function urlWithoutInvitation(href) {
|
|
|
4136
4140
|
}
|
|
4137
4141
|
function deliver(invitation) {
|
|
4138
4142
|
current = invitation;
|
|
4143
|
+
notifyWatchers();
|
|
4139
4144
|
if (listeners.size === 0) {
|
|
4140
4145
|
buffered = invitation;
|
|
4141
4146
|
return;
|
|
@@ -4174,8 +4179,12 @@ function ensureController() {
|
|
|
4174
4179
|
params: { ...intent.params, [INVITATION_PARAM]: token },
|
|
4175
4180
|
resolve: () => {
|
|
4176
4181
|
forgetAttempts(token);
|
|
4177
|
-
if (
|
|
4182
|
+
if (buffered?.token === token) buffered = null;
|
|
4178
4183
|
intent.resolve();
|
|
4184
|
+
if (current?.token === token) {
|
|
4185
|
+
current = null;
|
|
4186
|
+
notifyWatchers();
|
|
4187
|
+
}
|
|
4179
4188
|
},
|
|
4180
4189
|
autoJoin: spendAttempt(token)
|
|
4181
4190
|
});
|
|
@@ -4203,6 +4212,13 @@ function peekInvitation() {
|
|
|
4203
4212
|
ensureController();
|
|
4204
4213
|
return current;
|
|
4205
4214
|
}
|
|
4215
|
+
function subscribeInvitation(watcher) {
|
|
4216
|
+
ensureController();
|
|
4217
|
+
watchers.add(watcher);
|
|
4218
|
+
return () => {
|
|
4219
|
+
watchers.delete(watcher);
|
|
4220
|
+
};
|
|
4221
|
+
}
|
|
4206
4222
|
function resetInvitationCaptureForTests() {
|
|
4207
4223
|
controller?.dispose();
|
|
4208
4224
|
controller = null;
|
|
@@ -4211,6 +4227,7 @@ function resetInvitationCaptureForTests() {
|
|
|
4211
4227
|
current = null;
|
|
4212
4228
|
attemptsKey = "calimero:invitation-attempts";
|
|
4213
4229
|
ownSlugs = /* @__PURE__ */ new Set();
|
|
4230
|
+
notifyWatchers();
|
|
4214
4231
|
}
|
|
4215
4232
|
|
|
4216
4233
|
// src/invitations/describeInviteFailure.ts
|
|
@@ -4504,24 +4521,33 @@ function InvitationDialog({
|
|
|
4504
4521
|
}) {
|
|
4505
4522
|
const { state, accept, decline, retry, dismiss } = redemption;
|
|
4506
4523
|
const joinedId = state.stage === "joined" ? state.namespaceId : null;
|
|
4507
|
-
const
|
|
4524
|
+
const [backgroundId, setBackgroundId] = useState(null);
|
|
4525
|
+
useEffect(() => {
|
|
4526
|
+
if (joinedId) setBackgroundId(joinedId);
|
|
4527
|
+
}, [joinedId]);
|
|
4528
|
+
const waitingId = joinedId ?? backgroundId;
|
|
4529
|
+
const flagged = useJustJoined(waitingId);
|
|
4530
|
+
const stillSyncing = joinedId !== null && flagged;
|
|
4531
|
+
useEffect(() => {
|
|
4532
|
+
if (!joinedId && backgroundId && !flagged) setBackgroundId(null);
|
|
4533
|
+
}, [joinedId, backgroundId, flagged]);
|
|
4508
4534
|
useEffect(() => {
|
|
4509
|
-
if (
|
|
4510
|
-
}, [
|
|
4535
|
+
if (waitingId && flagged && synced) clearNamespaceJustJoined(waitingId);
|
|
4536
|
+
}, [waitingId, flagged, synced]);
|
|
4511
4537
|
const [slow, setSlow] = useState(false);
|
|
4512
4538
|
useEffect(() => {
|
|
4513
4539
|
setSlow(false);
|
|
4514
|
-
if (!
|
|
4540
|
+
if (!waitingId || !flagged) return;
|
|
4515
4541
|
const slowTimer = setTimeout(() => setSlow(true), JOIN_SYNC_WATCHDOG_MS);
|
|
4516
4542
|
const ceiling = setTimeout(
|
|
4517
|
-
() => clearNamespaceJustJoined(
|
|
4543
|
+
() => clearNamespaceJustJoined(waitingId),
|
|
4518
4544
|
JOIN_SYNC_MAX_MS
|
|
4519
4545
|
);
|
|
4520
4546
|
return () => {
|
|
4521
4547
|
clearTimeout(slowTimer);
|
|
4522
4548
|
clearTimeout(ceiling);
|
|
4523
4549
|
};
|
|
4524
|
-
}, [
|
|
4550
|
+
}, [waitingId, flagged]);
|
|
4525
4551
|
const stage = state.stage === "idle" ? null : state.stage === "joined" ? stillSyncing ? "syncing" : "ready" : state.stage;
|
|
4526
4552
|
useEffect(() => {
|
|
4527
4553
|
if (stage !== "ready") return;
|
|
@@ -4530,15 +4556,37 @@ function InvitationDialog({
|
|
|
4530
4556
|
}, [stage, dismiss]);
|
|
4531
4557
|
const titleId = useId();
|
|
4532
4558
|
const bodyId = useId();
|
|
4559
|
+
const overlayRef = useRef(null);
|
|
4533
4560
|
const dialogRef = useRef(null);
|
|
4534
4561
|
const primaryRef = useRef(null);
|
|
4562
|
+
const open = stage !== null;
|
|
4563
|
+
useEffect(() => {
|
|
4564
|
+
const overlay = overlayRef.current;
|
|
4565
|
+
if (!open || !overlay || typeof MutationObserver === "undefined") return;
|
|
4566
|
+
const made = /* @__PURE__ */ new Set();
|
|
4567
|
+
const shut = (el) => {
|
|
4568
|
+
if (el === overlay || el.hasAttribute("inert")) return;
|
|
4569
|
+
if (el.tagName === "SCRIPT" || el.tagName === "STYLE") return;
|
|
4570
|
+
el.setAttribute("inert", "");
|
|
4571
|
+
made.add(el);
|
|
4572
|
+
};
|
|
4573
|
+
Array.from(document.body.children).forEach(shut);
|
|
4574
|
+
const observer = new MutationObserver((records) => {
|
|
4575
|
+
for (const record of records) record.addedNodes.forEach((n) => n instanceof Element && shut(n));
|
|
4576
|
+
});
|
|
4577
|
+
observer.observe(document.body, { childList: true });
|
|
4578
|
+
return () => {
|
|
4579
|
+
observer.disconnect();
|
|
4580
|
+
made.forEach((el) => el.removeAttribute("inert"));
|
|
4581
|
+
};
|
|
4582
|
+
}, [open]);
|
|
4535
4583
|
useEffect(() => {
|
|
4536
4584
|
if (!stage) return;
|
|
4537
4585
|
(primaryRef.current ?? dialogRef.current)?.focus();
|
|
4538
4586
|
}, [stage]);
|
|
4539
4587
|
const close = useCallback(() => {
|
|
4540
4588
|
if (stage === "awaiting-confirmation") decline();
|
|
4541
|
-
else if (stage && stage !== "joining") dismiss();
|
|
4589
|
+
else if (stage && stage !== "joining" && stage !== "syncing") dismiss();
|
|
4542
4590
|
}, [stage, decline, dismiss]);
|
|
4543
4591
|
const onKeyDown = (event) => {
|
|
4544
4592
|
if (event.key === "Escape") {
|
|
@@ -4595,9 +4643,12 @@ function InvitationDialog({
|
|
|
4595
4643
|
/* @__PURE__ */ jsx(
|
|
4596
4644
|
"div",
|
|
4597
4645
|
{
|
|
4646
|
+
ref: overlayRef,
|
|
4598
4647
|
className: "mero-invite-overlay",
|
|
4599
4648
|
onMouseDown: (event) => {
|
|
4600
|
-
if (event.target
|
|
4649
|
+
if (event.target !== event.currentTarget) return;
|
|
4650
|
+
event.preventDefault();
|
|
4651
|
+
close();
|
|
4601
4652
|
},
|
|
4602
4653
|
children: /* @__PURE__ */ jsxs(
|
|
4603
4654
|
"div",
|
|
@@ -4654,7 +4705,7 @@ function InvitationDialog({
|
|
|
4654
4705
|
}
|
|
4655
4706
|
)
|
|
4656
4707
|
] }) : null,
|
|
4657
|
-
stage === "syncing" ? /* @__PURE__ */ jsx(
|
|
4708
|
+
stage === "syncing" && slow ? /* @__PURE__ */ jsx(
|
|
4658
4709
|
"button",
|
|
4659
4710
|
{
|
|
4660
4711
|
ref: primaryRef,
|
|
@@ -4824,6 +4875,165 @@ function Spinner() {
|
|
|
4824
4875
|
}
|
|
4825
4876
|
);
|
|
4826
4877
|
}
|
|
4878
|
+
function usePendingInvitation() {
|
|
4879
|
+
return useSyncExternalStore(subscribeInvitation, peekInvitation, () => null);
|
|
4880
|
+
}
|
|
4881
|
+
function InvitationGate({
|
|
4882
|
+
children,
|
|
4883
|
+
parse,
|
|
4884
|
+
noun = "team",
|
|
4885
|
+
appName,
|
|
4886
|
+
detail,
|
|
4887
|
+
connectButtonProps
|
|
4888
|
+
}) {
|
|
4889
|
+
const session = useContext(MeroContext);
|
|
4890
|
+
const pending = usePendingInvitation();
|
|
4891
|
+
const parsed = useMemo(() => {
|
|
4892
|
+
if (!pending || !parse) return null;
|
|
4893
|
+
try {
|
|
4894
|
+
const result = parse(pending.token, pending.params);
|
|
4895
|
+
return result?.namespaceId ? result : void 0;
|
|
4896
|
+
} catch {
|
|
4897
|
+
return void 0;
|
|
4898
|
+
}
|
|
4899
|
+
}, [pending, parse]);
|
|
4900
|
+
const state = !pending || !session || session.isAuthenticated ? null : session.isLoading ? "checking" : parsed === void 0 ? "invalid" : "invited";
|
|
4901
|
+
if (!state) return children === void 0 ? null : /* @__PURE__ */ jsx(Fragment, { children });
|
|
4902
|
+
const page = /* @__PURE__ */ jsx(
|
|
4903
|
+
InvitationScreen,
|
|
4904
|
+
{
|
|
4905
|
+
state,
|
|
4906
|
+
teamName: parsed?.teamName,
|
|
4907
|
+
noun,
|
|
4908
|
+
appName,
|
|
4909
|
+
detail,
|
|
4910
|
+
connectButtonProps,
|
|
4911
|
+
onDecline: () => pending?.resolve()
|
|
4912
|
+
}
|
|
4913
|
+
);
|
|
4914
|
+
if (children !== void 0 || typeof document === "undefined") return page;
|
|
4915
|
+
return createPortal(page, document.body);
|
|
4916
|
+
}
|
|
4917
|
+
function InvitationScreen({
|
|
4918
|
+
state,
|
|
4919
|
+
teamName,
|
|
4920
|
+
noun,
|
|
4921
|
+
appName,
|
|
4922
|
+
detail,
|
|
4923
|
+
connectButtonProps,
|
|
4924
|
+
onDecline
|
|
4925
|
+
}) {
|
|
4926
|
+
const titleId = useId();
|
|
4927
|
+
const bodyId = useId();
|
|
4928
|
+
const cardRef = useRef(null);
|
|
4929
|
+
const loginRef = useRef(null);
|
|
4930
|
+
const continueRef = useRef(null);
|
|
4931
|
+
useEffect(() => {
|
|
4932
|
+
if (state === "checking") return;
|
|
4933
|
+
const target = state === "invited" ? loginRef.current?.querySelector("button") : continueRef.current;
|
|
4934
|
+
(target ?? cardRef.current)?.focus();
|
|
4935
|
+
}, [state]);
|
|
4936
|
+
const onKeyDown = (event) => {
|
|
4937
|
+
if (event.key !== "Tab" || !cardRef.current) return;
|
|
4938
|
+
const focusable = cardRef.current.querySelectorAll(
|
|
4939
|
+
'button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'
|
|
4940
|
+
);
|
|
4941
|
+
if (focusable.length === 0) return;
|
|
4942
|
+
const first = focusable[0];
|
|
4943
|
+
const last = focusable[focusable.length - 1];
|
|
4944
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
4945
|
+
event.preventDefault();
|
|
4946
|
+
last.focus();
|
|
4947
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
4948
|
+
event.preventDefault();
|
|
4949
|
+
first.focus();
|
|
4950
|
+
}
|
|
4951
|
+
};
|
|
4952
|
+
if (state === "checking") {
|
|
4953
|
+
return /* @__PURE__ */ jsx(
|
|
4954
|
+
"div",
|
|
4955
|
+
{
|
|
4956
|
+
className: "mero-invite-landing",
|
|
4957
|
+
role: "status",
|
|
4958
|
+
"aria-busy": "true",
|
|
4959
|
+
"aria-label": "Checking your session",
|
|
4960
|
+
"data-testid": "invite-landing",
|
|
4961
|
+
"data-state": "checking",
|
|
4962
|
+
children: /* @__PURE__ */ jsx("span", { className: "mero-invite-icon mero-invite-spinner", "aria-hidden": "true" })
|
|
4963
|
+
}
|
|
4964
|
+
);
|
|
4965
|
+
}
|
|
4966
|
+
const invalid = state === "invalid";
|
|
4967
|
+
const title = invalid ? "This invitation can't be read" : teamName ? `You're invited to join \u201C${teamName}\u201D` : `You're invited to join a ${noun}`;
|
|
4968
|
+
const where = appName ? ` in ${appName}` : "";
|
|
4969
|
+
const body = invalid ? "The link may have been cut short when it was shared. Ask whoever sent it for a new one." : `Someone sent you a link to join this ${noun}${where}. Log in to accept it; you'll be asked to confirm before you join.`;
|
|
4970
|
+
return /* @__PURE__ */ jsx("div", { className: "mero-invite-landing", children: /* @__PURE__ */ jsxs(
|
|
4971
|
+
"div",
|
|
4972
|
+
{
|
|
4973
|
+
ref: cardRef,
|
|
4974
|
+
className: "mero-invite-dialog mero-invite-landing-card",
|
|
4975
|
+
role: "dialog",
|
|
4976
|
+
"aria-modal": "true",
|
|
4977
|
+
"aria-labelledby": titleId,
|
|
4978
|
+
"aria-describedby": bodyId,
|
|
4979
|
+
tabIndex: -1,
|
|
4980
|
+
"data-testid": "invite-landing",
|
|
4981
|
+
"data-state": state,
|
|
4982
|
+
onKeyDown,
|
|
4983
|
+
children: [
|
|
4984
|
+
appName ? /* @__PURE__ */ jsx("p", { className: "mero-invite-app", children: appName }) : null,
|
|
4985
|
+
/* @__PURE__ */ jsxs("div", { className: "mero-invite-head", children: [
|
|
4986
|
+
/* @__PURE__ */ jsx(InviteIcon2, { error: invalid }),
|
|
4987
|
+
/* @__PURE__ */ jsx("h1", { id: titleId, className: "mero-invite-title", children: title })
|
|
4988
|
+
] }),
|
|
4989
|
+
/* @__PURE__ */ jsx("p", { id: bodyId, className: "mero-invite-body", children: body }),
|
|
4990
|
+
detail && !invalid ? /* @__PURE__ */ jsx("p", { className: "mero-invite-body", children: detail }) : null,
|
|
4991
|
+
/* @__PURE__ */ jsx("div", { className: "mero-invite-actions", children: invalid ? /* @__PURE__ */ jsx(
|
|
4992
|
+
"button",
|
|
4993
|
+
{
|
|
4994
|
+
ref: continueRef,
|
|
4995
|
+
type: "button",
|
|
4996
|
+
className: "mero-invite-button mero-invite-primary",
|
|
4997
|
+
onClick: onDecline,
|
|
4998
|
+
"data-testid": "invite-landing-decline",
|
|
4999
|
+
children: "Continue"
|
|
5000
|
+
}
|
|
5001
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5002
|
+
/* @__PURE__ */ jsx(
|
|
5003
|
+
"button",
|
|
5004
|
+
{
|
|
5005
|
+
type: "button",
|
|
5006
|
+
className: "mero-invite-button mero-invite-secondary",
|
|
5007
|
+
onClick: onDecline,
|
|
5008
|
+
"data-testid": "invite-landing-decline",
|
|
5009
|
+
children: "Not now"
|
|
5010
|
+
}
|
|
5011
|
+
),
|
|
5012
|
+
/* @__PURE__ */ jsx(
|
|
5013
|
+
"div",
|
|
5014
|
+
{
|
|
5015
|
+
ref: loginRef,
|
|
5016
|
+
className: "mero-invite-landing-login",
|
|
5017
|
+
"data-testid": "invite-landing-login",
|
|
5018
|
+
children: /* @__PURE__ */ jsx(ConnectButton, { ...connectButtonProps, label: "Log in to join" })
|
|
5019
|
+
}
|
|
5020
|
+
)
|
|
5021
|
+
] }) })
|
|
5022
|
+
]
|
|
5023
|
+
}
|
|
5024
|
+
) });
|
|
5025
|
+
}
|
|
5026
|
+
function InviteIcon2({ error }) {
|
|
5027
|
+
const path = error ? "M12 7v6m0 4h.01" : "M4 7l8 6 8-6M5 6h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V7a1 1 0 011-1z";
|
|
5028
|
+
return /* @__PURE__ */ jsx(
|
|
5029
|
+
"span",
|
|
5030
|
+
{
|
|
5031
|
+
className: error ? "mero-invite-icon mero-invite-icon-error" : "mero-invite-icon",
|
|
5032
|
+
"aria-hidden": "true",
|
|
5033
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: path }) })
|
|
5034
|
+
}
|
|
5035
|
+
);
|
|
5036
|
+
}
|
|
4827
5037
|
function statusOf(err) {
|
|
4828
5038
|
if (!err || typeof err !== "object") return void 0;
|
|
4829
5039
|
const e = err;
|
|
@@ -4934,6 +5144,6 @@ function useJoinInvitation() {
|
|
|
4934
5144
|
return { joinInvitation, joining, memberships, invitationRedeemer };
|
|
4935
5145
|
}
|
|
4936
5146
|
|
|
4937
|
-
export { AccountSignInPanel, AppMode, CalimeroLogo, ConnectButton, ConnectButtonAccount, ConnectionType, DEFAULT_MIGRATION_POLL_INTERVAL_MS, INVITATION_PARAM, INVITATION_READY_MS, InvitationDialog, JOIN_ACTION, JOIN_SYNC_MAX_MS, JOIN_SYNC_POLL_MS, JOIN_SYNC_WATCHDOG_MS, JoinSyncBanner, LoginModal, MAX_AUTO_JOIN_ATTEMPTS, MERO_CSS_VARS, MeroContext, MeroProvider, MigrationAdminPanel, MigrationPendingBanner, buildInviteLink, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNamespaceJustJoined, clearNodeUrl, clearTokenNodeUrl, cssVar, defaultMeroTheme, describeInviteFailure, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getPermissionsForMode, getTokenNodeUrl, invitationFromRaw, isDesktopWindow, isFinalInvitationError, isNamespaceJustJoined, isReturningFromWallet, localStorageTokenStorage, markNamespaceJustJoined, onInvitation, peekInvitation, primeInvitationCapture, resetInvitationCaptureForTests, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, subscribeJustJoined, themeToCssVars, urlWithoutInvitation, useAccountEnrolment, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useInviteRedemption, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useJoinSync, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
|
|
5147
|
+
export { AccountSignInPanel, AppMode, CalimeroLogo, ConnectButton, ConnectButtonAccount, ConnectionType, DEFAULT_MIGRATION_POLL_INTERVAL_MS, INVITATION_PARAM, INVITATION_READY_MS, InvitationDialog, InvitationGate, JOIN_ACTION, JOIN_SYNC_MAX_MS, JOIN_SYNC_POLL_MS, JOIN_SYNC_WATCHDOG_MS, JoinSyncBanner, LoginModal, MAX_AUTO_JOIN_ATTEMPTS, MERO_CSS_VARS, MeroContext, MeroProvider, MigrationAdminPanel, MigrationPendingBanner, buildInviteLink, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNamespaceJustJoined, clearNodeUrl, clearTokenNodeUrl, cssVar, defaultMeroTheme, describeInviteFailure, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getPermissionsForMode, getTokenNodeUrl, invitationFromRaw, isDesktopWindow, isFinalInvitationError, isNamespaceJustJoined, isReturningFromWallet, localStorageTokenStorage, markNamespaceJustJoined, onInvitation, peekInvitation, primeInvitationCapture, resetInvitationCaptureForTests, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, subscribeInvitation, subscribeJustJoined, themeToCssVars, urlWithoutInvitation, useAccountEnrolment, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useInviteRedemption, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useJoinSync, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, usePendingInvitation, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
|
|
4938
5148
|
//# sourceMappingURL=index.js.map
|
|
4939
5149
|
//# sourceMappingURL=index.js.map
|