@maxzima/wa-communicator 1.0.53 → 1.0.55
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/Public/AccountTracker.js +3 -7
- package/dist/engine/Communicator/Public/Communicator.js +1 -2
- package/dist/types/TCommunicator.d.ts +0 -2
- package/package.json +1 -1
- package/src/engine/AccountTracker/Public/AccountTracker.ts +8 -9
- package/src/engine/Communicator/Public/Communicator.ts +2 -3
- package/src/types/TCommunicator.ts +0 -2
- package/test/__snapshots__/communicator.spec.ts.snap +1 -1
- package/test/testunits/communicator/general.ts +0 -1
- package/test/testunits/communicator/requests.ts +0 -1
- package/tsconfig.json +1 -1
|
@@ -2,15 +2,11 @@ import { GTMEventEnum, LintrkActionTypeEnum, LintrkEventIdEnum } from "./../Enum
|
|
|
2
2
|
export class AccountTracker {
|
|
3
3
|
constructor(props) {
|
|
4
4
|
this.sendGtmEvent = (event, eventParams) => {
|
|
5
|
-
if (
|
|
5
|
+
if (!Array.isArray(this.props.gtmDataLayer)) {
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
8
|
-
const paramsForCurrentEvent = eventParams[event] ||
|
|
9
|
-
|
|
10
|
-
for (const paramName in paramsForCurrentEvent) {
|
|
11
|
-
dataForLayer[paramName] = paramsForCurrentEvent[paramName];
|
|
12
|
-
}
|
|
13
|
-
this.props.gtmDataLayer.push(Object.assign({ event }, dataForLayer));
|
|
8
|
+
const paramsForCurrentEvent = (eventParams[event] || {});
|
|
9
|
+
this.props.gtmDataLayer.push(Object.assign({ event }, paramsForCurrentEvent));
|
|
14
10
|
};
|
|
15
11
|
this.sendLinkedInEvent = (id) => {
|
|
16
12
|
if (typeof this.props.lintrk === 'undefined') {
|
|
@@ -51,7 +51,7 @@ export class Communicator {
|
|
|
51
51
|
});
|
|
52
52
|
const queryParams = {};
|
|
53
53
|
if (data.outOfBandAllowed) {
|
|
54
|
-
queryParams['out_of_band_allowed'] = true;
|
|
54
|
+
queryParams['out_of_band_allowed'] = 'true';
|
|
55
55
|
}
|
|
56
56
|
return yield this.send({
|
|
57
57
|
method: 'POST',
|
|
@@ -215,7 +215,6 @@ export class Communicator {
|
|
|
215
215
|
utm_medium: data.utmMedium,
|
|
216
216
|
utm_campaign: data.utmCampaign,
|
|
217
217
|
utm_term: data.utmTerm,
|
|
218
|
-
fbclid: data.fbclid,
|
|
219
218
|
} }), (data.metadata && { metadata: prepareMetadata(data.metadata) })));
|
|
220
219
|
return yield this.send({
|
|
221
220
|
method: 'POST',
|
|
@@ -145,7 +145,6 @@ type TRegistrationRequestBodySource = {
|
|
|
145
145
|
utm_medium: string;
|
|
146
146
|
utm_campaign: string;
|
|
147
147
|
utm_term: string;
|
|
148
|
-
fbclid: string;
|
|
149
148
|
metadata: TRegistrationRequestBodySourceMetadata[];
|
|
150
149
|
};
|
|
151
150
|
type TRegistrationRequestBody = {
|
|
@@ -169,7 +168,6 @@ type TRegistrationRequestData = {
|
|
|
169
168
|
utmMedium: TRegistrationRequestBodySource['utm_medium'];
|
|
170
169
|
utmCampaign: TRegistrationRequestBodySource['utm_campaign'];
|
|
171
170
|
utmTerm: TRegistrationRequestBodySource['utm_term'];
|
|
172
|
-
fbclid: TRegistrationRequestBodySource['fbclid'];
|
|
173
171
|
metadata: TRegistrationMetadata;
|
|
174
172
|
};
|
|
175
173
|
type TStorageRequestData = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GTMEventEnum, LintrkActionTypeEnum, LintrkEventIdEnum } from "./../Enums/AccountTrackerEnum";
|
|
2
2
|
import type {
|
|
3
3
|
TAccountTrackerEventParams,
|
|
4
|
+
TAccountTrackerGtmEventParams,
|
|
4
5
|
TAccountTrackerGtmEventParamsMapping,
|
|
5
6
|
TAccountTrackerProps
|
|
6
7
|
} from "./../Types/TAccountTracker";
|
|
@@ -25,21 +26,19 @@ export class AccountTracker {
|
|
|
25
26
|
this.sendGtmEvent(GTMEventEnum.VERIFY_EMAIL_ONLINE, eventParams.gtm);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
private sendGtmEvent = (
|
|
29
|
-
|
|
29
|
+
private sendGtmEvent = (
|
|
30
|
+
event: GTMEventEnum,
|
|
31
|
+
eventParams: TAccountTrackerGtmEventParamsMapping
|
|
32
|
+
) => {
|
|
33
|
+
if (!Array.isArray(this.props.gtmDataLayer)) {
|
|
30
34
|
return;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
const paramsForCurrentEvent = eventParams[event] ||
|
|
34
|
-
const dataForLayer = {};
|
|
35
|
-
|
|
36
|
-
for (const paramName in paramsForCurrentEvent) {
|
|
37
|
-
dataForLayer[paramName] = paramsForCurrentEvent[paramName];
|
|
38
|
-
}
|
|
37
|
+
const paramsForCurrentEvent = (eventParams[event] || {}) as TAccountTrackerGtmEventParams;
|
|
39
38
|
|
|
40
39
|
this.props.gtmDataLayer.push({
|
|
41
40
|
event,
|
|
42
|
-
...
|
|
41
|
+
...paramsForCurrentEvent
|
|
43
42
|
});
|
|
44
43
|
};
|
|
45
44
|
|
|
@@ -54,10 +54,10 @@ export class Communicator {
|
|
|
54
54
|
mobile: data.phoneNumber,
|
|
55
55
|
} as TSignInStartRequestBody);
|
|
56
56
|
|
|
57
|
-
const queryParams = {};
|
|
57
|
+
const queryParams: TRequestQueryParams = {};
|
|
58
58
|
if (data.outOfBandAllowed) {
|
|
59
59
|
// TODO: temporary
|
|
60
|
-
queryParams['out_of_band_allowed'] = true;
|
|
60
|
+
queryParams['out_of_band_allowed'] = 'true';
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
return await this.send({
|
|
@@ -229,7 +229,6 @@ export class Communicator {
|
|
|
229
229
|
utm_medium: data.utmMedium,
|
|
230
230
|
utm_campaign: data.utmCampaign,
|
|
231
231
|
utm_term: data.utmTerm,
|
|
232
|
-
fbclid: data.fbclid,
|
|
233
232
|
},
|
|
234
233
|
...(data.metadata && { metadata: prepareMetadata(data.metadata) }),
|
|
235
234
|
});
|
|
@@ -192,7 +192,6 @@ type TRegistrationRequestBodySource = {
|
|
|
192
192
|
utm_medium: string,
|
|
193
193
|
utm_campaign: string,
|
|
194
194
|
utm_term: string,
|
|
195
|
-
fbclid: string,
|
|
196
195
|
metadata: TRegistrationRequestBodySourceMetadata[],
|
|
197
196
|
}
|
|
198
197
|
|
|
@@ -219,7 +218,6 @@ type TRegistrationRequestData = {
|
|
|
219
218
|
utmMedium: TRegistrationRequestBodySource['utm_medium'],
|
|
220
219
|
utmCampaign: TRegistrationRequestBodySource['utm_campaign'],
|
|
221
220
|
utmTerm: TRegistrationRequestBodySource['utm_term'],
|
|
222
|
-
fbclid: TRegistrationRequestBodySource['fbclid'],
|
|
223
221
|
metadata: TRegistrationMetadata,
|
|
224
222
|
}
|
|
225
223
|
/* endregion registration */
|
|
@@ -108,7 +108,7 @@ exports[`Communicator requests profileAssign 1`] = `
|
|
|
108
108
|
|
|
109
109
|
exports[`Communicator requests registration 1`] = `
|
|
110
110
|
{
|
|
111
|
-
"body": "{"name":"_companyName_","country_code":"CAN","source":{"hash":"_hash_","device_type":"mobile","ga_id":"_gaId_","origin":"_origin_","gc_id":"_gcId_","utm_source":"_utmSource_","utm_medium":"_utmMedium_","utm_campaign":"_utmCampaign_","utm_term":"_utmTerm_"
|
|
111
|
+
"body": "{"name":"_companyName_","country_code":"CAN","source":{"hash":"_hash_","device_type":"mobile","ga_id":"_gaId_","origin":"_origin_","gc_id":"_gcId_","utm_source":"_utmSource_","utm_medium":"_utmMedium_","utm_campaign":"_utmCampaign_","utm_term":"_utmTerm_"},"metadata":[{"key":"wa.country_code","value":"CAN"},{"key":"wa.device_type","value":"mobile"},{"key":"wa.hash","value":"_hash_"},{"key":"google._gcl_aw","value":"_gcl_aw_"},{"key":"google._ga","value":"_ga_"},{"key":"meta._fbc","value":"_fbc_"},{"key":"meta._fbp","value":"_fbp_"},{"key":"microsoft._uetmsclkid","value":"_uetmsclkid_"},{"key":"microsoft._uetvid","value":"_uetvid_"},{"key":"linkedin.li_fat_id","value":"_li_fat_id_"},{"key":"appsflyer.cuid","value":"_cuid_"},{"key":"utm.source","value":"_utmSource_"},{"key":"utm.medium","value":"_utmMedium_"},{"key":"utm.campaign","value":"_utmCampaign_"},{"key":"utm.term","value":"_utmTerm_"}]}",
|
|
112
112
|
"headers": {
|
|
113
113
|
"Accept": "application/json, text/plain, */*",
|
|
114
114
|
"Authorization": "Bearer _accessToken_",
|
|
@@ -72,7 +72,6 @@ const registrationData: TRegistrationRequestData = {
|
|
|
72
72
|
utmMedium: communicatorTestData.utmMedium,
|
|
73
73
|
utmCampaign: communicatorTestData.utmCampaign,
|
|
74
74
|
utmTerm: communicatorTestData.utmTerm,
|
|
75
|
-
fbclid: communicatorTestData.fbclid,
|
|
76
75
|
metadata: communicatorTestData.metadata,
|
|
77
76
|
};
|
|
78
77
|
|