@outseta/react 0.4.24 → 0.4.25
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.4.
|
|
3
|
+
"version": "0.4.25",
|
|
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.31"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "^18.0.0 || ^19.0.0"
|
|
@@ -3658,6 +3658,62 @@ export const ActivityType = {
|
|
|
3658
3658
|
DiscordUserRemovedFromServer: 503,
|
|
3659
3659
|
} as const;
|
|
3660
3660
|
|
|
3661
|
+
/**
|
|
3662
|
+
* @nullable
|
|
3663
|
+
*/
|
|
3664
|
+
export type TemplateEmailInstanceAllOfTemplate = Template | null;
|
|
3665
|
+
|
|
3666
|
+
/**
|
|
3667
|
+
* @nullable
|
|
3668
|
+
*/
|
|
3669
|
+
export type TemplateEmailInstanceAllOfRecipient = Person | null;
|
|
3670
|
+
|
|
3671
|
+
export type TemplateEmailInstanceAllOf = {
|
|
3672
|
+
/** @nullable */
|
|
3673
|
+
Template?: TemplateEmailInstanceAllOfTemplate;
|
|
3674
|
+
/** @nullable */
|
|
3675
|
+
Recipient?: TemplateEmailInstanceAllOfRecipient;
|
|
3676
|
+
/**
|
|
3677
|
+
* @maxLength 50
|
|
3678
|
+
* @nullable
|
|
3679
|
+
*/
|
|
3680
|
+
UniqueMessageId?: string | null;
|
|
3681
|
+
/**
|
|
3682
|
+
* @maxLength 1000
|
|
3683
|
+
* @nullable
|
|
3684
|
+
*/
|
|
3685
|
+
Subject?: string | null;
|
|
3686
|
+
/**
|
|
3687
|
+
* @maxLength 250
|
|
3688
|
+
* @nullable
|
|
3689
|
+
*/
|
|
3690
|
+
FromEmail?: string | null;
|
|
3691
|
+
/**
|
|
3692
|
+
* @maxLength 250
|
|
3693
|
+
* @nullable
|
|
3694
|
+
*/
|
|
3695
|
+
FromName?: string | null;
|
|
3696
|
+
SendDateTime?: string;
|
|
3697
|
+
/** @nullable */
|
|
3698
|
+
ProcessDateTime?: string | null;
|
|
3699
|
+
/** @nullable */
|
|
3700
|
+
DeliverDateTime?: string | null;
|
|
3701
|
+
/** @nullable */
|
|
3702
|
+
BounceDateTime?: string | null;
|
|
3703
|
+
/** @nullable */
|
|
3704
|
+
SpamDateTime?: string | null;
|
|
3705
|
+
/** @nullable */
|
|
3706
|
+
OpenDateTime?: string | null;
|
|
3707
|
+
/** @nullable */
|
|
3708
|
+
ClickDateTime?: string | null;
|
|
3709
|
+
/** @nullable */
|
|
3710
|
+
UnsubscribeDateTime?: string | null;
|
|
3711
|
+
/** @nullable */
|
|
3712
|
+
SendError?: string | null;
|
|
3713
|
+
};
|
|
3714
|
+
|
|
3715
|
+
export type TemplateEmailInstance = AbstractQcountBean & TemplateEmailInstanceAllOf;
|
|
3716
|
+
|
|
3661
3717
|
export type TemplateAllOf = {
|
|
3662
3718
|
/**
|
|
3663
3719
|
* @minLength 1
|
|
@@ -3694,6 +3750,29 @@ export type TemplateAllOf = {
|
|
|
3694
3750
|
|
|
3695
3751
|
export type Template = AbstractQcountBean & TemplateAllOf;
|
|
3696
3752
|
|
|
3753
|
+
export interface SendTemplateEmailRequest {
|
|
3754
|
+
/**
|
|
3755
|
+
* The Uid of the person to send the email to. Required.
|
|
3756
|
+
* @nullable
|
|
3757
|
+
*/
|
|
3758
|
+
PersonUid?: string | null;
|
|
3759
|
+
/**
|
|
3760
|
+
* The from address. Defaults to the support email address for the account.
|
|
3761
|
+
* @nullable
|
|
3762
|
+
*/
|
|
3763
|
+
FromEmail?: string | null;
|
|
3764
|
+
/**
|
|
3765
|
+
* The from name. Defaults to the company name.
|
|
3766
|
+
* @nullable
|
|
3767
|
+
*/
|
|
3768
|
+
FromName?: string | null;
|
|
3769
|
+
/**
|
|
3770
|
+
* Overrides the subject of the template.
|
|
3771
|
+
* @nullable
|
|
3772
|
+
*/
|
|
3773
|
+
Subject?: string | null;
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3697
3776
|
export type SendGridDomainAuthenticationAllOf = {
|
|
3698
3777
|
/**
|
|
3699
3778
|
* @minLength 1
|
|
@@ -9185,6 +9264,43 @@ export type CategoryGetAllCategories200 = {
|
|
|
9185
9264
|
items?: Category[];
|
|
9186
9265
|
};
|
|
9187
9266
|
|
|
9267
|
+
export type TemplateGetAllTemplateEmailsParams = {
|
|
9268
|
+
/**
|
|
9269
|
+
* 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.
|
|
9270
|
+
*/
|
|
9271
|
+
limit?: LimitParameter;
|
|
9272
|
+
/**
|
|
9273
|
+
* 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).
|
|
9274
|
+
*/
|
|
9275
|
+
offset?: OffsetParameter;
|
|
9276
|
+
};
|
|
9277
|
+
|
|
9278
|
+
export type TemplateGetAllTemplateEmails200 = {
|
|
9279
|
+
metadata?: CollectionMetadata;
|
|
9280
|
+
items?: TemplateEmailInstance[];
|
|
9281
|
+
};
|
|
9282
|
+
|
|
9283
|
+
export type TemplateGetTemplateEmailsParams = {
|
|
9284
|
+
/**
|
|
9285
|
+
* 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.
|
|
9286
|
+
*/
|
|
9287
|
+
limit?: LimitParameter;
|
|
9288
|
+
/**
|
|
9289
|
+
* 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).
|
|
9290
|
+
*/
|
|
9291
|
+
offset?: OffsetParameter;
|
|
9292
|
+
};
|
|
9293
|
+
|
|
9294
|
+
export type TemplateGetTemplateEmails200 = {
|
|
9295
|
+
metadata?: CollectionMetadata;
|
|
9296
|
+
items?: TemplateEmailInstance[];
|
|
9297
|
+
};
|
|
9298
|
+
|
|
9299
|
+
/**
|
|
9300
|
+
* @nullable
|
|
9301
|
+
*/
|
|
9302
|
+
export type TemplateSendTemplateEmailBody = SendTemplateEmailRequest | null;
|
|
9303
|
+
|
|
9188
9304
|
export type DripCampaignGetAllDripCampaignsParams = {
|
|
9189
9305
|
/**
|
|
9190
9306
|
* 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.
|
|
@@ -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
|
+
|