backendless 7.4.6 → 7.4.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.
- package/dist/backendless.js +35 -11
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +2 -2
- package/es/index.js +18 -7
- package/es/user-agent.js +1 -0
- package/es/users/utils.js +4 -1
- package/es/utils.js +10 -1
- package/lib/index.js +18 -7
- package/lib/user-agent.js +1 -0
- package/lib/users/utils.js +4 -1
- package/lib/utils.js +10 -1
- package/package.json +1 -1
- package/src/index.js +20 -10
- package/src/user-agent.js +2 -0
- package/src/users/utils.js +5 -1
- package/src/utils.js +14 -1
package/es/index.js
CHANGED
|
@@ -29,8 +29,7 @@ var DEFAULT_PROPS = {
|
|
|
29
29
|
XMLHttpRequest: typeof XMLHttpRequest !== 'undefined' ? XMLHttpRequest : undefined
|
|
30
30
|
};
|
|
31
31
|
var STATELESS_PROPS = ['appId', 'apiKey', 'domain'];
|
|
32
|
-
var
|
|
33
|
-
var previousBackendless = root && root.Backendless;
|
|
32
|
+
var previousBackendless = _utils["default"].globalScope && _utils["default"].globalScope.Backendless;
|
|
34
33
|
var showLegacyDataWarning = function showLegacyDataWarning() {
|
|
35
34
|
if (!showLegacyDataWarning.isShown) {
|
|
36
35
|
// eslint-disable-next-line no-console
|
|
@@ -190,9 +189,21 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
190
189
|
this.__appInfoPromise = new Promise(function (resolve, reject) {
|
|
191
190
|
_this.request.get({
|
|
192
191
|
url: _this.urls.appInfo()
|
|
193
|
-
}).then(resolve)["catch"](
|
|
192
|
+
}).then(resolve)["catch"](function (error) {
|
|
193
|
+
if (error.code === 3064) {
|
|
194
|
+
_this.setCurrentUserToken(null);
|
|
195
|
+
return _this.request.get({
|
|
196
|
+
url: _this.urls.appInfo()
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
throw error;
|
|
200
|
+
})["catch"](reject);
|
|
194
201
|
});
|
|
195
202
|
}
|
|
203
|
+
this.__appInfoPromise["catch"](function (error) {
|
|
204
|
+
// eslint-disable-next-line no-console
|
|
205
|
+
console.error('could not load backendless app info', error);
|
|
206
|
+
});
|
|
196
207
|
return this.__appInfoPromise;
|
|
197
208
|
}
|
|
198
209
|
}, {
|
|
@@ -380,8 +391,8 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
380
391
|
}, {
|
|
381
392
|
key: "noConflict",
|
|
382
393
|
value: function noConflict() {
|
|
383
|
-
if (
|
|
384
|
-
|
|
394
|
+
if (_utils["default"].globalScope) {
|
|
395
|
+
_utils["default"].globalScope.Backendless = previousBackendless;
|
|
385
396
|
}
|
|
386
397
|
return this;
|
|
387
398
|
}
|
|
@@ -606,8 +617,8 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
606
617
|
return Backendless;
|
|
607
618
|
}();
|
|
608
619
|
var backendless = new Backendless(DEFAULT_PROPS);
|
|
609
|
-
if (
|
|
610
|
-
|
|
620
|
+
if (_utils["default"].globalScope) {
|
|
621
|
+
_utils["default"].globalScope.Backendless = backendless;
|
|
611
622
|
}
|
|
612
623
|
exports = module.exports = backendless;
|
|
613
624
|
var _default = backendless;
|
package/es/user-agent.js
CHANGED
|
@@ -9,6 +9,7 @@ var _utils = _interopRequireDefault(require("./utils"));
|
|
|
9
9
|
function getUserAgent() {
|
|
10
10
|
var ua = 'NodeJS';
|
|
11
11
|
if (_utils["default"].isBrowser) {
|
|
12
|
+
var navigator = _utils["default"].getWindowNavigator();
|
|
12
13
|
ua = navigator.userAgent ? navigator.userAgent.toLowerCase() : 'hybrid-app';
|
|
13
14
|
}
|
|
14
15
|
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || [];
|
package/es/users/utils.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.UsersUtils = void 0;
|
|
8
|
+
var _utils = _interopRequireDefault(require("../utils"));
|
|
7
9
|
var UsersUtils = {
|
|
8
10
|
getClientUserLocale: function getClientUserLocale() {
|
|
9
|
-
|
|
11
|
+
var navigator = _utils["default"].getWindowNavigator();
|
|
12
|
+
if (typeof navigator === 'undefined' || !navigator) {
|
|
10
13
|
return;
|
|
11
14
|
}
|
|
12
15
|
var language = '';
|
package/es/utils.js
CHANGED
|
@@ -9,7 +9,7 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
9
9
|
var Utils = {
|
|
10
10
|
isBrowser: isBrowser(),
|
|
11
11
|
isLocalStorageSupported: isLocalStorageSupported(),
|
|
12
|
-
globalScope: (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object' && self.self === self && self || (typeof global === "undefined" ? "undefined" : (0, _typeof2["default"])(global)) === 'object' && global.global === global && global,
|
|
12
|
+
globalScope: (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object' && self.self === self && self || (typeof global === "undefined" ? "undefined" : (0, _typeof2["default"])(global)) === 'object' && global.global === global && global || (typeof globalThis === "undefined" ? "undefined" : (0, _typeof2["default"])(globalThis)) === 'object' && globalThis,
|
|
13
13
|
castArray: function castArray(value) {
|
|
14
14
|
if (Array.isArray(value)) {
|
|
15
15
|
return value;
|
|
@@ -58,6 +58,15 @@ var Utils = {
|
|
|
58
58
|
},
|
|
59
59
|
isObject: function isObject(obj) {
|
|
60
60
|
return obj != null && obj.constructor.name === 'Object';
|
|
61
|
+
},
|
|
62
|
+
getWindowNavigator: function getWindowNavigator() {
|
|
63
|
+
if (typeof __test_navigator !== 'undefined') {
|
|
64
|
+
return __test_navigator;
|
|
65
|
+
}
|
|
66
|
+
if (typeof navigator !== 'undefined') {
|
|
67
|
+
return navigator;
|
|
68
|
+
}
|
|
69
|
+
return Utils.globalScope && Utils.globalScope.navigator;
|
|
61
70
|
}
|
|
62
71
|
};
|
|
63
72
|
function isBrowser() {
|
package/lib/index.js
CHANGED
|
@@ -29,8 +29,7 @@ var DEFAULT_PROPS = {
|
|
|
29
29
|
XMLHttpRequest: typeof XMLHttpRequest !== 'undefined' ? XMLHttpRequest : undefined
|
|
30
30
|
};
|
|
31
31
|
var STATELESS_PROPS = ['appId', 'apiKey', 'domain'];
|
|
32
|
-
var
|
|
33
|
-
var previousBackendless = root && root.Backendless;
|
|
32
|
+
var previousBackendless = _utils["default"].globalScope && _utils["default"].globalScope.Backendless;
|
|
34
33
|
var showLegacyDataWarning = function showLegacyDataWarning() {
|
|
35
34
|
if (!showLegacyDataWarning.isShown) {
|
|
36
35
|
// eslint-disable-next-line no-console
|
|
@@ -190,9 +189,21 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
190
189
|
this.__appInfoPromise = new Promise(function (resolve, reject) {
|
|
191
190
|
_this.request.get({
|
|
192
191
|
url: _this.urls.appInfo()
|
|
193
|
-
}).then(resolve)["catch"](
|
|
192
|
+
}).then(resolve)["catch"](function (error) {
|
|
193
|
+
if (error.code === 3064) {
|
|
194
|
+
_this.setCurrentUserToken(null);
|
|
195
|
+
return _this.request.get({
|
|
196
|
+
url: _this.urls.appInfo()
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
throw error;
|
|
200
|
+
})["catch"](reject);
|
|
194
201
|
});
|
|
195
202
|
}
|
|
203
|
+
this.__appInfoPromise["catch"](function (error) {
|
|
204
|
+
// eslint-disable-next-line no-console
|
|
205
|
+
console.error('could not load backendless app info', error);
|
|
206
|
+
});
|
|
196
207
|
return this.__appInfoPromise;
|
|
197
208
|
}
|
|
198
209
|
}, {
|
|
@@ -380,8 +391,8 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
380
391
|
}, {
|
|
381
392
|
key: "noConflict",
|
|
382
393
|
value: function noConflict() {
|
|
383
|
-
if (
|
|
384
|
-
|
|
394
|
+
if (_utils["default"].globalScope) {
|
|
395
|
+
_utils["default"].globalScope.Backendless = previousBackendless;
|
|
385
396
|
}
|
|
386
397
|
return this;
|
|
387
398
|
}
|
|
@@ -606,8 +617,8 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
606
617
|
return Backendless;
|
|
607
618
|
}();
|
|
608
619
|
var backendless = new Backendless(DEFAULT_PROPS);
|
|
609
|
-
if (
|
|
610
|
-
|
|
620
|
+
if (_utils["default"].globalScope) {
|
|
621
|
+
_utils["default"].globalScope.Backendless = backendless;
|
|
611
622
|
}
|
|
612
623
|
exports = module.exports = backendless;
|
|
613
624
|
var _default = backendless;
|
package/lib/user-agent.js
CHANGED
|
@@ -9,6 +9,7 @@ var _utils = _interopRequireDefault(require("./utils"));
|
|
|
9
9
|
function getUserAgent() {
|
|
10
10
|
var ua = 'NodeJS';
|
|
11
11
|
if (_utils["default"].isBrowser) {
|
|
12
|
+
var navigator = _utils["default"].getWindowNavigator();
|
|
12
13
|
ua = navigator.userAgent ? navigator.userAgent.toLowerCase() : 'hybrid-app';
|
|
13
14
|
}
|
|
14
15
|
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || [];
|
package/lib/users/utils.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.UsersUtils = void 0;
|
|
8
|
+
var _utils = _interopRequireDefault(require("../utils"));
|
|
7
9
|
var UsersUtils = {
|
|
8
10
|
getClientUserLocale: function getClientUserLocale() {
|
|
9
|
-
|
|
11
|
+
var navigator = _utils["default"].getWindowNavigator();
|
|
12
|
+
if (typeof navigator === 'undefined' || !navigator) {
|
|
10
13
|
return;
|
|
11
14
|
}
|
|
12
15
|
var language = '';
|
package/lib/utils.js
CHANGED
|
@@ -9,7 +9,7 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
9
9
|
var Utils = {
|
|
10
10
|
isBrowser: isBrowser(),
|
|
11
11
|
isLocalStorageSupported: isLocalStorageSupported(),
|
|
12
|
-
globalScope: (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object' && self.self === self && self || (typeof global === "undefined" ? "undefined" : (0, _typeof2["default"])(global)) === 'object' && global.global === global && global,
|
|
12
|
+
globalScope: (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object' && self.self === self && self || (typeof global === "undefined" ? "undefined" : (0, _typeof2["default"])(global)) === 'object' && global.global === global && global || (typeof globalThis === "undefined" ? "undefined" : (0, _typeof2["default"])(globalThis)) === 'object' && globalThis,
|
|
13
13
|
castArray: function castArray(value) {
|
|
14
14
|
if (Array.isArray(value)) {
|
|
15
15
|
return value;
|
|
@@ -58,6 +58,15 @@ var Utils = {
|
|
|
58
58
|
},
|
|
59
59
|
isObject: function isObject(obj) {
|
|
60
60
|
return obj != null && obj.constructor.name === 'Object';
|
|
61
|
+
},
|
|
62
|
+
getWindowNavigator: function getWindowNavigator() {
|
|
63
|
+
if (typeof __test_navigator !== 'undefined') {
|
|
64
|
+
return __test_navigator;
|
|
65
|
+
}
|
|
66
|
+
if (typeof navigator !== 'undefined') {
|
|
67
|
+
return navigator;
|
|
68
|
+
}
|
|
69
|
+
return Utils.globalScope && Utils.globalScope.navigator;
|
|
61
70
|
}
|
|
62
71
|
};
|
|
63
72
|
function isBrowser() {
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -21,12 +21,7 @@ const DEFAULT_PROPS = {
|
|
|
21
21
|
|
|
22
22
|
const STATELESS_PROPS = ['appId', 'apiKey', 'domain']
|
|
23
23
|
|
|
24
|
-
const
|
|
25
|
-
(typeof self === 'object' && self.self === self && self) ||
|
|
26
|
-
(typeof global === 'object' && global.global === global && global)
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
const previousBackendless = root && root.Backendless
|
|
24
|
+
const previousBackendless = Utils.globalScope && Utils.globalScope.Backendless
|
|
30
25
|
|
|
31
26
|
const showLegacyDataWarning = () => {
|
|
32
27
|
if (!showLegacyDataWarning.isShown) {
|
|
@@ -173,10 +168,25 @@ class Backendless {
|
|
|
173
168
|
this.__appInfoPromise = new Promise((resolve, reject) => {
|
|
174
169
|
this.request.get({ url: this.urls.appInfo() })
|
|
175
170
|
.then(resolve)
|
|
171
|
+
.catch(error => {
|
|
172
|
+
if (error.code === 3064) {
|
|
173
|
+
this.setCurrentUserToken(null)
|
|
174
|
+
|
|
175
|
+
return this.request.get({ url: this.urls.appInfo() })
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
throw error
|
|
179
|
+
})
|
|
176
180
|
.catch(reject)
|
|
177
181
|
})
|
|
178
182
|
}
|
|
179
183
|
|
|
184
|
+
this.__appInfoPromise
|
|
185
|
+
.catch(error => {
|
|
186
|
+
// eslint-disable-next-line no-console
|
|
187
|
+
console.error('could not load backendless app info', error)
|
|
188
|
+
})
|
|
189
|
+
|
|
180
190
|
return this.__appInfoPromise
|
|
181
191
|
}
|
|
182
192
|
|
|
@@ -373,8 +383,8 @@ class Backendless {
|
|
|
373
383
|
}
|
|
374
384
|
|
|
375
385
|
noConflict() {
|
|
376
|
-
if (
|
|
377
|
-
|
|
386
|
+
if (Utils.globalScope) {
|
|
387
|
+
Utils.globalScope.Backendless = previousBackendless
|
|
378
388
|
}
|
|
379
389
|
|
|
380
390
|
return this
|
|
@@ -566,8 +576,8 @@ class Backendless {
|
|
|
566
576
|
|
|
567
577
|
const backendless = new Backendless(DEFAULT_PROPS)
|
|
568
578
|
|
|
569
|
-
if (
|
|
570
|
-
|
|
579
|
+
if (Utils.globalScope) {
|
|
580
|
+
Utils.globalScope.Backendless = backendless
|
|
571
581
|
}
|
|
572
582
|
|
|
573
583
|
exports = module.exports = backendless
|
package/src/user-agent.js
CHANGED
package/src/users/utils.js
CHANGED
package/src/utils.js
CHANGED
|
@@ -6,7 +6,8 @@ const Utils = {
|
|
|
6
6
|
|
|
7
7
|
globalScope: (
|
|
8
8
|
(typeof self === 'object' && self.self === self && self) ||
|
|
9
|
-
(typeof global === 'object' && global.global === global && global)
|
|
9
|
+
(typeof global === 'object' && global.global === global && global) ||
|
|
10
|
+
(typeof globalThis === 'object' && globalThis)
|
|
10
11
|
),
|
|
11
12
|
|
|
12
13
|
castArray(value) {
|
|
@@ -63,6 +64,18 @@ const Utils = {
|
|
|
63
64
|
|
|
64
65
|
isObject(obj) {
|
|
65
66
|
return obj != null && obj.constructor.name === 'Object'
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
getWindowNavigator() {
|
|
70
|
+
if (typeof __test_navigator !== 'undefined') {
|
|
71
|
+
return __test_navigator
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (typeof navigator !== 'undefined') {
|
|
75
|
+
return navigator
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return Utils.globalScope && Utils.globalScope.navigator
|
|
66
79
|
}
|
|
67
80
|
}
|
|
68
81
|
|