@ombori/ga-settings
Advanced tools
Comparing version 3.92.7 to 3.92.8
@@ -6,2 +6,10 @@ # Change Log | ||
## 3.92.8 (2024-05-24) | ||
**Note:** Version bump only for package @ombori/ga-settings | ||
## 3.92.7 (2024-05-24) | ||
@@ -8,0 +16,0 @@ |
@@ -94,3 +94,3 @@ "use strict"; | ||
case types_1.InstallationTypeEnum.SCREEN: | ||
var device = getDeviceInfo(); | ||
var device = getDeviceInfo(gridappSettings); | ||
if (device) { | ||
@@ -159,3 +159,17 @@ var devicesSettings = (gridappSettings === null || gridappSettings === void 0 ? void 0 : gridappSettings._devicesSettings) || {}; | ||
}; | ||
var getDeviceInfo = function () { | ||
var getDeviceInfo = function (bootSettings) { | ||
if (bootSettings && | ||
bootSettings._deviceEnvs && | ||
!utils_1.isObjectEmpty(bootSettings._deviceEnvs)) { | ||
var deviceEnvsFromBoot = bootSettings._deviceEnvs; | ||
var deviceInfo = { | ||
id: deviceEnvsFromBoot.browserId, | ||
name: deviceEnvsFromBoot.deviceName, | ||
accessId: deviceEnvsFromBoot.browserId, | ||
accessToken: deviceEnvsFromBoot.accessKey, | ||
env: deviceEnvsFromBoot.env, | ||
spaceId: deviceEnvsFromBoot.spaceId || '', | ||
}; | ||
return deviceInfo; | ||
} | ||
// Note: Do not immediately return null if NODE_ENV is dev | ||
@@ -210,3 +224,3 @@ // Sometimes we render the app within same network on GridOS device for development | ||
case types_1.InstallationTypeEnum.SCREEN: | ||
var device = getDeviceInfo(); | ||
var device = getDeviceInfo(settings); | ||
if (device) { | ||
@@ -256,3 +270,3 @@ delete device.accessId; | ||
else if (isScreenApp) { | ||
device = getDeviceInfo(); | ||
device = getDeviceInfo(settings); | ||
environment = device === null || device === void 0 ? void 0 : device.env; | ||
@@ -259,0 +273,0 @@ spaceId = device === null || device === void 0 ? void 0 : device.spaceId; |
@@ -84,2 +84,9 @@ declare global { | ||
} | ||
export interface DeviceEnvs { | ||
browserId: string; | ||
accessKey: string; | ||
env: string; | ||
spaceId?: string; | ||
deviceName: string; | ||
} | ||
export interface StaticSettingsProps { | ||
@@ -116,2 +123,3 @@ _general: GeneralInfo; | ||
}; | ||
_deviceEnvs?: DeviceEnvs; | ||
} | ||
@@ -118,0 +126,0 @@ export interface AppInfo extends GeneralInfo { |
{ | ||
"name": "@ombori/ga-settings", | ||
"version": "3.92.7", | ||
"version": "3.92.8", | ||
"main": "dist/index.js", | ||
@@ -19,3 +19,3 @@ "license": "UNLICENSED", | ||
"test:coverage": "npm run test -- --coverage --watchAll=false", | ||
"gitHead": "00638a0c3b8c9451a8a0b1139ef80abe42d99443" | ||
"gitHead": "415bcf14a8e0a6e9fd18ee53c89dda655d183014" | ||
} |
@@ -12,2 +12,3 @@ import { useEffect, useState, useRef } from 'react'; | ||
AppInfo, | ||
StaticSettingsProps, | ||
} from './types'; | ||
@@ -98,3 +99,3 @@ | ||
case InstallationTypeEnum.SCREEN: | ||
const device = getDeviceInfo(); | ||
const device = getDeviceInfo(gridappSettings); | ||
if (device) { | ||
@@ -173,3 +174,21 @@ const devicesSettings = gridappSettings?._devicesSettings || {}; | ||
const getDeviceInfo = (): DeviceInfo | null => { | ||
const getDeviceInfo = (bootSettings?: StaticSettingsProps): DeviceInfo | null => { | ||
if ( | ||
bootSettings && | ||
bootSettings._deviceEnvs && | ||
!isObjectEmpty(bootSettings._deviceEnvs) | ||
) { | ||
const deviceEnvsFromBoot = bootSettings._deviceEnvs; | ||
const deviceInfo = { | ||
id: deviceEnvsFromBoot.browserId, | ||
name: deviceEnvsFromBoot.deviceName, | ||
accessId: deviceEnvsFromBoot.browserId, | ||
accessToken: deviceEnvsFromBoot.accessKey, | ||
env: deviceEnvsFromBoot.env, | ||
spaceId: deviceEnvsFromBoot.spaceId || '', | ||
}; | ||
return deviceInfo; | ||
} | ||
// Note: Do not immediately return null if NODE_ENV is dev | ||
@@ -239,3 +258,3 @@ // Sometimes we render the app within same network on GridOS device for development | ||
case InstallationTypeEnum.SCREEN: | ||
const device = getDeviceInfo(); | ||
const device = getDeviceInfo(settings); | ||
@@ -294,3 +313,3 @@ if (device) { | ||
} else if (isScreenApp) { | ||
device = getDeviceInfo(); | ||
device = getDeviceInfo(settings); | ||
environment = device?.env; | ||
@@ -297,0 +316,0 @@ spaceId = device?.spaceId; |
@@ -95,2 +95,10 @@ declare global { | ||
export interface DeviceEnvs { | ||
browserId: string; | ||
accessKey: string; | ||
env: string; | ||
spaceId?: string; | ||
deviceName: string; | ||
} | ||
export interface StaticSettingsProps { | ||
@@ -127,2 +135,3 @@ _general: GeneralInfo; | ||
}; | ||
_deviceEnvs?: DeviceEnvs; | ||
} | ||
@@ -129,0 +138,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65484
1050