@deriv-com/analytics 1.35.1 → 1.37.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.
- package/README.md +853 -72
- package/dist/browser/analytics.bundle.global.js +23 -0
- package/dist/browser/analytics.bundle.global.js.map +1 -0
- package/dist/browser/analytics.esm.mjs +9 -0
- package/dist/browser/analytics.esm.mjs.map +1 -0
- package/dist/chunk-2P7RWD3W.mjs +3 -0
- package/dist/chunk-2P7RWD3W.mjs.map +1 -0
- package/dist/chunk-3LFZFQL4.mjs +3 -0
- package/dist/chunk-3LFZFQL4.mjs.map +1 -0
- package/dist/chunk-DNCZM4KN.mjs +4 -0
- package/dist/chunk-DNCZM4KN.mjs.map +1 -0
- package/dist/chunk-EMF3RT6E.mjs +14 -0
- package/dist/chunk-EMF3RT6E.mjs.map +1 -0
- package/dist/chunk-HQX3Z7PF.mjs +3 -0
- package/dist/chunk-HQX3Z7PF.mjs.map +1 -0
- package/dist/chunk-LKLVBL24.js +3 -0
- package/dist/chunk-LKLVBL24.js.map +1 -0
- package/dist/chunk-NOEKD4DT.js +4 -0
- package/dist/chunk-NOEKD4DT.js.map +1 -0
- package/dist/chunk-TLPR24DO.js +3 -0
- package/dist/chunk-TLPR24DO.js.map +1 -0
- package/dist/growthbook-NJGOOJH4.mjs +3 -0
- package/dist/growthbook-NJGOOJH4.mjs.map +1 -0
- package/dist/index.d.mts +114 -0
- package/dist/index.d.ts +114 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/metafile-iife.json +1 -0
- package/dist/posthog-CY-D6TZM.d.mts +90 -0
- package/dist/posthog-D--oI2Yn.d.ts +90 -0
- package/dist/posthog-OIC32FZG.mjs +6 -0
- package/dist/posthog-OIC32FZG.mjs.map +1 -0
- package/dist/providers/growthbook/index.d.mts +73 -0
- package/dist/providers/growthbook/index.d.ts +73 -0
- package/dist/providers/growthbook/index.js +3 -0
- package/dist/providers/growthbook/index.js.map +1 -0
- package/dist/providers/growthbook/index.mjs +3 -0
- package/dist/providers/growthbook/index.mjs.map +1 -0
- package/dist/providers/posthog/index.d.mts +3 -0
- package/dist/providers/posthog/index.d.ts +3 -0
- package/dist/providers/posthog/index.js +3 -0
- package/dist/providers/posthog/index.js.map +1 -0
- package/dist/providers/posthog/index.mjs +3 -0
- package/dist/providers/posthog/index.mjs.map +1 -0
- package/dist/providers/rudderstack/index.d.mts +73 -0
- package/dist/providers/rudderstack/index.d.ts +73 -0
- package/dist/providers/rudderstack/index.js +2 -0
- package/dist/providers/rudderstack/index.js.map +1 -0
- package/dist/providers/rudderstack/index.mjs +2 -0
- package/dist/providers/rudderstack/index.mjs.map +1 -0
- package/{lib/types.d.ts → dist/types-DoMejCXv.d.mts} +18 -29
- package/dist/types-DoMejCXv.d.ts +361 -0
- package/dist/utils/analytics-cache/index.d.mts +138 -0
- package/dist/utils/analytics-cache/index.d.ts +138 -0
- package/dist/utils/analytics-cache/index.js +2 -0
- package/dist/utils/analytics-cache/index.js.map +1 -0
- package/dist/utils/analytics-cache/index.mjs +2 -0
- package/dist/utils/analytics-cache/index.mjs.map +1 -0
- package/package.json +97 -68
- package/dist/analytics.bundle.js +0 -1
- package/lib/analytics.d.ts +0 -66
- package/lib/analytics.js +0 -418
- package/lib/growthbook.d.ts +0 -29
- package/lib/growthbook.js +0 -144
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -5
- package/lib/posthog.d.ts +0 -28
- package/lib/posthog.js +0 -154
- package/lib/rudderstack.d.ts +0 -23
- package/lib/rudderstack.js +0 -100
- package/lib/types.js +0 -2
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
define: any;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
type TCoreAttributes = {
|
|
7
|
+
account_type?: string;
|
|
8
|
+
user_id?: string;
|
|
9
|
+
anonymous_id?: string;
|
|
10
|
+
app_id?: string;
|
|
11
|
+
user_identity?: string;
|
|
12
|
+
country?: string;
|
|
13
|
+
user_language?: string;
|
|
14
|
+
device_language?: string;
|
|
15
|
+
device_type?: string;
|
|
16
|
+
utm_source?: string;
|
|
17
|
+
utm_medium?: 'ppc-native' | 'affiliate' | 'common' | string;
|
|
18
|
+
utm_campaign?: string;
|
|
19
|
+
is_authorised?: boolean;
|
|
20
|
+
url?: string;
|
|
21
|
+
domain?: string;
|
|
22
|
+
utm_content?: string;
|
|
23
|
+
residence_country?: string;
|
|
24
|
+
geo_location?: string;
|
|
25
|
+
email_hash?: string;
|
|
26
|
+
network_type?: string;
|
|
27
|
+
network_rtt?: number;
|
|
28
|
+
network_downlink?: number;
|
|
29
|
+
account_currency?: string;
|
|
30
|
+
loggedIn?: boolean;
|
|
31
|
+
account_mode?: string;
|
|
32
|
+
};
|
|
33
|
+
type SignupProvider = 'email' | 'phone' | 'google' | 'facebook' | 'apple';
|
|
34
|
+
type VirtualSignupForm = {
|
|
35
|
+
action?: 'open' | 'started' | 'email_confirmation_sent' | 'email_confirmed' | 'country_selection_screen_opened' | 'password_screen_opened' | 'signup_done' | 'signup_flow_error' | 'go_to_login' | 'signup_modal_open' | 'signup_modal_close';
|
|
36
|
+
signup_provider?: SignupProvider;
|
|
37
|
+
form_source?: string;
|
|
38
|
+
form_name?: string;
|
|
39
|
+
error_message?: string;
|
|
40
|
+
email?: string;
|
|
41
|
+
app_id?: string;
|
|
42
|
+
};
|
|
43
|
+
type EmailVerificationForm = {
|
|
44
|
+
action?: 'verify_popup_opened' | 'verify_popup_closed' | 'verify_popup_cta' | 'email_verification_sent' | 'email_verification_opened' | 'success_popup_opened' | 'success_popup_closed' | 'success_popup_cta';
|
|
45
|
+
form_source?: 'ce_tradershub_real_form' | 'ce_virtual_signup_form' | 'account_setting';
|
|
46
|
+
form_name?: string;
|
|
47
|
+
app_id?: string;
|
|
48
|
+
};
|
|
49
|
+
type RealAccountSignupForm = {
|
|
50
|
+
action?: 'open' | 'step_passed' | 'save' | 'restore' | 'close' | 'real_signup_error' | 'other_error' | 'real_signup_finished';
|
|
51
|
+
step_codename?: string;
|
|
52
|
+
step_num?: number;
|
|
53
|
+
user_choice?: string;
|
|
54
|
+
form_source?: string;
|
|
55
|
+
form_name?: string;
|
|
56
|
+
real_signup_error_message?: string;
|
|
57
|
+
landing_company?: string;
|
|
58
|
+
};
|
|
59
|
+
type RealAccountSignupIdentifyForm = {
|
|
60
|
+
action?: 'open' | 'step_passed' | 'step_back' | 'save' | 'close' | 'real_signup_error' | 'other_error' | 'real_signup_finished';
|
|
61
|
+
step_codename?: string;
|
|
62
|
+
step_num?: string;
|
|
63
|
+
user_choice?: string;
|
|
64
|
+
form_source?: string;
|
|
65
|
+
form_name?: string;
|
|
66
|
+
real_signup_error_message?: string;
|
|
67
|
+
landing_company?: string;
|
|
68
|
+
};
|
|
69
|
+
type LoginForm = {
|
|
70
|
+
action: 'open' | 'login_cta' | 'go_to_forgot' | 'email_reset_password_sent' | 'email_reset_password_opened' | 'reset_password_continued' | 'reset_password_done' | 'login_flow_error' | 'go_to_signup';
|
|
71
|
+
login_provider?: 'email' | 'phone' | 'google' | 'facebook' | 'apple';
|
|
72
|
+
form_source?: 'virtual_signup_form' | 'deriv.com (log in CTA)' | 'mobile_derivGo' | string;
|
|
73
|
+
error_message?: string;
|
|
74
|
+
email?: string;
|
|
75
|
+
};
|
|
76
|
+
type QuestionnaireForm = {
|
|
77
|
+
action: 'open' | 'choose_answer' | 'close';
|
|
78
|
+
question_code?: string;
|
|
79
|
+
question_content?: string;
|
|
80
|
+
answer_code?: string;
|
|
81
|
+
};
|
|
82
|
+
type PartnerAccountSignupForm = {
|
|
83
|
+
action: 'open_wizard';
|
|
84
|
+
email: string;
|
|
85
|
+
} | {
|
|
86
|
+
action: 'step_passed';
|
|
87
|
+
step_num: number;
|
|
88
|
+
step_codename: string;
|
|
89
|
+
} | {
|
|
90
|
+
action: 'step_back';
|
|
91
|
+
step_num: number;
|
|
92
|
+
step_codename: string;
|
|
93
|
+
} | {
|
|
94
|
+
action: 'push_learn_more';
|
|
95
|
+
} | {
|
|
96
|
+
action: 'close_wizard';
|
|
97
|
+
} | {
|
|
98
|
+
action: 'partners_signup_error';
|
|
99
|
+
partner_signup_error_message: string;
|
|
100
|
+
form_name?: string;
|
|
101
|
+
} | {
|
|
102
|
+
action: 'other_error';
|
|
103
|
+
partner_signup_error_message?: string;
|
|
104
|
+
} | {
|
|
105
|
+
action: 'try_submit';
|
|
106
|
+
} | {
|
|
107
|
+
action: 'failed_popup_cta';
|
|
108
|
+
} | {
|
|
109
|
+
action: 'success_popup_opened';
|
|
110
|
+
user_choice: string;
|
|
111
|
+
success_source: string;
|
|
112
|
+
affiliate_id: string;
|
|
113
|
+
} | {
|
|
114
|
+
action: 'success_popup_cta';
|
|
115
|
+
};
|
|
116
|
+
type VirtualSignupEmailConfirmation = {
|
|
117
|
+
action?: 'received' | 'expired' | 'confirmed' | 'error';
|
|
118
|
+
signup_provider?: SignupProvider;
|
|
119
|
+
form_source?: string;
|
|
120
|
+
email_md5?: string;
|
|
121
|
+
error_message?: string;
|
|
122
|
+
};
|
|
123
|
+
type TradeTypesForm = {
|
|
124
|
+
action?: 'open' | 'close' | 'choose_trade_type' | 'search' | 'info_open' | 'info_switcher' | 'info_close';
|
|
125
|
+
trade_type_name?: string;
|
|
126
|
+
tab_name?: string;
|
|
127
|
+
search_string?: string;
|
|
128
|
+
info_switcher_mode?: 'description' | 'glossary';
|
|
129
|
+
form_source?: string;
|
|
130
|
+
form_name?: string;
|
|
131
|
+
subform_name?: string;
|
|
132
|
+
};
|
|
133
|
+
type BotForm = {
|
|
134
|
+
action?: 'open' | 'close' | 'search' | 'run_bot' | 'run_quick_strategy' | 'edit_quick_strategy' | 'select_quick_strategy_guide' | 'switch_quick_strategy_tab' | 'choose_strategy_type';
|
|
135
|
+
form_name?: 'ce_bot_form';
|
|
136
|
+
subpage_source?: 'dashboard' | 'bot_builder';
|
|
137
|
+
subpage_name?: 'tutorials' | 'bot_builder' | 'charts' | 'dashboard';
|
|
138
|
+
subform_name?: 'quick_strategy';
|
|
139
|
+
subform_source?: 'dashboard' | 'bot_builder';
|
|
140
|
+
quick_strategy_tab?: 'learn more' | 'trade parameters';
|
|
141
|
+
strategy_name?: `d'alembert` | `martingale` | `oscar's-grind` | `reverse martingale` | `reverse d'alembert` | `1-3-2-6`;
|
|
142
|
+
strategy_type?: 'custom' | 'quick_strategy';
|
|
143
|
+
search_term?: string;
|
|
144
|
+
asset?: string;
|
|
145
|
+
trade_type?: string;
|
|
146
|
+
purchase_condition?: string;
|
|
147
|
+
initial_stake?: string;
|
|
148
|
+
};
|
|
149
|
+
type IndicatorsTypesFormAction = {
|
|
150
|
+
action: 'open' | 'close' | 'add_active' | 'clean_all_active' | 'delete_active' | 'edit_active' | 'search' | 'info_open' | 'info_close';
|
|
151
|
+
form_name?: string;
|
|
152
|
+
indicator_type_name?: string;
|
|
153
|
+
indicators_category_name?: string;
|
|
154
|
+
search_string?: string;
|
|
155
|
+
subform_name?: string;
|
|
156
|
+
};
|
|
157
|
+
type DrawingToolsTypesFormAction = {
|
|
158
|
+
action: 'open' | 'add' | 'delete' | 'edit_px' | 'edit_color';
|
|
159
|
+
form_name?: string;
|
|
160
|
+
drawing_tool_name?: string;
|
|
161
|
+
pxthickness?: string;
|
|
162
|
+
color_name?: string;
|
|
163
|
+
};
|
|
164
|
+
type CrossHairFormAction = {
|
|
165
|
+
action: 'click';
|
|
166
|
+
form_name?: string;
|
|
167
|
+
cta_name?: 'enable' | 'disable';
|
|
168
|
+
};
|
|
169
|
+
type MarketTypesFormAction = {
|
|
170
|
+
action: 'open' | 'close' | 'choose_market_type' | 'search' | 'info_redirect' | 'add_to_favorites' | 'delete_from_favorites';
|
|
171
|
+
form_name?: string;
|
|
172
|
+
market_type_name?: string;
|
|
173
|
+
search_string?: string;
|
|
174
|
+
tab_market_name?: string;
|
|
175
|
+
};
|
|
176
|
+
type ReportsFormAction = {
|
|
177
|
+
action: 'choose_report_type';
|
|
178
|
+
form_name: string;
|
|
179
|
+
subform_name: 'open_positions_form' | 'statement_form' | 'trade_table_form';
|
|
180
|
+
trade_type_filter?: string;
|
|
181
|
+
growth_type_filter?: string;
|
|
182
|
+
start_date_filter?: string;
|
|
183
|
+
end_date_filter?: string;
|
|
184
|
+
transaction_type_filter?: string;
|
|
185
|
+
} | {
|
|
186
|
+
action: 'filter_trade_type';
|
|
187
|
+
form_name: string;
|
|
188
|
+
subform_name: 'open_positions_form';
|
|
189
|
+
trade_type_filter: string;
|
|
190
|
+
} | {
|
|
191
|
+
action: 'filter_growth_rate';
|
|
192
|
+
form_name: string;
|
|
193
|
+
subform_name: 'open_positions_form';
|
|
194
|
+
growth_type_filter: string;
|
|
195
|
+
} | {
|
|
196
|
+
action: 'filter_dates';
|
|
197
|
+
form_name: string;
|
|
198
|
+
subform_name: 'trade_table_form' | 'statement_form';
|
|
199
|
+
start_date_filter?: string;
|
|
200
|
+
end_date_filter?: string;
|
|
201
|
+
} | {
|
|
202
|
+
action: 'filter_transaction_type';
|
|
203
|
+
form_name: string;
|
|
204
|
+
subform_name: 'statement_form';
|
|
205
|
+
transaction_type_filter: string;
|
|
206
|
+
} | {
|
|
207
|
+
action: 'open';
|
|
208
|
+
form_name: string;
|
|
209
|
+
subform_name: string;
|
|
210
|
+
form_source: string;
|
|
211
|
+
} | {
|
|
212
|
+
action: 'close';
|
|
213
|
+
form_name: string;
|
|
214
|
+
subform_name: string;
|
|
215
|
+
} | {
|
|
216
|
+
action: 'open_contract_details';
|
|
217
|
+
form_name: string;
|
|
218
|
+
form_source: string;
|
|
219
|
+
};
|
|
220
|
+
type ChartTypesFormAction = {
|
|
221
|
+
action?: 'open' | 'close' | 'choose_chart_type' | 'choose_time_interval' | 'switch_toggle';
|
|
222
|
+
form_name?: string;
|
|
223
|
+
chart_type_name?: string;
|
|
224
|
+
time_interval_name?: string;
|
|
225
|
+
};
|
|
226
|
+
type ContractsSetupForm = {
|
|
227
|
+
form_name?: string;
|
|
228
|
+
trade_type_name?: string;
|
|
229
|
+
} & ({
|
|
230
|
+
action: 'change_parameter_value';
|
|
231
|
+
duration_type?: string;
|
|
232
|
+
input_type?: string;
|
|
233
|
+
parameter_field_type?: string;
|
|
234
|
+
parameter_type?: string;
|
|
235
|
+
parameter_value?: string;
|
|
236
|
+
} | {
|
|
237
|
+
action: 'run_contract';
|
|
238
|
+
switcher_duration_mode_name?: string;
|
|
239
|
+
switcher_stakepayout_mode_name?: string;
|
|
240
|
+
market_name?: string;
|
|
241
|
+
trade_name?: string;
|
|
242
|
+
contract_id?: number;
|
|
243
|
+
});
|
|
244
|
+
type TradersHubOnboardingFormAction = {
|
|
245
|
+
action?: 'open' | 'close' | 'step_passed' | 'step_back' | 'choose_step_navigation';
|
|
246
|
+
form_source?: 'tradershub_dashboard_form' | 'tradershub_first_entrance' | 'repeat_tour';
|
|
247
|
+
step_num?: number;
|
|
248
|
+
step_codename?: string;
|
|
249
|
+
};
|
|
250
|
+
type UpgradeMT5BannerAction = {
|
|
251
|
+
action: 'open' | 'push_cta_upgrade';
|
|
252
|
+
};
|
|
253
|
+
type TradersHubDashboardFormAction = {
|
|
254
|
+
action?: 'open' | 'close' | 'switch_account_mode' | 'account_open' | 'account_get' | 'account_logo_push' | 'reset_balance' | 'deposit_balance' | 'compare_accounts_push';
|
|
255
|
+
account_mode?: string;
|
|
256
|
+
account_name?: string;
|
|
257
|
+
form_name?: string;
|
|
258
|
+
};
|
|
259
|
+
type PassKeyAccountSettingsFormAction = {
|
|
260
|
+
action?: 'open' | 'close' | 'info_open' | 'info_back' | 'create_passkey_started' | 'create_passkey_reminder_passed' | 'create_passkey_finished' | 'create_passkey_continue_trading' | 'error' | 'add_more_passkeys' | 'passkey_rename_started' | 'passkey_rename_back' | 'passkey_rename_success' | 'passkey_remove_started' | 'passkey_remove_success';
|
|
261
|
+
form_name?: string;
|
|
262
|
+
subform_name?: string;
|
|
263
|
+
remove_verification_provider?: string;
|
|
264
|
+
error_message?: string;
|
|
265
|
+
operating_system?: string;
|
|
266
|
+
};
|
|
267
|
+
type TradersHubPopUpAction = {
|
|
268
|
+
action?: 'open' | 'close' | 'click_download' | 'click_cta';
|
|
269
|
+
form_name?: string;
|
|
270
|
+
account_mode?: string;
|
|
271
|
+
popup_name?: string;
|
|
272
|
+
popup_type?: string;
|
|
273
|
+
};
|
|
274
|
+
type TradersHubBanner = {
|
|
275
|
+
action?: 'open' | 'close' | 'click download' | 'click_cta';
|
|
276
|
+
form_name?: string;
|
|
277
|
+
account_mode?: string;
|
|
278
|
+
banner_name?: string;
|
|
279
|
+
banner_type?: string;
|
|
280
|
+
};
|
|
281
|
+
type WalletsHomepageFormAction = {
|
|
282
|
+
action?: 'open';
|
|
283
|
+
form_name?: string;
|
|
284
|
+
};
|
|
285
|
+
type TNotificationsTrayForm = {
|
|
286
|
+
action?: 'clear_all' | 'click_cta' | 'close' | 'open';
|
|
287
|
+
form_name?: 'ce_notification_form';
|
|
288
|
+
notification_num?: number;
|
|
289
|
+
notification_key?: string;
|
|
290
|
+
};
|
|
291
|
+
type TCashierDepositOnboardingFormAction = {
|
|
292
|
+
action?: 'open' | 'open_deposit_subpage' | 'click_deposit_card' | 'click_copy_crypto_address';
|
|
293
|
+
form_name?: 'ce_cashier_deposit_onboarding_form';
|
|
294
|
+
currency?: string;
|
|
295
|
+
deposit_category?: string;
|
|
296
|
+
login_id?: string;
|
|
297
|
+
};
|
|
298
|
+
type TDtraderTradeForm = {
|
|
299
|
+
action?: 'open' | 'select_trade_type' | 'select_market_type' | 'open_guide' | 'run_contract' | 'close_contract';
|
|
300
|
+
trade_name?: string;
|
|
301
|
+
market_name?: string;
|
|
302
|
+
subform_name?: string;
|
|
303
|
+
trade_type_count?: number;
|
|
304
|
+
contract_id?: number;
|
|
305
|
+
};
|
|
306
|
+
type TEvents = {
|
|
307
|
+
ce_virtual_signup_form: VirtualSignupForm;
|
|
308
|
+
ce_email_verification_form: EmailVerificationForm;
|
|
309
|
+
ce_real_account_signup_form: RealAccountSignupForm;
|
|
310
|
+
ce_real_account_signup_setup_form: RealAccountSignupForm;
|
|
311
|
+
ce_real_account_signup_identity_form: RealAccountSignupIdentifyForm;
|
|
312
|
+
ce_login_form: LoginForm;
|
|
313
|
+
ce_questionnaire_form: QuestionnaireForm;
|
|
314
|
+
ce_partner_account_signup_form: PartnerAccountSignupForm;
|
|
315
|
+
ce_virtual_signup_email_confirmation: VirtualSignupEmailConfirmation;
|
|
316
|
+
ce_bot_form: BotForm;
|
|
317
|
+
ce_contracts_set_up_form: ContractsSetupForm;
|
|
318
|
+
ce_indicators_types_form: IndicatorsTypesFormAction;
|
|
319
|
+
ce_drawing_tools_form: DrawingToolsTypesFormAction;
|
|
320
|
+
ce_crosshair: CrossHairFormAction;
|
|
321
|
+
ce_trade_types_form: TradeTypesForm;
|
|
322
|
+
ce_chart_types_form: ChartTypesFormAction;
|
|
323
|
+
ce_market_types_form: MarketTypesFormAction;
|
|
324
|
+
ce_reports_form: ReportsFormAction;
|
|
325
|
+
ce_tradershub_onboarding_form: TradersHubOnboardingFormAction;
|
|
326
|
+
ce_upgrade_mt5_banner: UpgradeMT5BannerAction;
|
|
327
|
+
ce_tradershub_dashboard_form: TradersHubDashboardFormAction;
|
|
328
|
+
ce_passkey_account_settings_form: PassKeyAccountSettingsFormAction;
|
|
329
|
+
ce_tradershub_popup: TradersHubPopUpAction;
|
|
330
|
+
ce_tradershub_banner: TradersHubBanner;
|
|
331
|
+
ce_wallets_homepage_form: WalletsHomepageFormAction;
|
|
332
|
+
ce_notification_form: TNotificationsTrayForm;
|
|
333
|
+
ce_cashier_deposit_onboarding_form: TCashierDepositOnboardingFormAction;
|
|
334
|
+
ce_dtrader_trade_form: TDtraderTradeForm;
|
|
335
|
+
};
|
|
336
|
+
type TCtaInformation = {
|
|
337
|
+
cta_name: string;
|
|
338
|
+
section_name?: string;
|
|
339
|
+
container_name?: string;
|
|
340
|
+
};
|
|
341
|
+
type TErrorInformation = {
|
|
342
|
+
error_message: string;
|
|
343
|
+
error_code?: string;
|
|
344
|
+
};
|
|
345
|
+
type TV2EventMetadata = {
|
|
346
|
+
page_name?: string;
|
|
347
|
+
marketing_data?: Record<string, any>;
|
|
348
|
+
} & Partial<TCoreAttributes>;
|
|
349
|
+
type TV2EventPayload = {
|
|
350
|
+
action: string;
|
|
351
|
+
form_name?: string;
|
|
352
|
+
cta_information?: TCtaInformation | null;
|
|
353
|
+
error?: TErrorInformation | null;
|
|
354
|
+
event_metadata: TV2EventMetadata;
|
|
355
|
+
};
|
|
356
|
+
type TEventsV2 = {
|
|
357
|
+
ce_get_start_page: TV2EventPayload;
|
|
358
|
+
};
|
|
359
|
+
type TAllEvents = TEvents & TEventsV2;
|
|
360
|
+
|
|
361
|
+
export type { TCoreAttributes as T, TAllEvents as a, TEvents as b };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics Cache Manager - Version 1.1.0
|
|
3
|
+
* Enhanced TypeScript implementation with better type safety and SSR support
|
|
4
|
+
*/
|
|
5
|
+
type CachedEvent = {
|
|
6
|
+
name: string;
|
|
7
|
+
properties: Record<string, any>;
|
|
8
|
+
};
|
|
9
|
+
type EventListenerConfig = {
|
|
10
|
+
element: Element | NodeList | string;
|
|
11
|
+
event: {
|
|
12
|
+
name: string;
|
|
13
|
+
properties: Record<string, any>;
|
|
14
|
+
};
|
|
15
|
+
cache?: boolean;
|
|
16
|
+
callback?: (e: Event) => {
|
|
17
|
+
name: string;
|
|
18
|
+
properties: Record<string, any>;
|
|
19
|
+
cache?: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type LoadEventConfig = {
|
|
23
|
+
event: {
|
|
24
|
+
name: string;
|
|
25
|
+
properties: Record<string, any>;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
type PageLoadEventConfig = {
|
|
29
|
+
pages?: string[];
|
|
30
|
+
excludedPages?: string[];
|
|
31
|
+
event: {
|
|
32
|
+
name: string;
|
|
33
|
+
properties: Record<string, any>;
|
|
34
|
+
};
|
|
35
|
+
callback?: () => {
|
|
36
|
+
name: string;
|
|
37
|
+
properties: Record<string, any>;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
declare class AnalyticsCacheManager {
|
|
41
|
+
private interval;
|
|
42
|
+
private responses;
|
|
43
|
+
private isTrackingResponses;
|
|
44
|
+
private delegatedSelectors;
|
|
45
|
+
/**
|
|
46
|
+
* FNV-1a hash algorithm for creating consistent hashes
|
|
47
|
+
*/
|
|
48
|
+
private hash;
|
|
49
|
+
/**
|
|
50
|
+
* Get cookie value by name
|
|
51
|
+
*/
|
|
52
|
+
getCookies(name: string): any;
|
|
53
|
+
/**
|
|
54
|
+
* Track page unload events to cache pageviews before leaving
|
|
55
|
+
*/
|
|
56
|
+
trackPageUnload(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Track XMLHttpRequest responses to monitor analytics calls
|
|
59
|
+
*/
|
|
60
|
+
trackResponses(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Check if Analytics instance is ready
|
|
63
|
+
*/
|
|
64
|
+
isReady(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Parse cookies into an object
|
|
67
|
+
*/
|
|
68
|
+
private parseCookies;
|
|
69
|
+
/**
|
|
70
|
+
* Check if pageview has been sent
|
|
71
|
+
*/
|
|
72
|
+
isPageViewSent(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Set a cached event
|
|
75
|
+
*/
|
|
76
|
+
set(event: CachedEvent): void;
|
|
77
|
+
/**
|
|
78
|
+
* Push data to cookie cache
|
|
79
|
+
*/
|
|
80
|
+
push(cookieName: string, data: any): void;
|
|
81
|
+
/**
|
|
82
|
+
* Get the allowed domain for cookies
|
|
83
|
+
* For localhost/single-part domains: use as-is
|
|
84
|
+
* For multi-part domains: use top-level domain (e.g., .deriv.com)
|
|
85
|
+
*/
|
|
86
|
+
private getAllowedDomain;
|
|
87
|
+
/**
|
|
88
|
+
* Process event to hash email and add client info
|
|
89
|
+
*/
|
|
90
|
+
processEvent(event: CachedEvent): CachedEvent;
|
|
91
|
+
/**
|
|
92
|
+
* Track an event (either immediately or cache it)
|
|
93
|
+
*/
|
|
94
|
+
track(originalEvent: CachedEvent, cache?: boolean): void;
|
|
95
|
+
/**
|
|
96
|
+
* Track pageview with auto-retry until sent
|
|
97
|
+
*/
|
|
98
|
+
pageView(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Add click event listener to element(s)
|
|
101
|
+
*/
|
|
102
|
+
listen(element: Element | NodeList, { name, properties }: {
|
|
103
|
+
name: string;
|
|
104
|
+
properties: Record<string, any>;
|
|
105
|
+
}, cache?: boolean, callback?: ((e: Event) => {
|
|
106
|
+
name: string;
|
|
107
|
+
properties: Record<string, any>;
|
|
108
|
+
cache?: boolean;
|
|
109
|
+
}) | null): void;
|
|
110
|
+
/**
|
|
111
|
+
* Add event handlers to multiple elements with auto-retry
|
|
112
|
+
* Alias for backward compatibility with typo
|
|
113
|
+
*/
|
|
114
|
+
addEventHandler(items: EventListenerConfig[]): this;
|
|
115
|
+
/**
|
|
116
|
+
* Backward compatibility alias (with typo from original)
|
|
117
|
+
*/
|
|
118
|
+
addEventhandler: (items: EventListenerConfig[]) => this;
|
|
119
|
+
/**
|
|
120
|
+
* Load events immediately
|
|
121
|
+
*/
|
|
122
|
+
loadEvent(items: LoadEventConfig[]): this;
|
|
123
|
+
/**
|
|
124
|
+
* Load events on specific pages
|
|
125
|
+
*/
|
|
126
|
+
pageLoadEvent(items: PageLoadEventConfig[]): this;
|
|
127
|
+
/**
|
|
128
|
+
* Clear the interval and cleanup
|
|
129
|
+
*/
|
|
130
|
+
clearInterval(): void;
|
|
131
|
+
/**
|
|
132
|
+
* Cleanup method for removing event listeners and intervals
|
|
133
|
+
*/
|
|
134
|
+
cleanup(): void;
|
|
135
|
+
}
|
|
136
|
+
declare const cacheTrackEvents: AnalyticsCacheManager;
|
|
137
|
+
|
|
138
|
+
export { cacheTrackEvents };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics Cache Manager - Version 1.1.0
|
|
3
|
+
* Enhanced TypeScript implementation with better type safety and SSR support
|
|
4
|
+
*/
|
|
5
|
+
type CachedEvent = {
|
|
6
|
+
name: string;
|
|
7
|
+
properties: Record<string, any>;
|
|
8
|
+
};
|
|
9
|
+
type EventListenerConfig = {
|
|
10
|
+
element: Element | NodeList | string;
|
|
11
|
+
event: {
|
|
12
|
+
name: string;
|
|
13
|
+
properties: Record<string, any>;
|
|
14
|
+
};
|
|
15
|
+
cache?: boolean;
|
|
16
|
+
callback?: (e: Event) => {
|
|
17
|
+
name: string;
|
|
18
|
+
properties: Record<string, any>;
|
|
19
|
+
cache?: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type LoadEventConfig = {
|
|
23
|
+
event: {
|
|
24
|
+
name: string;
|
|
25
|
+
properties: Record<string, any>;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
type PageLoadEventConfig = {
|
|
29
|
+
pages?: string[];
|
|
30
|
+
excludedPages?: string[];
|
|
31
|
+
event: {
|
|
32
|
+
name: string;
|
|
33
|
+
properties: Record<string, any>;
|
|
34
|
+
};
|
|
35
|
+
callback?: () => {
|
|
36
|
+
name: string;
|
|
37
|
+
properties: Record<string, any>;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
declare class AnalyticsCacheManager {
|
|
41
|
+
private interval;
|
|
42
|
+
private responses;
|
|
43
|
+
private isTrackingResponses;
|
|
44
|
+
private delegatedSelectors;
|
|
45
|
+
/**
|
|
46
|
+
* FNV-1a hash algorithm for creating consistent hashes
|
|
47
|
+
*/
|
|
48
|
+
private hash;
|
|
49
|
+
/**
|
|
50
|
+
* Get cookie value by name
|
|
51
|
+
*/
|
|
52
|
+
getCookies(name: string): any;
|
|
53
|
+
/**
|
|
54
|
+
* Track page unload events to cache pageviews before leaving
|
|
55
|
+
*/
|
|
56
|
+
trackPageUnload(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Track XMLHttpRequest responses to monitor analytics calls
|
|
59
|
+
*/
|
|
60
|
+
trackResponses(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Check if Analytics instance is ready
|
|
63
|
+
*/
|
|
64
|
+
isReady(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Parse cookies into an object
|
|
67
|
+
*/
|
|
68
|
+
private parseCookies;
|
|
69
|
+
/**
|
|
70
|
+
* Check if pageview has been sent
|
|
71
|
+
*/
|
|
72
|
+
isPageViewSent(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Set a cached event
|
|
75
|
+
*/
|
|
76
|
+
set(event: CachedEvent): void;
|
|
77
|
+
/**
|
|
78
|
+
* Push data to cookie cache
|
|
79
|
+
*/
|
|
80
|
+
push(cookieName: string, data: any): void;
|
|
81
|
+
/**
|
|
82
|
+
* Get the allowed domain for cookies
|
|
83
|
+
* For localhost/single-part domains: use as-is
|
|
84
|
+
* For multi-part domains: use top-level domain (e.g., .deriv.com)
|
|
85
|
+
*/
|
|
86
|
+
private getAllowedDomain;
|
|
87
|
+
/**
|
|
88
|
+
* Process event to hash email and add client info
|
|
89
|
+
*/
|
|
90
|
+
processEvent(event: CachedEvent): CachedEvent;
|
|
91
|
+
/**
|
|
92
|
+
* Track an event (either immediately or cache it)
|
|
93
|
+
*/
|
|
94
|
+
track(originalEvent: CachedEvent, cache?: boolean): void;
|
|
95
|
+
/**
|
|
96
|
+
* Track pageview with auto-retry until sent
|
|
97
|
+
*/
|
|
98
|
+
pageView(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Add click event listener to element(s)
|
|
101
|
+
*/
|
|
102
|
+
listen(element: Element | NodeList, { name, properties }: {
|
|
103
|
+
name: string;
|
|
104
|
+
properties: Record<string, any>;
|
|
105
|
+
}, cache?: boolean, callback?: ((e: Event) => {
|
|
106
|
+
name: string;
|
|
107
|
+
properties: Record<string, any>;
|
|
108
|
+
cache?: boolean;
|
|
109
|
+
}) | null): void;
|
|
110
|
+
/**
|
|
111
|
+
* Add event handlers to multiple elements with auto-retry
|
|
112
|
+
* Alias for backward compatibility with typo
|
|
113
|
+
*/
|
|
114
|
+
addEventHandler(items: EventListenerConfig[]): this;
|
|
115
|
+
/**
|
|
116
|
+
* Backward compatibility alias (with typo from original)
|
|
117
|
+
*/
|
|
118
|
+
addEventhandler: (items: EventListenerConfig[]) => this;
|
|
119
|
+
/**
|
|
120
|
+
* Load events immediately
|
|
121
|
+
*/
|
|
122
|
+
loadEvent(items: LoadEventConfig[]): this;
|
|
123
|
+
/**
|
|
124
|
+
* Load events on specific pages
|
|
125
|
+
*/
|
|
126
|
+
pageLoadEvent(items: PageLoadEventConfig[]): this;
|
|
127
|
+
/**
|
|
128
|
+
* Clear the interval and cleanup
|
|
129
|
+
*/
|
|
130
|
+
clearInterval(): void;
|
|
131
|
+
/**
|
|
132
|
+
* Cleanup method for removing event listeners and intervals
|
|
133
|
+
*/
|
|
134
|
+
cleanup(): void;
|
|
135
|
+
}
|
|
136
|
+
declare const cacheTrackEvents: AnalyticsCacheManager;
|
|
137
|
+
|
|
138
|
+
export { cacheTrackEvents };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|