@maxzima/wa-communicator 1.0.44 → 1.0.46
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 -4
- package/dist/engine/AccountTracker/Enums/AccountTrackerEnum.js +0 -4
- package/dist/engine/AccountTracker/Public/AccountTracker.js +0 -1
- package/dist/engine/AccountTracker/Types/TAccountTracker.d.ts +2 -11
- package/dist/engine/Communicator/Public/Communicator.js +1 -0
- package/dist/types/TCommunicator.d.ts +2 -0
- package/package.json +1 -1
- package/src/engine/AccountTracker/Enums/AccountTrackerEnum.ts +0 -4
- package/src/engine/AccountTracker/Public/AccountTracker.ts +0 -1
- package/src/engine/AccountTracker/Types/TAccountTracker.ts +2 -13
- package/src/engine/Communicator/Public/Communicator.ts +1 -0
- package/src/types/TCommunicator.ts +2 -0
- package/test/accountTracker.spec.ts +3 -4
- package/test/testunits/accountTracker/events.ts +3 -22
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
export declare enum GTMEventEnum {
|
|
2
|
-
SIGN_UP = "sign_up",
|
|
3
2
|
SIGN_UP_ONLINE = "sign_up_online",
|
|
4
3
|
VERIFY_EMAIL_ONLINE = "verify_email_online",
|
|
5
4
|
VERIFY_PHONE_ONLINE = "verify_phone_online"
|
|
6
5
|
}
|
|
7
6
|
export declare enum GTMEventParamsEnum {
|
|
8
|
-
GCLID = "gclid",
|
|
9
7
|
PHONE = "phone",
|
|
10
8
|
EMAIL = "email",
|
|
11
|
-
ORIGIN = "origin",
|
|
12
|
-
SEND_TO = "send_to",
|
|
13
9
|
GCL_ID = "gcl_id"
|
|
14
10
|
}
|
|
15
11
|
export declare enum LintrkActionTypeEnum {
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
export var GTMEventEnum;
|
|
2
2
|
(function (GTMEventEnum) {
|
|
3
|
-
GTMEventEnum["SIGN_UP"] = "sign_up";
|
|
4
3
|
GTMEventEnum["SIGN_UP_ONLINE"] = "sign_up_online";
|
|
5
4
|
GTMEventEnum["VERIFY_EMAIL_ONLINE"] = "verify_email_online";
|
|
6
5
|
GTMEventEnum["VERIFY_PHONE_ONLINE"] = "verify_phone_online";
|
|
7
6
|
})(GTMEventEnum || (GTMEventEnum = {}));
|
|
8
7
|
export var GTMEventParamsEnum;
|
|
9
8
|
(function (GTMEventParamsEnum) {
|
|
10
|
-
GTMEventParamsEnum["GCLID"] = "gclid";
|
|
11
9
|
GTMEventParamsEnum["PHONE"] = "phone";
|
|
12
10
|
GTMEventParamsEnum["EMAIL"] = "email";
|
|
13
|
-
GTMEventParamsEnum["ORIGIN"] = "origin";
|
|
14
|
-
GTMEventParamsEnum["SEND_TO"] = "send_to";
|
|
15
11
|
GTMEventParamsEnum["GCL_ID"] = "gcl_id";
|
|
16
12
|
})(GTMEventParamsEnum || (GTMEventParamsEnum = {}));
|
|
17
13
|
export var LintrkActionTypeEnum;
|
|
@@ -23,7 +23,6 @@ export class AccountTracker {
|
|
|
23
23
|
this.props = props;
|
|
24
24
|
}
|
|
25
25
|
sendRegistrationSuccessEvent(eventParams) {
|
|
26
|
-
this.sendGtmEvent(GTMEventEnum.SIGN_UP, eventParams.gtm);
|
|
27
26
|
this.sendGtmEvent(GTMEventEnum.SIGN_UP_ONLINE, eventParams.gtm);
|
|
28
27
|
this.sendLinkedInEvent(LintrkEventIdEnum.REGISTRATION);
|
|
29
28
|
}
|
|
@@ -12,24 +12,15 @@ export type TAccountTrackerEventParams = {
|
|
|
12
12
|
export type TAccountTrackerGtmEventParamsMapping = {
|
|
13
13
|
[event in GTMEventEnum]?: TAccountTrackerGtmEventParams;
|
|
14
14
|
};
|
|
15
|
-
export type TAccountTrackerGtmEventParams =
|
|
16
|
-
export type
|
|
17
|
-
[GTMEventParamsEnum.GCLID]: string;
|
|
15
|
+
export type TAccountTrackerGtmEventParams = TAccountTrackerGtmSignUpOnlineEventParams | TAccountTrackerGtmVerifyPhoneOnlineEventParams | TAccountTrackerGtmVerifyEmailOnlineEventParams;
|
|
16
|
+
export type TAccountTrackerGtmSignUpOnlineEventParams = {
|
|
18
17
|
[GTMEventParamsEnum.EMAIL]: string;
|
|
19
18
|
[GTMEventParamsEnum.PHONE]: string;
|
|
20
|
-
};
|
|
21
|
-
export type TAccountTrackerGtmSignUpOnlineEventParams = {
|
|
22
|
-
[GTMEventParamsEnum.ORIGIN]: string;
|
|
23
|
-
[GTMEventParamsEnum.SEND_TO]: string;
|
|
24
19
|
[GTMEventParamsEnum.GCL_ID]: string;
|
|
25
20
|
};
|
|
26
21
|
export type TAccountTrackerGtmVerifyPhoneOnlineEventParams = {
|
|
27
|
-
[GTMEventParamsEnum.ORIGIN]: string;
|
|
28
|
-
[GTMEventParamsEnum.SEND_TO]: string;
|
|
29
22
|
[GTMEventParamsEnum.GCL_ID]: string;
|
|
30
23
|
};
|
|
31
24
|
export type TAccountTrackerGtmVerifyEmailOnlineEventParams = {
|
|
32
|
-
[GTMEventParamsEnum.ORIGIN]: string;
|
|
33
|
-
[GTMEventParamsEnum.SEND_TO]: string;
|
|
34
25
|
[GTMEventParamsEnum.GCL_ID]: string;
|
|
35
26
|
};
|
|
@@ -140,6 +140,7 @@ type TRegistrationRequestBodySource = {
|
|
|
140
140
|
utm_medium: string;
|
|
141
141
|
utm_campaign: string;
|
|
142
142
|
utm_term: string;
|
|
143
|
+
fbclid: string;
|
|
143
144
|
};
|
|
144
145
|
type TRegistrationRequestBody = {
|
|
145
146
|
name: string;
|
|
@@ -162,6 +163,7 @@ type TRegistrationRequestData = {
|
|
|
162
163
|
utmMedium: TRegistrationRequestBodySource['utm_medium'];
|
|
163
164
|
utmCampaign: TRegistrationRequestBodySource['utm_campaign'];
|
|
164
165
|
utmTerm: TRegistrationRequestBodySource['utm_term'];
|
|
166
|
+
fbclid: TRegistrationRequestBodySource['fbclid'];
|
|
165
167
|
};
|
|
166
168
|
type TStorageRequestData = {
|
|
167
169
|
accessToken: string;
|
package/package.json
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
export enum GTMEventEnum {
|
|
2
|
-
SIGN_UP = 'sign_up',
|
|
3
2
|
SIGN_UP_ONLINE = 'sign_up_online',
|
|
4
3
|
VERIFY_EMAIL_ONLINE = 'verify_email_online',
|
|
5
4
|
VERIFY_PHONE_ONLINE = 'verify_phone_online',
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
export enum GTMEventParamsEnum {
|
|
9
|
-
GCLID = 'gclid',
|
|
10
8
|
PHONE = 'phone',
|
|
11
9
|
EMAIL = 'email',
|
|
12
|
-
ORIGIN = 'origin',
|
|
13
|
-
SEND_TO = 'send_to',
|
|
14
10
|
GCL_ID = 'gcl_id',
|
|
15
11
|
}
|
|
16
12
|
|
|
@@ -13,7 +13,6 @@ export class AccountTracker {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
public sendRegistrationSuccessEvent (eventParams: TAccountTrackerEventParams) {
|
|
16
|
-
this.sendGtmEvent(GTMEventEnum.SIGN_UP, eventParams.gtm);
|
|
17
16
|
this.sendGtmEvent(GTMEventEnum.SIGN_UP_ONLINE, eventParams.gtm);
|
|
18
17
|
this.sendLinkedInEvent(LintrkEventIdEnum.REGISTRATION);
|
|
19
18
|
}
|
|
@@ -21,31 +21,20 @@ export type TAccountTrackerGtmEventParamsMapping = {
|
|
|
21
21
|
[event in GTMEventEnum]?: TAccountTrackerGtmEventParams;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
export type TAccountTrackerGtmEventParams =
|
|
25
|
-
| TAccountTrackerGtmSignUpOnlineEventParams
|
|
24
|
+
export type TAccountTrackerGtmEventParams = TAccountTrackerGtmSignUpOnlineEventParams
|
|
26
25
|
| TAccountTrackerGtmVerifyPhoneOnlineEventParams
|
|
27
26
|
| TAccountTrackerGtmVerifyEmailOnlineEventParams;
|
|
28
27
|
|
|
29
|
-
export type
|
|
30
|
-
[GTMEventParamsEnum.GCLID]: string;
|
|
28
|
+
export type TAccountTrackerGtmSignUpOnlineEventParams = {
|
|
31
29
|
[GTMEventParamsEnum.EMAIL]: string;
|
|
32
30
|
[GTMEventParamsEnum.PHONE]: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type TAccountTrackerGtmSignUpOnlineEventParams = {
|
|
36
|
-
[GTMEventParamsEnum.ORIGIN]: string;
|
|
37
|
-
[GTMEventParamsEnum.SEND_TO]: string;
|
|
38
31
|
[GTMEventParamsEnum.GCL_ID]: string;
|
|
39
32
|
}
|
|
40
33
|
|
|
41
34
|
export type TAccountTrackerGtmVerifyPhoneOnlineEventParams = {
|
|
42
|
-
[GTMEventParamsEnum.ORIGIN]: string;
|
|
43
|
-
[GTMEventParamsEnum.SEND_TO]: string;
|
|
44
35
|
[GTMEventParamsEnum.GCL_ID]: string;
|
|
45
36
|
}
|
|
46
37
|
|
|
47
38
|
export type TAccountTrackerGtmVerifyEmailOnlineEventParams = {
|
|
48
|
-
[GTMEventParamsEnum.ORIGIN]: string;
|
|
49
|
-
[GTMEventParamsEnum.SEND_TO]: string;
|
|
50
39
|
[GTMEventParamsEnum.GCL_ID]: string;
|
|
51
40
|
}
|
|
@@ -189,6 +189,7 @@ type TRegistrationRequestBodySource = {
|
|
|
189
189
|
utm_medium: string,
|
|
190
190
|
utm_campaign: string,
|
|
191
191
|
utm_term: string,
|
|
192
|
+
fbclid: string,
|
|
192
193
|
}
|
|
193
194
|
|
|
194
195
|
type TRegistrationRequestBody = {
|
|
@@ -214,6 +215,7 @@ type TRegistrationRequestData = {
|
|
|
214
215
|
utmMedium: TRegistrationRequestBodySource['utm_medium'],
|
|
215
216
|
utmCampaign: TRegistrationRequestBodySource['utm_campaign'],
|
|
216
217
|
utmTerm: TRegistrationRequestBodySource['utm_term'],
|
|
218
|
+
fbclid: TRegistrationRequestBodySource['fbclid'],
|
|
217
219
|
}
|
|
218
220
|
/* endregion registration */
|
|
219
221
|
|
|
@@ -19,8 +19,7 @@ describe('AccountTracker', () => {
|
|
|
19
19
|
test('sendRegistrationSuccessEvent', () => {
|
|
20
20
|
accountTracker.sendRegistrationSuccessEvent(registrationSuccessEventParams);
|
|
21
21
|
|
|
22
|
-
expect(mockGtmDataLayer[0]).toEqual({...registrationSuccessEvents.gtm.
|
|
23
|
-
expect(mockGtmDataLayer[1]).toEqual({...registrationSuccessEvents.gtm.sign_up_online});
|
|
22
|
+
expect(mockGtmDataLayer[0]).toEqual({...registrationSuccessEvents.gtm.sign_up_online});
|
|
24
23
|
|
|
25
24
|
expect(mockLintrk.mock.calls[0][0]).toBe(registrationSuccessEvents.linkedIn.action);
|
|
26
25
|
expect(mockLintrk.mock.calls[0][1]).toEqual(registrationSuccessEvents.linkedIn.event);
|
|
@@ -30,12 +29,12 @@ describe('AccountTracker', () => {
|
|
|
30
29
|
test('sendVerifyPhoneSuccessEvent', () => {
|
|
31
30
|
accountTracker.sendVerifyPhoneSuccessEvent(registrationSuccessEventParams);
|
|
32
31
|
|
|
33
|
-
expect(mockGtmDataLayer[
|
|
32
|
+
expect(mockGtmDataLayer[1]).toEqual({...registrationSuccessEvents.gtm.verify_phone_online});
|
|
34
33
|
});
|
|
35
34
|
|
|
36
35
|
test('sendVerifyEmailSuccessEvent', () => {
|
|
37
36
|
accountTracker.sendVerifyEmailSuccessEvent(registrationSuccessEventParams);
|
|
38
37
|
|
|
39
|
-
expect(mockGtmDataLayer[
|
|
38
|
+
expect(mockGtmDataLayer[2]).toEqual({...registrationSuccessEvents.gtm.verify_email_online});
|
|
40
39
|
});
|
|
41
40
|
});
|
|
@@ -2,28 +2,18 @@ import {communicatorTestData} from "../communicator/general";
|
|
|
2
2
|
|
|
3
3
|
const registrationSuccessEvents = {
|
|
4
4
|
gtm: {
|
|
5
|
-
sign_up: {
|
|
6
|
-
event: 'sign_up',
|
|
7
|
-
gclid: communicatorTestData.gcId,
|
|
8
|
-
email: communicatorTestData.email,
|
|
9
|
-
phone: communicatorTestData.phoneNumber,
|
|
10
|
-
},
|
|
11
5
|
sign_up_online: {
|
|
12
6
|
event: 'sign_up_online',
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
email: communicatorTestData.email,
|
|
8
|
+
phone: communicatorTestData.phoneNumber,
|
|
15
9
|
gcl_id: communicatorTestData.gcId,
|
|
16
10
|
},
|
|
17
11
|
verify_phone_online: {
|
|
18
12
|
event: 'verify_phone_online',
|
|
19
|
-
origin: communicatorTestData.gtmId,
|
|
20
|
-
send_to: communicatorTestData.ga4Id,
|
|
21
13
|
gcl_id: communicatorTestData.gcId,
|
|
22
14
|
},
|
|
23
15
|
verify_email_online: {
|
|
24
16
|
event: 'verify_email_online',
|
|
25
|
-
origin: communicatorTestData.gtmId,
|
|
26
|
-
send_to: communicatorTestData.ga4Id,
|
|
27
17
|
gcl_id: communicatorTestData.gcId,
|
|
28
18
|
}
|
|
29
19
|
},
|
|
@@ -37,24 +27,15 @@ const registrationSuccessEvents = {
|
|
|
37
27
|
|
|
38
28
|
const registrationSuccessEventParams = {
|
|
39
29
|
gtm: {
|
|
40
|
-
|
|
41
|
-
gclid: communicatorTestData.gcId,
|
|
30
|
+
sign_up_online: {
|
|
42
31
|
email: communicatorTestData.email,
|
|
43
32
|
phone: communicatorTestData.phoneNumber,
|
|
44
|
-
},
|
|
45
|
-
sign_up_online: {
|
|
46
|
-
origin: communicatorTestData.gtmId,
|
|
47
|
-
send_to: communicatorTestData.ga4Id,
|
|
48
33
|
gcl_id: communicatorTestData.gcId,
|
|
49
34
|
},
|
|
50
35
|
verify_phone_online: {
|
|
51
|
-
origin: communicatorTestData.gtmId,
|
|
52
|
-
send_to: communicatorTestData.ga4Id,
|
|
53
36
|
gcl_id: communicatorTestData.gcId,
|
|
54
37
|
},
|
|
55
38
|
verify_email_online: {
|
|
56
|
-
origin: communicatorTestData.gtmId,
|
|
57
|
-
send_to: communicatorTestData.ga4Id,
|
|
58
39
|
gcl_id: communicatorTestData.gcId,
|
|
59
40
|
}
|
|
60
41
|
}
|