create-disposabl-app 0.20.16 → 0.20.17
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 +1 -1
- package/dist/templates/default/.github/scripts/apple.sh +9 -0
- package/dist/templates/default/.github/workflows/pipeline.yml +1 -1
- package/dist/templates/default/apps/mobile/eas.json +2 -0
- package/dist/templates/default/apps/mobile/package.json +14 -14
- package/dist/templates/default/apps/mobile/scripts/android-release-verify.mjs +11 -1
- package/dist/templates/default/bun.lock +103 -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 +6 -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 +4 -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/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/components/email-verification.tsx +4 -2
- package/dist/templates/default/packages/disposabl-kit/mobile/lib/auth-errors.ts +2 -0
- package/dist/templates/default/packages/disposabl-kit/package.json +7 -7
- 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/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/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 +19 -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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
3
|
"platforms": ["web", "android", "ios", "api", "mcp", "cli", "typescript-sdk"],
|
|
4
|
-
"features": ["authentication", "docs", "analytics"],
|
|
4
|
+
"features": ["authentication", "docs", "analytics", "payments"],
|
|
5
5
|
"androidArchitectures": ["arm64-v8a", "x86_64"]
|
|
6
6
|
}
|
|
@@ -31,22 +31,22 @@
|
|
|
31
31
|
"packages/*"
|
|
32
32
|
],
|
|
33
33
|
"catalog": {
|
|
34
|
-
"@convex-dev/auth": "file:vendor/convex-auth-
|
|
35
|
-
"convex": "^1.
|
|
34
|
+
"@convex-dev/auth": "file:vendor/convex-auth-2.0.0-disposabl.2.tgz",
|
|
35
|
+
"convex": "^1.50.0",
|
|
36
36
|
"lucide-react": "^1.70.0",
|
|
37
37
|
"react": "19.3.0",
|
|
38
38
|
"react-dom": "19.3.0",
|
|
39
39
|
"@convex-dev/mcp": "0.1.0-alpha.7",
|
|
40
40
|
"@convex-dev/static-hosting": "0.2.1",
|
|
41
|
-
"posthog-js": "1.
|
|
42
|
-
"posthog-react-native": "4.
|
|
43
|
-
"@posthog/react-native-plugin": "2.13.
|
|
41
|
+
"posthog-js": "1.450.0",
|
|
42
|
+
"posthog-react-native": "4.87.0",
|
|
43
|
+
"@posthog/react-native-plugin": "2.13.1"
|
|
44
44
|
},
|
|
45
45
|
"patchedDependencies": {
|
|
46
46
|
"@convex-dev/mcp@0.1.0-alpha.7": "patches/convex-mcp-account-erasure-alpha7.patch",
|
|
47
47
|
"@convex-dev/static-hosting@0.2.1": "patches/@convex-dev%2Fstatic-hosting@0.2.1.patch",
|
|
48
48
|
"react-native-css@3.1.0-rc.1": "patches/react-native-css@3.1.0-rc.1.patch",
|
|
49
|
-
"expo-modules-core@58.0
|
|
49
|
+
"expo-modules-core@58.1.0": "patches/expo-modules-core@58.1.0.patch"
|
|
50
50
|
},
|
|
51
51
|
"overrides": {
|
|
52
52
|
"lightningcss": "1.30.1"
|
|
@@ -24,6 +24,7 @@ const app = defineApp({
|
|
|
24
24
|
REVENUECAT_WEBHOOK_AUTH: v.optional(v.string()),
|
|
25
25
|
REVENUECAT_PROJECT_ID: v.optional(v.string()),
|
|
26
26
|
REVENUECAT_ENVIRONMENT: v.optional(v.string()),
|
|
27
|
+
REVENUECAT_REVIEWER_USERS: v.optional(v.string()),
|
|
27
28
|
REVENUECAT_ROUTES: v.optional(v.string()),
|
|
28
29
|
REVENUECAT_MANAGED_MONTHLY_ROUTES: v.optional(v.string()),
|
|
29
30
|
REVENUECAT_SYNC_ENABLED: v.optional(v.string()),
|
|
@@ -30,20 +30,17 @@ export const current = internalQuery({
|
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const authMethod = v.union(
|
|
34
34
|
v.object({
|
|
35
35
|
name: v.literal("emailPassword"),
|
|
36
|
-
accountId: v.string(),
|
|
37
36
|
profile: v.object({}),
|
|
38
37
|
}),
|
|
39
38
|
v.object({
|
|
40
|
-
name: v.literal("
|
|
41
|
-
accountId: v.string(),
|
|
39
|
+
name: v.literal("usernamePassword"),
|
|
42
40
|
profile: v.object({}),
|
|
43
41
|
}),
|
|
44
42
|
v.object({
|
|
45
43
|
name: v.literal("google"),
|
|
46
|
-
accountId: v.string(),
|
|
47
44
|
profile: vGoogleProfile,
|
|
48
45
|
}),
|
|
49
46
|
);
|
|
@@ -54,21 +51,21 @@ const authProvider = v.union(
|
|
|
54
51
|
*/
|
|
55
52
|
export const createUser = internalMutation({
|
|
56
53
|
args: {
|
|
57
|
-
|
|
54
|
+
method: authMethod,
|
|
58
55
|
},
|
|
59
56
|
returns: v.id("users"),
|
|
60
|
-
handler: async (ctx, {
|
|
61
|
-
if (env.AUTH_GOOGLE_ONLY === "true" &&
|
|
57
|
+
handler: async (ctx, { method }) => {
|
|
58
|
+
if (env.AUTH_GOOGLE_ONLY === "true" && method.name !== "google")
|
|
62
59
|
throw new ConvexError("Use Sign in with Google for this app.");
|
|
63
|
-
if (
|
|
60
|
+
if (method.name === "usernamePassword" && env.RESEND_API_KEY?.trim()) {
|
|
64
61
|
throw new ConvexError(
|
|
65
62
|
"New accounts must use verified email and password.",
|
|
66
63
|
);
|
|
67
64
|
}
|
|
68
65
|
return await ctx.db.insert(
|
|
69
66
|
"users",
|
|
70
|
-
|
|
71
|
-
? { profile: displayProfile(
|
|
67
|
+
method.name === "google"
|
|
68
|
+
? { profile: displayProfile(method.profile) }
|
|
72
69
|
: {},
|
|
73
70
|
);
|
|
74
71
|
},
|
|
@@ -76,14 +73,14 @@ export const createUser = internalMutation({
|
|
|
76
73
|
|
|
77
74
|
/** Enforce Google-only policy even when an old client calls password sign-in. */
|
|
78
75
|
export const onSignIn = internalMutation({
|
|
79
|
-
args: { userId: v.id("users"),
|
|
76
|
+
args: { userId: v.id("users"), method: authMethod },
|
|
80
77
|
returns: v.null(),
|
|
81
|
-
handler: async (ctx, { userId,
|
|
82
|
-
if (env.AUTH_GOOGLE_ONLY === "true" &&
|
|
78
|
+
handler: async (ctx, { userId, method }) => {
|
|
79
|
+
if (env.AUTH_GOOGLE_ONLY === "true" && method.name !== "google")
|
|
83
80
|
throw new ConvexError("Use Sign in with Google for this app.");
|
|
84
|
-
if (
|
|
81
|
+
if (method.name === "google")
|
|
85
82
|
await ctx.db.patch("users", userId, {
|
|
86
|
-
profile: displayProfile(
|
|
83
|
+
profile: displayProfile(method.profile),
|
|
87
84
|
});
|
|
88
85
|
return null;
|
|
89
86
|
},
|
|
@@ -16,6 +16,8 @@ Configure `AUTUMN_SECRET_KEY` and `BILLING_RETURN_URL` on this app's Convex depl
|
|
|
16
16
|
|
|
17
17
|
## Catalog initialization
|
|
18
18
|
|
|
19
|
+
Disposabl uses Yast-dev's USD production organization with separate IDs `disposabl_credits`, `disposabl_monthly`, and `disposabl_topup`. These isolate Disposabl balances from Yast plans. The generator replaces `payments/catalog.ts` with the starter's own default IDs; it does not copy production credentials.
|
|
20
|
+
|
|
19
21
|
`payments/config.ts` is the editable source for plan IDs, prices, credits and currency. The default catalog has a consumable `credits` feature, a $5 monthly plan with 750 included credits resetting each month, and a $5 prepaid top-up with `billing_units: 500` and `interval: "one_off"`. The monthly multiplier changes the monthly allowance without changing top-ups. Top-ups have no reset or expiry configuration. Web checkout sends exactly that credit quantity. The web pricing page, mobile allowance text and optional Autumn configuration example use the same source.
|
|
20
22
|
|
|
21
23
|
The internal Convex action `billing:setup` takes `{}` and returns `{ enabled, created, preserved }`. It is re-exported by both the app backend and starter backend. With payments disabled, it returns before reading credentials or calling Autumn. When enabled without `AUTUMN_SECRET_KEY`, it fails with a setup message identifying the missing deployment credential. Customer checkout never initializes the catalog.
|
|
@@ -87,3 +89,7 @@ Catalog contracts were checked against the official API 2.6.0 docs and `autumn-j
|
|
|
87
89
|
Provider references: [create plan](https://docs.useautumn.com/api-reference/plans/createPlan), [get plan](https://docs.useautumn.com/api-reference/plans/getPlan), [list plans](https://docs.useautumn.com/api-reference/plans/listPlans), [create feature](https://docs.useautumn.com/api-reference/features/createFeature), [get feature](https://docs.useautumn.com/api-reference/features/getFeature), [list features](https://docs.useautumn.com/api-reference/features/listFeatures), [API attach](https://docs.useautumn.com/api-reference/billing/attach), [customer](https://docs.useautumn.com/api-reference/customers/getOrCreateCustomer), [portal](https://docs.useautumn.com/api-reference/billing/openCustomerPortal), [prepaid top-ups](https://docs.useautumn.com/examples/prepaid), [pricing config](https://docs.useautumn.com/cli/config), [RevenueCat](https://docs.useautumn.com/documentation/external-providers/revenuecat), [Platform API](https://docs.useautumn.com/api-reference/platform/overview).
|
|
88
90
|
|
|
89
91
|
Native SDK is pinned to `react-native-purchases` 10.16.0 because its required `PurchasesHybridCommon` 19.17.0 is published in CocoaPods. At verification on 2026-11-07, npm 11.0.1 required 20.4.0, which was absent from the CocoaPods specs repository. Upgrade only after both native dependency graphs resolve and installed builds pass.
|
|
92
|
+
|
|
93
|
+
### Store reviewer sandbox purchases
|
|
94
|
+
|
|
95
|
+
Production deployments may explicitly set `REVENUECAT_REVIEWER_USERS` to a JSON array of exact app user IDs (maximum 20) to accept authenticated RevenueCat `SANDBOX` purchase events for those accounts on the existing allowlisted app, store and product routes. The setting is absent by default. Only those users' sandbox purchases can grant their live Autumn balance; do not add ordinary users. The regular production purchase route and managed monthly integration are unchanged. Configure RevenueCat separately to send sandbox webhooks using the authenticated endpoint; sandbox transfers and other accounts are rejected. A sandbox monthly initial purchase or renewal grants the configured monthly credits until the event's `expiration_at_ms`; a top-up grants the configured non-expiring top-up credits. Normal monthly cancellation does not revoke the current grant; a reported refund follows the existing operator-review flow. Unknown outcomes remain held for reconciliation. Remove the allowlist when review is complete and reconcile any remaining sandbox grants and pending events; changes cannot cancel an already dispatched provider request. These controls do not prove delivery or billing provider behavior. Verify the exact reviewer account and a real sandbox transaction through the webhook, balance and product usage before submission.
|
|
@@ -35,8 +35,6 @@ export function GoogleSignIn() {
|
|
|
35
35
|
return "That sign-in expired. Please try again.";
|
|
36
36
|
case "INVALID_FLOW":
|
|
37
37
|
return "Please start Google sign-in again in this browser.";
|
|
38
|
-
case "REJECTED":
|
|
39
|
-
return "Google sign-in was declined.";
|
|
40
38
|
case "OTHER_ERROR":
|
|
41
39
|
return "Google sign-in failed. Please try again.";
|
|
42
40
|
default:
|
|
@@ -51,7 +51,10 @@ export function LegalPage({
|
|
|
51
51
|
</p>
|
|
52
52
|
)}
|
|
53
53
|
{legalConfig.effectiveDate && (
|
|
54
|
-
<p className="mt-4 text-sm">
|
|
54
|
+
<p className="mt-4 text-sm">
|
|
55
|
+
{legalIsDraft() ? "Planned effective date" : "Effective"}{" "}
|
|
56
|
+
{legalConfig.effectiveDate}
|
|
57
|
+
</p>
|
|
55
58
|
)}
|
|
56
59
|
{document ? (
|
|
57
60
|
<div className="mt-10 space-y-9">
|
package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/verify-email.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCompleteSignUpWithEmailPassword } from "@convex-dev/auth/methods/email-password/react";
|
|
2
2
|
import { createFileRoute, Link } from "@tanstack/react-router";
|
|
3
3
|
import { useEffect } from "react";
|
|
4
4
|
import { api } from "../../../../backend/convex/_generated/api";
|
|
@@ -8,7 +8,9 @@ import { PasswordPage } from "../../components/password-page";
|
|
|
8
8
|
|
|
9
9
|
function VerifyEmail() {
|
|
10
10
|
const { code } = Route.useSearch();
|
|
11
|
-
const state =
|
|
11
|
+
const state = useCompleteSignUpWithEmailPassword(api.authEmail, {
|
|
12
|
+
emailCode: code,
|
|
13
|
+
});
|
|
12
14
|
useEffect(() => {
|
|
13
15
|
if (state.status !== "complete") return;
|
|
14
16
|
const destination =
|
|
@@ -67,20 +67,27 @@ export type BillingAttempt =
|
|
|
67
67
|
|
|
68
68
|
export function Pricing({
|
|
69
69
|
onAttempt,
|
|
70
|
-
|
|
70
|
+
embedded = false,
|
|
71
|
+
}: { onAttempt?: (attempt: BillingAttempt) => void; embedded?: boolean } = {}) {
|
|
71
72
|
if (!paymentsEnabled)
|
|
72
73
|
return (
|
|
73
74
|
<section className="mx-auto max-w-5xl p-8">
|
|
74
|
-
|
|
75
|
+
{embedded ? (
|
|
76
|
+
<h2>Payments are unavailable</h2>
|
|
77
|
+
) : (
|
|
78
|
+
<h1>Payments are unavailable</h1>
|
|
79
|
+
)}
|
|
75
80
|
<SubscriptionHelp />
|
|
76
81
|
</section>
|
|
77
82
|
);
|
|
78
|
-
return <SessionPricing onAttempt={onAttempt} />;
|
|
83
|
+
return <SessionPricing onAttempt={onAttempt} embedded={embedded} />;
|
|
79
84
|
}
|
|
80
85
|
function SessionPricing({
|
|
81
86
|
onAttempt,
|
|
87
|
+
embedded,
|
|
82
88
|
}: {
|
|
83
89
|
onAttempt?: (attempt: BillingAttempt) => void;
|
|
90
|
+
embedded: boolean;
|
|
84
91
|
}) {
|
|
85
92
|
const token = useAuthToken();
|
|
86
93
|
const { isAuthenticated, isLoading } = useConvexAuth();
|
|
@@ -90,6 +97,7 @@ function SessionPricing({
|
|
|
90
97
|
key={session ?? "signed-out"}
|
|
91
98
|
session={session}
|
|
92
99
|
onAttempt={onAttempt}
|
|
100
|
+
embedded={embedded}
|
|
93
101
|
/>
|
|
94
102
|
);
|
|
95
103
|
}
|
|
@@ -119,9 +127,11 @@ function SubscriptionHelp() {
|
|
|
119
127
|
function PurchasePage({
|
|
120
128
|
session,
|
|
121
129
|
onAttempt,
|
|
130
|
+
embedded,
|
|
122
131
|
}: {
|
|
123
132
|
session: string | null;
|
|
124
133
|
onAttempt?: (attempt: BillingAttempt) => void;
|
|
134
|
+
embedded: boolean;
|
|
125
135
|
}) {
|
|
126
136
|
const identity = useConsentIdentity();
|
|
127
137
|
const [{ handoff, fromIos }] = useState(() =>
|
|
@@ -270,7 +280,11 @@ function PurchasePage({
|
|
|
270
280
|
return (
|
|
271
281
|
<section className="mx-auto max-w-5xl space-y-8 p-8">
|
|
272
282
|
<div>
|
|
273
|
-
|
|
283
|
+
{embedded ? (
|
|
284
|
+
<h2 className="text-3xl font-semibold">Pricing</h2>
|
|
285
|
+
) : (
|
|
286
|
+
<h1 className="text-3xl font-semibold">Pricing</h1>
|
|
287
|
+
)}
|
|
274
288
|
</div>
|
|
275
289
|
{isLoading ? (
|
|
276
290
|
<p>Checking your account...</p>
|
|
@@ -11,14 +11,17 @@ import { publisher } from "./publisher";
|
|
|
11
11
|
export const legalConfig = {
|
|
12
12
|
appName: project.name === "disposabl-dev" ? "Disposabl" : project.name,
|
|
13
13
|
operatorName: publisher.operatorName,
|
|
14
|
-
operatorAddress:
|
|
15
|
-
country:
|
|
14
|
+
operatorAddress: publisher.operatorAddress,
|
|
15
|
+
country: publisher.country,
|
|
16
16
|
privacyEmail: publisher.privacyEmail,
|
|
17
|
-
effectiveDate: "",
|
|
18
|
-
reviewed: false,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
effectiveDate: publisher.policy?.effectiveDate ?? "",
|
|
18
|
+
reviewed: publisher.policy?.reviewed ?? false,
|
|
19
|
+
dataNotice: publisher.policy?.dataNotice ?? "",
|
|
20
|
+
retention: publisher.policy?.retention ?? "",
|
|
21
|
+
internationalTransfers: publisher.policy?.internationalTransfers ?? "",
|
|
22
|
+
audience: publisher.policy?.audience ?? "",
|
|
23
|
+
aiNotice: publisher.policy?.aiNotice ?? "",
|
|
24
|
+
deletionInstructions: publisher.policy?.deletionInstructions,
|
|
22
25
|
providers: [
|
|
23
26
|
{
|
|
24
27
|
name: "Convex",
|
|
@@ -18,13 +18,15 @@ export const privacy: LegalDocument = {
|
|
|
18
18
|
paragraphs: [
|
|
19
19
|
"When you use account features, we handle account identifiers and the profile information supplied through sign-in to authenticate you and provide access to your account. We handle content you submit to provide the features you request.",
|
|
20
20
|
"Our infrastructure processes technical information needed to deliver requests, protect the service, and investigate faults. Avoid sending information we do not need.",
|
|
21
|
+
...(c.dataNotice ? [c.dataNotice] : []),
|
|
21
22
|
"The legal basis for providing requested account and service features is performance of our contract with you. Security and abuse prevention rely on our legitimate interest in protecting the service, balanced against your rights. We also process information where required by law. Where we rely on consent, you may withdraw it without affecting earlier lawful processing.",
|
|
22
23
|
],
|
|
23
24
|
},
|
|
24
25
|
{
|
|
25
26
|
title: "Service providers and disclosures",
|
|
26
27
|
paragraphs: [
|
|
27
|
-
"We use service providers to operate the service. They receive information needed for their role
|
|
28
|
+
"We use service providers to operate the service. They receive information needed for their role.",
|
|
29
|
+
...(c.aiNotice ? [c.aiNotice] : []),
|
|
28
30
|
...c.providers.map((p) => `${p.name}: ${p.purpose}.`),
|
|
29
31
|
"We may disclose information where required by law, to protect legal rights or safety, or as part of a business transfer subject to applicable protections and notices.",
|
|
30
32
|
],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { privacy } from "./documents/privacy";
|
|
2
2
|
import { terms } from "./documents/terms";
|
|
3
3
|
import type { LegalDocument } from "./types";
|
|
4
|
+
import { legalConfig } from "./config";
|
|
4
5
|
|
|
5
6
|
export { legalConfig, legalIsDraft } from "./config";
|
|
6
7
|
export const legalDocuments: LegalDocument[] = [
|
|
@@ -29,7 +30,7 @@ export const legalDocuments: LegalDocument[] = [
|
|
|
29
30
|
sections: [
|
|
30
31
|
{
|
|
31
32
|
title: "Request account deletion",
|
|
32
|
-
paragraphs: [
|
|
33
|
+
paragraphs: legalConfig.deletionInstructions ?? [
|
|
33
34
|
"Use the available request option or contact the publisher below. A request does not itself delete your account; the publisher must confirm how it will be handled.",
|
|
34
35
|
"Clearing browser storage or uninstalling an app does not delete information held by the service. Some records may be retained where applicable law requires or permits it; ask the publisher about its retention policy.",
|
|
35
36
|
"Account deletion does not itself cancel an app-store subscription. Manage subscriptions through the store where you purchased them.",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import type { Publisher } from "./types";
|
|
2
|
+
|
|
1
3
|
// Set these to the app publisher's details before launch.
|
|
2
|
-
export const publisher = {
|
|
4
|
+
export const publisher: Publisher = {
|
|
3
5
|
operatorName: "",
|
|
6
|
+
operatorAddress: "",
|
|
7
|
+
country: "",
|
|
4
8
|
privacyEmail: "",
|
|
5
9
|
providers: [] as { name: string; purpose: string }[],
|
|
6
10
|
};
|
|
@@ -4,3 +4,21 @@ export type LegalDocument = {
|
|
|
4
4
|
description: string;
|
|
5
5
|
sections: { title: string; paragraphs: string[] }[];
|
|
6
6
|
};
|
|
7
|
+
|
|
8
|
+
export type Publisher = {
|
|
9
|
+
operatorName: string;
|
|
10
|
+
operatorAddress: string;
|
|
11
|
+
country: string;
|
|
12
|
+
privacyEmail: string;
|
|
13
|
+
providers: { name: string; purpose: string }[];
|
|
14
|
+
policy?: {
|
|
15
|
+
reviewed?: boolean;
|
|
16
|
+
effectiveDate?: string;
|
|
17
|
+
dataNotice?: string;
|
|
18
|
+
retention?: string;
|
|
19
|
+
internationalTransfers?: string;
|
|
20
|
+
audience?: string;
|
|
21
|
+
aiNotice?: string;
|
|
22
|
+
deletionInstructions?: string[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -17,6 +17,8 @@ export function authErrorMessage(error: {
|
|
|
17
17
|
return "If this email belongs to an account, a reset link will arrive shortly.";
|
|
18
18
|
case "INVALID_EMAIL":
|
|
19
19
|
return "Enter a valid email address.";
|
|
20
|
+
case "USERNAME_TOO_LONG":
|
|
21
|
+
return `Username must be at most ${error.maximumLength} characters.`;
|
|
20
22
|
case "USERNAME_TOO_SHORT":
|
|
21
23
|
return `Username must be at least ${error.minimumLength} characters.`;
|
|
22
24
|
case "USERNAME_HAS_SURROUNDING_WHITESPACE":
|
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]);
|
|
@@ -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,7 +19,7 @@
|
|
|
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:",
|
|
@@ -67,16 +67,16 @@
|
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"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.
|
|
70
|
+
"expo": "~58.0.25",
|
|
71
|
+
"expo-router": "~58.0.31",
|
|
72
|
+
"expo-secure-store": "~58.0.3",
|
|
73
|
+
"expo-updates": "~58.0.22",
|
|
74
|
+
"expo-web-browser": "~58.0.8",
|
|
75
75
|
"react-native": "0.88.1",
|
|
76
76
|
"react-native-safe-area-context": "~5.11.1",
|
|
77
77
|
"react-native-purchases": "10.16.0",
|
|
78
78
|
"react-native-css": "3.1.0-rc.1",
|
|
79
|
-
"@expo/ui": "~58.0.
|
|
79
|
+
"@expo/ui": "~58.0.28",
|
|
80
80
|
"expo-glass-effect": "~58.0.5",
|
|
81
81
|
"react-native-purchases-ui": "10.16.0"
|
|
82
82
|
},
|
|
@@ -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";
|
|
@@ -9,6 +9,8 @@ export type RevenueCatConfig = {
|
|
|
9
9
|
store: "APP_STORE" | "PLAY_STORE";
|
|
10
10
|
autumnKey: string;
|
|
11
11
|
managedMonthlyProducts?: string[];
|
|
12
|
+
reviewerCustomers?: string[];
|
|
13
|
+
reviewerMonthly?: boolean;
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
export type PurchaseEvent = {
|
|
@@ -20,7 +22,8 @@ export type PurchaseEvent = {
|
|
|
20
22
|
product: string;
|
|
21
23
|
customer: string;
|
|
22
24
|
transaction: string;
|
|
23
|
-
type: "purchase" | "cancel" | "review";
|
|
25
|
+
type: "purchase" | "cancel" | "review" | "ignore";
|
|
26
|
+
expiresAt?: number;
|
|
24
27
|
};
|
|
25
28
|
|
|
26
29
|
export function parseTransfer(payload: unknown, config: RevenueCatConfig) {
|
|
@@ -43,6 +46,7 @@ export function parseTransfer(payload: unknown, config: RevenueCatConfig) {
|
|
|
43
46
|
(id) => typeof id === "string" && id.length > 0 && id.length <= 256,
|
|
44
47
|
);
|
|
45
48
|
if (
|
|
49
|
+
config.reviewerCustomers !== undefined ||
|
|
46
50
|
e.type !== "TRANSFER" ||
|
|
47
51
|
e.app_id !== config.app ||
|
|
48
52
|
e.environment !== config.environment ||
|
|
@@ -149,6 +153,42 @@ export function revenueCatConfigs(
|
|
|
149
153
|
(config.managedMonthlyProducts ??= []).push(route.product);
|
|
150
154
|
}
|
|
151
155
|
}
|
|
156
|
+
if (environment === "PRODUCTION" && env.REVENUECAT_REVIEWER_USERS) {
|
|
157
|
+
let users: unknown;
|
|
158
|
+
try {
|
|
159
|
+
users = JSON.parse(env.REVENUECAT_REVIEWER_USERS);
|
|
160
|
+
} catch {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
if (
|
|
164
|
+
!Array.isArray(users) ||
|
|
165
|
+
!users.length ||
|
|
166
|
+
users.length > 20 ||
|
|
167
|
+
!users.every(
|
|
168
|
+
(id) => typeof id === "string" && /^[a-z0-9]{20,64}$/.test(id),
|
|
169
|
+
) ||
|
|
170
|
+
new Set(users).size !== users.length
|
|
171
|
+
)
|
|
172
|
+
return null;
|
|
173
|
+
const reviewers = users as string[];
|
|
174
|
+
const sandbox = result.flatMap((route) => [
|
|
175
|
+
{
|
|
176
|
+
...route,
|
|
177
|
+
environment: "SANDBOX" as const,
|
|
178
|
+
managedMonthlyProducts: undefined,
|
|
179
|
+
reviewerCustomers: reviewers,
|
|
180
|
+
},
|
|
181
|
+
...(route.managedMonthlyProducts ?? []).map((product) => ({
|
|
182
|
+
...route,
|
|
183
|
+
product,
|
|
184
|
+
environment: "SANDBOX" as const,
|
|
185
|
+
managedMonthlyProducts: undefined,
|
|
186
|
+
reviewerCustomers: reviewers,
|
|
187
|
+
reviewerMonthly: true,
|
|
188
|
+
})),
|
|
189
|
+
]);
|
|
190
|
+
result.push(...sandbox);
|
|
191
|
+
}
|
|
152
192
|
return result;
|
|
153
193
|
}
|
|
154
194
|
|
|
@@ -235,16 +275,48 @@ export function parseRevenueCatEvent(
|
|
|
235
275
|
const customer = e.app_user_id as string;
|
|
236
276
|
if (
|
|
237
277
|
customer.startsWith("$RCAnonymousID:") ||
|
|
278
|
+
(config.reviewerCustomers &&
|
|
279
|
+
!config.reviewerCustomers.includes(customer)) ||
|
|
238
280
|
(e.original_app_user_id !== undefined &&
|
|
239
281
|
e.original_app_user_id !== customer)
|
|
240
282
|
)
|
|
241
283
|
return null;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
284
|
+
let type: PurchaseEvent["type"];
|
|
285
|
+
let expiresAt: number | undefined;
|
|
286
|
+
if (config.reviewerMonthly) {
|
|
287
|
+
if (e.type === "INITIAL_PURCHASE" || e.type === "RENEWAL") {
|
|
288
|
+
if (
|
|
289
|
+
!Number.isSafeInteger(e.expiration_at_ms) ||
|
|
290
|
+
(e.expiration_at_ms as number) <= 0
|
|
291
|
+
)
|
|
292
|
+
return null;
|
|
293
|
+
expiresAt = e.expiration_at_ms as number;
|
|
294
|
+
type = "purchase";
|
|
295
|
+
} else if (
|
|
296
|
+
e.type === "CANCELLATION" &&
|
|
297
|
+
e.cancel_reason === "CUSTOMER_SUPPORT"
|
|
298
|
+
)
|
|
299
|
+
type = "cancel";
|
|
300
|
+
else if (
|
|
301
|
+
(e.type === "CANCELLATION" &&
|
|
302
|
+
[
|
|
303
|
+
"UNSUBSCRIBE",
|
|
304
|
+
"BILLING_ERROR",
|
|
305
|
+
"DEVELOPER_INITIATED",
|
|
306
|
+
"PRICE_INCREASE",
|
|
307
|
+
].includes(e.cancel_reason as string)) ||
|
|
308
|
+
e.type === "EXPIRATION"
|
|
309
|
+
)
|
|
310
|
+
type = "ignore";
|
|
311
|
+
else type = "review";
|
|
312
|
+
} else {
|
|
313
|
+
type =
|
|
314
|
+
e.type === "NON_RENEWING_PURCHASE"
|
|
315
|
+
? "purchase"
|
|
316
|
+
: e.type === "CANCELLATION"
|
|
317
|
+
? "cancel"
|
|
318
|
+
: "review";
|
|
319
|
+
}
|
|
248
320
|
return {
|
|
249
321
|
deliveryId: e.id as string,
|
|
250
322
|
project: config.project,
|
|
@@ -255,6 +327,7 @@ export function parseRevenueCatEvent(
|
|
|
255
327
|
customer,
|
|
256
328
|
transaction: e.transaction_id as string,
|
|
257
329
|
type,
|
|
330
|
+
...(expiresAt === undefined ? {} : { expiresAt }),
|
|
258
331
|
};
|
|
259
332
|
}
|
|
260
333
|
|
|
@@ -282,13 +355,19 @@ export function balanceRequest(
|
|
|
282
355
|
customer: string,
|
|
283
356
|
balance: string,
|
|
284
357
|
kind: "grant" | "refund",
|
|
358
|
+
expiresAt?: number,
|
|
285
359
|
) {
|
|
286
360
|
return {
|
|
287
361
|
customer_id: customer,
|
|
288
362
|
feature_id: pricing.featureId,
|
|
289
363
|
balance_id: balance,
|
|
290
364
|
...(kind === "grant"
|
|
291
|
-
? {
|
|
365
|
+
? {
|
|
366
|
+
included_grant: creditQuantity(
|
|
367
|
+
expiresAt === undefined ? "topup" : "monthly",
|
|
368
|
+
),
|
|
369
|
+
...(expiresAt === undefined ? {} : { expires_at: expiresAt }),
|
|
370
|
+
}
|
|
292
371
|
: { remaining: 0 }),
|
|
293
372
|
};
|
|
294
373
|
}
|