create-disposabl-app 0.20.16 → 0.20.18
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/disposabl.js +1 -1
- package/dist/index.js +3 -1
- package/dist/templates/default/.github/scripts/apple.sh +9 -0
- package/dist/templates/default/.github/scripts/release.sh +11 -1
- package/dist/templates/default/.github/workflows/pipeline.yml +1 -1
- package/dist/templates/default/apps/docs/content/mobile.mdx +2 -0
- package/dist/templates/default/apps/docs/content/publishing/apple.mdx +12 -0
- package/dist/templates/default/apps/docs/content/publishing/google-play.mdx +12 -0
- package/dist/templates/default/apps/docs/content/publishing/index.mdx +23 -0
- package/dist/templates/default/apps/mobile/eas.json +2 -0
- package/dist/templates/default/apps/mobile/package.json +15 -14
- package/dist/templates/default/apps/mobile/scripts/android-release-verify.mjs +62 -7
- package/dist/templates/default/apps/mobile/scripts/play-aab.mjs +4 -0
- package/dist/templates/default/apps/mobile/scripts/verify-play-aab.mjs +48 -0
- package/dist/templates/default/bun.lock +111 -169
- package/dist/templates/default/disposabl.json +1 -1
- package/dist/templates/default/package.json +6 -6
- package/dist/templates/default/packages/backend/convex/authEmail.ts +1 -1
- package/dist/templates/default/packages/backend/convex/convex.config.ts +1 -0
- package/dist/templates/default/packages/backend/convex/users/internal.ts +13 -16
- package/dist/templates/default/packages/disposabl-kit/PAYMENTS.md +8 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/cookie-consent.tsx +117 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/google-sign-in.tsx +0 -2
- package/dist/templates/default/packages/disposabl-kit/client/components/legal-page.tsx +19 -1
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/verify-email.tsx +4 -2
- package/dist/templates/default/packages/disposabl-kit/client/routes/pricing.tsx +18 -4
- package/dist/templates/default/packages/disposabl-kit/client/styles/cookie-consent.css +54 -0
- package/dist/templates/default/packages/disposabl-kit/legal/config.ts +10 -7
- package/dist/templates/default/packages/disposabl-kit/legal/documents/privacy.ts +3 -1
- package/dist/templates/default/packages/disposabl-kit/legal/index.ts +2 -1
- package/dist/templates/default/packages/disposabl-kit/legal/publisher.ts +5 -1
- package/dist/templates/default/packages/disposabl-kit/legal/types.ts +18 -0
- package/dist/templates/default/packages/disposabl-kit/lib/auth-errors.ts +2 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +168 -99
- package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-ui.tsx +9 -21
- package/dist/templates/default/packages/disposabl-kit/mobile/components/email-verification.tsx +4 -2
- package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-page.tsx +52 -20
- package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +13 -4
- package/dist/templates/default/packages/disposabl-kit/mobile/lib/auth-errors.ts +2 -0
- package/dist/templates/default/packages/disposabl-kit/package.json +14 -9
- package/dist/templates/default/packages/disposabl-kit/payments/catalog.ts +6 -0
- package/dist/templates/default/packages/disposabl-kit/payments/config.ts +5 -3
- package/dist/templates/default/packages/disposabl-kit/server/billing-functions.ts +15 -3
- package/dist/templates/default/packages/disposabl-kit/server/billing-native-capability.ts +33 -6
- package/dist/templates/default/packages/disposabl-kit/server/billing.ts +11 -3
- package/dist/templates/default/packages/disposabl-kit/server/revenuecat-contract.ts +87 -8
- package/dist/templates/default/packages/disposabl-kit/server/revenuecat-functions.ts +34 -8
- package/dist/templates/default/packages/disposabl-kit/server/revenuecat-validator.ts +3 -0
- package/dist/templates/default/packages/tests/billing-setup.test.ts +14 -14
- package/dist/templates/default/packages/tests/billing.test.ts +22 -0
- package/dist/templates/default/packages/tests/components/mobile-account-billing.test.mjs +149 -0
- package/dist/templates/default/packages/tests/flows/email-delivery.e2e.ts +1 -1
- package/dist/templates/default/packages/tests/flows/legal.e2e.ts +7 -5
- package/dist/templates/default/packages/tests/flows/password-backend.e2e.ts +1 -1
- package/dist/templates/default/packages/tests/helpers/auth-email-setup/probe.test.mjs +1 -1
- package/dist/templates/default/packages/tests/ios-ota.test.ts +32 -10
- package/dist/templates/default/packages/tests/mobile-account-billing.test.ts +19 -0
- package/dist/templates/default/packages/tests/native-billing.test.ts +71 -0
- package/dist/templates/default/packages/tests/package-release.test.ts +16 -0
- package/dist/templates/default/packages/tests/revenuecat-inbox.test.ts +91 -3
- package/dist/templates/default/patches/expo-modules-core@58.1.0.patch +23 -0
- package/dist/templates/default/vendor/README.md +4 -10
- package/dist/templates/default/vendor/convex-auth-2.0.0-disposabl.2.patch +2096 -0
- package/dist/templates/default/vendor/convex-auth-2.0.0-disposabl.2.tgz +0 -0
- package/package.json +1 -1
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { useAction } from "convex/react";
|
|
2
2
|
import { makeFunctionReference } from "convex/server";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
AppState,
|
|
6
|
+
Linking,
|
|
7
|
+
Platform,
|
|
8
|
+
Pressable,
|
|
9
|
+
Text,
|
|
10
|
+
View,
|
|
11
|
+
} from "react-native";
|
|
5
12
|
import type { PurchasesPackage } from "react-native-purchases";
|
|
6
|
-
import { AuthButton, authClasses } from "../components/auth-ui";
|
|
7
13
|
import { billingSession } from "./session";
|
|
8
14
|
import {
|
|
9
15
|
monthlyOfferingId,
|
|
10
16
|
presentMonthlyPaywall,
|
|
11
17
|
selectMonthlyOffering,
|
|
12
18
|
} from "./paywall";
|
|
13
|
-
import { creditQuantity
|
|
19
|
+
import { creditQuantity } from "../../payments/config";
|
|
14
20
|
import { paymentOptions, storeEligibility } from "./policy";
|
|
15
21
|
import { useWebCheckout } from "./web-checkout";
|
|
16
22
|
import { useTopup } from "./use-topup";
|
|
@@ -63,10 +69,19 @@ export function AccountBilling({ customerId }: { customerId: string }) {
|
|
|
63
69
|
const latest = () =>
|
|
64
70
|
current(version) && sequence === refreshSequence.current;
|
|
65
71
|
if (latest()) setMonthly(null);
|
|
72
|
+
let result: Snapshot;
|
|
73
|
+
try {
|
|
74
|
+
result = await getSnapshot({});
|
|
75
|
+
} catch {
|
|
76
|
+
if (latest()) {
|
|
77
|
+
setData(null);
|
|
78
|
+
setRefreshError("Billing could not refresh. Please try again.");
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (!latest()) return;
|
|
83
|
+
setData(result);
|
|
66
84
|
try {
|
|
67
|
-
const result = await getSnapshot({});
|
|
68
|
-
if (!latest()) return;
|
|
69
|
-
setData(result);
|
|
70
85
|
if (key && productId && result.nativeSubscriptionsEnabled) {
|
|
71
86
|
const store = await billingSession.run(
|
|
72
87
|
customerId,
|
|
@@ -97,8 +112,8 @@ export function AccountBilling({ customerId }: { customerId: string }) {
|
|
|
97
112
|
if (latest()) setRefreshError("");
|
|
98
113
|
} catch {
|
|
99
114
|
if (latest()) {
|
|
100
|
-
|
|
101
|
-
setRefreshError("
|
|
115
|
+
setMonthly(null);
|
|
116
|
+
setRefreshError("Store unavailable. Please try again.");
|
|
102
117
|
}
|
|
103
118
|
}
|
|
104
119
|
},
|
|
@@ -210,121 +225,175 @@ export function AccountBilling({ customerId }: { customerId: string }) {
|
|
|
210
225
|
}
|
|
211
226
|
}
|
|
212
227
|
|
|
228
|
+
const disabled = busy || web.busy || topup.busy;
|
|
229
|
+
const openManagement = (url: string) => {
|
|
230
|
+
void Linking.openURL(url).catch(() =>
|
|
231
|
+
setMessage("Could not open subscription settings."),
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
|
|
213
235
|
return (
|
|
214
|
-
<View className=
|
|
215
|
-
<
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
236
|
+
<View className="gap-4">
|
|
237
|
+
<View>
|
|
238
|
+
<Text className="text-[13px] font-medium text-muted-foreground">
|
|
239
|
+
Available
|
|
240
|
+
</Text>
|
|
241
|
+
<Text className="text-[28px] font-bold tracking-[-0.5px] text-foreground">
|
|
242
|
+
{data?.balance == null
|
|
243
|
+
? "Unavailable"
|
|
244
|
+
: `${new Intl.NumberFormat().format(data.balance)} credits`}
|
|
245
|
+
</Text>
|
|
246
|
+
</View>
|
|
223
247
|
{data?.hasMonthlyPlan && (
|
|
224
|
-
<Text className=
|
|
225
|
-
|
|
248
|
+
<Text className="text-[14px] text-muted-foreground">
|
|
249
|
+
Monthly plan active or scheduled.
|
|
226
250
|
</Text>
|
|
227
251
|
)}
|
|
228
252
|
{data?.monthlyCheckoutPending && (
|
|
229
|
-
<Text className=
|
|
230
|
-
Finish or cancel your website checkout
|
|
253
|
+
<Text className="text-[14px] text-muted-foreground">
|
|
254
|
+
Finish or cancel your website checkout first.
|
|
231
255
|
</Text>
|
|
232
256
|
)}
|
|
233
257
|
{monthly ? (
|
|
234
|
-
<
|
|
235
|
-
|
|
258
|
+
<Pressable
|
|
259
|
+
accessibilityRole="button"
|
|
260
|
+
accessibilityState={{
|
|
261
|
+
disabled:
|
|
262
|
+
disabled ||
|
|
263
|
+
data?.hasMonthlyPlan !== false ||
|
|
264
|
+
data?.monthlyCheckoutPending !== false,
|
|
265
|
+
}}
|
|
236
266
|
disabled={
|
|
237
|
-
|
|
238
|
-
web.busy ||
|
|
239
|
-
topup.busy ||
|
|
267
|
+
disabled ||
|
|
240
268
|
data?.hasMonthlyPlan !== false ||
|
|
241
269
|
data?.monthlyCheckoutPending !== false
|
|
242
270
|
}
|
|
243
271
|
onPress={() => void transact(false)}
|
|
244
|
-
|
|
272
|
+
className={`rounded-[14px] bg-foreground p-4 active:opacity-60 ${disabled || data?.hasMonthlyPlan !== false || data?.monthlyCheckoutPending !== false ? "opacity-60" : ""}`}
|
|
273
|
+
>
|
|
274
|
+
<View className="flex-row items-center justify-between gap-2">
|
|
275
|
+
<Text className="text-[16px] font-semibold text-background">
|
|
276
|
+
{creditQuantity("monthly")} credits / month
|
|
277
|
+
</Text>
|
|
278
|
+
<Text className="text-[16px] font-semibold text-background">
|
|
279
|
+
{monthly.product.priceString} / mo
|
|
280
|
+
</Text>
|
|
281
|
+
</View>
|
|
282
|
+
<Text className="mt-1 text-[13px] text-background opacity-70">
|
|
283
|
+
Unused credits expire monthly
|
|
284
|
+
</Text>
|
|
285
|
+
</Pressable>
|
|
245
286
|
) : (
|
|
246
|
-
<Text className=
|
|
247
|
-
Store subscriptions
|
|
287
|
+
<Text className="text-[14px] text-muted-foreground">
|
|
288
|
+
Store subscriptions unavailable.
|
|
248
289
|
</Text>
|
|
249
290
|
)}
|
|
250
|
-
{web.available && (
|
|
251
|
-
<AuthButton
|
|
252
|
-
title="Buy monthly on website"
|
|
253
|
-
disabled={busy || web.busy || topup.busy}
|
|
254
|
-
onPress={() => void web.open()}
|
|
255
|
-
/>
|
|
256
|
-
)}
|
|
257
291
|
{topup.product && (
|
|
258
|
-
<
|
|
259
|
-
|
|
260
|
-
|
|
292
|
+
<Pressable
|
|
293
|
+
accessibilityRole="button"
|
|
294
|
+
accessibilityState={{ disabled }}
|
|
295
|
+
disabled={disabled}
|
|
261
296
|
onPress={() => void topup.purchase()}
|
|
262
|
-
|
|
297
|
+
className={`rounded-[14px] border border-border px-4 py-3 active:opacity-60 ${disabled ? "opacity-60" : ""}`}
|
|
298
|
+
>
|
|
299
|
+
<View className="flex-row items-center justify-between gap-2">
|
|
300
|
+
<Text className="text-[16px] font-semibold text-foreground">
|
|
301
|
+
{creditQuantity("topup")} credits once
|
|
302
|
+
</Text>
|
|
303
|
+
<Text className="text-[16px] font-semibold text-foreground">
|
|
304
|
+
{topup.product.priceString}
|
|
305
|
+
</Text>
|
|
306
|
+
</View>
|
|
307
|
+
<Text className="mt-1 text-[13px] text-muted-foreground">
|
|
308
|
+
Never expires
|
|
309
|
+
</Text>
|
|
310
|
+
</Pressable>
|
|
263
311
|
)}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}}
|
|
282
|
-
/>
|
|
283
|
-
{!!key && data?.nativeSubscriptionsEnabled && (
|
|
284
|
-
<AuthButton
|
|
285
|
-
title="Restore purchases"
|
|
312
|
+
<View className="flex-row flex-wrap gap-x-5 gap-y-2">
|
|
313
|
+
{web.available && (
|
|
314
|
+
<BillingLink
|
|
315
|
+
title="Monthly on website"
|
|
316
|
+
disabled={disabled}
|
|
317
|
+
onPress={() => void web.open()}
|
|
318
|
+
/>
|
|
319
|
+
)}
|
|
320
|
+
{web.topupAvailable && (
|
|
321
|
+
<BillingLink
|
|
322
|
+
title="Top-up on website"
|
|
323
|
+
disabled={disabled}
|
|
324
|
+
onPress={() => void web.open("topup")}
|
|
325
|
+
/>
|
|
326
|
+
)}
|
|
327
|
+
<BillingLink
|
|
328
|
+
title="Refresh"
|
|
286
329
|
disabled={busy}
|
|
287
|
-
onPress={() => void
|
|
330
|
+
onPress={() => void refresh(generation.current)}
|
|
288
331
|
/>
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
332
|
+
{!!key && data?.nativeSubscriptionsEnabled && (
|
|
333
|
+
<BillingLink
|
|
334
|
+
title="Restore"
|
|
335
|
+
disabled={busy}
|
|
336
|
+
onPress={() => void transact(true)}
|
|
337
|
+
/>
|
|
338
|
+
)}
|
|
339
|
+
</View>
|
|
340
|
+
<Text className="text-[13px] leading-[18px] text-muted-foreground">
|
|
341
|
+
Manage or cancel where you subscribed:
|
|
294
342
|
</Text>
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
"
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
"Manage Google Play subscriptions",
|
|
302
|
-
"https://play.google.com/store/account/subscriptions",
|
|
303
|
-
],
|
|
304
|
-
].map(([title, url]) => (
|
|
305
|
-
<AuthButton
|
|
306
|
-
key={title}
|
|
307
|
-
title={title!}
|
|
308
|
-
onPress={() => {
|
|
309
|
-
void Linking.openURL(url!).catch(() =>
|
|
310
|
-
setMessage("Could not open subscription settings."),
|
|
311
|
-
);
|
|
312
|
-
}}
|
|
343
|
+
<View className="flex-row flex-wrap gap-x-5 gap-y-2">
|
|
344
|
+
<BillingLink
|
|
345
|
+
title="Apple"
|
|
346
|
+
onPress={() =>
|
|
347
|
+
openManagement("https://apps.apple.com/account/subscriptions")
|
|
348
|
+
}
|
|
313
349
|
/>
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
<Text accessibilityRole="alert" className={authClasses.body}>
|
|
325
|
-
{web.error}
|
|
350
|
+
<BillingLink
|
|
351
|
+
title="Google Play"
|
|
352
|
+
onPress={() =>
|
|
353
|
+
openManagement(
|
|
354
|
+
"https://play.google.com/store/account/subscriptions",
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
/>
|
|
358
|
+
<Text className="py-1 text-[13px] text-muted-foreground">
|
|
359
|
+
Website: pricing page
|
|
326
360
|
</Text>
|
|
327
|
-
|
|
361
|
+
</View>
|
|
362
|
+
{[topup.message, refreshError, message, web.error]
|
|
363
|
+
.filter(Boolean)
|
|
364
|
+
.map((text, index) => (
|
|
365
|
+
<Text
|
|
366
|
+
key={index}
|
|
367
|
+
accessibilityRole="alert"
|
|
368
|
+
className="text-[14px] leading-[20px] text-muted-foreground"
|
|
369
|
+
>
|
|
370
|
+
{text}
|
|
371
|
+
</Text>
|
|
372
|
+
))}
|
|
328
373
|
</View>
|
|
329
374
|
);
|
|
330
375
|
}
|
|
376
|
+
|
|
377
|
+
function BillingLink({
|
|
378
|
+
title,
|
|
379
|
+
onPress,
|
|
380
|
+
disabled = false,
|
|
381
|
+
}: {
|
|
382
|
+
title: string;
|
|
383
|
+
onPress: () => void;
|
|
384
|
+
disabled?: boolean;
|
|
385
|
+
}) {
|
|
386
|
+
return (
|
|
387
|
+
<Pressable
|
|
388
|
+
accessibilityRole="button"
|
|
389
|
+
accessibilityState={{ disabled }}
|
|
390
|
+
disabled={disabled}
|
|
391
|
+
onPress={onPress}
|
|
392
|
+
className={`py-1 active:opacity-60 ${disabled ? "opacity-60" : ""}`}
|
|
393
|
+
>
|
|
394
|
+
<Text className="text-[14px] font-semibold text-primary-text">
|
|
395
|
+
{title}
|
|
396
|
+
</Text>
|
|
397
|
+
</Pressable>
|
|
398
|
+
);
|
|
399
|
+
}
|
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
import type { PropsWithChildren } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
KeyboardAvoidingView,
|
|
5
|
-
Platform,
|
|
6
|
-
Pressable,
|
|
7
|
-
ScrollView,
|
|
8
|
-
Text,
|
|
9
|
-
} from "react-native";
|
|
10
|
-
import { useHeaderHeight } from "expo-router/react-navigation";
|
|
2
|
+
import { ActivityIndicator, Pressable, Text } from "react-native";
|
|
3
|
+
import { KeyboardAwareScrollView } from "react-native-keyboard-controller";
|
|
11
4
|
import { useTheme } from "../design/use-theme";
|
|
12
5
|
|
|
13
6
|
export function AuthScreen({ children }: PropsWithChildren) {
|
|
14
|
-
const headerHeight = useHeaderHeight();
|
|
15
7
|
return (
|
|
16
|
-
<
|
|
8
|
+
<KeyboardAwareScrollView
|
|
17
9
|
className="flex-1 bg-background"
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
contentContainerClassName={authClasses.content}
|
|
11
|
+
bottomOffset={48}
|
|
12
|
+
keyboardShouldPersistTaps="handled"
|
|
13
|
+
keyboardDismissMode="none"
|
|
20
14
|
>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
keyboardShouldPersistTaps="handled"
|
|
24
|
-
keyboardDismissMode="on-drag"
|
|
25
|
-
>
|
|
26
|
-
{children}
|
|
27
|
-
</ScrollView>
|
|
28
|
-
</KeyboardAvoidingView>
|
|
15
|
+
{children}
|
|
16
|
+
</KeyboardAwareScrollView>
|
|
29
17
|
);
|
|
30
18
|
}
|
|
31
19
|
|
package/dist/templates/default/packages/disposabl-kit/mobile/components/email-verification.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { authReturnPath } from "../lib/auth-return";
|
|
2
|
-
import {
|
|
2
|
+
import { useCompleteSignUpWithEmailPassword } from "@convex-dev/auth/methods/email-password/react";
|
|
3
3
|
import { router, useLocalSearchParams } from "expo-router";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
5
|
import { Text, TextInput } from "react-native";
|
|
@@ -56,7 +56,9 @@ export function EmailVerification() {
|
|
|
56
56
|
|
|
57
57
|
function CompleteVerification({ code }: { code: string }) {
|
|
58
58
|
const { returnTo } = useLocalSearchParams<{ returnTo?: string }>();
|
|
59
|
-
const state =
|
|
59
|
+
const state = useCompleteSignUpWithEmailPassword(api.authEmail, {
|
|
60
|
+
emailCode: code,
|
|
61
|
+
});
|
|
60
62
|
useEffect(() => {
|
|
61
63
|
if (state.status === "complete") router.replace(authReturnPath(returnTo));
|
|
62
64
|
}, [state.status, returnTo]);
|
|
@@ -1,38 +1,66 @@
|
|
|
1
1
|
import { VariableContextProvider } from "nativewind";
|
|
2
2
|
import { router, Stack } from "expo-router";
|
|
3
3
|
import type { ReactNode } from "react";
|
|
4
|
-
import { Pressable, ScrollView
|
|
4
|
+
import { Pressable, ScrollView } from "react-native";
|
|
5
5
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
|
-
import { usePreferenceColors } from "../design/preferences";
|
|
6
|
+
import { GlassIconButton, usePreferenceColors } from "../design/preferences";
|
|
7
|
+
import { useAccentColor } from "../design/theme-provider";
|
|
8
|
+
import { SymbolView } from "../design/nativewind";
|
|
7
9
|
|
|
8
10
|
export function ScreenCloseButton({
|
|
9
11
|
label,
|
|
10
12
|
onPress,
|
|
13
|
+
purpose = "close",
|
|
11
14
|
}: {
|
|
12
15
|
label: string;
|
|
13
16
|
onPress: () => void;
|
|
17
|
+
purpose?: "done" | "close";
|
|
14
18
|
}) {
|
|
19
|
+
const accent = useAccentColor();
|
|
20
|
+
const colors = usePreferenceColors();
|
|
21
|
+
const done = purpose === "done";
|
|
15
22
|
return process.env.EXPO_OS === "ios" ? (
|
|
16
|
-
|
|
17
|
-
<Stack.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
<>
|
|
24
|
+
<Stack.Screen options={{ headerBackVisible: false }} />
|
|
25
|
+
<Stack.Toolbar placement="right">
|
|
26
|
+
<Stack.Toolbar.Button
|
|
27
|
+
accessibilityLabel={label}
|
|
28
|
+
icon={done ? "checkmark" : "xmark"}
|
|
29
|
+
tintColor={done ? accent : colors.text}
|
|
30
|
+
variant={done ? "prominent" : "plain"}
|
|
31
|
+
onPress={onPress}
|
|
32
|
+
/>
|
|
33
|
+
</Stack.Toolbar>
|
|
34
|
+
</>
|
|
21
35
|
) : (
|
|
22
36
|
<Stack.Screen
|
|
23
37
|
options={{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
headerBackVisible: false,
|
|
39
|
+
headerRight: () =>
|
|
40
|
+
done ? (
|
|
41
|
+
<Pressable
|
|
42
|
+
accessibilityRole="button"
|
|
43
|
+
accessibilityLabel={label}
|
|
44
|
+
hitSlop={12}
|
|
45
|
+
onPress={onPress}
|
|
46
|
+
className="min-h-[44px] min-w-[44px] items-center justify-center"
|
|
47
|
+
>
|
|
48
|
+
<SymbolView
|
|
49
|
+
name={{
|
|
50
|
+
ios: done ? "checkmark" : "xmark",
|
|
51
|
+
android: done ? "check" : "close",
|
|
52
|
+
}}
|
|
53
|
+
size={24}
|
|
54
|
+
tintColor={done ? accent : colors.text}
|
|
55
|
+
/>
|
|
56
|
+
</Pressable>
|
|
57
|
+
) : (
|
|
58
|
+
<GlassIconButton
|
|
59
|
+
label={label}
|
|
60
|
+
icon={{ ios: "xmark", android: "close" }}
|
|
61
|
+
onPress={onPress}
|
|
62
|
+
/>
|
|
63
|
+
),
|
|
36
64
|
}}
|
|
37
65
|
/>
|
|
38
66
|
);
|
|
@@ -65,7 +93,11 @@ export function SettingsPage({
|
|
|
65
93
|
contentStyle: { backgroundColor: colors.background },
|
|
66
94
|
}}
|
|
67
95
|
/>
|
|
68
|
-
<ScreenCloseButton
|
|
96
|
+
<ScreenCloseButton
|
|
97
|
+
label="Close settings"
|
|
98
|
+
purpose="done"
|
|
99
|
+
onPress={onClose}
|
|
100
|
+
/>
|
|
69
101
|
<VariableContextProvider
|
|
70
102
|
value={{ "--layout-padding-bottom": inset.bottom + 32 }}
|
|
71
103
|
>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SymbolView } from "./design/nativewind";
|
|
2
|
+
import { KeyboardProvider } from "react-native-keyboard-controller";
|
|
1
3
|
import { ConvexAuthProvider, useAuthToken } from "@convex-dev/auth/react";
|
|
2
4
|
import { ConvexProvider, ConvexReactClient, useConvexAuth } from "convex/react";
|
|
3
5
|
import { Redirect, Stack, router, usePathname } from "expo-router";
|
|
@@ -34,9 +36,11 @@ export function MobileLayout({
|
|
|
34
36
|
telemetry?: TelemetryOverride;
|
|
35
37
|
}) {
|
|
36
38
|
return (
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
|
|
39
|
+
<KeyboardProvider>
|
|
40
|
+
<ThemeProvider>
|
|
41
|
+
<BackendLayout telemetry={telemetry}>{children}</BackendLayout>
|
|
42
|
+
</ThemeProvider>
|
|
43
|
+
</KeyboardProvider>
|
|
40
44
|
);
|
|
41
45
|
}
|
|
42
46
|
|
|
@@ -146,6 +150,7 @@ export function AuthLayout() {
|
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
function CloseAuth() {
|
|
153
|
+
const colors = useTheme();
|
|
149
154
|
return (
|
|
150
155
|
<Pressable
|
|
151
156
|
accessibilityRole="button"
|
|
@@ -153,7 +158,11 @@ function CloseAuth() {
|
|
|
153
158
|
onPress={() => router.dismissTo("/")}
|
|
154
159
|
className="p-[10px]"
|
|
155
160
|
>
|
|
156
|
-
<
|
|
161
|
+
<SymbolView
|
|
162
|
+
name={{ ios: "xmark", android: "close" }}
|
|
163
|
+
size={20}
|
|
164
|
+
tintColor={colors.foreground}
|
|
165
|
+
/>
|
|
157
166
|
</Pressable>
|
|
158
167
|
);
|
|
159
168
|
}
|
|
@@ -15,6 +15,8 @@ export function authErrorMessage(error: AuthError): string {
|
|
|
15
15
|
return "Incorrect username or password.";
|
|
16
16
|
case "USERNAME_TAKEN":
|
|
17
17
|
return "That username is already taken.";
|
|
18
|
+
case "USERNAME_TOO_LONG":
|
|
19
|
+
return `Username must be at most ${error.maximumLength} characters.`;
|
|
18
20
|
case "USERNAME_TOO_SHORT":
|
|
19
21
|
return `Username must be at least ${error.minimumLength} characters.`;
|
|
20
22
|
case "USERNAME_HAS_SURROUNDING_WHITESPACE":
|
|
@@ -19,13 +19,14 @@
|
|
|
19
19
|
"class-variance-authority": "^0.7.1",
|
|
20
20
|
"cn": "^0.5.2",
|
|
21
21
|
"convex": "catalog:",
|
|
22
|
-
"jose": "^6.2.
|
|
22
|
+
"jose": "^6.2.17",
|
|
23
23
|
"lucide-react": "catalog:",
|
|
24
24
|
"next-themes": "^0.4.6",
|
|
25
25
|
"react": "catalog:",
|
|
26
26
|
"react-dom": "catalog:",
|
|
27
27
|
"shadcn": "^4.23.0",
|
|
28
|
-
"tw-animate-css": "^1.4.0"
|
|
28
|
+
"tw-animate-css": "^1.4.0",
|
|
29
|
+
"vanilla-cookieconsent": "3.1.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@tailwindcss/vite": "^4.3.5",
|
|
@@ -67,18 +68,19 @@
|
|
|
67
68
|
},
|
|
68
69
|
"peerDependencies": {
|
|
69
70
|
"expo-clipboard": "~58.0.4",
|
|
70
|
-
"expo": "~58.0.
|
|
71
|
-
"expo-router": "~58.0.
|
|
72
|
-
"expo-secure-store": "~58.0.
|
|
73
|
-
"expo-updates": "~58.0.
|
|
74
|
-
"expo-web-browser": "~58.0.
|
|
71
|
+
"expo": "~58.0.25",
|
|
72
|
+
"expo-router": "~58.0.31",
|
|
73
|
+
"expo-secure-store": "~58.0.3",
|
|
74
|
+
"expo-updates": "~58.0.22",
|
|
75
|
+
"expo-web-browser": "~58.0.8",
|
|
75
76
|
"react-native": "0.88.1",
|
|
76
77
|
"react-native-safe-area-context": "~5.11.1",
|
|
77
78
|
"react-native-purchases": "10.16.0",
|
|
78
79
|
"react-native-css": "3.1.0-rc.1",
|
|
79
|
-
"@expo/ui": "~58.0.
|
|
80
|
+
"@expo/ui": "~58.0.28",
|
|
80
81
|
"expo-glass-effect": "~58.0.5",
|
|
81
|
-
"react-native-purchases-ui": "10.16.0"
|
|
82
|
+
"react-native-purchases-ui": "10.16.0",
|
|
83
|
+
"react-native-keyboard-controller": "1.22.7"
|
|
82
84
|
},
|
|
83
85
|
"peerDependenciesMeta": {
|
|
84
86
|
"expo-clipboard": {
|
|
@@ -119,6 +121,9 @@
|
|
|
119
121
|
},
|
|
120
122
|
"react-native-purchases-ui": {
|
|
121
123
|
"optional": true
|
|
124
|
+
},
|
|
125
|
+
"react-native-keyboard-controller": {
|
|
126
|
+
"optional": true
|
|
122
127
|
}
|
|
123
128
|
}
|
|
124
129
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { catalog } from "./catalog";
|
|
2
|
+
|
|
1
3
|
export type Pricing = {
|
|
2
4
|
currency: string;
|
|
3
5
|
creditsPerDollar: number;
|
|
@@ -10,9 +12,9 @@ export type Pricing = {
|
|
|
10
12
|
export const pricing: Pricing = {
|
|
11
13
|
currency: "USD",
|
|
12
14
|
creditsPerDollar: 100,
|
|
13
|
-
featureId:
|
|
14
|
-
monthly: { planId:
|
|
15
|
-
topup: { planId:
|
|
15
|
+
featureId: catalog.featureId,
|
|
16
|
+
monthly: { planId: catalog.monthlyPlanId, price: 5, creditMultiplier: 1.5 },
|
|
17
|
+
topup: { planId: catalog.topupPlanId, price: 5 },
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export type Purchase = "monthly" | "topup";
|
|
@@ -11,7 +11,10 @@ import {
|
|
|
11
11
|
} from "../../backend/convex/_generated/server";
|
|
12
12
|
import { paymentsEnabled } from "../features";
|
|
13
13
|
import { setupBilling } from "./billing-setup";
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
nativeTopupRoutes,
|
|
16
|
+
reviewerNativeSubscriptionsEnabled,
|
|
17
|
+
} from "./billing-native-capability";
|
|
15
18
|
import {
|
|
16
19
|
balanceFromCustomer,
|
|
17
20
|
monthlyPlanFromCustomer,
|
|
@@ -242,8 +245,17 @@ export const createSnapshot = (eligibility?: BillingEligibility) =>
|
|
|
242
245
|
balance: balanceFromCustomer(customer),
|
|
243
246
|
hasMonthlyPlan: monthlyPlanFromCustomer(customer),
|
|
244
247
|
nativeSubscriptionsEnabled:
|
|
245
|
-
process.env.REVENUECAT_SYNC_ENABLED === "true"
|
|
246
|
-
|
|
248
|
+
process.env.REVENUECAT_SYNC_ENABLED === "true" ||
|
|
249
|
+
reviewerNativeSubscriptionsEnabled(
|
|
250
|
+
paymentsEnabled,
|
|
251
|
+
process.env,
|
|
252
|
+
userId,
|
|
253
|
+
),
|
|
254
|
+
nativeTopupRoutes: nativeTopupRoutes(
|
|
255
|
+
paymentsEnabled,
|
|
256
|
+
process.env,
|
|
257
|
+
userId,
|
|
258
|
+
),
|
|
247
259
|
mobileWebCheckoutEnabled: mobileWebCheckoutConfigured(
|
|
248
260
|
paymentsEnabled,
|
|
249
261
|
process.env,
|