@better-giving/donation 1.1.16 → 1.1.17
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/donation.d.mts +2 -39
- package/dist/intent.d.mts +25 -25
- package/dist/intent.mjs +27 -27
- package/package.json +1 -1
- package/src/donation.mts +3 -43
- package/src/intent.mts +31 -31
package/dist/donation.d.mts
CHANGED
|
@@ -134,6 +134,7 @@ export declare namespace Donation {
|
|
|
134
134
|
fund_id?: string;
|
|
135
135
|
fund_name?: string;
|
|
136
136
|
fund_tx?: string;
|
|
137
|
+
company_name?: string;
|
|
137
138
|
};
|
|
138
139
|
type NonKeyAttributes = {
|
|
139
140
|
addressComplement?: " ";
|
|
@@ -190,45 +191,6 @@ export declare namespace Donation {
|
|
|
190
191
|
/** may be empty `""` */
|
|
191
192
|
fromMsg: string;
|
|
192
193
|
};
|
|
193
|
-
namespace Intent {
|
|
194
|
-
interface Donor {
|
|
195
|
-
/** may be empty `''` */
|
|
196
|
-
title?: DonorTitle;
|
|
197
|
-
firstName: string;
|
|
198
|
-
lastName: string;
|
|
199
|
-
companyName?: string;
|
|
200
|
-
email: string;
|
|
201
|
-
address?: DonorAddress;
|
|
202
|
-
/** signifies eligibility to UK Gift Aid, defaults to `false` for crypto donations */
|
|
203
|
-
ukGiftAid: boolean;
|
|
204
|
-
}
|
|
205
|
-
interface Attr {
|
|
206
|
-
transactionId?: string;
|
|
207
|
-
amount: number;
|
|
208
|
-
tipAmount: number;
|
|
209
|
-
feeAllowance: number;
|
|
210
|
-
endowmentId: number;
|
|
211
|
-
/** program donation: may be empty `""`*/
|
|
212
|
-
programId?: string;
|
|
213
|
-
programName?: string;
|
|
214
|
-
splitLiq: number;
|
|
215
|
-
donor: Donor;
|
|
216
|
-
/** honorary full name */
|
|
217
|
-
inHonorOf?: string;
|
|
218
|
-
/** only allowed if honoree is provided */
|
|
219
|
-
tributeNotif?: TributeNotif;
|
|
220
|
-
source: Source;
|
|
221
|
-
}
|
|
222
|
-
interface Crypto extends Attr {
|
|
223
|
-
denomination: string;
|
|
224
|
-
chainId: ChainID.V2CryptoChainID;
|
|
225
|
-
walletAddress?: string;
|
|
226
|
-
chainName: string;
|
|
227
|
-
}
|
|
228
|
-
interface Fiat extends Attr {
|
|
229
|
-
currency: string;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
194
|
/** web-app determinant: show signup page or not*/
|
|
233
195
|
type GuestDonor = {
|
|
234
196
|
email: string;
|
|
@@ -307,6 +269,7 @@ export declare namespace OnHoldDonation {
|
|
|
307
269
|
tributeNotif?: Donation.TributeNotif;
|
|
308
270
|
donor_message?: string;
|
|
309
271
|
donor_public?: boolean;
|
|
272
|
+
company_name?: string;
|
|
310
273
|
} & (ApesAttributes | EmptyObject) & (Donation.WithKYC | Donation.WithoutKYC);
|
|
311
274
|
type CryptoDBRecord = PrimaryKey & NonKeyAttributes & CryptoAttributes & Donation.EmailIndexKey;
|
|
312
275
|
type FiatDBRecord = PrimaryKey & Required<Donation.FiatRamp_IndexKey> & NonKeyAttributes & FiatAttributes & Required<Donation.EmailIndexKey>;
|
package/dist/intent.d.mts
CHANGED
|
@@ -2,36 +2,36 @@ import * as v from "valibot";
|
|
|
2
2
|
export declare const frequencies: readonly ["one-time", "recurring"];
|
|
3
3
|
export declare const frequency: v.PicklistSchema<readonly ["one-time", "recurring"], undefined>;
|
|
4
4
|
export type Frequency = v.InferOutput<typeof frequency>;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export type DonationSource = v.InferOutput<typeof
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export type DonorTitle = v.InferOutput<typeof
|
|
11
|
-
export declare const
|
|
5
|
+
export declare const donation_sources: readonly ["bg-marketplace", "bg-widget", "tester-app"];
|
|
6
|
+
export declare const donation_source: v.PicklistSchema<readonly ["bg-marketplace", "bg-widget", "tester-app"], undefined>;
|
|
7
|
+
export type DonationSource = v.InferOutput<typeof donation_source>;
|
|
8
|
+
export declare const donor_titles: readonly ["Mr", "Mrs", "Ms", "Mx", ""];
|
|
9
|
+
export declare const donor_title: v.PicklistSchema<readonly ["Mr", "Mrs", "Ms", "Mx", ""], undefined>;
|
|
10
|
+
export type DonorTitle = v.InferOutput<typeof donor_title>;
|
|
11
|
+
export declare const donor_address: v.ObjectSchema<{
|
|
12
12
|
readonly street: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
13
13
|
readonly city: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
14
14
|
readonly state: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
|
|
15
|
-
readonly
|
|
15
|
+
readonly zip_code: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
|
|
16
16
|
/** country name */
|
|
17
17
|
readonly country: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
18
|
-
readonly
|
|
18
|
+
readonly uk_gift_aid: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
19
19
|
}, undefined>;
|
|
20
|
-
export type DonorAddress = v.InferOutput<typeof
|
|
20
|
+
export type DonorAddress = v.InferOutput<typeof donor_address>;
|
|
21
21
|
export declare const donor: v.ObjectSchema<{
|
|
22
22
|
readonly title: v.PicklistSchema<readonly ["Mr", "Mrs", "Ms", "Mx", ""], undefined>;
|
|
23
|
-
readonly
|
|
24
|
-
readonly
|
|
25
|
-
readonly
|
|
23
|
+
readonly first_name: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
24
|
+
readonly company_name: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
|
|
25
|
+
readonly last_name: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
26
26
|
readonly email: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
|
|
27
27
|
readonly address: v.OptionalSchema<v.ObjectSchema<{
|
|
28
28
|
readonly street: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
29
29
|
readonly city: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
30
30
|
readonly state: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
|
|
31
|
-
readonly
|
|
31
|
+
readonly zip_code: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
|
|
32
32
|
/** country name */
|
|
33
33
|
readonly country: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
34
|
-
readonly
|
|
34
|
+
readonly uk_gift_aid: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
35
35
|
}, undefined>, never>;
|
|
36
36
|
}, undefined>;
|
|
37
37
|
export type Donor = v.InferOutput<typeof donor>;
|
|
@@ -39,10 +39,10 @@ export declare const amount: v.ObjectSchema<{
|
|
|
39
39
|
readonly amount: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
40
40
|
readonly currency: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
41
41
|
readonly tip: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
42
|
-
readonly
|
|
42
|
+
readonly fee_allowance: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
43
43
|
}, undefined>;
|
|
44
44
|
export type Amount = v.InferOutput<typeof amount>;
|
|
45
|
-
export declare const
|
|
45
|
+
export declare const endow_id: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
46
46
|
export declare const uuid: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UuidAction<string, undefined>]>;
|
|
47
47
|
export declare const program: v.ObjectSchema<{
|
|
48
48
|
readonly id: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UuidAction<string, undefined>]>;
|
|
@@ -51,12 +51,12 @@ export declare const program: v.ObjectSchema<{
|
|
|
51
51
|
export type Program = v.InferOutput<typeof program>;
|
|
52
52
|
export declare const recipient: v.UnionSchema<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UuidAction<string, undefined>]>], undefined>;
|
|
53
53
|
export type Recipient = v.InferOutput<typeof recipient>;
|
|
54
|
-
export declare const
|
|
54
|
+
export declare const tribute_notif: v.ObjectSchema<{
|
|
55
55
|
readonly toEmail: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
|
|
56
56
|
readonly toFullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
57
57
|
readonly fromMsg: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 250, undefined>]>;
|
|
58
58
|
}, undefined>;
|
|
59
|
-
export type TributeNotif = v.InferOutput<typeof
|
|
59
|
+
export type TributeNotif = v.InferOutput<typeof tribute_notif>;
|
|
60
60
|
export declare const tribute: v.ObjectSchema<{
|
|
61
61
|
readonly fullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
62
62
|
readonly notif: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -71,7 +71,7 @@ export declare const intent: v.ObjectSchema<{
|
|
|
71
71
|
readonly amount: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
72
72
|
readonly currency: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
73
73
|
readonly tip: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
74
|
-
readonly
|
|
74
|
+
readonly fee_allowance: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
75
75
|
}, undefined>;
|
|
76
76
|
readonly recipient: v.UnionSchema<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UuidAction<string, undefined>]>], undefined>;
|
|
77
77
|
readonly program: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -80,18 +80,18 @@ export declare const intent: v.ObjectSchema<{
|
|
|
80
80
|
}, undefined>, never>;
|
|
81
81
|
readonly donor: v.ObjectSchema<{
|
|
82
82
|
readonly title: v.PicklistSchema<readonly ["Mr", "Mrs", "Ms", "Mx", ""], undefined>;
|
|
83
|
-
readonly
|
|
84
|
-
readonly
|
|
85
|
-
readonly
|
|
83
|
+
readonly first_name: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
84
|
+
readonly company_name: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
|
|
85
|
+
readonly last_name: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
86
86
|
readonly email: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
|
|
87
87
|
readonly address: v.OptionalSchema<v.ObjectSchema<{
|
|
88
88
|
readonly street: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
89
89
|
readonly city: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
90
90
|
readonly state: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
|
|
91
|
-
readonly
|
|
91
|
+
readonly zip_code: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
|
|
92
92
|
/** country name */
|
|
93
93
|
readonly country: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
94
|
-
readonly
|
|
94
|
+
readonly uk_gift_aid: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
95
95
|
}, undefined>, never>;
|
|
96
96
|
}, undefined>;
|
|
97
97
|
readonly donor_message: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, v.MaxLengthAction<string, 500, undefined>]>, never>;
|
package/dist/intent.mjs
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
const str = v.pipe(v.string(), v.trim());
|
|
3
|
-
const
|
|
3
|
+
const required_str = v.pipe(str, v.nonEmpty());
|
|
4
4
|
export const frequencies = ["one-time", "recurring"];
|
|
5
5
|
export const frequency = v.picklist(frequencies);
|
|
6
|
-
export const
|
|
6
|
+
export const donation_sources = [
|
|
7
7
|
"bg-marketplace",
|
|
8
8
|
"bg-widget",
|
|
9
9
|
"tester-app",
|
|
10
10
|
];
|
|
11
|
-
export const
|
|
12
|
-
export const
|
|
13
|
-
export const
|
|
14
|
-
export const
|
|
15
|
-
street:
|
|
16
|
-
city:
|
|
17
|
-
state: v.optional(
|
|
18
|
-
|
|
11
|
+
export const donation_source = v.picklist(donation_sources);
|
|
12
|
+
export const donor_titles = ["Mr", "Mrs", "Ms", "Mx", ""];
|
|
13
|
+
export const donor_title = v.picklist(donor_titles);
|
|
14
|
+
export const donor_address = v.object({
|
|
15
|
+
street: required_str,
|
|
16
|
+
city: required_str,
|
|
17
|
+
state: v.optional(required_str),
|
|
18
|
+
zip_code: v.optional(required_str),
|
|
19
19
|
/** country name */
|
|
20
|
-
country:
|
|
21
|
-
|
|
20
|
+
country: required_str,
|
|
21
|
+
uk_gift_aid: v.optional(v.boolean()),
|
|
22
22
|
});
|
|
23
23
|
export const donor = v.object({
|
|
24
|
-
title:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
title: donor_title,
|
|
25
|
+
first_name: required_str,
|
|
26
|
+
company_name: v.optional(str),
|
|
27
|
+
last_name: required_str,
|
|
28
28
|
email: v.pipe(str, v.email()),
|
|
29
|
-
address: v.optional(
|
|
29
|
+
address: v.optional(donor_address),
|
|
30
30
|
});
|
|
31
31
|
const money = v.pipe(v.number(), v.minValue(0));
|
|
32
32
|
export const amount = v.object({
|
|
33
33
|
amount: money,
|
|
34
|
-
currency:
|
|
34
|
+
currency: required_str,
|
|
35
35
|
tip: money,
|
|
36
|
-
|
|
36
|
+
fee_allowance: money,
|
|
37
37
|
});
|
|
38
|
-
export const
|
|
38
|
+
export const endow_id = v.pipe(str, v.transform((x) => +x), v.number(), v.integer(), v.minValue(1));
|
|
39
39
|
export const uuid = v.pipe(str, v.uuid());
|
|
40
40
|
export const program = v.object({
|
|
41
41
|
id: uuid,
|
|
42
|
-
name:
|
|
42
|
+
name: required_str,
|
|
43
43
|
});
|
|
44
|
-
export const recipient = v.union([
|
|
45
|
-
export const
|
|
44
|
+
export const recipient = v.union([endow_id, uuid]);
|
|
45
|
+
export const tribute_notif = v.object({
|
|
46
46
|
toEmail: v.pipe(str, v.email()),
|
|
47
47
|
toFullName: v.pipe(str, v.nonEmpty()),
|
|
48
48
|
fromMsg: v.pipe(str, v.maxLength(250)),
|
|
49
49
|
});
|
|
50
50
|
export const tribute = v.object({
|
|
51
|
-
fullName:
|
|
52
|
-
notif: v.optional(
|
|
51
|
+
fullName: required_str,
|
|
52
|
+
notif: v.optional(tribute_notif),
|
|
53
53
|
});
|
|
54
54
|
export const intent = v.object({
|
|
55
55
|
amount,
|
|
56
56
|
recipient,
|
|
57
57
|
program: v.optional(program),
|
|
58
58
|
donor,
|
|
59
|
-
donor_message: v.optional(v.pipe(
|
|
59
|
+
donor_message: v.optional(v.pipe(required_str, v.maxLength(500))),
|
|
60
60
|
donor_public: v.optional(v.boolean()),
|
|
61
|
-
source:
|
|
61
|
+
source: donation_source,
|
|
62
62
|
tribute: v.optional(tribute),
|
|
63
63
|
frequency,
|
|
64
64
|
/** chain name, etc. */
|
package/package.json
CHANGED
package/src/donation.mts
CHANGED
|
@@ -183,6 +183,8 @@ export declare namespace Donation {
|
|
|
183
183
|
fund_id?: string;
|
|
184
184
|
fund_name?: string;
|
|
185
185
|
fund_tx?: string;
|
|
186
|
+
|
|
187
|
+
company_name?: string;
|
|
186
188
|
};
|
|
187
189
|
|
|
188
190
|
type NonKeyAttributes = {
|
|
@@ -286,49 +288,6 @@ export declare namespace Donation {
|
|
|
286
288
|
fromMsg: string;
|
|
287
289
|
};
|
|
288
290
|
|
|
289
|
-
export namespace Intent {
|
|
290
|
-
interface Donor {
|
|
291
|
-
/** may be empty `''` */
|
|
292
|
-
title?: DonorTitle;
|
|
293
|
-
firstName: string;
|
|
294
|
-
lastName: string;
|
|
295
|
-
companyName?: string;
|
|
296
|
-
email: string;
|
|
297
|
-
address?: DonorAddress;
|
|
298
|
-
/** signifies eligibility to UK Gift Aid, defaults to `false` for crypto donations */
|
|
299
|
-
ukGiftAid: boolean;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
interface Attr {
|
|
303
|
-
transactionId?: string;
|
|
304
|
-
amount: number;
|
|
305
|
-
tipAmount: number;
|
|
306
|
-
feeAllowance: number;
|
|
307
|
-
endowmentId: number;
|
|
308
|
-
/** program donation: may be empty `""`*/
|
|
309
|
-
programId?: string;
|
|
310
|
-
programName?: string;
|
|
311
|
-
splitLiq: number;
|
|
312
|
-
donor: Donor;
|
|
313
|
-
/** honorary full name */
|
|
314
|
-
inHonorOf?: string;
|
|
315
|
-
/** only allowed if honoree is provided */
|
|
316
|
-
tributeNotif?: TributeNotif;
|
|
317
|
-
source: Source;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
interface Crypto extends Attr {
|
|
321
|
-
denomination: string;
|
|
322
|
-
chainId: ChainID.V2CryptoChainID;
|
|
323
|
-
walletAddress?: string;
|
|
324
|
-
chainName: string;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
interface Fiat extends Attr {
|
|
328
|
-
currency: string;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
291
|
/** web-app determinant: show signup page or not*/
|
|
333
292
|
type GuestDonor = {
|
|
334
293
|
email: string;
|
|
@@ -413,6 +372,7 @@ export declare namespace OnHoldDonation {
|
|
|
413
372
|
tributeNotif?: Donation.TributeNotif;
|
|
414
373
|
donor_message?: string;
|
|
415
374
|
donor_public?: boolean;
|
|
375
|
+
company_name?: string;
|
|
416
376
|
} & (ApesAttributes | EmptyObject) &
|
|
417
377
|
(Donation.WithKYC | Donation.WithoutKYC);
|
|
418
378
|
|
package/src/intent.mts
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
const str = v.pipe(v.string(), v.trim());
|
|
4
|
-
const
|
|
4
|
+
const required_str = v.pipe(str, v.nonEmpty());
|
|
5
5
|
|
|
6
6
|
export const frequencies = ["one-time", "recurring"] as const;
|
|
7
7
|
export const frequency = v.picklist(frequencies);
|
|
8
8
|
|
|
9
9
|
export type Frequency = v.InferOutput<typeof frequency>;
|
|
10
10
|
|
|
11
|
-
export const
|
|
11
|
+
export const donation_sources = [
|
|
12
12
|
"bg-marketplace",
|
|
13
13
|
"bg-widget",
|
|
14
14
|
"tester-app",
|
|
15
15
|
] as const;
|
|
16
16
|
|
|
17
|
-
export const
|
|
18
|
-
export type DonationSource = v.InferOutput<typeof
|
|
17
|
+
export const donation_source = v.picklist(donation_sources);
|
|
18
|
+
export type DonationSource = v.InferOutput<typeof donation_source>;
|
|
19
19
|
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
20
|
+
export const donor_titles = ["Mr", "Mrs", "Ms", "Mx", ""] as const;
|
|
21
|
+
export const donor_title = v.picklist(donor_titles);
|
|
22
22
|
|
|
23
|
-
export type DonorTitle = v.InferOutput<typeof
|
|
23
|
+
export type DonorTitle = v.InferOutput<typeof donor_title>;
|
|
24
24
|
|
|
25
|
-
export const
|
|
26
|
-
street:
|
|
27
|
-
city:
|
|
28
|
-
state: v.optional(
|
|
29
|
-
|
|
25
|
+
export const donor_address = v.object({
|
|
26
|
+
street: required_str,
|
|
27
|
+
city: required_str,
|
|
28
|
+
state: v.optional(required_str),
|
|
29
|
+
zip_code: v.optional(required_str),
|
|
30
30
|
/** country name */
|
|
31
|
-
country:
|
|
32
|
-
|
|
31
|
+
country: required_str,
|
|
32
|
+
uk_gift_aid: v.optional(v.boolean()),
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
export type DonorAddress = v.InferOutput<typeof
|
|
35
|
+
export type DonorAddress = v.InferOutput<typeof donor_address>;
|
|
36
36
|
|
|
37
37
|
export const donor = v.object({
|
|
38
|
-
title:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
title: donor_title,
|
|
39
|
+
first_name: required_str,
|
|
40
|
+
company_name: v.optional(str),
|
|
41
|
+
last_name: required_str,
|
|
42
42
|
email: v.pipe(str, v.email()),
|
|
43
|
-
address: v.optional(
|
|
43
|
+
address: v.optional(donor_address),
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
export type Donor = v.InferOutput<typeof donor>;
|
|
@@ -49,14 +49,14 @@ const money = v.pipe(v.number(), v.minValue(0));
|
|
|
49
49
|
|
|
50
50
|
export const amount = v.object({
|
|
51
51
|
amount: money,
|
|
52
|
-
currency:
|
|
52
|
+
currency: required_str,
|
|
53
53
|
tip: money,
|
|
54
|
-
|
|
54
|
+
fee_allowance: money,
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
export type Amount = v.InferOutput<typeof amount>;
|
|
58
58
|
|
|
59
|
-
export const
|
|
59
|
+
export const endow_id = v.pipe(
|
|
60
60
|
str,
|
|
61
61
|
v.transform((x) => +x),
|
|
62
62
|
v.number(),
|
|
@@ -67,26 +67,26 @@ export const uuid = v.pipe(str, v.uuid());
|
|
|
67
67
|
|
|
68
68
|
export const program = v.object({
|
|
69
69
|
id: uuid,
|
|
70
|
-
name:
|
|
70
|
+
name: required_str,
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
export type Program = v.InferOutput<typeof program>;
|
|
74
74
|
|
|
75
|
-
export const recipient = v.union([
|
|
75
|
+
export const recipient = v.union([endow_id, uuid]);
|
|
76
76
|
|
|
77
77
|
export type Recipient = v.InferOutput<typeof recipient>;
|
|
78
78
|
|
|
79
|
-
export const
|
|
79
|
+
export const tribute_notif = v.object({
|
|
80
80
|
toEmail: v.pipe(str, v.email()),
|
|
81
81
|
toFullName: v.pipe(str, v.nonEmpty()),
|
|
82
82
|
fromMsg: v.pipe(str, v.maxLength(250)),
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
export type TributeNotif = v.InferOutput<typeof
|
|
85
|
+
export type TributeNotif = v.InferOutput<typeof tribute_notif>;
|
|
86
86
|
|
|
87
87
|
export const tribute = v.object({
|
|
88
|
-
fullName:
|
|
89
|
-
notif: v.optional(
|
|
88
|
+
fullName: required_str,
|
|
89
|
+
notif: v.optional(tribute_notif),
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
export type Tribute = v.InferOutput<typeof tribute>;
|
|
@@ -96,9 +96,9 @@ export const intent = v.object({
|
|
|
96
96
|
recipient,
|
|
97
97
|
program: v.optional(program),
|
|
98
98
|
donor,
|
|
99
|
-
donor_message: v.optional(v.pipe(
|
|
99
|
+
donor_message: v.optional(v.pipe(required_str, v.maxLength(500))),
|
|
100
100
|
donor_public: v.optional(v.boolean()),
|
|
101
|
-
source:
|
|
101
|
+
source: donation_source,
|
|
102
102
|
tribute: v.optional(tribute),
|
|
103
103
|
frequency,
|
|
104
104
|
/** chain name, etc. */
|