@maxzima/wa-communicator 1.0.52 → 1.0.54
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 -1
- package/dist/engine/Communicator/Utils/registrationMetaData.js +4 -5
- package/package.json +1 -1
- package/src/engine/AccountTracker/Public/AccountTracker.ts +8 -9
- package/src/engine/Communicator/Public/Communicator.ts +2 -2
- package/src/engine/Communicator/Utils/registrationMetaData.ts +3 -5
- package/tsconfig.json +1 -0
|
@@ -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') {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { registrationMetadataKeys } from "../Constants/RegistrationMetadata";
|
|
2
2
|
export function prepareMetadata(obj) {
|
|
3
|
+
var _a;
|
|
3
4
|
const result = [];
|
|
4
5
|
for (const key of registrationMetadataKeys) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
value: obj[key],
|
|
9
|
-
});
|
|
6
|
+
const value = (_a = obj[key]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
7
|
+
if (typeof value === 'string' && value) {
|
|
8
|
+
result.push({ key, value });
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
return result;
|
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({
|
|
@@ -5,11 +5,9 @@ export function prepareMetadata(obj: TRegistrationMetadata): TRegistrationReques
|
|
|
5
5
|
const result: TRegistrationRequestBodySourceMetadata[] = [];
|
|
6
6
|
|
|
7
7
|
for (const key of registrationMetadataKeys) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value: obj[key],
|
|
12
|
-
})
|
|
8
|
+
const value = obj[key]?.trim();
|
|
9
|
+
if (typeof value === 'string' && value) {
|
|
10
|
+
result.push({ key, value });
|
|
13
11
|
}
|
|
14
12
|
}
|
|
15
13
|
|