@vvedantb/native-ui 0.31.0 → 0.33.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 CHANGED
@@ -24,7 +24,7 @@ Optional, only if you import those components:
24
24
  - `@rn-primitives/portal` — `Select`. Mount one `<PortalHost />` from this package at the app root (for example in the root layout), outside any `Modal`. The package does not re-export it, so install it with `@rn-primitives/select`.
25
25
  - `@swmansion/react-native-bottom-sheet` — `BottomSheetContainer`. It needs the New Architecture, React Native 0.82 or later and a native build (no Expo Go), and no root provider.
26
26
  - `@react-native-community/datetimepicker` and `dayjs` — `DateTimeField`
27
- - `@clerk/clerk-expo`, `convex`, `expo-auth-session`, `expo-web-browser` and `expo-router` — `@vvedantb/native-ui/auth` (0.7.0). `expo-router` also for `@vvedantb/native-ui/expo-web-root`.
27
+ - `@clerk/expo`, `convex`, `expo-auth-session`, `expo-web-browser` and `expo-router` — `@vvedantb/native-ui/auth` (0.7.0). `expo-router` also for `@vvedantb/native-ui/expo-web-root`.
28
28
  - `react-native-gesture-handler` (`>=2.0.0`) — `@vvedantb/native-ui/gesture-handler` (Unreleased). Wrap the app in `GestureHandlerRootView`, and put `GestureHandlerProvider` from that entry inside it: the sheet drags (`SheetContent`, the compact `DialogContent`) then run on Gesture Handler, on the UI thread, and each overlay's `Modal` gets its own root view (Android needs one in every `Modal`). It also turns on the `SwipeableRow` swipe. Without the provider, the sheets drag with `PanResponder`, with the same rules, and a `SwipeableRow` does not swipe. Only that entry imports the peer, so an app without it bundles as before. In a Metro monorepo, resolve the peer from the app (one copy), as for `react`.
29
29
  - `react-native-keyboard-controller` (`>=1.21.0`) — `@vvedantb/native-ui/keyboard-controller` (Unreleased). Put `KeyboardControllerProvider` from that entry inside the app's `KeyboardProvider`: the chat transcript (`ConversationList`), the dock (`ConversationDock`) and its scroll button then follow the keyboard frame by frame, a drag down on the transcript moves the keyboard with the finger (iOS, Android 11+; Android 10 and below lower it at once), and `PromptInput`, `ChatThread`, the overlays and `KeyboardAvoidingView` pad frame by frame. The dock moves by the keyboard less the bottom inset: its content pads that inset, as `PromptInput` does. Without the provider, every part keeps React Native's `KeyboardAvoidingView`. Only that entry imports the peer. In a Metro monorepo, resolve the peer from the app (one copy): the parts read its provider's context.
30
30
  - `react-native-svg` — the app marks (`APP_ICONS`, `Icon*`, `AppMark`, `AppWordmark`), `GoogleMark` and `PricingModal`. Apps with the icon peers above already have it: `lucide-react-native` and `@tabler/icons-react-native` both require it.
