@better-giving/donation 1.1.16 → 1.1.18

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.
@@ -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,47 +2,47 @@ 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 donationSources: readonly ["bg-marketplace", "bg-widget", "tester-app"];
6
- export declare const donationSource: v.PicklistSchema<readonly ["bg-marketplace", "bg-widget", "tester-app"], undefined>;
7
- export type DonationSource = v.InferOutput<typeof donationSource>;
8
- export declare const donorTitles: readonly ["Mr", "Mrs", "Ms", "Mx", ""];
9
- export declare const donorTitle: v.PicklistSchema<readonly ["Mr", "Mrs", "Ms", "Mx", ""], undefined>;
10
- export type DonorTitle = v.InferOutput<typeof donorTitle>;
11
- export declare const donorAddress: v.ObjectSchema<{
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 zipCode: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
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 ukGiftAid: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
18
+ readonly uk_gift_aid: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
19
19
  }, undefined>;
20
- export type DonorAddress = v.InferOutput<typeof donorAddress>;
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 firstName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
24
- readonly companyName: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
25
- readonly lastName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
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 zipCode: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
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 ukGiftAid: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
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>;
38
38
  export declare const amount: v.ObjectSchema<{
39
39
  readonly amount: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
40
- readonly currency: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
40
+ readonly currency: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, v.ToUpperCaseAction]>;
41
41
  readonly tip: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
42
- readonly feeAllowance: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
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 endowId: 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>]>;
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,27 +51,27 @@ 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 tributeNotif: v.ObjectSchema<{
55
- readonly toEmail: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
56
- readonly toFullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
57
- readonly fromMsg: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 250, undefined>]>;
54
+ export declare const tribute_notif: v.ObjectSchema<{
55
+ readonly to_email: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
56
+ readonly to_fullname: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
57
+ readonly from_msg: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 250, undefined>]>;
58
58
  }, undefined>;
59
- export type TributeNotif = v.InferOutput<typeof tributeNotif>;
59
+ export type TributeNotif = v.InferOutput<typeof tribute_notif>;
60
60
  export declare const tribute: v.ObjectSchema<{
61
- readonly fullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
61
+ readonly full_name: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
62
62
  readonly notif: v.OptionalSchema<v.ObjectSchema<{
63
- readonly toEmail: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
64
- readonly toFullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
65
- readonly fromMsg: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 250, undefined>]>;
63
+ readonly to_email: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
64
+ readonly to_fullname: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
65
+ readonly from_msg: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 250, undefined>]>;
66
66
  }, undefined>, never>;
67
67
  }, undefined>;
68
68
  export type Tribute = v.InferOutput<typeof tribute>;
69
69
  export declare const intent: v.ObjectSchema<{
70
70
  readonly amount: v.ObjectSchema<{
71
71
  readonly amount: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
72
- readonly currency: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
72
+ readonly currency: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, v.ToUpperCaseAction]>;
73
73
  readonly tip: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
74
- readonly feeAllowance: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
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,35 +80,35 @@ 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 firstName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
84
- readonly companyName: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
85
- readonly lastName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
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 zipCode: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
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 ukGiftAid: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
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>;
98
98
  readonly donor_public: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
99
99
  readonly source: v.PicklistSchema<readonly ["bg-marketplace", "bg-widget", "tester-app"], undefined>;
100
100
  readonly tribute: v.OptionalSchema<v.ObjectSchema<{
101
- readonly fullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
101
+ readonly full_name: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
102
102
  readonly notif: v.OptionalSchema<v.ObjectSchema<{
103
- readonly toEmail: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
104
- readonly toFullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
105
- readonly fromMsg: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 250, undefined>]>;
103
+ readonly to_email: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
104
+ readonly to_fullname: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
105
+ readonly from_msg: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 250, undefined>]>;
106
106
  }, undefined>, never>;
107
107
  }, undefined>, never>;
108
108
  readonly frequency: v.PicklistSchema<readonly ["one-time", "recurring"], undefined>;
109
109
  /** chain name, etc. */
110
- readonly viaName: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
110
+ readonly via_name: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
111
111
  /** chain id, workflow-session-id, etc. */
112
- readonly viaId: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
112
+ readonly via_id: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
113
113
  }, undefined>;
114
114
  export type DonationIntent = v.InferOutput<typeof intent>;
package/dist/intent.mjs CHANGED
@@ -1,68 +1,68 @@
1
1
  import * as v from "valibot";
2
2
  const str = v.pipe(v.string(), v.trim());
3
- const requiredStr = v.pipe(str, v.nonEmpty());
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 donationSources = [
6
+ export const donation_sources = [
7
7
  "bg-marketplace",
8
8
  "bg-widget",
9
9
  "tester-app",
10
10
  ];
11
- export const donationSource = v.picklist(donationSources);
12
- export const donorTitles = ["Mr", "Mrs", "Ms", "Mx", ""];
13
- export const donorTitle = v.picklist(donorTitles);
14
- export const donorAddress = v.object({
15
- street: requiredStr,
16
- city: requiredStr,
17
- state: v.optional(requiredStr),
18
- zipCode: v.optional(requiredStr),
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: requiredStr,
21
- ukGiftAid: v.optional(v.boolean()),
20
+ country: required_str,
21
+ uk_gift_aid: v.optional(v.boolean()),
22
22
  });
23
23
  export const donor = v.object({
24
- title: donorTitle,
25
- firstName: requiredStr,
26
- companyName: v.optional(str),
27
- lastName: requiredStr,
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(donorAddress),
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: requiredStr,
34
+ currency: v.pipe(required_str, v.toUpperCase()),
35
35
  tip: money,
36
- feeAllowance: money,
36
+ fee_allowance: money,
37
37
  });
38
- export const endowId = v.pipe(str, v.transform((x) => +x), v.number(), v.integer(), v.minValue(1));
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: requiredStr,
42
+ name: required_str,
43
43
  });
