@basis-theory/basis-theory-js 1.79.3 → 1.79.4
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/common/utils.js +17 -3
- package/package.json +1 -1
package/common/utils.js
CHANGED
|
@@ -375,12 +375,21 @@ const getBrowser = () => {
|
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
return `${(browser === null || browser === void 0 ? void 0 : browser.browserName) || 'unknown'}/${version}`;
|
|
378
|
-
};
|
|
378
|
+
}; // the following product property is deprecated but it's the only way
|
|
379
|
+
// I've found to detect react-native
|
|
380
|
+
|
|
379
381
|
|
|
380
382
|
exports.getBrowser = getBrowser;
|
|
381
383
|
|
|
384
|
+
const isEnvReactNative = () => typeof window === 'object' && window.navigator.product === 'ReactNative';
|
|
385
|
+
|
|
382
386
|
const getOSVersion = () => {
|
|
383
|
-
//
|
|
387
|
+
// react-native
|
|
388
|
+
if (isEnvReactNative()) {
|
|
389
|
+
return 'ReactNative';
|
|
390
|
+
} // node
|
|
391
|
+
|
|
392
|
+
|
|
384
393
|
if (typeof window === 'undefined') {
|
|
385
394
|
try {
|
|
386
395
|
return `${_os.default.type()}/${_os.default.version()}`;
|
|
@@ -407,7 +416,12 @@ const getOSVersion = () => {
|
|
|
407
416
|
exports.getOSVersion = getOSVersion;
|
|
408
417
|
|
|
409
418
|
const getRuntime = () => {
|
|
410
|
-
//
|
|
419
|
+
// react-native
|
|
420
|
+
if (isEnvReactNative()) {
|
|
421
|
+
return 'ReactNative';
|
|
422
|
+
} // node
|
|
423
|
+
|
|
424
|
+
|
|
411
425
|
if (typeof window === 'undefined') {
|
|
412
426
|
return `NodeJS/${process.version}`;
|
|
413
427
|
} // browser
|