@@ -100,7 +100,7 @@ The root entry exports everything. It still imports `BottomSheetContainer` and `
100
100
  | `@vvedantb/native-ui/date-time` | `DateTimeField`, `DateTimeFieldProps` (0.5.0) | `@react-native-community/datetimepicker`, `dayjs` (import) |
101
101
  | `@vvedantb/native-ui/ai` | The AI chat parts (from 0.4.0): `Conversation`, `Message`, `Reasoning`, `AgentTrace`, `ChainOfThought`, `ActivityStep`, `PromptInput`, `Suggestions`, `Sources`, `FileChip`, `Attachments`, `CodeBlock`, `ResponseText`, `Shimmer`, `Collapsible`, `useStreamingDisclosure` and their parts. See [AI chat](#ai-chat-040). Not on the root entry.. From 0.12.0: `ChatThread`, `UIMessage`, `ChatJumpRail` and the `Attachment` props `onPress` and `accessibilityLabel` | none |
102
102
  | `@vvedantb/native-ui/ai-gallery` | `AiChatGallery`, `AiChatSamples` (from 0.4.0) | none |
103
- | `@vvedantb/native-ui/auth` | From 0.7.0: `AuthProviders`, `SignInScreen`, `SignUpScreen`, `GoogleSignInButton`, `useGoogleSignIn`, `AuthScreen`, `OrDivider`, `FieldError`, `authErrorMessage`, `SecondFactorScreen`, `useSecondFactor`, `submitTotpSecondFactor`, `submitSecondFactor`, `prepareSecondFactorIfNeeded`, `prepareFirstFactorIfNeeded`, `submitFirstFactor`, `pickFirstFactorStrategy`, `TOTP_MESSAGES` and their props types. See [Auth](#auth-070). Not on the root entry. | `@clerk/clerk-expo`, `convex`, `expo-auth-session`, `expo-web-browser`, `expo-router` (import) |
103
+ | `@vvedantb/native-ui/auth` | From 0.7.0: `AuthProviders`, `SignInScreen`, `SignUpScreen`, `ChangePasswordScreen`, `DeleteAccountScreen` (0.32.0), `GoogleSignInButton`, `useGoogleSignIn`, `AuthScreen`, `OrDivider`, `FieldError`, `authErrorMessage`, `SecondFactorScreen`, `useSecondFactor`, `submitTotpSecondFactor`, `submitSecondFactor`, `prepareSecondFactorIfNeeded`, `prepareFirstFactorIfNeeded`, `submitFirstFactor`, `pickFirstFactorStrategy`, `TOTP_MESSAGES` and their props types. See [Auth](#auth-070). Not on the root entry. | `@clerk/expo`, `convex`, `expo-auth-session`, `expo-web-browser`, `expo-router` (import) |
104
104
  | `@vvedantb/native-ui/expo-router` | From 0.12.0: `RouterStackPageHeader`, `RouterStackPageHeaderProps`, `goBackOrReplace`. Not on the root, `/layout` or `/page-title` entries. | `expo-router` (import) |
105
105
  | `@vvedantb/native-ui/expo-web-root` | From 0.7.0: `ExpoWebRoot`, `ExpoWebRootProps`, `ExpoWebRootViewport`, `EXPO_WEB_VIEWPORT`, `expoWebBackgroundCss`. Not on the root entry. | `expo-router` (import of `expo-router/html`) |
106
106
  | `@vvedantb/native-ui/tailwind-preset` | From 0.7.0, CommonJS for `tailwind.config.js`: `nativeUiPreset`, `nativeUiContent`, `cssVar`, `hslVar`, `rgbAlpha`, `cssVariables`, `schemeColors` and a default preset. See [Expo / NativeWind](#expo--nativewind). | `nativewind` (`require`, when installed) |
@@ -197,12 +197,12 @@ It renders `<html lang="en">`, the charset, `X-UA-Compatible` and viewport meta
197
197
 
198
198
  ## Auth (0.7.0)
199
199
 
200
- `@vvedantb/native-ui/auth` has the Clerk and Convex providers and a sign-in and sign-up screen. It needs `@clerk/clerk-expo`, `expo-auth-session`, `expo-web-browser` and `expo-router`, and `convex` when you pass a Convex client.
200
+ `@vvedantb/native-ui/auth` has the Clerk and Convex providers and a sign-in and sign-up screen. It needs `@clerk/expo`, `expo-auth-session`, `expo-web-browser` and `expo-router`, and `convex` when you pass a Convex client.
201
201
 
202
202
  ```tsx
203
203
  // app/_layout.tsx
204
- import { useAuth } from "@clerk/clerk-expo";
205
- import { tokenCache } from "@clerk/clerk-expo/token-cache";
204
+ import { useAuth } from "@clerk/expo";
205
+ import { tokenCache } from "@clerk/expo/token-cache";
206
206
  import { AuthProviders } from "@vvedantb/native-ui/auth";
207
207
 
208
208
  <AuthProviders publishableKey={publishableKey} tokenCache={tokenCache} convex={convex} useAuth={useAuth}>
@@ -210,7 +210,7 @@ import { AuthProviders } from "@vvedantb/native-ui/auth";
210
210
  </AuthProviders>
