@outseta/react 0.3.2 → 0.3.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outseta/react",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "React hooks and components for the Outseta API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@tanstack/react-query": "^5.0.0",
22
- "@outseta/api-client": "0.3.2"
22
+ "@outseta/api-client": "0.3.4"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": "^18.0.0 || ^19.0.0"
@@ -2642,6 +2642,8 @@ export interface TokenPayload {
2642
2642
  /** @nullable */
2643
2643
  id_token?: string | null;
2644
2644
  /** @nullable */
2645
+ refresh_token?: string | null;
2646
+ /** @nullable */
2645
2647
  token_type?: string | null;
2646
2648
  }
2647
2649
 
@@ -2713,6 +2715,30 @@ as a fallback if they cannot produce a primary code.
2713
2715
  recovery_codes_available?: boolean | null;
2714
2716
  }
2715
2717
 
2718
+ /**
2719
+ * Request body for POST /api/v1/tokens/two-factor: the challenge token
2720
+ from the login response plus the user's one-time code. Property names are
2721
+ snake_case to match the wire format of the token endpoints.
2722
+
2723
+ The action binds the body as a loose JObject at runtime; this type
2724
+ exists so the API docs describe the body instead of an opaque data
2725
+ parameter (see [OpenApiRequestBody] on the action).
2726
+ */
2727
+ export interface TwoFactorVerifyRequest {
2728
+ /**
2729
+ * The challenge_token returned by POST /api/v1/tokens when
2730
+ two-factor authentication is required. Echo it back verbatim.
2731
+ * @nullable
2732
+ */
2733
+ challenge_token?: string | null;
2734
+ /**
2735
+ * The user's one-time code: the emailed code for an Email challenge,
2736
+ or the current code from their authenticator app for a Totp challenge.
2737
+ * @nullable
2738
+ */
2739
+ code?: string | null;
2740
+ }
2741
+
2716
2742
  export interface PasswordPayload {
2717
2743
  /** @nullable */
2718
2744
  Password?: string | null;
@@ -3593,6 +3619,8 @@ export type SendGridDomainAuthenticationAllOf = {
3593
3619
  LastValidationAttempt?: string | null;
3594
3620
  /** @nullable */
3595
3621
  DnsEntries?: DnsEntry[] | null;
3622
+ /** @nullable */
3623
+ LegacyDnsEntries?: DnsEntry[] | null;
3596
3624
  };
3597
3625
 
3598
3626
  export type SendGridDomainAuthentication = AbstractQcountBean & SendGridDomainAuthenticationAllOf;
@@ -5836,13 +5864,6 @@ export type AuthGetTokenParams = {
5836
5864
  data: unknown | null;
5837
5865
  };
5838
5866
 
5839
- export type AuthVerifyTwoFactorTokenParams = {
5840
- /**
5841
- * @nullable
5842
- */
5843
- data: unknown | null;
5844
- };
5845
-
5846
5867
  export type AuthResendTwoFactorParams = {
5847
5868
  /**
5848
5869
  * @nullable
@@ -13,7 +13,6 @@ import type {
13
13
  AuthResendTwoFactorParams,
14
14
  AuthSwitchTwoFactorMechanismParams,
15
15
  AuthVerifyTwoFactorRecoveryParams,
16
- AuthVerifyTwoFactorTokenParams,
17
16
  TokenPayload,
18
17
  TokenTwoFactorEnrollmentBeginEmailParams,
19
18
  TokenTwoFactorEnrollmentBeginTotpParams,
@@ -21,7 +20,8 @@ import type {
21
20
  TokenTwoFactorEnrollmentConfirmTotpParams,
22
21
  TwoFactorChallengePayload,
23
22
  TwoFactorEnrollmentConfirmationPayload,
24
- TwoFactorTotpEnrollmentPayload
23
+ TwoFactorTotpEnrollmentPayload,
24
+ TwoFactorVerifyRequest
25
25
  } from '../outsetaAPI.schemas';
26
26
 
27
27
  import { customFetch } from '../../mutator';
@@ -36,9 +36,9 @@ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
36
36
 
37
37
  { "username": "user@example.com", "password": "their-password" }
38
38
 
39
- On success the response is `200` with an access token:
39
+ On success the response is `200` with an access token and refresh token:
40
40
 
41
- { "access_token": "eyJ...", "token_type": "Bearer", "expires_in": 31536000 }
41
+ { "access_token": "eyJ...", "refresh_token": "...", "token_type": "Bearer", "expires_in": 31536000 }
42
42
 
43
43
  **Two-factor authentication.** If the user has a verified 2FA method,
44
44
  the password alone is not enough. After verifying the password this
@@ -140,23 +140,24 @@ authenticator app):
140
140
  On success the response is `200` with the final access token, in the
141
141
  same shape as `POST /api/v1/tokens`:
142
142
 
143
- { "access_token": "eyJ...", "token_type": "Bearer", "expires_in": 31536000 }
143
+ { "access_token": "eyJ...", "refresh_token": "...", "token_type": "Bearer", "expires_in": 31536000 }
144
144
 
145
145
  An incorrect code returns `400` (`invalid_grant`). A code has at most
146
146
  five attempts before the challenge locks. An expired challenge returns
147
147
  `410` (`challenge_expired`) — restart at `POST /api/v1/tokens`. The
148
148
  endpoint is rate limited to 10 requests per minute (`429`).
149
- * @summary Complete a two-factor login challenge and obtain a JWT access token.
149
+ * @summary Complete login when user has two-factor authentication enabled.
150
150
  */
151
151
  export const authVerifyTwoFactorToken = (
152
- params: AuthVerifyTwoFactorTokenParams,
152
+ twoFactorVerifyRequest: TwoFactorVerifyRequest,
153
153
  options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
154
154
  ) => {
155
155
 
156
156
 
157
157
  return customFetch<TokenPayload>(
158
158
  {url: `/api/v1/tokens/two-factor`, method: 'POST',
159
- params, signal
159
+ headers: {'Content-Type': 'application/json', },
160
+ data: twoFactorVerifyRequest, signal
160
161
  },
161
162
  options);
162
163
  }
@@ -164,8 +165,8 @@ export const authVerifyTwoFactorToken = (
164
165
 
165
166
 
166
167
  export const getAuthVerifyTwoFactorTokenMutationOptions = <TError = string,
167
- TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authVerifyTwoFactorToken>>, TError,{params: AuthVerifyTwoFactorTokenParams}, TContext>, request?: SecondParameter<typeof customFetch>}
168
- ): UseMutationOptions<Awaited<ReturnType<typeof authVerifyTwoFactorToken>>, TError,{params: AuthVerifyTwoFactorTokenParams}, TContext> => {
168
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authVerifyTwoFactorToken>>, TError,{data: TwoFactorVerifyRequest}, TContext>, request?: SecondParameter<typeof customFetch>}
169
+ ): UseMutationOptions<Awaited<ReturnType<typeof authVerifyTwoFactorToken>>, TError,{data: TwoFactorVerifyRequest}, TContext> => {
169
170
 
170
171
  const mutationKey = ['authVerifyTwoFactorToken'];
171
172
  const {mutation: mutationOptions, request: requestOptions} = options ?
@@ -177,10 +178,10 @@ const {mutation: mutationOptions, request: requestOptions} = options ?
177
178
 
178
179
 
179
180
 
180
- const mutationFn: MutationFunction<Awaited<ReturnType<typeof authVerifyTwoFactorToken>>, {params: AuthVerifyTwoFactorTokenParams}> = (props) => {
181
- const {params} = props ?? {};
181
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof authVerifyTwoFactorToken>>, {data: TwoFactorVerifyRequest}> = (props) => {
182
+ const {data} = props ?? {};
182
183
 
183
- return authVerifyTwoFactorToken(params,requestOptions)
184
+ return authVerifyTwoFactorToken(data,requestOptions)
184
185
  }
185
186
 
186
187
 
@@ -189,18 +190,18 @@ const {mutation: mutationOptions, request: requestOptions} = options ?
189
190
  return { mutationFn, ...mutationOptions }}
190
191
 
191
192
  export type AuthVerifyTwoFactorTokenMutationResult = NonNullable<Awaited<ReturnType<typeof authVerifyTwoFactorToken>>>
192
-
193
+ export type AuthVerifyTwoFactorTokenMutationBody = TwoFactorVerifyRequest
193
194
  export type AuthVerifyTwoFactorTokenMutationError = string
194
195
 
195
196
  /**
196
- * @summary Complete a two-factor login challenge and obtain a JWT access token.
197
+ * @summary Complete login when user has two-factor authentication enabled.
197
198
  */
198
199
  export const useAuthVerifyTwoFactorToken = <TError = string,
199
- TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authVerifyTwoFactorToken>>, TError,{params: AuthVerifyTwoFactorTokenParams}, TContext>, request?: SecondParameter<typeof customFetch>}
200
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authVerifyTwoFactorToken>>, TError,{data: TwoFactorVerifyRequest}, TContext>, request?: SecondParameter<typeof customFetch>}
200
201
  ): UseMutationResult<
