@bizfly/cdp-web 0.0.0-stage → 1.2.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.
@@ -0,0 +1,1500 @@
1
+ type CanonicalType = 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'string[]' | 'number[]';
2
+
3
+ interface ParamDef {
4
+ type: CanonicalType;
5
+ required?: boolean;
6
+ }
7
+ interface EventDef {
8
+ name: string;
9
+ web: boolean;
10
+ app: boolean;
11
+ sendMode: 'realtime' | 'batch';
12
+ correlation?: boolean;
13
+ params: Record<string, ParamDef>;
14
+ }
15
+ interface ParamMeta {
16
+ type: CanonicalType;
17
+ sensitive?: boolean;
18
+ enum?: string[];
19
+ free?: boolean;
20
+ }
21
+ interface AttrMeta {
22
+ type: CanonicalType;
23
+ identifier?: boolean;
24
+ platformOnly?: boolean;
25
+ options?: string[];
26
+ }
27
+ interface Catalog {
28
+ version: string;
29
+ params: Record<string, ParamMeta>;
30
+ attributes: Record<string, AttrMeta>;
31
+ events: Record<string, EventDef>;
32
+ mutual?: Record<string, ParamDef>;
33
+ source?: 'builtin' | 'server';
34
+ }
35
+
36
+ declare const CATALOG_VERSION = "0.2";
37
+ type WebEventName = "user_logout" | "session_start" | "page_view" | "consent_updated" | "survey_result" | "lead_collected" | "gamification_played" | "web_push_subscribed" | "web_push_unsubscribed" | "web_push_delivered" | "web_push_clicked" | "web_popup_seen" | "web_popup_clicked" | "web_popup_dismissed" | "web_banner_seen" | "web_banner_clicked" | "form_submitted" | "login_start" | "login_success" | "login_fail" | "forgot_password_start" | "forgot_password_success" | "change_password_start" | "change_password_success" | "email_verify_start" | "email_verify_success" | "onboarding_start" | "onboarding_step_completed" | "onboarding_success" | "onboarding_fail" | "identity_document_update_success" | "search_submit" | "search_result_click" | "account_view" | "account_open_start" | "account_open_confirm" | "account_open_success" | "account_close_success" | "transfer_view" | "transfer_start" | "transfer_confirm" | "transfer_success" | "transfer_fail" | "transaction_success" | "billpayment_view" | "billpayment_start" | "billpayment_confirm" | "billpayment_success" | "billpayment_fail" | "billpayment_autopay_start" | "billpayment_autopay_success" | "bill_save_success" | "bill_delete_success" | "mobile_topup_start" | "mobile_topup_success" | "card_view" | "card_issue_start" | "card_issue_success" | "card_issue_fail" | "card_activate_success" | "card_lock_success" | "card_unlock_success" | "card_payment_start" | "card_payment_success" | "card_limit_adjust_start" | "card_limit_adjust_success" | "card_installment_view" | "card_installment_start" | "card_installment_success" | "loan_view" | "loan_product_view" | "loan_eligibility_check_start" | "loan_eligibility_check_success" | "loan_apply_start" | "loan_apply_confirm" | "loan_apply_success" | "loan_apply_fail" | "loan_disburse_start" | "loan_disburse_confirm" | "loan_disburse_success" | "loan_disburse_fail" | "loan_repay_start" | "loan_repay_success" | "loan_close_start" | "loan_close_success" | "saving_view" | "saving_detail_view" | "saving_open_start" | "saving_open_confirm" | "saving_open_success" | "saving_open_fail" | "saving_deposit_more_start" | "saving_deposit_more_confirm" | "saving_deposit_more_success" | "saving_autodeposit_setup_start" | "saving_autodeposit_setup_success" | "saving_withdraw_partial_start" | "saving_withdraw_partial_success" | "saving_withdraw_partial_fail" | "saving_settle_start" | "saving_settle_success" | "saving_settle_fail" | "insurance_view" | "insurance_product_view" | "insurance_purchase_start" | "insurance_purchase_success" | "insurance_claim_view" | "investment_view" | "investment_product_view" | "investment_account_open_start" | "investment_account_open_success" | "investment_purchase_start" | "investment_purchase_success" | "investment_purchase_fail" | "loyalty_view" | "loyalty_redeem_success" | "offer_view" | "offer_detail_view" | "voucher_view" | "voucher_detail_view" | "voucher_use_click" | "voucher_issue_success" | "referral_success" | "business_account_open_start" | "business_account_open_confirm" | "business_account_open_success" | "business_account_open_fail";
38
+ interface CorrelationContext {
39
+ channel: string;
40
+ message_id: string;
41
+ variant_id: string;
42
+ message_type: 'advertisement' | 'announcement';
43
+ campaign_id?: string;
44
+ campaign_name?: string;
45
+ campaign_type?: string;
46
+ journey_id?: string;
47
+ journey_name?: string;
48
+ journey_version?: number;
49
+ journey_node_id?: string;
50
+ content_id?: string;
51
+ is_test?: boolean;
52
+ dry_run?: boolean;
53
+ }
54
+ interface EventParamMap {
55
+ user_logout: {
56
+ logout_reason?: "user" | "timeout" | "forced" | "account_switch";
57
+ };
58
+ session_start: {
59
+ landing_url: string;
60
+ };
61
+ page_view: {
62
+ page_title?: string;
63
+ };
64
+ consent_updated: {
65
+ consent_type: string;
66
+ consent_status: "granted" | "withdrawn";
67
+ change_source: "app_settings" | "web_settings" | "lead_form" | "email_link" | "sms_keyword" | "zalo" | "branch" | "api" | "admin";
68
+ channel?: string;
69
+ };
70
+ survey_result: {
71
+ survey_id: string;
72
+ question_id: string;
73
+ question_text?: string;
74
+ question_type: "single_choice" | "multi_choice" | "rating" | "nps" | "text";
75
+ answer_id?: string;
76
+ answer_text?: string;
77
+ score?: number;
78
+ } & CorrelationContext;
79
+ lead_collected: {
80
+ form_id: string;
81
+ fields_submitted: string[];
82
+ } & CorrelationContext;
83
+ gamification_played: {
84
+ game_type: "spin_wheel" | "scratch_card" | "gift_box" | "quiz";
85
+ is_win: boolean;
86
+ prize_id?: string;
87
+ } & CorrelationContext;
88
+ web_push_subscribed: {
89
+ prompt_type?: "soft" | "native";
90
+ };
91
+ web_push_unsubscribed: {};
92
+ web_push_delivered: {} & CorrelationContext;
93
+ web_push_clicked: {
94
+ url?: string;
95
+ } & CorrelationContext;
96
+ web_popup_seen: {
97
+ inapp_id: string;
98
+ } & CorrelationContext;
99
+ web_popup_clicked: {
100
+ inapp_id: string;
101
+ click_action: "deeplink" | "url" | "go_to_page" | "dismiss" | "open_settings" | "request_push_permission" | "trigger_event" | "update_attribute" | "copy_code";
102
+ button_text?: string;
103
+ url?: string;
104
+ } & CorrelationContext;
105
+ web_popup_dismissed: {
106
+ inapp_id: string;
107
+ dismiss_type: "close_button" | "auto_close" | "tap_outside" | "back" | "app_exit";
108
+ } & CorrelationContext;
109
+ web_banner_seen: {
110
+ slot_id: string;
111
+ position?: number;
112
+ } & CorrelationContext;
113
+ web_banner_clicked: {
114
+ slot_id: string;
115
+ position?: number;
116
+ url?: string;
117
+ } & CorrelationContext;
118
+ form_submitted: {
119
+ form_id: string;
120
+ form_name?: string;
121
+ form_data?: string;
122
+ };
123
+ login_start: {
124
+ login_method?: "password" | "fingerprint" | "face_id" | "soft_otp" | "qr_login";
125
+ };
126
+ login_success: {
127
+ login_method?: "password" | "fingerprint" | "face_id" | "soft_otp" | "qr_login";
128
+ };
129
+ login_fail: {
130
+ login_method?: "password" | "fingerprint" | "face_id" | "soft_otp" | "qr_login";
131
+ error_code: string;
132
+ error_message?: string;
133
+ };
134
+ forgot_password_start: {};
135
+ forgot_password_success: {};
136
+ change_password_start: {};
137
+ change_password_success: {};
138
+ email_verify_start: {
139
+ email?: string;
140
+ };
141
+ email_verify_success: {
142
+ email?: string;
143
+ };
144
+ onboarding_start: {
145
+ acquisition_source?: "organic" | "referral" | "rm" | "partner" | "paid_ads" | "branch" | "other";
146
+ referral_code?: string;
147
+ };
148
+ onboarding_step_completed: {
149
+ step_no: number;
150
+ step_name: string;
151
+ step_result?: "pass" | "fail" | "manual_review";
152
+ verification_method?: "nfc_chip" | "vneid" | "ocr" | "face_match" | "branch";
153
+ };
154
+ onboarding_success: {
155
+ verification_method?: "nfc_chip" | "vneid" | "ocr" | "face_match" | "branch";
156
+ acquisition_source?: "organic" | "referral" | "rm" | "partner" | "paid_ads" | "branch" | "other";
157
+ referral_code?: string;
158
+ account_number?: string;
159
+ };
160
+ onboarding_fail: {
161
+ step_name: string;
162
+ error_code: string;
163
+ error_message?: string;
164
+ };
165
+ identity_document_update_success: {
166
+ update_flow: "update" | "change";
167
+ verification_method: "nfc_chip" | "vneid" | "ocr" | "face_match" | "branch";
168
+ document_type?: "cccd_chip" | "cccd" | "cmnd" | "passport";
169
+ };
170
+ search_submit: {
171
+ search_keyword: string;
172
+ result_count?: number;
173
+ };
174
+ search_result_click: {
175
+ search_keyword: string;
176
+ result_title: string;
177
+ result_position?: number;
178
+ };
179
+ account_view: {};
180
+ account_open_start: {
181
+ account_type: "current" | "fancy_number" | "business" | "joint" | "payroll";
182
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
183
+ };
184
+ account_open_confirm: {
185
+ account_type: "current" | "fancy_number" | "business" | "joint" | "payroll";
186
+ fee_amount?: number;
187
+ voucher_code?: string;
188
+ };
189
+ account_open_success: {
190
+ account_number?: string;
191
+ account_type: "current" | "fancy_number" | "business" | "joint" | "payroll";
192
+ fee_amount?: number;
193
+ voucher_code?: string;
194
+ };
195
+ account_close_success: {
196
+ account_number: string;
197
+ account_type?: "current" | "fancy_number" | "business" | "joint" | "payroll";
198
+ };
199
+ transfer_view: {
200
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
201
+ };
202
+ transfer_start: {
203
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
204
+ transfer_type?: "own_account" | "internal" | "interbank_fast" | "interbank_normal" | "card" | "international" | "split" | "scheduled";
205
+ };
206
+ transfer_confirm: {
207
+ transfer_type: "own_account" | "internal" | "interbank_fast" | "interbank_normal" | "card" | "international" | "split" | "scheduled";
208
+ transaction_amount: number;
209
+ currency?: string;
210
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
211
+ };
212
+ transfer_success: {
213
+ transaction_id: string;
214
+ transfer_type: "own_account" | "internal" | "interbank_fast" | "interbank_normal" | "card" | "international" | "split" | "scheduled";
215
+ transaction_amount: number;
216
+ currency?: string;
217
+ fee_amount?: number;
218
+ auth_method?: "soft_otp" | "sms_otp" | "face_biometric" | "fingerprint" | "pin" | "password";
219
+ funding_source?: "account" | "credit_card" | "debit_card" | "loyalty_points" | "account_points" | "card_points" | "overdraft";
220
+ counterparty_bank_code?: string;
221
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
222
+ };
223
+ transfer_fail: {
224
+ transfer_type?: "own_account" | "internal" | "interbank_fast" | "interbank_normal" | "card" | "international" | "split" | "scheduled";
225
+ transaction_amount?: number;
226
+ funding_source?: "account" | "credit_card" | "debit_card" | "loyalty_points" | "account_points" | "card_points" | "overdraft";
227
+ error_code: string;
228
+ error_message?: string;
229
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
230
+ };
231
+ transaction_success: {
232
+ transaction_id: string;
233
+ transaction_category: "salary" | "transfer_in" | "cash_deposit" | "interest" | "refund" | "loan_disbursement" | "card_payment" | "bill_payment" | "transfer_out" | "other";
234
+ transaction_amount: number;
235
+ currency?: string;
236
+ };
237
+ billpayment_view: {
238
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
239
+ };
240
+ billpayment_start: {
241
+ service_type: "electricity" | "water" | "internet" | "telco_postpaid" | "tv" | "tuition" | "insurance_premium" | "tax" | "fee" | "other";
242
+ partner_name?: string;
243
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
244
+ payment_mode?: "one_time" | "recurring";
245
+ };
246
+ billpayment_confirm: {
247
+ service_type: "electricity" | "water" | "internet" | "telco_postpaid" | "tv" | "tuition" | "insurance_premium" | "tax" | "fee" | "other";
248
+ partner_name?: string;
249
+ transaction_amount: number;
250
+ funding_source?: "account" | "credit_card" | "debit_card" | "loyalty_points" | "account_points" | "card_points" | "overdraft";
251
+ voucher_code?: string;
252
+ };
253
+ billpayment_success: {
254
+ transaction_id: string;
255
+ service_type: "electricity" | "water" | "internet" | "telco_postpaid" | "tv" | "tuition" | "insurance_premium" | "tax" | "fee" | "other";
256
+ partner_name?: string;
257
+ transaction_amount: number;
258
+ funding_source?: "account" | "credit_card" | "debit_card" | "loyalty_points" | "account_points" | "card_points" | "overdraft";
259
+ voucher_code?: string;
260
+ bill_saved?: boolean;
261
+ payment_mode?: "one_time" | "recurring";
262
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
263
+ };
264
+ billpayment_fail: {
265
+ service_type?: "electricity" | "water" | "internet" | "telco_postpaid" | "tv" | "tuition" | "insurance_premium" | "tax" | "fee" | "other";
266
+ partner_name?: string;
267
+ transaction_amount?: number;
268
+ funding_source?: "account" | "credit_card" | "debit_card" | "loyalty_points" | "account_points" | "card_points" | "overdraft";
269
+ error_code: string;
270
+ error_message?: string;
271
+ };
272
+ billpayment_autopay_start: {
273
+ service_type: "electricity" | "water" | "internet" | "telco_postpaid" | "tv" | "tuition" | "insurance_premium" | "tax" | "fee" | "other";
274
+ partner_name?: string;
275
+ };
276
+ billpayment_autopay_success: {
277
+ service_type: "electricity" | "water" | "internet" | "telco_postpaid" | "tv" | "tuition" | "insurance_premium" | "tax" | "fee" | "other";
278
+ partner_name?: string;
279
+ transaction_amount?: number;
280
+ funding_source?: "account" | "credit_card" | "debit_card" | "loyalty_points" | "account_points" | "card_points" | "overdraft";
281
+ voucher_code?: string;
282
+ };
283
+ bill_save_success: {
284
+ service_type?: "electricity" | "water" | "internet" | "telco_postpaid" | "tv" | "tuition" | "insurance_premium" | "tax" | "fee" | "other";
285
+ partner_name?: string;
286
+ };
287
+ bill_delete_success: {
288
+ service_type?: "electricity" | "water" | "internet" | "telco_postpaid" | "tv" | "tuition" | "insurance_premium" | "tax" | "fee" | "other";
289
+ partner_name?: string;
290
+ };
291
+ mobile_topup_start: {
292
+ partner_name?: string;
293
+ };
294
+ mobile_topup_success: {
295
+ transaction_id: string;
296
+ partner_name: string;
297
+ transaction_amount: number;
298
+ funding_source?: "account" | "credit_card" | "debit_card" | "loyalty_points" | "account_points" | "card_points" | "overdraft";
299
+ };
300
+ card_view: {
301
+ card_type?: "credit" | "debit" | "prepaid";
302
+ };
303
+ card_issue_start: {
304
+ card_type: "credit" | "debit" | "prepaid";
305
+ card_product?: string;
306
+ card_form?: "physical" | "virtual";
307
+ issue_type?: "new" | "reissue" | "replacement" | "preapproved_limit";
308
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
309
+ };
310
+ card_issue_success: {
311
+ card_id?: string;
312
+ card_type: "credit" | "debit" | "prepaid";
313
+ card_product?: string;
314
+ card_brand?: "visa" | "mastercard" | "jcb" | "amex" | "unionpay" | "napas";
315
+ card_form?: "physical" | "virtual";
316
+ issue_type?: "new" | "reissue" | "replacement" | "preapproved_limit";
317
+ credit_limit?: number;
318
+ };
319
+ card_issue_fail: {
320
+ card_type?: "credit" | "debit" | "prepaid";
321
+ card_product?: string;
322
+ error_code: string;
323
+ error_message?: string;
324
+ };
325
+ card_activate_success: {
326
+ card_id?: string;
327
+ card_type: "credit" | "debit" | "prepaid";
328
+ card_product?: string;
329
+ issue_type?: "new" | "reissue" | "replacement" | "preapproved_limit";
330
+ credit_limit?: number;
331
+ };
332
+ card_lock_success: {
333
+ card_id: string;
334
+ card_type?: "credit" | "debit" | "prepaid";
335
+ };
336
+ card_unlock_success: {
337
+ card_id: string;
338
+ card_type?: "credit" | "debit" | "prepaid";
339
+ };
340
+ card_payment_start: {
341
+ card_id?: string;
342
+ };
343
+ card_payment_success: {
344
+ transaction_id: string;
345
+ card_id?: string;
346
+ transaction_amount: number;
347
+ repay_type?: "installment" | "partial" | "full";
348
+ };
349
+ card_limit_adjust_start: {
350
+ card_id?: string;
351
+ };
352
+ card_limit_adjust_success: {
353
+ card_id?: string;
354
+ credit_limit: number;
355
+ };
356
+ card_installment_view: {
357
+ card_id?: string;
358
+ };
359
+ card_installment_start: {
360
+ card_id?: string;
361
+ };
362
+ card_installment_success: {
363
+ card_id?: string;
364
+ transaction_amount: number;
365
+ term?: string;
366
+ };
367
+ loan_view: {
368
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
369
+ };
370
+ loan_product_view: {
371
+ product_type: string;
372
+ product_id?: string;
373
+ product_name?: string;
374
+ };
375
+ loan_eligibility_check_start: {
376
+ product_type: string;
377
+ product_id?: string;
378
+ };
379
+ loan_eligibility_check_success: {
380
+ product_type: string;
381
+ product_id?: string;
382
+ eligible_amount?: number;
383
+ };
384
+ loan_apply_start: {
385
+ product_type: string;
386
+ product_id?: string;
387
+ loan_action: "new_loan" | "limit_adjust" | "top_up" | "repayment" | "settlement";
388
+ disbursement_mode: "instant" | "separate";
389
+ step_no?: number;
390
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
391
+ };
392
+ loan_apply_confirm: {
393
+ product_type: string;
394
+ product_id?: string;
395
+ loan_action: "new_loan" | "limit_adjust" | "top_up" | "repayment" | "settlement";
396
+ disbursement_mode: "instant" | "separate";
397
+ transaction_amount?: number;
398
+ term?: string;
399
+ };
400
+ loan_apply_success: {
401
+ loan_id?: string;
402
+ product_type: string;
403
+ product_id?: string;
404
+ loan_action: "new_loan" | "limit_adjust" | "top_up" | "repayment" | "settlement";
405
+ disbursement_mode: "instant" | "separate";
406
+ transaction_amount: number;
407
+ term?: string;
408
+ };
409
+ loan_apply_fail: {
410
+ product_type: string;
411
+ product_id?: string;
412
+ loan_action?: "new_loan" | "limit_adjust" | "top_up" | "repayment" | "settlement";
413
+ disbursement_mode?: "instant" | "separate";
414
+ transaction_amount?: number;
415
+ error_code: string;
416
+ error_message?: string;
417
+ };
418
+ loan_disburse_start: {
419
+ loan_id?: string;
420
+ product_type: string;
421
+ product_id?: string;
422
+ transaction_amount?: number;
423
+ step_no?: number;
424
+ };
425
+ loan_disburse_confirm: {
426
+ loan_id?: string;
427
+ product_type: string;
428
+ product_id?: string;
429
+ transaction_amount?: number;
430
+ };
431
+ loan_disburse_success: {
432
+ transaction_id?: string;
433
+ loan_id?: string;
434
+ product_type: string;
435
+ product_id?: string;
436
+ transaction_amount: number;
437
+ term?: string;
438
+ };
439
+ loan_disburse_fail: {
440
+ loan_id?: string;
441
+ product_type: string;
442
+ product_id?: string;
443
+ transaction_amount?: number;
444
+ error_code: string;
445
+ error_message?: string;
446
+ };
447
+ loan_repay_start: {
448
+ loan_id?: string;
449
+ product_type?: string;
450
+ };
451
+ loan_repay_success: {
452
+ transaction_id: string;
453
+ loan_id?: string;
454
+ product_type?: string;
455
+ transaction_amount: number;
456
+ repay_type?: "installment" | "partial" | "full";
457
+ };
458
+ loan_close_start: {
459
+ loan_id?: string;
460
+ product_type?: string;
461
+ };
462
+ loan_close_success: {
463
+ loan_id?: string;
464
+ product_type?: string;
465
+ transaction_amount?: number;
466
+ };
467
+ saving_view: {
468
+ product_type?: string;
469
+ };
470
+ saving_detail_view: {
471
+ savings_account_number?: string;
472
+ product_type?: string;
473
+ transaction_amount?: number;
474
+ term?: string;
475
+ };
476
+ saving_open_start: {
477
+ product_type: string;
478
+ interest_payment_method?: "end_of_term" | "monthly" | "quarterly" | "upfront";
479
+ entry_point?: "home_shortcut" | "menu" | "search" | "banner" | "push" | "inapp" | "inbox" | "deeplink" | "qr" | "contact" | "chat" | "paste_text" | "partner_hub" | "cross_sell" | "other";
480
+ };
481
+ saving_open_confirm: {
482
+ product_type: string;
483
+ term: string;
484
+ transaction_amount: number;
485
+ interest_payment_method?: "end_of_term" | "monthly" | "quarterly" | "upfront";
486
+ auto_deposit_frequency?: "daily" | "weekly" | "monthly";
487
+ auto_deposit_amount?: number;
488
+ promotion_code?: string;
489
+ };
490
+ saving_open_success: {
491
+ savings_account_number?: string;
492
+ product_type: string;
493
+ term: string;
494
+ transaction_amount: number;
495
+ interest_payment_method?: "end_of_term" | "monthly" | "quarterly" | "upfront";
496
+ auto_deposit_frequency?: "daily" | "weekly" | "monthly";
497
+ auto_deposit_amount?: number;
498
+ voucher_code?: string;
499
+ promotion_code?: string;
500
+ };
501
+ saving_open_fail: {
502
+ product_type: string;
503
+ term?: string;
504
+ transaction_amount?: number;
505
+ interest_payment_method?: "end_of_term" | "monthly" | "quarterly" | "upfront";
506
+ error_code: string;
507
+ error_message?: string;
508
+ };
509
+ saving_deposit_more_start: {
510
+ savings_account_number?: string;
511
+ product_type: string;
512
+ term?: string;
513
+ };
514
+ saving_deposit_more_confirm: {
515
+ savings_account_number?: string;
516
+ product_type: string;
517
+ transaction_amount: number;
518
+ auto_deposit_frequency?: "daily" | "weekly" | "monthly";
519
+ auto_deposit_amount?: number;
520
+ };
521
+ saving_deposit_more_success: {
522
+ transaction_id?: string;
523
+ savings_account_number?: string;
524
+ product_type: string;
525
+ transaction_amount: number;
526
+ auto_deposit_frequency?: "daily" | "weekly" | "monthly";
527
+ auto_deposit_amount?: number;
528
+ };
529
+ saving_autodeposit_setup_start: {
530
+ savings_account_number?: string;
531
+ product_type: string;
532
+ };
533
+ saving_autodeposit_setup_success: {
534
+ savings_account_number?: string;
535
+ product_type: string;
536
+ auto_deposit_amount: number;
537
+ auto_deposit_frequency: "daily" | "weekly" | "monthly";
538
+ status: "success" | "pending" | "fail";
539
+ };
540
+ saving_withdraw_partial_start: {
541
+ savings_account_number?: string;
542
+ product_type: string;
543
+ term?: string;
544
+ };
545
+ saving_withdraw_partial_success: {
546
+ transaction_id?: string;
547
+ savings_account_number?: string;
548
+ product_type: string;
549
+ transaction_amount: number;
550
+ term?: string;
551
+ };
552
+ saving_withdraw_partial_fail: {
553
+ savings_account_number?: string;
554
+ product_type: string;
555
+ transaction_amount?: number;
556
+ error_code: string;
557
+ };
558
+ saving_settle_start: {
559
+ savings_account_number?: string;
560
+ product_type: string;
561
+ transaction_amount?: number;
562
+ term?: string;
563
+ };
564
+ saving_settle_success: {
565
+ savings_account_number?: string;
566
+ product_type: string;
567
+ transaction_amount: number;
568
+ term?: string;
569
+ };
570
+ saving_settle_fail: {
571
+ savings_account_number?: string;
572
+ product_type: string;
573
+ error_code: string;
574
+ };
575
+ insurance_view: {
576
+ insurance_type?: "life" | "health" | "accident" | "motor" | "card_protection" | "fraud_protection" | "travel" | "home";
577
+ partner_name?: string;
578
+ };
579
+ insurance_product_view: {
580
+ insurance_type: "life" | "health" | "accident" | "motor" | "card_protection" | "fraud_protection" | "travel" | "home";
581
+ partner_name?: string;
582
+ product_id?: string;
583
+ product_name?: string;
584
+ };
585
+ insurance_purchase_start: {
586
+ insurance_type: "life" | "health" | "accident" | "motor" | "card_protection" | "fraud_protection" | "travel" | "home";
587
+ partner_name?: string;
588
+ product_id?: string;
589
+ };
590
+ insurance_purchase_success: {
591
+ policy_number?: string;
592
+ insurance_type: "life" | "health" | "accident" | "motor" | "card_protection" | "fraud_protection" | "travel" | "home";
593
+ partner_name?: string;
594
+ product_id?: string;
595
+ transaction_amount: number;
596
+ term?: string;
597
+ };
598
+ insurance_claim_view: {
599
+ partner_name?: string;
600
+ };
601
+ investment_view: {
602
+ investment_type: "securities" | "fund" | "bond" | "gold" | "certificate";
603
+ partner_name?: string;
604
+ };
605
+ investment_product_view: {
606
+ investment_type: "securities" | "fund" | "bond" | "gold" | "certificate";
607
+ partner_name?: string;
608
+ product_name?: string;
609
+ };
610
+ investment_account_open_start: {
611
+ investment_type: "securities" | "fund" | "bond" | "gold" | "certificate";
612
+ partner_name: string;
613
+ };
614
+ investment_account_open_success: {
615
+ investment_type: "securities" | "fund" | "bond" | "gold" | "certificate";
616
+ partner_name: string;
617
+ };
618
+ investment_purchase_start: {
619
+ investment_type: "securities" | "fund" | "bond" | "gold" | "certificate";
620
+ partner_name?: string;
621
+ product_name?: string;
622
+ transaction_amount?: number;
623
+ };
624
+ investment_purchase_success: {
625
+ transaction_id?: string;
626
+ investment_type: "securities" | "fund" | "bond" | "gold" | "certificate";
627
+ partner_name?: string;
628
+ product_name?: string;
629
+ transaction_amount: number;
630
+ };
631
+ investment_purchase_fail: {
632
+ investment_type: "securities" | "fund" | "bond" | "gold" | "certificate";
633
+ partner_name?: string;
634
+ product_name?: string;
635
+ transaction_amount?: number;
636
+ error_code: string;
637
+ error_message?: string;
638
+ };
639
+ loyalty_view: {};
640
+ loyalty_redeem_success: {
641
+ points: number;
642
+ reward_name?: string;
643
+ };
644
+ offer_view: {};
645
+ offer_detail_view: {
646
+ offer_id?: string;
647
+ offer_name: string;
648
+ partner_name?: string;
649
+ };
650
+ voucher_view: {};
651
+ voucher_detail_view: {
652
+ voucher_name: string;
653
+ voucher_code?: string;
654
+ };
655
+ voucher_use_click: {
656
+ voucher_name: string;
657
+ voucher_code?: string;
658
+ };
659
+ voucher_issue_success: {
660
+ voucher_code?: string;
661
+ promotion_code: string;
662
+ applicable_product?: string;
663
+ };
664
+ referral_success: {
665
+ referred_customer_id?: string;
666
+ referral_milestone?: number;
667
+ };
668
+ business_account_open_start: {
669
+ business_type: "household_business" | "sole_proprietor" | "sme";
670
+ step_no?: number;
671
+ };
672
+ business_account_open_confirm: {
673
+ business_type: "household_business" | "sole_proprietor" | "sme";
674
+ };
675
+ business_account_open_success: {
676
+ account_number?: string;
677
+ business_type: "household_business" | "sole_proprietor" | "sme";
678
+ industry_code?: string;
679
+ rm_code?: string;
680
+ };
681
+ business_account_open_fail: {
682
+ business_type: "household_business" | "sole_proprietor" | "sme";
683
+ industry_code?: string;
684
+ error_code: string;
685
+ error_message?: string;
686
+ };
687
+ }
688
+
689
+ interface SdkConfig {
690
+ /** Khoá SDK của tenant (công khai, loại "sdk"), gửi ở header x-api-key. Bắt buộc */
691
+ sdkKey?: string;
692
+ /** Host API public dành cho SDK (subdomain riêng trỏ tới cdp-pipeline). Bắt buộc */
693
+ apiHost?: string;
694
+ /** Chỉ để log / phân biệt môi trường */
695
+ env?: 'production' | 'staging';
696
+ /** Tự gửi page_view (kể cả SPA đổi route). Mặc định true */
697
+ autoPageView?: boolean;
698
+ /** Hết phiên sau N phút không hoạt động. Mặc định 30 */
699
+ sessionTimeoutMin?: number;
700
+ /** true = không thu gì (không cookie, không request, không xếp hàng) cho đến khi setConsent('analytics', true) */
701
+ requireConsent?: boolean;
702
+ /** Domain cookie, vd ".shb.com.vn", để nhiều subdomain dùng chung device_id */
703
+ cookieDomain?: string;
704
+ /** Gửi theo lô cho event send_mode = batch. Mặc định { size: 20, intervalMs: 5000 } */
705
+ batch?: {
706
+ size?: number;
707
+ intervalMs?: number;
708
+ };
709
+ /** Web Push. Mặc định tắt. vapidPublicKey lấy từ /sdk/web/config, không cần truyền */
710
+ webPush?: {
711
+ serviceWorkerPath?: string;
712
+ serviceWorkerScope?: string;
713
+ vapidPublicKey?: string;
714
+ softPrompt?: boolean;
715
+ };
716
+ /**
717
+ * Hiển thị popup / banner. Mặc định { popups: true, banners: true }. Bản <script> tải bộ chạy popup / banner từ file riêng
718
+ * `bizcdp-web-campaigns.<phiên bản>.js` cùng thư mục với file SDK; `scriptUrl` = địa chỉ khác của file đó (tự host SDK).
719
+ */
720
+ inApp?: {
721
+ popups?: boolean;
722
+ banners?: boolean;
723
+ scriptUrl?: string;
724
+ };
725
+ debug?: boolean;
726
+ /** Version website (gửi trong app_version) */
727
+ appVersion?: string;
728
+ /** Số event tối đa giữ ở hàng đợi offline. Mặc định 1000 */
729
+ maxQueueSize?: number;
730
+ /** Hàng đợi offline giữ tối đa N ngày. Mặc định 7 */
731
+ maxQueueAgeDays?: number;
732
+ /** Cho phép gửi event ngoài từ điển (server ghi ở trạng thái pending). Mặc định false; bật `debug` cũng cho phép */
733
+ allowUnknownEvents?: boolean;
734
+ /** Cho phép attribute ngoài từ điển. Mặc định false */
735
+ allowUnknownAttributes?: boolean;
736
+ /** Tên query bị bỏ khỏi page_url / referrer. Mặc định: token, otp, password, email, phone ... */
737
+ sensitiveQueryParams?: string[];
738
+ /** Tiền tố cookie/localStorage. Mặc định "_bzc_" */
739
+ storagePrefix?: string;
740
+ /** Nguồn nội dung popup/banner (dùng cho thử nghiệm, hoặc khi server chưa có API). Trả về danh sách campaign cần hiển thị */
741
+ contentProvider?: (ctx: {
742
+ deviceId: string;
743
+ cid?: number;
744
+ pageUrl: string;
745
+ }) => Promise<unknown[]>;
746
+ /** @deprecated dùng sdkKey */ apiKey?: string;
747
+ /** @deprecated dùng apiHost */ endpoint?: string;
748
+ /** @deprecated dùng batch.size */ batchSize?: number;
749
+ /** @deprecated dùng batch.intervalMs */ flushIntervalMs?: number;
750
+ /** @deprecated dùng sessionTimeoutMin */ sessionTimeoutMs?: number;
751
+ /** @deprecated dùng autoPageView */ autoTrack?: {
752
+ session?: boolean;
753
+ pageView?: boolean;
754
+ };
755
+ /** @deprecated dùng webPush.vapidPublicKey */ vapidPublicKey?: string;
756
+ /** @deprecated dùng webPush.serviceWorkerPath */ serviceWorkerUrl?: string;
757
+ /** @deprecated dùng inApp */ campaigns?: boolean;
758
+ /** @deprecated */ campaignsRefreshMs?: number;
759
+ }
760
+ /** Cấu hình đã chuẩn hoá (đầy đủ giá trị mặc định) */
761
+ interface ResolvedConfig {
762
+ sdkKey: string;
763
+ apiHost: string;
764
+ env: 'production' | 'staging';
765
+ autoPageView: boolean;
766
+ autoSession: boolean;
767
+ sessionTimeoutMs: number;
768
+ requireConsent: boolean;
769
+ cookieDomain?: string;
770
+ batchSize: number;
771
+ batchIntervalMs: number;
772
+ webPush: {
773
+ enabled: boolean;
774
+ serviceWorkerPath: string;
775
+ serviceWorkerScope: string;
776
+ vapidPublicKey?: string;
777
+ softPrompt: boolean;
778
+ };
779
+ inApp: {
780
+ popups: boolean;
781
+ banners: boolean;
782
+ scriptUrl?: string;
783
+ };
784
+ debug: boolean;
785
+ appVersion?: string;
786
+ maxQueueSize: number;
787
+ maxQueueAgeMs: number;
788
+ allowUnknownEvents: boolean;
789
+ allowUnknownAttributes: boolean;
790
+ sensitiveQueryParams: string[];
791
+ storagePrefix: string;
792
+ campaignsRefreshMs: number;
793
+ contentProvider?: SdkConfig['contentProvider'];
794
+ }
795
+ interface Identifiers {
796
+ customer_id?: string;
797
+ national_id?: string;
798
+ phone_number?: string;
799
+ email?: string;
800
+ [key: string]: string | undefined;
801
+ }
802
+ type Params = Record<string, unknown>;
803
+ /** Bản ghi chuẩn gửi tới POST /ingest/records */
804
+ interface EventRecord {
805
+ record_type: 'event';
806
+ name: string;
807
+ event_id: string;
808
+ event_time: string;
809
+ source: 'web_sdk';
810
+ device_id: string;
811
+ session_id: string;
812
+ platform: 'web';
813
+ sdk_version: string;
814
+ app_version?: string;
815
+ os_version?: string;
816
+ user_agent?: string;
817
+ page_url?: string;
818
+ referrer?: string;
819
+ utm_source?: string;
820
+ utm_medium?: string;
821
+ utm_campaign?: string;
822
+ utm_content?: string;
823
+ utm_term?: string;
824
+ /** correlation (channel, message_id, variant_id, message_type, campaign_id, ...) nằm phẳng ở cấp ngoài */
825
+ [correlation: string]: unknown;
826
+ values: Record<string, unknown>;
827
+ }
828
+ interface AttributeRecord {
829
+ record_type: 'attribute';
830
+ source_record_id: string;
831
+ device_id: string;
832
+ values: Record<string, unknown>;
833
+ update_mode?: UpdateMode;
834
+ }
835
+ type Record_ = EventRecord | AttributeRecord;
836
+ /** @deprecated tên cũ */
837
+ type EventEnvelope = EventRecord;
838
+ type UpdateMode = 'replace' | 'append' | 'remove';
839
+ type TypedEventName = keyof EventParamMap;
840
+ type TypedParams<N extends TypedEventName> = EventParamMap[N];
841
+ type ConsentStatus = 'granted' | 'withdrawn';
842
+ type AttributeValue = string | number | boolean | Date | string[] | number[] | null;
843
+ type Attributes = Record<string, AttributeValue>;
844
+ interface RecordResult {
845
+ index: number;
846
+ status: 'accepted' | 'pending' | 'rejected';
847
+ reason?: string;
848
+ errors?: Array<{
849
+ field?: string;
850
+ code: string;
851
+ }>;
852
+ warnings?: Array<{
853
+ field?: string;
854
+ code: string;
855
+ }>;
856
+ }
857
+ /** accepted/pending: server đã nhận. queued: chưa gửi được (offline, tạm dừng, bị chặn) nhưng đã lưu bền và sẽ gửi sau. dropped: bỏ (chưa đồng ý theo dõi…) */
858
+ interface TrackResult {
859
+ status: 'accepted' | 'pending' | 'queued' | 'dropped';
860
+ warnings?: RecordResult['warnings'];
861
+ reason?: string;
862
+ }
863
+ interface IdentifyResult {
864
+ cid: number;
865
+ caseCode?: number;
866
+ action?: 'convert' | 'merge' | 'use' | 'create' | 'switch';
867
+ mappingVersion?: number;
868
+ }
869
+ interface SdkError extends Error {
870
+ code?: string;
871
+ errors?: RecordResult['errors'];
872
+ }
873
+
874
+ /** Định dạng campaign mà platform trả về cho Web SDK (GET /api/collect/campaigns). Đây là hợp đồng giữa SDK và platform.
875
+ * Nội dung là DỮ LIỆU thuần (không HTML tự do) để tránh XSS trên site ngân hàng. */
876
+ type Template = 'modal' | 'slide_in' | 'banner_top' | 'banner_bottom' | 'inline';
877
+ type Kind = 'message' | 'survey' | 'lead_form' | 'gamification';
878
+ type UrlMatch = {
879
+ match: 'equals' | 'contains' | 'starts_with' | 'regex';
880
+ value: string;
881
+ };
882
+ type Action = {
883
+ type: 'url';
884
+ url: string;
885
+ newTab?: boolean;
886
+ } | {
887
+ type: 'go_to_page';
888
+ url: string;
889
+ } | {
890
+ type: 'dismiss';
891
+ } | {
892
+ type: 'request_push_permission';
893
+ } | {
894
+ type: 'trigger_event';
895
+ event: string;
896
+ params?: Record<string, unknown>;
897
+ } | {
898
+ type: 'update_attribute';
899
+ attributes: Record<string, unknown>;
900
+ } | {
901
+ type: 'copy_code';
902
+ code: string;
903
+ };
904
+ interface Button {
905
+ id: string;
906
+ text: string;
907
+ style?: 'primary' | 'secondary';
908
+ action: Action;
909
+ }
910
+ interface SurveyQuestion {
911
+ id: string;
912
+ text: string;
913
+ type: 'single_choice' | 'multi_choice' | 'rating' | 'nps' | 'text';
914
+ options?: Array<{
915
+ id: string;
916
+ text: string;
917
+ }>;
918
+ }
919
+ interface LeadField {
920
+ name: string;
921
+ label: string;
922
+ type?: 'text' | 'email' | 'phone' | 'checkbox';
923
+ required?: boolean;
924
+ }
925
+ /** `has_coupon`: giải kèm mã coupon (máy chủ quyết giải và cấp mã, docs/sdk-inapp-contract.md mục 2.4). */
926
+ interface Prize {
927
+ id: string;
928
+ label: string;
929
+ weight?: number;
930
+ is_win?: boolean;
931
+ has_coupon?: boolean;
932
+ }
933
+ interface Campaign {
934
+ id: string;
935
+ name: string;
936
+ kind?: Kind;
937
+ template: Template;
938
+ slot_id?: string;
939
+ position?: number;
940
+ variant_id?: string;
941
+ message_type?: 'advertisement' | 'announcement';
942
+ campaign_type?: string;
943
+ content_id?: string;
944
+ priority?: number;
945
+ start_time?: string;
946
+ end_time?: string;
947
+ /** 'design' = `design` là cây thiết kế của composer đã được server giải quyết (docs/sdk-inapp-contract.md mục 3.1); mặc định 'content'. */
948
+ render?: 'design' | 'content';
949
+ design?: unknown;
950
+ /** Mã tin do server cấp (m-<campaign>-<cid|device>): SDK gửi đúng mã này để journey đối chiếu 'đã xem'. */
951
+ message_id?: string;
952
+ content?: {
953
+ title?: string;
954
+ body?: string;
955
+ image_url?: string;
956
+ buttons?: Button[];
957
+ theme?: {
958
+ background?: string;
959
+ text?: string;
960
+ accent?: string;
961
+ };
962
+ };
963
+ /** `thanks`: bước "Cảm ơn" (chữ, `coupon_ref` = danh sách coupon: SDK hỏi mã khi khách trả lời xong). */
964
+ survey?: {
965
+ survey_id: string;
966
+ questions: SurveyQuestion[];
967
+ thanks?: {
968
+ text?: string;
969
+ coupon_ref?: string;
970
+ };
971
+ };
972
+ lead_form?: {
973
+ form_id: string;
974
+ submit_text?: string;
975
+ fields: LeadField[];
976
+ };
977
+ /** `server`: có giải kèm mã coupon → máy chủ quyết giải (POST /sdk/web/game/play), không chọn ở trình duyệt. */
978
+ game?: {
979
+ game_type: 'spin_wheel' | 'scratch_card' | 'gift_box';
980
+ prizes: Prize[];
981
+ play_text?: string;
982
+ server?: boolean;
983
+ };
984
+ trigger?: {
985
+ urls?: UrlMatch[];
986
+ delay_ms?: number;
987
+ scroll_percent?: number;
988
+ exit_intent?: boolean;
989
+ event?: {
990
+ name: string;
991
+ params?: Record<string, unknown>;
992
+ };
993
+ /** Nhiều điều kiện (server): mode any = một điều kiện đủ, all = mọi điều kiện đã xảy ra trong phiên. */
994
+ mode?: 'any' | 'all';
995
+ list?: Array<{
996
+ kind: 'page';
997
+ urls: UrlMatch[];
998
+ } | {
999
+ kind: 'event';
1000
+ name: string;
1001
+ }>;
1002
+ /** Đang chờ delay_ms mà event này xảy ra (trong wait_ms kể từ lúc bắt đầu chờ) thì hủy lần hiện này. */
1003
+ cancel?: {
1004
+ event: string;
1005
+ wait_ms?: number;
1006
+ };
1007
+ };
1008
+ display_window?: {
1009
+ freq: 'daily' | 'weekly' | 'monthly';
1010
+ weekdays?: number[];
1011
+ month_days?: number[];
1012
+ start: string;
1013
+ end: string;
1014
+ tz?: string;
1015
+ };
1016
+ /** Trang được phép hiện (khớp một mục), áp cùng lúc với trigger; thiếu = mọi trang. */
1017
+ display_pages?: UrlMatch[];
1018
+ fallback?: boolean;
1019
+ audience?: {
1020
+ logged_in?: boolean;
1021
+ };
1022
+ frequency?: {
1023
+ max_in_window?: {
1024
+ count: number;
1025
+ days: number;
1026
+ };
1027
+ max_per_period?: {
1028
+ count: number;
1029
+ period: 'daily' | 'weekly' | 'monthly';
1030
+ };
1031
+ max_per_day?: number;
1032
+ max_total?: number;
1033
+ cooldown_ms?: number;
1034
+ hide_after_dismiss?: boolean;
1035
+ hide_after_click?: boolean;
1036
+ };
1037
+ }
1038
+
1039
+ type DismissType = 'close_button' | 'auto_close' | 'tap_outside' | 'back';
1040
+
1041
+ /** Phần của SDK mà bộ chạy popup / banner dùng: CdpSdk trên website, AppInAppHost trong WebView của app (src/inapp-app.ts). */
1042
+ interface InAppHost {
1043
+ readonly config: Pick<ResolvedConfig, 'inApp' | 'campaignsRefreshMs' | 'contentProvider'>;
1044
+ readonly log: {
1045
+ log(...a: unknown[]): void;
1046
+ warn(...a: unknown[]): void;
1047
+ };
1048
+ readonly storage: {
1049
+ getJSON<T>(k: string): T | null;
1050
+ setJSON(k: string, v: unknown): void;
1051
+ };
1052
+ readonly http: {
1053
+ request(method: 'GET' | 'POST', path: string, body?: unknown): Promise<{
1054
+ status: number;
1055
+ ok: boolean;
1056
+ json?: unknown;
1057
+ }>;
1058
+ };
1059
+ readonly trackingBlocked: boolean;
1060
+ webPush?: {
1061
+ subscribe(mode: 'soft'): Promise<unknown>;
1062
+ };
1063
+ /** `replay` = nhận cả event đã xảy ra trước khi bộ chạy gắn vào (bản <script> tải bộ chạy sau, CdpSdk.holdEvents) */
1064
+ onEvent(fn: (name: string, params: Record<string, unknown>) => void, replay?: boolean): void;
1065
+ onIdentify(fn: () => void): void;
1066
+ getDeviceId(): string;
1067
+ getCid(): number | undefined;
1068
+ isIdentified(): boolean;
1069
+ whenSynced(): Promise<void>;
1070
+ emit(name: string, params?: Record<string, unknown>): void;
1071
+ track(name: string, params?: Record<string, unknown>): Promise<unknown>;
1072
+ setAttributes(attrs: Record<string, unknown>): Promise<unknown>;
1073
+ identify(ids: Record<string, string>): Promise<unknown>;
1074
+ flush(): Promise<void>;
1075
+ }
1076
+ /**
1077
+ * Popup trong app mobile (WebView, docs/INAPP-APP.md): API `/sdk/app/*`, "trang" là tên màn hình app đang mở, sự kiện
1078
+ * `inapp_*` (kênh inapp_popup), sao chép / xin quyền thông báo / mở link qua cầu nối native, báo app khi có / hết popup.
1079
+ */
1080
+ interface AppSurface {
1081
+ screen(): string;
1082
+ /** Vị trí banner (`placement_id`) WebView này vẽ; rỗng = WebView popup. */
1083
+ slots(): string[];
1084
+ lang(): 'vi' | 'en';
1085
+ platform: string;
1086
+ copy(text: string): void;
1087
+ requestPush(): void;
1088
+ onVisible(visible: boolean): void;
1089
+ }
1090
+ declare class CampaignEngine {
1091
+ private sdk;
1092
+ private app?;
1093
+ private campaigns;
1094
+ private pending;
1095
+ private active;
1096
+ private shownAt;
1097
+ private seenEvents;
1098
+ private ttlTimer?;
1099
+ private waiting;
1100
+ private modalOpen;
1101
+ private refreshTimer?;
1102
+ private cleanup;
1103
+ private slotSig;
1104
+ private seenSig;
1105
+ private slotTimer?;
1106
+ private slotObserver?;
1107
+ private loading;
1108
+ private reloadAfter;
1109
+ constructor(sdk: InAppHost, app?: AppSurface | undefined);
1110
+ /** Trang đang xem (website) / màn hình đang mở (app): điều kiện "trang", nhớ campaign đã hiện ở đâu. */
1111
+ private here;
1112
+ private get api();
1113
+ private lang;
1114
+ /** Thân chung của các API nội dung: website gửi đường dẫn trang, app gửi màn hình + nền tảng. */
1115
+ private where;
1116
+ /** App: báo native còn popup đang hiện / đang chờ hay không (để hiện / ẩn WebView). */
1117
+ private visibility;
1118
+ start(): void;
1119
+ stop(): void;
1120
+ /** Các khung banner (`data-cdp-slot`) đang có trên trang, đã khử trùng lặp và sắp xếp. */
1121
+ private slotsOnPage;
1122
+ /** Website SPA dựng khung banner sau khi SDK đã nạp nội dung (hoặc đổi khung khi chuyển trang): theo dõi DOM,
1123
+ * tập khung khác với lần nạp trước thì nạp lại để lấy banner cho các khung mới. Chỉ khi dùng API của nền tảng (không có contentProvider). */
1124
+ private watchSlots;
1125
+ private scheduleSlotCheck;
1126
+ /** Gỡ các banner đã vẽ nhưng phần tử không còn trong trang. Trả về true nếu có. */
1127
+ private pruneDetached;
1128
+ /** Đóng popup hiện lên sau cùng (nút Back của app). false = không có popup nào đang hiện. */
1129
+ closeTop(type?: DismissType): boolean;
1130
+ /** Ghi đè danh sách campaign (dùng cho test/preview) */
1131
+ setCampaigns(list: Campaign[]): void;
1132
+ get loaded(): Campaign[];
1133
+ load(): Promise<void>;
1134
+ private loadNow;
1135
+ /** Gọi hai API nội dung. null = lỗi (giữ danh sách cũ). Chỉ gọi khi thiết bị đã đăng ký. */
1136
+ private fetchServer;
1137
+ /**
1138
+ * Mã coupon của popup đang hiện (phần tử coupon có `couponRef`): server cấp lúc này, mỗi khách 1 mã / danh sách /
1139
+ * campaign, hiện lại ra đúng mã cũ (docs/sdk-inapp-contract.md mục 2.3). null = không có mã (404, lỗi mạng, chặn theo dõi).
1140
+ */
1141
+ private couponCode;
1142
+ /**
1143
+ * Mã của bước "Cảm ơn" của khảo sát: gửi câu trả lời mọi câu hỏi, máy chủ kiểm tra rồi mới cấp (mỗi khách 1 mã / danh
1144
+ * sách / campaign; docs/sdk-inapp-contract.md mục 2.5). null = không có mã (trả lời chưa đủ, hết mã, lỗi mạng…).
1145
+ */
1146
+ private surveyCode;
1147
+ /**
1148
+ * Một lượt chơi mini game có giải kèm mã: máy chủ quyết giải, giới hạn lượt chơi, cấp mã (docs/sdk-inapp-contract.md
1149
+ * mục 2.4). null = không chơi được (popup không còn dành cho khách, khách chưa có hồ sơ, lỗi mạng).
1150
+ */
1151
+ private gamePlay;
1152
+ /** Gọi lại khi hết `ttl_sec`. */
1153
+ private schedule;
1154
+ /** Điều kiện trang: nhiều điều kiện (`trigger.list`) hoặc `trigger.urls` cũ. */
1155
+ private urlGate;
1156
+ /** Các điều kiện trang / event đã thỏa theo `mode` (chỉ cho `trigger.list`). */
1157
+ private listOk;
1158
+ private onPage;
1159
+ private eligible;
1160
+ /** Banner mặc định phải nhường: khung có banner thường đang hiện, hoặc còn hiện được. */
1161
+ private slotHeld;
1162
+ /** Hiệu lực, trang, khung giờ, đăng nhập và tần suất. */
1163
+ private allowed;
1164
+ private arm;
1165
+ private onTrackedEvent;
1166
+ private check;
1167
+ private freqKey;
1168
+ private freqAll;
1169
+ private freqOk;
1170
+ private freqUpdate;
1171
+ private show;
1172
+ private display;
1173
+ private runAction;
1174
+ }
1175
+
1176
+ type PushPrompt = 'soft' | 'native';
1177
+ /** Lý do lần bật gần nhất thất bại (webPush.lastError). Website dùng để báo đúng cho người dùng thay vì "thử lại".
1178
+ * - unsupported: trình duyệt không có Push API · no_consent: chưa/đã rút consent · disabled: tenant chưa có kênh Web Push (hoặc không lấy được config, ví dụ origin không được phép)
1179
+ * - dismissed: bấm "Để sau" ở hộp của SDK hoặc đóng hộp xin quyền · denied: quyền bị chặn
1180
+ * - out_of_scope: trang nằm ngoài serviceWorkerScope (service worker không bao giờ điều khiển trang này) · sw_timeout: service worker không kích hoạt kịp
1181
+ * - push_unavailable: đã cấp quyền nhưng trình duyệt từ chối đăng ký push (cửa sổ ẩn danh / chế độ khách)
1182
+ * - push_service: lỗi dịch vụ đẩy của trình duyệt (FCM/mạng) · push_token: nền tảng không nhận token */
1183
+ type PushFailReason = 'unsupported' | 'no_consent' | 'disabled' | 'dismissed' | 'denied' | 'out_of_scope' | 'sw_timeout' | 'push_unavailable' | 'push_service' | 'push_token';
1184
+ interface PushState {
1185
+ supported: boolean;
1186
+ permission: NotificationPermission | 'unsupported';
1187
+ subscribed: boolean;
1188
+ enabled: boolean;
1189
+ lastError: PushFailReason | null;
1190
+ }
1191
+ /** Web Push chuẩn VAPID. Khoá công khai lấy từ GET /sdk/web/config (mỗi tenant một cặp, đổi khoá thì đăng ký lại);
1192
+ * thiết bị đăng ký qua POST /identity/push-token. delivered/clicked do service worker báo vì trang có thể đã đóng. */
1193
+ declare class WebPush {
1194
+ private sdk;
1195
+ private vapid?;
1196
+ private enabledByServer;
1197
+ private failure;
1198
+ private pending?;
1199
+ private lock;
1200
+ constructor(sdk: CdpSdk);
1201
+ get supported(): boolean;
1202
+ private get swUrl();
1203
+ get enabled(): boolean;
1204
+ /** Lý do lần subscribe() gần nhất thất bại; null nếu thành công hoặc chưa thử */
1205
+ get lastError(): PushFailReason | null;
1206
+ /** Trang hiện tại có nằm trong scope của service worker không. Ngoài scope (ví dụ /shop so với scope /shop/) thì service worker
1207
+ * không bao giờ điều khiển trang, navigator.serviceWorker.ready treo mãi. */
1208
+ get inScope(): boolean;
1209
+ private serialize;
1210
+ /** Lấy khoá VAPID của tenant từ nền tảng. enabled=false (tenant chưa có kênh Web Push) thì SDK ẩn mọi nút đăng ký. */
1211
+ loadConfig(): Promise<boolean>;
1212
+ state(): Promise<PushState>;
1213
+ /** Gọi sau cử chỉ người dùng (nút bấm). `soft` = đã hỏi bằng UI riêng trước hộp xin quyền của trình duyệt.
1214
+ * Trả true/false; lý do thất bại ở `lastError`. Gọi lại khi lần trước chưa xong thì dùng chung kết quả lần đó. */
1215
+ subscribe(opts?: {
1216
+ soft?: boolean;
1217
+ } | PushPrompt): Promise<boolean>;
1218
+ private fail;
1219
+ private doSubscribe;
1220
+ unsubscribe(): Promise<boolean>;
1221
+ /** Mỗi lần init: đồng bộ trạng thái thực với nền tảng (đổi khoá VAPID, đổi endpoint, bị thu hồi quyền). */
1222
+ refresh(): Promise<void>;
1223
+ private doRefresh;
1224
+ /** Lấy/tạo subscription với khoá hiện hành rồi gửi lên nền tảng */
1225
+ private register;
1226
+ /** Service worker không có localStorage: SDK gửi cấu hình để nó ghi vào IndexedDB và tự báo event */
1227
+ private configureWorker;
1228
+ }
1229
+
1230
+ /** Lưu trữ key-value có fallback: localStorage -> bộ nhớ. Không bao giờ ném lỗi. */
1231
+ declare class Storage {
1232
+ private prefix;
1233
+ private cookieDomain?;
1234
+ private mem;
1235
+ constructor(prefix: string, cookieDomain?: string | undefined);
1236
+ get(key: string): string | null;
1237
+ set(key: string, value: string): void;
1238
+ remove(key: string): void;
1239
+ getJSON<T>(key: string): T | null;
1240
+ setJSON(key: string, value: unknown): void;
1241
+ getSession(key: string): string | null;
1242
+ setSession(key: string, value: string): void;
1243
+ removeCookie(name: string): void;
1244
+ getCookie(name: string): string | null;
1245
+ setCookie(name: string, value: string, days?: number): void;
1246
+ }
1247
+
1248
+ declare class Logger {
1249
+ debug: boolean;
1250
+ constructor(debug: boolean);
1251
+ log(...a: unknown[]): void;
1252
+ warn(...a: unknown[]): void;
1253
+ }
1254
+
1255
+ interface TransportOptions {
1256
+ apiHost: string;
1257
+ sdkKey: string;
1258
+ }
1259
+ /** Kết quả gửi lô bản ghi tới /ingest/records */
1260
+ type SendOutcome = {
1261
+ kind: 'ok';
1262
+ results: RecordResult[];
1263
+ } | {
1264
+ kind: 'retry';
1265
+ } | {
1266
+ kind: 'pause';
1267
+ until: number;
1268
+ } | {
1269
+ kind: 'stop';
1270
+ reason: string;
1271
+ } | {
1272
+ kind: 'drop';
1273
+ status: number;
1274
+ message?: string;
1275
+ };
1276
+ interface HttpResult<T> {
1277
+ status: number;
1278
+ ok: boolean;
1279
+ json?: T;
1280
+ etag?: string;
1281
+ }
1282
+ /** Mọi lời gọi mạng của SDK nằm ở đây. Không bao giờ ném lỗi ra ngoài. */
1283
+ declare class Transport {
1284
+ private o;
1285
+ private log;
1286
+ constructor(o: TransportOptions, log: Logger);
1287
+ get host(): string;
1288
+ get key(): string;
1289
+ /** Gọi API thô. Trả status 0 khi lỗi mạng. */
1290
+ request<T = unknown>(method: 'GET' | 'POST', path: string, body?: unknown, extra?: {
1291
+ etag?: string;
1292
+ keepalive?: boolean;
1293
+ }): Promise<HttpResult<T>>;
1294
+ /** POST /ingest/records: phân loại kết quả để hàng đợi biết phải làm gì tiếp */
1295
+ sendRecords(records: Record_[], keepalive?: boolean): Promise<SendOutcome>;
1296
+ getOrCreateDevice(body: Record<string, unknown>): Promise<HttpResult<{
1297
+ cid: number;
1298
+ profileStatus: string;
1299
+ mappingVersion: number;
1300
+ }>>;
1301
+ identify(body: Record<string, unknown>): Promise<HttpResult<IdentifyResult & {
1302
+ message?: string;
1303
+ errorCode?: string;
1304
+ }>>;
1305
+ logout(deviceId: string): Promise<HttpResult<unknown>>;
1306
+ pushToken(body: Record<string, unknown>): Promise<HttpResult<unknown>>;
1307
+ dictionary(etag?: string): Promise<HttpResult<unknown>>;
1308
+ webConfig(): Promise<HttpResult<{
1309
+ webPush?: {
1310
+ enabled?: boolean;
1311
+ vapidPublicKey?: string;
1312
+ };
1313
+ }>>;
1314
+ slots(etag?: string): Promise<HttpResult<{
1315
+ slots?: unknown[];
1316
+ }>>;
1317
+ }
1318
+
1319
+ type SdkEvent = 'ready' | 'identified' | 'cidChanged' | 'error' | 'popupShown';
1320
+ declare class CdpSdk {
1321
+ cfg: ResolvedConfig;
1322
+ log: Logger;
1323
+ private store;
1324
+ private queue;
1325
+ private transport;
1326
+ private session;
1327
+ private dict;
1328
+ private deviceId;
1329
+ private ready;
1330
+ private activated;
1331
+ private gate;
1332
+ private flushing;
1333
+ private flushAgain;
1334
+ private attempt;
1335
+ private pausedUntil;
1336
+ private stopped;
1337
+ private timer?;
1338
+ private timerAt;
1339
+ private consents;
1340
+ private lastPageUrl;
1341
+ private waiters;
1342
+ private unsent;
1343
+ /** Event gọi khi từ điển của server chưa có (lần mở trang đầu): chạy lần lượt khi từ điển tải xong / lỗi / quá DICT_WAIT_MS */
1344
+ private waiting;
1345
+ private handlers;
1346
+ private listeners;
1347
+ /** Event giữ lại cho module gắn vào sau (bộ chạy popup / banner tải sau ở bản <script>): xem holdEvents() */
1348
+ private held;
1349
+ private grantedHooks;
1350
+ /** Cho phép module ngoài (autotrack…) gắn hook sau khi init */
1351
+ onInit: Array<() => void>;
1352
+ webPush?: WebPush;
1353
+ campaigns?: CampaignEngine;
1354
+ get http(): Transport;
1355
+ get storage(): Storage;
1356
+ get config(): ResolvedConfig;
1357
+ get catalog(): Catalog;
1358
+ get isReady(): boolean;
1359
+ get sessionId(): string;
1360
+ get trackingBlocked(): boolean;
1361
+ /** Resolve khi cid đã đồng bộ với server (đăng ký thiết bị, và identify đang chạy nếu có). */
1362
+ whenSynced(): Promise<void>;
1363
+ /** Khởi tạo. Không bao giờ ném lỗi: thiếu cấu hình thì ghi cảnh báo và SDK ở trạng thái tắt. Promise resolve khi thiết bị đã đăng ký với nền tảng. */
1364
+ init(config: SdkConfig): Promise<void>;
1365
+ /** Bắt đầu thu thập: lưu device_id, đăng ký thiết bị, tải từ điển, gắn sự kiện trình duyệt */
1366
+ private activate;
1367
+ /**
1368
+ * Mỗi lần mở trang: hỏi server hồ sơ hiện tại của thiết bị, vì cid lưu ở trình duyệt có thể không còn đúng (hồ sơ bị
1369
+ * gộp / xoá, dữ liệu được đặt lại). cid đổi thì quên những gì đã gửi theo cid cũ (identify, đăng ký push) để gửi lại.
1370
+ * Gọi lỗi thì dùng tiếp cid đang lưu.
1371
+ */
1372
+ private registerDevice;
1373
+ private releaseWaiting;
1374
+ private onHttpFailure;
1375
+ private halt;
1376
+ on(event: SdkEvent, cb: (d?: unknown) => void): () => void;
1377
+ fire(event: SdkEvent, data?: unknown): void;
1378
+ /** Module (campaign trigger) lắng nghe mọi event đã được chấp nhận */
1379
+ /** `replay`: nhận lại các event đã giữ từ lúc holdEvents() (rồi thôi giữ). */
1380
+ onEvent(fn: (name: string, params: Record<string, unknown>) => void, replay?: boolean): void;
1381
+ /** Bắt đầu giữ event đã chấp nhận (tối đa 100) cho tới khi có listener `onEvent(fn, true)`: module tải sau không lỡ event
1382
+ * (trigger "khi có event", điều kiện "mọi event đã xảy ra trong phiên"). */
1383
+ holdEvents(): void;
1384
+ onIdentify(fn: () => void): void;
1385
+ onConsentGranted(fn: () => void): void;
1386
+ track<N extends TypedEventName>(name: N, params: TypedParams<N>): Promise<TrackResult>;
1387
+ track(name: string, params?: Params): Promise<TrackResult>;
1388
+ /** Gửi page_view thủ công (khi autoPageView = false hoặc trang tự dựng) */
1389
+ page(params?: Params): Promise<TrackResult>;
1390
+ /** Gọi sau khi đăng nhập / đổi tài khoản. Mã KH, CCCD, SĐT, email chỉ đi qua đây. */
1391
+ identify(ids: Identifiers): Promise<IdentifyResult>;
1392
+ private doIdentify;
1393
+ /** Đăng xuất: giữ device_id và cid trong bộ nhớ (TI-R-07), bắt đầu phiên mới, quên hash identify. */
1394
+ logout(): Promise<void>;
1395
+ setAttribute(name: string, value: AttributeValue, mode?: UpdateMode): Promise<TrackResult>;
1396
+ /** Cập nhật thuộc tính hồ sơ theo từ điển. Giá trị là định danh (SĐT, email…) không đi qua đây mà qua identify (TI-R-08). */
1397
+ setAttributes(attrs: Attributes, mode?: UpdateMode): Promise<TrackResult>;
1398
+ /** Đồng ý / rút đồng ý. `setConsent('analytics', true)`; dạng cũ `setConsent('granted')` = analytics. Phát event consent_updated. */
1399
+ setConsent(category: string, value?: boolean | ConsentStatus, opts?: {
1400
+ changeSource?: string;
1401
+ channel?: string;
1402
+ }): Promise<TrackResult>;
1403
+ /** Xoá toàn bộ dữ liệu cục bộ (device_id, cid, phiên, hàng đợi) — dùng khi phát triển / kiểm thử */
1404
+ reset(): Promise<void>;
1405
+ getDeviceId(): string;
1406
+ getCid(): number | undefined;
1407
+ /** Thiết bị đang gắn với hồ sơ đã định danh (không còn anonymous) */
1408
+ isIdentified(): boolean;
1409
+ /** Gửi ngay mọi bản ghi đang chờ. */
1410
+ flush(): Promise<void>;
1411
+ /** Dùng bởi module (autotrack, popup, push): gửi event, lỗi chỉ được log */
1412
+ emit(name: string, params?: Params, bypassConsent?: boolean, internal?: boolean): void;
1413
+ /** Hàm xử lý chung cho track/emit */
1414
+ private record;
1415
+ /** Phiên + giờ + trang lúc event xảy ra. Mở phiên mới thì phát session_start trước. */
1416
+ private capture;
1417
+ private recordNow;
1418
+ private enqueue;
1419
+ /** Gửi riêng một bản ghi, không qua hàng đợi (event rút consent: hàng đợi đã bị xoá và việc gửi bình thường đã dừng) */
1420
+ private sendDirect;
1421
+ /** Báo kết quả từng bản ghi cho nơi gọi track()/setAttributes() */
1422
+ private settle;
1423
+ private rejectAll;
1424
+ private blocked;
1425
+ private loadConsents;
1426
+ private url;
1427
+ /** utm_* lấy từ URL landing, giữ suốt phiên web */
1428
+ private captureUtm;
1429
+ /** Lên lịch gửi: lịch sớm hơn thắng lịch muộn hơn; `force` (backoff) thay lịch hiện có */
1430
+ private schedule;
1431
+ /** Nhiều tab: chỉ một tab gửi tại một thời điểm (Web Locks), tránh gửi trùng */
1432
+ private locked;
1433
+ /** Rời trang: gửi bản ghi chưa được xác nhận bằng fetch keepalive (sendBeacon không có header x-api-key). Giữ trong hàng đợi, server loại trùng theo event_id. */
1434
+ private flushOnUnload;
1435
+ /** Cho module autotrack */
1436
+ markPage(url: string): boolean;
1437
+ }
1438
+
1439
+ /**
1440
+ * Lớp dùng chung cho React / Vue / ứng dụng SPA tự viết (`@bizfly/cdp-react`, `@bizfly/cdp-vue` đều đứng trên nó):
1441
+ * - MỘT SDK cho cả trang (giữ trên `window`): React StrictMode, HMR, gọi `createClient` nhiều lần đều dùng lại SDK đầu tiên,
1442
+ * không gửi trùng page_view / không mở hai bộ hiển thị popup.
1443
+ * - An toàn khi render ở máy chủ (Next.js, Nuxt): không có `window` thì trả client rỗng, mọi hàm resolve
1444
+ * `{ status: 'dropped', reason: 'server' }` và không đụng tới `document` / `location`.
1445
+ * - Không ném lỗi đồng bộ: mọi hàm trả Promise.
1446
+ * - `state` + `subscribe` để framework vẽ lại khi SDK sẵn sàng / khách được định danh (useSyncExternalStore, ref của Vue).
1447
+ */
1448
+ interface ClientState {
1449
+ /** SDK đã khởi tạo và đăng ký thiết bị xong (sự kiện `ready`) */
1450
+ ready: boolean;
1451
+ cid?: number;
1452
+ deviceId?: string;
1453
+ /** Thiết bị đang gắn với hồ sơ đã định danh */
1454
+ identified: boolean;
1455
+ }
1456
+ interface BizCdpClient {
1457
+ /** SDK gốc (null khi chạy ở máy chủ) */
1458
+ readonly sdk: CdpSdk | null;
1459
+ /** Ảnh chụp trạng thái hiện tại (cùng một object cho tới khi có thay đổi) */
1460
+ readonly state: ClientState;
1461
+ /** Nghe thay đổi `state`; trả hàm hủy */
1462
+ subscribe(listener: () => void): () => void;
1463
+ track(name: string, params?: Record<string, unknown>): Promise<TrackResult>;
1464
+ page(params?: Record<string, unknown>): Promise<TrackResult>;
1465
+ identify(identifiers: Identifiers): Promise<IdentifyResult | undefined>;
1466
+ logout(): Promise<void>;
1467
+ setAttribute(name: string, value: AttributeValue, mode?: UpdateMode): Promise<TrackResult>;
1468
+ setAttributes(attributes: Attributes, mode?: UpdateMode): Promise<TrackResult>;
1469
+ setConsent(category: string, value?: boolean | ConsentStatus, opts?: {
1470
+ changeSource?: string;
1471
+ channel?: string;
1472
+ }): Promise<TrackResult>;
1473
+ flush(): Promise<void>;
1474
+ reset(): Promise<void>;
1475
+ getCid(): number | undefined;
1476
+ getDeviceId(): string | undefined;
1477
+ /** Nghe sự kiện của SDK (`ready`, `identified`, `cidChanged`, `error`, `popupShown`); trả hàm hủy */
1478
+ on(event: SdkEvent, cb: (data?: unknown) => void): () => void;
1479
+ /** Tải lại popup / banner ngay (ví dụ sau khi SPA đổi nội dung mà không đổi URL) */
1480
+ refreshCampaigns(): Promise<void>;
1481
+ webPush: {
1482
+ subscribe(opts?: {
1483
+ soft?: boolean;
1484
+ } | 'soft' | 'native'): Promise<boolean>;
1485
+ unsubscribe(): Promise<boolean>;
1486
+ getState(): Promise<PushState | undefined>;
1487
+ };
1488
+ }
1489
+ /**
1490
+ * Lấy client dùng chung của trang, khởi tạo SDK ở lần gọi đầu. Gọi lại với cấu hình khác thì vẫn dùng SDK đầu tiên
1491
+ * (cảnh báo khi `sdkKey` khác). Chạy ở máy chủ thì trả client rỗng.
1492
+ */
1493
+ declare function createClient(config: SdkConfig): BizCdpClient;
1494
+ /** Client đã khởi tạo trên trang (null nếu chưa gọi createClient hoặc đang ở máy chủ). */
1495
+ declare function getClient(): BizCdpClient | null;
1496
+
1497
+ /** Tạo SDK mới và gắn auto-tracking. Dùng cho npm/ESM (bộ chạy popup / banner gắn ngay, không tải file riêng). */
1498
+ declare function createSdk(config?: SdkConfig): CdpSdk;
1499
+
1500
+ export { type AttributeValue, type Attributes, type BizCdpClient, CATALOG_VERSION, type Campaign, CampaignEngine, CdpSdk, type ClientState, type ConsentStatus, type CorrelationContext, type EventEnvelope, type EventParamMap, type EventRecord, type Identifiers, type IdentifyResult, type PushFailReason, type PushState, type SdkConfig, type SdkError, type SdkEvent, type TrackResult, type TypedEventName, type TypedParams, type UpdateMode, type WebEventName, WebPush, createClient, createSdk, getClient };