@maxzima/wa-communicator 1.0.19 → 1.0.20
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/dist/engine/AccountTracker/Enums/AccountTrackerEnum.d.ts +0 -9
- package/dist/engine/AccountTracker/Public/AccountTracker.d.ts +0 -3
- package/dist/engine/AccountTracker/Public/AccountTracker.js +0 -18
- package/dist/engine/AccountTracker/Types/TAccountTracker.d.ts +0 -2
- package/package.json +1 -1
- package/src/engine/AccountTracker/Enums/AccountTrackerEnum.ts +0 -11
- package/src/engine/AccountTracker/Public/AccountTracker.ts +0 -22
- package/src/engine/AccountTracker/Types/TAccountTracker.ts +0 -2
- package/test/accountTracker.spec.ts +1 -27
- package/test/testunits/accountTracker/events.ts +0 -32
- package/test/testunits/accountTracker/general.ts +0 -7
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
declare const enum GTMEventEnum {
|
|
2
|
-
VERIFY_CONTACT = "verify_contact"
|
|
3
|
-
}
|
|
4
|
-
declare const enum GTMEventContactEnum {
|
|
5
|
-
PHONE = "phone",
|
|
6
|
-
EMAIL = "email"
|
|
7
|
-
}
|
|
8
1
|
declare const enum LintrkActionTypeEnum {
|
|
9
2
|
TRACK = "track"
|
|
10
3
|
}
|
|
11
4
|
declare const enum LintrkEventIdEnum {
|
|
12
|
-
PHONE = 8612332,
|
|
13
|
-
EMAIL = 8612340,
|
|
14
5
|
REGISTRATION = 8612308
|
|
15
6
|
}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
export class AccountTracker {
|
|
2
2
|
constructor(props) {
|
|
3
|
-
this.sendGtmEvent = (event, contact) => {
|
|
4
|
-
if (typeof this.props.gtmDataLayer === 'undefined') {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
this.props.gtmDataLayer.push({
|
|
8
|
-
event,
|
|
9
|
-
contact,
|
|
10
|
-
origin: this.props.origin || null,
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
3
|
this.sendLinkedInEvent = (id) => {
|
|
14
4
|
if (typeof this.props.lintrk === 'undefined') {
|
|
15
5
|
return;
|
|
@@ -20,14 +10,6 @@ export class AccountTracker {
|
|
|
20
10
|
};
|
|
21
11
|
this.props = props;
|
|
22
12
|
}
|
|
23
|
-
sendPhoneVerifyEvent() {
|
|
24
|
-
this.sendGtmEvent("verify_contact", "phone");
|
|
25
|
-
this.sendLinkedInEvent(8612332);
|
|
26
|
-
}
|
|
27
|
-
sendEmailVerifyEvent() {
|
|
28
|
-
this.sendGtmEvent("verify_contact", "email");
|
|
29
|
-
this.sendLinkedInEvent(8612340);
|
|
30
|
-
}
|
|
31
13
|
sendRegistrationSuccessEvent() {
|
|
32
14
|
this.sendLinkedInEvent(8612308);
|
|
33
15
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
const enum GTMEventEnum {
|
|
2
|
-
VERIFY_CONTACT = 'verify_contact',
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
const enum GTMEventContactEnum {
|
|
6
|
-
PHONE = 'phone',
|
|
7
|
-
EMAIL = 'email',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
1
|
const enum LintrkActionTypeEnum {
|
|
11
2
|
TRACK= 'track',
|
|
12
3
|
}
|
|
13
4
|
|
|
14
5
|
const enum LintrkEventIdEnum {
|
|
15
|
-
PHONE = 8612332,
|
|
16
|
-
EMAIL = 8612340,
|
|
17
6
|
REGISTRATION = 8612308,
|
|
18
7
|
}
|
|
@@ -5,32 +5,10 @@ export class AccountTracker {
|
|
|
5
5
|
this.props = props;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
public sendPhoneVerifyEvent () {
|
|
9
|
-
this.sendGtmEvent(GTMEventEnum.VERIFY_CONTACT, GTMEventContactEnum.PHONE);
|
|
10
|
-
this.sendLinkedInEvent(LintrkEventIdEnum.PHONE);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public sendEmailVerifyEvent () {
|
|
14
|
-
this.sendGtmEvent(GTMEventEnum.VERIFY_CONTACT, GTMEventContactEnum.EMAIL);
|
|
15
|
-
this.sendLinkedInEvent(LintrkEventIdEnum.EMAIL);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
8
|
public sendRegistrationSuccessEvent () {
|
|
19
9
|
this.sendLinkedInEvent(LintrkEventIdEnum.REGISTRATION);
|
|
20
10
|
}
|
|
21
11
|
|
|
22
|
-
private sendGtmEvent = (event: GTMEventEnum, contact: GTMEventContactEnum) => {
|
|
23
|
-
if (typeof this.props.gtmDataLayer === 'undefined') {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
this.props.gtmDataLayer.push({
|
|
28
|
-
event,
|
|
29
|
-
contact,
|
|
30
|
-
origin: this.props.origin || null,
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
|
|
34
12
|
private sendLinkedInEvent = (id: LintrkEventIdEnum) => {
|
|
35
13
|
if (typeof this.props.lintrk === 'undefined') {
|
|
36
14
|
return;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import {AccountTracker} from "../src";
|
|
2
|
-
import {
|
|
3
|
-
import {emailVerifyEvents, phoneVerifyEvents, registrationSuccessEvents} from "./testunits/accountTracker/events";
|
|
2
|
+
import {registrationSuccessEvents} from "./testunits/accountTracker/events";
|
|
4
3
|
|
|
5
4
|
const mockLintrk = jest.fn().mockImplementation();
|
|
6
|
-
const mockGtmDataLayer = [];
|
|
7
5
|
|
|
8
6
|
const accountTrackerInitProps = {
|
|
9
|
-
...accountTrackerInitPropsNormal,
|
|
10
|
-
gtmDataLayer: mockGtmDataLayer,
|
|
11
7
|
lintrk: mockLintrk,
|
|
12
8
|
};
|
|
13
9
|
|
|
@@ -18,31 +14,9 @@ describe('AccountTracker', () => {
|
|
|
18
14
|
jest.clearAllMocks();
|
|
19
15
|
});
|
|
20
16
|
|
|
21
|
-
test('sendPhoneVerifyEvent', () => {
|
|
22
|
-
accountTracker.sendPhoneVerifyEvent();
|
|
23
|
-
|
|
24
|
-
expect(mockGtmDataLayer[0]).toEqual({...phoneVerifyEvents.gtm});
|
|
25
|
-
|
|
26
|
-
expect(mockLintrk.mock.calls[0][0]).toBe(phoneVerifyEvents.linkedIn.action);
|
|
27
|
-
expect(mockLintrk.mock.calls[0][1]).toEqual(phoneVerifyEvents.linkedIn.event);
|
|
28
|
-
expect(mockLintrk).toHaveBeenCalled();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test('sendEmailVerifyEvent', () => {
|
|
32
|
-
accountTracker.sendEmailVerifyEvent();
|
|
33
|
-
|
|
34
|
-
expect(mockGtmDataLayer[1]).toEqual({...emailVerifyEvents.gtm});
|
|
35
|
-
|
|
36
|
-
expect(mockLintrk.mock.calls[0][0]).toBe(emailVerifyEvents.linkedIn.action);
|
|
37
|
-
expect(mockLintrk.mock.calls[0][1]).toEqual(emailVerifyEvents.linkedIn.event);
|
|
38
|
-
expect(mockLintrk).toHaveBeenCalled();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
17
|
test('sendRegistrationSuccessEvent', () => {
|
|
42
18
|
accountTracker.sendRegistrationSuccessEvent();
|
|
43
19
|
|
|
44
|
-
expect(mockGtmDataLayer).toHaveLength(2);
|
|
45
|
-
|
|
46
20
|
expect(mockLintrk.mock.calls[0][0]).toBe(registrationSuccessEvents.linkedIn.action);
|
|
47
21
|
expect(mockLintrk.mock.calls[0][1]).toEqual(registrationSuccessEvents.linkedIn.event);
|
|
48
22
|
expect(mockLintrk).toHaveBeenCalled();
|
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
import {accountTrackerInitPropsNormal} from "./general";
|
|
2
|
-
|
|
3
|
-
const phoneVerifyEvents = {
|
|
4
|
-
gtm: {
|
|
5
|
-
event: 'verify_contact',
|
|
6
|
-
contact: 'phone',
|
|
7
|
-
origin: accountTrackerInitPropsNormal.origin,
|
|
8
|
-
},
|
|
9
|
-
linkedIn: {
|
|
10
|
-
action: 'track',
|
|
11
|
-
event: {
|
|
12
|
-
conversation_id: 8612332,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const emailVerifyEvents = {
|
|
18
|
-
gtm: {
|
|
19
|
-
event: 'verify_contact',
|
|
20
|
-
contact: 'email',
|
|
21
|
-
origin: accountTrackerInitPropsNormal.origin,
|
|
22
|
-
},
|
|
23
|
-
linkedIn: {
|
|
24
|
-
action: 'track',
|
|
25
|
-
event: {
|
|
26
|
-
conversation_id: 8612340,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
1
|
const registrationSuccessEvents = {
|
|
32
2
|
linkedIn: {
|
|
33
3
|
action: 'track',
|
|
@@ -38,7 +8,5 @@ const registrationSuccessEvents = {
|
|
|
38
8
|
};
|
|
39
9
|
|
|
40
10
|
export {
|
|
41
|
-
phoneVerifyEvents,
|
|
42
|
-
emailVerifyEvents,
|
|
43
11
|
registrationSuccessEvents,
|
|
44
12
|
};
|