Browse Source
Bootstrap analytics - Two components: <Track> and <TrackPage>. we should try to ALWAYS use them. only case you might not use them is for imperative events (click, etc..) - also: introduce a "Use system locale" for the language because analytics need to diffferenciate if lang was set by user of fallbacked. it's also better when we'll introduce new lang to users to directly auto switch to their system's - started to track some pages and events. there will be more required and we'll have to add some in the next days filtering developper toolsmaster
amougel
7 years ago
9 changed files with 135 additions and 44 deletions
@ -0,0 +1,15 @@ |
|||
// @flow
|
|||
|
|||
import { createCommand, Command } from 'helpers/ipc' |
|||
import { fromPromise } from 'rxjs/observable/fromPromise' |
|||
import type { DeviceInfo } from 'helpers/devices/getDeviceInfo' |
|||
|
|||
import listAppVersions from 'helpers/apps/listAppVersions' |
|||
|
|||
type Result = * |
|||
|
|||
const cmd: Command<DeviceInfo, Result> = createCommand('listAppVersions', deviceInfo => |
|||
fromPromise(listAppVersions(deviceInfo)), |
|||
) |
|||
|
|||
export default cmd |
@ -0,0 +1,16 @@ |
|||
// @flow
|
|||
|
|||
import { createCommand, Command } from 'helpers/ipc' |
|||
import { fromPromise } from 'rxjs/observable/fromPromise' |
|||
|
|||
import listCategories from 'helpers/apps/listCategories' |
|||
|
|||
type Input = {} |
|||
|
|||
type Result = * |
|||
|
|||
const cmd: Command<Input, Result> = createCommand('listCategories', () => |
|||
fromPromise(listCategories()), |
|||
) |
|||
|
|||
export default cmd |
@ -0,0 +1,31 @@ |
|||
// @flow
|
|||
import network from 'api/network' |
|||
import type { DeviceInfo } from 'helpers/devices/getDeviceInfo' |
|||
|
|||
import { APPLICATIONS_BY_DEVICE } from 'helpers/urls' |
|||
import getDeviceVersion from 'helpers/devices/getDeviceVersion' |
|||
import getCurrentFirmware from 'helpers/devices/getCurrentFirmware' |
|||
|
|||
export default async (deviceInfo: DeviceInfo) => { |
|||
try { |
|||
const deviceData = await getDeviceVersion(deviceInfo.targetId, deviceInfo.providerId) |
|||
const firmwareData = await getCurrentFirmware({ |
|||
deviceId: deviceData.id, |
|||
fullVersion: deviceInfo.fullVersion, |
|||
provider: deviceInfo.providerId, |
|||
}) |
|||
const params = { |
|||
provider: deviceInfo.providerId, |
|||
current_se_firmware_final_version: firmwareData.id, |
|||
device_version: deviceData.id, |
|||
} |
|||
const { |
|||
data: { application_versions }, |
|||
} = await network({ method: 'POST', url: APPLICATIONS_BY_DEVICE, data: params }) |
|||
return application_versions.length > 0 ? application_versions : [] |
|||
} catch (err) { |
|||
const error = Error(err.message) |
|||
error.stack = err.stack |
|||
throw err |
|||
} |
|||
} |
@ -0,0 +1,15 @@ |
|||
// @flow
|
|||
import network from 'api/network' |
|||
|
|||
import { GET_CATEGORIES } from 'helpers/urls' |
|||
|
|||
export default async () => { |
|||
try { |
|||
const { data } = await network({ method: 'GET', url: GET_CATEGORIES }) |
|||
return data.length > 0 ? data : [] |
|||
} catch (err) { |
|||
const error = Error(err.message) |
|||
error.stack = err.stack |
|||
throw err |
|||
} |
|||
} |
Loading…
Reference in new issue