@lacagnottedesproches/lcdp-js-lite 1.12.1 → 1.13.0

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.
Files changed (2) hide show
  1. package/dist/types.d.ts +51 -0
  2. package/package.json +2 -2
package/dist/types.d.ts CHANGED
@@ -177,6 +177,34 @@ export interface PayloadDonation extends DataDonation {
177
177
  amount_donation: number;
178
178
  amount_tip: number;
179
179
  }
180
+ /**
181
+ * Donor edit of a donation, sent to `updateDonation`. `token` is the edit
182
+ * token from the link v4 puts in the donation email. Only the fields you set
183
+ * are changed; `message: null` clears the message.
184
+ */
185
+ export interface PayloadDonationUpdate {
186
+ token: string;
187
+ first_name?: string | undefined;
188
+ message?: string | null | undefined;
189
+ stay_anonymous_checked?: boolean | undefined;
190
+ hide_amount_donation_checked?: boolean | undefined;
191
+ private_message_checked?: boolean | undefined;
192
+ }
193
+ /**
194
+ * Current values of a donation for the donor edit form, from `getDonationForEdit`.
195
+ * `first_name` and `message` are the real values, even for an anonymous
196
+ * donation or a private message.
197
+ */
198
+ export interface DonationForEdit {
199
+ id: UUID;
200
+ first_name: string | null;
201
+ message: string | null;
202
+ stay_anonymous_checked: boolean;
203
+ hide_amount_donation_checked: boolean;
204
+ private_message_checked: boolean;
205
+ pot_id: UUID;
206
+ pot_name: string;
207
+ }
180
208
  export interface DonationResult {
181
209
  error?: string;
182
210
  status: string | "requires_action";
@@ -246,6 +274,25 @@ export interface StatsPot {
246
274
  amount_tips?: number;
247
275
  amount_real_tips?: number;
248
276
  }
277
+ /**
278
+ * Public view of a donation in a pot donations list. The API already hides
279
+ * what the donor chose to hide: names are null when anonymous, the amount
280
+ * is null when hidden, the message is null when private.
281
+ */
282
+ export interface PotDonation {
283
+ id: UUID;
284
+ date_created_ts: number;
285
+ amount_donation: number | null;
286
+ stay_anonymous_checked: boolean;
287
+ hide_amount_donation_checked: boolean;
288
+ private_message_checked: boolean;
289
+ message: string | null;
290
+ first_name: string | null;
291
+ last_name: string | null;
292
+ }
293
+ export interface PotDonationsPagination extends Pagination {
294
+ items: PotDonation[];
295
+ }
249
296
  export interface StatsPotsPagination extends Pagination {
250
297
  items: StatsPot[];
251
298
  }
@@ -303,10 +350,14 @@ export interface LCDP {
303
350
  createTokenPersonVerification: (payload: PayloadVerification) => Promise<ExternalTokenObject>;
304
351
  createTokenAccountBank(payload: PayloadAccountBank): Promise<ExternalTokenObject>;
305
352
  createDonation: (payload: PayloadDonation) => Promise<DonationResult>;
353
+ /** `getDonationForEdit` and `updateDonation` need SDK 1.7.0 or later. */
354
+ getDonationForEdit: (token: string) => Promise<DonationForEdit>;
355
+ updateDonation: (donationId: string, payload: PayloadDonationUpdate) => Promise<void>;
306
356
  getAvailableCountries: () => Promise<Country[]>;
307
357
  getCategories: () => Promise<Category[]>;
308
358
  getPots: (params?: ParamsPagination) => Promise<PotsPagination>;
309
359
  getPot: (potId: string) => Promise<Pot>;
360
+ getPotDonations: (potId: string, params?: ParamsPagination) => Promise<PotDonationsPagination>;
310
361
  getStatsDashboard: (ts_start?: number, ts_end?: number) => Promise<StatDashboard>;
311
362
  getStatsPots: (ts_start?: number, ts_end?: number, page?: number, per_page?: number) => Promise<StatsPotsPagination>;
312
363
  retrieveAssociations: (payload?: PayloadQueryAssociations) => Promise<Associations>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacagnottedesproches/lcdp-js-lite",
3
- "version": "1.12.1",
3
+ "version": "1.13.0",
4
4
  "description": "LCDP JS Lite",
5
5
  "scripts": {
6
6
  "build": "rm -rf dist/ && rollup -c",
@@ -16,7 +16,7 @@
16
16
  "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
17
17
  "test:update-snapshots": "jest --updateSnapshot",
18
18
  "test:clear-cache": "jest --clearCache",
19
- "docs": "typedoc src/index.ts --out docs"
19
+ "docs": "typedoc"
20
20
  },
21
21
  "main": "dist/index.js",
22
22
  "module": "dist/index.mjs",