@outseta/react 0.4.25 → 0.4.26
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/index.js +565 -538
- package/package.json +2 -2
- package/src/generated/crm/crm.ts +70 -0
- package/src/generated/outsetaAPI.schemas.ts +14 -1
- package/src/generated/public/public.ts +80 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outseta/react",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.26",
|
|
4
4
|
"description": "React hooks and components for the Outseta API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@outseta/api-client": "0.3.
|
|
21
|
+
"@outseta/api-client": "0.3.32"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "^18.0.0 || ^19.0.0"
|
package/src/generated/crm/crm.ts
CHANGED
|
@@ -35,6 +35,7 @@ import type {
|
|
|
35
35
|
PersonForgotPasswordBody,
|
|
36
36
|
PersonGetAllPeople200,
|
|
37
37
|
PersonGetAllPeopleParams,
|
|
38
|
+
PersonRequestMagicLinkBody,
|
|
38
39
|
PersonSetTemporaryPasswordBody,
|
|
39
40
|
PersonUpdatePersonBody
|
|
40
41
|
} from '../outsetaAPI.schemas';
|
|
@@ -1795,4 +1796,73 @@ export const usePersonForgotPassword = <TError = void,
|
|
|
1795
1796
|
|
|
1796
1797
|
return useMutation(mutationOptions);
|
|
1797
1798
|
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Sends an email containing a single-use, time-limited link that signs
|
|
1801
|
+
the recipient in without a password. Always responds 200 regardless
|
|
1802
|
+
of whether the email matches a known user or whether the feature is
|
|
1803
|
+
enabled, so the endpoint cannot be used to enumerate accounts.
|
|
1804
|
+
* @summary Request a passwordless magic link to sign in.
|
|
1805
|
+
*/
|
|
1806
|
+
export const personRequestMagicLink = (
|
|
1807
|
+
personRequestMagicLinkBody: NonReadonly<PersonRequestMagicLinkBody>,
|
|
1808
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
1809
|
+
) => {
|
|
1810
|
+
|
|
1811
|
+
|
|
1812
|
+
return customFetch<Blob>(
|
|
1813
|
+
{url: `/api/v1/crm/people/requestMagicLink`, method: 'POST',
|
|
1814
|
+
headers: {'Content-Type': 'application/json', },
|
|
1815
|
+
data: personRequestMagicLinkBody,
|
|
1816
|
+
responseType: 'blob', signal
|
|
1817
|
+
},
|
|
1818
|
+
options);
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
|
|
1823
|
+
export const getPersonRequestMagicLinkMutationOptions = <TError = unknown,
|
|
1824
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof personRequestMagicLink>>, TError,{data: NonReadonly<PersonRequestMagicLinkBody>}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
1825
|
+
): UseMutationOptions<Awaited<ReturnType<typeof personRequestMagicLink>>, TError,{data: NonReadonly<PersonRequestMagicLinkBody>}, TContext> => {
|
|
1826
|
+
|
|
1827
|
+
const mutationKey = ['personRequestMagicLink'];
|
|
1828
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
1829
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
1830
|
+
options
|
|
1831
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
1832
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
1833
|
+
|
|
1834
|
+
|
|
1835
|
+
|
|
1836
|
+
|
|
1837
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof personRequestMagicLink>>, {data: NonReadonly<PersonRequestMagicLinkBody>}> = (props) => {
|
|
1838
|
+
const {data} = props ?? {};
|
|
1839
|
+
|
|
1840
|
+
return personRequestMagicLink(data,requestOptions)
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
|
|
1844
|
+
|
|
1845
|
+
|
|
1846
|
+
return { mutationFn, ...mutationOptions }}
|
|
1847
|
+
|
|
1848
|
+
export type PersonRequestMagicLinkMutationResult = NonNullable<Awaited<ReturnType<typeof personRequestMagicLink>>>
|
|
1849
|
+
export type PersonRequestMagicLinkMutationBody = NonReadonly<PersonRequestMagicLinkBody>
|
|
1850
|
+
export type PersonRequestMagicLinkMutationError = unknown
|
|
1851
|
+
|
|
1852
|
+
/**
|
|
1853
|
+
* @summary Request a passwordless magic link to sign in.
|
|
1854
|
+
*/
|
|
1855
|
+
export const usePersonRequestMagicLink = <TError = unknown,
|
|
1856
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof personRequestMagicLink>>, TError,{data: NonReadonly<PersonRequestMagicLinkBody>}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
1857
|
+
): UseMutationResult<
|
|
1858
|
+
Awaited<ReturnType<typeof personRequestMagicLink>>,
|
|
1859
|
+
TError,
|
|
1860
|
+
{data: NonReadonly<PersonRequestMagicLinkBody>},
|
|
1861
|
+
TContext
|
|
1862
|
+
> => {
|
|
1863
|
+
|
|
1864
|
+
const mutationOptions = getPersonRequestMagicLinkMutationOptions(options);
|
|
1865
|
+
|
|
1866
|
+
return useMutation(mutationOptions);
|
|
1867
|
+
}
|
|
1798
1868
|
|
|
@@ -3432,7 +3432,7 @@ export type QcountConfigAllOf = {
|
|
|
3432
3432
|
export type QcountConfig = AbstractQcountBean & QcountConfigAllOf;
|
|
3433
3433
|
|
|
3434
3434
|
/**
|
|
3435
|
-
* `100` - Slack, `102` - MagicLinkApiKey, `103` - MagicLinkApiKeySecret, `104` - OAuth_HideCreateAccountLink, `105` - Chat_IsOffline, `106` - HostedPageCustomCode, `107` - RegistrationConfirmationEmailDelaySeconds, `108` - AccountCancellationReasons, `110` - WebhookSignatureKey, `111` - HostedProfileBackLink, `112` - AccountCancellationReasonRequired, `114` - Email_OutsetaBrandingDisabled, `119` - Email_BlacklistedInboundEmails, `121` - PasswordPolicy, `123` - CRM_FieldSortingEnabled, `124` - CRM_RegistrationCallbackLocations, `125` - KnowledgeBaseVersion, `126` - Support_SpamThreshold, `127` - Email_RestrictedPhrases, `128` - KnowledgeBaseLanguage, `130` - Billing_System, `131` - Billing_RestrictSubscriptionActions, `140` - TwoFactorAuthenticationEnabled, `142` - ForceTwoFactorAuthentication, `190` - Stripe_TaxEnabled, `192` - Stripe_TaxIdTypes, `193` - Stripe_ApplePayMerchantIdDomainAssociation, `194` - Stripe_WebhookSecret, `195` - Stripe_OnlySyncOutsetaCustomers, `196` - Stripe_Checkout_RequireBillingAddress, `197` - Stripe_Checkout_RequireConsentTermsOfService, `200` - Webflow_AccessToken, `201` - Webflow_SyncEnabled, `202` - Webflow_SyncConfiguration, `203` - Webflow_ApiVersion, `550` - CopyQcount_AddOnMap, `551` - CopyQcount_AccountMap, `552` - CopyQcount_DiscountCouponMap, `553` - CopyQcount_InvoiceMap, `554` - CopyQcount_PersonMap, `555` - CopyQcount_PlanMap, `556` - CopyQcount_PlanFamilyMap, `557` - CopyQcount_SubscriptionMap, `558` - CopyQcount_TransactionMap, `570` - StripeMigration_LastAccountId, `571` - StripeMigration_LastInvoiceId, `572` - StripeMigration_LastExpiredSubscriptionId, `573` - StripeMigration_LastPostExportSubscriptionId, `574` - StripeMigration_LastUsageId, `575` - StripeMigration_SubscriptionExportDate, `576` - StripeMigration_SubscriptionExportIds, `577` - StripeMigration_SubscriptionAddOnExportIds, `578` - StripeMigration_SubscriptionCutoverDate, `579` - StripeMigration_LastPreCutoverExportSubscriptionId
|
|
3435
|
+
* `100` - Slack, `102` - MagicLinkApiKey, `103` - MagicLinkApiKeySecret, `104` - OAuth_HideCreateAccountLink, `105` - Chat_IsOffline, `106` - HostedPageCustomCode, `107` - RegistrationConfirmationEmailDelaySeconds, `108` - AccountCancellationReasons, `110` - WebhookSignatureKey, `111` - HostedProfileBackLink, `112` - AccountCancellationReasonRequired, `114` - Email_OutsetaBrandingDisabled, `119` - Email_BlacklistedInboundEmails, `121` - PasswordPolicy, `123` - CRM_FieldSortingEnabled, `124` - CRM_RegistrationCallbackLocations, `125` - KnowledgeBaseVersion, `126` - Support_SpamThreshold, `127` - Email_RestrictedPhrases, `128` - KnowledgeBaseLanguage, `130` - Billing_System, `131` - Billing_RestrictSubscriptionActions, `140` - TwoFactorAuthenticationEnabled, `142` - ForceTwoFactorAuthentication, `143` - MagicLinkLoginEnabled, `190` - Stripe_TaxEnabled, `192` - Stripe_TaxIdTypes, `193` - Stripe_ApplePayMerchantIdDomainAssociation, `194` - Stripe_WebhookSecret, `195` - Stripe_OnlySyncOutsetaCustomers, `196` - Stripe_Checkout_RequireBillingAddress, `197` - Stripe_Checkout_RequireConsentTermsOfService, `200` - Webflow_AccessToken, `201` - Webflow_SyncEnabled, `202` - Webflow_SyncConfiguration, `203` - Webflow_ApiVersion, `550` - CopyQcount_AddOnMap, `551` - CopyQcount_AccountMap, `552` - CopyQcount_DiscountCouponMap, `553` - CopyQcount_InvoiceMap, `554` - CopyQcount_PersonMap, `555` - CopyQcount_PlanMap, `556` - CopyQcount_PlanFamilyMap, `557` - CopyQcount_SubscriptionMap, `558` - CopyQcount_TransactionMap, `570` - StripeMigration_LastAccountId, `571` - StripeMigration_LastInvoiceId, `572` - StripeMigration_LastExpiredSubscriptionId, `573` - StripeMigration_LastPostExportSubscriptionId, `574` - StripeMigration_LastUsageId, `575` - StripeMigration_SubscriptionExportDate, `576` - StripeMigration_SubscriptionExportIds, `577` - StripeMigration_SubscriptionAddOnExportIds, `578` - StripeMigration_SubscriptionCutoverDate, `579` - StripeMigration_LastPreCutoverExportSubscriptionId
|
|
3436
3436
|
*/
|
|
3437
3437
|
export type QcountConfigSettingType = typeof QcountConfigSettingType[keyof typeof QcountConfigSettingType];
|
|
3438
3438
|
|
|
@@ -3463,6 +3463,7 @@ export const QcountConfigSettingType = {
|
|
|
3463
3463
|
Billing_RestrictSubscriptionActions: 131,
|
|
3464
3464
|
TwoFactorAuthenticationEnabled: 140,
|
|
3465
3465
|
ForceTwoFactorAuthentication: 142,
|
|
3466
|
+
MagicLinkLoginEnabled: 143,
|
|
3466
3467
|
Stripe_TaxEnabled: 190,
|
|
3467
3468
|
Stripe_TaxIdTypes: 192,
|
|
3468
3469
|
Stripe_ApplePayMerchantIdDomainAssociation: 193,
|
|
@@ -9134,6 +9135,13 @@ export type AuthGetTokenParams = {
|
|
|
9134
9135
|
data: unknown | null;
|
|
9135
9136
|
};
|
|
9136
9137
|
|
|
9138
|
+
export type AuthMagicLinkTokenParams = {
|
|
9139
|
+
/**
|
|
9140
|
+
* @nullable
|
|
9141
|
+
*/
|
|
9142
|
+
data: unknown | null;
|
|
9143
|
+
};
|
|
9144
|
+
|
|
9137
9145
|
export type AuthResendTwoFactorParams = {
|
|
9138
9146
|
/**
|
|
9139
9147
|
* @nullable
|
|
@@ -9562,6 +9570,11 @@ export type PersonSetTemporaryPasswordBody = TemporaryPasswordModel | null;
|
|
|
9562
9570
|
*/
|
|
9563
9571
|
export type PersonForgotPasswordBody = Person | null;
|
|
9564
9572
|
|
|
9573
|
+
/**
|
|
9574
|
+
* @nullable
|
|
9575
|
+
*/
|
|
9576
|
+
export type PersonRequestMagicLinkBody = Person | null;
|
|
9577
|
+
|
|
9565
9578
|
export type DiscountCouponGetDiscountCouponByCodeParams = {
|
|
9566
9579
|
/**
|
|
9567
9580
|
* The unique identifier of the plan to validate the coupon against
|
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
|
|
11
11
|
import type {
|
|
12
12
|
AuthGetTokenParams,
|
|
13
|
+
AuthMagicLinkTokenParams,
|
|
13
14
|
AuthResendTwoFactorParams,
|
|
14
15
|
AuthSwitchTwoFactorMechanismParams,
|
|
15
16
|
AuthVerifyTwoFactorRecoveryParams,
|
|
@@ -228,6 +229,85 @@ export const useAuthGetToken = <TError = string,
|
|
|
228
229
|
return useMutation(mutationOptions);
|
|
229
230
|
}
|
|
230
231
|
/**
|
|
232
|
+
* Call this with the magicToken carried by the link from a
|
|
233
|
+
"magic link" email (requested via POST /api/v1/crm/people/requestMagicLink):
|
|
234
|
+
|
|
235
|
+
{ "magic_token": "eyJ..." }
|
|
236
|
+
|
|
237
|
+
The link proves control of the email inbox, which satisfies the first
|
|
238
|
+
factor. The response then matches POST /api/v1/tokens:
|
|
239
|
+
|
|
240
|
+
- 200 with an access token when no further factor is required;
|
|
241
|
+
- 202 with a two_factor_required challenge when the user
|
|
242
|
+
has a non-email second factor (e.g. an authenticator app) that must
|
|
243
|
+
still be cleared via POST /api/v1/tokens/two-factor. Email is
|
|
244
|
+
never offered as that second factor — it was already the first.
|
|
245
|
+
|
|
246
|
+
An invalid, expired, already-used token (or a tenant without magic-link
|
|
247
|
+
login enabled) returns 400 (invalid_grant).
|
|
248
|
+
* @summary Exchange a magic-link token for an access token (passwordless login).
|
|
249
|
+
*/
|
|
250
|
+
export const authMagicLinkToken = (
|
|
251
|
+
params: AuthMagicLinkTokenParams,
|
|
252
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
253
|
+
) => {
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
return customFetch<TokenPayload | TwoFactorChallengePayload>(
|
|
257
|
+
{url: `/api/v1/tokens/magic-link`, method: 'POST',
|
|
258
|
+
params, signal
|
|
259
|
+
},
|
|
260
|
+
options);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
export const getAuthMagicLinkTokenMutationOptions = <TError = string,
|
|
266
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authMagicLinkToken>>, TError,{params: AuthMagicLinkTokenParams}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
267
|
+
): UseMutationOptions<Awaited<ReturnType<typeof authMagicLinkToken>>, TError,{params: AuthMagicLinkTokenParams}, TContext> => {
|
|
268
|
+
|
|
269
|
+
const mutationKey = ['authMagicLinkToken'];
|
|
270
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
271
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
272
|
+
options
|
|
273
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
274
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof authMagicLinkToken>>, {params: AuthMagicLinkTokenParams}> = (props) => {
|
|
280
|
+
const {params} = props ?? {};
|
|
281
|
+
|
|
282
|
+
return authMagicLinkToken(params,requestOptions)
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
return { mutationFn, ...mutationOptions }}
|
|
289
|
+
|
|
290
|
+
export type AuthMagicLinkTokenMutationResult = NonNullable<Awaited<ReturnType<typeof authMagicLinkToken>>>
|
|
291
|
+
|
|
292
|
+
export type AuthMagicLinkTokenMutationError = string
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* @summary Exchange a magic-link token for an access token (passwordless login).
|
|
296
|
+
*/
|
|
297
|
+
export const useAuthMagicLinkToken = <TError = string,
|
|
298
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authMagicLinkToken>>, TError,{params: AuthMagicLinkTokenParams}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
299
|
+
): UseMutationResult<
|
|
300
|
+
Awaited<ReturnType<typeof authMagicLinkToken>>,
|
|
301
|
+
TError,
|
|
302
|
+
{params: AuthMagicLinkTokenParams},
|
|
303
|
+
TContext
|
|
304
|
+
> => {
|
|
305
|
+
|
|
306
|
+
const mutationOptions = getAuthMagicLinkTokenMutationOptions(options);
|
|
307
|
+
|
|
308
|
+
return useMutation(mutationOptions);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
231
311
|
* Call this after `POST /api/v1/tokens` returns `two_factor_required`.
|
|
232
312
|
Post the challenge token from that response together with the user's
|
|
233
313
|
one-time code (the emailed code, or the current code from their
|