react-native-rook-sdk 4.0.0 → 5.0.0-beta.0
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/LICENSE +1 -1
- package/README.md +35 -3
- package/RNRookSdk.podspec +22 -0
- package/android/build.gradle +21 -40
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/rooksdk/RookSdkModule.kt +1709 -117
- package/android/src/main/java/com/rooksdk/RookSdkPackage.kt +26 -42
- package/android/src/main/java/com/rooksdk/broadcasts/AndroidPermissionsReceiverTransmitter.kt +34 -37
- package/android/src/main/java/com/rooksdk/broadcasts/HealthConnectPermissionsReceiverTransmitter.kt +8 -14
- package/android/src/main/java/com/rooksdk/broadcasts/SamsungHealthPermissionsReceiverTransmitter.kt +8 -16
- package/android/src/main/java/com/rooksdk/utils/{DatasourcesUtils.kt → DatasourceUtils.kt} +10 -9
- package/android/src/main/java/com/rooksdk/utils/{PermissionConversion.kt → PermissionConvertions.kt} +1 -1
- package/android/src/main/java/com/rooksdk/utils/ReadableToWritable.kt +0 -1
- package/android/src/main/java/com/rooksdk/utils/RookGsonBuilder.kt +3 -0
- package/android/src/main/java/com/rooksdk/utils/SamsungAvailability.kt +1 -0
- package/android/src/main/java/com/rooksdk/utils/serializers/InstantSerializer.kt +0 -1
- package/android/src/main/java/com/rooksdk/utils/serializers/ZoneDateTimeSerializer.kt +18 -0
- package/ios/DateHelper.swift +4 -4
- package/ios/Encodable.swift +25 -0
- package/ios/EncodableDataSource.swift +2 -3
- package/ios/EncodableDataSourceAuthorizer.swift +2 -3
- package/ios/EncodableSDKState.swift +3 -2
- package/ios/{EncodableHeartRate.swift → HearRateMapper.swift} +3 -3
- package/ios/NutritionMapper.swift +3 -3
- package/ios/RookBackground.swift +5 -8
- package/ios/RookConfiguration.swift +33 -30
- package/ios/{RookLocalData.swift → RookData.swift} +76 -69
- package/ios/RookEntry.swift +62 -0
- package/ios/RookPermissions.swift +36 -40
- package/ios/RookSdk-Bridging-Header.h +12 -0
- package/ios/RookSdk.h +3 -3
- package/ios/RookSdk.mm +390 -134
- package/ios/RookSources.swift +60 -54
- package/ios/RookSync.swift +48 -78
- package/ios/boost-boost_privacy-Bridging-Header.h +4 -0
- package/lib/{commonjs/types/AppleHealthPermissions.js → module/NativeRookSdk.js} +50 -6
- package/lib/module/NativeRookSdk.js.map +1 -0
- package/lib/module/context/RookSyncGateContext.js +2 -0
- package/lib/module/context/RookSyncGateContext.js.map +1 -1
- package/lib/module/context/RookSyncGateProvider.js +17 -18
- package/lib/module/context/RookSyncGateProvider.js.map +1 -1
- package/lib/module/context/RookSyncGateReducer.js +2 -0
- package/lib/module/context/RookSyncGateReducer.js.map +1 -1
- package/lib/module/context/RookSyncGateTypes.js +2 -0
- package/lib/module/hooks/useRookAPISources.js +10 -16
- package/lib/module/hooks/useRookAPISources.js.map +1 -1
- package/lib/module/hooks/useRookAndroidBackgroundSteps.js +11 -12
- package/lib/module/hooks/useRookAndroidBackgroundSteps.js.map +1 -1
- package/lib/module/hooks/useRookAppleHealth.js +9 -10
- package/lib/module/hooks/useRookAppleHealth.js.map +1 -1
- package/lib/module/hooks/useRookConfiguration.js +17 -22
- package/lib/module/hooks/useRookConfiguration.js.map +1 -1
- package/lib/module/hooks/useRookData.js +33 -38
- package/lib/module/hooks/useRookData.js.map +1 -1
- package/lib/module/hooks/useRookHealthConnect.js +9 -10
- package/lib/module/hooks/useRookHealthConnect.js.map +1 -1
- package/lib/module/hooks/useRookPermissions.js +34 -45
- package/lib/module/hooks/useRookPermissions.js.map +1 -1
- package/lib/module/hooks/useRookSamsungHealth.js +8 -20
- package/lib/module/hooks/useRookSamsungHealth.js.map +1 -1
- package/lib/module/hooks/useRookSync.js +23 -32
- package/lib/module/hooks/useRookSync.js.map +1 -1
- package/lib/module/hooks/useRookVariables.js +26 -29
- package/lib/module/hooks/useRookVariables.js.map +1 -1
- package/lib/module/index.js +18 -10
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/components/RookStateManager.js +31 -0
- package/lib/module/modules/components/RookStateManager.js.map +1 -0
- package/lib/module/modules/hook/useRookAutoSync.js +24 -36
- package/lib/module/modules/hook/useRookAutoSync.js.map +1 -1
- package/lib/module/modules/hook/useRookEmitter.js +61 -0
- package/lib/module/modules/hook/useRookEmitter.js.map +1 -0
- package/lib/module/modules/types/sendMessageBroadcast.js +1 -1
- package/lib/module/modules/utils/errors.js +2 -0
- package/lib/module/modules/utils/errors.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types/ActivityEvent.js +2 -0
- package/lib/module/types/AppleHealthNutritionEvent.js +2 -0
- package/lib/module/types/AppleHealthNutritionEvent.js.map +1 -1
- package/lib/module/types/AppleHealthPermissions.js +2 -0
- package/lib/module/types/AppleHealthPermissions.js.map +1 -1
- package/lib/module/types/AuthorizedSources.js +2 -0
- package/lib/module/types/BodySummary.js +2 -0
- package/lib/module/types/DataSource.js +2 -0
- package/lib/module/types/DataSource.js.map +1 -1
- package/lib/module/types/HCMealData.js +3 -1
- package/lib/module/types/HCMealData.js.map +1 -1
- package/lib/module/types/HeartRateEvent.js +1 -1
- package/lib/module/types/PermissionsType.js +1 -1
- package/lib/module/types/PhysicalSummary.js +2 -0
- package/lib/module/types/Rook.js +2 -0
- package/lib/{commonjs/types/BodySummary.js.map → module/types/Rook.js.map} +1 -1
- package/lib/module/types/SDKSources.js +2 -0
- package/lib/module/types/SDKSources.js.map +1 -1
- package/lib/module/types/SamsungHealthPermissions.js +3 -0
- package/lib/module/types/SamsungHealthPermissions.js.map +1 -1
- package/lib/module/types/SleepSummary.js +2 -0
- package/lib/module/types/SummaryTypes.js +1 -1
- package/lib/module/types/SyncTypes.js +2 -0
- package/lib/module/types/SyncTypes.js.map +1 -1
- package/lib/module/types/WriteNutrition.js +2 -0
- package/lib/module/types/WriteNutrition.js.map +1 -1
- package/lib/module/utils/isModuleReady.js +2 -0
- package/lib/module/utils/isModuleReady.js.map +1 -1
- package/lib/module/utils/isRunningOnAndroid.js +2 -0
- package/lib/module/utils/isRunningOnAndroid.js.map +1 -1
- package/lib/module/utils/isRunningOniOS.js +2 -0
- package/lib/module/utils/isRunningOniOS.js.map +1 -1
- package/lib/module/utils/isValidDate.js +2 -0
- package/lib/module/utils/isValidDate.js.map +1 -1
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeRookSdk.d.ts +705 -0
- package/lib/typescript/src/NativeRookSdk.d.ts.map +1 -0
- package/lib/typescript/src/context/RookSyncGateContext.d.ts.map +1 -1
- package/lib/typescript/src/context/RookSyncGateProvider.d.ts.map +1 -1
- package/lib/typescript/src/context/RookSyncGateReducer.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookAPISources.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookAndroidBackgroundSteps.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookAppleHealth.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookConfiguration.d.ts +1 -1
- package/lib/typescript/src/hooks/useRookConfiguration.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookData.d.ts +1 -1
- package/lib/typescript/src/hooks/useRookData.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookHealthConnect.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookPermissions.d.ts +1 -1
- package/lib/typescript/src/hooks/useRookPermissions.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookSamsungHealth.d.ts +0 -6
- package/lib/typescript/src/hooks/useRookSamsungHealth.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookSync.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookVariables.d.ts +1 -1
- package/lib/typescript/src/hooks/useRookVariables.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +17 -8
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/modules/components/RookStateManager.d.ts +10 -0
- package/lib/typescript/src/modules/components/RookStateManager.d.ts.map +1 -0
- package/lib/typescript/src/modules/hook/useRookAutoSync.d.ts.map +1 -1
- package/lib/typescript/src/modules/hook/useRookEmitter.d.ts +4 -0
- package/lib/typescript/src/modules/hook/useRookEmitter.d.ts.map +1 -0
- package/lib/typescript/src/types/AppleHealthNutritionEvent.d.ts.map +1 -1
- package/lib/typescript/src/types/AuthorizedSources.d.ts +11 -0
- package/lib/typescript/src/types/AuthorizedSources.d.ts.map +1 -1
- package/lib/typescript/src/types/HCMealData.d.ts.map +1 -1
- package/lib/typescript/src/types/HeartRateEvent.d.ts +2 -2
- package/lib/typescript/src/types/HeartRateEvent.d.ts.map +1 -1
- package/lib/typescript/src/types/Rook.d.ts +9 -0
- package/lib/typescript/src/types/Rook.d.ts.map +1 -0
- package/lib/typescript/src/types/SamsungHealthPermissions.d.ts +1 -0
- package/lib/typescript/src/types/SamsungHealthPermissions.d.ts.map +1 -1
- package/lib/typescript/src/types/SyncTypes.d.ts +5 -1
- package/lib/typescript/src/types/SyncTypes.d.ts.map +1 -1
- package/lib/typescript/src/utils/isModuleReady.d.ts.map +1 -1
- package/lib/typescript/src/utils/isValidDate.d.ts.map +1 -1
- package/package.json +94 -98
- package/src/NativeRookSdk.ts +839 -0
- package/{lib/commonjs/context/RookSyncGateContext.js → src/context/RookSyncGateContext.ts} +10 -13
- package/src/context/RookSyncGateProvider.tsx +82 -0
- package/{lib/commonjs/context/RookSyncGateReducer.js → src/context/RookSyncGateReducer.ts} +14 -41
- package/src/context/RookSyncGateTypes.ts +40 -0
- package/{lib/commonjs/hooks/useRookAPISources.js → src/hooks/useRookAPISources.ts} +40 -36
- package/src/hooks/useRookAndroidBackgroundSteps.ts +81 -0
- package/src/hooks/useRookAppleHealth.ts +55 -0
- package/src/hooks/useRookConfiguration.ts +106 -0
- package/src/hooks/useRookData.ts +133 -0
- package/src/hooks/useRookHealthConnect.ts +59 -0
- package/src/hooks/useRookPermissions.ts +240 -0
- package/src/hooks/useRookSamsungHealth.ts +37 -0
- package/src/hooks/useRookSync.ts +157 -0
- package/src/hooks/useRookVariables.ts +98 -0
- package/src/index.tsx +28 -0
- package/src/modules/components/RookStateManager.tsx +41 -0
- package/{lib/commonjs/modules/hook/useRookAutoSync.js → src/modules/hook/useRookAutoSync.ts} +141 -95
- package/src/modules/hook/useRookEmitter.ts +94 -0
- package/src/modules/types/sendMessageBroadcast.ts +5 -0
- package/src/modules/utils/errors.ts +9 -0
- package/src/types/ActivityEvent.ts +159 -0
- package/src/types/AppleHealthNutritionEvent.ts +142 -0
- package/src/types/AppleHealthPermissions.ts +49 -0
- package/src/types/AuthorizedSources.ts +33 -0
- package/src/types/BodySummary.ts +116 -0
- package/src/types/DataSource.ts +16 -0
- package/{lib/commonjs/types/HCMealData.js → src/types/HCMealData.ts} +60 -11
- package/src/types/HeartRateEvent.ts +26 -0
- package/src/types/PermissionsType.ts +9 -0
- package/src/types/PhysicalSummary.ts +84 -0
- package/src/types/Rook.ts +8 -0
- package/src/types/SDKSources.ts +5 -0
- package/src/types/SamsungHealthPermissions.ts +16 -0
- package/src/types/SleepSummary.ts +66 -0
- package/src/types/SummaryTypes.ts +70 -0
- package/src/types/SyncTypes.ts +63 -0
- package/src/types/WriteNutrition.ts +66 -0
- package/{lib/commonjs/utils/isModuleReady.js → src/utils/isModuleReady.ts} +4 -10
- package/src/utils/isRunningOnAndroid.ts +10 -0
- package/src/utils/isRunningOniOS.ts +10 -0
- package/{lib/commonjs/utils/isValidDate.js → src/utils/isValidDate.ts} +12 -14
- package/android/src/main/AndroidManifestNew.xml +0 -36
- package/android/src/main/java/com/rooksdk/modules/RookBackgroundSyncModule.kt +0 -99
- package/android/src/main/java/com/rooksdk/modules/RookConfigurationModule.kt +0 -182
- package/android/src/main/java/com/rooksdk/modules/RookLocalData.kt +0 -301
- package/android/src/main/java/com/rooksdk/modules/RookPermissionsModule.kt +0 -359
- package/android/src/main/java/com/rooksdk/modules/RookSourcesModule.kt +0 -102
- package/android/src/main/java/com/rooksdk/modules/RookStepsModule.kt +0 -119
- package/android/src/main/java/com/rooksdk/modules/RookSyncModule.kt +0 -551
- package/android/src/main/res/drawable/ic_health_connect.xml +0 -19
- package/android/src/main/res/values/themes.xml +0 -3
- package/ios/EncodableRookDataSource.swift +0 -36
- package/ios/EncodableStatusDataSources.swift +0 -47
- package/ios/RookBackgroundModule.h +0 -5
- package/ios/RookBackgroundModule.mm +0 -15
- package/ios/RookConfigurationModule.h +0 -5
- package/ios/RookConfigurationModule.mm +0 -22
- package/ios/RookExternalModule.h +0 -5
- package/ios/RookExternalModule.m +0 -31
- package/ios/RookPermissionsModule.h +0 -5
- package/ios/RookPermissionsModule.mm +0 -20
- package/ios/RookSourcesModule.h +0 -5
- package/ios/RookSourcesModule.mm +0 -18
- package/ios/RookSync.h +0 -5
- package/ios/RookSync.m +0 -35
- package/ios/SwiftTest.swift +0 -18
- package/ios/react-native-rook-sdk-Bridging-Header.h +0 -12
- package/lib/commonjs/context/RookSyncGateContext.js.map +0 -1
- package/lib/commonjs/context/RookSyncGateProvider.js +0 -108
- package/lib/commonjs/context/RookSyncGateProvider.js.map +0 -1
- package/lib/commonjs/context/RookSyncGateReducer.js.map +0 -1
- package/lib/commonjs/context/RookSyncGateTypes.js +0 -6
- package/lib/commonjs/context/RookSyncGateTypes.js.map +0 -1
- package/lib/commonjs/context/index.js +0 -14
- package/lib/commonjs/context/index.js.map +0 -1
- package/lib/commonjs/hooks/index.js +0 -76
- package/lib/commonjs/hooks/index.js.map +0 -1
- package/lib/commonjs/hooks/useRookAPISources.js.map +0 -1
- package/lib/commonjs/hooks/useRookAndroidBackgroundSteps.js +0 -88
- package/lib/commonjs/hooks/useRookAndroidBackgroundSteps.js.map +0 -1
- package/lib/commonjs/hooks/useRookAppleHealth.js +0 -63
- package/lib/commonjs/hooks/useRookAppleHealth.js.map +0 -1
- package/lib/commonjs/hooks/useRookConfiguration.js +0 -113
- package/lib/commonjs/hooks/useRookConfiguration.js.map +0 -1
- package/lib/commonjs/hooks/useRookData.js +0 -116
- package/lib/commonjs/hooks/useRookData.js.map +0 -1
- package/lib/commonjs/hooks/useRookHealthConnect.js +0 -70
- package/lib/commonjs/hooks/useRookHealthConnect.js.map +0 -1
- package/lib/commonjs/hooks/useRookPermissions.js +0 -211
- package/lib/commonjs/hooks/useRookPermissions.js.map +0 -1
- package/lib/commonjs/hooks/useRookSamsungHealth.js +0 -54
- package/lib/commonjs/hooks/useRookSamsungHealth.js.map +0 -1
- package/lib/commonjs/hooks/useRookSync.js +0 -148
- package/lib/commonjs/hooks/useRookSync.js.map +0 -1
- package/lib/commonjs/hooks/useRookVariables.js +0 -93
- package/lib/commonjs/hooks/useRookVariables.js.map +0 -1
- package/lib/commonjs/index.js +0 -121
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/modules/hook/useRookAutoSync.js.map +0 -1
- package/lib/commonjs/modules/types/sendMessageBroadcast.js +0 -2
- package/lib/commonjs/modules/types/sendMessageBroadcast.js.map +0 -1
- package/lib/commonjs/modules/utils/errors.js +0 -12
- package/lib/commonjs/modules/utils/errors.js.map +0 -1
- package/lib/commonjs/types/ActivityEvent.js +0 -6
- package/lib/commonjs/types/ActivityEvent.js.map +0 -1
- package/lib/commonjs/types/AppleHealthNutritionEvent.js +0 -77
- package/lib/commonjs/types/AppleHealthNutritionEvent.js.map +0 -1
- package/lib/commonjs/types/AppleHealthPermissions.js.map +0 -1
- package/lib/commonjs/types/AuthorizedSources.js +0 -6
- package/lib/commonjs/types/AuthorizedSources.js.map +0 -1
- package/lib/commonjs/types/BodySummary.js +0 -6
- package/lib/commonjs/types/DataSource.js +0 -16
- package/lib/commonjs/types/DataSource.js.map +0 -1
- package/lib/commonjs/types/DiagnosticState.js +0 -2
- package/lib/commonjs/types/DiagnosticState.js.map +0 -1
- package/lib/commonjs/types/HCMealData.js.map +0 -1
- package/lib/commonjs/types/HeartRateEvent.js +0 -2
- package/lib/commonjs/types/HeartRateEvent.js.map +0 -1
- package/lib/commonjs/types/PermissionsType.js +0 -2
- package/lib/commonjs/types/PermissionsType.js.map +0 -1
- package/lib/commonjs/types/PhysicalSummary.js +0 -6
- package/lib/commonjs/types/PhysicalSummary.js.map +0 -1
- package/lib/commonjs/types/SDKSources.js +0 -13
- package/lib/commonjs/types/SDKSources.js.map +0 -1
- package/lib/commonjs/types/SamsungHealthPermissions.js +0 -23
- package/lib/commonjs/types/SamsungHealthPermissions.js.map +0 -1
- package/lib/commonjs/types/SleepSummary.js +0 -6
- package/lib/commonjs/types/SleepSummary.js.map +0 -1
- package/lib/commonjs/types/SummaryTypes.js +0 -2
- package/lib/commonjs/types/SummaryTypes.js.map +0 -1
- package/lib/commonjs/types/SyncTypes.js +0 -33
- package/lib/commonjs/types/SyncTypes.js.map +0 -1
- package/lib/commonjs/types/WriteNutrition.js +0 -18
- package/lib/commonjs/types/WriteNutrition.js.map +0 -1
- package/lib/commonjs/utils/getNativeModule.js +0 -29
- package/lib/commonjs/utils/getNativeModule.js.map +0 -1
- package/lib/commonjs/utils/getRookModule.js +0 -28
- package/lib/commonjs/utils/getRookModule.js.map +0 -1
- package/lib/commonjs/utils/isModuleReady.js.map +0 -1
- package/lib/commonjs/utils/isRunningOnAndroid.js +0 -15
- package/lib/commonjs/utils/isRunningOnAndroid.js.map +0 -1
- package/lib/commonjs/utils/isRunningOniOS.js +0 -15
- package/lib/commonjs/utils/isRunningOniOS.js.map +0 -1
- package/lib/commonjs/utils/isValidDate.js.map +0 -1
- package/lib/commonjs/utils/nativeModules.js +0 -29
- package/lib/commonjs/utils/nativeModules.js.map +0 -1
- package/lib/commonjs/utils/packageInfo.js +0 -13
- package/lib/commonjs/utils/packageInfo.js.map +0 -1
- package/lib/module/context/index.js +0 -2
- package/lib/module/context/index.js.map +0 -1
- package/lib/module/hooks/index.js +0 -11
- package/lib/module/hooks/index.js.map +0 -1
- package/lib/module/types/DiagnosticState.js +0 -2
- package/lib/module/types/DiagnosticState.js.map +0 -1
- package/lib/module/utils/getNativeModule.js +0 -23
- package/lib/module/utils/getNativeModule.js.map +0 -1
- package/lib/module/utils/getRookModule.js +0 -22
- package/lib/module/utils/getRookModule.js.map +0 -1
- package/lib/module/utils/nativeModules.js +0 -23
- package/lib/module/utils/nativeModules.js.map +0 -1
- package/lib/module/utils/packageInfo.js +0 -7
- package/lib/module/utils/packageInfo.js.map +0 -1
- package/lib/typescript/src/context/index.d.ts +0 -2
- package/lib/typescript/src/context/index.d.ts.map +0 -1
- package/lib/typescript/src/hooks/index.d.ts +0 -11
- package/lib/typescript/src/hooks/index.d.ts.map +0 -1
- package/lib/typescript/src/types/DiagnosticState.d.ts +0 -13
- package/lib/typescript/src/types/DiagnosticState.d.ts.map +0 -1
- package/lib/typescript/src/utils/getNativeModule.d.ts +0 -10
- package/lib/typescript/src/utils/getNativeModule.d.ts.map +0 -1
- package/lib/typescript/src/utils/getRookModule.d.ts +0 -9
- package/lib/typescript/src/utils/getRookModule.d.ts.map +0 -1
- package/lib/typescript/src/utils/nativeModules.d.ts +0 -24
- package/lib/typescript/src/utils/nativeModules.d.ts.map +0 -1
- package/lib/typescript/src/utils/packageInfo.d.ts +0 -6
- package/lib/typescript/src/utils/packageInfo.d.ts.map +0 -1
- package/react-native-rook-sdk.podspec +0 -45
|
@@ -0,0 +1,839 @@
|
|
|
1
|
+
import type { TurboModule, CodegenTypes } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
|
|
4
|
+
type RookConfig = {
|
|
5
|
+
environment: string;
|
|
6
|
+
clientUUID: string;
|
|
7
|
+
secret: string;
|
|
8
|
+
bundleId?: string;
|
|
9
|
+
packageName?: string;
|
|
10
|
+
enableLogs: boolean;
|
|
11
|
+
enableBackground: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
enum APIDataSource {
|
|
15
|
+
GARMIN = 'Garmin',
|
|
16
|
+
OURA = 'Oura',
|
|
17
|
+
POLAR = 'Polar',
|
|
18
|
+
FITBIT = 'Fitbit',
|
|
19
|
+
WITHINGS = 'Withings',
|
|
20
|
+
WHOOP = 'Whoop',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type DataSourceProps = {
|
|
24
|
+
userID: string;
|
|
25
|
+
dataSource: APIDataSource;
|
|
26
|
+
redirectURL?: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type DataSourceAuthorizer = {
|
|
30
|
+
dataSource: string;
|
|
31
|
+
authorized: boolean;
|
|
32
|
+
authorizationUrl?: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type AuthorizedSource = {
|
|
36
|
+
name: string;
|
|
37
|
+
imageUrl: string;
|
|
38
|
+
authorized: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
enum SDKDataSource {
|
|
42
|
+
HEALTH_CONNECT = 'HEALTH_CONNECT',
|
|
43
|
+
SAMSUNG_HEALTH = 'SAMSUNG_HEALTH',
|
|
44
|
+
APPLE_HEALTH = 'APPLE_HEALTH',
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type RequestStatusPermissions = 'REQUEST_SENT' | 'ALREADY_GRANTED';
|
|
48
|
+
|
|
49
|
+
export type BackgroundStatus =
|
|
50
|
+
| 'UNAVAILABLE'
|
|
51
|
+
| 'PERMISSION_NOT_GRANTED'
|
|
52
|
+
| 'PERMISSION_GRANTED';
|
|
53
|
+
|
|
54
|
+
type CheckAvailabilityResponse =
|
|
55
|
+
| 'INSTALLED'
|
|
56
|
+
| 'NOT_INSTALLED'
|
|
57
|
+
| 'DISABLED'
|
|
58
|
+
| 'NOT_READY'
|
|
59
|
+
| 'OUTDATED'
|
|
60
|
+
| 'NOT_SUPPORTED';
|
|
61
|
+
|
|
62
|
+
type PermissionStatus =
|
|
63
|
+
| 'PERMISSION_NOT_REQUESTED'
|
|
64
|
+
| 'PERMISSION_INDETERMINATE'
|
|
65
|
+
| 'PERMISSION_GRANTED';
|
|
66
|
+
|
|
67
|
+
enum SamsungHealthPermission {
|
|
68
|
+
ACTIVITY_SUMMARY = 'ACTIVITY_SUMMARY',
|
|
69
|
+
BODY_TEMPERATURE = 'BODY_TEMPERATURE',
|
|
70
|
+
BLOOD_GLUCOSE = 'BLOOD_GLUCOSE',
|
|
71
|
+
BLOOD_OXYGEN = 'BLOOD_OXYGEN',
|
|
72
|
+
BLOOD_PRESSURE = 'BLOOD_PRESSURE',
|
|
73
|
+
BODY_COMPOSITION = 'BODY_COMPOSITION',
|
|
74
|
+
EXERCISE = 'EXERCISE',
|
|
75
|
+
EXERCISE_LOCATION = 'EXERCISE_LOCATION',
|
|
76
|
+
FLOORS_CLIMBED = 'FLOORS_CLIMBED',
|
|
77
|
+
HEART_RATE = 'HEART_RATE',
|
|
78
|
+
NUTRITION = 'NUTRITION',
|
|
79
|
+
SLEEP = 'SLEEP',
|
|
80
|
+
STEPS = 'STEPS',
|
|
81
|
+
WATER_INTAKE = 'WATER_INTAKE',
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
enum AppleHealthPermission {
|
|
85
|
+
APPLE_EXERCISE_TIME = 'appleExerciseTime',
|
|
86
|
+
APPLE_MOVE_TIME = 'appleMoveTime',
|
|
87
|
+
APPLE_STAND_TIME = 'appleStandTime',
|
|
88
|
+
BASAL_ENERGY_BURNED = 'basalEnergyBurned',
|
|
89
|
+
ACTIVE_ENERGY_BURNED = 'activeEnergyBurned',
|
|
90
|
+
STEP_COUNT = 'stepCount',
|
|
91
|
+
DISTANCE_CYCLING = 'distanceCycling',
|
|
92
|
+
DISTANCE_WALKING_RUNNING = 'distanceWalkingRunning',
|
|
93
|
+
DISTANCE_SWIMMING = 'distanceSwimming',
|
|
94
|
+
SWIMMING_STROKE_COUNT = 'swimmingStrokeCount',
|
|
95
|
+
FLIGHTS_CLIMBED = 'flightsClimbed',
|
|
96
|
+
WALKING_SPEED = 'walkingSpeed',
|
|
97
|
+
WALKING_STEP_LENGTH = 'walkingStepLength',
|
|
98
|
+
RUNNING_POWER = 'runningPower',
|
|
99
|
+
RUNNING_SPEED = 'runningSpeed',
|
|
100
|
+
HEIGHT = 'height',
|
|
101
|
+
BODY_MASS = 'bodyMass',
|
|
102
|
+
BODY_MASS_INDEX = 'bodyMassIndex',
|
|
103
|
+
WAIST_CIRCUMFERENCE = 'waistCircumference',
|
|
104
|
+
BODY_FAT_PERCENTAGE = 'bodyFatPercentage',
|
|
105
|
+
BODY_TEMPERATURE = 'bodyTemperature',
|
|
106
|
+
BASAL_BODY_TEMPERATURE = 'basalBodyTemperature',
|
|
107
|
+
APPLE_SLEEPING_WRIST_TEMPERATURE = 'appleSleepingWristTemperature',
|
|
108
|
+
HEART_RATE = 'heartRate',
|
|
109
|
+
RESTING_HEART_RATE = 'restingHeartRate',
|
|
110
|
+
WALKING_HEART_RATE_AVERAGE = 'walkingHeartRateAverage',
|
|
111
|
+
HEART_RATE_VARIABILITY_SDNN = 'heartRateVariabilitySDNN',
|
|
112
|
+
ELECTROCARDIOGRAM = 'electrocardiogram',
|
|
113
|
+
WORKOUT = 'workout',
|
|
114
|
+
SLEEP_ANALYSIS = 'sleepAnalysis',
|
|
115
|
+
VO2_MAX = 'vo2Max',
|
|
116
|
+
OXYGEN_SATURATION = 'oxygenSaturation',
|
|
117
|
+
RESPIRATORY_RATE = 'respiratoryRate',
|
|
118
|
+
UV_EXPOSURE = 'uvExposure',
|
|
119
|
+
BIOLOGICAL_SEX = 'biologicalSex',
|
|
120
|
+
DATE_OF_BIRTH = 'dateOfBirth',
|
|
121
|
+
BLOOD_PRESSURE_SYSTOLIC = 'bloodPressureSystolic',
|
|
122
|
+
BLOOD_PRESSURE_DIASTOLIC = 'bloodPressureDiastolic',
|
|
123
|
+
BLOOD_GLUCOSE = 'bloodGlucose',
|
|
124
|
+
DIETARY_ENERGY_CONSUMED = 'dietaryEnergyConsumed',
|
|
125
|
+
DIETARY_PROTEIN = 'dietaryProtein',
|
|
126
|
+
DIETARY_SUGAR = 'dietarySugar',
|
|
127
|
+
DIETARY_FAT_TOTAL = 'dietaryFatTotal',
|
|
128
|
+
DIETARY_CARBOHYDRATES = 'dietaryCarbohydrates',
|
|
129
|
+
DIETARY_FIBER = 'dietaryFiber',
|
|
130
|
+
DIETARY_SODIUM = 'dietarySodium',
|
|
131
|
+
DIETARY_CHOLESTEROL = 'dietaryCholesterol',
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
type Calories = {
|
|
135
|
+
active: number;
|
|
136
|
+
basal: number;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
type RookError = {
|
|
140
|
+
code: string;
|
|
141
|
+
message: string;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
type Message = {
|
|
145
|
+
type: string;
|
|
146
|
+
value: boolean;
|
|
147
|
+
message?: string;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export type DiagnosticsPermissionStatus = 'REQUESTED' | 'GRANTED' | 'NONE';
|
|
151
|
+
|
|
152
|
+
export interface SyncStatus {
|
|
153
|
+
enabled: boolean;
|
|
154
|
+
lastSync: string; // Or Date, if you plan to hydrate the string into a Date object
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface DiagnosticState {
|
|
158
|
+
isConfigured: boolean;
|
|
159
|
+
userIdentified: boolean;
|
|
160
|
+
permissions: DiagnosticsPermissionStatus;
|
|
161
|
+
backgroundSync: SyncStatus;
|
|
162
|
+
manualSync: SyncStatus;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export enum MealDataType {
|
|
166
|
+
BREAKFAST = 'BREAKFAST',
|
|
167
|
+
LUNCH = 'LUNCH',
|
|
168
|
+
DINNER = 'DINNER',
|
|
169
|
+
SNACK = 'SNACK',
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface WriteNutrition {
|
|
173
|
+
// Metadata
|
|
174
|
+
name: string;
|
|
175
|
+
date: string; // Must be ISO-8601
|
|
176
|
+
mealType?: MealDataType;
|
|
177
|
+
|
|
178
|
+
// Apple Health specific root values
|
|
179
|
+
amount?: number;
|
|
180
|
+
unit?: number;
|
|
181
|
+
|
|
182
|
+
// Unified Nutrients (Flat list)
|
|
183
|
+
biotin?: number;
|
|
184
|
+
caffeine?: number;
|
|
185
|
+
calcium?: number;
|
|
186
|
+
calories?: number;
|
|
187
|
+
caloriesFromFat?: number;
|
|
188
|
+
chloride?: number;
|
|
189
|
+
cholesterol?: number;
|
|
190
|
+
chromium?: number;
|
|
191
|
+
copper?: number;
|
|
192
|
+
dietaryFiber?: number;
|
|
193
|
+
folate?: number;
|
|
194
|
+
folicAcid?: number;
|
|
195
|
+
iodine?: number;
|
|
196
|
+
iron?: number;
|
|
197
|
+
magnesium?: number;
|
|
198
|
+
manganese?: number;
|
|
199
|
+
molybdenum?: number;
|
|
200
|
+
monounsaturatedFat?: number;
|
|
201
|
+
niacin?: number;
|
|
202
|
+
pantothenicAcid?: number;
|
|
203
|
+
phosphorus?: number;
|
|
204
|
+
polyunsaturatedFat?: number;
|
|
205
|
+
potassium?: number;
|
|
206
|
+
protein?: number;
|
|
207
|
+
riboflavin?: number;
|
|
208
|
+
saturatedFat?: number;
|
|
209
|
+
selenium?: number;
|
|
210
|
+
sodium?: number;
|
|
211
|
+
sugar?: number;
|
|
212
|
+
thiamin?: number;
|
|
213
|
+
totalCarbohydrates?: number;
|
|
214
|
+
totalFat?: number;
|
|
215
|
+
transFat?: number;
|
|
216
|
+
unsaturatedFat?: number;
|
|
217
|
+
vitaminA?: number;
|
|
218
|
+
vitaminB12?: number;
|
|
219
|
+
vitaminB6?: number;
|
|
220
|
+
vitaminC?: number;
|
|
221
|
+
vitaminD?: number;
|
|
222
|
+
vitaminE?: number;
|
|
223
|
+
vitaminK?: number;
|
|
224
|
+
water?: number; // iOS specific
|
|
225
|
+
zinc?: number;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface ActivityLevelGranularData {
|
|
229
|
+
dateTime: string;
|
|
230
|
+
activityLevel: number;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface ElevationGranularData {
|
|
234
|
+
dateTime: string;
|
|
235
|
+
intervalDurationSeconds: number;
|
|
236
|
+
elevationChangeMeters: number;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export interface FloorsClimbedGranularData {
|
|
240
|
+
dateTime: string;
|
|
241
|
+
intervalDurationSeconds: number;
|
|
242
|
+
floorsClimbed: number;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface HrGranularData {
|
|
246
|
+
dateTime: string;
|
|
247
|
+
hrBpm: number;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface HrvSdnnGranularData {
|
|
251
|
+
dateTime: string;
|
|
252
|
+
hrvSdnn: number;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface HrvRmssdGranularData {
|
|
256
|
+
dateTime: string;
|
|
257
|
+
hrvRmssd: number;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface SaturationGranularData {
|
|
261
|
+
dateTime: string;
|
|
262
|
+
saturationPercentage: number;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export interface Vo2GranularData {
|
|
266
|
+
dateTime: string;
|
|
267
|
+
vo2MlPerMinPerKg: number;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export interface TemperatureObject {
|
|
271
|
+
temperatureCelsius: number;
|
|
272
|
+
measurementType: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface TemperatureGranularData {
|
|
276
|
+
dateTime: string;
|
|
277
|
+
temperatureCelsius: number;
|
|
278
|
+
measurementType: string;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface TraveledDistanceGranularData {
|
|
282
|
+
dateTime: string;
|
|
283
|
+
intervalDurationSeconds: number;
|
|
284
|
+
traveledDistanceMeters: number;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export interface StepsGranularData {
|
|
288
|
+
dateTime: string;
|
|
289
|
+
intervalDurationSeconds: number;
|
|
290
|
+
steps: number;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface SwimmingDistanceGranularData {
|
|
294
|
+
dateTime: string;
|
|
295
|
+
intervalDurationSeconds: number;
|
|
296
|
+
swimmingDistanceMeters: number;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface BreathingGranularData {
|
|
300
|
+
dateTime: string;
|
|
301
|
+
breathsPerMin: number;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export interface SnoringGranularData {
|
|
305
|
+
dateTime: string;
|
|
306
|
+
intervalDurationSeconds: number;
|
|
307
|
+
snoringEventsCount: number;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export interface SleepSummary {
|
|
311
|
+
dateTime: string;
|
|
312
|
+
sourceOfData: string;
|
|
313
|
+
wasTheUserUnderPhysicalActivity: boolean;
|
|
314
|
+
sleepStartDateTime: string;
|
|
315
|
+
sleepEndDateTime: string;
|
|
316
|
+
sleepDate: string;
|
|
317
|
+
sleepDurationSeconds: number | null;
|
|
318
|
+
timeInBedSeconds: number | null;
|
|
319
|
+
lightSleepDurationSeconds: number | null;
|
|
320
|
+
remSleepDurationSeconds: number | null;
|
|
321
|
+
deepSleepDurationSeconds: number | null;
|
|
322
|
+
timeToFallAsleepSeconds: number | null;
|
|
323
|
+
timeAwakeDuringSleepSeconds: number | null;
|
|
324
|
+
sleepQualityRating1To5Score: number | null;
|
|
325
|
+
sleepEfficiency1To100Score: number | null;
|
|
326
|
+
sleepGoalSeconds: number | null;
|
|
327
|
+
sleepContinuity1To5Score: number | null;
|
|
328
|
+
sleepContinuity1To5Rating: number | null;
|
|
329
|
+
hrMaximumBpm: number | null;
|
|
330
|
+
hrMinimumBpm: number | null;
|
|
331
|
+
hrAvgBpm: number | null;
|
|
332
|
+
hrRestingBpm: number | null;
|
|
333
|
+
hrBasalBpm: number | null;
|
|
334
|
+
hrGranularData: HrGranularData[] | null;
|
|
335
|
+
hrvAvgRmssd: number | null;
|
|
336
|
+
hrvAvgSdnn: number | null;
|
|
337
|
+
hrvSdnnGranularData: HrvSdnnGranularData[] | null;
|
|
338
|
+
hrvRmssdGranularData: HrvRmssdGranularData[] | null;
|
|
339
|
+
temperatureMinimum: TemperatureObject | null;
|
|
340
|
+
temperatureAvg: TemperatureObject | null;
|
|
341
|
+
temperatureMaximum: TemperatureObject | null;
|
|
342
|
+
temperatureGranularData: TemperatureGranularData[] | null;
|
|
343
|
+
temperatureDelta: TemperatureObject | null;
|
|
344
|
+
breathsMinimumPerMin: number | null;
|
|
345
|
+
breathsAvgPerMin: number | null;
|
|
346
|
+
breathsMaximumPerMin: number | null;
|
|
347
|
+
breathingGranularData: BreathingGranularData[] | null;
|
|
348
|
+
snoringEventsCount: number | null;
|
|
349
|
+
snoringDurationTotalSeconds: number | null;
|
|
350
|
+
snoringGranularData: SnoringGranularData[] | null;
|
|
351
|
+
saturationAvgPercentage: number | null;
|
|
352
|
+
saturationMinimumPercentage: number | null;
|
|
353
|
+
saturationMaximumPercentage: number | null;
|
|
354
|
+
saturationGranularData: SaturationGranularData[] | null;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export interface ActiveStepsGranularData {
|
|
358
|
+
dateTime: string;
|
|
359
|
+
intervalDurationSeconds: number;
|
|
360
|
+
activeSteps: number;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export interface StressGranularData {
|
|
364
|
+
dateTime: string;
|
|
365
|
+
stressScore: number;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export interface PhysicalSummary {
|
|
369
|
+
dateTime: string;
|
|
370
|
+
sourceOfData: string;
|
|
371
|
+
wasTheUserUnderPhysicalActivity: boolean;
|
|
372
|
+
activeSeconds: number | null;
|
|
373
|
+
restSeconds: number | null;
|
|
374
|
+
lowIntensitySeconds: number | null;
|
|
375
|
+
moderateIntensitySeconds: number | null;
|
|
376
|
+
vigorousIntensitySeconds: number | null;
|
|
377
|
+
inactivitySeconds: number | null;
|
|
378
|
+
activityLevelGranularData: ActivityLevelGranularData[] | null;
|
|
379
|
+
continuousInactivePeriods: number | null;
|
|
380
|
+
caloriesNetIntakeKcal: number | null;
|
|
381
|
+
caloriesExpenditureKcal: number | null;
|
|
382
|
+
caloriesNetActiveKcal: number | null;
|
|
383
|
+
caloriesBasalMetabolicRateKcal: number | null;
|
|
384
|
+
steps: number | null;
|
|
385
|
+
stepsGranularData: StepsGranularData[] | null;
|
|
386
|
+
activeSteps: number | null;
|
|
387
|
+
activeStepsGranularData: ActiveStepsGranularData[] | null;
|
|
388
|
+
walkedDistanceMeters: number | null;
|
|
389
|
+
traveledDistanceMeters: number | null;
|
|
390
|
+
traveledDistanceGranularData: TraveledDistanceGranularData[] | null;
|
|
391
|
+
floorsClimbed: number | null;
|
|
392
|
+
floorsClimbedGranularData: FloorsClimbedGranularData[] | null;
|
|
393
|
+
elevationAvgAltitudeMeters: number | null;
|
|
394
|
+
elevationMinimumAltitudeMeters: number | null;
|
|
395
|
+
elevationMaximumAltitudeMeters: number | null;
|
|
396
|
+
elevationLossActualAltitudeMeters: number | null;
|
|
397
|
+
elevationGainActualAltitudeMeters: number | null;
|
|
398
|
+
elevationPlannedGainMeters: number | null;
|
|
399
|
+
elevationGranularData: ElevationGranularData[] | null;
|
|
400
|
+
swimmingNumStrokes: number | null;
|
|
401
|
+
swimmingNumLaps: number | null;
|
|
402
|
+
swimmingPoolLengthMeters: number | null;
|
|
403
|
+
swimmingTotalDistanceMeters: number | null;
|
|
404
|
+
swimmingDistanceGranularData: SwimmingDistanceGranularData[] | null;
|
|
405
|
+
hrMaximumBpm: number | null;
|
|
406
|
+
hrMinimumBpm: number | null;
|
|
407
|
+
hrAvgBpm: number | null;
|
|
408
|
+
hrRestingBpm: number | null;
|
|
409
|
+
hrGranularData: HrGranularData[] | null;
|
|
410
|
+
hrvAvgRmssd: number | null;
|
|
411
|
+
hrvAvgSdnn: number | null;
|
|
412
|
+
hrvSdnnGranularData: HrvSdnnGranularData[] | null;
|
|
413
|
+
hrvRmssdGranularData: HrvRmssdGranularData[] | null;
|
|
414
|
+
saturationAvgPercentage: number | null;
|
|
415
|
+
saturationGranularData: SaturationGranularData[] | null;
|
|
416
|
+
vo2MaxMlPerMinPerKg: number | null;
|
|
417
|
+
vo2GranularData: Vo2GranularData[] | null;
|
|
418
|
+
stressAtRestDurationSeconds: number | null;
|
|
419
|
+
stressDurationSeconds: number | null;
|
|
420
|
+
lowStressDurationSeconds: number | null;
|
|
421
|
+
mediumStressDurationSeconds: number | null;
|
|
422
|
+
highStressDurationSeconds: number | null;
|
|
423
|
+
stressGranularData: StressGranularData[] | null;
|
|
424
|
+
stressAvgLevel: number | null;
|
|
425
|
+
stressMaximumLevel: number | null;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export interface BloodGlucoseGranularData {
|
|
429
|
+
dateTime: string;
|
|
430
|
+
bloodGlucoseMgPerDl: number;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export interface BloodPressureObject {
|
|
434
|
+
systolicMmHg: number;
|
|
435
|
+
diastolicMmHg: number;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export interface BloodPressureGranularData {
|
|
439
|
+
dateTime: string;
|
|
440
|
+
systolicMmHg: number;
|
|
441
|
+
diastolicMmHg: number;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export interface HydrationAmountGranularData {
|
|
445
|
+
dateTime: string;
|
|
446
|
+
intervalDurationSeconds: number;
|
|
447
|
+
hydrationAmountMl: number;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export interface HydrationLevelGranularData {
|
|
451
|
+
dateTime: string;
|
|
452
|
+
intervalDurationSeconds: number;
|
|
453
|
+
hydrationLevelPercentage: number;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export interface MoodGranularData {
|
|
457
|
+
dateTime: string;
|
|
458
|
+
intervalDurationSeconds: number;
|
|
459
|
+
moodScale: number;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export interface MenstruationFlowGranularData {
|
|
463
|
+
dateTime: string;
|
|
464
|
+
flowMl: number;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// --- Interfaz SHBodySummary Completa ---
|
|
468
|
+
export interface BodySummary {
|
|
469
|
+
dateTime: string;
|
|
470
|
+
sourceOfData: string;
|
|
471
|
+
wasTheUserUnderPhysicalActivity: boolean;
|
|
472
|
+
waistCircumferenceCm: number | null;
|
|
473
|
+
hipCircumferenceCm: number | null;
|
|
474
|
+
chestCircumferenceCm: number | null;
|
|
475
|
+
boneCompositionPercentage: number | null;
|
|
476
|
+
muscleCompositionPercentage: number | null;
|
|
477
|
+
waterCompositionPercentage: number | null;
|
|
478
|
+
weightKg: number | null;
|
|
479
|
+
heightCm: number | null;
|
|
480
|
+
bmi: number | null;
|
|
481
|
+
bloodGlucoseAvgMgPerDl: number | null;
|
|
482
|
+
bloodGlucoseGranularData: BloodGlucoseGranularData[] | null;
|
|
483
|
+
bloodPressureAvg: BloodPressureObject | null;
|
|
484
|
+
bloodPressureGranularData: BloodPressureGranularData[] | null;
|
|
485
|
+
waterTotalConsumptionMl: number | null;
|
|
486
|
+
hydrationAmountGranularData: HydrationAmountGranularData[] | null;
|
|
487
|
+
hydrationLevelGranularData: HydrationLevelGranularData[] | null;
|
|
488
|
+
hrMaximumBpm: number | null;
|
|
489
|
+
hrMinimumBpm: number | null;
|
|
490
|
+
hrAvgBpm: number | null;
|
|
491
|
+
hrRestingBpm: number | null;
|
|
492
|
+
hrGranularData: HrGranularData[] | null;
|
|
493
|
+
hrvAvgRmssd: number | null;
|
|
494
|
+
hrvAvgSdnn: number | null;
|
|
495
|
+
hrvSdnnGranularData: HrvSdnnGranularData[] | null;
|
|
496
|
+
hrvRmssdGranularData: HrvRmssdGranularData[] | null;
|
|
497
|
+
moodMinimumScale: number | null;
|
|
498
|
+
moodAvgScale: number | null;
|
|
499
|
+
moodMaximumScale: number | null;
|
|
500
|
+
moodGranularData: MoodGranularData[] | null;
|
|
501
|
+
moodDeltaScale: number | null;
|
|
502
|
+
foodIntake: number | null;
|
|
503
|
+
caloriesIntakeKcal: number | null;
|
|
504
|
+
proteinIntakeG: number | null;
|
|
505
|
+
sugarIntakeG: number | null;
|
|
506
|
+
fatIntakeG: number | null;
|
|
507
|
+
transFatIntakeG: number | null;
|
|
508
|
+
carbohydratesIntakeG: number | null;
|
|
509
|
+
fiberIntakeG: number | null;
|
|
510
|
+
alcoholIntakeG: number | null;
|
|
511
|
+
sodiumIntakeMg: number | null;
|
|
512
|
+
cholesterolIntakeMg: number | null;
|
|
513
|
+
saturationAvgPercentage: number | null;
|
|
514
|
+
saturationGranularData: SaturationGranularData[] | null;
|
|
515
|
+
vo2MaxMlPerMinPerKg: number | null;
|
|
516
|
+
vo2GranularData: Vo2GranularData[] | null;
|
|
517
|
+
temperatureMinimum: TemperatureObject | null;
|
|
518
|
+
temperatureAvg: TemperatureObject | null;
|
|
519
|
+
temperatureMaximum: TemperatureObject | null;
|
|
520
|
+
temperatureGranularData: TemperatureGranularData[] | null;
|
|
521
|
+
temperatureDelta: TemperatureObject | null;
|
|
522
|
+
lastUpdatedDatetime: string | null;
|
|
523
|
+
periodStartDate: string | null;
|
|
524
|
+
cycleDay: number | null;
|
|
525
|
+
cycleLengthDays: number | null;
|
|
526
|
+
predictedCycleLengthDays: number | null;
|
|
527
|
+
currentPhase: string | null;
|
|
528
|
+
lengthOfCurrentPhaseDays: number | null;
|
|
529
|
+
daysUntilNextPhase: number | null;
|
|
530
|
+
isAPredictedCycle: boolean | null;
|
|
531
|
+
menstruationFlowGranularData: MenstruationFlowGranularData[] | null;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export interface SpeedGranularData {
|
|
535
|
+
dateTime: string;
|
|
536
|
+
intervalDurationSeconds: number;
|
|
537
|
+
speedMetersPerSecond: number;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
export interface VelocityObject {
|
|
541
|
+
speedMetersPerSecond: number;
|
|
542
|
+
direction: string;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export interface CadenceGranularData {
|
|
546
|
+
dateTime: string;
|
|
547
|
+
intervalDurationSeconds: number;
|
|
548
|
+
cadenceRpm: number;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export interface TorqueGranularData {
|
|
552
|
+
dateTime: string;
|
|
553
|
+
intervalDurationSeconds: number;
|
|
554
|
+
torqueNewtonMeters: number;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
export interface LapGranularData {
|
|
558
|
+
dateTime: string;
|
|
559
|
+
intervalDurationSeconds: number;
|
|
560
|
+
laps: number;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
export interface PositionObject {
|
|
564
|
+
latDeg: number;
|
|
565
|
+
lngDeg: number;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export interface PositionGranularData {
|
|
569
|
+
dateTime: string;
|
|
570
|
+
intervalDurationSeconds: number;
|
|
571
|
+
latDeg: number;
|
|
572
|
+
lngDeg: number;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
export interface PowerGranularData {
|
|
576
|
+
dateTime: string;
|
|
577
|
+
intervalDurationSeconds: number;
|
|
578
|
+
powerWatts: number;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export interface TssGranularData {
|
|
582
|
+
dateTime: string;
|
|
583
|
+
intervalDurationSeconds: number;
|
|
584
|
+
tssScore: number;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// --- Interfaz SHActivityEvent Completa ---
|
|
588
|
+
export interface ActivityEvent {
|
|
589
|
+
dateTime: string;
|
|
590
|
+
sourceOfData: string;
|
|
591
|
+
wasTheUserUnderPhysicalActivity: boolean;
|
|
592
|
+
activityStartDateTime: string;
|
|
593
|
+
activityEndDateTime: string;
|
|
594
|
+
activityDurationSeconds: number;
|
|
595
|
+
activityTypeName: string;
|
|
596
|
+
activeSeconds: number | null;
|
|
597
|
+
restSeconds: number | null;
|
|
598
|
+
lowIntensitySeconds: number | null;
|
|
599
|
+
moderateIntensitySeconds: number | null;
|
|
600
|
+
vigorousIntensitySeconds: number | null;
|
|
601
|
+
inactivitySeconds: number | null;
|
|
602
|
+
activityLevelGranularData: ActivityLevelGranularData[] | null;
|
|
603
|
+
continuousInactivePeriods: number | null;
|
|
604
|
+
activityStrainLevel: number | null;
|
|
605
|
+
activityWorkKilojoules: number | null;
|
|
606
|
+
activityEnergyKilojoules: number | null;
|
|
607
|
+
activityEnergyPlannedKilojoules: number | null;
|
|
608
|
+
caloriesNetIntakeKcal: number | null;
|
|
609
|
+
caloriesExpenditureKcal: number | null;
|
|
610
|
+
caloriesNetActiveKcal: number | null;
|
|
611
|
+
caloriesBasalMetabolicRateKcal: number | null;
|
|
612
|
+
fatPercentageOfCalories: number | null;
|
|
613
|
+
carbohydratePercentageOfCalories: number | null;
|
|
614
|
+
proteinPercentageOfCalories: number | null;
|
|
615
|
+
steps: number | null;
|
|
616
|
+
stepsGranularData: StepsGranularData[] | null;
|
|
617
|
+
walkedDistanceMeters: number | null;
|
|
618
|
+
traveledDistanceMeters: number | null;
|
|
619
|
+
traveledDistanceGranularData: TraveledDistanceGranularData[] | null;
|
|
620
|
+
floorsClimbed: number | null;
|
|
621
|
+
floorsClimbedGranularData: FloorsClimbedGranularData[] | null;
|
|
622
|
+
elevationAvgAltitudeMeters: number | null;
|
|
623
|
+
elevationMinimumAltitudeMeters: number | null;
|
|
624
|
+
elevationMaximumAltitudeMeters: number | null;
|
|
625
|
+
elevationLossActualAltitudeMeters: number | null;
|
|
626
|
+
elevationGainActualAltitudeMeters: number | null;
|
|
627
|
+
elevationPlannedGainMeters: number | null;
|
|
628
|
+
elevationGranularData: ElevationGranularData[] | null;
|
|
629
|
+
swimmingNumStrokes: number | null;
|
|
630
|
+
swimmingNumLaps: number | null;
|
|
631
|
+
swimmingPoolLengthMeters: number | null;
|
|
632
|
+
swimmingTotalDistanceMeters: number | null;
|
|
633
|
+
swimmingDistanceGranularData: SwimmingDistanceGranularData[] | null;
|
|
634
|
+
hrMaximumBpm: number | null;
|
|
635
|
+
hrMinimumBpm: number | null;
|
|
636
|
+
hrAvgBpm: number | null;
|
|
637
|
+
hrRestingBpm: number | null;
|
|
638
|
+
hrGranularData: HrGranularData[] | null;
|
|
639
|
+
hrvAvgRmssd: number | null;
|
|
640
|
+
hrvAvgSdnn: number | null;
|
|
641
|
+
hrvSdnnGranularData: HrvSdnnGranularData[] | null;
|
|
642
|
+
hrvRmssdGranularData: HrvRmssdGranularData[] | null;
|
|
643
|
+
speedNormalizedMetersPerSecond: number | null;
|
|
644
|
+
speedAvgMetersPerSecond: number | null;
|
|
645
|
+
speedMaximumMetersPerSecond: number | null;
|
|
646
|
+
speedGranularData: SpeedGranularData[] | null;
|
|
647
|
+
velocityAvg: VelocityObject | null;
|
|
648
|
+
velocityMaximum: VelocityObject | null;
|
|
649
|
+
paceAvgMinPerKm: number | null;
|
|
650
|
+
paceMaximumMinPerKm: number | null;
|
|
651
|
+
cadenceAvgRpm: number | null;
|
|
652
|
+
cadenceMaximumRpm: number | null;
|
|
653
|
+
cadenceGranularData: CadenceGranularData[] | null;
|
|
654
|
+
torqueAvgNewtonMeters: number | null;
|
|
655
|
+
torqueMaximumNewtonMeters: number | null;
|
|
656
|
+
torqueGranularData: TorqueGranularData[] | null;
|
|
657
|
+
lapGranularData: LapGranularData[] | null;
|
|
658
|
+
saturationAvgPercentage: number | null;
|
|
659
|
+
saturationGranularData: SaturationGranularData[] | null;
|
|
660
|
+
vo2MaxMlPerMinPerKg: number | null;
|
|
661
|
+
vo2GranularData: Vo2GranularData[] | null;
|
|
662
|
+
positionStart: PositionObject | null;
|
|
663
|
+
positionCentroid: PositionObject | null;
|
|
664
|
+
positionEnd: PositionObject | null;
|
|
665
|
+
positionGranularData: PositionGranularData[] | null;
|
|
666
|
+
positionPolylineMapDataSummary: string | null;
|
|
667
|
+
powerAvgWatts: number | null;
|
|
668
|
+
powerMaximumWatts: number | null;
|
|
669
|
+
powerGranularData: PowerGranularData[] | null;
|
|
670
|
+
stressAtRestDurationSeconds: number | null;
|
|
671
|
+
stressDurationSeconds: number | null;
|
|
672
|
+
lowStressDurationSeconds: number | null;
|
|
673
|
+
mediumStressDurationSeconds: number | null;
|
|
674
|
+
highStressDurationSeconds: number | null;
|
|
675
|
+
tssGranularData: TssGranularData[] | null;
|
|
676
|
+
stressAvgLevel: number | null;
|
|
677
|
+
stressMaximumLevel: number | null;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
export interface HrGranularDataItem {
|
|
681
|
+
dateTime: string;
|
|
682
|
+
hrBPM: number;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
export interface HrvSDNNGranularData {
|
|
686
|
+
dateTime: string;
|
|
687
|
+
hrvSDNN: number;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
export interface HrvRMSSDGranularData {
|
|
691
|
+
dateTime: string;
|
|
692
|
+
hrvRmssd: number;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
export interface HeartRateData {
|
|
696
|
+
hrAverageBPM: number;
|
|
697
|
+
hrvSDNNGranularData: HrvSDNNGranularData[] | null;
|
|
698
|
+
hrGranularData: HrGranularDataItem[];
|
|
699
|
+
hrMinimumBPM: number;
|
|
700
|
+
hrRestingBPM: number | null;
|
|
701
|
+
hrMaximumBPM: number;
|
|
702
|
+
hrvAverageSDNN: number | null;
|
|
703
|
+
hrvRMSSDGranularData: HrvRMSSDGranularData[] | null;
|
|
704
|
+
hrvAverageRMSSD: number | null;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
// Mock of the full object
|
|
708
|
+
interface HCMealData {}
|
|
709
|
+
|
|
710
|
+
export interface Spec extends TurboModule {
|
|
711
|
+
initRook: (options: RookConfig) => Promise<boolean>;
|
|
712
|
+
|
|
713
|
+
// API Sources
|
|
714
|
+
revokeDataSource: (userid: string, type: APIDataSource) => Promise<boolean>;
|
|
715
|
+
getDataSourceAuthorizer: (
|
|
716
|
+
props: DataSourceProps
|
|
717
|
+
) => Promise<DataSourceAuthorizer>;
|
|
718
|
+
getAuthorizedDataSourcesV2: (userid: string) => Promise<AuthorizedSource[]>;
|
|
719
|
+
|
|
720
|
+
// Configuration
|
|
721
|
+
getUserID: () => Promise<string>;
|
|
722
|
+
updateUserID: (userID: string) => Promise<boolean>;
|
|
723
|
+
removeUserFromRook: (sources: SDKDataSource[]) => Promise<boolean>;
|
|
724
|
+
syncUserTimeZone: () => Promise<boolean>;
|
|
725
|
+
getHealthConnectDiagnosticState: () => Promise<string>;
|
|
726
|
+
getSamsungHealthDiagnosticState: () => Promise<string>;
|
|
727
|
+
getDiagnosticState: () => Promise<DiagnosticState>;
|
|
728
|
+
|
|
729
|
+
// bg android steps
|
|
730
|
+
isStepsAvailable: () => Promise<boolean>;
|
|
731
|
+
enableBackgroundAndroidSteps: () => Promise<boolean>;
|
|
732
|
+
disableBackgroundAndroidSteps: () => Promise<boolean>;
|
|
733
|
+
isBackgroundAndroidStepsActive: () => Promise<boolean>;
|
|
734
|
+
syncTodayAndroidStepsCount: () => Promise<string>;
|
|
735
|
+
|
|
736
|
+
//Apple health hook
|
|
737
|
+
enableBackGroundUpdates: () => Promise<boolean>;
|
|
738
|
+
disableBackGroundUpdates: () => Promise<boolean>;
|
|
739
|
+
isBackgroundUpdatesEnabled: () => Promise<boolean>;
|
|
740
|
+
|
|
741
|
+
// Permissions
|
|
742
|
+
androidHasBackgroundPermissions: () => Promise<boolean>;
|
|
743
|
+
appleHealthHasPermissions: (
|
|
744
|
+
param: AppleHealthPermission
|
|
745
|
+
) => Promise<PermissionStatus>;
|
|
746
|
+
checkHealthConnectAvailability: () => Promise<CheckAvailabilityResponse>;
|
|
747
|
+
checkHealthConnectBackgroundReadStatus: () => Promise<BackgroundStatus>;
|
|
748
|
+
checkSamsungAvailability: () => Promise<CheckAvailabilityResponse>;
|
|
749
|
+
healthConnectHasPartialPermissions: () => Promise<boolean>;
|
|
750
|
+
healthConnectHasPermissions: () => Promise<boolean>;
|
|
751
|
+
samsungHealthHasPermissions: () => Promise<boolean>;
|
|
752
|
+
samsungHealthHasPartialPermissions: () => Promise<boolean>;
|
|
753
|
+
openAppleHealthSettings: () => Promise<void>;
|
|
754
|
+
openHealthConnectSettings: () => Promise<void>;
|
|
755
|
+
requestAndroidBackgroundPermissions: () => Promise<RequestStatusPermissions>;
|
|
756
|
+
requestHealthConnectPermissions: () => Promise<RequestStatusPermissions>;
|
|
757
|
+
requestAppleHealthPermissions: (
|
|
758
|
+
permissions?: AppleHealthPermission[]
|
|
759
|
+
) => Promise<boolean>;
|
|
760
|
+
requestSamsungHealthPermissions: (
|
|
761
|
+
permissions?: SamsungHealthPermission[]
|
|
762
|
+
) => Promise<RequestStatusPermissions>;
|
|
763
|
+
requestAppleWriteNutritionPermission: () => Promise<void>;
|
|
764
|
+
revokeHealthConnectPermissions: () => Promise<boolean>;
|
|
765
|
+
shouldRequestAndroidBackgroundPermissions: () => Promise<boolean>;
|
|
766
|
+
|
|
767
|
+
// data hook
|
|
768
|
+
getAppleHealthSleepSummary: (date: string) => Promise<any[]>;
|
|
769
|
+
getHealthConnectSleepSummary: (date: string) => Promise<string>;
|
|
770
|
+
getSamsungSleepSummary: (date: string) => Promise<string>;
|
|
771
|
+
|
|
772
|
+
getAppleHealthBodySummary: (date: string) => Promise<any>;
|
|
773
|
+
getHealthConnectBodySummary: (date: string) => Promise<string>;
|
|
774
|
+
getSamsungBodySummary: (date: string) => Promise<string>;
|
|
775
|
+
|
|
776
|
+
getAppleHealthPhysicalSummary: (date: string) => Promise<any>;
|
|
777
|
+
getHealthConnectPhysicalSummary: (date: string) => Promise<string>;
|
|
778
|
+
getSamsungPhysicalSummary: (date: string) => Promise<string>;
|
|
779
|
+
|
|
780
|
+
getAppleHealthActivityEvents: (date: string) => Promise<any[]>;
|
|
781
|
+
getHealthConnectActivityEvents: (date: string) => Promise<string>;
|
|
782
|
+
getSamsungActivityEvents: (date: string) => Promise<string>;
|
|
783
|
+
|
|
784
|
+
writeHealthConnectMealData: (meal: HCMealData) => Promise<boolean>;
|
|
785
|
+
writeAppleHealthMealData: (meal: Object) => Promise<boolean>;
|
|
786
|
+
|
|
787
|
+
// samsung hook
|
|
788
|
+
enableSamsungSync: () => Promise<boolean>;
|
|
789
|
+
disableSamsungSync: () => Promise<boolean>;
|
|
790
|
+
isSamsungSyncEnabled: () => Promise<boolean>;
|
|
791
|
+
|
|
792
|
+
// health connect hook
|
|
793
|
+
scheduleBackgroundSync: (enableLogs?: boolean) => Promise<boolean>;
|
|
794
|
+
cancelBackgroundSync: () => Promise<boolean>;
|
|
795
|
+
isBackgroundSyncEnabled: () => Promise<boolean>;
|
|
796
|
+
|
|
797
|
+
// variables
|
|
798
|
+
syncTodaySamsungHealthStepsCount: () => Promise<string>;
|
|
799
|
+
getTodayAppleHealthSteps: () => Promise<string>;
|
|
800
|
+
syncTodayHealthConnectStepsCount: () => Promise<string>;
|
|
801
|
+
syncTodayCaloriesCount: () => Promise<Calories>;
|
|
802
|
+
syncSHTodayCaloriesCount: () => Promise<Calories>;
|
|
803
|
+
getTodayHeartRate: () => Promise<HeartRateData>;
|
|
804
|
+
getSHTodayHeartRate: () => Promise<HeartRateData>;
|
|
805
|
+
|
|
806
|
+
// sync
|
|
807
|
+
sync: (cb: (error: RookError, result: boolean) => void) => void;
|
|
808
|
+
syncByDate: (
|
|
809
|
+
date: string,
|
|
810
|
+
cb: (error: RookError, result: boolean) => void
|
|
811
|
+
) => void;
|
|
812
|
+
syncByDefinition: (
|
|
813
|
+
summary: string,
|
|
814
|
+
date: string,
|
|
815
|
+
cb: (error: RookError, result: boolean) => void
|
|
816
|
+
) => void;
|
|
817
|
+
syncEvent: (date: string, event: string) => Promise<any>;
|
|
818
|
+
|
|
819
|
+
shSync: (
|
|
820
|
+
enableLogs: boolean,
|
|
821
|
+
cb: (error: RookError, result: boolean) => void
|
|
822
|
+
) => void;
|
|
823
|
+
shSyncByDate: (
|
|
824
|
+
date: string,
|
|
825
|
+
cb: (error: RookError, result: boolean) => void
|
|
826
|
+
) => void;
|
|
827
|
+
shSyncByDefinition: (
|
|
828
|
+
summary: string,
|
|
829
|
+
date: string,
|
|
830
|
+
cb: (error: RookError, result: boolean) => void
|
|
831
|
+
) => void;
|
|
832
|
+
shSyncEvent: (date: string, event: string) => Promise<any>;
|
|
833
|
+
|
|
834
|
+
// Notifications
|
|
835
|
+
sendMessage: (message: Message) => Promise<boolean>;
|
|
836
|
+
readonly onRookMessage: CodegenTypes.EventEmitter<Message>;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('RNRookSdk');
|