diff --git a/README.md b/README.md index 4992b72..15a430f 100644 --- a/README.md +++ b/README.md @@ -1679,88 +1679,12 @@ setBiometricsAuthenticationStatus: ({enable: boolean}) => Promise; App version >= TBD -Enable/configure Family Locator SDK. Wrapper for `sdk.setConfig(config)`. +Enable/configure Family Locator SDK. Wrapper for `sdk.setConfig(config)`. See +SDK type `LocatorConfig`: +https://datamob.gitbook.io/doc-locator/TQfkVhcPsZiXIvXxq8Bv/english/service#id-4.5.1-setconfig-config-locatorconfig-void ```ts -setupLocatorSdkConfig: (config: LocatorSdkConfig) => Promise; -``` - -#### Types - -```ts -export type LocatorSdkConfig = { - license: string; - sdkVersion: string; - osPlatform: string; - api: { - token: string; - certUrl?: string; - scopesUrl?: string; - tokenUrl?: string; - configUrl?: string; - groupsUrl?: string; - featuresUrl?: string; - geofencesUrl?: string; - }; - mqtt: { - clientId?: string; - broker?: string; - port?: string; - username?: string; - }; - process: { - retryPolicy?: { - maxRetries?: number; - baseDelayMs?: number; - backoffFactor?: number; - }; - offlineRetentionDays?: number; - foregroundServiceNotification?: { - title?: string; - message?: string; - }; - }; - battery?: { - events?: Array<{ - name: string; - min: number; - max: number; - interval: number; - charging: boolean; - powerMode: Array<'normal' | 'power_saver' | 'super_saver'>; - }>; - }; - motion?: { - sensitivity?: number; - }; - collect?: { - collectIntervalMillis?: number; - sendIntervalMillis?: number; - minDisplacementMeters?: number; - maxTravelDistanceMeters?: number; - highAccuracy?: boolean; - maxBatchSize?: number; - }; - audioRecord?: { - recordsCount: number; - durationSeconds: number; - retryCount: number; - intervalSeconds: number; - audioServiceNotification?: { - title?: string; - message?: string; - }; - }; - revision?: number; - createdAt?: number; - updatedAt?: number; -}; -``` - -#### Example - -```ts -setupLocatorSdkConfig({license: 'xxx', sdkVersion: '2.0.1'}); +setupLocatorSdkConfig: (config: Record) => Promise; ``` #### Error cases @@ -1865,7 +1789,7 @@ Get current SDK config. Wrapper for `getConfig`. See SDK type `LocatorConfig`: https://datamob.gitbook.io/doc-locator/TQfkVhcPsZiXIvXxq8Bv/english/service#id-4.4.1-getconfig-locatorconfig ```ts -getLocatorSdkConfig: () => Promise<{config: LocatorSdkConfig | null}>; +getLocatorSdkConfig: () => Promise<{config: Record | null}>; ``` ### requestPermissionLocation diff --git a/index.ts b/index.ts index 570ab6f..ed6e2b5 100644 --- a/index.ts +++ b/index.ts @@ -146,7 +146,6 @@ export { export { type LocatorSdkMode, - type LocatorSdkConfig, setupLocatorSdkConfig, getLocatorSdkState, setLocatorSdkMode, diff --git a/src/family-locator.ts b/src/family-locator.ts index c9fddf3..7ce4eae 100644 --- a/src/family-locator.ts +++ b/src/family-locator.ts @@ -4,76 +4,8 @@ import {postMessageToNativeApp} from './post-message'; export type LocatorSdkMode = string; -export type LocatorSdkConfig = { - license: string; - sdkVersion: string; - osPlatform: string; - api: { - token: string; - certUrl?: string; - scopesUrl?: string; - tokenUrl?: string; - configUrl?: string; - groupsUrl?: string; - featuresUrl?: string; - geofencesUrl?: string; - }; - mqtt: { - clientId?: string; - broker?: string; - port?: string; - username?: string; - }; - process: { - retryPolicy?: { - maxRetries?: number; - baseDelayMs?: number; - backoffFactor?: number; - }; - offlineRetentionDays?: number; - foregroundServiceNotification?: { - title?: string; - message?: string; - }; - }; - battery?: { - events?: Array<{ - name: string; - min: number; - max: number; - interval: number; - charging: boolean; - powerMode: Array<'normal' | 'power_saver' | 'super_saver'>; - }>; - }; - motion?: { - sensitivity?: number; - }; - collect?: { - collectIntervalMillis?: number; - sendIntervalMillis?: number; - minDisplacementMeters?: number; - maxTravelDistanceMeters?: number; - highAccuracy?: boolean; - maxBatchSize?: number; - }; - audioRecord?: { - recordsCount: number; - durationSeconds: number; - retryCount: number; - intervalSeconds: number; - audioServiceNotification?: { - title?: string; - message?: string; - }; - }; - revision?: number; - createdAt?: number; - updatedAt?: number; -}; - export const setupLocatorSdkConfig = ( - config: LocatorSdkConfig, + config: Record, ): Promise => postMessageToNativeApp({ type: 'SETUP_LOCATOR_SDK_CONFIG', @@ -116,7 +48,7 @@ export const getLocatorSdkMode = (): Promise<{ }> => postMessageToNativeApp({type: 'GET_LOCATOR_SDK_MODE'}); export const getLocatorSdkConfig = (): Promise<{ - config: LocatorSdkConfig | null; + config: Record | null; }> => postMessageToNativeApp({ type: 'GET_LOCATOR_SDK_CONFIG', diff --git a/src/post-message.ts b/src/post-message.ts index 4554eb4..6b85e30 100644 --- a/src/post-message.ts +++ b/src/post-message.ts @@ -1,5 +1,4 @@ import {getId} from './message-id'; -import type {LocatorSdkConfig} from './family-locator'; /** * There are two possible kind of messages we can receive from native app: @@ -544,7 +543,7 @@ export type ResponsesFromNativeApp = { GET_LOCATOR_SDK_CONFIG: { type: 'GET_LOCATOR_SDK_CONFIG'; id: string; - payload: {config: LocatorSdkConfig | null}; + payload: {config: Record | null}; }; REQUEST_ALLOWME_BIOMETRICS: {