@como/como-client 0.7.93 → 0.7.95
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/lib/como.js +437 -380
- package/package.json +1 -1
- package/src/como.js +23 -2
package/package.json
CHANGED
package/src/como.js
CHANGED
|
@@ -115,10 +115,11 @@ class Como {
|
|
|
115
115
|
//refresh failed - need to revoke and signOn again
|
|
116
116
|
initService.logError({method: 'refreshToken', installationId, locationId, source, refreshToken, error : e.message});
|
|
117
117
|
refreshFailed = true;
|
|
118
|
+
credExist = false;
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
121
|
let interval = 0;
|
|
121
|
-
if(
|
|
122
|
+
if(!credExist){
|
|
122
123
|
while(!credExist && interval < 3000){
|
|
123
124
|
try{
|
|
124
125
|
const data = await this.comoData.initApi.signOn(installationId, locationId, source);
|
|
@@ -134,7 +135,7 @@ class Como {
|
|
|
134
135
|
}
|
|
135
136
|
else if(!isExpired){
|
|
136
137
|
let signOnSuccessfully = false;
|
|
137
|
-
while(!signOnSuccessfully && interval < 3000){
|
|
138
|
+
while (!signOnSuccessfully && interval < 3000) {
|
|
138
139
|
try{
|
|
139
140
|
console.log(`signOn with installationId:${installationId}, locationId:${locationId}, source:${source},accessToken:${accessToken}`);
|
|
140
141
|
const data = await this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
|
|
@@ -177,6 +178,9 @@ class Como {
|
|
|
177
178
|
this.comoData.expiresIn = credentials.expiresIn;
|
|
178
179
|
if(credentials.config){
|
|
179
180
|
this.comoData.reCaptchaSiteKey = credentials.config.recaptchaSiteKey;
|
|
181
|
+
if (credentials.config.recaptcha) {
|
|
182
|
+
this.comoData.recaptchaConfig = credentials.config.recaptcha;
|
|
183
|
+
}
|
|
180
184
|
}
|
|
181
185
|
}
|
|
182
186
|
|
|
@@ -303,6 +307,23 @@ class Como {
|
|
|
303
307
|
}
|
|
304
308
|
}
|
|
305
309
|
|
|
310
|
+
/**
|
|
311
|
+
* @param {string} language language code
|
|
312
|
+
*/
|
|
313
|
+
async updateLanguage(language) {
|
|
314
|
+
const { api } = this.comoData;
|
|
315
|
+
try {
|
|
316
|
+
const data = await api.updateLanguage(language);
|
|
317
|
+
return data;
|
|
318
|
+
} catch (error) {
|
|
319
|
+
if (error.response && error.response.data) {
|
|
320
|
+
const { code, message } = error.response.data;
|
|
321
|
+
throw new Error(code || message);
|
|
322
|
+
}
|
|
323
|
+
throw error;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
306
327
|
/**
|
|
307
328
|
*
|
|
308
329
|
* @param {string} unsubscribeSms unsubscribe user at location
|