@outseta/react 0.4.18 → 0.4.20
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.20",
|
|
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.26"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "^18.0.0 || ^19.0.0"
|
|
@@ -1248,6 +1248,12 @@ export type StripePriceAllOf = {
|
|
|
1248
1248
|
* @nullable
|
|
1249
1249
|
*/
|
|
1250
1250
|
Currency?: string | null;
|
|
1251
|
+
/** @nullable */
|
|
1252
|
+
CustomUnitAmount_Maximum?: number | null;
|
|
1253
|
+
/** @nullable */
|
|
1254
|
+
CustomUnitAmount_Minimum?: number | null;
|
|
1255
|
+
/** @nullable */
|
|
1256
|
+
CustomUnitAmount_Preset?: number | null;
|
|
1251
1257
|
IsActive?: boolean;
|
|
1252
1258
|
/**
|
|
1253
1259
|
* @maxLength 250
|
|
@@ -1275,6 +1281,11 @@ export type StripePriceAllOf = {
|
|
|
1275
1281
|
* @nullable
|
|
1276
1282
|
*/
|
|
1277
1283
|
TaxBehavior?: string | null;
|
|
1284
|
+
/**
|
|
1285
|
+
* @maxLength 36
|
|
1286
|
+
* @nullable
|
|
1287
|
+
*/
|
|
1288
|
+
TiersMode?: string | null;
|
|
1278
1289
|
/** @nullable */
|
|
1279
1290
|
TransformQuantity_DivideBy?: number | null;
|
|
1280
1291
|
/**
|
|
@@ -8992,22 +9003,22 @@ export type DiscordUserRemovedFromServerWebhookPayloadAllOf = {
|
|
|
8992
9003
|
export type DiscordUserRemovedFromServerWebhookPayload = PersonWebhookEntity & DiscordUserRemovedFromServerWebhookPayloadAllOf;
|
|
8993
9004
|
|
|
8994
9005
|
/**
|
|
8995
|
-
*
|
|
9006
|
+
* 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.
|
|
8996
9007
|
*/
|
|
8997
9008
|
export type LimitParameter = number;
|
|
8998
9009
|
|
|
8999
9010
|
/**
|
|
9000
|
-
* Zero-based page index.
|
|
9011
|
+
* 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).
|
|
9001
9012
|
*/
|
|
9002
9013
|
export type OffsetParameter = number;
|
|
9003
9014
|
|
|
9004
9015
|
export type DefinitionGetAllDefinitionsParams = {
|
|
9005
9016
|
/**
|
|
9006
|
-
*
|
|
9017
|
+
* 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.
|
|
9007
9018
|
*/
|
|
9008
9019
|
limit?: LimitParameter;
|
|
9009
9020
|
/**
|
|
9010
|
-
* Zero-based page index.
|
|
9021
|
+
* 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).
|
|
9011
9022
|
*/
|
|
9012
9023
|
offset?: OffsetParameter;
|
|
9013
9024
|
};
|
|
@@ -9017,6 +9028,11 @@ export type DefinitionGetAllDefinitions200 = {
|
|
|
9017
9028
|
items?: Definition[];
|
|
9018
9029
|
};
|
|
9019
9030
|
|
|
9031
|
+
/**
|
|
9032
|
+
* @nullable
|
|
9033
|
+
*/
|
|
9034
|
+
export type PublicEmailListAddSubscriptionBody = EmailListPerson | null;
|
|
9035
|
+
|
|
9020
9036
|
export type AuthGetTokenParams = {
|
|
9021
9037
|
/**
|
|
9022
9038
|
* @nullable
|
|
@@ -9124,11 +9140,11 @@ export type ArticleAddArticleBody = Article | null;
|
|
|
9124
9140
|
|
|
9125
9141
|
export type CategoryGetAllCategoriesParams = {
|
|
9126
9142
|
/**
|
|
9127
|
-
*
|
|
9143
|
+
* 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.
|
|
9128
9144
|
*/
|
|
9129
9145
|
limit?: LimitParameter;
|
|
9130
9146
|
/**
|
|
9131
|
-
* Zero-based page index.
|
|
9147
|
+
* 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).
|
|
9132
9148
|
*/
|
|
9133
9149
|
offset?: OffsetParameter;
|
|
9134
9150
|
};
|
|
@@ -9140,11 +9156,11 @@ export type CategoryGetAllCategories200 = {
|
|
|
9140
9156
|
|
|
9141
9157
|
export type DripCampaignGetAllDripCampaignsParams = {
|
|
9142
9158
|
/**
|
|
9143
|
-
*
|
|
9159
|
+
* 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.
|
|
9144
9160
|
*/
|
|
9145
9161
|
limit?: LimitParameter;
|
|
9146
9162
|
/**
|
|
9147
|
-
* Zero-based page index.
|
|
9163
|
+
* 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).
|
|
9148
9164
|
*/
|
|
9149
9165
|
offset?: OffsetParameter;
|
|
9150
9166
|
};
|
|
@@ -9181,11 +9197,11 @@ export type DripCampaignSendTestCampaignEmailBody = SendTestEmailRequest | null;
|
|
|
9181
9197
|
|
|
9182
9198
|
export type CampaignGetAllBroadcastEmailsParams = {
|
|
9183
9199
|
/**
|
|
9184
|
-
*
|
|
9200
|
+
* 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.
|
|
9185
9201
|
*/
|
|
9186
9202
|
limit?: LimitParameter;
|
|
9187
9203
|
/**
|
|
9188
|
-
* Zero-based page index.
|
|
9204
|
+
* 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).
|
|
9189
9205
|
*/
|
|
9190
9206
|
offset?: OffsetParameter;
|
|
9191
9207
|
};
|
|
@@ -9406,11 +9422,11 @@ export type UsageAddUsageBody = Usage | null;
|
|
|
9406
9422
|
|
|
9407
9423
|
export type TransactionsGetAllTransactionsByAccountIdParams = {
|
|
9408
9424
|
/**
|
|
9409
|
-
*
|
|
9425
|
+
* 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.
|
|
9410
9426
|
*/
|
|
9411
9427
|
limit?: LimitParameter;
|
|
9412
9428
|
/**
|
|
9413
|
-
* Zero-based page index.
|
|
9429
|
+
* 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).
|
|
9414
9430
|
*/
|
|
9415
9431
|
offset?: OffsetParameter;
|
|
9416
9432
|
};
|
|
@@ -9460,11 +9476,11 @@ export type SubscriptionAddOnSetAddOnUpgradeRequiredBody = SubscriptionAddOn | n
|
|
|
9460
9476
|
|
|
9461
9477
|
export type InvoiceGetAllInvoicesParams = {
|
|
9462
9478
|
/**
|
|
9463
|
-
*
|
|
9479
|
+
* 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.
|
|
9464
9480
|
*/
|
|
9465
9481
|
limit?: LimitParameter;
|
|
9466
9482
|
/**
|
|
9467
|
-
* Zero-based page index.
|
|
9483
|
+
* 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).
|
|
9468
9484
|
*/
|
|
9469
9485
|
offset?: OffsetParameter;
|
|
9470
9486
|
/**
|
|
@@ -9557,11 +9573,11 @@ export type SubscriptionChangeSubscriptionBody = Subscription | null;
|
|
|
9557
9573
|
|
|
9558
9574
|
export type PlanGetAllPlansParams = {
|
|
9559
9575
|
/**
|
|
9560
|
-
*
|
|
9576
|
+
* 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.
|
|
9561
9577
|
*/
|
|
9562
9578
|
limit?: LimitParameter;
|
|
9563
9579
|
/**
|
|
9564
|
-
* Zero-based page index.
|
|
9580
|
+
* 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).
|
|
9565
9581
|
*/
|
|
9566
9582
|
offset?: OffsetParameter;
|
|
9567
9583
|
};
|
|
@@ -9583,11 +9599,11 @@ export type PlanUpdatePlanBody = Plan | null;
|
|
|
9583
9599
|
|
|
9584
9600
|
export type PlanFamilyGetAllPlanFamiliesParams = {
|
|
9585
9601
|
/**
|
|
9586
|
-
*
|
|
9602
|
+
* 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.
|
|
9587
9603
|
*/
|
|
9588
9604
|
limit?: LimitParameter;
|
|
9589
9605
|
/**
|
|
9590
|
-
* Zero-based page index.
|
|
9606
|
+
* 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).
|
|
9591
9607
|
*/
|
|
9592
9608
|
offset?: OffsetParameter;
|
|
9593
9609
|
};
|
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
AuthResendTwoFactorParams,
|
|
14
14
|
AuthSwitchTwoFactorMechanismParams,
|
|
15
15
|
AuthVerifyTwoFactorRecoveryParams,
|
|
16
|
+
PublicEmailListAddSubscriptionBody,
|
|
16
17
|
TokenPayload,
|
|
17
18
|
TokenTwoFactorEnrollmentBeginEmailParams,
|
|
18
19
|
TokenTwoFactorEnrollmentBeginTotpParams,
|
|
@@ -26,12 +27,107 @@ import type {
|
|
|
26
27
|
|
|
27
28
|
import { customFetch } from '../../mutator';
|
|
28
29
|
|
|
30
|
+
// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
|
|
31
|
+
type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <
|
|
32
|
+
T,
|
|
33
|
+
>() => T extends Y ? 1 : 2
|
|
34
|
+
? A
|
|
35
|
+
: B;
|
|
36
|
+
|
|
37
|
+
type WritableKeys<T> = {
|
|
38
|
+
[P in keyof T]-?: IfEquals<
|
|
39
|
+
{ [Q in P]: T[P] },
|
|
40
|
+
{ -readonly [Q in P]: T[P] },
|
|
41
|
+
P
|
|
42
|
+
>;
|
|
43
|
+
}[keyof T];
|
|
44
|
+
|
|
45
|
+
type UnionToIntersection<U> =
|
|
46
|
+
(U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;
|
|
47
|
+
type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;
|
|
48
|
+
|
|
49
|
+
type Writable<T> = Pick<T, WritableKeys<T>>;
|
|
50
|
+
type NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {
|
|
51
|
+
[P in keyof Writable<T>]: T[P] extends object
|
|
52
|
+
? NonReadonly<NonNullable<T[P]>>
|
|
53
|
+
: T[P];
|
|
54
|
+
} : DistributeReadOnlyOverUnions<T>;
|
|
55
|
+
|
|
56
|
+
|
|
29
57
|
|
|
30
58
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
31
59
|
|
|
32
60
|
|
|
33
61
|
|
|
34
62
|
/**
|
|
63
|
+
* This endpoint does not require authentication. The email list must be public, and the
|
|
64
|
+
subscription is subject to bot protection and the list's double opt-in settings.
|
|
65
|
+
* @summary Publicly subscribe a person to an email list.
|
|
66
|
+
*/
|
|
67
|
+
export const publicEmailListAddSubscription = (
|
|
68
|
+
emailListUid: string | null,
|
|
69
|
+
publicEmailListAddSubscriptionBody: NonReadonly<PublicEmailListAddSubscriptionBody>,
|
|
70
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
71
|
+
) => {
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
return customFetch<Blob>(
|
|
75
|
+
{url: `/api/v1/public/email/lists/${emailListUid}/subscriptions`, method: 'POST',
|
|
76
|
+
headers: {'Content-Type': 'application/json', },
|
|
77
|
+
data: publicEmailListAddSubscriptionBody,
|
|
78
|
+
responseType: 'blob', signal
|
|
79
|
+
},
|
|
80
|
+
options);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
export const getPublicEmailListAddSubscriptionMutationOptions = <TError = void,
|
|
86
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof publicEmailListAddSubscription>>, TError,{emailListUid: string | null;data: NonReadonly<PublicEmailListAddSubscriptionBody>}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
87
|
+
): UseMutationOptions<Awaited<ReturnType<typeof publicEmailListAddSubscription>>, TError,{emailListUid: string | null;data: NonReadonly<PublicEmailListAddSubscriptionBody>}, TContext> => {
|
|
88
|
+
|
|
89
|
+
const mutationKey = ['publicEmailListAddSubscription'];
|
|
90
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
91
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
92
|
+
options
|
|
93
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
94
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof publicEmailListAddSubscription>>, {emailListUid: string | null;data: NonReadonly<PublicEmailListAddSubscriptionBody>}> = (props) => {
|
|
100
|
+
const {emailListUid,data} = props ?? {};
|
|
101
|
+
|
|
102
|
+
return publicEmailListAddSubscription(emailListUid,data,requestOptions)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
return { mutationFn, ...mutationOptions }}
|
|
109
|
+
|
|
110
|
+
export type PublicEmailListAddSubscriptionMutationResult = NonNullable<Awaited<ReturnType<typeof publicEmailListAddSubscription>>>
|
|
111
|
+
export type PublicEmailListAddSubscriptionMutationBody = NonReadonly<PublicEmailListAddSubscriptionBody>
|
|
112
|
+
export type PublicEmailListAddSubscriptionMutationError = void
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @summary Publicly subscribe a person to an email list.
|
|
116
|
+
*/
|
|
117
|
+
export const usePublicEmailListAddSubscription = <TError = void,
|
|
118
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof publicEmailListAddSubscription>>, TError,{emailListUid: string | null;data: NonReadonly<PublicEmailListAddSubscriptionBody>}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
119
|
+
): UseMutationResult<
|
|
120
|
+
Awaited<ReturnType<typeof publicEmailListAddSubscription>>,
|
|
121
|
+
TError,
|
|
122
|
+
{emailListUid: string | null;data: NonReadonly<PublicEmailListAddSubscriptionBody>},
|
|
123
|
+
TContext
|
|
124
|
+
> => {
|
|
125
|
+
|
|
126
|
+
const mutationOptions = getPublicEmailListAddSubscriptionMutationOptions(options);
|
|
127
|
+
|
|
128
|
+
return useMutation(mutationOptions);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
35
131
|
* Authenticates a user and returns a JWT access token (plus a refresh token).
|
|
36
132
|
|
|
37
133
|
Post a JSON body with the user's credentials:
|