@pisti-paypiller/react 0.0.0-stage → 0.7.1

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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +159 -2
  3. package/dist/api-keys.d.ts +8 -0
  4. package/dist/api-keys.d.ts.map +1 -0
  5. package/dist/api-keys.js +54 -0
  6. package/dist/api-keys.js.map +1 -0
  7. package/dist/async-state.d.ts +14 -0
  8. package/dist/async-state.d.ts.map +1 -0
  9. package/dist/async-state.js +81 -0
  10. package/dist/async-state.js.map +1 -0
  11. package/dist/auth.d.ts +23 -0
  12. package/dist/auth.d.ts.map +1 -0
  13. package/dist/auth.js +297 -0
  14. package/dist/auth.js.map +1 -0
  15. package/dist/client.d.ts +152 -0
  16. package/dist/client.d.ts.map +1 -0
  17. package/dist/client.js +633 -0
  18. package/dist/client.js.map +1 -0
  19. package/dist/context.d.ts +94 -0
  20. package/dist/context.d.ts.map +1 -0
  21. package/dist/context.js +145 -0
  22. package/dist/context.js.map +1 -0
  23. package/dist/index.d.ts +15 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +9 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/organizations.d.ts +16 -0
  28. package/dist/organizations.d.ts.map +1 -0
  29. package/dist/organizations.js +169 -0
  30. package/dist/organizations.js.map +1 -0
  31. package/dist/resources.d.ts +204 -0
  32. package/dist/resources.d.ts.map +1 -0
  33. package/dist/resources.js +129 -0
  34. package/dist/resources.js.map +1 -0
  35. package/dist/reverification.d.ts +5 -0
  36. package/dist/reverification.d.ts.map +1 -0
  37. package/dist/reverification.js +54 -0
  38. package/dist/reverification.js.map +1 -0
  39. package/dist/types.d.ts +118 -0
  40. package/dist/types.d.ts.map +1 -0
  41. package/dist/types.js +2 -0
  42. package/dist/types.js.map +1 -0
  43. package/dist/ui.d.ts +72 -0
  44. package/dist/ui.d.ts.map +1 -0
  45. package/dist/ui.js +125 -0
  46. package/dist/ui.js.map +1 -0
  47. package/dist/user-profile.d.ts +6 -0
  48. package/dist/user-profile.d.ts.map +1 -0
  49. package/dist/user-profile.js +219 -0
  50. package/dist/user-profile.js.map +1 -0
  51. package/package.json +48 -4
  52. package/styles.css +517 -0
