@maxzima/wa-communicator 1.0.28 → 1.0.30
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
|
}
|
|
@@ -109,9 +114,7 @@ export class Communicator {
|
|
|
109
114
|
mobile: data.phoneNumber,
|
|
110
115
|
};
|
|
111
116
|
const url = `${this.props.clientAuthSSEBaseUrl}${"sse/app-auth"}`;
|
|
112
|
-
this.sseAuth = new EventSource(`${url}?${this.processingQueryParams(params)}
|
|
113
|
-
withCredentials: true,
|
|
114
|
-
});
|
|
117
|
+
this.sseAuth = new EventSource(`${url}?${this.processingQueryParams(params)}`);
|
|
115
118
|
if (this.sseAuth) {
|
|
116
119
|
this.sseAuth.addEventListener('open', (event) => {
|
|
117
120
|
if (this.props.env !== 'prod') {
|
|
@@ -143,7 +146,6 @@ export class Communicator {
|
|
|
143
146
|
}
|
|
144
147
|
closeSSEAuth() {
|
|
145
148
|
if (this.sseAuth) {
|
|
146
|
-
console.log(this.sseAuth.readyState);
|
|
147
149
|
this.sseAuth.close();
|
|
148
150
|
this.sseAuth = null;
|
|
149
151
|
}
|
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
|
|
|
@@ -110,9 +117,7 @@ export class Communicator {
|
|
|
110
117
|
mobile: data.phoneNumber,
|
|
111
118
|
}
|
|
112
119
|
const url = `${this.props.clientAuthSSEBaseUrl}${CommunicatorAuthAPIEndpointEnum.SSE_AUTH}`;
|
|
113
|
-
this.sseAuth = new EventSource(`${url}?${this.processingQueryParams(params)}
|
|
114
|
-
withCredentials: true,
|
|
115
|
-
});
|
|
120
|
+
this.sseAuth = new EventSource(`${url}?${this.processingQueryParams(params)}`);
|
|
116
121
|
|
|
117
122
|
if (this.sseAuth) {
|
|
118
123
|
this.sseAuth.addEventListener('open', (event: MessageEvent) => {
|
|
@@ -147,8 +152,7 @@ export class Communicator {
|
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
public closeSSEAuth() {
|
|
150
|
-
if (this.sseAuth) {
|
|
151
|
-
console.log(this.sseAuth.readyState);
|
|
155
|
+
if (this.sseAuth) { // && this.sseAuth.readyState === EventSource.OPEN
|
|
152
156
|
this.sseAuth.close();
|
|
153
157
|
this.sseAuth = null;
|
|
154
158
|
}
|