@outseta/react 0.4.24 → 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 +130 -1
- package/src/generated/public/public.ts +80 -0
- package/src/generated/template/template.ts +251 -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,
|
|
@@ -3658,6 +3659,62 @@ export const ActivityType = {
|
|
|
3658
3659
|
DiscordUserRemovedFromServer: 503,
|
|
3659
3660
|
} as const;
|
|
3660
3661
|
|
|
3662
|
+
/**
|
|
3663
|
+
* @nullable
|
|
3664
|
+
*/
|
|
3665
|
+
export type TemplateEmailInstanceAllOfTemplate = Template | null;
|
|
3666
|
+
|
|
3667
|
+
/**
|
|
3668
|
+
* @nullable
|
|
3669
|
+
*/
|
|
3670
|
+
export type TemplateEmailInstanceAllOfRecipient = Person | null;
|
|
3671
|
+
|
|
3672
|
+
export type TemplateEmailInstanceAllOf = {
|
|
3673
|
+
/** @nullable */
|
|
3674
|
+
Template?: TemplateEmailInstanceAllOfTemplate;
|
|
3675
|
+
/** @nullable */
|
|
3676
|
+
Recipient?: TemplateEmailInstanceAllOfRecipient;
|
|
3677
|
+
/**
|
|
3678
|
+
* @maxLength 50
|
|
3679
|
+
* @nullable
|
|
3680
|
+
*/
|
|
3681
|
+
UniqueMessageId?: string | null;
|
|
3682
|
+
/**
|
|
3683
|
+
* @maxLength 1000
|
|
3684
|
+
* @nullable
|
|
3685
|
+
*/
|
|
3686
|
+
Subject?: string | null;
|
|
3687
|
+
/**
|
|
3688
|
+
* @maxLength 250
|
|
3689
|
+
* @nullable
|
|
3690
|
+
*/
|
|
3691
|
+
FromEmail?: string | null;
|
|
3692
|
+
/**
|
|
3693
|
+
* @maxLength 250
|
|
3694
|
+
* @nullable
|
|
3695
|
+
*/
|
|
3696
|
+
FromName?: string | null;
|
|
3697
|
+
SendDateTime?: string;
|
|
3698
|
+
/** @nullable */
|
|
3699
|
+
ProcessDateTime?: string | null;
|
|
3700
|
+
/** @nullable */
|
|
3701
|
+
DeliverDateTime?: string | null;
|
|
3702
|
+
/** @nullable */
|
|
3703
|
+
BounceDateTime?: string | null;
|
|
3704
|
+
/** @nullable */
|
|
3705
|
+
SpamDateTime?: string | null;
|
|
3706
|
+
/** @nullable */
|
|
3707
|
+
OpenDateTime?: string | null;
|
|
3708
|
+
/** @nullable */
|
|
3709
|
+
ClickDateTime?: string | null;
|
|
3710
|
+
/** @nullable */
|
|
3711
|
+
UnsubscribeDateTime?: string | null;
|
|
3712
|
+
/** @nullable */
|
|
3713
|
+
SendError?: string | null;
|
|
3714
|
+
};
|
|
3715
|
+
|
|
3716
|
+
export type TemplateEmailInstance = AbstractQcountBean & TemplateEmailInstanceAllOf;
|
|
3717
|
+
|
|
3661
3718
|
export type TemplateAllOf = {
|
|
3662
3719
|
/**
|
|
3663
3720
|
* @minLength 1
|
|
@@ -3694,6 +3751,29 @@ export type TemplateAllOf = {
|
|
|
3694
3751
|
|
|
3695
3752
|
export type Template = AbstractQcountBean & TemplateAllOf;
|
|
3696
3753
|
|
|
3754
|
+
export interface SendTemplateEmailRequest {
|
|
3755
|
+
/**
|
|
3756
|
+
* The Uid of the person to send the email to. Required.
|
|
3757
|
+
* @nullable
|
|
3758
|
+
*/
|
|
3759
|
+
PersonUid?: string | null;
|
|
3760
|
+
/**
|
|
3761
|
+
* The from address. Defaults to the support email address for the account.
|
|
3762
|
+
* @nullable
|
|
3763
|
+
*/
|
|
3764
|
+
FromEmail?: string | null;
|
|
3765
|
+
/**
|
|
3766
|
+
* The from name. Defaults to the company name.
|
|
3767
|
+
* @nullable
|
|
3768
|
+
*/
|
|
3769
|
+
FromName?: string | null;
|
|
3770
|
+
/**
|
|
3771
|
+
* Overrides the subject of the template.
|
|
3772
|
+
* @nullable
|
|
3773
|
+
*/
|
|
3774
|
+
Subject?: string | null;
|
|
3775
|
+
}
|
|
3776
|
+
|
|
3697
3777
|
export type SendGridDomainAuthenticationAllOf = {
|
|
3698
3778
|
/**
|
|
3699
3779
|
* @minLength 1
|
|
@@ -9055,6 +9135,13 @@ export type AuthGetTokenParams = {
|
|
|
9055
9135
|
data: unknown | null;
|
|
9056
9136
|
};
|
|
9057
9137
|
|
|
9138
|
+
export type AuthMagicLinkTokenParams = {
|
|
9139
|
+
/**
|
|
9140
|
+
* @nullable
|
|
9141
|
+
*/
|
|
9142
|
+
data: unknown | null;
|
|
9143
|
+
};
|
|
9144
|
+
|
|
9058
9145
|
export type AuthResendTwoFactorParams = {
|
|
9059
9146
|
/**
|
|
9060
9147
|
* @nullable
|
|
@@ -9185,6 +9272,43 @@ export type CategoryGetAllCategories200 = {
|
|
|
9185
9272
|
items?: Category[];
|
|
9186
9273
|
};
|
|
9187
9274
|
|
|
9275
|
+
export type TemplateGetAllTemplateEmailsParams = {
|
|
9276
|
+
/**
|
|
9277
|
+
* Requested page size. The server caps it at 100, or 25 when requested fields expand child objects or require additional queries; metadata.limit reports the applied value. Use offset=1 for the second page.
|
|
9278
|
+
*/
|
|
9279
|
+
limit?: LimitParameter;
|
|
9280
|
+
/**
|
|
9281
|
+
* Zero-based page number, not a record offset. With limit=50, the second page is offset=1; offset=50 is page index 50 (records 2501-2550).
|
|
9282
|
+
*/
|
|
9283
|
+
offset?: OffsetParameter;
|
|
9284
|
+
};
|
|
9285
|
+
|
|
9286
|
+
export type TemplateGetAllTemplateEmails200 = {
|
|
9287
|
+
metadata?: CollectionMetadata;
|
|
9288
|
+
items?: TemplateEmailInstance[];
|
|
9289
|
+
};
|
|
9290
|
+
|
|
9291
|
+
export type TemplateGetTemplateEmailsParams = {
|
|
9292
|
+
/**
|
|
9293
|
+
* Requested page size. The server caps it at 100, or 25 when requested fields expand child objects or require additional queries; metadata.limit reports the applied value. Use offset=1 for the second page.
|
|
9294
|
+
*/
|
|
9295
|
+
limit?: LimitParameter;
|
|
9296
|
+
/**
|
|
9297
|
+
* Zero-based page number, not a record offset. With limit=50, the second page is offset=1; offset=50 is page index 50 (records 2501-2550).
|
|
9298
|
+
*/
|
|
9299
|
+
offset?: OffsetParameter;
|
|
9300
|
+
};
|
|
9301
|
+
|
|
9302
|
+
export type TemplateGetTemplateEmails200 = {
|
|
9303
|
+
metadata?: CollectionMetadata;
|
|
9304
|
+
items?: TemplateEmailInstance[];
|
|
9305
|
+
};
|
|
9306
|
+
|
|
9307
|
+
/**
|
|
9308
|
+
* @nullable
|
|
9309
|
+
*/
|
|
9310
|
+
export type TemplateSendTemplateEmailBody = SendTemplateEmailRequest | null;
|
|
9311
|
+
|
|
9188
9312
|
export type DripCampaignGetAllDripCampaignsParams = {
|
|
9189
9313
|
/**
|
|
9190
9314
|
* Requested page size. The server caps it at 100, or 25 when requested fields expand child objects or require additional queries; metadata.limit reports the applied value. Use offset=1 for the second page.
|
|
@@ -9446,6 +9570,11 @@ export type PersonSetTemporaryPasswordBody = TemporaryPasswordModel | null;
|
|
|
9446
9570
|
*/
|
|
9447
9571
|
export type PersonForgotPasswordBody = Person | null;
|
|
9448
9572
|
|
|
9573
|
+
/**
|
|
9574
|
+
* @nullable
|
|
9575
|
+
*/
|
|
9576
|
+
export type PersonRequestMagicLinkBody = Person | null;
|
|
9577
|
+
|
|
9449
9578
|
export type DiscountCouponGetDiscountCouponByCodeParams = {
|
|
9450
9579
|
/**
|
|
9451
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
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import {
|
|
3
|
+
useMutation,
|
|
4
|
+
useQuery
|
|
5
|
+
} from '../../query';
|
|
6
|
+
import type {
|
|
7
|
+
MutationFunction,
|
|
8
|
+
QueryFunction,
|
|
9
|
+
QueryKey,
|
|
10
|
+
UseMutationOptions,
|
|
11
|
+
UseMutationResult,
|
|
12
|
+
UseQueryOptions,
|
|
13
|
+
UseQueryResult
|
|
14
|
+
} from '../../query';
|
|
15
|
+
|
|
16
|
+
import type {
|
|
17
|
+
TemplateEmailInstance,
|
|
18
|
+
TemplateGetAllTemplateEmails200,
|
|
19
|
+
TemplateGetAllTemplateEmailsParams,
|
|
20
|
+
TemplateGetTemplateEmails200,
|
|
21
|
+
TemplateGetTemplateEmailsParams,
|
|
22
|
+
TemplateSendTemplateEmailBody
|
|
23
|
+
} from '../outsetaAPI.schemas';
|
|
24
|
+
|
|
25
|
+
import { customFetch } from '../../mutator';
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Filter with personUid to see what one person was sent, or with templateUid to
|
|
34
|
+
restrict the results to a single template.
|
|
35
|
+
* @summary The one-off emails that were sent from any email template.
|
|
36
|
+
*/
|
|
37
|
+
export const templateGetAllTemplateEmails = (
|
|
38
|
+
params?: TemplateGetAllTemplateEmailsParams,
|
|
39
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
40
|
+
) => {
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
return customFetch<TemplateGetAllTemplateEmails200>(
|
|
44
|
+
{url: `/api/v1/templates/emails`, method: 'GET',
|
|
45
|
+
params, signal
|
|
46
|
+
},
|
|
47
|
+
options);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
export const getTemplateGetAllTemplateEmailsQueryKey = (params?: TemplateGetAllTemplateEmailsParams,) => {
|
|
54
|
+
return [
|
|
55
|
+
`/api/v1/templates/emails`, ...(params ? [params]: [])
|
|
56
|
+
] as const;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
export const getTemplateGetAllTemplateEmailsQueryOptions = <TData = Awaited<ReturnType<typeof templateGetAllTemplateEmails>>, TError = void>(params?: TemplateGetAllTemplateEmailsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof templateGetAllTemplateEmails>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
61
|
+
) => {
|
|
62
|
+
|
|
63
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
64
|
+
|
|
65
|
+
const queryKey = queryOptions?.queryKey ?? getTemplateGetAllTemplateEmailsQueryKey(params);
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof templateGetAllTemplateEmails>>> = ({ signal }) => templateGetAllTemplateEmails(params, requestOptions, signal);
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof templateGetAllTemplateEmails>>, TError, TData> & { queryKey: QueryKey }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type TemplateGetAllTemplateEmailsQueryResult = NonNullable<Awaited<ReturnType<typeof templateGetAllTemplateEmails>>>
|
|
79
|
+
export type TemplateGetAllTemplateEmailsQueryError = void
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @summary The one-off emails that were sent from any email template.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
export function useTemplateGetAllTemplateEmails<TData = Awaited<ReturnType<typeof templateGetAllTemplateEmails>>, TError = void>(
|
|
87
|
+
params?: TemplateGetAllTemplateEmailsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof templateGetAllTemplateEmails>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
88
|
+
|
|
89
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
90
|
+
|
|
91
|
+
const queryOptions = getTemplateGetAllTemplateEmailsQueryOptions(params,options)
|
|
92
|
+
|
|
93
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
94
|
+
|
|
95
|
+
query.queryKey = queryOptions.queryKey ;
|
|
96
|
+
|
|
97
|
+
return query;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Add personUid to the query string to see what one person was sent from this
|
|
105
|
+
template.
|
|
106
|
+
* @summary The one-off emails that were sent from this email template.
|
|
107
|
+
*/
|
|
108
|
+
export const templateGetTemplateEmails = (
|
|
109
|
+
templateUid: string | null,
|
|
110
|
+
params?: TemplateGetTemplateEmailsParams,
|
|
111
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
112
|
+
) => {
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
return customFetch<TemplateGetTemplateEmails200>(
|
|
116
|
+
{url: `/api/v1/templates/${templateUid}/emails`, method: 'GET',
|
|
117
|
+
params, signal
|
|
118
|
+
},
|
|
119
|
+
options);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
export const getTemplateGetTemplateEmailsQueryKey = (templateUid?: string | null,
|
|
126
|
+
params?: TemplateGetTemplateEmailsParams,) => {
|
|
127
|
+
return [
|
|
128
|
+
`/api/v1/templates/${templateUid}/emails`, ...(params ? [params]: [])
|
|
129
|
+
] as const;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
export const getTemplateGetTemplateEmailsQueryOptions = <TData = Awaited<ReturnType<typeof templateGetTemplateEmails>>, TError = void>(templateUid: string | null,
|
|
134
|
+
params?: TemplateGetTemplateEmailsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof templateGetTemplateEmails>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
135
|
+
) => {
|
|
136
|
+
|
|
137
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
138
|
+
|
|
139
|
+
const queryKey = queryOptions?.queryKey ?? getTemplateGetTemplateEmailsQueryKey(templateUid,params);
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof templateGetTemplateEmails>>> = ({ signal }) => templateGetTemplateEmails(templateUid,params, requestOptions, signal);
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
return { queryKey, queryFn, enabled: !!(templateUid), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof templateGetTemplateEmails>>, TError, TData> & { queryKey: QueryKey }
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export type TemplateGetTemplateEmailsQueryResult = NonNullable<Awaited<ReturnType<typeof templateGetTemplateEmails>>>
|
|
153
|
+
export type TemplateGetTemplateEmailsQueryError = void
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @summary The one-off emails that were sent from this email template.
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
export function useTemplateGetTemplateEmails<TData = Awaited<ReturnType<typeof templateGetTemplateEmails>>, TError = void>(
|
|
161
|
+
templateUid: string | null,
|
|
162
|
+
params?: TemplateGetTemplateEmailsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof templateGetTemplateEmails>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
163
|
+
|
|
164
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
165
|
+
|
|
166
|
+
const queryOptions = getTemplateGetTemplateEmailsQueryOptions(templateUid,params,options)
|
|
167
|
+
|
|
168
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
169
|
+
|
|
170
|
+
query.queryKey = queryOptions.queryKey ;
|
|
171
|
+
|
|
172
|
+
return query;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* The email is merge-rendered for the person and sent immediately. No broadcast
|
|
180
|
+
is created. People who have bounced, unsubscribed or reported spam are not sent
|
|
181
|
+
the email. Only templates from Email > Email templates can be sent.
|
|
182
|
+
|
|
183
|
+
The response holds the record of the send. Read the open and click analytics
|
|
184
|
+
for it later from the emails endpoint for the template. The template and the
|
|
185
|
+
recipient are left out of the response unless they are asked for, for example
|
|
186
|
+
fields=*,Template.Uid,Recipient.Uid.
|
|
187
|
+
* @summary Send an email template to a single person as a one-off email.
|
|
188
|
+
*/
|
|
189
|
+
export const templateSendTemplateEmail = (
|
|
190
|
+
templateUid: string | null,
|
|
191
|
+
templateSendTemplateEmailBody: TemplateSendTemplateEmailBody,
|
|
192
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
193
|
+
) => {
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
return customFetch<TemplateEmailInstance>(
|
|
197
|
+
{url: `/api/v1/templates/${templateUid}/send`, method: 'POST',
|
|
198
|
+
headers: {'Content-Type': 'application/json', },
|
|
199
|
+
data: templateSendTemplateEmailBody, signal
|
|
200
|
+
},
|
|
201
|
+
options);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
export const getTemplateSendTemplateEmailMutationOptions = <TError = void,
|
|
207
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof templateSendTemplateEmail>>, TError,{templateUid: string | null;data: TemplateSendTemplateEmailBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
208
|
+
): UseMutationOptions<Awaited<ReturnType<typeof templateSendTemplateEmail>>, TError,{templateUid: string | null;data: TemplateSendTemplateEmailBody}, TContext> => {
|
|
209
|
+
|
|
210
|
+
const mutationKey = ['templateSendTemplateEmail'];
|
|
211
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
212
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
213
|
+
options
|
|
214
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
215
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof templateSendTemplateEmail>>, {templateUid: string | null;data: TemplateSendTemplateEmailBody}> = (props) => {
|
|
221
|
+
const {templateUid,data} = props ?? {};
|
|
222
|
+
|
|
223
|
+
return templateSendTemplateEmail(templateUid,data,requestOptions)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
return { mutationFn, ...mutationOptions }}
|
|
230
|
+
|
|
231
|
+
export type TemplateSendTemplateEmailMutationResult = NonNullable<Awaited<ReturnType<typeof templateSendTemplateEmail>>>
|
|
232
|
+
export type TemplateSendTemplateEmailMutationBody = TemplateSendTemplateEmailBody
|
|
233
|
+
export type TemplateSendTemplateEmailMutationError = void
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @summary Send an email template to a single person as a one-off email.
|
|
237
|
+
*/
|
|
238
|
+
export const useTemplateSendTemplateEmail = <TError = void,
|
|
239
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof templateSendTemplateEmail>>, TError,{templateUid: string | null;data: TemplateSendTemplateEmailBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
240
|
+
): UseMutationResult<
|
|
241
|
+
Awaited<ReturnType<typeof templateSendTemplateEmail>>,
|
|
242
|
+
TError,
|
|
243
|
+
{templateUid: string | null;data: TemplateSendTemplateEmailBody},
|
|
244
|
+
TContext
|
|
245
|
+
> => {
|
|
246
|
+
|
|
247
|
+
const mutationOptions = getTemplateSendTemplateEmailMutationOptions(options);
|
|
248
|
+
|
|
249
|
+
return useMutation(mutationOptions);
|
|
250
|
+
}
|
|
251
|
+
|