@maxzima/wa-communicator 1.0.27 → 1.0.29
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.
|
@@ -47,11 +47,16 @@ export class Communicator {
|
|
|
47
47
|
meta,
|
|
48
48
|
mobile: data.phoneNumber,
|
|
49
49
|
});
|
|
50
|
+
const queryParams = {};
|
|
51
|
+
if (data.outOfBandAllowed) {
|
|
52
|
+
queryParams['out_of_band_allowed'] = true;
|
|
53
|
+
}
|
|
50
54
|
return yield this.send({
|
|
51
55
|
method: 'POST',
|
|
52
56
|
url: `${this.props.clientAuthApiBaseUrl}${"sign-in"}`,
|
|
53
57
|
body,
|
|
54
58
|
headers,
|
|
59
|
+
queryParams,
|
|
55
60
|
});
|
|
56
61
|
});
|
|
57
62
|
}
|
|
@@ -143,7 +148,6 @@ export class Communicator {
|
|
|
143
148
|
}
|
|
144
149
|
closeSSEAuth() {
|
|
145
150
|
if (this.sseAuth) {
|
|
146
|
-
console.log(this.sseAuth.readyState);
|
|
147
151
|
this.sseAuth.close();
|
|
148
152
|
this.sseAuth = null;
|
|
149
153
|
}
|
|
@@ -46,6 +46,7 @@ declare type TSignInByMobileRequestData = {
|
|
|
46
46
|
phoneNumber: string;
|
|
47
47
|
deviceId: string;
|
|
48
48
|
browserData: TAccountBrowserData;
|
|
49
|
+
outOfBandAllowed?: boolean;
|
|
49
50
|
};
|
|
50
51
|
declare type TSignInByAppRequestData = {
|
|
51
52
|
authToken: string;
|
|
@@ -83,8 +84,14 @@ declare type TSetupSSERequestData = {
|
|
|
83
84
|
onMessage: (responseData: TSSEResponseData) => void;
|
|
84
85
|
};
|
|
85
86
|
declare type TSSEResponseData = {
|
|
86
|
-
otp
|
|
87
|
+
otp?: string;
|
|
87
88
|
decline_reason?: string;
|
|
89
|
+
message?: string;
|
|
90
|
+
error_code?: number;
|
|
91
|
+
error_text?: string;
|
|
92
|
+
error_context?: {
|
|
93
|
+
next_attempts_after?: string;
|
|
94
|
+
};
|
|
88
95
|
};
|
|
89
96
|
declare type TSetupChallengeResponse = {
|
|
90
97
|
attempts_left: number;
|
package/package.json
CHANGED
|
@@ -47,11 +47,18 @@ export class Communicator {
|
|
|
47
47
|
mobile: data.phoneNumber,
|
|
48
48
|
} as TSignInStartRequestBody);
|
|
49
49
|
|
|
50
|
+
const queryParams = {}
|
|
51
|
+
if (data.outOfBandAllowed) {
|
|
52
|
+
// TODO: temporary
|
|
53
|
+
queryParams['out_of_band_allowed'] = true;
|
|
54
|
+
}
|
|
55
|
+
|
|
50
56
|
return await this.send({
|
|
51
57
|
method: 'POST',
|
|
52
58
|
url: `${this.props.clientAuthApiBaseUrl}${CommunicatorAuthAPIEndpointEnum.SIGN_IN}`,
|
|
53
59
|
body,
|
|
54
60
|
headers,
|
|
61
|
+
queryParams,
|
|
55
62
|
});
|
|
56
63
|
}
|
|
57
64
|
|
|
@@ -147,8 +154,7 @@ export class Communicator {
|
|
|
147
154
|
}
|
|
148
155
|
|
|
149
156
|
public closeSSEAuth() {
|
|
150
|
-
if (this.sseAuth) {
|
|
151
|
-
console.log(this.sseAuth.readyState);
|
|
157
|
+
if (this.sseAuth) { // && this.sseAuth.readyState === EventSource.OPEN
|
|
152
158
|
this.sseAuth.close();
|
|
153
159
|
this.sseAuth = null;
|
|
154
160
|
}
|
|
@@ -55,6 +55,7 @@ type TSignInByMobileRequestData = {
|
|
|
55
55
|
phoneNumber: string,
|
|
56
56
|
deviceId: string,
|
|
57
57
|
browserData: TAccountBrowserData,
|
|
58
|
+
outOfBandAllowed?: boolean,
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
type TSignInByAppRequestData = {
|
|
@@ -104,8 +105,14 @@ type TSetupSSERequestData = {
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
type TSSEResponseData = {
|
|
107
|
-
otp
|
|
108
|
+
otp?: string,
|
|
108
109
|
decline_reason?: string,
|
|
110
|
+
message?: string,
|
|
111
|
+
error_code?: number,
|
|
112
|
+
error_text?: string,
|
|
113
|
+
error_context?: {
|
|
114
|
+
next_attempts_after?: string,
|
|
115
|
+
}
|
|
109
116
|
}
|
|
110
117
|
|
|
111
118
|
type TSetupChallengeResponse = {
|