201
202
  Awaited<ReturnType<typeof authVerifyTwoFactorToken>>,
202
203
  TError,
203
- {params: AuthVerifyTwoFactorTokenParams},
204
+ {data: TwoFactorVerifyRequest},
204
205
  TContext
205
206
  > => {
206
207
 
@@ -374,8 +375,7 @@ requests per minute (`429`).
374
375
 
375
376
  Used by the embed login widget; the hosted Razor flow has its own
376
377
  equivalent action on the AuthenticationController.
377
- * @summary Complete a two-factor login challenge with a recovery code instead of
378
- the primary one-time code, and obtain a JWT access token.
378
+ * @summary Complete login with a two-factor recovery code.
379
379
  */
380
380
  export const authVerifyTwoFactorRecovery = (
381
381
  params: AuthVerifyTwoFactorRecoveryParams,
@@ -422,8 +422,7 @@ const {mutation: mutationOptions, request: requestOptions} = options ?
422
422
  export type AuthVerifyTwoFactorRecoveryMutationError = string
423
423
 
424
424
  /**
425
- * @summary Complete a two-factor login challenge with a recovery code instead of
426
- the primary one-time code, and obtain a JWT access token.
425
+ * @summary Complete login with a two-factor recovery code.
427
426
  */
428
427
  export const useAuthVerifyTwoFactorRecovery = <TError = string,
429
428
  TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authVerifyTwoFactorRecovery>>, TError,{params: AuthVerifyTwoFactorRecoveryParams}, TContext>, request?: SecondParameter<typeof customFetch>}