@better-giving/donation 3.0.32 → 3.0.34
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/helpers.d.mts +12 -0
- package/dist/helpers.mjs +15 -0
- package/dist/interfaces.d.mts +5 -1
- package/dist/schema.d.mts +2 -2
- package/dist/schema.mjs +1 -1
- package/package.json +1 -1
- package/src/helpers.mts +18 -0
- package/src/interfaces.mts +10 -1
- package/src/schema.mts +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TFrequency } from "./schema.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @description combines the new frequency field and legacy is_recurring flag
|
|
4
|
+
* @param freq
|
|
5
|
+
* @param is_recurring legacy flag
|
|
6
|
+
*/
|
|
7
|
+
export declare const is_recurring: (freq?: TFrequency, is_recurring?: boolean) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @description combines legacy is_recurring flag to frequency
|
|
10
|
+
* @param is_recurring
|
|
11
|
+
*/
|
|
12
|
+
export declare const freq: (freq?: TFrequency, is_recurring?: boolean) => TFrequency;
|
package/dist/helpers.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description combines the new frequency field and legacy is_recurring flag
|
|
3
|
+
* @param freq
|
|
4
|
+
* @param is_recurring legacy flag
|
|
5
|
+
*/
|
|
6
|
+
export const is_recurring = (freq, is_recurring = false) => {
|
|
7
|
+
return freq ? freq !== "one-time" : is_recurring;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @description combines legacy is_recurring flag to frequency
|
|
11
|
+
* @param is_recurring
|
|
12
|
+
*/
|
|
13
|
+
export const freq = (freq, is_recurring = false) => {
|
|
14
|
+
return freq ?? (is_recurring ? "monthly" : "one-time");
|
|
15
|
+
};
|
package/dist/interfaces.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Environment } from "@better-giving/types/list";
|
|
2
|
-
import type { IAllocation, TDonationSource, TDonorTitle } from "./schema.mjs";
|
|
2
|
+
import type { IAllocation, TDonationSource, TDonorTitle, TFrequency } from "./schema.mjs";
|
|
3
3
|
interface IReferrerCommission {
|
|
4
4
|
from_tip: number;
|
|
5
5
|
from_fee: number;
|
|
@@ -46,7 +46,9 @@ export interface IDonationOnHoldAttr {
|
|
|
46
46
|
"USD", "TRX", "karate-295", "BRL", "GBP", "USDC", "JPY", "ETH", "USDCMATIC", "EUR", "INR", "THB", "PHP",
|
|
47
47
|
"XRP", "RUB", "CAD", "karate-1" ... */
|
|
48
48
|
denomination: string;
|
|
49
|
+
/** @legacy */
|
|
49
50
|
isRecurring?: boolean;
|
|
51
|
+
frequency?: TFrequency;
|
|
50
52
|
title?: TDonorTitle;
|
|
51
53
|
fullName: string;
|
|
52
54
|
/** may be empty */
|
|
@@ -167,7 +169,9 @@ export interface IDonationFinalAttr {
|
|
|
167
169
|
network?: Environment;
|
|
168
170
|
amount?: number;
|
|
169
171
|
usdValue?: number;
|
|
172
|
+
/** @legacy */
|
|
170
173
|
isRecurring?: boolean;
|
|
174
|
+
frequency?: TFrequency;
|
|
171
175
|
feeAllowance?: number;
|
|
172
176
|
/**
|
|
173
177
|
PHP", "UST", "USD", "LUNA", "ETH", "USDCMATIC", "axlUSDC", "LTC", undefined, "EUR", "NZD", "JUNO", "INR",
|
package/dist/schema.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
export declare const frequencies: readonly ["one-time", "
|
|
3
|
-
export declare const frequency: v.PicklistSchema<readonly ["one-time", "
|
|
2
|
+
export declare const frequencies: readonly ["one-time", "monthly", "weekly"];
|
|
3
|
+
export declare const frequency: v.PicklistSchema<readonly ["one-time", "monthly", "weekly"], "Please select donation frequency">;
|
|
4
4
|
export type TFrequency = v.InferOutput<typeof frequency>;
|
|
5
5
|
export declare const donation_sources: readonly ["bg-marketplace", "bg-widget"];
|
|
6
6
|
export declare const donation_source: v.PicklistSchema<readonly ["bg-marketplace", "bg-widget"], undefined>;
|
package/dist/schema.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $int_gte1 } from "@better-giving/schemas";
|
|
2
2
|
import { endOfDay, iso_date, startOfDay } from "@better-giving/schemas/date";
|
|
3
3
|
import * as v from "valibot";
|
|
4
|
-
export const frequencies = ["one-time", "
|
|
4
|
+
export const frequencies = ["one-time", "monthly", "weekly"];
|
|
5
5
|
export const frequency = v.picklist(frequencies, "Please select donation frequency");
|
|
6
6
|
export const donation_sources = ["bg-marketplace", "bg-widget"];
|
|
7
7
|
export const donation_source = v.picklist(donation_sources);
|
package/package.json
CHANGED
package/src/helpers.mts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TFrequency } from "./schema.mjs";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description combines the new frequency field and legacy is_recurring flag
|
|
5
|
+
* @param freq
|
|
6
|
+
* @param is_recurring legacy flag
|
|
7
|
+
*/
|
|
8
|
+
export const is_recurring = (freq?: TFrequency, is_recurring = false) => {
|
|
9
|
+
return freq ? freq !== "one-time" : is_recurring;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description combines legacy is_recurring flag to frequency
|
|
14
|
+
* @param is_recurring
|
|
15
|
+
*/
|
|
16
|
+
export const freq = (freq?: TFrequency, is_recurring = false): TFrequency => {
|
|
17
|
+
return freq ?? (is_recurring ? "monthly" : "one-time");
|
|
18
|
+
};
|
package/src/interfaces.mts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { Environment } from "@better-giving/types/list";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
IAllocation,
|
|
4
|
+
TDonationSource,
|
|
5
|
+
TDonorTitle,
|
|
6
|
+
TFrequency,
|
|
7
|
+
} from "./schema.mjs";
|
|
3
8
|
|
|
4
9
|
interface IReferrerCommission {
|
|
5
10
|
from_tip: number;
|
|
@@ -53,7 +58,9 @@ export interface IDonationOnHoldAttr {
|
|
|
53
58
|
"USD", "TRX", "karate-295", "BRL", "GBP", "USDC", "JPY", "ETH", "USDCMATIC", "EUR", "INR", "THB", "PHP",
|
|
54
59
|
"XRP", "RUB", "CAD", "karate-1" ... */
|
|
55
60
|
denomination: string;
|
|
61
|
+
/** @legacy */
|
|
56
62
|
isRecurring?: boolean;
|
|
63
|
+
frequency?: TFrequency;
|
|
57
64
|
|
|
58
65
|
/// FROM ///
|
|
59
66
|
title?: TDonorTitle;
|
|
@@ -187,7 +194,9 @@ export interface IDonationFinalAttr {
|
|
|
187
194
|
network?: Environment;
|
|
188
195
|
amount?: number;
|
|
189
196
|
usdValue?: number;
|
|
197
|
+
/** @legacy */
|
|
190
198
|
isRecurring?: boolean;
|
|
199
|
+
frequency?: TFrequency;
|
|
191
200
|
feeAllowance?: number;
|
|
192
201
|
/**
|
|
193
202
|
PHP", "UST", "USD", "LUNA", "ETH", "USDCMATIC", "axlUSDC", "LTC", undefined, "EUR", "NZD", "JUNO", "INR",
|
package/src/schema.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $int_gte1 } from "@better-giving/schemas";
|
|
2
2
|
import { endOfDay, iso_date, startOfDay } from "@better-giving/schemas/date";
|
|
3
3
|
import * as v from "valibot";
|
|
4
|
-
export const frequencies = ["one-time", "
|
|
4
|
+
export const frequencies = ["one-time", "monthly", "weekly"] as const;
|
|
5
5
|
export const frequency = v.picklist(
|
|
6
6
|
frequencies,
|
|
7
7
|
"Please select donation frequency"
|