@vvedantb/native-ui 0.11.1 → 0.11.2
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/package.json +4 -2
- package/src/auth/index.ts +2 -0
- package/src/auth/totp.ts +20 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/native-ui",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared React Native / Expo UI primitives. Floating surfaces, forms, overlays, toasts, settings chrome, tab bar, AI chat parts, the family app marks, a NativeWind preset, the Expo web root and Clerk + Convex auth screens.",
|
|
6
6
|
"type": "module",
|
|
@@ -214,6 +214,7 @@
|
|
|
214
214
|
}
|
|
215
215
|
},
|
|
216
216
|
"devDependencies": {
|
|
217
|
+
"@clerk/clerk-expo": "2.20.2",
|
|
217
218
|
"@types/react": "^19.1.0",
|
|
218
219
|
"react": "^19.1.0",
|
|
219
220
|
"typescript": "^5.9.0",
|
|
@@ -222,6 +223,7 @@
|
|
|
222
223
|
"scripts": {
|
|
223
224
|
"build": "node -e \"require('node:fs').accessSync('src/index.ts')\"",
|
|
224
225
|
"test": "vitest run",
|
|
225
|
-
"typecheck": "tsc -p tsconfig.typecheck.json"
|
|
226
|
+
"typecheck": "tsc -p tsconfig.typecheck.json && pnpm run typecheck:consumer",
|
|
227
|
+
"typecheck:consumer": "tsc -p tsconfig.consumer.json"
|
|
226
228
|
}
|
|
227
229
|
}
|
package/src/auth/index.ts
CHANGED
package/src/auth/totp.ts
CHANGED
|
@@ -43,6 +43,24 @@ export type SecondFactor = {
|
|
|
43
43
|
|
|
44
44
|
type AttemptResult = { status: string | null; createdSessionId: string | null };
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* The params of `prepareSecondFactor`. A union on `strategy`, as in Clerk's
|
|
48
|
+
* `PhoneCodeSecondFactorConfig | EmailCodeSecondFactorConfig`. One object with
|
|
49
|
+
* `strategy: "phone_code" | "email_code"` does not accept Clerk's
|
|
50
|
+
* `SignInResource` under `strictFunctionTypes`.
|
|
51
|
+
*/
|
|
52
|
+
export type PrepareSecondFactorParams =
|
|
53
|
+
| { strategy: "phone_code"; phoneNumberId?: string }
|
|
54
|
+
| { strategy: "email_code"; emailAddressId?: string };
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The params of `prepareFirstFactor`. A union on `strategy`, as in Clerk's
|
|
58
|
+
* `EmailCodeConfig | PhoneCodeConfig`, where the id is required.
|
|
59
|
+
*/
|
|
60
|
+
export type PrepareFirstFactorParams =
|
|
61
|
+
| { strategy: "email_code"; emailAddressId: string }
|
|
62
|
+
| { strategy: "phone_code"; phoneNumberId: string };
|
|
63
|
+
|
|
46
64
|
/** The part of the sign-in resource that TOTP needs. Tests pass a mock. */
|
|
47
65
|
export type TotpSignIn = {
|
|
48
66
|
attemptSecondFactor(params: { strategy: "totp"; code: string }): Promise<AttemptResult>;
|
|
@@ -51,11 +69,7 @@ export type TotpSignIn = {
|
|
|
51
69
|
/** The part of the sign-in resource that any second factor needs. Tests pass a mock. */
|
|
52
70
|
export type SecondFactorSignIn = {
|
|
53
71
|
supportedSecondFactors?: SecondFactor[] | null;
|
|
54
|
-
prepareSecondFactor?(params:
|
|
55
|
-
strategy: "phone_code" | "email_code";
|
|
56
|
-
phoneNumberId?: string;
|
|
57
|
-
emailAddressId?: string;
|
|
58
|
-
}): Promise<unknown>;
|
|
72
|
+
prepareSecondFactor?(params: PrepareSecondFactorParams): Promise<unknown>;
|
|
59
73
|
attemptSecondFactor(params: { strategy: SecondFactorStrategy; code: string }): Promise<AttemptResult>;
|
|
60
74
|
};
|
|
61
75
|
|
|
@@ -173,11 +187,7 @@ export type FirstFactor = {
|
|
|
173
187
|
/** The part of the sign-in resource that a first-factor code needs. Tests pass a mock. */
|
|
174
188
|
export type FirstFactorSignIn = {
|
|
175
189
|
supportedFirstFactors?: FirstFactor[] | null;
|
|
176
|
-
prepareFirstFactor?(params:
|
|
177
|
-
strategy: FirstFactorStrategy;
|
|
178
|
-
phoneNumberId?: string;
|
|
179
|
-
emailAddressId?: string;
|
|
180
|
-
}): Promise<unknown>;
|
|
190
|
+
prepareFirstFactor?(params: PrepareFirstFactorParams): Promise<unknown>;
|
|
181
191
|
attemptFirstFactor(params: { strategy: FirstFactorStrategy; code: string }): Promise<AttemptResult>;
|
|
182
192
|
};
|
|
183
193
|
|