@moengage/web-sdk 2.70.1 → 2.71.1
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 +9 -8
- package/dist/index.d.ts +147 -6
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ This is the npm package of the origin SDK. Please refer the documentation for fu
|
|
|
6
6
|
|
|
7
7
|
### Installation
|
|
8
8
|
|
|
9
|
-
Install the dependencies
|
|
9
|
+
Install the dependencies
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
12
|
$ npm i @moengage/web-sdk
|
|
@@ -19,8 +19,9 @@ import moengage from '@moengage/web-sdk';
|
|
|
19
19
|
|
|
20
20
|
moengage.initialize(
|
|
21
21
|
{
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
appId: 'XXXXXXXXXXXX',
|
|
23
|
+
env: 'LIVE',
|
|
24
|
+
logLevel: 0,
|
|
24
25
|
}
|
|
25
26
|
);
|
|
26
27
|
|
|
@@ -30,14 +31,14 @@ moengage.identifyUser({
|
|
|
30
31
|
u_fn: 'some name',
|
|
31
32
|
});
|
|
32
33
|
|
|
33
|
-
//
|
|
34
|
-
moengage.
|
|
34
|
+
// or simply
|
|
35
|
+
moengage.identifyUser('abc@xyz.com') // sets just uid
|
|
35
36
|
|
|
36
|
-
moengage.
|
|
37
|
+
moengage.setEmailId('qwerty@xyz.com');
|
|
37
38
|
|
|
38
|
-
moengage.
|
|
39
|
+
moengage.trackEvent('Add to Cart', { name: 'Phone', price: '100000' });
|
|
39
40
|
|
|
40
|
-
moengage.
|
|
41
|
+
moengage.logoutUser();
|
|
41
42
|
|
|
42
43
|
```
|
|
43
44
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,19 +2,43 @@
|
|
|
2
2
|
* The configuration used while initializing the SDK.
|
|
3
3
|
*/
|
|
4
4
|
declare interface InitData {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated
|
|
7
|
+
* Use appId instead.
|
|
8
|
+
*/
|
|
5
9
|
app_id: string;
|
|
10
|
+
appId?: string;
|
|
6
11
|
cluster: string;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
* Use env and logLevel instead.
|
|
15
|
+
*/
|
|
7
16
|
debug_logs?: number;
|
|
8
17
|
env?: SDK_ENVIRONMENT;
|
|
9
18
|
logLevel?: LOG_LEVEL;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated
|
|
21
|
+
* Use projectId instead.
|
|
22
|
+
*/
|
|
10
23
|
project_id?: string;
|
|
24
|
+
projectId?: string;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated
|
|
27
|
+
* Use disableOnsite instead.
|
|
28
|
+
*/
|
|
11
29
|
disable_onsite?: boolean;
|
|
30
|
+
disableOnsite?: boolean;
|
|
12
31
|
enableSPA?: boolean;
|
|
13
32
|
/**
|
|
14
33
|
* Cards configuration for Web SDK Cards module
|
|
15
34
|
*/
|
|
16
35
|
cards?: CardsConfig;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated
|
|
38
|
+
* Use disableWebPush instead.
|
|
39
|
+
*/
|
|
17
40
|
disable_web_push?: boolean;
|
|
41
|
+
disableWebPush?: boolean;
|
|
18
42
|
swPath?: string;
|
|
19
43
|
swScope?: string;
|
|
20
44
|
disableCookies?: boolean;
|
|
@@ -23,7 +47,13 @@ declare interface InitData {
|
|
|
23
47
|
disableSdk?: boolean;
|
|
24
48
|
contentSecurityNonce?: string;
|
|
25
49
|
customProxyDomain?: string;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated
|
|
52
|
+
* Use botsList instead.
|
|
53
|
+
*/
|
|
26
54
|
bots_list?: string[];
|
|
55
|
+
botsList?: string[];
|
|
56
|
+
integrationType?: string;
|
|
27
57
|
}
|
|
28
58
|
|
|
29
59
|
/**
|
|
@@ -43,6 +73,32 @@ declare enum LOG_LEVEL {
|
|
|
43
73
|
ALL = 2,
|
|
44
74
|
}
|
|
45
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Integration type enum
|
|
78
|
+
*/
|
|
79
|
+
declare enum INTEGRATION_TYPE {
|
|
80
|
+
GTM = 'GTM',
|
|
81
|
+
FLUTTER = 'Flutter',
|
|
82
|
+
SEGMENT = 'Segment',
|
|
83
|
+
AMP = 'AMP',
|
|
84
|
+
NPM = 'NPM',
|
|
85
|
+
CHROME_EXTENSION = 'Chrome extension',
|
|
86
|
+
TV = 'TV',
|
|
87
|
+
VTEX = 'VTEX',
|
|
88
|
+
SHOPIFY = 'Shopify',
|
|
89
|
+
MOENGAGE_ASSIST = 'MoEngage Assist plugin',
|
|
90
|
+
DIRECT = 'Direct',
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Configuration for self-handled soft ask
|
|
94
|
+
*/
|
|
95
|
+
declare interface SelfHandledSoftAskConfig {
|
|
96
|
+
softAsk: boolean;
|
|
97
|
+
mainClass: string;
|
|
98
|
+
allowClass: string;
|
|
99
|
+
dismissClass: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
46
102
|
/**
|
|
47
103
|
* Cards configuration interface
|
|
48
104
|
* Matches CardsConfigModel structure from the SDK
|
|
@@ -186,6 +242,11 @@ declare function isMoeLoaded(): boolean;
|
|
|
186
242
|
* @param eventAttrs - The attributes associated with the event.
|
|
187
243
|
* @returns A Promise that resolves when the event tracking is completed.
|
|
188
244
|
*/
|
|
245
|
+
declare function trackEvent(eventName: string, eventAttrs: any): Promise<any>;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @deprecated Use trackEvent instead.
|
|
249
|
+
*/
|
|
189
250
|
declare function track_event(eventName: string, eventAttrs: any): Promise<any>;
|
|
190
251
|
|
|
191
252
|
/**
|
|
@@ -215,16 +276,12 @@ declare function setLogLevel(level: number): Promise<void>;
|
|
|
215
276
|
declare function setDebugLevel(level: number): Promise<void>;
|
|
216
277
|
|
|
217
278
|
/**
|
|
218
|
-
*
|
|
219
|
-
* @param id - The identifier associated to the user.
|
|
220
|
-
* @returns A Promise that resolves when setting of the identifier is complete.
|
|
279
|
+
* @deprecated Use identifyUser instead.
|
|
221
280
|
*/
|
|
222
281
|
declare function add_unique_user_id(id: string | number): Promise<any>;
|
|
223
282
|
|
|
224
283
|
/**
|
|
225
|
-
*
|
|
226
|
-
* @param id - The identifier associated to the user.
|
|
227
|
-
* @returns A Promise that resolves when the identifier is updated.
|
|
284
|
+
* @deprecated Use identifyUser instead.
|
|
228
285
|
*/
|
|
229
286
|
declare function update_unique_user_id(id: string | number): Promise<any>;
|
|
230
287
|
|
|
@@ -308,6 +365,15 @@ declare function getUserAttribute(
|
|
|
308
365
|
* @param userAttributeLevel - The level at which the user attribute is to be set. This is valid only for portfolio of DBs. If not provided, the attribute will be set at the 'PROJECT' level by default. Refer to `Attribute.USER_ATTRIBUTE_LEVEL` for possible values.
|
|
309
366
|
* @returns A Promise that resolves when the user attribute is added.
|
|
310
367
|
*/
|
|
368
|
+
declare function setUserAttribute(
|
|
369
|
+
attrName: string,
|
|
370
|
+
attrValue: any,
|
|
371
|
+
userAttributeLevel?: string,
|
|
372
|
+
): Promise<any>;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* @deprecated Use setUserAttribute instead.
|
|
376
|
+
*/
|
|
311
377
|
declare function add_user_attribute(
|
|
312
378
|
attrName: string,
|
|
313
379
|
attrValue: any,
|
|
@@ -332,6 +398,11 @@ declare namespace Attribute {
|
|
|
332
398
|
* @param firstName - the first name of the user.
|
|
333
399
|
* @returns A Promise that resolves when the first name is set.
|
|
334
400
|
*/
|
|
401
|
+
declare function setFirstName(firstName: string): Promise<any>;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @deprecated Use setFirstName instead.
|
|
405
|
+
*/
|
|
335
406
|
declare function add_first_name(firstName: string): Promise<any>;
|
|
336
407
|
|
|
337
408
|
/**
|
|
@@ -339,6 +410,11 @@ declare function add_first_name(firstName: string): Promise<any>;
|
|
|
339
410
|
* @param lastName - the last name of the user.
|
|
340
411
|
* @returns A Promise that resolves when the last name is set.
|
|
341
412
|
*/
|
|
413
|
+
declare function setLastName(lastName: string): Promise<any>;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* @deprecated Use setLastName instead.
|
|
417
|
+
*/
|
|
342
418
|
declare function add_last_name(lastName: string): Promise<any>;
|
|
343
419
|
|
|
344
420
|
/**
|
|
@@ -346,6 +422,11 @@ declare function add_last_name(lastName: string): Promise<any>;
|
|
|
346
422
|
* @param email - the email of the user.
|
|
347
423
|
* @returns A Promise that resolves when the email is set.
|
|
348
424
|
*/
|
|
425
|
+
declare function setEmailId(email: string): Promise<any>;
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* @deprecated Use setEmailId instead.
|
|
429
|
+
*/
|
|
349
430
|
declare function add_email(email: string): Promise<any>;
|
|
350
431
|
|
|
351
432
|
/**
|
|
@@ -353,6 +434,11 @@ declare function add_email(email: string): Promise<any>;
|
|
|
353
434
|
* @param mobile - the mobile number of the user.
|
|
354
435
|
* @returns A Promise that resolves when the mobile number is set.
|
|
355
436
|
*/
|
|
437
|
+
declare function setMobileNumber(mobile: string): Promise<any>;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* @deprecated Use setMobileNumber instead.
|
|
441
|
+
*/
|
|
356
442
|
declare function add_mobile(mobile: string): Promise<any>;
|
|
357
443
|
|
|
358
444
|
/**
|
|
@@ -360,6 +446,11 @@ declare function add_mobile(mobile: string): Promise<any>;
|
|
|
360
446
|
* @param user_name - the name of the user.
|
|
361
447
|
* @returns A Promise that resolves when the name is set.
|
|
362
448
|
*/
|
|
449
|
+
declare function setUserName(user_name: string): Promise<any>;
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* @deprecated Use setUserName instead.
|
|
453
|
+
*/
|
|
363
454
|
declare function add_user_name(user_name: string): Promise<any>;
|
|
364
455
|
|
|
365
456
|
/**
|
|
@@ -367,6 +458,11 @@ declare function add_user_name(user_name: string): Promise<any>;
|
|
|
367
458
|
* @param gender - the gender of the user.
|
|
368
459
|
* @returns A Promise that resolves when the gender is set.
|
|
369
460
|
*/
|
|
461
|
+
declare function setGender(gender: string): Promise<any>;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* @deprecated Use setGender instead.
|
|
465
|
+
*/
|
|
370
466
|
declare function add_gender(gender: string): Promise<any>;
|
|
371
467
|
|
|
372
468
|
/**
|
|
@@ -374,30 +470,56 @@ declare function add_gender(gender: string): Promise<any>;
|
|
|
374
470
|
* @param dob - the birthday of the user.
|
|
375
471
|
* @returns A Promise that resolves when the birthday is set.
|
|
376
472
|
*/
|
|
473
|
+
declare function setBirthDate(dob: Date): Promise<any>;
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* @deprecated Use setBirthDate instead.
|
|
477
|
+
*/
|
|
377
478
|
declare function add_birthday(dob: Date): Promise<any>;
|
|
378
479
|
|
|
379
480
|
/**
|
|
380
481
|
* Logs out the current user.
|
|
381
482
|
* @returns A Promise that resolves when the user is logged out.
|
|
382
483
|
*/
|
|
484
|
+
declare function logoutUser(): Promise<any>;
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* @deprecated Use logoutUser instead.
|
|
488
|
+
*/
|
|
383
489
|
declare function destroy_session(): Promise<any>;
|
|
384
490
|
|
|
385
491
|
/**
|
|
386
492
|
* Starts the web push operations.
|
|
493
|
+
* @param config - Configuration for self-handled soft ask (if opt-in type is two-step)
|
|
387
494
|
* @note Self-handled web push must be configured from MoEngage dashboard in order to use this method.
|
|
388
495
|
*/
|
|
496
|
+
declare function callWebPush(config?: SelfHandledSoftAskConfig): void;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* @deprecated Use callWebPush instead.
|
|
500
|
+
*/
|
|
389
501
|
declare function call_web_push(config?: any): void;
|
|
390
502
|
|
|
391
503
|
/**
|
|
392
504
|
* Tracks events related to page-view.
|
|
393
505
|
* @returns A Promise that resolves when tracking of page-view events is completed.
|
|
394
506
|
*/
|
|
507
|
+
declare function trackPageView(): Promise<any>;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* @deprecated Use trackPageView instead.
|
|
511
|
+
*/
|
|
395
512
|
declare function track_page_view(): Promise<any>;
|
|
396
513
|
|
|
397
514
|
/**
|
|
398
515
|
* Enforces the functionaly of page-change.
|
|
399
516
|
* Tracks page-view events and resets all the SDK modules.
|
|
400
517
|
*/
|
|
518
|
+
declare function handlePageChange(): void;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* @deprecated Use handlePageChange instead.
|
|
522
|
+
*/
|
|
401
523
|
declare function handle_page_change(): void;
|
|
402
524
|
|
|
403
525
|
/**
|
|
@@ -406,6 +528,11 @@ declare function handle_page_change(): void;
|
|
|
406
528
|
* @note Refer this guide on how to use the cards module: https://developers.moengage.com/hc/en-us/articles/9526886582292-Cards
|
|
407
529
|
* @returns A Promise that resolves when the cards module is successfully initialized.
|
|
408
530
|
*/
|
|
531
|
+
declare function onCardsLoaded(): Promise<any>;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* @deprecated Use onCardsLoaded instead.
|
|
535
|
+
*/
|
|
409
536
|
declare function on_cards_loaded(): Promise<any>;
|
|
410
537
|
|
|
411
538
|
/**
|
|
@@ -498,4 +625,18 @@ export {
|
|
|
498
625
|
Attribute,
|
|
499
626
|
SDK_ENVIRONMENT as env,
|
|
500
627
|
LOG_LEVEL as logLevel,
|
|
628
|
+
setUserAttribute,
|
|
629
|
+
setFirstName,
|
|
630
|
+
setLastName,
|
|
631
|
+
setEmailId,
|
|
632
|
+
setMobileNumber,
|
|
633
|
+
setUserName,
|
|
634
|
+
setGender,
|
|
635
|
+
setBirthDate,
|
|
636
|
+
logoutUser,
|
|
637
|
+
callWebPush,
|
|
638
|
+
trackPageView,
|
|
639
|
+
handlePageChange,
|
|
640
|
+
onCardsLoaded,
|
|
641
|
+
trackEvent,
|
|
501
642
|
};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const Moe={initialize:e=>{if(e&&
|
|
1
|
+
const Moe={initialize:e=>{var o=e.appId||e.app_id;if(e&&o){var n=e.debug_logs||0,a=e.env||null,d=e.logLevel||null,i=e.cluster||"DC_1",t=e.projectId||e.project_id||null,s=e.disableOnsite||e.disable_onsite||!1,r=e.enableSPA||!1,g=e.cards||null,l=e.disableWebPush||e.disable_web_push||!1,M=e.swPath||"/serviceworker.js",w=e.swScope||null,u=e.disableCookies||!1,c=e.useLatest||!1,L=e.sdkVersion||"2.71.01",_=e.disableSdk||!1,b=e.contentSecurityNonce||"",m=e.customProxyDomain||null,f=e.botsList||e.bots_list||[],p=e.integrationType||"NPM",E=null;try{g&&(E=JSON.stringify(g))}catch(e){console.log("Failed to parse cards config",e)}var h=null;try{f&&f.length>0&&(h=JSON.stringify(f))}catch(e){console.log("Failed to parse bots list config",e)}if("undefined"!=typeof window&&document&&!window.Moengage){var v=i.toLowerCase(),S=document.createElement("script"),k="string"==typeof m&&m.length?`https://cdn.${m}`:"https://cdn.moengage.com",y=L&&!c?`${k}/release/${v}/versions/${L}/moe_webSdk.min.latest.js`:`${k}/release/${v}/moe_webSdk.min.latest.js`;S.type="text/javascript",S.text=`!function(e,n,i,t,a,r,o,d){if(!"${v}"||"{DC}"==="${v}")return console.error("Data center has not been passed correctly. Please follow the SDK installation instruction carefully.");var s=e[a]=e[a]||[];if(s.invoked=0,s&&s.initialised>0||s.invoked>0)return console.error("MoEngage Web SDK initialised multiple times. Please integrate the Web SDK only once!"),!1;e.moengage_object=a;var l={},g=function n(i){return function(){for(var n=arguments.length,t=Array(n),a=0;a<n;a++)t[a]=arguments[a];(e.moengage_q=e.moengage_q||[]).push({f:i,a:t})}},u=["track_event","add_user_attribute","add_first_name","add_last_name","add_email","add_mobile","add_user_name","add_gender","add_birthday","destroy_session","add_unique_user_id","update_unique_user_id","moe_events","call_web_push","track","location_type_attribute","track_page_view","getSdkVersion","setLogLevel","setDebugLevel","handle_page_change","identifyUser","getUserIdentities","trackEvent","setUserAttribute","setFirstName","setLastName","setEmailId","setMobileNumber","setUserName","setGender","setBirthDate","logoutUser","trackPageView","callWebPush","handlePageChange"],m={onsite:["getData","registerCallback","getSelfHandledOSM"]};for(var c in u)l[u[c]]=g(u[c]);for(var v in m)for(var f in m[v])null==l[v]&&(l[v]={}),l[v][m[v][f]]=g(v+"."+m[v][f]);r=n.createElement(i),o=n.getElementsByTagName("head")[0],r.async=1,r.src=t,o.appendChild(r),e.moe=e.moe||function(){return(s.invoked=s.invoked+1,s.invoked>1)?(console.error("MoEngage Web SDK initialised multiple times. Please integrate the Web SDK only once!"),!1):(d=arguments.length<=0?void 0:arguments[0],l)},r.addEventListener("load",function(){if(d)return e[a]=e.moe(d),(e[a]&&(e[a].initialised=e[a].initialised+1||1)),!0}),r.addEventListener("error",function(){return console.error("Moengage Web SDK loading failed."),!1})}(window,document,"script","${y}","Moengage");\n Moengage = moe({\n appId: "${o}",\n debug_logs: ${n},\n ${a?`env: "${a}",`:""}\n ${null!=d?`logLevel: ${"string"==typeof d?`"${d}"`:d},`:""}\n swPath: "${M}",\n ${w?`swScope: "${w}",`:""}\n cluster: "${i.toUpperCase()}",\n ${t?`projectId: "${t}",`:""}\n disableOnsite: ${s},\n disableCookies: ${u},\n disableWebPush: ${l},\n enableSPA: ${r},\n ${E?`cards: ${E},`:""}\n disableSdk: ${_},\n contentSecurityNonce: "${b}",\n customProxyDomain: ${"string"==typeof m&&m.length?`"${m}"`:null},\n ${h?`botsList: ${h},`:""}\n integrationType: "${p}"\n });\n `,document.head.appendChild(S)}}else console.error("MoEngage: appId is required for initialization")},isMoeLoaded:()=>{try{if("undefined"!=typeof window&&document&&window.Moengage)return!0}catch(e){return!1}return!1},trackEvent:(e,o)=>Moe.isMoeLoaded()&&window.Moengage.trackEvent(e,o),track_event:(e,o)=>Moe.isMoeLoaded()&&window.Moengage.trackEvent(e,o),getSdkVersion:()=>Moe.isMoeLoaded()&&window.Moengage.getSdkVersion(),setLogLevel:e=>Moe.isMoeLoaded()&&window.Moengage.setLogLevel(e),setDebugLevel:e=>Moe.isMoeLoaded()&&window.Moengage.setDebugLevel(e),add_unique_user_id:e=>Moe.isMoeLoaded()&&window.Moengage.add_unique_user_id(e),update_unique_user_id:e=>Moe.isMoeLoaded()&&window.Moengage.update_unique_user_id(e),identifyUser:e=>Moe.isMoeLoaded()&&window.Moengage.identifyUser(e),getUserIdentities:()=>Moe.isMoeLoaded()&&window.Moengage.getUserIdentities(),enableSdk:()=>Moe.isMoeLoaded()&&window.Moengage.enableSdk(),disableSdk:()=>Moe.isMoeLoaded()&&window.Moengage.disableSdk(),isSdkEnabled:()=>Moe.isMoeLoaded()&&window.Moengage.isSdkEnabled(),enableDataTracking:()=>Moe.isMoeLoaded()&&window.Moengage.enableDataTracking(),disableDataTracking:()=>Moe.isMoeLoaded()&&window.Moengage.disableDataTracking(),isDataTrackingEnabled:()=>Moe.isMoeLoaded()&&window.Moengage.isDataTrackingEnabled(),getUserId:()=>Moe.isMoeLoaded()&&window.Moengage.getUserId(),getUserAttribute:(e,o)=>Moe.isMoeLoaded()?o&&"string"==typeof o?window.Moengage.getUserAttribute(e,o):window.Moengage.getUserAttribute(e):null,setUserAttribute:(e,o,n)=>!!Moe.isMoeLoaded()&&(n&&"string"==typeof n?window.Moengage.setUserAttribute(e,o,n):window.Moengage.setUserAttribute(e,o)),add_user_attribute:(e,o,n)=>!!Moe.isMoeLoaded()&&(n&&"string"==typeof n?window.Moengage.setUserAttribute(e,o,n):window.Moengage.setUserAttribute(e,o)),setFirstName:e=>Moe.isMoeLoaded()&&window.Moengage.setFirstName(e),add_first_name:e=>Moe.isMoeLoaded()&&window.Moengage.setFirstName(e),setLastName:e=>Moe.isMoeLoaded()&&window.Moengage.setLastName(e),add_last_name:e=>Moe.isMoeLoaded()&&window.Moengage.setLastName(e),setEmailId:e=>Moe.isMoeLoaded()&&window.Moengage.setEmailId(e),add_email:e=>Moe.isMoeLoaded()&&window.Moengage.setEmailId(e),setMobileNumber:e=>Moe.isMoeLoaded()&&window.Moengage.setMobileNumber(e),add_mobile:e=>Moe.isMoeLoaded()&&window.Moengage.setMobileNumber(e),setUserName:e=>Moe.isMoeLoaded()&&window.Moengage.setUserName(e),add_user_name:e=>Moe.isMoeLoaded()&&window.Moengage.setUserName(e),setGender:e=>Moe.isMoeLoaded()&&window.Moengage.setGender(e),add_gender:e=>Moe.isMoeLoaded()&&window.Moengage.setGender(e),setBirthDate:e=>Moe.isMoeLoaded()&&window.Moengage.setBirthDate(e),add_birthday:e=>Moe.isMoeLoaded()&&window.Moengage.setBirthDate(e),logoutUser:()=>Moe.isMoeLoaded()&&window.Moengage.logoutUser(),destroy_session:()=>Moe.isMoeLoaded()&&window.Moengage.logoutUser(),callWebPush:e=>Moe.isMoeLoaded()&&window.Moengage.callWebPush(e),call_web_push:e=>Moe.isMoeLoaded()&&window.Moengage.callWebPush(e),trackPageView:()=>Moe.isMoeLoaded()&&window.Moengage.trackPageView(),track_page_view:()=>Moe.isMoeLoaded()&&window.Moengage.trackPageView(),handlePageChange:()=>Moe.isMoeLoaded()&&window.Moengage.handlePageChange(),handle_page_change:()=>Moe.isMoeLoaded()&&window.Moengage.handlePageChange(),onCardsLoaded:()=>new Promise((e,o)=>{"undefined"!=typeof window?window.Moengage.cards?(Moe.cards=window.Moengage.cards,e()):window.addEventListener("MOE_LIFECYCLE",o=>{"CARDS_INITIALIZED"===o.detail.name&&(Moe.cards=window.Moengage.cards,e())}):o()}),on_cards_loaded:()=>new Promise((e,o)=>{"undefined"!=typeof window?window.Moengage.cards?(Moe.cards=window.Moengage.cards,e()):window.addEventListener("MOE_LIFECYCLE",o=>{"CARDS_INITIALIZED"===o.detail.name&&(Moe.cards=window.Moengage.cards,e())}):o()}),cards:"undefined"!=typeof window&&window.Moengage&&window.Moengage.cards||{},onsite:{getData:()=>Moe.isMoeLoaded()&&window.Moengage.onsite.getData(),registerCallback:e=>Moe.isMoeLoaded()&&window.Moengage.onsite.registerCallback(e),getSelfHandledOSM:e=>Moe.isMoeLoaded()&&window.Moengage.onsite.getSelfHandledOSM(e),selfHandledShown:e=>Moe.isMoeLoaded()&&window.Moengage.onsite.selfHandledShown(e),selfHandledClicked:e=>Moe.isMoeLoaded()&&window.Moengage.onsite.selfHandledClicked(e),selfHandledDismissed:e=>Moe.isMoeLoaded()&&window.Moengage.onsite.selfHandledDismissed(e)},Attribute:{USER_ATTRIBUTE_LEVEL:{PROJECT:"PROJECT",PORTFOLIO:"PORTFOLIO"}},env:{TEST:"TEST",LIVE:"LIVE"},logLevel:{NONE:0,LIMITED:1,ALL:2},integrationType:{GTM:"GTM",FLUTTER:"Flutter",SEGMENT:"Segment",AMP:"AMP",NPM:"NPM",CHROME_EXTENSION:"Chrome extension",TV:"TV",VTEX:"VTEX",SHOPIFY:"Shopify",MOENGAGE_ASSIST:"MoEngage Assist plugin",DIRECT:"Direct"}};module.exports=Moe;
|