@synqauth/react 0.3.0 → 0.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/README.md +1 -1
- package/dist/index.d.ts +58 -2
- package/dist/index.js +3272 -2981
- package/dist/styles.css +96 -50
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ To sign people in on your own page (own-UI sign-in, on for the app in the dashbo
|
|
|
40
40
|
|
|
41
41
|
The hooks are `useSession()`, `useSignIn()`, `useUser()`, `useWallets()`, `useLinkedAccounts()`, `useAccountSessions()` and `useAuth()`. Every call answers `{ data, error }` and never throws, and a change clicked twice while it's under way is sent once.
|
|
42
42
|
|
|
43
|
-
The components take Synq's look from `@synqauth/react/styles.css`: Molly's design for Synq, dark with teal actions and pill buttons, and a light counterpart when the page prefers light. Theme it with CSS variables (`--synq-color-primary`, `--synq-color-surface`, `--synq-radius`...; a button that is off takes `--synq-color-disabled`, `--synq-color-disabled-border` and `--synq-color-disabled-text`), or take none of it with `unstyled`. `<AccountManager>` shows the profile, the ways to sign in, passkeys, devices and deleting the account (`sections` picks and orders them); it offers to add the ways your brand turns on, as the account API lists them (`useLinkableMethods()`), and `linkMethods` narrows them. "Add a passkey" shows only where the brand offers passkeys, and makes one on Synq's add-passkey page; elsewhere passkeys are listed and removed, never added. Removing a way in, a wallet or the account asks first. `<SynqProvider messages>` puts their words in your app's language.
|
|
43
|
+
The components take Synq's look from `@synqauth/react/styles.css`: Molly's design for Synq, dark with teal actions and pill buttons, and a light counterpart when the page prefers light. Theme it with CSS variables (`--synq-color-primary`, `--synq-color-surface`, `--synq-radius`...; a button that is off takes `--synq-color-disabled`, `--synq-color-disabled-border` and `--synq-color-disabled-text`), or take none of it with `unstyled`. Text sizes are a scale, `--synq-text-xs` to `--synq-text-3xl`: nothing under 13px, 14px for labels and notes, 16px for body text, inputs and buttons (`--synq-font-size`), and one step up from 1024px wide. `<AccountManager>` shows the profile, the ways to sign in, passkeys, devices and deleting the account (`sections` picks and orders them); it offers to add the ways your brand turns on, as the account API lists them (`useLinkableMethods()`), and `linkMethods` narrows them. "Add a passkey" shows only where the brand offers passkeys, and makes one on Synq's add-passkey page; elsewhere passkeys are listed and removed, never added. Removing a way in, a wallet or the account asks first. `<SynqProvider messages>` puts their words in your app's language.
|
|
44
44
|
|
|
45
45
|
Plugins hold functions, which a server component can't pass: an app with plugins wraps `SynqProvider` in a client component of its own.
|
|
46
46
|
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,16 @@ interface SignInProblem {
|
|
|
20
20
|
readonly message: string;
|
|
21
21
|
/** Seconds to wait first, when Synq said. */
|
|
22
22
|
readonly retryAfter?: number;
|
|
23
|
+
/**
|
|
24
|
+
* For `unavailable` (AERO-2757): what the route mount answered, so the
|
|
25
|
+
* words can tell the person's connection from the app's or Synq's side:
|
|
26
|
+
* `network_error` when nothing answered, else the mount's own code
|
|
27
|
+
* (`forbidden`, `origin_mismatch`, `server_error`…), with its status.
|
|
28
|
+
*/
|
|
29
|
+
readonly cause?: string;
|
|
30
|
+
readonly status?: number;
|
|
31
|
+
/** The request's id, to quote to support, when the mount said. */
|
|
32
|
+
readonly requestId?: string;
|
|
23
33
|
}
|
|
24
34
|
/** What only the hosted page can do for this sign-in, and what to take there. */
|
|
25
35
|
interface SignInHandover {
|
|
@@ -492,6 +502,8 @@ interface SynqMessages {
|
|
|
492
502
|
/** Under a wallet in the picker. */
|
|
493
503
|
readonly walletDetected: string;
|
|
494
504
|
readonly noWalletHere: string;
|
|
505
|
+
/** The button under that: reload once a wallet is installed. */
|
|
506
|
+
readonly reload: string;
|
|
495
507
|
/** Signing in on the brand's hosted page instead, where only it can. */
|
|
496
508
|
readonly useSignInPage: string;
|
|
497
509
|
readonly moreOptions: string;
|
|
@@ -509,6 +521,26 @@ interface SynqMessages {
|
|
|
509
521
|
/** A sign-in that couldn't reach the app's server or Synq. */
|
|
510
522
|
readonly signInOffline: string;
|
|
511
523
|
readonly signInFailed: string;
|
|
524
|
+
/** `<SessionError>`: the app couldn't tell whether anyone is signed in. */
|
|
525
|
+
readonly sessionUnknown: string;
|
|
526
|
+
readonly retry: string;
|
|
527
|
+
/**
|
|
528
|
+
* Sign-in broke on the app's or Synq's side (AERO-2757): a server error, a
|
|
529
|
+
* route mount set up wrong, an app Synq refuses. Never the person's doing.
|
|
530
|
+
*/
|
|
531
|
+
readonly signInBroken: string;
|
|
532
|
+
/** Synq's sign-in is down for a moment (`temporarily_unavailable`). */
|
|
533
|
+
readonly signInDown: string;
|
|
534
|
+
/** The sign-in expired, or finished in another tab (`unknown_state`). */
|
|
535
|
+
readonly signInStale: string;
|
|
536
|
+
/** The person left the sign-in before it finished. */
|
|
537
|
+
readonly signInCanceled: string;
|
|
538
|
+
/** This account can't use this app (a refusal that came back from the hosted page). */
|
|
539
|
+
readonly signInRefused: string;
|
|
540
|
+
/** Synq couldn't read the person's wallets for the app's token gates. */
|
|
541
|
+
readonly walletsUnchecked: string;
|
|
542
|
+
/** The app's server takes changes from another address than the page's (`origin_mismatch`). */
|
|
543
|
+
readonly signInOtherOrigin: string;
|
|
512
544
|
readonly tryAgain: string;
|
|
513
545
|
readonly securedBy: string;
|
|
514
546
|
/** A first sign-in's greeting, with their first name when known. */
|
|
@@ -537,6 +569,8 @@ interface SynqMessages {
|
|
|
537
569
|
readonly showing: string;
|
|
538
570
|
readonly accountSettings: string;
|
|
539
571
|
readonly signOutFailed: string;
|
|
572
|
+
/** Signing out failed while offline: the person is still signed in. */
|
|
573
|
+
readonly signOutOffline: string;
|
|
540
574
|
readonly usernamePlaceholder: string;
|
|
541
575
|
readonly checking: string;
|
|
542
576
|
/** The connected wallet, when it isn't on their profile. */
|
|
@@ -555,6 +589,8 @@ interface SynqMessages {
|
|
|
555
589
|
readonly confirmItsYou: string;
|
|
556
590
|
readonly onlyWayIn: string;
|
|
557
591
|
readonly walletInUse: string;
|
|
592
|
+
/** A wallet on another profile that can't move here (its only way in, or the brand doesn't move them). */
|
|
593
|
+
readonly walletOnOtherProfile: string;
|
|
558
594
|
readonly moveHere: string;
|
|
559
595
|
readonly linked: string;
|
|
560
596
|
readonly link: string;
|
|
@@ -1081,13 +1117,33 @@ export declare function SignedOut({ children }: {
|
|
|
1081
1117
|
readonly children?: ReactNode;
|
|
1082
1118
|
}): ReactNode;
|
|
1083
1119
|
//#endregion
|
|
1120
|
+
//#region src/components/SessionError.d.ts
|
|
1121
|
+
/** What `SessionError` takes: its look, and its own words in place of the default. */
|
|
1122
|
+
interface SessionErrorProps extends SynqStyleProps {
|
|
1123
|
+
/** What it says, with its own retry: the default line and a Retry button otherwise. */
|
|
1124
|
+
readonly children?: ReactNode;
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Shown only while the app couldn't tell whether anyone is signed in (the
|
|
1128
|
+
* route mount answered an error, or nothing): `<SignedIn>` and
|
|
1129
|
+
* `<SignedOut>` both show nothing then, so a header built on them would
|
|
1130
|
+
* show neither (AERO-2757). It says so, with a one-tap retry, and tells
|
|
1131
|
+
* the app's developers in the console once.
|
|
1132
|
+
*/
|
|
1133
|
+
export declare function SessionError({ unstyled, className, children }: SessionErrorProps): ReactNode;
|
|
1134
|
+
//#endregion
|
|
1084
1135
|
//#region src/components/SignInButton.d.ts
|
|
1085
1136
|
/** What `SignInButton` takes: the sign-in's options, its look and its words. */
|
|
1086
1137
|
interface SignInButtonProps extends SignInOptions, SynqStyleProps {
|
|
1087
1138
|
/** Its label: the provider's `messages.signIn` by default. */
|
|
1088
1139
|
readonly children?: ReactNode;
|
|
1089
1140
|
}
|
|
1090
|
-
/**
|
|
1141
|
+
/**
|
|
1142
|
+
* A button that sends the browser to sign in, through the app's route mount.
|
|
1143
|
+
* A press shows at once (AERO-2757): busy, and "Taking you to sign in…" while
|
|
1144
|
+
* the browser leaves; a popup sign-in that fails says why beside it, never
|
|
1145
|
+
* silently, and the person who closed it on purpose hears nothing.
|
|
1146
|
+
*/
|
|
1091
1147
|
export declare function SignInButton({ unstyled, className, children, ...options }: SignInButtonProps): ReactNode;
|
|
1092
1148
|
//#endregion
|
|
1093
1149
|
//#region src/components/SignInForm.d.ts
|
|
@@ -1615,4 +1671,4 @@ export declare function WalletLayerProvider({ value, children }: {
|
|
|
1615
1671
|
/** The wallet layer lent to this component (`WalletLayerProvider`), or null when there is none. */
|
|
1616
1672
|
export declare function useWalletLayer(): WalletLayer | null;
|
|
1617
1673
|
//#endregion
|
|
1618
|
-
export { type AccountManagerProps, Card as AccountPanelCard, type AccountPanelCardProps, type AccountPanelDialogProps, type AccountPanelGrabberProps, type AccountPanelLayout, LinkRow as AccountPanelLinkRow, type AccountPanelLinkRowProps, Linked as AccountPanelLinked, type AccountPanelLinkedProps, type AccountPanelPending, type AccountPanelProps, Row as AccountPanelRow, type AccountPanelRowProps, type AccountPanelSection, type AccountPanelTriggerProps, Username as AccountPanelUsername, type AccountPanelUsernameProps, type AccountPanelView, Wallets as AccountPanelWallets, type AccountPanelWalletsProps, type AccountSection, type AccountSession, type ApiKey, type ApiKeyInput, type AvatarFallback, type AvatarMomentProps, type AvatarProps, type AvatarSettings, type AvatarSource, type HandoffOptions, type KeyableApi, type LastUsedMethod, type LinkStatus, type LinkableMethod, type LinkedAccount, type NewApiKey, type OneTimeCodeInputProps, type Passkey, type Profile, type ProfileUpdate, type ReauthenticateOptions, type RedirectKind, type RedirectResult, type SessionStatus, type SignInButtonProps, type SignInDisplay, type SignInDone, type SignInEvent, type SignInFormProps, type SignInHandover, type SignInMethod, type SignInMethodInfo, type SignInMethods, type SignInOptions, type SignInPartProps, type SignInProblem, type SignInStep, type SignOutOptions, type SynqClientPlugin, type SynqMessages, type SynqMountRequest, type SynqProviderProps, type SynqResult, type SynqSessionInfo, type SynqStyleProps, type SynqUser, type UseAccountData, type UseAccountPanel, type UseAccountPanelOptions, type UseAuth, type UseAvatar, type UseLink, type UseRedirectResult, type UseSession, type UseSignIn, type UseSignInEvent, type UseSignInMethods, type UseSignInOptions, type UseUser, type UseUsernameField, type UserButtonProps, type UserMetadata, type UsernameCode, type UsernameStatus, type Wallet, type WalletAppInfo, type WalletLayer, type WalletManagerProps, type WalletRequestTarget, type WalletSignedIn };
|
|
1674
|
+
export { type AccountManagerProps, Card as AccountPanelCard, type AccountPanelCardProps, type AccountPanelDialogProps, type AccountPanelGrabberProps, type AccountPanelLayout, LinkRow as AccountPanelLinkRow, type AccountPanelLinkRowProps, Linked as AccountPanelLinked, type AccountPanelLinkedProps, type AccountPanelPending, type AccountPanelProps, Row as AccountPanelRow, type AccountPanelRowProps, type AccountPanelSection, type AccountPanelTriggerProps, Username as AccountPanelUsername, type AccountPanelUsernameProps, type AccountPanelView, Wallets as AccountPanelWallets, type AccountPanelWalletsProps, type AccountSection, type AccountSession, type ApiKey, type ApiKeyInput, type AvatarFallback, type AvatarMomentProps, type AvatarProps, type AvatarSettings, type AvatarSource, type HandoffOptions, type KeyableApi, type LastUsedMethod, type LinkStatus, type LinkableMethod, type LinkedAccount, type NewApiKey, type OneTimeCodeInputProps, type Passkey, type Profile, type ProfileUpdate, type ReauthenticateOptions, type RedirectKind, type RedirectResult, type SessionErrorProps, type SessionStatus, type SignInButtonProps, type SignInDisplay, type SignInDone, type SignInEvent, type SignInFormProps, type SignInHandover, type SignInMethod, type SignInMethodInfo, type SignInMethods, type SignInOptions, type SignInPartProps, type SignInProblem, type SignInStep, type SignOutOptions, type SynqClientPlugin, type SynqMessages, type SynqMountRequest, type SynqProviderProps, type SynqResult, type SynqSessionInfo, type SynqStyleProps, type SynqUser, type UseAccountData, type UseAccountPanel, type UseAccountPanelOptions, type UseAuth, type UseAvatar, type UseLink, type UseRedirectResult, type UseSession, type UseSignIn, type UseSignInEvent, type UseSignInMethods, type UseSignInOptions, type UseUser, type UseUsernameField, type UserButtonProps, type UserMetadata, type UsernameCode, type UsernameStatus, type Wallet, type WalletAppInfo, type WalletLayer, type WalletManagerProps, type WalletRequestTarget, type WalletSignedIn };
|