44
- export const recipient = v.union([endowId, uuid]);
45
- export const tributeNotif = v.object({
46
- toEmail: v.pipe(str, v.email()),
47
- toFullName: v.pipe(str, v.nonEmpty()),
48
- fromMsg: v.pipe(str, v.maxLength(250)),
44
+ export const recipient = v.union([endow_id, uuid]);
45
+ export const tribute_notif = v.object({
46
+ to_email: v.pipe(str, v.email()),
47
+ to_fullname: v.pipe(str, v.nonEmpty()),
48
+ from_msg: v.pipe(str, v.maxLength(250)),
49
49
  });
50
50
  export const tribute = v.object({
51
- fullName: requiredStr,
52
- notif: v.optional(tributeNotif),
51
+ full_name: 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(requiredStr, v.maxLength(500))),
59
+ donor_message: v.optional(v.pipe(required_str, v.maxLength(500))),
60
60
  donor_public: v.optional(v.boolean()),
61
- source: donationSource,
61
+ source: donation_source,
62
62
  tribute: v.optional(tribute),
63
63
  frequency,
64
64
  /** chain name, etc. */
65
- viaName: str,
65
+ via_name: str,
66
66
  /** chain id, workflow-session-id, etc. */
67
- viaId: str,
67
+ via_id: str,
68
68
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-giving/donation",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "devDependencies": {
5
5
  "@better-giving/config": "1.1.2"
6
6
  },
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 requiredStr = v.pipe(str, v.nonEmpty());
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 donationSources = [
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 donationSource = v.picklist(donationSources);
18
- export type DonationSource = v.InferOutput<typeof donationSource>;
17
+ export const donation_source = v.picklist(donation_sources);
18
+ export type DonationSource = v.InferOutput<typeof donation_source>;
19
19
 
20
- export const donorTitles = ["Mr", "Mrs", "Ms", "Mx", ""] as const;
21
- export const donorTitle = v.picklist(donorTitles);
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 donorTitle>;
23
+ export type DonorTitle = v.InferOutput<typeof donor_title>;
24
24
 
25
- export const donorAddress = v.object({
26
- street: requiredStr,
27
- city: requiredStr,
28
- state: v.optional(requiredStr),
29
- zipCode: v.optional(requiredStr),
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: requiredStr,
32
- ukGiftAid: v.optional(v.boolean()),
31
+ country: required_str,
32
+ uk_gift_aid: v.optional(v.boolean()),
33
33
  });
34
34
 
35
- export type DonorAddress = v.InferOutput<typeof donorAddress>;
35
+ export type DonorAddress = v.InferOutput<typeof donor_address>;
36
36
 
37
37
  export const donor = v.object({
38
- title: donorTitle,
39
- firstName: requiredStr,
40
- companyName: v.optional(str),
41
- lastName: requiredStr,
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(donorAddress),
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: requiredStr,
52
+ currency: v.pipe(required_str, v.toUpperCase()),
53
53
  tip: money,
54
- feeAllowance: money,
54
+ fee_allowance: money,
55
55
  });
56
56
 
57
57
  export type Amount = v.InferOutput<typeof amount>;
58
58
 
59
- export const endowId = v.pipe(
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: requiredStr,
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([endowId, uuid]);
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 tributeNotif = v.object({
80
- toEmail: v.pipe(str, v.email()),
81
- toFullName: v.pipe(str, v.nonEmpty()),
82
- fromMsg: v.pipe(str, v.maxLength(250)),
79
+ export const tribute_notif = v.object({
80
+ to_email: v.pipe(str, v.email()),
81
+ to_fullname: v.pipe(str, v.nonEmpty()),
82
+ from_msg: v.pipe(str, v.maxLength(250)),
83
83
  });
84
84
 
85
- export type TributeNotif = v.InferOutput<typeof tributeNotif>;
85
+ export type TributeNotif = v.InferOutput<typeof tribute_notif>;
86
86
 
87
87
  export const tribute = v.object({
88
- fullName: requiredStr,
89
- notif: v.optional(tributeNotif),
88
+ full_name: required_str,
89
+ notif: v.optional(tribute_notif),
90
90
  });
91
91
 
92
92
  export type Tribute = v.InferOutput<typeof tribute>;
@@ -96,15 +96,15 @@ export const intent = v.object({
96
96
  recipient,
97
97
  program: v.optional(program),
98
98
  donor,
99
- donor_message: v.optional(v.pipe(requiredStr, v.maxLength(500))),
99
+ donor_message: v.optional(v.pipe(required_str, v.maxLength(500))),
100
100
  donor_public: v.optional(v.boolean()),
101
- source: donationSource,
101
+ source: donation_source,
102
102
  tribute: v.optional(tribute),
103
103
  frequency,
104
104
  /** chain name, etc. */
105
- viaName: str,
105
+ via_name: str,
106
106
  /** chain id, workflow-session-id, etc. */
107
- viaId: str,
107
+ via_id: str,
108
108
  });
109
109
 
110
110
  export type DonationIntent = v.InferOutput<typeof intent>;