@como/como-client 0.6.9 → 0.7.3
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 +40 -6
- package/lib/services/auth.service.js +21 -14
- package/lib/services/form.service.js +32 -0
- package/package.json +1 -1
- package/src/como.js +19 -2
package/lib/como.js
CHANGED
|
@@ -223,7 +223,7 @@ var Como = function () {
|
|
|
223
223
|
interval = 0;
|
|
224
224
|
|
|
225
225
|
if (!(refreshFailed || !credExist)) {
|
|
226
|
-
_context2.next =
|
|
226
|
+
_context2.next = 51;
|
|
227
227
|
break;
|
|
228
228
|
}
|
|
229
229
|
|
|
@@ -262,17 +262,38 @@ var Como = function () {
|
|
|
262
262
|
break;
|
|
263
263
|
|
|
264
264
|
case 49:
|
|
265
|
+
_context2.next = 60;
|
|
266
|
+
break;
|
|
267
|
+
|
|
268
|
+
case 51:
|
|
269
|
+
_context2.prev = 51;
|
|
270
|
+
|
|
271
|
+
console.error('signOn with, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken);
|
|
272
|
+
_context2.next = 55;
|
|
273
|
+
return this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
|
|
274
|
+
|
|
275
|
+
case 55:
|
|
276
|
+
_context2.next = 60;
|
|
277
|
+
break;
|
|
278
|
+
|
|
279
|
+
case 57:
|
|
280
|
+
_context2.prev = 57;
|
|
281
|
+
_context2.t2 = _context2['catch'](51);
|
|
282
|
+
|
|
283
|
+
console.log('Failed signOn with accessToken, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken + ', error:' + _context2.t2);
|
|
284
|
+
|
|
285
|
+
case 60:
|
|
265
286
|
if (!this.comoData.token) {
|
|
266
287
|
this.comoData.token = this.comoData.accessToken;
|
|
267
288
|
}
|
|
268
289
|
return _context2.abrupt('return', this.getCredentials());
|
|
269
290
|
|
|
270
|
-
case
|
|
291
|
+
case 62:
|
|
271
292
|
case 'end':
|
|
272
293
|
return _context2.stop();
|
|
273
294
|
}
|
|
274
295
|
}
|
|
275
|
-
}, _callee2, this, [[17, 24], [32, 40]]);
|
|
296
|
+
}, _callee2, this, [[17, 24], [32, 40], [51, 57]]);
|
|
276
297
|
}));
|
|
277
298
|
|
|
278
299
|
function init(_x, _x2, _x3) {
|
|
@@ -895,10 +916,9 @@ var Como = function () {
|
|
|
895
916
|
_context14.prev = 5;
|
|
896
917
|
_context14.t0 = _context14['catch'](1);
|
|
897
918
|
|
|
898
|
-
console.log('clientUpdateMembership failed, token:' + token + ', locationId:' + locationId);
|
|
899
|
-
initService.logError({ method: 'clientUpdateMembership', token: token, locationId: locationId });
|
|
919
|
+
console.log('clientUpdateMembership failed, token:' + token + ', locationId:' + locationId + ', error: ' + _context14.t0);
|
|
900
920
|
|
|
901
|
-
case
|
|
921
|
+
case 8:
|
|
902
922
|
case 'end':
|
|
903
923
|
return _context14.stop();
|
|
904
924
|
}
|
|
@@ -2249,6 +2269,20 @@ var Como = function () {
|
|
|
2249
2269
|
|
|
2250
2270
|
return getPurchaseHistory;
|
|
2251
2271
|
}()
|
|
2272
|
+
|
|
2273
|
+
/**
|
|
2274
|
+
* Get app texts for multi languages - only for apps that has project set in translation service
|
|
2275
|
+
*/
|
|
2276
|
+
|
|
2277
|
+
}, {
|
|
2278
|
+
key: 'getAppTextsV2',
|
|
2279
|
+
value: function getAppTextsV2() {
|
|
2280
|
+
var _comoData44 = this.comoData,
|
|
2281
|
+
api = _comoData44.api,
|
|
2282
|
+
locationId = _comoData44.locationId;
|
|
2283
|
+
|
|
2284
|
+
return api.getAllTranslations(locationId);
|
|
2285
|
+
}
|
|
2252
2286
|
}]);
|
|
2253
2287
|
return Como;
|
|
2254
2288
|
}();
|
|
@@ -27,24 +27,31 @@ function getHashHeader(data) {
|
|
|
27
27
|
|
|
28
28
|
exports.signOn = function (service) {
|
|
29
29
|
return function () {
|
|
30
|
-
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(deviceId, locationId, source) {
|
|
30
|
+
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(deviceId, locationId, source, accessToken) {
|
|
31
31
|
var params, headers, _ref2, data;
|
|
32
32
|
|
|
33
33
|
return _regenerator2.default.wrap(function _callee$(_context) {
|
|
34
34
|
while (1) {
|
|
35
35
|
switch (_context.prev = _context.next) {
|
|
36
36
|
case 0:
|
|
37
|
-
params = { deviceId: deviceId, locationId: locationId, source: source };
|
|
37
|
+
params = { deviceId: deviceId, locationId: locationId, source: source, accessToken: accessToken };
|
|
38
38
|
headers = getHashHeader(params);
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
if (accessToken) {
|
|
41
|
+
headers['Authorization'] = "Bearer " + accessToken;
|
|
42
|
+
}
|
|
43
|
+
console.error("signOn(auth) with deviceId:" + deviceId + ", locationId:" + locationId + ", source:" + source + ",accessToken:" + accessToken + ", headers: " + headers);
|
|
44
|
+
_context.next = 6;
|
|
40
45
|
return service.post('/auth/v2/auth/signOn', params, { headers: headers });
|
|
41
46
|
|
|
42
|
-
case
|
|
47
|
+
case 6:
|
|
43
48
|
_ref2 = _context.sent;
|
|
44
49
|
data = _ref2.data;
|
|
50
|
+
|
|
51
|
+
console.error("signOn(auth) result with data:" + data);
|
|
45
52
|
return _context.abrupt("return", data);
|
|
46
53
|
|
|
47
|
-
case
|
|
54
|
+
case 10:
|
|
48
55
|
case "end":
|
|
49
56
|
return _context.stop();
|
|
50
57
|
}
|
|
@@ -52,7 +59,7 @@ exports.signOn = function (service) {
|
|
|
52
59
|
}, _callee, undefined);
|
|
53
60
|
}));
|
|
54
61
|
|
|
55
|
-
return function (_x, _x2, _x3) {
|
|
62
|
+
return function (_x, _x2, _x3, _x4) {
|
|
56
63
|
return _ref.apply(this, arguments);
|
|
57
64
|
};
|
|
58
65
|
}();
|
|
@@ -85,7 +92,7 @@ exports.register = function (service) {
|
|
|
85
92
|
}, _callee2, undefined);
|
|
86
93
|
}));
|
|
87
94
|
|
|
88
|
-
return function (
|
|
95
|
+
return function (_x5, _x6, _x7) {
|
|
89
96
|
return _ref3.apply(this, arguments);
|
|
90
97
|
};
|
|
91
98
|
}();
|
|
@@ -117,7 +124,7 @@ exports.registerVerify = function (service) {
|
|
|
117
124
|
}, _callee3, undefined);
|
|
118
125
|
}));
|
|
119
126
|
|
|
120
|
-
return function (
|
|
127
|
+
return function (_x9, _x10, _x11, _x12) {
|
|
121
128
|
return _ref5.apply(this, arguments);
|
|
122
129
|
};
|
|
123
130
|
}();
|
|
@@ -150,7 +157,7 @@ exports.updateProfile = function (service) {
|
|
|
150
157
|
}, _callee4, undefined);
|
|
151
158
|
}));
|
|
152
159
|
|
|
153
|
-
return function (
|
|
160
|
+
return function (_x13, _x14) {
|
|
154
161
|
return _ref7.apply(this, arguments);
|
|
155
162
|
};
|
|
156
163
|
}();
|
|
@@ -184,7 +191,7 @@ exports.updateProfileVerify = function (service) {
|
|
|
184
191
|
}, _callee5, undefined);
|
|
185
192
|
}));
|
|
186
193
|
|
|
187
|
-
return function (
|
|
194
|
+
return function (_x16, _x17, _x18, _x19) {
|
|
188
195
|
return _ref9.apply(this, arguments);
|
|
189
196
|
};
|
|
190
197
|
}();
|
|
@@ -216,7 +223,7 @@ exports.unsubscribeSms = function (service) {
|
|
|
216
223
|
}, _callee6, undefined);
|
|
217
224
|
}));
|
|
218
225
|
|
|
219
|
-
return function (
|
|
226
|
+
return function (_x21, _x22) {
|
|
220
227
|
return _ref11.apply(this, arguments);
|
|
221
228
|
};
|
|
222
229
|
}();
|
|
@@ -249,7 +256,7 @@ exports.logIn = function (service) {
|
|
|
249
256
|
}, _callee7, undefined);
|
|
250
257
|
}));
|
|
251
258
|
|
|
252
|
-
return function (
|
|
259
|
+
return function (_x23, _x24) {
|
|
253
260
|
return _ref13.apply(this, arguments);
|
|
254
261
|
};
|
|
255
262
|
}();
|
|
@@ -286,7 +293,7 @@ exports.logInVerify = function (service) {
|
|
|
286
293
|
}, _callee8, undefined);
|
|
287
294
|
}));
|
|
288
295
|
|
|
289
|
-
return function (
|
|
296
|
+
return function (_x25, _x26, _x27) {
|
|
290
297
|
return _ref15.apply(this, arguments);
|
|
291
298
|
};
|
|
292
299
|
}();
|
|
@@ -344,7 +351,7 @@ exports.refreshToken = function (service) {
|
|
|
344
351
|
}, _callee10, undefined);
|
|
345
352
|
}));
|
|
346
353
|
|
|
347
|
-
return function (
|
|
354
|
+
return function (_x28, _x29, _x30, _x31) {
|
|
348
355
|
return _ref19.apply(this, arguments);
|
|
349
356
|
};
|
|
350
357
|
}();
|
|
@@ -136,4 +136,36 @@ exports.getZappResource = function (service) {
|
|
|
136
136
|
return _ref7.apply(this, arguments);
|
|
137
137
|
};
|
|
138
138
|
}();
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
exports.getAllTranslations = function (service) {
|
|
142
|
+
return function () {
|
|
143
|
+
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(locationId) {
|
|
144
|
+
var url, _ref10, data;
|
|
145
|
+
|
|
146
|
+
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
|
147
|
+
while (1) {
|
|
148
|
+
switch (_context5.prev = _context5.next) {
|
|
149
|
+
case 0:
|
|
150
|
+
url = "/v1/translation/" + locationId;
|
|
151
|
+
_context5.next = 3;
|
|
152
|
+
return service.get(url);
|
|
153
|
+
|
|
154
|
+
case 3:
|
|
155
|
+
_ref10 = _context5.sent;
|
|
156
|
+
data = _ref10.data;
|
|
157
|
+
return _context5.abrupt("return", data);
|
|
158
|
+
|
|
159
|
+
case 6:
|
|
160
|
+
case "end":
|
|
161
|
+
return _context5.stop();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}, _callee5, undefined);
|
|
165
|
+
}));
|
|
166
|
+
|
|
167
|
+
return function (_x9) {
|
|
168
|
+
return _ref9.apply(this, arguments);
|
|
169
|
+
};
|
|
170
|
+
}();
|
|
139
171
|
};
|
package/package.json
CHANGED
package/src/como.js
CHANGED
|
@@ -130,6 +130,15 @@ class Como {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
+
else{
|
|
134
|
+
try{
|
|
135
|
+
console.error(`signOn with, installationId:${installationId}, locationId:${locationId}, source:${source},accessToken:${accessToken}`);
|
|
136
|
+
await this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
|
|
137
|
+
}catch(e){
|
|
138
|
+
console.log(`Failed signOn with accessToken, installationId:${installationId}, locationId:${locationId}, source:${source},accessToken:${accessToken}, error:${e}`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
}
|
|
133
142
|
if(!this.comoData.token){
|
|
134
143
|
this.comoData.token = this.comoData.accessToken;
|
|
135
144
|
}
|
|
@@ -372,8 +381,8 @@ class Como {
|
|
|
372
381
|
return api.clientUpdateMembership(env.services_root, token, locationId, pushEnable, locationEnable);
|
|
373
382
|
}
|
|
374
383
|
catch(e){
|
|
375
|
-
console.log(`clientUpdateMembership failed, token:${token}, locationId:${locationId}`);
|
|
376
|
-
|
|
384
|
+
console.log(`clientUpdateMembership failed, token:${token}, locationId:${locationId}, error: ${e}`);
|
|
385
|
+
|
|
377
386
|
}
|
|
378
387
|
}
|
|
379
388
|
|
|
@@ -938,6 +947,14 @@ class Como {
|
|
|
938
947
|
} = this.comoData;
|
|
939
948
|
return api.getPurchaseHistory(locationId, membership.Key, limit, offset);
|
|
940
949
|
}
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* Get app texts for multi languages - only for apps that has project set in translation service
|
|
953
|
+
*/
|
|
954
|
+
getAppTextsV2() {
|
|
955
|
+
const { api, locationId } = this.comoData;
|
|
956
|
+
return api.getAllTranslations(locationId);
|
|
957
|
+
}
|
|
941
958
|
}
|
|
942
959
|
|
|
943
960
|
module.exports = Como;
|