211
211
  ```
212
212
 
213
- `AuthProviders` nests `ClerkProvider`, `ConvexProviderWithClerk` (only with `convex`) and `ClerkLoaded` (with `loaded`, default `true`). Without `convex` the children sit under Clerk only. `clerk={false}` gives a plain `ConvexProvider`, for UI preview builds. The app reads its own key; the component checks nothing.
213
+ `AuthProviders` nests `ClerkProvider`, `ConvexProviderWithClerk` (only with `convex`) and `ClerkLoaded` (with `loaded`, default `true`). Without `convex` the children sit under Clerk only. `clerk={false}` gives a plain `ConvexProvider`, for UI preview builds. The app reads its own key; the component checks nothing. From 0.32.0 the Clerk peer is `@clerk/expo` 4 or later (not `@clerk/clerk-expo`): pass `publishableKey`, because `@clerk/expo` does not read it from the environment.
214
214
 
215
215
  ```tsx
216
216
  // app/(auth)/sign-in.tsx
@@ -256,6 +256,22 @@ export default function SignUp() {
256
256
 
257
257
  ### Second factor (0.10.0)
258
258
 
259
+ Account screens (0.32.0), for a signed-in user. Both use `useUser` from `@clerk/expo` and show errors under the fields.
260
+
261
+ ```tsx
262
+ import { ChangePasswordScreen, DeleteAccountScreen } from "@vvedantb/native-ui/auth";
263
+
264
+ // app/(app)/change-password.tsx
265
+ <ChangePasswordScreen minPasswordLength={8} onCancel={() => router.back()} />
266
+
267
+ // app/(app)/delete-account.tsx
268
+ <DeleteAccountScreen afterDeleteHref="/sign-in" onCancel={() => router.back()} />
269
+ ```
270
+
271
+ - `ChangePasswordScreen` calls `user.updatePassword`: the current password, then the new one twice. An account with no password (Google only) gets no current-password field. `signOutOfOtherSessions` defaults to `true`. After the change it calls `onSuccess`, or `router.back()`.
272
+ - `DeleteAccountScreen` calls `user.delete()`. The user types `confirmWord` (default `DELETE`) first; the button stays off until it matches. Turn on "Allow users to delete their accounts" in the Clerk dashboard, or the call fails. After the delete it calls `onDeleted`, or `router.replace(afterDeleteHref)`.
273
+ - `testID`s: `change-password-current`, `-new`, `-confirm`, `-error`, `-submit`, `-cancel`; `delete-account-confirm`, `-error`, `-submit`, `-cancel`. Change the prefix with `testIDPrefix`.
274
+
259
275
  `SecondFactorScreen` is a one-time code step with no Clerk import. The caller owns the check.
260
276
 
261
277
  | Prop | Default | Use |
@@ -0,0 +1,450 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { useRef, useState } from "react";
3
+ import { useUser } from "@clerk/expo";
4
+ import { useRouter } from "expo-router";
5
+ import { Button } from "../Button";
6
+ import { Input } from "../Input";
7
+ import { PasswordInput } from "../PasswordInput";
8
+ import { AuthScreen, FieldError } from "./AuthScreen";
9
+ import { authErrorMessage, DEFAULT_STAGE_TIMEOUT_MS, logAuthFailure, withAuthTimeout } from "./authErrors";
10
+
11
+ /** The messages the account screens can show. Generic: none names a provider. */
12
+ export const ACCOUNT_MESSAGES = {
13
+ changePasswordTitle: "Change password",
14
+ changePasswordSubtitle: "Enter your current password, then a new one.",
15
+ setPasswordTitle: "Set a password",
16
+ setPasswordSubtitle: "Your account has no password yet. Choose one.",
17
+ currentPasswordLabel: "Current password",
18
+ newPasswordLabel: "New password",
19
+ confirmPasswordLabel: "Confirm new password",
20
+ missingCurrentPassword: "Enter your current password",
21
+ missingNewPassword: "Enter a new password",
22
+ passwordMismatch: "The passwords do not match",
23
+ changePasswordFailed: "Could not change the password",
24
+ changePassword: "Change password",
25
+ setPassword: "Set password",
26
+ deleteTitle: "Delete account",
27
+ deleteSubtitle: "This deletes your account and its data. It cannot be undone.",
28
+ deleteConfirmMismatch: "Type the word exactly to confirm",
29
+ deleteFailed: "Could not delete the account",
30
+ deleteAccount: "Delete account",
31
+ cancel: "Cancel",
32
+ notReady: "Your account is not ready yet. Try again in a moment."
33
+ };
34
+ /**
35
+ * Changes the signed-in user's password with `user.updatePassword`: the
36
+ * current password, then the new one typed twice. An account with no password
37
+ * (Google only) gets no current-password field and the "Set a password" copy.
38
+ * Errors show under the fields. Render it under `ClerkProvider`, signed in.
39
+ */
40
+ export function ChangePasswordScreen(t0) {
41
+ const $ = _c(55);
42
+ const {
43
+ title,
44
+ subtitle,
45
+ header,
46
+ footer,
47
+ onCancel,
48
+ stageTimeoutMs: t1,
49
+ minPasswordLength,
50
+ signOutOfOtherSessions: t2,
51
+ onSuccess,
52
+ testIDPrefix: t3
53
+ } = t0;
54
+ const stageTimeoutMs = t1 === undefined ? DEFAULT_STAGE_TIMEOUT_MS : t1;
55
+ const signOutOfOtherSessions = t2 === undefined ? true : t2;
56
+ const testIDPrefix = t3 === undefined ? "change-password" : t3;
57
+ const {
58
+ isLoaded,
59
+ user
60
+ } = useUser();
61
+ const router = useRouter();
62
+ const [current, setCurrent] = useState("");
63
+ const [next, setNext] = useState("");
64
+ const [confirm, setConfirm] = useState("");
65
+ const [error, setError] = useState("");
66
+ const [submitting, setSubmitting] = useState(false);
67
+ const nextField = useRef(null);
68
+ const confirmField = useRef(null);
69
+ let t4;
70
+ if ($[0] !== testIDPrefix) {
71
+ t4 = name => `${testIDPrefix}-${name}`;
72
+ $[0] = testIDPrefix;
73
+ $[1] = t4;
74
+ } else {
75
+ t4 = $[1];
76
+ }
77
+ const id = t4;
78
+ const hasPassword = user ? user.passwordEnabled : true;
79
+ let t5;
80
+ if ($[2] !== confirm || $[3] !== current || $[4] !== hasPassword || $[5] !== isLoaded || $[6] !== minPasswordLength || $[7] !== next || $[8] !== onSuccess || $[9] !== router || $[10] !== signOutOfOtherSessions || $[11] !== stageTimeoutMs || $[12] !== submitting || $[13] !== user) {
81
+ t5 = async () => {
82
+ if (submitting) {
83
+ return;
84
+ }
85
+ if (!isLoaded || !user) {
86
+ return setError(ACCOUNT_MESSAGES.notReady);
87
+ }
88
+ if (hasPassword && !current) {
89
+ return setError(ACCOUNT_MESSAGES.missingCurrentPassword);
90
+ }
91
+ if (!next) {
92
+ return setError(ACCOUNT_MESSAGES.missingNewPassword);
93
+ }
94
+ if (minPasswordLength && next.length < minPasswordLength) {
95
+ return setError(`Use at least ${minPasswordLength} characters for the password`);
96
+ }
97
+ if (next !== confirm) {
98
+ return setError(ACCOUNT_MESSAGES.passwordMismatch);
99
+ }
100
+ setSubmitting(true);
101
+ setError("");
102
+ const params = hasPassword ? {
103
+ newPassword: next,
104
+ signOutOfOtherSessions,
105
+ currentPassword: current
106
+ } : {
107
+ newPassword: next,
108
+ signOutOfOtherSessions
109
+ };
110
+ let failed = false;
111
+ let failure;
112
+ ;
113
+ try {
114
+ await withAuthTimeout(user.updatePassword(params), "update-password", stageTimeoutMs);
115
+ } catch (t6) {
116
+ const caught = t6;
117
+ failed = true;
118
+ failure = caught;
119
+ }
120
+ setSubmitting(false);
121
+ if (failed) {
122
+ logAuthFailure("update-password", failure);
123
+ return setError(authErrorMessage(failure, ACCOUNT_MESSAGES.changePasswordFailed));
124
+ }
125
+ setCurrent("");
126
+ setNext("");
127
+ setConfirm("");
128
+ if (onSuccess) {
129
+ onSuccess();
130
+ } else {
131
+ router.back();
132
+ }
133
+ };
134
+ $[2] = confirm;
135
+ $[3] = current;
136
+ $[4] = hasPassword;
137
+ $[5] = isLoaded;
138
+ $[6] = minPasswordLength;
139
+ $[7] = next;
140
+ $[8] = onSuccess;
141
+ $[9] = router;
142
+ $[10] = signOutOfOtherSessions;
143
+ $[11] = stageTimeoutMs;
144
+ $[12] = submitting;
145
+ $[13] = user;
146
+ $[14] = t5;
147
+ } else {
148
+ t5 = $[14];
149
+ }
150
+ const submit = t5;
151
+ const t6 = id("screen");
152
+ const t7 = title ?? (hasPassword ? ACCOUNT_MESSAGES.changePasswordTitle : ACCOUNT_MESSAGES.setPasswordTitle);
153
+ const t8 = subtitle ?? (hasPassword ? ACCOUNT_MESSAGES.changePasswordSubtitle : ACCOUNT_MESSAGES.setPasswordSubtitle);
154
+ let t9;
155
+ if ($[15] !== current || $[16] !== hasPassword || $[17] !== id) {
156
+ t9 = hasPassword ? <PasswordInput testID={id("current")} accessibilityLabel={ACCOUNT_MESSAGES.currentPasswordLabel} autoCapitalize="none" autoComplete="password" textContentType="password" returnKeyType="next" submitBehavior="submit" onSubmitEditing={() => nextField.current?.focus()} value={current} placeholder={ACCOUNT_MESSAGES.currentPasswordLabel} onChangeText={setCurrent} /> : null;
157
+ $[15] = current;
158
+ $[16] = hasPassword;
159
+ $[17] = id;
160
+ $[18] = t9;
161
+ } else {
162
+ t9 = $[18];
163
+ }
164
+ const t10 = id("new");
165
+ let t11;
166
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
167
+ t11 = () => confirmField.current?.focus();
168
+ $[19] = t11;
169
+ } else {
170
+ t11 = $[19];
171
+ }
172
+ let t12;
173
+ if ($[20] !== next || $[21] !== t10) {
174
+ t12 = <PasswordInput testID={t10} ref={nextField} accessibilityLabel={ACCOUNT_MESSAGES.newPasswordLabel} autoCapitalize="none" autoComplete="new-password" textContentType="newPassword" returnKeyType="next" submitBehavior="submit" onSubmitEditing={t11} value={next} placeholder={ACCOUNT_MESSAGES.newPasswordLabel} onChangeText={setNext} />;
175
+ $[20] = next;
176
+ $[21] = t10;
177
+ $[22] = t12;
178
+ } else {
179
+ t12 = $[22];
180
+ }
181
+ const t13 = id("confirm");
182
+ let t14;
183
+ if ($[23] !== submit) {
184
+ t14 = () => void submit();
185
+ $[23] = submit;
186
+ $[24] = t14;
187
+ } else {
188
+ t14 = $[24];
189
+ }
190
+ let t15;
191
+ if ($[25] !== confirm || $[26] !== t13 || $[27] !== t14) {
192
+ t15 = <PasswordInput testID={t13} ref={confirmField} accessibilityLabel={ACCOUNT_MESSAGES.confirmPasswordLabel} autoCapitalize="none" autoComplete="new-password" textContentType="newPassword" returnKeyType="go" value={confirm} placeholder={ACCOUNT_MESSAGES.confirmPasswordLabel} onChangeText={setConfirm} onSubmitEditing={t14} />;
193
+ $[25] = confirm;
194
+ $[26] = t13;
195
+ $[27] = t14;
196
+ $[28] = t15;
197
+ } else {
198
+ t15 = $[28];
199
+ }
200
+ const t16 = id("error");
201
+ let t17;
202
+ if ($[29] !== error || $[30] !== t16) {
203
+ t17 = <FieldError testID={t16} message={error} />;
204
+ $[29] = error;
205
+ $[30] = t16;
206
+ $[31] = t17;
207
+ } else {
208
+ t17 = $[31];
209
+ }
210
+ const t18 = id("submit");
211
+ let t19;
212
+ if ($[32] !== submit) {
213
+ t19 = () => void submit();
214
+ $[32] = submit;
215
+ $[33] = t19;
216
+ } else {
217
+ t19 = $[33];
218
+ }
219
+ const t20 = hasPassword ? ACCOUNT_MESSAGES.changePassword : ACCOUNT_MESSAGES.setPassword;
220
+ let t21;
221
+ if ($[34] !== submitting || $[35] !== t18 || $[36] !== t19 || $[37] !== t20) {
222
+ t21 = <Button testID={t18} loading={submitting} onPress={t19}>{t20}</Button>;
223
+ $[34] = submitting;
224
+ $[35] = t18;
225
+ $[36] = t19;
226
+ $[37] = t20;
227
+ $[38] = t21;
228
+ } else {
229
+ t21 = $[38];
230
+ }
231
+ let t22;
232
+ if ($[39] !== id || $[40] !== onCancel || $[41] !== submitting) {
233
+ t22 = onCancel ? <Button testID={id("cancel")} variant="ghost" disabled={submitting} onPress={onCancel}>{ACCOUNT_MESSAGES.cancel}</Button> : null;
234
+ $[39] = id;
235
+ $[40] = onCancel;
236
+ $[41] = submitting;
237
+ $[42] = t22;
238
+ } else {
239
+ t22 = $[42];
240
+ }
241
+ let t23;
242
+ if ($[43] !== footer || $[44] !== header || $[45] !== t12 || $[46] !== t15 || $[47] !== t17 || $[48] !== t21 || $[49] !== t22 || $[50] !== t6 || $[51] !== t7 || $[52] !== t8 || $[53] !== t9) {
243
+ t23 = <AuthScreen testID={t6} title={t7} subtitle={t8} header={header} footer={footer}>{t9}{t12}{t15}{t17}{t21}{t22}</AuthScreen>;
244
+ $[43] = footer;
245
+ $[44] = header;
246
+ $[45] = t12;
247
+ $[46] = t15;
248
+ $[47] = t17;
249
+ $[48] = t21;
250
+ $[49] = t22;
251
+ $[50] = t6;
252
+ $[51] = t7;
253
+ $[52] = t8;
254
+ $[53] = t9;
255
+ $[54] = t23;
256
+ } else {
257
+ t23 = $[54];
258
+ }
259
+ return t23;
260
+ }
261
+ /**
262
+ * Deletes the signed-in user's account with `user.delete()`. The user types
263
+ * `confirmWord` first; the delete button stays off until it matches. Needs
264
+ * "Allow users to delete their accounts" turned on for the instance. Errors
265
+ * show under the field. Render it under `ClerkProvider`, signed in.
266
+ */
267
+ export function DeleteAccountScreen(t0) {
268
+ const $ = _c(44);
269
+ const {
270
+ title,
271
+ subtitle,
272
+ header,
273
+ footer,
274
+ onCancel,
275
+ stageTimeoutMs: t1,
276
+ confirmWord: t2,
277
+ onDeleted,
278
+ afterDeleteHref: t3,
279
+ testIDPrefix: t4
280
+ } = t0;
281
+ const stageTimeoutMs = t1 === undefined ? DEFAULT_STAGE_TIMEOUT_MS : t1;
282
+ const confirmWord = t2 === undefined ? "DELETE" : t2;
283
+ const afterDeleteHref = t3 === undefined ? "/" : t3;
284
+ const testIDPrefix = t4 === undefined ? "delete-account" : t4;
285
+ const {
286
+ isLoaded,
287
+ user
288
+ } = useUser();
289
+ const router = useRouter();
290
+ const [typed, setTyped] = useState("");
291
+ const [error, setError] = useState("");
292
+ const [submitting, setSubmitting] = useState(false);
293
+ let t5;
294
+ if ($[0] !== testIDPrefix) {
295
+ t5 = name => `${testIDPrefix}-${name}`;
296
+ $[0] = testIDPrefix;
297
+ $[1] = t5;
298
+ } else {
299
+ t5 = $[1];
300
+ }
301
+ const id = t5;
302
+ let t6;
303
+ if ($[2] !== typed) {
304
+ t6 = typed.trim().toLowerCase();
305
+ $[2] = typed;
306
+ $[3] = t6;
307
+ } else {
308
+ t6 = $[3];
309
+ }
310
+ let t7;
311
+ if ($[4] !== confirmWord) {
312
+ t7 = confirmWord.toLowerCase();
313
+ $[4] = confirmWord;
314
+ $[5] = t7;
315
+ } else {
316
+ t7 = $[5];
317
+ }
318
+ const matches = t6 === t7;
319
+ let t8;
320
+ if ($[6] !== afterDeleteHref || $[7] !== isLoaded || $[8] !== matches || $[9] !== onDeleted || $[10] !== router || $[11] !== stageTimeoutMs || $[12] !== submitting || $[13] !== user) {
321
+ t8 = async () => {
322
+ if (submitting) {
323
+ return;
324
+ }
325
+ if (!matches) {
326
+ return setError(ACCOUNT_MESSAGES.deleteConfirmMismatch);
327
+ }
328
+ if (!isLoaded || !user) {
329
+ return setError(ACCOUNT_MESSAGES.notReady);
330
+ }
331
+ setSubmitting(true);
332
+ setError("");
333
+ let failed = false;
334
+ let failure;
335
+ ;
336
+ try {
337
+ await withAuthTimeout(user.delete(), "delete-account", stageTimeoutMs);
338
+ } catch (t9) {
339
+ const caught = t9;
340
+ failed = true;
341
+ failure = caught;
342
+ }
343
+ setSubmitting(false);
344
+ if (failed) {
345
+ logAuthFailure("delete-account", failure);
346
+ return setError(authErrorMessage(failure, ACCOUNT_MESSAGES.deleteFailed));
347
+ }
348
+ if (onDeleted) {
349
+ onDeleted();
350
+ } else {
351
+ router.replace(afterDeleteHref);
352
+ }
353
+ };
354
+ $[6] = afterDeleteHref;
355
+ $[7] = isLoaded;
356
+ $[8] = matches;
357
+ $[9] = onDeleted;
358
+ $[10] = router;
359
+ $[11] = stageTimeoutMs;
360
+ $[12] = submitting;
361
+ $[13] = user;
362
+ $[14] = t8;
363
+ } else {
364
+ t8 = $[14];
365
+ }
366
+ const submit = t8;
367
+ const label = `Type ${confirmWord} to confirm`;
368
+ const t9 = id("screen");
369
+ const t10 = title ?? ACCOUNT_MESSAGES.deleteTitle;
370
+ const t11 = subtitle ?? ACCOUNT_MESSAGES.deleteSubtitle;
371
+ const t12 = id("confirm");
372
+ let t13;
373
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
374
+ t13 = text => {
375
+ setTyped(text);
376
+ setError("");
377
+ };
378
+ $[15] = t13;
379
+ } else {
380
+ t13 = $[15];
381
+ }
382
+ let t14;
383
+ if ($[16] !== label || $[17] !== t12 || $[18] !== typed) {
384
+ t14 = <Input testID={t12} accessibilityLabel={label} autoCapitalize="characters" autoCorrect={false} returnKeyType="done" value={typed} placeholder={label} onChangeText={t13} />;
385
+ $[16] = label;
386
+ $[17] = t12;
387
+ $[18] = typed;
388
+ $[19] = t14;
389
+ } else {
390
+ t14 = $[19];
391
+ }
392
+ const t15 = id("error");
393
+ let t16;
394
+ if ($[20] !== error || $[21] !== t15) {
395
+ t16 = <FieldError testID={t15} message={error} />;
396
+ $[20] = error;
397
+ $[21] = t15;
398
+ $[22] = t16;
399
+ } else {
400
+ t16 = $[22];
401
+ }
402
+ const t17 = id("submit");
403
+ const t18 = !matches;
404
+ let t19;
405
+ if ($[23] !== submit) {
406
+ t19 = () => void submit();
407
+ $[23] = submit;
408
+ $[24] = t19;
409
+ } else {
410
+ t19 = $[24];
411
+ }
412
+ let t20;
413
+ if ($[25] !== submitting || $[26] !== t17 || $[27] !== t18 || $[28] !== t19) {
414
+ t20 = <Button testID={t17} variant="destructive" loading={submitting} disabled={t18} onPress={t19}>{ACCOUNT_MESSAGES.deleteAccount}</Button>;
415
+ $[25] = submitting;
416
+ $[26] = t17;
417
+ $[27] = t18;
418
+ $[28] = t19;
419
+ $[29] = t20;
420
+ } else {
421
+ t20 = $[29];
422
+ }
423
+ let t21;
424
+ if ($[30] !== id || $[31] !== onCancel || $[32] !== submitting) {
425
+ t21 = onCancel ? <Button testID={id("cancel")} variant="ghost" disabled={submitting} onPress={onCancel}>{ACCOUNT_MESSAGES.cancel}</Button> : null;
426
+ $[30] = id;
427
+ $[31] = onCancel;
428
+ $[32] = submitting;
429
+ $[33] = t21;
430
+ } else {
431
+ t21 = $[33];
432
+ }
433
+ let t22;
434
+ if ($[34] !== footer || $[35] !== header || $[36] !== t10 || $[37] !== t11 || $[38] !== t14 || $[39] !== t16 || $[40] !== t20 || $[41] !== t21 || $[42] !== t9) {
435
+ t22 = <AuthScreen testID={t9} title={t10} subtitle={t11} header={header} footer={footer}>{t14}{t16}{t20}{t21}</AuthScreen>;
436
+ $[34] = footer;
437
+ $[35] = header;
438
+ $[36] = t10;
439
+ $[37] = t11;
440
+ $[38] = t14;
441
+ $[39] = t16;
442
+ $[40] = t20;
443
+ $[41] = t21;
444
+ $[42] = t9;
445
+ $[43] = t22;
446
+ } else {
447
+ t22 = $[43];
448
+ }
449
+ return t22;
450
+ }
@@ -1,4 +1,4 @@
1
- import { ClerkLoaded, ClerkProvider, useAuth as useClerkAuth } from "@clerk/clerk-expo";
1
+ import { ClerkLoaded, ClerkProvider, useAuth as useClerkAuth } from "@clerk/expo";
2
2
  import { ConvexProvider } from "convex/react";
3
3
  import { ConvexProviderWithClerk } from "convex/react-clerk";
4
4
  /**
@@ -19,7 +19,7 @@ export function AuthProviders({
19
19
  return convex ? <ConvexProvider client={convex}>{children}</ConvexProvider> : <>{children}</>;
20
20
  }
21
21
  const inner = loaded ? <ClerkLoaded>{children}</ClerkLoaded> : children;
22
- return <ClerkProvider publishableKey={publishableKey} tokenCache={tokenCache}>
22
+ return <ClerkProvider publishableKey={publishableKey ?? ""} tokenCache={tokenCache}>
23
23
  {convex ? <ConvexProviderWithClerk client={convex} useAuth={useAuth}>
24
24
  {inner}
25
25
  </ConvexProviderWithClerk> : inner}
@@ -1,7 +1,7 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { useEffect, useState } from "react";
3
3
  import { Platform } from "react-native";
4
- import { useSSO } from "@clerk/clerk-expo";
4
+ import { useSSO } from "@clerk/expo";
5
5
  import * as AuthSession from "expo-auth-session";
6
6
  import * as WebBrowser from "expo-web-browser";
7
7
  import { useRouter } from "expo-router";