PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / Donors / resources / utils.ts

utils.ts in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Donors/resources/utils.ts

38 lines 952 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useEntityRecord } from '@wordpress/core-data';
2 import {Donor} from '@givewp/donors/admin/components/types';
3 import type {GiveDonorOptions} from '@givewp/donors/types';
4
5 declare const window: {
6 GiveDonorOptions: GiveDonorOptions;
7 } & Window;
8
9 /**
10 * @since 4.4.0
11 */
12 export function useDonorEntityRecord(donorId?: number) {
13 const urlParams = new URLSearchParams(window.location.search);
14
15 const {
16 record: donor,
17 hasResolved,
18 isResolving,
19 save,
20 edit,
21 }: {
22 record: Donor;
23 hasResolved: boolean;
24 isResolving: boolean;
25 save: () => any;
26 edit: (data: Donor | Partial<Donor>) => void;
27 } = useEntityRecord('givewp', 'donor', donorId ?? urlParams.get('id'));
28
29 return {record: donor, hasResolved, isResolving, save, edit};
30 }
31
32 /**
33 * @since 4.4.0
34 */
35 export function getDonorOptionsWindowData(): GiveDonorOptions {
36 return window.GiveDonorOptions;
37 }
38