@dubsdotapp/expo 0.1.2 → 0.1.3
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.mts +3 -12
- package/dist/index.d.ts +3 -12
- package/dist/index.js +368 -249
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +377 -253
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useAuth.ts +3 -2
- package/src/types.ts +1 -0
- package/src/ui/AuthGate.tsx +406 -310
package/dist/index.d.mts
CHANGED
|
@@ -232,6 +232,7 @@ interface RegisterParams {
|
|
|
232
232
|
nonce: string;
|
|
233
233
|
username: string;
|
|
234
234
|
referralCode?: string;
|
|
235
|
+
avatarUrl?: string;
|
|
235
236
|
}
|
|
236
237
|
interface RegisterResult {
|
|
237
238
|
user: DubsUser;
|
|
@@ -499,7 +500,7 @@ interface UseAuthResult {
|
|
|
499
500
|
* Register a new user after authenticate() returned needsRegistration.
|
|
500
501
|
* Reuses the nonce+signature from authenticate() — no second signing prompt.
|
|
501
502
|
*/
|
|
502
|
-
register: (username: string, referralCode?: string) => Promise<void>;
|
|
503
|
+
register: (username: string, referralCode?: string, avatarUrl?: string) => Promise<void>;
|
|
503
504
|
/** Log out and clear state */
|
|
504
505
|
logout: () => Promise<void>;
|
|
505
506
|
/**
|
|
@@ -513,28 +514,18 @@ interface UseAuthResult {
|
|
|
513
514
|
declare function useAuth(): UseAuthResult;
|
|
514
515
|
|
|
515
516
|
interface RegistrationScreenProps {
|
|
516
|
-
|
|
517
|
-
onRegister: (username: string, referralCode?: string) => void;
|
|
518
|
-
/** Whether a registration request is in flight */
|
|
517
|
+
onRegister: (username: string, referralCode?: string, avatarUrl?: string) => void;
|
|
519
518
|
registering: boolean;
|
|
520
|
-
/** Error from the last registration attempt, or null */
|
|
521
519
|
error: Error | null;
|
|
522
|
-
/** DubsClient instance for checkUsername() availability checks */
|
|
523
520
|
client: DubsClient;
|
|
524
521
|
}
|
|
525
522
|
interface AuthGateProps {
|
|
526
523
|
children: React.ReactNode;
|
|
527
|
-
/** Persist or clear the JWT token (called with null on logout) */
|
|
528
524
|
onSaveToken: (token: string | null) => void | Promise<void>;
|
|
529
|
-
/** Load a previously persisted JWT token */
|
|
530
525
|
onLoadToken: () => string | null | Promise<string | null>;
|
|
531
|
-
/** Custom loading screen (receives current auth status) */
|
|
532
526
|
renderLoading?: (status: AuthStatus) => React.ReactNode;
|
|
533
|
-
/** Custom error screen (receives the error and a retry callback) */
|
|
534
527
|
renderError?: (error: Error, retry: () => void) => React.ReactNode;
|
|
535
|
-
/** Custom registration screen */
|
|
536
528
|
renderRegistration?: (props: RegistrationScreenProps) => React.ReactNode;
|
|
537
|
-
/** App name shown in default screens. Defaults to "Dubs" */
|
|
538
529
|
appName?: string;
|
|
539
530
|
}
|
|
540
531
|
declare function AuthGate({ children, onSaveToken, onLoadToken, renderLoading, renderError, renderRegistration, appName, }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -232,6 +232,7 @@ interface RegisterParams {
|
|
|
232
232
|
nonce: string;
|
|
233
233
|
username: string;
|
|
234
234
|
referralCode?: string;
|
|
235
|
+
avatarUrl?: string;
|
|
235
236
|
}
|
|
236
237
|
interface RegisterResult {
|
|
237
238
|
user: DubsUser;
|
|
@@ -499,7 +500,7 @@ interface UseAuthResult {
|
|
|
499
500
|
* Register a new user after authenticate() returned needsRegistration.
|
|
500
501
|
* Reuses the nonce+signature from authenticate() — no second signing prompt.
|
|
501
502
|
*/
|
|
502
|
-
register: (username: string, referralCode?: string) => Promise<void>;
|
|
503
|
+
register: (username: string, referralCode?: string, avatarUrl?: string) => Promise<void>;
|
|
503
504
|
/** Log out and clear state */
|
|
504
505
|
logout: () => Promise<void>;
|
|
505
506
|
/**
|
|
@@ -513,28 +514,18 @@ interface UseAuthResult {
|
|
|
513
514
|
declare function useAuth(): UseAuthResult;
|
|
514
515
|
|
|
515
516
|
interface RegistrationScreenProps {
|
|
516
|
-
|
|
517
|
-
onRegister: (username: string, referralCode?: string) => void;
|
|
518
|
-
/** Whether a registration request is in flight */
|
|
517
|
+
onRegister: (username: string, referralCode?: string, avatarUrl?: string) => void;
|
|
519
518
|
registering: boolean;
|
|
520
|
-
/** Error from the last registration attempt, or null */
|
|
521
519
|
error: Error | null;
|
|
522
|
-
/** DubsClient instance for checkUsername() availability checks */
|
|
523
520
|
client: DubsClient;
|
|
524
521
|
}
|
|
525
522
|
interface AuthGateProps {
|
|
526
523
|
children: React.ReactNode;
|
|
527
|
-
/** Persist or clear the JWT token (called with null on logout) */
|
|
528
524
|
onSaveToken: (token: string | null) => void | Promise<void>;
|
|
529
|
-
/** Load a previously persisted JWT token */
|
|
530
525
|
onLoadToken: () => string | null | Promise<string | null>;
|
|
531
|
-
/** Custom loading screen (receives current auth status) */
|
|
532
526
|
renderLoading?: (status: AuthStatus) => React.ReactNode;
|
|
533
|
-
/** Custom error screen (receives the error and a retry callback) */
|
|
534
527
|
renderError?: (error: Error, retry: () => void) => React.ReactNode;
|
|
535
|
-
/** Custom registration screen */
|
|
536
528
|
renderRegistration?: (props: RegistrationScreenProps) => React.ReactNode;
|
|
537
|
-
/** App name shown in default screens. Defaults to "Dubs" */
|
|
538
529
|
appName?: string;
|
|
539
530
|
}
|
|
540
531
|
declare function AuthGate({ children, onSaveToken, onLoadToken, renderLoading, renderError, renderRegistration, appName, }: AuthGateProps): react_jsx_runtime.JSX.Element;
|