package/dist/auth.js ADDED
@@ -0,0 +1,297 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, useContext, useEffect, useRef, useState } from "react";
3
+ import { useAuth, usePisti } from "./context.js";
4
+ import { PistiClientError } from "./client.js";
5
+ /** Set by the provider's modal host, so the forms close the modal instead of redirecting. */
6
+ export const ModalContext = createContext(false);
7
+ function message(error) {
8
+ return error instanceof Error ? error.message : "Something went wrong. Try again.";
9
+ }
10
+ function useEnvironment() {
11
+ const client = usePisti();
12
+ const [environment, setEnvironment] = useState(client.environment);
13
+ const [error, setError] = useState(null);
14
+ useEffect(() => {
15
+ let active = true;
16
+ client.loadEnvironment().then((value) => active && setEnvironment(value), (failure) => active && setError(message(failure)));
17
+ return () => {
18
+ active = false;
19
+ };
20
+ }, [client]);
21
+ return { environment, error };
22
+ }
23
+ function Card({ title, subtitle, children, footer, className = "", }) {
24
+ return (_jsxs("section", { className: "pisti-ui pisti-card " + className, "aria-labelledby": "pisti-card-title", children: [_jsxs("header", { className: "pisti-card-header", children: [_jsx("h1", { id: "pisti-card-title", children: title }), subtitle && _jsx("p", { className: "pisti-muted", children: subtitle })] }), children, footer && _jsx("footer", { className: "pisti-card-footer", children: footer }), _jsx("p", { className: "pisti-secured", children: "Secured by Pisti" })] }));
25
+ }
26
+ function Field({ label, hint, action, ...input }) {
27
+ return (_jsxs("label", { className: "pisti-field", children: [_jsxs("span", { className: "pisti-field-label", children: [label, action] }), _jsx("input", { ...input }), hint && _jsx("span", { className: "pisti-muted pisti-hint", children: hint })] }));
28
+ }
29
+ function CodeField({ label = "Code", autoFocus = true }) {
30
+ return (_jsx(Field, { label: label, name: "code", inputMode: "numeric", autoComplete: "one-time-code", pattern: "[0-9]{6}", maxLength: 6, required: true, autoFocus: autoFocus, className: "pisti-code" }));
31
+ }
32
+ function Problem({ error }) {
33
+ return error ? (_jsx("p", { className: "pisti-notice pisti-error", role: "alert", children: error })) : null;
34
+ }
35
+ /** A complete sign-in form: password or email code, two-step verification and password reset. */
36
+ export function SignIn({ forceRedirectUrl, fallbackRedirectUrl, signUpUrl, className }) {
37
+ const client = usePisti();
38
+ const inModal = useContext(ModalContext);
39
+ const { isLoaded, isSignedIn } = useAuth();
40
+ const { environment, error: loadError } = useEnvironment();
41
+ const [step, setStep] = useState({ name: "start" });
42
+ const [identifier, setIdentifier] = useState("");
43
+ const [useCode, setUseCode] = useState(false);
44
+ const [useRecovery, setUseRecovery] = useState(false);
45
+ const [pending, setPending] = useState(false);
46
+ const [error, setError] = useState(null);
47
+ const [notice, setNotice] = useState(null);
48
+ const finish = () => {
49
+ if (inModal) {
50
+ const options = client.getModalOptions();
51
+ client.closeModal();
52
+ if (options.forceRedirectUrl || options.fallbackRedirectUrl)
53
+ client.redirectAfterSignIn(options);
54
+ }
55
+ else
56
+ client.redirectAfterSignIn({ forceRedirectUrl, fallbackRedirectUrl });
57
+ };
58
+ // Arriving at the sign-in page already signed in continues to the app. Only the first
59
+ // loaded state counts, so a sign-in completed here can still show recovery codes.
60
+ const arrival = useRef(false);
61
+ useEffect(() => {
62
+ if (!isLoaded || arrival.current)
63
+ return;
64
+ arrival.current = true;
65
+ if (isSignedIn)
66
+ finish();
67
+ // eslint-disable-next-line react-hooks/exhaustive-deps
68
+ }, [isLoaded, isSignedIn]);
69
+ async function run(work) {
70
+ setPending(true);
71
+ setError(null);
72
+ try {
73
+ await work();
74
+ }
75
+ catch (failure) {
76
+ setError(message(failure));
77
+ }
78
+ finally {
79
+ setPending(false);
80
+ }
81
+ }
82
+ async function handle(result) {
83
+ if (result.status === "complete") {
84
+ if (result.recoveryCodes?.length)
85
+ setStep({ name: "recovery-codes", codes: result.recoveryCodes });
86
+ else
87
+ finish();
88
+ return;
89
+ }
90
+ const details = result.enrollmentRequired ? await client.signIn.secondFactorDetails(result.attemptId) : null;
91
+ setStep({
92
+ name: "second-factor",
93
+ attemptId: result.attemptId,
94
+ enrollment: details
95
+ ? { setupKey: details.setupKey, uri: details.authenticatorUri, emailCodeRequired: details.emailCodeRequired }
96
+ : null,
97
+ });
98
+ }
99
+ if (!environment)
100
+ return (_jsx(Card, { title: "Sign in", className: className, children: loadError ? _jsx(Problem, { error: loadError }) : _jsx("p", { className: "pisti-muted", role: "status", children: "Loading\u2026" }) }));
101
+ const passwordEnabled = environment.signIn.password;
102
+ const codeEnabled = environment.signIn.emailCode;
103
+ const signUp = environment.signUp.enabled ? (_jsxs(_Fragment, { children: ["Don\u2019t have an account?", " ", _jsx("button", { type: "button", className: "pisti-link", onClick: () => {
104
+ const target = signUpUrl ?? client.signUpUrl;
105
+ if (inModal || !target)
106
+ client.openSignUp(client.getModalOptions());
107
+ else
108
+ client.navigate(target);
109
+ }, children: "Sign up" })] })) : undefined;
110
+ if (step.name === "recovery-codes")
111
+ return (_jsxs(Card, { title: "Save your recovery codes", subtitle: "Each code signs you in once if you lose your phone.", className: className, children: [_jsx("ol", { className: "pisti-codes", children: step.codes.map((code) => (_jsx("li", { children: code }, code))) }), _jsx("button", { type: "button", onClick: finish, children: "I\u2019ve saved them" })] }));
112
+ if (step.name === "second-factor")
113
+ return (_jsxs(Card, { title: step.enrollment ? "Set up two-step verification" : "Two-step verification", subtitle: step.enrollment
114
+ ? "This app requires an authenticator. Add this key to your authenticator app, then enter the code it shows."
115
+ : useRecovery
116
+ ? "Enter one of your recovery codes."
117
+ : "Enter the code from your authenticator app.", className: className, children: [step.enrollment?.setupKey && (_jsxs("div", { className: "pisti-setup", children: [_jsx("code", { children: step.enrollment.setupKey }), step.enrollment.uri && (_jsx("a", { href: step.enrollment.uri, className: "pisti-link", children: "Open in authenticator app" }))] })), _jsxs("form", { className: "pisti-form", onSubmit: (event) => {
118
+ event.preventDefault();
119
+ const form = new FormData(event.currentTarget);
120
+ const code = String(form.get("code")).trim();
121
+ const emailCode = String(form.get("emailCode") ?? "").trim() || undefined;
122
+ void run(async () => handle(await client.signIn.completeSecondFactor(step.attemptId, code, emailCode)));
123
+ }, children: [_jsxs("fieldset", { disabled: pending, children: [step.enrollment?.emailCodeRequired && (_jsx(Field, { label: "Code from your email", hint: "We emailed a code to confirm it\u2019s you before adding an authenticator.", name: "emailCode", inputMode: "numeric", autoComplete: "one-time-code", pattern: "[0-9]{6}", maxLength: 6, required: true, autoFocus: true, className: "pisti-code" })), useRecovery ? (_jsx(Field, { label: "Recovery code", name: "code", autoComplete: "off", required: true, autoFocus: true, maxLength: 64 })) : (_jsx(CodeField, { label: step.enrollment?.emailCodeRequired ? "Code from your authenticator app" : "Code", autoFocus: !step.enrollment?.emailCodeRequired }))] }), _jsx(Problem, { error: error }), _jsx("button", { type: "submit", disabled: pending, children: pending ? "Verifying…" : "Continue" })] }), _jsxs("div", { className: "pisti-row", children: [!step.enrollment && (_jsx("button", { type: "button", className: "pisti-link", onClick: () => setUseRecovery(!useRecovery), children: useRecovery ? "Use authenticator app" : "Use a recovery code" })), _jsx("button", { type: "button", className: "pisti-link", onClick: () => setStep({ name: "start" }), children: "Back" })] })] }));
124
+ if (step.name === "email-code")
125
+ return (_jsxs(Card, { title: "Check your email", subtitle: _jsxs(_Fragment, { children: ["Enter the code we sent to ", _jsx("strong", { children: step.identifier }), "."] }), className: className, children: [_jsxs("form", { className: "pisti-form", onSubmit: (event) => {
126
+ event.preventDefault();
127
+ const code = String(new FormData(event.currentTarget).get("code")).trim();
128
+ void run(async () => handle(await client.signIn.verifyEmailCode(step.requestId, code)));
129
+ }, children: [_jsx("fieldset", { disabled: pending, children: _jsx(CodeField, {}) }), _jsx(Problem, { error: error }), notice && _jsx("p", { className: "pisti-notice", role: "status", children: notice }), _jsx("button", { type: "submit", disabled: pending, children: pending ? "Verifying…" : "Continue" })] }), _jsxs("div", { className: "pisti-row", children: [_jsx("button", { type: "button", className: "pisti-link", disabled: pending, onClick: () => void run(async () => {
130
+ const sent = await client.signIn.sendEmailCode(step.identifier);
131
+ setStep({ ...step, requestId: sent.requestId });
132
+ setNotice("We sent a new code.");
133
+ }), children: "Resend code" }), _jsx("button", { type: "button", className: "pisti-link", onClick: () => setStep({ name: "start" }), children: "Use a different email" })] })] }));
134
+ if (step.name === "reset" || step.name === "reset-code")
135
+ return (_jsxs(Card, { title: "Reset your password", subtitle: step.name === "reset" ? "We’ll email you a code." : _jsxs(_Fragment, { children: ["Enter the code we sent to ", _jsx("strong", { children: step.identifier }), " and choose a new password."] }), className: className, children: [_jsxs("form", { className: "pisti-form", onSubmit: (event) => {
136
+ event.preventDefault();
137
+ const data = new FormData(event.currentTarget);
138
+ if (step.name === "reset") {
139
+ const email = String(data.get("identifier")).trim();
140
+ void run(async () => {
141
+ const sent = await client.passwordReset.sendEmailCode(email);
142
+ setStep({ name: "reset-code", requestId: sent.requestId, identifier: email });
143
+ });
144
+ }
145
+ else
146
+ void run(async () => {
147
+ const authenticatorCode = String(data.get("authenticatorCode") ?? "").trim();
148
+ await client.passwordReset.complete({
149
+ requestId: step.requestId,
150
+ code: String(data.get("code")).trim(),
151
+ password: String(data.get("password")),
152
+ ...(authenticatorCode ? { authenticatorCode } : {}),
153
+ });
154
+ setNotice("Password updated. Sign in with your new password.");
155
+ setStep({ name: "start" });
156
+ });
157
+ }, children: [_jsx("fieldset", { disabled: pending, children: step.name === "reset" ? (_jsx(Field, { label: "Email address", name: "identifier", type: "email", autoComplete: "username", defaultValue: identifier, required: true, autoFocus: true })) : (_jsxs(_Fragment, { children: [_jsx(CodeField, { label: "Code from the email" }), _jsx(Field, { label: "New password", name: "password", type: "password", autoComplete: "new-password", minLength: 15, maxLength: 128, required: true, hint: "At least 15 characters." }), _jsx(Field, { label: "Authenticator code (only if you use one)", name: "authenticatorCode", autoComplete: "off", maxLength: 64 })] })) }), _jsx(Problem, { error: error }), _jsx("button", { type: "submit", disabled: pending, children: pending ? "Working…" : step.name === "reset" ? "Send code" : "Update password" })] }), _jsx("div", { className: "pisti-row", children: _jsx("button", { type: "button", className: "pisti-link", onClick: () => setStep({ name: "start" }), children: "Back to sign in" }) })] }));
158
+ if (step.name === "reactivate" || step.name === "reactivate-code")
159
+ return (_jsxs(Card, { title: "Reactivate your account", subtitle: step.name === "reactivate" ? ("Deactivated accounts can be restored for 30 days. We’ll email you a code.") : (_jsxs(_Fragment, { children: ["Enter the code we sent to ", _jsx("strong", { children: step.identifier }), "."] })), className: className, children: [_jsxs("form", { className: "pisti-form", onSubmit: (event) => {
160
+ event.preventDefault();
161
+ const data = new FormData(event.currentTarget);
162
+ if (step.name === "reactivate") {
163
+ const email = String(data.get("identifier")).trim();
164
+ void run(async () => {
165
+ const sent = await client.reactivation.sendEmailCode(email);
166
+ setStep({ name: "reactivate-code", requestId: sent.requestId, identifier: email });
167
+ });
168
+ }
169
+ else
170
+ void run(async () => {
171
+ const authenticatorCode = String(data.get("authenticatorCode") ?? "").trim();
172
+ await client.reactivation.complete({
173
+ requestId: step.requestId,
174
+ code: String(data.get("code")).trim(),
175
+ ...(authenticatorCode ? { authenticatorCode } : {}),
176
+ });
177
+ setNotice("Your account is active again. Sign in to continue.");
178
+ setStep({ name: "start" });
179
+ });
180
+ }, children: [_jsx("fieldset", { disabled: pending, children: step.name === "reactivate" ? (_jsx(Field, { label: "Email address", name: "identifier", type: "email", autoComplete: "username", defaultValue: identifier, required: true, autoFocus: true })) : (_jsxs(_Fragment, { children: [_jsx(CodeField, { label: "Code from the email" }), _jsx(Field, { label: "Authenticator code (only if you use one)", name: "authenticatorCode", autoComplete: "off", maxLength: 64 })] })) }), _jsx(Problem, { error: error }), _jsx("button", { type: "submit", disabled: pending, children: pending ? "Working…" : step.name === "reactivate" ? "Send code" : "Reactivate account" })] }), _jsx("div", { className: "pisti-row", children: _jsx("button", { type: "button", className: "pisti-link", onClick: () => setStep({ name: "start" }), children: "Back to sign in" }) })] }));
181
+ const emailOnly = !passwordEnabled || useCode;
182
+ return (_jsxs(Card, { title: `Sign in to ${environment.applicationName}`, subtitle: "Welcome back! Please sign in to continue.", footer: signUp, className: className, children: [notice && _jsx("p", { className: "pisti-notice", role: "status", children: notice }), _jsxs("form", { className: "pisti-form", onSubmit: (event) => {
183
+ event.preventDefault();
184
+ const data = new FormData(event.currentTarget);
185
+ const email = String(data.get("identifier")).trim();
186
+ setIdentifier(email);
187
+ setNotice(null);
188
+ void run(async () => {
189
+ if (emailOnly) {
190
+ const sent = await client.signIn.sendEmailCode(email);
191
+ setStep({ name: "email-code", requestId: sent.requestId, identifier: email });
192
+ }
193
+ else
194
+ await handle(await client.signIn.password(email, String(data.get("password"))));
195
+ });
196
+ }, children: [_jsxs("fieldset", { disabled: pending, children: [_jsx(Field, { label: "Email address", name: "identifier", type: "email", autoComplete: "username", defaultValue: identifier, required: true, autoFocus: true }), !emailOnly && (_jsx(Field, { label: "Password", name: "password", type: "password", autoComplete: "current-password", maxLength: 128, required: true, action: _jsx("button", { type: "button", className: "pisti-link pisti-small", onClick: (event) => {
197
+ const field = event.currentTarget.closest("form")?.querySelector('input[name="identifier"]');
198
+ setIdentifier(field?.value.trim() ?? identifier);
199
+ setError(null);
200
+ setStep({ name: "reset", identifier: field?.value.trim() ?? identifier });
201
+ }, children: "Forgot password?" }) }))] }), _jsx(Problem, { error: error }), _jsx("button", { type: "submit", disabled: pending, children: pending ? "Signing in…" : "Continue" })] }), passwordEnabled && codeEnabled && (_jsx("div", { className: "pisti-row", children: _jsx("button", { type: "button", className: "pisti-link", onClick: () => setUseCode(!useCode), children: useCode ? "Use your password instead" : "Email me a sign-in code instead" }) })), _jsx("div", { className: "pisti-row", children: _jsx("button", { type: "button", className: "pisti-link pisti-small", onClick: () => {
202
+ setError(null);
203
+ setNotice(null);
204
+ setStep({ name: "reactivate", identifier });
205
+ }, children: "Reactivate a deactivated account" }) })] }));
206
+ }
207
+ /** A complete sign-up form: email verification by code, name and an optional password. */
208
+ export function SignUp({ forceRedirectUrl, fallbackRedirectUrl, signInUrl, className }) {
209
+ const client = usePisti();
210
+ const inModal = useContext(ModalContext);
211
+ const { isLoaded, isSignedIn } = useAuth();
212
+ const { environment, error: loadError } = useEnvironment();
213
+ const done = () => {
214
+ if (inModal) {
215
+ const options = client.getModalOptions();
216
+ client.closeModal();
217
+ if (options.forceRedirectUrl || options.fallbackRedirectUrl)
218
+ client.redirectAfterSignUp(options);
219
+ }
220
+ else
221
+ client.redirectAfterSignUp({ forceRedirectUrl, fallbackRedirectUrl });
222
+ };
223
+ const [request, setRequest] = useState(null);
224
+ const [details, setDetails] = useState({
225
+ firstName: "",
226
+ lastName: "",
227
+ password: "",
228
+ });
229
+ const [pending, setPending] = useState(false);
230
+ const [error, setError] = useState(null);
231
+ const arrival = useRef(false);
232
+ useEffect(() => {
233
+ if (!isLoaded || arrival.current)
234
+ return;
235
+ arrival.current = true;
236
+ if (isSignedIn)
237
+ done();
238
+ // eslint-disable-next-line react-hooks/exhaustive-deps
239
+ }, [isLoaded, isSignedIn]);
240
+ async function run(work) {
241
+ setPending(true);
242
+ setError(null);
243
+ try {
244
+ await work();
245
+ }
246
+ catch (failure) {
247
+ setError(failure instanceof PistiClientError && failure.code === "sign_up_disabled" ? "Sign-ups are closed for this app." : message(failure));
248
+ }
249
+ finally {
250
+ setPending(false);
251
+ }
252
+ }
253
+ if (!environment)
254
+ return (_jsx(Card, { title: "Create your account", className: className, children: loadError ? _jsx(Problem, { error: loadError }) : _jsx("p", { className: "pisti-muted", role: "status", children: "Loading\u2026" }) }));
255
+ const signIn = (_jsxs(_Fragment, { children: ["Already have an account?", " ", _jsx("button", { type: "button", className: "pisti-link", onClick: () => {
256
+ const target = signInUrl ?? client.signInUrl;
257
+ if (inModal || !target)
258
+ client.openSignIn(client.getModalOptions());
259
+ else
260
+ client.navigate(target);
261
+ }, children: "Sign in" })] }));
262
+ if (!environment.signUp.enabled)
263
+ return (_jsx(Card, { title: "Sign-ups are closed", subtitle: "Ask the app\u2019s owner for an invitation.", footer: signIn, className: className, children: _jsx("span", {}) }));
264
+ if (request)
265
+ return (_jsxs(Card, { title: "Verify your email", subtitle: _jsxs(_Fragment, { children: ["Enter the code we sent to ", _jsx("strong", { children: request.email }), "."] }), footer: signIn, className: className, children: [_jsxs("form", { className: "pisti-form", onSubmit: (event) => {
266
+ event.preventDefault();
267
+ const code = String(new FormData(event.currentTarget).get("code")).trim();
268
+ void run(async () => {
269
+ const result = await client.signUp.verify({
270
+ requestId: request.requestId,
271
+ code,
272
+ firstName: details.firstName,
273
+ lastName: details.lastName,
274
+ ...(details.password ? { password: details.password } : {}),
275
+ });
276
+ if (result.status === "complete")
277
+ done();
278
+ else
279
+ setError("Sign in to finish setting up two-step verification.");
280
+ });
281
+ }, children: [_jsx("fieldset", { disabled: pending, children: _jsx(CodeField, {}) }), _jsx(Problem, { error: error }), _jsx("button", { type: "submit", disabled: pending, children: pending ? "Creating account…" : "Continue" })] }), _jsx("div", { className: "pisti-row", children: _jsx("button", { type: "button", className: "pisti-link", onClick: () => setRequest(null), children: "Use a different email" }) })] }));
282
+ return (_jsx(Card, { title: "Create your account", subtitle: `Welcome! Fill in the details to get started with ${environment.applicationName}.`, footer: signIn, className: className, children: _jsxs("form", { className: "pisti-form", onSubmit: (event) => {
283
+ event.preventDefault();
284
+ const data = new FormData(event.currentTarget);
285
+ const email = String(data.get("email")).trim();
286
+ setDetails({
287
+ firstName: String(data.get("firstName") ?? "").trim(),
288
+ lastName: String(data.get("lastName") ?? "").trim(),
289
+ password: String(data.get("password") ?? ""),
290
+ });
291
+ void run(async () => {
292
+ const sent = await client.signUp.sendEmailCode(email);
293
+ setRequest({ requestId: sent.requestId, email });
294
+ });
295
+ }, children: [_jsxs("fieldset", { disabled: pending, children: [_jsxs("div", { className: "pisti-pair", children: [_jsx(Field, { label: "First name", name: "firstName", autoComplete: "given-name", maxLength: 100, defaultValue: details.firstName }), _jsx(Field, { label: "Last name", name: "lastName", autoComplete: "family-name", maxLength: 100, defaultValue: details.lastName })] }), _jsx(Field, { label: "Email address", name: "email", type: "email", autoComplete: "email", required: true, autoFocus: true }), environment.signUp.password && (_jsx(Field, { label: "Password", name: "password", type: "password", autoComplete: "new-password", minLength: 15, maxLength: 128, required: true, hint: "At least 15 characters." }))] }), _jsx(Problem, { error: error }), _jsx("button", { type: "submit", disabled: pending, children: pending ? "Sending code…" : "Continue" })] }) }));
296
+ }
297
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkC,MAAM,OAAO,CAAC;AAC/G,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAiB/C,6FAA6F;AAC7F,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAoBjD,SAAS,OAAO,CAAC,KAAc;IAC3B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,kCAAkC,CAAC;AACvF,CAAC;AAED,SAAS,cAAc;IACnB,MAAM,MAAM,GAAG,QAAQ,EAAE,CAAC;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACnE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACxD,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,MAAM,CAAC,eAAe,EAAE,CAAC,IAAI,CACzB,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,IAAI,cAAc,CAAC,KAAK,CAAC,EAC1C,C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AC,IAAI,EAAC,UAAU,EAAC,IAAI,EAAC,UAAU,EAAC,YAAY,EAAC,cAAc,EAAC,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,QAAC,IAAI,EAAC,yBAAyB,GAAG,CAChK,IACM,EACX,KAAC,OAAO,IAAC,KAAK,EAAE,KAAK,GAAI,EACzB,iBAAQ,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,OAAO,YAClC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,GAClC,IACN,GACJ,CACV,CAAC;AACN,CAAC"}
@@ -0,0 +1,152 @@
1
+ import { AccountResource, OrganizationResource, type SecurityProof } from "./resources.js";
2
+ import type { RedirectOptions, AuthSnapshot, EnvironmentConfig, GetTokenOptions, PermissionCheck, PistiClientOptions, PistiModal, PistiNavigationOptions, SecondFactorDetails, SignInResult, SignUpInput } from "./types.js";
3
+ export type { Profile, AccountSession, SecurityState, SecurityProof, VerificationRequest, AuthenticatorEnrollment, Organization, OrganizationInput, OrganizationMember, OrganizationInvitation, OrganizationRole, } from "./resources.js";
4
+ export declare class PistiClientError extends Error {
5
+ readonly status: number;
6
+ readonly code?: string | undefined;
7
+ constructor(message: string, status?: number, code?: string | undefined);
8
+ }
9
+ /** Parses `pk_test_…`/`pk_live_…`: base64url of the Frontend API URL followed by `$`. */
10
+ export declare function parsePublishableKey(key: string | undefined): {
11
+ frontendApi: URL;
12
+ frontendApiId: string;
13
+ issuer: URL;
14
+ development: boolean;
15
+ };
16
+ /**
17
+ * Talks to the environment's Frontend API from the browser: sign-in and sign-up
18
+ * steps, the signed-in session, and short-lived session tokens. Keeps the
19
+ * `__session` cookie fresh so same-site backends can read it.
20
+ */
21
+ export declare class PistiClient {
22
+ readonly publishableKey: string;
23
+ readonly frontendApi: URL;
24
+ readonly issuer: URL;
25
+ readonly development: boolean;
26
+ readonly account: AccountResource;
27
+ readonly organizations: OrganizationResource;
28
+ private snapshot;
29
+ private environmentConfig;
30
+ private environmentRequest;
31
+ private readonly listeners;
32
+ private token;
33
+ private renewing;
34
+ private loading;
35
+ private timer;
36
+ private channel;
37
+ private readonly storageKey;
38
+ private readonly frontendApiId;
39
+ private navigation;
40
+ private modal;
41
+ private modalOptions;
42
+ private readonly modalListeners;
43
+ private readonly reverificationListeners;
44
+ private reverification;
45
+ constructor(options?: PistiClientOptions);
46
+ /** Updates redirect URLs and router functions without recreating the client. */
47
+ configure(navigation: PistiNavigationOptions): void;
48
+ readonly subscribe: (listener: () => void) => (() => void);
49
+ readonly getSnapshot: () => AuthSnapshot;
50
+ readonly getServerSnapshot: () => AuthSnapshot;
51
+ get environment(): EnvironmentConfig | null;
52
+ start(): () => void;
53
+ /** Re-reads the browser's session from Pisti. */
54
+ readonly load: () => Promise<void>;
55
+ readonly loadEnvironment: () => Promise<EnvironmentConfig>;
56
+ readonly signIn: {
57
+ password: (identifier: string, password: string) => Promise<SignInResult>;
58
+ sendEmailCode: (identifier: string) => Promise<{
59
+ requestId: string;
60
+ }>;
61
+ verifyEmailCode: (requestId: string, code: string) => Promise<SignInResult>;
62
+ secondFactorDetails: (attemptId: string) => Promise<SecondFactorDetails>;
63
+ completeSecondFactor: (attemptId: string, code: string, emailCode?: string) => Promise<SignInResult>;
64
+ };
65
+ readonly signUp: {
66
+ sendEmailCode: (email: string) => Promise<{
67
+ requestId: string;
68
+ }>;
69
+ verify: (input: SignUpInput) => Promise<SignInResult>;
70
+ };
71
+ readonly passwordReset: {
72
+ sendEmailCode: (identifier: string) => Promise<{
73
+ requestId: string;
74
+ resendAvailableAt: string;
75
+ }>;
76
+ complete: (input: {
77
+ requestId: string;
78
+ code: string;
79
+ password: string;
80
+ authenticatorCode?: string;
81
+ }) => Promise<void>;
82
+ };
83
+ /** Restores a self-deactivated account during its 30-day grace period. The user then signs in again. */
84
+ readonly reactivation: {
85
+ sendEmailCode: (identifier: string) => Promise<{
86
+ requestId: string;
87
+ resendAvailableAt: string;
88
+ }>;
89
+ complete: (input: {
90
+ requestId: string;
91
+ code: string;
92
+ authenticatorCode?: string;
93
+ }) => Promise<void>;
94
+ };
95
+ readonly signOut: () => Promise<void>;
96
+ readonly setActiveOrganization: (organizationId: string | null) => Promise<void>;
97
+ /** A fresh session token for your backend, or null when signed out. Tokens last about a minute. */
98
+ readonly getToken: (options?: GetTokenOptions) => Promise<string | null>;
99
+ readonly has: (check: PermissionCheck) => boolean;
100
+ /** `fetch` with the session token attached as a bearer credential. */
101
+ readonly authenticatedFetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
102
+ get signInUrl(): string | null;
103
+ get signUpUrl(): string | null;
104
+ /** Goes to your sign-in page (remembering the current page), or opens sign-in in a modal when you have none. */
105
+ readonly redirectToSignIn: () => void;
106
+ readonly redirectToSignUp: () => void;
107
+ /** Force redirect, then `redirect_url`, then the fallback, then the console setting, then "/". */
108
+ readonly redirectAfterSignIn: (options?: RedirectOptions) => void;
109
+ readonly redirectAfterSignUp: (options?: RedirectOptions) => void;
110
+ readonly redirectAfterSignOut: () => void;
111
+ /** Navigates with your router when you passed routerPush, otherwise with a normal page load. */
112
+ readonly navigate: (to: string, replace?: boolean) => void;
113
+ readonly subscribeModal: (listener: () => void) => (() => void);
114
+ readonly getModal: () => PistiModal;
115
+ readonly getServerModal: () => PistiModal;
116
+ /** Redirect options the open modal was given, for example by a sign-in button. */
117
+ readonly getModalOptions: () => RedirectOptions;
118
+ readonly openSignIn: (options?: RedirectOptions) => void;
119
+ readonly openSignUp: (options?: RedirectOptions) => void;
120
+ readonly openUserProfile: () => void;
121
+ readonly closeModal: () => void;
122
+ readonly subscribeReverification: (listener: () => void) => (() => void);
123
+ readonly getReverificationSnapshot: () => boolean;
124
+ readonly getServerReverificationSnapshot: () => boolean;
125
+ readonly requestReverification: () => Promise<void>;
126
+ readonly completeReverification: (proof: SecurityProof) => Promise<void>;
127
+ readonly cancelReverification: () => void;
128
+ /** Signs out so the user can sign in again, for example to prove who they are. */
129
+ readonly reauthenticate: () => Promise<void>;
130
+ readonly withReverification: <T>(operation: () => Promise<T>) => Promise<T>;
131
+ private complete;
132
+ private apply;
133
+ private applyClaims;
134
+ /**
135
+ * Writes `__session` and `__client_uat` (the session's sign-in time, or 0 when signed out) on the
136
+ * app's origin. Backend SDKs use `__client_uat` to tell an expired cookie that needs a handshake
137
+ * from a visitor who is simply signed out.
138
+ */
139
+ private writeCookie;
140
+ private setSnapshot;
141
+ private setModal;
142
+ /** Adds the current page as `redirect_url`, so sign-in returns here. */
143
+ private withReturn;
144
+ /** A same-origin `redirect_url` from the address bar, if any. Other origins are ignored to avoid open redirects. */
145
+ private returnUrl;
146
+ private requireSession;
147
+ private requireIdentity;
148
+ private fapi;
149
+ private resource;
150
+ private error;
151
+ }
152
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,oBAAoB,EACpB,KAAK,aAAa,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACR,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EAEtB,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACd,MAAM,YAAY,CAAC;AAEpB,YAAY,EACR,OAAO,EACP,cAAc,EACd,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,GACnB,MAAM,gBAAgB,CAAC;AAExB,qBAAa,gBAAiB,SAAQ,KAAK;IAGnC,QAAQ,CAAC,MAAM;IACf,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;IAH1B,YACI,OAAO,EAAE,MAAM,EACN,MAAM,SAAI,EACV,IAAI,CAAC,EAAE,MAAM,YAAA,EAIzB;CACJ;AA4ED,yFAAyF;AAC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