This repository has been archived by the owner on Mar 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
window.d.ts
147 lines (137 loc) · 4.17 KB
/
window.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import * as EventEmitter from 'eventemitter3';
import * as I18n from 'i18n-js';
import { Store } from 'redux';
import { Fundraiser } from './plugins/fundraiser';
import { Petition } from './plugins/petition';
import Plugin, { IPluginConfig } from './plugins/plugin';
import { IReCaptchaInstance } from './shared/recaptcha';
import { IAppState, IFormField } from './types';
declare global {
// tslint:disable-next-line:interface-name
interface Window {
grecaptcha?: IReCaptchaInstance;
champaign: IChampaignGlobalObject;
I18n: II18n & typeof I18n;
store: Store<any>;
ee: EventEmitter;
}
}
interface IChampaignGlobalObject {
configuration: {
environment: string;
defaultCurrency: string;
recaptcha3: {
siteKey: string;
};
[key: string]: any;
};
page: IChampaignPage;
personalization: {
location: IChampaignLocation;
member: Partial<IChampaignMember>;
paymentMethods: any[];
outstandingFields: any[];
formValues?: { [key: string]: string };
donationBands?: { [currency: string]: number[] };
urlParams: { [key: string]: string };
};
plugins: IChampaignPagePlugins;
store?: Store<IAppState>;
}
interface IChampaignPagePlugins {
actions_thermometer?: IChampaignPluginData<IPluginConfig, Plugin<any>>;
call_tool?: IChampaignPluginData<IPluginConfig, Plugin<any>>;
donations_thermometer?: IChampaignPluginData<IPluginConfig, Plugin<any>>;
email_pension?: IChampaignPluginData<IPluginConfig, Plugin<any>>;
email_tool?: IChampaignPluginData<IPluginConfig, Plugin<any>>;
email?: IChampaignPluginData<IPluginConfig, Plugin<any>>;
fundraiser?: IChampaignPluginData<IFundraiserPluginConfig, Fundraiser>;
petition?: IChampaignPluginData<IPetitionPluginConfig, Petition>;
survey?: IChampaignPluginData<IPluginConfig, Plugin<any>>;
text?: IChampaignPluginData<IPluginConfig, Plugin<any>>;
}
interface IChampaignPluginData<T, M> {
[ref: string]: {
config: T;
instance?: M;
customRenderer?: (instance: M) => void;
};
}
interface IPetitionPluginConfig extends IPluginConfig {
cta: string;
description: string;
form_id: number;
outstanding_fields: string[];
target: string;
fields: IFormField[];
}
interface IFundraiserPluginConfig extends IPluginConfig {
description: string;
donation_band_id: number | null | undefined;
donation_bands: { [currency: string]: number[] };
fields: IFormField[];
form_id: number;
outstanding_fields: string[];
preselect_amount: boolean;
recurring_default: string;
title: string;
}
interface IDonationsThermometerPluginConfig extends IPluginConfig {
offset: number;
title: string;
percentage: number;
total_donations: number;
goals: { [k: string]: number };
}
interface IChampaignMember {
id: number;
email: string;
country: string;
consented: boolean | null | undefined;
consented_updated_at: string | null | undefined;
name: string;
first_name: string;
last_name: string;
full_name: string;
welcome_name: string;
postal: string;
actionkit_user_id: string | null | undefined;
donor_status: string;
registered: boolean;
created_at: string;
updated_at: string;
}
export interface IChampaignLocation {
readonly country?: string;
readonly country_code?: string;
readonly country_name?: string;
readonly currency?: string;
readonly ip?: string;
readonly latitude?: string;
readonly longitude?: string;
}
export interface IChampaignPage {
readonly action_count: number;
readonly allow_duplicate_actions: boolean;
readonly canonical_url: string;
readonly created_at: string;
readonly featured: boolean;
readonly follow_up_page_id: number;
readonly follow_up_plan: 'with_liquid' | 'with_page';
readonly id: number;
readonly language_id: number;
readonly optimizely_status: 'optimizely_disabled' | 'optimizely_enabled';
readonly primary_image_id: number;
readonly publish_status: string;
readonly slug: string;
readonly status: string;
readonly title: string;
readonly updated_at: string;
readonly ak_donation_resource_uri?: string;
readonly ak_petition_resource_uri?: string;
readonly campaign_id?: number;
readonly follow_up_liquid_layout_id?: number;
}
interface II18n {
lookup(key: string): string;
}