@maxzima/wa-communicator 1.0.6 → 1.0.8
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.
|
@@ -2,15 +2,15 @@ import { __awaiter } from "tslib";
|
|
|
2
2
|
import { CommunicatorDefaultRequestData } from "./../Constants/Communicator";
|
|
3
3
|
export class Communicator {
|
|
4
4
|
constructor(props) {
|
|
5
|
-
this.getMeta = () => {
|
|
5
|
+
this.getMeta = (browserData) => {
|
|
6
6
|
return {
|
|
7
7
|
audit_source_type: CommunicatorDefaultRequestData.AUDIT_SOURCE_TYPE,
|
|
8
|
-
browser_page_resolution: `${
|
|
9
|
-
cookies_enabled:
|
|
8
|
+
browser_page_resolution: `${browserData.innerWidth}x${browserData.innerHeight}`,
|
|
9
|
+
cookies_enabled: browserData.isCookieEnabled,
|
|
10
10
|
ip: CommunicatorDefaultRequestData.IP,
|
|
11
11
|
js_enabled: true,
|
|
12
12
|
language: CommunicatorDefaultRequestData.LANG,
|
|
13
|
-
user_agent:
|
|
13
|
+
user_agent: browserData.userAgent,
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
this.processingQueryParams = (queryParams) => {
|
|
@@ -29,7 +29,10 @@ export class Communicator {
|
|
|
29
29
|
}
|
|
30
30
|
signIn(data) {
|
|
31
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
|
|
32
|
+
if (!data.browserData) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const meta = this.getMeta(data.browserData);
|
|
33
36
|
const body = JSON.stringify({
|
|
34
37
|
captcha_response: '_',
|
|
35
38
|
meta,
|
|
@@ -111,7 +114,7 @@ export class Communicator {
|
|
|
111
114
|
return yield this.send({
|
|
112
115
|
method: 'GET',
|
|
113
116
|
url: `${this.props.clientFAPIBaseUrl}${"user"}`,
|
|
114
|
-
headers: Object.assign({ 'Authorization': `Bearer ${data.
|
|
117
|
+
headers: Object.assign({ 'Authorization': `Bearer ${data.authToken}` }, CommunicatorDefaultRequestData.FETCH_HEADERS_INIT),
|
|
115
118
|
});
|
|
116
119
|
});
|
|
117
120
|
}
|
|
@@ -31,8 +31,15 @@ declare type TAccountMeta = {
|
|
|
31
31
|
language: string;
|
|
32
32
|
user_agent: string;
|
|
33
33
|
};
|
|
34
|
+
declare type TAccountBrowserData = {
|
|
35
|
+
innerWidth: number;
|
|
36
|
+
innerHeight: number;
|
|
37
|
+
isCookieEnabled: boolean;
|
|
38
|
+
userAgent: NavigatorID['userAgent'];
|
|
39
|
+
};
|
|
34
40
|
declare type TSignInByMobileRequestData = {
|
|
35
41
|
phoneNumber: string;
|
|
42
|
+
browserData: TAccountBrowserData;
|
|
36
43
|
};
|
|
37
44
|
declare type TSignInByMobileResponse = {
|
|
38
45
|
auth_token: string;
|
|
@@ -100,7 +107,7 @@ declare type TRegistrationRequestBody = {
|
|
|
100
107
|
source: TRegistrationRequestBodySource;
|
|
101
108
|
};
|
|
102
109
|
declare type TGetCurrentUserProfileRequestData = {
|
|
103
|
-
|
|
110
|
+
authToken: string;
|
|
104
111
|
};
|
|
105
112
|
declare type TRegistrationRequestData = {
|
|
106
113
|
accessToken: string;
|
|
@@ -110,4 +117,4 @@ declare type TRegistrationRequestData = {
|
|
|
110
117
|
gaId: TRegistrationRequestBodySource['ga_id'];
|
|
111
118
|
origin: TRegistrationRequestBodySource['origin'];
|
|
112
119
|
};
|
|
113
|
-
export { TChallenge, TAuditSource, TRequestProps, TRequestQueryParams, TResponse, TSignInStartRequestBody, TAccountMeta, TSignInByMobileRequestData, TSignInByMobileResponse, TSignUpStartRequestBody, TSignUpByMobileRequestData, TSetupChallengeRequestData, TSetupChallengeResponse, TVerifyChallengeRequestBody, TVerifyChallengeRequestData, TVerifyChallengeResponse, TEmailUpdateRequestData, TCreateSessionRequestData, TCreateSessionResponse, TGetCurrentUserProfileResponseUser, TGetCurrentUserProfileRequestData, TRegistrationRequestData };
|
|
120
|
+
export { TChallenge, TAuditSource, TRequestProps, TRequestQueryParams, TResponse, TSignInStartRequestBody, TAccountMeta, TAccountBrowserData, TSignInByMobileRequestData, TSignInByMobileResponse, TSignUpStartRequestBody, TSignUpByMobileRequestData, TSetupChallengeRequestData, TSetupChallengeResponse, TVerifyChallengeRequestBody, TVerifyChallengeRequestData, TVerifyChallengeResponse, TEmailUpdateRequestData, TCreateSessionRequestData, TCreateSessionResponse, TGetCurrentUserProfileResponseUser, TGetCurrentUserProfileRequestData, TRegistrationRequestData };
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
TAccountBrowserData,
|
|
2
3
|
TAccountMeta,
|
|
3
4
|
TCreateSessionRequestData,
|
|
4
5
|
TEmailUpdateRequestData,
|
|
@@ -25,7 +26,11 @@ export class Communicator {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
public async signIn(data: TSignInByMobileRequestData) {
|
|
28
|
-
|
|
29
|
+
if (!data.browserData) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const meta = this.getMeta(data.browserData);
|
|
29
34
|
const body = JSON.stringify({
|
|
30
35
|
captcha_response: '_',
|
|
31
36
|
meta,
|
|
@@ -118,7 +123,7 @@ export class Communicator {
|
|
|
118
123
|
method: 'GET',
|
|
119
124
|
url: `${this.props.clientFAPIBaseUrl}${CommunicatorFAPIEndpointEnum.USER}`,
|
|
120
125
|
headers: {
|
|
121
|
-
'Authorization': `Bearer ${data.
|
|
126
|
+
'Authorization': `Bearer ${data.authToken}`,
|
|
122
127
|
...CommunicatorDefaultRequestData.FETCH_HEADERS_INIT,
|
|
123
128
|
},
|
|
124
129
|
});
|
|
@@ -168,15 +173,15 @@ export class Communicator {
|
|
|
168
173
|
});
|
|
169
174
|
}
|
|
170
175
|
|
|
171
|
-
private getMeta = (): TAccountMeta => {
|
|
176
|
+
private getMeta = (browserData: TAccountBrowserData): TAccountMeta => {
|
|
172
177
|
return {
|
|
173
178
|
audit_source_type: CommunicatorDefaultRequestData.AUDIT_SOURCE_TYPE,
|
|
174
|
-
browser_page_resolution: `${
|
|
175
|
-
cookies_enabled:
|
|
179
|
+
browser_page_resolution: `${browserData.innerWidth}x${browserData.innerHeight}`,
|
|
180
|
+
cookies_enabled: browserData.isCookieEnabled,
|
|
176
181
|
ip: CommunicatorDefaultRequestData.IP,
|
|
177
182
|
js_enabled: true,
|
|
178
183
|
language: CommunicatorDefaultRequestData.LANG,
|
|
179
|
-
user_agent:
|
|
184
|
+
user_agent: browserData.userAgent,
|
|
180
185
|
};
|
|
181
186
|
};
|
|
182
187
|
|
|
@@ -38,8 +38,16 @@ type TAccountMeta = {
|
|
|
38
38
|
user_agent: string
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
type TAccountBrowserData = {
|
|
42
|
+
innerWidth: number,
|
|
43
|
+
innerHeight: number,
|
|
44
|
+
isCookieEnabled: boolean,
|
|
45
|
+
userAgent: NavigatorID['userAgent'],
|
|
46
|
+
}
|
|
47
|
+
|
|
41
48
|
type TSignInByMobileRequestData = {
|
|
42
49
|
phoneNumber: string,
|
|
50
|
+
browserData: TAccountBrowserData,
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
type TSignInByMobileResponse = {
|
|
@@ -145,7 +153,7 @@ type TRegistrationRequestBody = {
|
|
|
145
153
|
}
|
|
146
154
|
|
|
147
155
|
type TGetCurrentUserProfileRequestData = {
|
|
148
|
-
|
|
156
|
+
authToken: string,
|
|
149
157
|
}
|
|
150
158
|
|
|
151
159
|
type TRegistrationRequestData = {
|
|
@@ -166,6 +174,7 @@ export {
|
|
|
166
174
|
TResponse,
|
|
167
175
|
TSignInStartRequestBody,
|
|
168
176
|
TAccountMeta,
|
|
177
|
+
TAccountBrowserData,
|
|
169
178
|
TSignInByMobileRequestData,
|
|
170
179
|
TSignInByMobileResponse,
|
|
171
180
|
TSignUpStartRequestBody,
|