create-disposabl-app 0.19.1 → 0.19.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/dist/disposabl.js +9 -3
- package/dist/index.js +1 -1
- package/dist/templates/default/packages/cli/build.ts +2 -0
- package/dist/templates/default/packages/cli/client.ts +7 -1
- package/dist/templates/default/packages/cli/gitignore +1 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/billing-login.tsx +69 -15
- package/dist/templates/default/packages/sdk/build.ts +2 -0
- package/dist/templates/default/packages/sdk/gitignore +1 -0
- package/package.json +1 -1
package/dist/disposabl.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// ../cli/auth.ts
|
|
4
4
|
import { lock } from "proper-lockfile";
|
|
5
5
|
// ../cli/package.json
|
|
6
|
-
var version = "0.19.
|
|
6
|
+
var version = "0.19.2";
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@disposabl/cli",
|
|
9
9
|
version,
|
|
@@ -514,6 +514,9 @@ function createProgram(serviceOrigin, centralAnalytics = false, dependencies = {
|
|
|
514
514
|
});
|
|
515
515
|
};
|
|
516
516
|
const program = new Command().name(Object.keys(package_default.bin)[0]).version(package_default.version);
|
|
517
|
+
program.addHelpText("after", `
|
|
518
|
+
API commands are loaded from the configured service. Use <command> --help for their options.
|
|
519
|
+
`);
|
|
517
520
|
if (centralAnalytics)
|
|
518
521
|
program.addHelpText("after", `
|
|
519
522
|
Disposabl collects limited CLI usage when configured. Set DO_NOT_TRACK=1 to opt out.
|
|
@@ -704,7 +707,7 @@ function needsContract(program, argv, origin) {
|
|
|
704
707
|
const args = argv.slice(2);
|
|
705
708
|
const { operands } = program.parseOptions(args);
|
|
706
709
|
const command = operands[0] === "help" ? operands[1] : operands[0];
|
|
707
|
-
return Boolean(origin) && !args.some((arg) => arg === "--version" || arg === "-V") && command !== "login" && command !== "logout";
|
|
710
|
+
return Boolean(origin) && command !== undefined && !args.some((arg) => arg === "--version" || arg === "-V") && command !== "login" && command !== "logout";
|
|
708
711
|
}
|
|
709
712
|
|
|
710
713
|
// ../cli/commands.ts
|
|
@@ -1012,7 +1015,10 @@ Waiting for connections. Press Ctrl+C to keep your files and finish later.`);
|
|
|
1012
1015
|
}
|
|
1013
1016
|
}
|
|
1014
1017
|
}
|
|
1015
|
-
|
|
1018
|
+
if (argv.length <= 2)
|
|
1019
|
+
program.outputHelp();
|
|
1020
|
+
else
|
|
1021
|
+
await program.parseAsync(argv);
|
|
1016
1022
|
}
|
|
1017
1023
|
const command = ["--version", "-V"].includes(argv[2] ?? "") ? "version" : ["--help", "-h"].includes(argv[2] ?? "") ? "help" : argv[2] ?? "help";
|
|
1018
1024
|
const central = serviceOrigin === SERVICE_ORIGIN;
|
package/dist/index.js
CHANGED
|
@@ -1563,7 +1563,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
1563
1563
|
import { Command, CommanderError } from "commander";
|
|
1564
1564
|
import * as p2 from "@clack/prompts";
|
|
1565
1565
|
// package.json
|
|
1566
|
-
var version = "0.19.
|
|
1566
|
+
var version = "0.19.2";
|
|
1567
1567
|
|
|
1568
1568
|
// ../cli/telemetry.ts
|
|
1569
1569
|
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
@@ -82,6 +82,10 @@ export function createProgram(
|
|
|
82
82
|
const program = new Command()
|
|
83
83
|
.name(Object.keys(manifest.bin)[0])
|
|
84
84
|
.version(manifest.version);
|
|
85
|
+
program.addHelpText(
|
|
86
|
+
"after",
|
|
87
|
+
"\nAPI commands are loaded from the configured service. Use <command> --help for their options.\n",
|
|
88
|
+
);
|
|
85
89
|
if (centralAnalytics)
|
|
86
90
|
program.addHelpText(
|
|
87
91
|
"after",
|
|
@@ -362,7 +366,8 @@ export async function runApiCli(argv: string[], serviceOrigin: string) {
|
|
|
362
366
|
}
|
|
363
367
|
}
|
|
364
368
|
}
|
|
365
|
-
|
|
369
|
+
if (argv.length <= 2) program.outputHelp();
|
|
370
|
+
else await program.parseAsync(argv);
|
|
366
371
|
}
|
|
367
372
|
|
|
368
373
|
/** Offline auth/version help remains usable even when the API is unavailable. */
|
|
@@ -376,6 +381,7 @@ export function needsContract(
|
|
|
376
381
|
const command = operands[0] === "help" ? operands[1] : operands[0];
|
|
377
382
|
return (
|
|
378
383
|
Boolean(origin) &&
|
|
384
|
+
command !== undefined &&
|
|
379
385
|
!args.some((arg) => arg === "--version" || arg === "-V") &&
|
|
380
386
|
command !== "login" &&
|
|
381
387
|
command !== "logout"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
LICENSE
|
|
@@ -2,7 +2,7 @@ import { createFileRoute } from "@tanstack/react-router";
|
|
|
2
2
|
import { useAuthActions } from "@convex-dev/auth/react";
|
|
3
3
|
import { makeFunctionReference } from "convex/server";
|
|
4
4
|
import { useMutation, useQuery } from "convex/react";
|
|
5
|
-
import {
|
|
5
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
6
6
|
import { PasswordPage } from "../components/password-page";
|
|
7
7
|
import { Button } from "../components/ui/button";
|
|
8
8
|
|
|
@@ -31,7 +31,7 @@ function BillingLogin() {
|
|
|
31
31
|
const [framed] = useState(
|
|
32
32
|
() => typeof window !== "undefined" && window.top !== window.self,
|
|
33
33
|
);
|
|
34
|
-
const [code] = useState(() =>
|
|
34
|
+
const [code, setCode] = useState(() =>
|
|
35
35
|
typeof window === "undefined" ? "" : window.location.hash.slice(1),
|
|
36
36
|
);
|
|
37
37
|
const account = useQuery(inspect, code && !framed ? { code } : "skip");
|
|
@@ -39,21 +39,69 @@ function BillingLogin() {
|
|
|
39
39
|
const { setSession } = useAuthActions();
|
|
40
40
|
const [pending, setPending] = useState(false);
|
|
41
41
|
const [error, setError] = useState("");
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
const [adopting, setAdopting] = useState(false);
|
|
43
|
+
const generation = useRef(0);
|
|
44
|
+
const currentCode = useRef(code);
|
|
45
|
+
const consentUrl = useRef("");
|
|
46
|
+
const inFlight = useRef(false);
|
|
47
|
+
const adoption = useRef(false);
|
|
48
|
+
useLayoutEffect(() => {
|
|
49
|
+
const scrub = () => {
|
|
50
|
+
window.history.replaceState(
|
|
51
|
+
window.history.state,
|
|
52
|
+
"",
|
|
53
|
+
window.location.pathname,
|
|
54
|
+
);
|
|
55
|
+
consentUrl.current = window.location.href;
|
|
56
|
+
};
|
|
57
|
+
const changed = (event: HashChangeEvent) => {
|
|
58
|
+
const fragment = new URL(event.newURL).hash;
|
|
59
|
+
if (window.location.hash !== fragment) return;
|
|
60
|
+
generation.current++;
|
|
61
|
+
currentCode.current = fragment.slice(1);
|
|
62
|
+
inFlight.current = false;
|
|
63
|
+
setPending(false);
|
|
64
|
+
setError("");
|
|
65
|
+
setCode(fragment.slice(1));
|
|
66
|
+
scrub();
|
|
67
|
+
};
|
|
68
|
+
scrub();
|
|
69
|
+
window.addEventListener("hashchange", changed);
|
|
70
|
+
return () => {
|
|
71
|
+
generation.current++;
|
|
72
|
+
window.removeEventListener("hashchange", changed);
|
|
73
|
+
};
|
|
48
74
|
}, []);
|
|
49
75
|
async function proceed() {
|
|
50
|
-
if (
|
|
76
|
+
if (
|
|
77
|
+
!account?.name ||
|
|
78
|
+
pending ||
|
|
79
|
+
inFlight.current ||
|
|
80
|
+
adoption.current ||
|
|
81
|
+
code !== currentCode.current ||
|
|
82
|
+
window.location.href !== consentUrl.current
|
|
83
|
+
)
|
|
84
|
+
return;
|
|
85
|
+
const version = generation.current;
|
|
86
|
+
const current = () =>
|
|
87
|
+
version === generation.current &&
|
|
88
|
+
window.location.href === consentUrl.current;
|
|
89
|
+
inFlight.current = true;
|
|
51
90
|
setPending(true);
|
|
52
91
|
try {
|
|
53
92
|
const { purchase, expiresAt, returnClaim, ...tokens } = await exchange({
|
|
54
93
|
code,
|
|
55
94
|
});
|
|
56
|
-
|
|
95
|
+
if (!current()) return;
|
|
96
|
+
adoption.current = true;
|
|
97
|
+
setAdopting(true);
|
|
98
|
+
try {
|
|
99
|
+
await setSession(tokens);
|
|
100
|
+
} finally {
|
|
101
|
+
adoption.current = false;
|
|
102
|
+
setAdopting(false);
|
|
103
|
+
}
|
|
104
|
+
if (!current()) return;
|
|
57
105
|
window.sessionStorage.setItem(
|
|
58
106
|
"billing-from-ios",
|
|
59
107
|
JSON.stringify({
|
|
@@ -65,10 +113,16 @@ function BillingLogin() {
|
|
|
65
113
|
);
|
|
66
114
|
window.location.replace("/pricing?source=ios");
|
|
67
115
|
} catch {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
116
|
+
if (current()) {
|
|
117
|
+
setError(
|
|
118
|
+
"This link could not sign you in. Open billing again from the app.",
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
} finally {
|
|
122
|
+
if (current()) {
|
|
123
|
+
inFlight.current = false;
|
|
124
|
+
setPending(false);
|
|
125
|
+
}
|
|
72
126
|
}
|
|
73
127
|
}
|
|
74
128
|
return (
|
|
@@ -84,7 +138,7 @@ function BillingLogin() {
|
|
|
84
138
|
<>
|
|
85
139
|
<p className="break-words font-medium">{account.name}</p>
|
|
86
140
|
<p>This signs this browser into the account shown above.</p>
|
|
87
|
-
<Button disabled={pending} onClick={() => void proceed()}>
|
|
141
|
+
<Button disabled={pending || adopting} onClick={() => void proceed()}>
|
|
88
142
|
{pending ? "Signing in…" : `Continue as ${account.name}`}
|
|
89
143
|
</Button>
|
|
90
144
|
</>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
LICENSE
|