@ovok/native 1.5.5 → 1.6.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/README.md +27 -17
- package/app.plugin.js +104 -0
- package/lib/commonjs/index.js +11 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/auth/delete-account-button/components/delete-account-button.js +2 -0
- package/lib/commonjs/modules/auth/delete-account-button/components/delete-account-button.js.map +1 -1
- package/lib/commonjs/modules/auth/hooks/use-rate-limit-cooldown.js +23 -0
- package/lib/commonjs/modules/auth/hooks/use-rate-limit-cooldown.js.map +1 -0
- package/lib/commonjs/modules/auth/hooks/use-session.js +91 -0
- package/lib/commonjs/modules/auth/hooks/use-session.js.map +1 -0
- package/lib/commonjs/modules/auth/index.js +44 -0
- package/lib/commonjs/modules/auth/index.js.map +1 -1
- package/lib/commonjs/modules/auth/logout-button/components/logout-button.js +3 -1
- package/lib/commonjs/modules/auth/logout-button/components/logout-button.js.map +1 -1
- package/lib/commonjs/modules/auth/register/components/form/inputs.js +48 -1
- package/lib/commonjs/modules/auth/register/components/form/inputs.js.map +1 -1
- package/lib/commonjs/modules/auth/register/components/form/register-button.js +4 -0
- package/lib/commonjs/modules/auth/register/components/form/register-button.js.map +1 -1
- package/lib/commonjs/modules/auth/register/components/form/register-form-provider.js +6 -0
- package/lib/commonjs/modules/auth/register/components/form/register-form-provider.js.map +1 -1
- package/lib/commonjs/modules/auth/reset-password/components/form/inputs.js +12 -0
- package/lib/commonjs/modules/auth/reset-password/components/form/inputs.js.map +1 -1
- package/lib/commonjs/modules/auth/reset-password/components/form/reset-password-button.js +4 -0
- package/lib/commonjs/modules/auth/reset-password/components/form/reset-password-button.js.map +1 -1
- package/lib/commonjs/modules/auth/reset-password/components/form/reset-password-form-provider.js +7 -1
- package/lib/commonjs/modules/auth/reset-password/components/form/reset-password-form-provider.js.map +1 -1
- package/lib/commonjs/modules/auth/session/components/session-list.js +82 -0
- package/lib/commonjs/modules/auth/session/components/session-list.js.map +1 -0
- package/lib/commonjs/modules/auth/session/events.js +19 -0
- package/lib/commonjs/modules/auth/session/events.js.map +1 -0
- package/lib/commonjs/modules/auth/session/index.js +13 -0
- package/lib/commonjs/modules/auth/session/index.js.map +1 -0
- package/lib/commonjs/modules/auth/session/types/session-list-props.js +6 -0
- package/lib/commonjs/modules/auth/session/types/session-list-props.js.map +1 -0
- package/lib/commonjs/modules/auth/sign-in/components/form/inputs.js +25 -0
- package/lib/commonjs/modules/auth/sign-in/components/form/inputs.js.map +1 -1
- package/lib/commonjs/modules/auth/sign-in/components/form/login-form-provider.js +48 -1
- package/lib/commonjs/modules/auth/sign-in/components/form/login-form-provider.js.map +1 -1
- package/lib/commonjs/modules/auth/sign-in/components/form/mfa-code-input.js +58 -0
- package/lib/commonjs/modules/auth/sign-in/components/form/mfa-code-input.js.map +1 -0
- package/lib/commonjs/modules/auth/sign-in/components/form/sign-in-with-email.js +2 -0
- package/lib/commonjs/modules/auth/sign-in/components/form/sign-in-with-email.js.map +1 -1
- package/lib/commonjs/modules/auth/sign-in/components/form/signin-button.js +13 -5
- package/lib/commonjs/modules/auth/sign-in/components/form/signin-button.js.map +1 -1
- package/lib/commonjs/modules/auth/types/session.js +2 -0
- package/lib/commonjs/modules/auth/types/session.js.map +1 -0
- package/lib/commonjs/modules/auth/utils/rate-limit.js +37 -0
- package/lib/commonjs/modules/auth/utils/rate-limit.js.map +1 -0
- package/lib/commonjs/modules/background-sync/android-bluetooth-foreground-service.js +3 -2
- package/lib/commonjs/modules/background-sync/android-bluetooth-foreground-service.js.map +1 -1
- package/lib/commonjs/modules/background-sync/background-safe-storage.js +79 -0
- package/lib/commonjs/modules/background-sync/background-safe-storage.js.map +1 -0
- package/lib/commonjs/modules/background-sync/index.js +11 -0
- package/lib/commonjs/modules/background-sync/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js +123 -21
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/runtime-context.js +91 -0
- package/lib/commonjs/modules/bt-management/hooks/runtime-context.js.map +1 -0
- package/lib/commonjs/modules/bt-management/hooks/use-background-sync.js +47 -0
- package/lib/commonjs/modules/bt-management/hooks/use-background-sync.js.map +1 -0
- package/lib/commonjs/modules/bt-management/hooks/use-bluetooth-state.js +51 -0
- package/lib/commonjs/modules/bt-management/hooks/use-bluetooth-state.js.map +1 -0
- package/lib/commonjs/modules/bt-management/hooks/use-device-connection.js +36 -0
- package/lib/commonjs/modules/bt-management/hooks/use-device-connection.js.map +1 -0
- package/lib/commonjs/modules/bt-management/hooks/use-health-import.js +46 -0
- package/lib/commonjs/modules/bt-management/hooks/use-health-import.js.map +1 -0
- package/lib/commonjs/modules/bt-management/hooks/use-measurements.js +57 -0
- package/lib/commonjs/modules/bt-management/hooks/use-measurements.js.map +1 -0
- package/lib/commonjs/modules/bt-management/hooks/use-nearby-devices.js +26 -0
- package/lib/commonjs/modules/bt-management/hooks/use-nearby-devices.js.map +1 -0
- package/lib/commonjs/modules/bt-management/hooks/use-paired-devices.js +49 -0
- package/lib/commonjs/modules/bt-management/hooks/use-paired-devices.js.map +1 -0
- package/lib/commonjs/modules/bt-management/index.js +143 -0
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/background-sync/background-sync-coordinator.js +41 -4
- package/lib/commonjs/modules/bt-management/services/background-sync/background-sync-coordinator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/bt-manager.js +75 -4
- package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js +57 -0
- package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +111 -3
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/measurement-state-machine.js +5 -3
- package/lib/commonjs/modules/bt-management/services/devices/measurement-state-machine.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/spo/spo2.main-services.js +12 -0
- package/lib/commonjs/modules/bt-management/services/devices/spo/spo2.main-services.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.js +9 -3
- package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/testing/fake-ble-manager.js +52 -0
- package/lib/commonjs/modules/bt-management/testing/fake-ble-manager.js.map +1 -0
- package/lib/commonjs/modules/bt-management/testing/index.js +28 -0
- package/lib/commonjs/modules/bt-management/testing/index.js.map +1 -0
- package/lib/commonjs/modules/bt-management/testing/recorded-frames.js +23 -0
- package/lib/commonjs/modules/bt-management/testing/recorded-frames.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/bluetooth-error.js +80 -0
- package/lib/commonjs/modules/bt-management/types/bluetooth-error.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/device-connection-event.js +6 -0
- package/lib/commonjs/modules/bt-management/types/device-connection-event.js.map +1 -0
- package/lib/commonjs/modules/bt-management/types/result-policy.js +6 -0
- package/lib/commonjs/modules/bt-management/types/result-policy.js.map +1 -0
- package/lib/commonjs/modules/bt-management/utils/result-identity.js +63 -0
- package/lib/commonjs/modules/bt-management/utils/result-identity.js.map +1 -0
- package/lib/commonjs/modules/data-sync/components/android/android-health-connect-authorization-provider.js +8 -2
- package/lib/commonjs/modules/data-sync/components/android/android-health-connect-authorization-provider.js.map +1 -1
- package/lib/commonjs/modules/data-sync/services/base-health-sync-service.js +23 -4
- package/lib/commonjs/modules/data-sync/services/base-health-sync-service.js.map +1 -1
- package/lib/commonjs/modules/data-sync/services/managers/data-processor.js +2 -2
- package/lib/commonjs/modules/data-sync/services/managers/data-processor.js.map +1 -1
- package/lib/commonjs/modules/data-sync/services/managers/sync-progress-manager.js +1 -1
- package/lib/commonjs/modules/data-sync/services/managers/sync-progress-manager.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/retry-save.js +65 -0
- package/lib/commonjs/modules/data-sync/utils/retry-save.js.map +1 -0
- package/lib/commonjs/modules/helpers/form-items/form-field.js +2 -0
- package/lib/commonjs/modules/helpers/form-items/form-field.js.map +1 -1
- package/lib/commonjs/modules/helpers/index.js +12 -0
- package/lib/commonjs/modules/helpers/index.js.map +1 -1
- package/lib/commonjs/modules/helpers/utils/s-log.js +4 -13
- package/lib/commonjs/modules/helpers/utils/s-log.js.map +1 -1
- package/lib/commonjs/modules/helpers/utils/sentry-logger.js +28 -17
- package/lib/commonjs/modules/helpers/utils/sentry-logger.js.map +1 -1
- package/lib/commonjs/modules/helpers/utils/telemetry.js +143 -0
- package/lib/commonjs/modules/helpers/utils/telemetry.js.map +1 -0
- package/lib/commonjs/modules/image/components/optimized-image.js +24 -2
- package/lib/commonjs/modules/image/components/optimized-image.js.map +1 -1
- package/lib/commonjs/modules/questionnaire-response-form/components/content/questionnaire-content-error.js +18 -9
- package/lib/commonjs/modules/questionnaire-response-form/components/content/questionnaire-content-error.js.map +1 -1
- package/lib/commonjs/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.js +3 -2
- package/lib/commonjs/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.js.map +1 -1
- package/lib/commonjs/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.js +4 -2
- package/lib/commonjs/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.js.map +1 -1
- package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-form-provider.js +42 -17
- package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-form-provider.js.map +1 -1
- package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-navigation-provider.js +2 -1
- package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-navigation-provider.js.map +1 -1
- package/lib/commonjs/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.js.map +1 -1
- package/lib/commonjs/modules/tile/components/task-icon.js +2 -1
- package/lib/commonjs/modules/tile/components/task-icon.js.map +1 -1
- package/lib/commonjs/modules/ui/components/background-sync-setting.js +113 -0
- package/lib/commonjs/modules/ui/components/background-sync-setting.js.map +1 -0
- package/lib/commonjs/modules/ui/components/bluetooth-state-notice.js +105 -0
- package/lib/commonjs/modules/ui/components/bluetooth-state-notice.js.map +1 -0
- package/lib/commonjs/modules/ui/components/ecg-strip-viewer.js +165 -0
- package/lib/commonjs/modules/ui/components/ecg-strip-viewer.js.map +1 -0
- package/lib/commonjs/modules/ui/components/health-import-card.js +130 -0
- package/lib/commonjs/modules/ui/components/health-import-card.js.map +1 -0
- package/lib/commonjs/modules/ui/components/manual-entry-form.js +123 -0
- package/lib/commonjs/modules/ui/components/manual-entry-form.js.map +1 -0
- package/lib/commonjs/modules/ui/components/pairing-flow.js +222 -0
- package/lib/commonjs/modules/ui/components/pairing-flow.js.map +1 -0
- package/lib/commonjs/modules/ui/components/supported-devices-catalog-list.js +99 -0
- package/lib/commonjs/modules/ui/components/supported-devices-catalog-list.js.map +1 -0
- package/lib/commonjs/modules/ui/components/urine-test-result.js +94 -0
- package/lib/commonjs/modules/ui/components/urine-test-result.js.map +1 -0
- package/lib/commonjs/modules/ui/index.js +116 -0
- package/lib/commonjs/modules/ui/index.js.map +1 -0
- package/lib/commonjs/modules/ui/types.js +6 -0
- package/lib/commonjs/modules/ui/types.js.map +1 -0
- package/lib/commonjs/modules/ui/use-ovok-ui.js +51 -0
- package/lib/commonjs/modules/ui/use-ovok-ui.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/auth/delete-account-button/components/delete-account-button.js +2 -0
- package/lib/module/modules/auth/delete-account-button/components/delete-account-button.js.map +1 -1
- package/lib/module/modules/auth/hooks/use-rate-limit-cooldown.js +17 -0
- package/lib/module/modules/auth/hooks/use-rate-limit-cooldown.js.map +1 -0
- package/lib/module/modules/auth/hooks/use-session.js +85 -0
- package/lib/module/modules/auth/hooks/use-session.js.map +1 -0
- package/lib/module/modules/auth/index.js +4 -0
- package/lib/module/modules/auth/index.js.map +1 -1
- package/lib/module/modules/auth/logout-button/components/logout-button.js +3 -1
- package/lib/module/modules/auth/logout-button/components/logout-button.js.map +1 -1
- package/lib/module/modules/auth/register/components/form/inputs.js +48 -1
- package/lib/module/modules/auth/register/components/form/inputs.js.map +1 -1
- package/lib/module/modules/auth/register/components/form/register-button.js +4 -0
- package/lib/module/modules/auth/register/components/form/register-button.js.map +1 -1
- package/lib/module/modules/auth/register/components/form/register-form-provider.js +6 -0
- package/lib/module/modules/auth/register/components/form/register-form-provider.js.map +1 -1
- package/lib/module/modules/auth/reset-password/components/form/inputs.js +12 -0
- package/lib/module/modules/auth/reset-password/components/form/inputs.js.map +1 -1
- package/lib/module/modules/auth/reset-password/components/form/reset-password-button.js +4 -0
- package/lib/module/modules/auth/reset-password/components/form/reset-password-button.js.map +1 -1
- package/lib/module/modules/auth/reset-password/components/form/reset-password-form-provider.js +7 -1
- package/lib/module/modules/auth/reset-password/components/form/reset-password-form-provider.js.map +1 -1
- package/lib/module/modules/auth/session/components/session-list.js +76 -0
- package/lib/module/modules/auth/session/components/session-list.js.map +1 -0
- package/lib/module/modules/auth/session/events.js +13 -0
- package/lib/module/modules/auth/session/events.js.map +1 -0
- package/lib/module/modules/auth/session/index.js +4 -0
- package/lib/module/modules/auth/session/index.js.map +1 -0
- package/lib/module/modules/auth/session/types/session-list-props.js +4 -0
- package/lib/module/modules/auth/session/types/session-list-props.js.map +1 -0
- package/lib/module/modules/auth/sign-in/components/form/inputs.js +25 -0
- package/lib/module/modules/auth/sign-in/components/form/inputs.js.map +1 -1
- package/lib/module/modules/auth/sign-in/components/form/login-form-provider.js +48 -1
- package/lib/module/modules/auth/sign-in/components/form/login-form-provider.js.map +1 -1
- package/lib/module/modules/auth/sign-in/components/form/mfa-code-input.js +52 -0
- package/lib/module/modules/auth/sign-in/components/form/mfa-code-input.js.map +1 -0
- package/lib/module/modules/auth/sign-in/components/form/sign-in-with-email.js +2 -0
- package/lib/module/modules/auth/sign-in/components/form/sign-in-with-email.js.map +1 -1
- package/lib/module/modules/auth/sign-in/components/form/signin-button.js +13 -5
- package/lib/module/modules/auth/sign-in/components/form/signin-button.js.map +1 -1
- package/lib/module/modules/auth/types/session.js +2 -0
- package/lib/module/modules/auth/types/session.js.map +1 -0
- package/lib/module/modules/auth/utils/rate-limit.js +31 -0
- package/lib/module/modules/auth/utils/rate-limit.js.map +1 -0
- package/lib/module/modules/background-sync/android-bluetooth-foreground-service.js +3 -2
- package/lib/module/modules/background-sync/android-bluetooth-foreground-service.js.map +1 -1
- package/lib/module/modules/background-sync/background-safe-storage.js +74 -0
- package/lib/module/modules/background-sync/background-safe-storage.js.map +1 -0
- package/lib/module/modules/background-sync/index.js +1 -0
- package/lib/module/modules/background-sync/index.js.map +1 -1
- package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +123 -21
- package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/runtime-context.js +82 -0
- package/lib/module/modules/bt-management/hooks/runtime-context.js.map +1 -0
- package/lib/module/modules/bt-management/hooks/use-background-sync.js +41 -0
- package/lib/module/modules/bt-management/hooks/use-background-sync.js.map +1 -0
- package/lib/module/modules/bt-management/hooks/use-bluetooth-state.js +45 -0
- package/lib/module/modules/bt-management/hooks/use-bluetooth-state.js.map +1 -0
- package/lib/module/modules/bt-management/hooks/use-device-connection.js +30 -0
- package/lib/module/modules/bt-management/hooks/use-device-connection.js.map +1 -0
- package/lib/module/modules/bt-management/hooks/use-health-import.js +40 -0
- package/lib/module/modules/bt-management/hooks/use-health-import.js.map +1 -0
- package/lib/module/modules/bt-management/hooks/use-measurements.js +51 -0
- package/lib/module/modules/bt-management/hooks/use-measurements.js.map +1 -0
- package/lib/module/modules/bt-management/hooks/use-nearby-devices.js +20 -0
- package/lib/module/modules/bt-management/hooks/use-nearby-devices.js.map +1 -0
- package/lib/module/modules/bt-management/hooks/use-paired-devices.js +43 -0
- package/lib/module/modules/bt-management/hooks/use-paired-devices.js.map +1 -0
- package/lib/module/modules/bt-management/index.js +13 -0
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/bt-management/services/background-sync/background-sync-coordinator.js +41 -4
- package/lib/module/modules/bt-management/services/background-sync/background-sync-coordinator.js.map +1 -1
- package/lib/module/modules/bt-management/services/bt-manager.js +75 -4
- package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js +57 -0
- package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +111 -3
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/measurement-state-machine.js +5 -3
- package/lib/module/modules/bt-management/services/devices/measurement-state-machine.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/spo/spo2.main-services.js +12 -0
- package/lib/module/modules/bt-management/services/devices/spo/spo2.main-services.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.js +9 -3
- package/lib/module/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.js.map +1 -1
- package/lib/module/modules/bt-management/testing/fake-ble-manager.js +48 -0
- package/lib/module/modules/bt-management/testing/fake-ble-manager.js.map +1 -0
- package/lib/module/modules/bt-management/testing/index.js +5 -0
- package/lib/module/modules/bt-management/testing/index.js.map +1 -0
- package/lib/module/modules/bt-management/testing/recorded-frames.js +17 -0
- package/lib/module/modules/bt-management/testing/recorded-frames.js.map +1 -0
- package/lib/module/modules/bt-management/types/bluetooth-error.js +74 -0
- package/lib/module/modules/bt-management/types/bluetooth-error.js.map +1 -0
- package/lib/module/modules/bt-management/types/device-connection-event.js +4 -0
- package/lib/module/modules/bt-management/types/device-connection-event.js.map +1 -0
- package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
- package/lib/module/modules/bt-management/types/result-policy.js +4 -0
- package/lib/module/modules/bt-management/types/result-policy.js.map +1 -0
- package/lib/module/modules/bt-management/utils/result-identity.js +57 -0
- package/lib/module/modules/bt-management/utils/result-identity.js.map +1 -0
- package/lib/module/modules/data-sync/components/android/android-health-connect-authorization-provider.js +8 -2
- package/lib/module/modules/data-sync/components/android/android-health-connect-authorization-provider.js.map +1 -1
- package/lib/module/modules/data-sync/services/base-health-sync-service.js +23 -4
- package/lib/module/modules/data-sync/services/base-health-sync-service.js.map +1 -1
- package/lib/module/modules/data-sync/services/managers/data-processor.js +2 -2
- package/lib/module/modules/data-sync/services/managers/data-processor.js.map +1 -1
- package/lib/module/modules/data-sync/services/managers/sync-progress-manager.js +1 -1
- package/lib/module/modules/data-sync/services/managers/sync-progress-manager.js.map +1 -1
- package/lib/module/modules/data-sync/utils/retry-save.js +60 -0
- package/lib/module/modules/data-sync/utils/retry-save.js.map +1 -0
- package/lib/module/modules/helpers/form-items/form-field.js +2 -0
- package/lib/module/modules/helpers/form-items/form-field.js.map +1 -1
- package/lib/module/modules/helpers/index.js +1 -0
- package/lib/module/modules/helpers/index.js.map +1 -1
- package/lib/module/modules/helpers/utils/s-log.js +4 -12
- package/lib/module/modules/helpers/utils/s-log.js.map +1 -1
- package/lib/module/modules/helpers/utils/sentry-logger.js +26 -14
- package/lib/module/modules/helpers/utils/sentry-logger.js.map +1 -1
- package/lib/module/modules/helpers/utils/telemetry.js +131 -0
- package/lib/module/modules/helpers/utils/telemetry.js.map +1 -0
- package/lib/module/modules/image/components/optimized-image.js +25 -3
- package/lib/module/modules/image/components/optimized-image.js.map +1 -1
- package/lib/module/modules/questionnaire-response-form/components/content/questionnaire-content-error.js +20 -11
- package/lib/module/modules/questionnaire-response-form/components/content/questionnaire-content-error.js.map +1 -1
- package/lib/module/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.js +3 -2
- package/lib/module/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.js.map +1 -1
- package/lib/module/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.js +4 -2
- package/lib/module/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.js.map +1 -1
- package/lib/module/modules/questionnaire-response-form/components/questionnaire-form-provider.js +42 -17
- package/lib/module/modules/questionnaire-response-form/components/questionnaire-form-provider.js.map +1 -1
- package/lib/module/modules/questionnaire-response-form/components/questionnaire-navigation-provider.js +2 -1
- package/lib/module/modules/questionnaire-response-form/components/questionnaire-navigation-provider.js.map +1 -1
- package/lib/module/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.js.map +1 -1
- package/lib/module/modules/tile/components/task-icon.js +2 -1
- package/lib/module/modules/tile/components/task-icon.js.map +1 -1
- package/lib/module/modules/ui/components/background-sync-setting.js +107 -0
- package/lib/module/modules/ui/components/background-sync-setting.js.map +1 -0
- package/lib/module/modules/ui/components/bluetooth-state-notice.js +99 -0
- package/lib/module/modules/ui/components/bluetooth-state-notice.js.map +1 -0
- package/lib/module/modules/ui/components/ecg-strip-viewer.js +159 -0
- package/lib/module/modules/ui/components/ecg-strip-viewer.js.map +1 -0
- package/lib/module/modules/ui/components/health-import-card.js +124 -0
- package/lib/module/modules/ui/components/health-import-card.js.map +1 -0
- package/lib/module/modules/ui/components/manual-entry-form.js +117 -0
- package/lib/module/modules/ui/components/manual-entry-form.js.map +1 -0
- package/lib/module/modules/ui/components/pairing-flow.js +216 -0
- package/lib/module/modules/ui/components/pairing-flow.js.map +1 -0
- package/lib/module/modules/ui/components/supported-devices-catalog-list.js +93 -0
- package/lib/module/modules/ui/components/supported-devices-catalog-list.js.map +1 -0
- package/lib/module/modules/ui/components/urine-test-result.js +89 -0
- package/lib/module/modules/ui/components/urine-test-result.js.map +1 -0
- package/lib/module/modules/ui/index.js +13 -0
- package/lib/module/modules/ui/index.js.map +1 -0
- package/lib/module/modules/ui/types.js +4 -0
- package/lib/module/modules/ui/types.js.map +1 -0
- package/lib/module/modules/ui/use-ovok-ui.js +45 -0
- package/lib/module/modules/ui/use-ovok-ui.js.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/delete-account-button/components/delete-account-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-rate-limit-cooldown.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-rate-limit-cooldown.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-session.d.ts +16 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-session.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/auth/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/logout-button/components/logout-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/register/components/form/inputs.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/register/components/form/register-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/register/components/form/register-form-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/reset-password/components/form/inputs.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/reset-password/components/form/reset-password-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/reset-password/components/form/reset-password-form-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/session/components/session-list.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/auth/session/components/session-list.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/session/events.d.ts +5 -0
- package/lib/typescript/commonjs/src/modules/auth/session/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/session/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/auth/session/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/session/types/session-list-props.d.ts +5 -0
- package/lib/typescript/commonjs/src/modules/auth/session/types/session-list-props.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/inputs.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/login-form-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/mfa-code-input.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/mfa-code-input.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/sign-in-with-email.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/sign-in-with-email.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/signin-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/sign-in.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/sign-in.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/contexts/login-form-context.d.ts +2 -46
- package/lib/typescript/commonjs/src/modules/auth/sign-in/contexts/login-form-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/hooks/use-login-form.d.ts +1 -47
- package/lib/typescript/commonjs/src/modules/auth/sign-in/hooks/use-login-form.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/types/login-form-context-type.d.ts +11 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/types/login-form-context-type.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/types/session.d.ts +13 -0
- package/lib/typescript/commonjs/src/modules/auth/types/session.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/utils/rate-limit.d.ts +11 -0
- package/lib/typescript/commonjs/src/modules/auth/utils/rate-limit.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/background-sync/android-bluetooth-foreground-service.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/background-sync/background-safe-storage.d.ts +29 -0
- package/lib/typescript/commonjs/src/modules/background-sync/background-safe-storage.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/background-sync/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/background-sync/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +46 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-background-sync.d.ts +14 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-background-sync.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bluetooth-state.d.ts +11 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bluetooth-state.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-device-connection.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-device-connection.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-health-import.d.ts +16 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-health-import.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-measurements.d.ts +11 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-nearby-devices.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-nearby-devices.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-paired-devices.d.ts +16 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-paired-devices.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +13 -0
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/background-sync/background-sync-coordinator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +22 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +9 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/measurement-state-machine.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/measurement-state-machine.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/spo/spo2.main-services.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/testing/fake-ble-manager.d.ts +16 -0
- package/lib/typescript/commonjs/src/modules/bt-management/testing/fake-ble-manager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/testing/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/bt-management/testing/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/testing/recorded-frames.d.ts +12 -0
- package/lib/typescript/commonjs/src/modules/bt-management/testing/recorded-frames.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/background-sync.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/background-sync.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/bluetooth-error.d.ts +23 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/bluetooth-error.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/btprovider-children-props.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/btprovider-children-props.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts +16 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/error-callback.d.ts +5 -2
- package/lib/typescript/commonjs/src/modules/bt-management/types/error-callback.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/i-bt-managed-device.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/i-bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/result-callback.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/result-callback.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/result-policy.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/result-policy.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/result-identity.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/bt-management/utils/result-identity.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/components/android/android-health-connect-authorization-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/services/base-health-sync-service.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/sync-progress.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/sync-progress.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/retry-save.d.ts +5 -0
- package/lib/typescript/commonjs/src/modules/data-sync/utils/retry-save.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/helpers/form-items/form-field.d.ts +4 -1
- package/lib/typescript/commonjs/src/modules/helpers/form-items/form-field.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/helpers/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/helpers/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/helpers/utils/s-log.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/helpers/utils/sentry-logger.d.ts +7 -1
- package/lib/typescript/commonjs/src/modules/helpers/utils/sentry-logger.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/helpers/utils/telemetry.d.ts +68 -0
- package/lib/typescript/commonjs/src/modules/helpers/utils/telemetry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/image/components/optimized-image.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/image/components/optimized-image.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/image/types/optimized-image-props.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/image/types/optimized-image-props.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/content/questionnaire-content-error.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/questionnaire-form-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/questionnaire-navigation-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/hooks/use-navigation-handlers.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/hooks/use-navigation-handlers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/hooks/use-questionnaire-navigation.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/hooks/use-questionnaire-navigation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/types/questionnaire-form-context-type.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/types/questionnaire-form-context-type.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/types/questionnaire-navigation-provider-props.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/types/questionnaire-navigation-provider-props.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/tile/components/task-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/ui/components/background-sync-setting.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/ui/components/background-sync-setting.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/ui/components/bluetooth-state-notice.d.ts +12 -0
- package/lib/typescript/commonjs/src/modules/ui/components/bluetooth-state-notice.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/ui/components/ecg-strip-viewer.d.ts +17 -0
- package/lib/typescript/commonjs/src/modules/ui/components/ecg-strip-viewer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/ui/components/health-import-card.d.ts +13 -0
- package/lib/typescript/commonjs/src/modules/ui/components/health-import-card.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/ui/components/manual-entry-form.d.ts +20 -0
- package/lib/typescript/commonjs/src/modules/ui/components/manual-entry-form.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/ui/components/pairing-flow.d.ts +15 -0
- package/lib/typescript/commonjs/src/modules/ui/components/pairing-flow.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/ui/components/supported-devices-catalog-list.d.ts +16 -0
- package/lib/typescript/commonjs/src/modules/ui/components/supported-devices-catalog-list.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/ui/components/urine-test-result.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/ui/components/urine-test-result.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/ui/index.d.ts +11 -0
- package/lib/typescript/commonjs/src/modules/ui/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/ui/types.d.ts +24 -0
- package/lib/typescript/commonjs/src/modules/ui/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/ui/use-ovok-ui.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/ui/use-ovok-ui.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +1 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/delete-account-button/components/delete-account-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/hooks/use-rate-limit-cooldown.d.ts +2 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-rate-limit-cooldown.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-session.d.ts +16 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-session.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/index.d.ts +4 -0
- package/lib/typescript/module/src/modules/auth/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/logout-button/components/logout-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/register/components/form/inputs.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/register/components/form/register-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/register/components/form/register-form-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/reset-password/components/form/inputs.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/reset-password/components/form/reset-password-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/reset-password/components/form/reset-password-form-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/session/components/session-list.d.ts +4 -0
- package/lib/typescript/module/src/modules/auth/session/components/session-list.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/session/events.d.ts +5 -0
- package/lib/typescript/module/src/modules/auth/session/events.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/session/index.d.ts +3 -0
- package/lib/typescript/module/src/modules/auth/session/index.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/session/types/session-list-props.d.ts +5 -0
- package/lib/typescript/module/src/modules/auth/session/types/session-list-props.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/sign-in/components/form/inputs.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/components/form/login-form-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/components/form/mfa-code-input.d.ts +9 -0
- package/lib/typescript/module/src/modules/auth/sign-in/components/form/mfa-code-input.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/sign-in/components/form/sign-in-with-email.d.ts +4 -0
- package/lib/typescript/module/src/modules/auth/sign-in/components/form/sign-in-with-email.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/components/form/signin-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/components/sign-in.d.ts +4 -0
- package/lib/typescript/module/src/modules/auth/sign-in/components/sign-in.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/contexts/login-form-context.d.ts +2 -46
- package/lib/typescript/module/src/modules/auth/sign-in/contexts/login-form-context.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/hooks/use-login-form.d.ts +1 -47
- package/lib/typescript/module/src/modules/auth/sign-in/hooks/use-login-form.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/types/login-form-context-type.d.ts +11 -1
- package/lib/typescript/module/src/modules/auth/sign-in/types/login-form-context-type.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/types/session.d.ts +13 -0
- package/lib/typescript/module/src/modules/auth/types/session.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/utils/rate-limit.d.ts +11 -0
- package/lib/typescript/module/src/modules/auth/utils/rate-limit.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/background-sync/android-bluetooth-foreground-service.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/background-sync/background-safe-storage.d.ts +29 -0
- package/lib/typescript/module/src/modules/background-sync/background-safe-storage.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/background-sync/index.d.ts +1 -0
- package/lib/typescript/module/src/modules/background-sync/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +46 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-background-sync.d.ts +14 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-background-sync.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-bluetooth-state.d.ts +11 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-bluetooth-state.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-device-connection.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-device-connection.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-health-import.d.ts +16 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-health-import.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-measurements.d.ts +11 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-nearby-devices.d.ts +8 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-nearby-devices.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-paired-devices.d.ts +16 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-paired-devices.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/index.d.ts +13 -0
- package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/background-sync/background-sync-coordinator.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +22 -0
- package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +9 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/measurement-state-machine.d.ts +3 -2
- package/lib/typescript/module/src/modules/bt-management/services/devices/measurement-state-machine.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/spo/spo2.main-services.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/testing/fake-ble-manager.d.ts +16 -0
- package/lib/typescript/module/src/modules/bt-management/testing/fake-ble-manager.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/testing/index.d.ts +3 -0
- package/lib/typescript/module/src/modules/bt-management/testing/index.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/testing/recorded-frames.d.ts +12 -0
- package/lib/typescript/module/src/modules/bt-management/testing/recorded-frames.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/background-sync.d.ts +3 -1
- package/lib/typescript/module/src/modules/bt-management/types/background-sync.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/bluetooth-error.d.ts +23 -0
- package/lib/typescript/module/src/modules/bt-management/types/bluetooth-error.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/btprovider-children-props.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/types/btprovider-children-props.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts +16 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/error-callback.d.ts +5 -2
- package/lib/typescript/module/src/modules/bt-management/types/error-callback.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/i-bt-managed-device.d.ts +1 -0
- package/lib/typescript/module/src/modules/bt-management/types/i-bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/result-callback.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/types/result-callback.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/result-policy.d.ts +8 -0
- package/lib/typescript/module/src/modules/bt-management/types/result-policy.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/utils/result-identity.d.ts +10 -0
- package/lib/typescript/module/src/modules/bt-management/utils/result-identity.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/data-sync/components/android/android-health-connect-authorization-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/services/base-health-sync-service.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts +4 -0
- package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
- package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts +2 -0
- package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/types/sync-progress.d.ts +1 -1
- package/lib/typescript/module/src/modules/data-sync/types/sync-progress.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/retry-save.d.ts +5 -0
- package/lib/typescript/module/src/modules/data-sync/utils/retry-save.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/helpers/form-items/form-field.d.ts +4 -1
- package/lib/typescript/module/src/modules/helpers/form-items/form-field.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/helpers/index.d.ts +1 -0
- package/lib/typescript/module/src/modules/helpers/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/helpers/utils/s-log.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/helpers/utils/sentry-logger.d.ts +7 -1
- package/lib/typescript/module/src/modules/helpers/utils/sentry-logger.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/helpers/utils/telemetry.d.ts +68 -0
- package/lib/typescript/module/src/modules/helpers/utils/telemetry.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/image/components/optimized-image.d.ts +1 -1
- package/lib/typescript/module/src/modules/image/components/optimized-image.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/image/types/optimized-image-props.d.ts +4 -0
- package/lib/typescript/module/src/modules/image/types/optimized-image-props.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/questionnaire-response-form/components/content/questionnaire-content-error.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/questionnaire-response-form/components/questionnaire-form-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/questionnaire-response-form/components/questionnaire-navigation-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.d.ts +1 -0
- package/lib/typescript/module/src/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/questionnaire-response-form/hooks/use-navigation-handlers.d.ts +1 -0
- package/lib/typescript/module/src/modules/questionnaire-response-form/hooks/use-navigation-handlers.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/questionnaire-response-form/hooks/use-questionnaire-navigation.d.ts +1 -0
- package/lib/typescript/module/src/modules/questionnaire-response-form/hooks/use-questionnaire-navigation.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/questionnaire-response-form/types/questionnaire-form-context-type.d.ts +2 -0
- package/lib/typescript/module/src/modules/questionnaire-response-form/types/questionnaire-form-context-type.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/questionnaire-response-form/types/questionnaire-navigation-provider-props.d.ts +1 -0
- package/lib/typescript/module/src/modules/questionnaire-response-form/types/questionnaire-navigation-provider-props.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/tile/components/task-icon.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/ui/components/background-sync-setting.d.ts +9 -0
- package/lib/typescript/module/src/modules/ui/components/background-sync-setting.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/ui/components/bluetooth-state-notice.d.ts +12 -0
- package/lib/typescript/module/src/modules/ui/components/bluetooth-state-notice.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/ui/components/ecg-strip-viewer.d.ts +17 -0
- package/lib/typescript/module/src/modules/ui/components/ecg-strip-viewer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/ui/components/health-import-card.d.ts +13 -0
- package/lib/typescript/module/src/modules/ui/components/health-import-card.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/ui/components/manual-entry-form.d.ts +20 -0
- package/lib/typescript/module/src/modules/ui/components/manual-entry-form.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/ui/components/pairing-flow.d.ts +15 -0
- package/lib/typescript/module/src/modules/ui/components/pairing-flow.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/ui/components/supported-devices-catalog-list.d.ts +16 -0
- package/lib/typescript/module/src/modules/ui/components/supported-devices-catalog-list.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/ui/components/urine-test-result.d.ts +10 -0
- package/lib/typescript/module/src/modules/ui/components/urine-test-result.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/ui/index.d.ts +11 -0
- package/lib/typescript/module/src/modules/ui/index.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/ui/types.d.ts +24 -0
- package/lib/typescript/module/src/modules/ui/types.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/ui/use-ovok-ui.d.ts +7 -0
- package/lib/typescript/module/src/modules/ui/use-ovok-ui.d.ts.map +1 -0
- package/package.json +145 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["modules/background-sync/index.ts"],"mappings":";;AAAA,cAAc,8BAA2B;AACzC,cAAc,2CAAwC;AACtD,cAAc,oBAAiB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["modules/background-sync/index.ts"],"mappings":";;AAAA,cAAc,8BAA2B;AACzC,cAAc,2CAAwC;AACtD,cAAc,oBAAiB;AAC/B,cAAc,8BAA2B","ignoreList":[]}
|
|
@@ -6,10 +6,12 @@ import { AppState } from "react-native";
|
|
|
6
6
|
import { AndroidBluetoothForegroundService, showPushNotification } from "../../background-sync/index.js";
|
|
7
7
|
import { useDeviceList } from "../../bt-device/components/hooks/use-device-list.js";
|
|
8
8
|
import { sentryLogger } from "../../helpers/utils/sentry-logger.js";
|
|
9
|
+
import { BluetoothRuntimeProvider, createBluetoothRuntime } from "../hooks/runtime-context.js";
|
|
9
10
|
import { getRestoredBleState } from "../services/background-sync/background-ble-manager.js";
|
|
10
11
|
import { getBackgroundServiceUUIDs } from "../services/background-sync/background-service-uuids.js";
|
|
11
12
|
import { BackgroundSyncCoordinator } from "../services/background-sync/background-sync-coordinator.js";
|
|
12
13
|
import { BTManager } from "../services/bt-manager.js";
|
|
14
|
+
import { toBluetoothError } from "../types/bluetooth-error.js";
|
|
13
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
16
|
export const BTProviderChildWrapper = /*#__PURE__*/React.memo(({
|
|
15
17
|
bleManager,
|
|
@@ -20,10 +22,13 @@ export const BTProviderChildWrapper = /*#__PURE__*/React.memo(({
|
|
|
20
22
|
onDeviceFound,
|
|
21
23
|
onError,
|
|
22
24
|
onDeviceStatusChanged,
|
|
25
|
+
onConnectionEvent,
|
|
23
26
|
onResult,
|
|
27
|
+
resultPolicies,
|
|
24
28
|
backgroundSync
|
|
25
29
|
}) => {
|
|
26
30
|
const btManagerRef = React.useRef(null);
|
|
31
|
+
const runtimeRef = React.useRef(createBluetoothRuntime(bleManager));
|
|
27
32
|
const backgroundSyncRef = React.useRef(backgroundSync);
|
|
28
33
|
const backgroundSyncCoordinatorRef = React.useRef(null);
|
|
29
34
|
const {
|
|
@@ -34,6 +39,7 @@ export const BTProviderChildWrapper = /*#__PURE__*/React.memo(({
|
|
|
34
39
|
if (!acceptedDevices.length) {
|
|
35
40
|
return;
|
|
36
41
|
}
|
|
42
|
+
const runtime = runtimeRef.current;
|
|
37
43
|
sentryLogger("info", "Creating BTManager");
|
|
38
44
|
const currentBackgroundSync = backgroundSyncRef.current;
|
|
39
45
|
const isBackgroundEnabled = currentBackgroundSync?.enabled === true;
|
|
@@ -48,6 +54,9 @@ export const BTProviderChildWrapper = /*#__PURE__*/React.memo(({
|
|
|
48
54
|
}),
|
|
49
55
|
...(deliveredEcgFileNames === undefined ? {} : {
|
|
50
56
|
deliveredEcgFileNames
|
|
57
|
+
}),
|
|
58
|
+
...(resultPolicies === undefined ? {} : {
|
|
59
|
+
resultPolicies
|
|
51
60
|
})
|
|
52
61
|
};
|
|
53
62
|
const btManager = Object.keys(managerOptions).length ? new BTManager(bleManager, acceptedDevices, managerOptions) : new BTManager(bleManager, acceptedDevices);
|
|
@@ -75,12 +84,13 @@ export const BTProviderChildWrapper = /*#__PURE__*/React.memo(({
|
|
|
75
84
|
});
|
|
76
85
|
} catch (error) {
|
|
77
86
|
onError?.({
|
|
78
|
-
error:
|
|
87
|
+
error: toBluetoothError(error)
|
|
79
88
|
});
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
91
|
}) : null;
|
|
83
92
|
btManagerRef.current = btManager;
|
|
93
|
+
runtime.setManager(btManager);
|
|
84
94
|
backgroundSyncCoordinatorRef.current = coordinator;
|
|
85
95
|
btManager.setBackgroundScanEnabled(isBackgroundEnabled && AppState.currentState !== "active");
|
|
86
96
|
btManager.startScan();
|
|
@@ -88,52 +98,112 @@ export const BTProviderChildWrapper = /*#__PURE__*/React.memo(({
|
|
|
88
98
|
sentryLogger("info", "Destroying scan service");
|
|
89
99
|
backgroundSyncCoordinatorRef.current = null;
|
|
90
100
|
btManagerRef.current = null;
|
|
101
|
+
runtime.setManager(undefined);
|
|
91
102
|
btManager.destroy();
|
|
92
103
|
};
|
|
93
|
-
}, [acceptedDevices, backgroundSync?.enabled, backgroundSync?.maxRetries, backgroundSync?.retryBackoffMs, backgroundSync?.serviceUUIDs, backgroundSync?.storage, backgroundSync?.storageKey, backgroundSync?.notifications?.enabled, backgroundSync?.notifications?.title, backgroundSync?.notifications?.body, backgroundSync?.notifications?.data, bleManager, deliveredEcgFileNames, onError, oneReadingPerConnection]);
|
|
104
|
+
}, [acceptedDevices, backgroundSync?.enabled, backgroundSync?.maxRetries, backgroundSync?.retryBackoffMs, backgroundSync?.serviceUUIDs, backgroundSync?.storage, backgroundSync?.storageKey, backgroundSync?.notifications?.enabled, backgroundSync?.notifications?.title, backgroundSync?.notifications?.body, backgroundSync?.notifications?.data, bleManager, deliveredEcgFileNames, resultPolicies, onError, oneReadingPerConnection]);
|
|
94
105
|
React.useEffect(() => {
|
|
95
|
-
if (!
|
|
106
|
+
if (!acceptedDevices.length) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const runtime = runtimeRef.current;
|
|
110
|
+
const hasRuntimeListener = runtime.hasListeners("deviceFound");
|
|
111
|
+
if (!onDeviceFound && !hasRuntimeListener) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const manager = btManagerRef.current;
|
|
115
|
+
if (!manager) {
|
|
96
116
|
return;
|
|
97
117
|
}
|
|
98
|
-
|
|
118
|
+
if (onDeviceFound && !hasRuntimeListener) {
|
|
119
|
+
manager.onDeviceFound(onDeviceFound);
|
|
120
|
+
return () => {
|
|
121
|
+
manager.onDeviceFound(undefined);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
manager.onDeviceFound((device, deviceManager) => {
|
|
125
|
+
runtime.upsertDevice(device);
|
|
126
|
+
runtime.emit("deviceFound", device);
|
|
127
|
+
return onDeviceFound?.(device, deviceManager) ?? Promise.resolve();
|
|
128
|
+
});
|
|
99
129
|
return () => {
|
|
100
|
-
|
|
130
|
+
manager.onDeviceFound(undefined);
|
|
101
131
|
};
|
|
102
132
|
}, [onDeviceFound, acceptedDevices]);
|
|
103
133
|
React.useEffect(() => {
|
|
104
|
-
if (!
|
|
134
|
+
if (!acceptedDevices.length) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const runtime = runtimeRef.current;
|
|
138
|
+
const hasRuntimeListener = runtime.hasListeners("error");
|
|
139
|
+
if (!onError && !hasRuntimeListener) {
|
|
105
140
|
return;
|
|
106
141
|
}
|
|
107
|
-
btManagerRef.current
|
|
142
|
+
const manager = btManagerRef.current;
|
|
143
|
+
if (!manager) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (onError && !hasRuntimeListener) {
|
|
147
|
+
manager.onError(onError);
|
|
148
|
+
return () => {
|
|
149
|
+
manager.onError(undefined);
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
manager.onError(data => {
|
|
153
|
+
runtime.emit("error", data);
|
|
154
|
+
onError?.(data);
|
|
155
|
+
});
|
|
108
156
|
return () => {
|
|
109
|
-
|
|
157
|
+
manager.onError(undefined);
|
|
110
158
|
};
|
|
111
159
|
}, [onError, acceptedDevices]);
|
|
112
160
|
React.useEffect(() => {
|
|
113
161
|
if (!acceptedDevices.length) {
|
|
114
162
|
return;
|
|
115
163
|
}
|
|
164
|
+
const runtime = runtimeRef.current;
|
|
165
|
+
const requiresBridge = backgroundSync?.enabled === true || runtime.hasListeners("result");
|
|
166
|
+
if (!onResult && !requiresBridge) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const manager = btManagerRef.current;
|
|
170
|
+
if (!manager) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (onResult && !requiresBridge) {
|
|
174
|
+
manager.onResult(onResult);
|
|
175
|
+
return () => {
|
|
176
|
+
manager.onResult(undefined);
|
|
177
|
+
};
|
|
178
|
+
}
|
|
116
179
|
const callback = backgroundSync?.enabled === true ? data => {
|
|
117
180
|
onResult?.(data);
|
|
118
181
|
const coordinator = backgroundSyncCoordinatorRef.current;
|
|
119
182
|
if (coordinator) {
|
|
120
183
|
void coordinator.enqueue(data).catch(error => {
|
|
121
184
|
onError?.({
|
|
122
|
-
error:
|
|
185
|
+
error: toBluetoothError(error)
|
|
123
186
|
});
|
|
124
187
|
});
|
|
125
188
|
}
|
|
126
189
|
} : onResult;
|
|
127
|
-
if (!
|
|
190
|
+
if (!acceptedDevices.length) {
|
|
128
191
|
return;
|
|
129
192
|
}
|
|
130
|
-
|
|
193
|
+
manager.onResult(data => {
|
|
194
|
+
runtime.emit("result", data);
|
|
195
|
+
callback?.(data);
|
|
196
|
+
});
|
|
131
197
|
return () => {
|
|
132
|
-
|
|
198
|
+
manager.onResult(undefined);
|
|
133
199
|
};
|
|
134
200
|
}, [backgroundSync?.enabled, onError, onResult, acceptedDevices]);
|
|
135
201
|
React.useEffect(() => {
|
|
136
|
-
if (!
|
|
202
|
+
if (!acceptedDevices.length) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const runtime = runtimeRef.current;
|
|
206
|
+
if (!onDeviceStatusChanged && !runtime.hasListeners("status")) {
|
|
137
207
|
return;
|
|
138
208
|
}
|
|
139
209
|
btManagerRef.current?.onDeviceStatusChanged(({
|
|
@@ -141,6 +211,15 @@ export const BTProviderChildWrapper = /*#__PURE__*/React.memo(({
|
|
|
141
211
|
deviceData,
|
|
142
212
|
measurementTypeKey
|
|
143
213
|
}) => {
|
|
214
|
+
runtime.setDeviceStatus({
|
|
215
|
+
deviceData,
|
|
216
|
+
status
|
|
217
|
+
});
|
|
218
|
+
runtime.emit("status", {
|
|
219
|
+
status,
|
|
220
|
+
deviceData,
|
|
221
|
+
measurementTypeKey
|
|
222
|
+
});
|
|
144
223
|
setDeviceListItems(prev => {
|
|
145
224
|
const newList = [...prev];
|
|
146
225
|
const index = newList.findIndex(item => item.deviceType === deviceData.name);
|
|
@@ -153,7 +232,7 @@ export const BTProviderChildWrapper = /*#__PURE__*/React.memo(({
|
|
|
153
232
|
};
|
|
154
233
|
return newList;
|
|
155
234
|
});
|
|
156
|
-
onDeviceStatusChanged({
|
|
235
|
+
onDeviceStatusChanged?.({
|
|
157
236
|
status,
|
|
158
237
|
deviceData,
|
|
159
238
|
measurementTypeKey
|
|
@@ -163,6 +242,26 @@ export const BTProviderChildWrapper = /*#__PURE__*/React.memo(({
|
|
|
163
242
|
btManagerRef.current?.onDeviceStatusChanged(undefined);
|
|
164
243
|
};
|
|
165
244
|
}, [onDeviceStatusChanged, acceptedDevices, setDeviceListItems]);
|
|
245
|
+
React.useEffect(() => {
|
|
246
|
+
if (!acceptedDevices.length) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const runtime = runtimeRef.current;
|
|
250
|
+
if (!onConnectionEvent && !runtime.hasListeners("connection")) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const manager = btManagerRef.current;
|
|
254
|
+
if (!manager || typeof manager.onConnectionEvent !== "function") {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
manager.onConnectionEvent(event => {
|
|
258
|
+
runtime.emit("connection", event);
|
|
259
|
+
onConnectionEvent?.(event);
|
|
260
|
+
});
|
|
261
|
+
return () => {
|
|
262
|
+
manager.onConnectionEvent(undefined);
|
|
263
|
+
};
|
|
264
|
+
}, [onConnectionEvent, acceptedDevices]);
|
|
166
265
|
React.useEffect(() => {
|
|
167
266
|
if (!acceptedDevices.length || backgroundSync?.enabled !== true) {
|
|
168
267
|
return;
|
|
@@ -176,7 +275,7 @@ export const BTProviderChildWrapper = /*#__PURE__*/React.memo(({
|
|
|
176
275
|
resetExhausted: true
|
|
177
276
|
}).catch(error => {
|
|
178
277
|
onError?.({
|
|
179
|
-
error:
|
|
278
|
+
error: toBluetoothError(error)
|
|
180
279
|
});
|
|
181
280
|
});
|
|
182
281
|
}, [acceptedDevices, backgroundSync?.enabled, backgroundSync?.restoreStateIdentifier, onError]);
|
|
@@ -189,7 +288,7 @@ export const BTProviderChildWrapper = /*#__PURE__*/React.memo(({
|
|
|
189
288
|
resetExhausted: true
|
|
190
289
|
}).catch(error => {
|
|
191
290
|
onError?.({
|
|
192
|
-
error:
|
|
291
|
+
error: toBluetoothError(error)
|
|
193
292
|
});
|
|
194
293
|
});
|
|
195
294
|
}
|
|
@@ -198,11 +297,14 @@ export const BTProviderChildWrapper = /*#__PURE__*/React.memo(({
|
|
|
198
297
|
listener.remove();
|
|
199
298
|
};
|
|
200
299
|
}, [onError]);
|
|
201
|
-
return /*#__PURE__*/_jsx(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
300
|
+
return /*#__PURE__*/_jsx(BluetoothRuntimeProvider, {
|
|
301
|
+
runtime: runtimeRef.current,
|
|
302
|
+
children: /*#__PURE__*/_jsx(AndroidBluetoothForegroundService, {
|
|
303
|
+
enabled: backgroundSync?.enabled === true,
|
|
304
|
+
options: backgroundSync?.android?.foregroundService,
|
|
305
|
+
onError: onError,
|
|
306
|
+
children: children
|
|
307
|
+
})
|
|
206
308
|
});
|
|
207
309
|
});
|
|
208
310
|
//# sourceMappingURL=bt-provider-child-wrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","AppState","AndroidBluetoothForegroundService","showPushNotification","useDeviceList","sentryLogger","getRestoredBleState","getBackgroundServiceUUIDs","BackgroundSyncCoordinator","BTManager","jsx","_jsx","BTProviderChildWrapper","memo","bleManager","acceptedDevices","children","oneReadingPerConnection","deliveredEcgFileNames","onDeviceFound","onError","onDeviceStatusChanged","onResult","backgroundSync","btManagerRef","useRef","backgroundSyncRef","backgroundSyncCoordinatorRef","setDeviceListItems","current","useEffect","length","currentBackgroundSync","isBackgroundEnabled","enabled","backgroundOptions","backgroundEnabled","serviceUUIDs","undefined","managerOptions","btManager","Object","keys","coordinator","result","latest","notifications","body","data","title","deviceData","name","error","Error","String","setBackgroundScanEnabled","currentState","startScan","destroy","maxRetries","retryBackoffMs","storage","storageKey","callback","enqueue","catch","status","measurementTypeKey","prev","newList","index","findIndex","item","deviceType","restoredState","restoreStateIdentifier","connectedPeripherals","restoreDevices","flush","includeExhausted","resetExhausted","listener","addEventListener","state","remove","options","android","foregroundService"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/components/bt-provider-child-wrapper.tsx"],"mappings":";;AAAA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SACEC,iCAAiC,EACjCC,oBAAoB,QACf,gCAAuB;AAC9B,SAASC,aAAa,QAAQ,qDAAkD;AAChF,SAASC,YAAY,QAAQ,sCAAmC;AAChE,SAASC,mBAAmB,QAAQ,uDAAoD;AACxF,SAASC,yBAAyB,QAAQ,yDAAsD;AAChG,SAASC,yBAAyB,QAAQ,4DAAyD;AACnG,SAASC,SAAS,QAAQ,2BAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAKnD,OAAO,MAAMC,sBAAsB,gBAAGZ,KAAK,CAACa,IAAI,CAC9C,CAAsC;EACpCC,UAAU;EACVC,eAAe,GAAG,EAAkB;EACpCC,QAAQ;EACRC,uBAAuB;EACvBC,qBAAqB;EACrBC,aAAa;EACbC,OAAO;EACPC,qBAAqB;EACrBC,QAAQ;EACRC;AACuD,CAAC,KAAK;EAC7D,MAAMC,YAAY,GAAGxB,KAAK,CAACyB,MAAM,CAAsB,IAAI,CAAC;EAC5D,MAAMC,iBAAiB,GAAG1B,KAAK,CAACyB,MAAM,CAACF,cAAc,CAAC;EAEtD,MAAMI,4BAA4B,GAAG3B,KAAK,CAACyB,MAAM,CAE/C,IAAI,CAAC;EAEP,MAAM;IAAEG;EAAmB,CAAC,GAAGxB,aAAa,CAAC,CAAC;EAE9CsB,iBAAiB,CAACG,OAAO,GAAGN,cAAc;EAE1CvB,KAAK,CAAC8B,SAAS,CAAC,MAAM;IACpB,IAAI,CAACf,eAAe,CAACgB,MAAM,EAAE;MAC3B;IACF;IACA1B,YAAY,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAE1C,MAAM2B,qBAAqB,GAAGN,iBAAiB,CAACG,OAAO;IACvD,MAAMI,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,CAAC,CAACf,KAAK,CAAEb,KAAc,IAAK;UAC3BhC,OAAO,GAAG;YACRgC,KAAK,EAAEA,KAAK,YAAYC,KAAK,GAAGD,KAAK,GAAGE,MAAM,CAACF,KAAK;UACtD,CAAC,CAAC;QACJ,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;IAEF,OAAO,MAAM;MACX6B,QAAQ,CAACG,MAAM,CAAC,CAAC;IACnB,CAAC;EACH,CAAC,EAAE,CAAChE,OAAO,CAAC,CAAC;EAEb,oBACET,IAAA,CAACT,iCAAiC;IAChCgC,OAAO,EAAEX,cAAc,EAAEW,OAAO,KAAK,IAAK;IAC1CmD,OAAO,EAAE9D,cAAc,EAAE+D,OAAO,EAAEC,iBAAkB;IACpDnE,OAAO,EAAEA,OAAQ;IAAAJ,QAAA,EAEhBA;EAAQ,CACwB,CAAC;AAExC,CACF,CAEsB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","AppState","AndroidBluetoothForegroundService","showPushNotification","useDeviceList","sentryLogger","BluetoothRuntimeProvider","createBluetoothRuntime","getRestoredBleState","getBackgroundServiceUUIDs","BackgroundSyncCoordinator","BTManager","toBluetoothError","jsx","_jsx","BTProviderChildWrapper","memo","bleManager","acceptedDevices","children","oneReadingPerConnection","deliveredEcgFileNames","onDeviceFound","onError","onDeviceStatusChanged","onConnectionEvent","onResult","resultPolicies","backgroundSync","btManagerRef","useRef","runtimeRef","backgroundSyncRef","backgroundSyncCoordinatorRef","setDeviceListItems","current","useEffect","length","runtime","currentBackgroundSync","isBackgroundEnabled","enabled","backgroundOptions","backgroundEnabled","serviceUUIDs","undefined","managerOptions","btManager","Object","keys","coordinator","result","latest","notifications","body","data","title","deviceData","name","error","setManager","setBackgroundScanEnabled","currentState","startScan","destroy","maxRetries","retryBackoffMs","storage","storageKey","hasRuntimeListener","hasListeners","manager","device","deviceManager","upsertDevice","emit","Promise","resolve","requiresBridge","callback","enqueue","catch","status","measurementTypeKey","setDeviceStatus","prev","newList","index","findIndex","item","deviceType","event","restoredState","restoreStateIdentifier","connectedPeripherals","restoreDevices","flush","includeExhausted","resetExhausted","listener","addEventListener","state","remove","options","android","foregroundService"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/components/bt-provider-child-wrapper.tsx"],"mappings":";;AAAA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SACEC,iCAAiC,EACjCC,oBAAoB,QACf,gCAAuB;AAC9B,SAASC,aAAa,QAAQ,qDAAkD;AAChF,SAASC,YAAY,QAAQ,sCAAmC;AAChE,SAASC,wBAAwB,EAAEC,sBAAsB,QAAQ,6BAA0B;AAC3F,SAASC,mBAAmB,QAAQ,uDAAoD;AACxF,SAASC,yBAAyB,QAAQ,yDAAsD;AAChG,SAASC,yBAAyB,QAAQ,4DAAyD;AACnG,SAASC,SAAS,QAAQ,2BAAwB;AAElD,SAASC,gBAAgB,QAAQ,6BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAI5D,OAAO,MAAMC,sBAAsB,gBAAGf,KAAK,CAACgB,IAAI,CAC9C,CAAsC;EACpCC,UAAU;EACVC,eAAe,GAAG,EAAkB;EACpCC,QAAQ;EACRC,uBAAuB;EACvBC,qBAAqB;EACrBC,aAAa;EACbC,OAAO;EACPC,qBAAqB;EACrBC,iBAAiB;EACjBC,QAAQ;EACRC,cAAc;EACdC;AACuD,CAAC,KAAK;EAC7D,MAAMC,YAAY,GAAG7B,KAAK,CAAC8B,MAAM,CAAsB,IAAI,CAAC;EAC5D,MAAMC,UAAU,GAAG/B,KAAK,CAAC8B,MAAM,CAACvB,sBAAsB,CAACU,UAAU,CAAC,CAAC;EACnE,MAAMe,iBAAiB,GAAGhC,KAAK,CAAC8B,MAAM,CAACF,cAAc,CAAC;EAEtD,MAAMK,4BAA4B,GAAGjC,KAAK,CAAC8B,MAAM,CAE/C,IAAI,CAAC;EAEP,MAAM;IAAEI;EAAmB,CAAC,GAAG9B,aAAa,CA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Q,CACwB;EAAC,CACV,CAAC;AAE/B,CACF,CAEsB","ignoreList":[]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable import/group-exports */
|
|
4
|
+
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const RuntimeContext = /*#__PURE__*/React.createContext(null);
|
|
8
|
+
export const createBluetoothRuntime = bleManager => {
|
|
9
|
+
const listeners = new Map();
|
|
10
|
+
let currentManager;
|
|
11
|
+
let currentDevices = [];
|
|
12
|
+
const subscribers = new Set();
|
|
13
|
+
return {
|
|
14
|
+
bleManager,
|
|
15
|
+
get manager() {
|
|
16
|
+
return currentManager;
|
|
17
|
+
},
|
|
18
|
+
get devices() {
|
|
19
|
+
return currentDevices;
|
|
20
|
+
},
|
|
21
|
+
subscribe: (event, callback) => {
|
|
22
|
+
const eventListeners = listeners.get(event) ?? new Set();
|
|
23
|
+
eventListeners.add(callback);
|
|
24
|
+
listeners.set(event, eventListeners);
|
|
25
|
+
return () => eventListeners.delete(callback);
|
|
26
|
+
},
|
|
27
|
+
hasListeners: event => (listeners.get(event)?.size ?? 0) > 0,
|
|
28
|
+
emit: (event, value) => {
|
|
29
|
+
listeners.get(event)?.forEach(callback => callback(value));
|
|
30
|
+
subscribers.forEach(notify => notify());
|
|
31
|
+
},
|
|
32
|
+
setManager: manager => {
|
|
33
|
+
currentManager = manager;
|
|
34
|
+
subscribers.forEach(notify => notify());
|
|
35
|
+
},
|
|
36
|
+
upsertDevice: device => {
|
|
37
|
+
const existing = currentDevices.findIndex(item => item.id === device.id);
|
|
38
|
+
const next = {
|
|
39
|
+
id: device.id,
|
|
40
|
+
deviceData: device.deviceData,
|
|
41
|
+
device,
|
|
42
|
+
status: existing === -1 ? undefined : currentDevices[existing]?.status
|
|
43
|
+
};
|
|
44
|
+
currentDevices = existing === -1 ? [...currentDevices, next] : currentDevices.map((item, index) => index === existing ? next : item);
|
|
45
|
+
subscribers.forEach(notify => notify());
|
|
46
|
+
},
|
|
47
|
+
setDeviceStatus: ({
|
|
48
|
+
deviceData,
|
|
49
|
+
status
|
|
50
|
+
}) => {
|
|
51
|
+
currentDevices = currentDevices.map(item => item.id === deviceData.id ? {
|
|
52
|
+
...item,
|
|
53
|
+
deviceData,
|
|
54
|
+
status
|
|
55
|
+
} : item);
|
|
56
|
+
subscribers.forEach(notify => notify());
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export const BluetoothRuntimeProvider = ({
|
|
61
|
+
runtime,
|
|
62
|
+
children
|
|
63
|
+
}) => /*#__PURE__*/_jsx(RuntimeContext.Provider, {
|
|
64
|
+
value: runtime,
|
|
65
|
+
children: children
|
|
66
|
+
});
|
|
67
|
+
export const useBluetoothRuntime = () => {
|
|
68
|
+
const runtime = React.useContext(RuntimeContext);
|
|
69
|
+
if (!runtime) {
|
|
70
|
+
throw new Error("Bluetooth hooks must be rendered inside BTProvider");
|
|
71
|
+
}
|
|
72
|
+
return runtime;
|
|
73
|
+
};
|
|
74
|
+
export const useRuntimeEvent = (event, callback) => {
|
|
75
|
+
const runtime = useBluetoothRuntime();
|
|
76
|
+
const callbackRef = React.useRef(callback);
|
|
77
|
+
callbackRef.current = callback;
|
|
78
|
+
React.useEffect(() => runtime.subscribe(event, value => callbackRef.current(value)), [event, runtime]);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** Typed union exposed when a host listens to every accepted device. */
|
|
82
|
+
//# sourceMappingURL=runtime-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","jsx","_jsx","RuntimeContext","createContext","createBluetoothRuntime","bleManager","listeners","Map","currentManager","currentDevices","subscribers","Set","manager","devices","subscribe","event","callback","eventListeners","get","add","set","delete","hasListeners","size","emit","value","forEach","notify","setManager","upsertDevice","device","existing","findIndex","item","id","next","deviceData","status","undefined","map","index","setDeviceStatus","BluetoothRuntimeProvider","runtime","children","Provider","useBluetoothRuntime","useContext","Error","useRuntimeEvent","callbackRef","useRef","current","useEffect"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/runtime-context.tsx"],"mappings":";;AAAA;;AAEA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAkD/B,MAAMC,cAAc,gBAAGH,KAAK,CAACI,aAAa,CAA0B,IAAI,CAAC;AAEzE,OAAO,MAAMC,sBAAsB,GACjCC,UAAuB,IACF;EACrB,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAA8C,CAAC;EACxE,IAAIC,cAES;EACb,IAAIC,cAA+B,GAAG,EAAE;EACxC,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAAa,CAAC;EAEzC,OAAO;IACLN,UAAU;IACV,IAAIO,OAAOA,CAAA,EAAG;MACZ,OAAOJ,cAAc;IACvB,CAAC;IACD,IAAIK,OAAOA,CAAA,EAAG;MACZ,OAAOJ,cAAc;IACvB,CAAC;IACDK,SAAS,EAAEA,CAAKC,KAAmB,EAAEC,QAA4B,KAAK;MACpE,MAAMC,cAAc,GAAGX,SAAS,CAACY,GAAG,CAACH,KAAK,CAAC,IAAI,IAAIJ,GAAG,CAAC,CAAC;MAExDM,cAAc,CAACE,GAAG,CAACH,QAAoC,CAAC;MACxDV,SAAS,CAACc,GAAG,CAACL,KAAK,EAAEE,cAAc,CAAC;MAEpC,OAAO,MAAMA,cAAc,CAACI,MAAM,CAACL,QAAoC,CAAC;IAC1E,CAAC;IACDM,YAAY,EAAGP,KAAK,IAAK,CAACT,SAAS,CAACY,GAAG,CAACH,KAAK,CAAC,EAAEQ,IAAI,IAAI,CAAC,IAAI,CAAC;IAC9DC,IAAI,EAAEA,CAAKT,KAAmB,EAAEU,KAAQ,KAAK;MAC3CnB,SAAS,CAACY,GAAG,CAACH,KAAK,CAAC,EAAEW,OAAO,CAAEV,QAAQ,IAAKA,QAAQ,CAACS,KAAK,CAAC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C;IAC3C;EACF,CAAC;AACH,CAAC;AAED,OAAO,MAAMe,wBAAwB,GAAGA,CAAC;EACvCC,OAAO;EACPC;AACsD,CAAC,kBACvD3C,IAAA,CAACC,cAAc,CAAC2C,QAAQ;EAACpB,KAAK,EAAEkB,OAAQ;EAAAC,QAAA,EAAEA;AAAQ,CAA0B,CAC7E;AAED,OAAO,MAAME,mBAAmB,GAAGA,CAAA,KAAwB;EACzD,MAAMH,OAAO,GAAG5C,KAAK,CAACgD,UAAU,CAAC7C,cAAc,CAAC;EAEhD,IAAI,CAACyC,OAAO,EAAE;IACZ,MAAM,IAAIK,KAAK,CAAC,oDAAoD,CAAC;EACvE;EAEA,OAAOL,OAAO;AAChB,CAAC;AAED,OAAO,MAAMM,eAAe,GAAGA,CAC7BlC,KAAmB,EACnBC,QAA4B,KACnB;EACT,MAAM2B,OAAO,GAAGG,mBAAmB,CAAC,CAAC;EACrC,MAAMI,WAAW,GAAGnD,KAAK,CAACoD,MAAM,CAACnC,QAAQ,CAAC;EAE1CkC,WAAW,CAACE,OAAO,GAAGpC,QAAQ;EAE9BjB,KAAK,CAACsD,SAAS,CACb,MAAMV,OAAO,CAAC7B,SAAS,CAAIC,KAAK,EAAGU,KAAK,IAAKyB,WAAW,CAACE,OAAO,CAAC3B,KAAK,CAAC,CAAC,EACxE,CAACV,KAAK,EAAE4B,OAAO,CACjB,CAAC;AACH,CAAC;;AAED","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable import/group-exports */
|
|
4
|
+
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { useBluetoothRuntime } from "./runtime-context.js";
|
|
7
|
+
export const useBackgroundSync = ({
|
|
8
|
+
enabled: initialEnabled = false,
|
|
9
|
+
canEnable,
|
|
10
|
+
onEnabledChange
|
|
11
|
+
} = {}) => {
|
|
12
|
+
const runtime = useBluetoothRuntime();
|
|
13
|
+
const [enabled, setEnabledState] = React.useState(initialEnabled);
|
|
14
|
+
const [error, setError] = React.useState();
|
|
15
|
+
const [status, setStatus] = React.useState(initialEnabled ? "on" : "off");
|
|
16
|
+
const setEnabled = React.useCallback(async next => {
|
|
17
|
+
setError(undefined);
|
|
18
|
+
if (next && canEnable && !(await canEnable())) {
|
|
19
|
+
setStatus("restricted");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
runtime.manager?.setBackgroundScanEnabled(next);
|
|
24
|
+
await onEnabledChange?.(next);
|
|
25
|
+
setEnabledState(next);
|
|
26
|
+
setStatus(next ? "on" : "off");
|
|
27
|
+
} catch (cause) {
|
|
28
|
+
const nextError = cause instanceof Error ? cause : new Error(String(cause));
|
|
29
|
+
setError(nextError);
|
|
30
|
+
setStatus("blocked");
|
|
31
|
+
}
|
|
32
|
+
}, [canEnable, onEnabledChange, runtime]);
|
|
33
|
+
return {
|
|
34
|
+
enabled,
|
|
35
|
+
setEnabled,
|
|
36
|
+
status,
|
|
37
|
+
error,
|
|
38
|
+
reason: status === "restricted" ? "background access is restricted" : undefined
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=use-background-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useBluetoothRuntime","useBackgroundSync","enabled","initialEnabled","canEnable","onEnabledChange","runtime","setEnabledState","useState","error","setError","status","setStatus","setEnabled","useCallback","next","undefined","manager","setBackgroundScanEnabled","cause","nextError","Error","String","reason"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-background-sync.ts"],"mappings":";;AAAA;;AAEA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,SAASC,mBAAmB,QAAQ,sBAAmB;AAUvD,OAAO,MAAMC,iBAAiB,GAAGA,CAAC;EAChCC,OAAO,EAAEC,cAAc,GAAG,KAAK;EAC/BC,SAAS;EACTC;AACwB,CAAC,GAAG,CAAC,CAAC,KAM3B;EACH,MAAMC,O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
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable import/group-exports */
|
|
4
|
+
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { Platform } from "react-native";
|
|
7
|
+
import { State } from "react-native-ble-plx";
|
|
8
|
+
import { PERMISSIONS, requestMultiple } from "react-native-permissions";
|
|
9
|
+
const requestBluetoothPermission = async () => {
|
|
10
|
+
const permissions = Platform.select({
|
|
11
|
+
android: [PERMISSIONS.ANDROID.BLUETOOTH_SCAN, PERMISSIONS.ANDROID.BLUETOOTH_CONNECT],
|
|
12
|
+
ios: [PERMISSIONS.IOS.BLUETOOTH],
|
|
13
|
+
default: []
|
|
14
|
+
});
|
|
15
|
+
const result = await requestMultiple(permissions);
|
|
16
|
+
return Object.values(result).every(value => value === "granted");
|
|
17
|
+
};
|
|
18
|
+
export const useBluetoothState = ({
|
|
19
|
+
bleManager,
|
|
20
|
+
requestPermission = requestBluetoothPermission
|
|
21
|
+
} = {}) => {
|
|
22
|
+
const [state, setState] = React.useState(bleManager ? "off" : "unsupported");
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
if (!bleManager) {
|
|
25
|
+
setState("unsupported");
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const subscription = bleManager.onStateChange(nextState => {
|
|
29
|
+
setState(nextState === State.PoweredOn ? "on" : nextState === State.Unsupported ? "unsupported" : nextState === State.Unauthorized ? "unauthorized" : "off");
|
|
30
|
+
}, true);
|
|
31
|
+
return () => subscription.remove();
|
|
32
|
+
}, [bleManager]);
|
|
33
|
+
const request = React.useCallback(async () => {
|
|
34
|
+
const granted = await requestPermission();
|
|
35
|
+
if (!granted) {
|
|
36
|
+
setState("unauthorized");
|
|
37
|
+
}
|
|
38
|
+
return granted;
|
|
39
|
+
}, [requestPermission]);
|
|
40
|
+
return {
|
|
41
|
+
state,
|
|
42
|
+
requestPermission: request
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=use-bluetooth-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Platform","State","PERMISSIONS","requestMultiple","requestBluetoothPermission","permissions","select","android","ANDROID","BLUETOOTH_SCAN","BLUETOOTH_CONNECT","ios","IOS","BLUETOOTH","default","result","Object","values","every","value","useBluetoothState","bleManager","requestPermission","state","setState","useState","useEffect","subscription","onStateChange","nextState","PoweredOn","Unsupported","Unauthorized","remove","request","useCallback","granted"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-bluetooth-state.ts"],"mappings":";;AAAA;;AAEA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAAqBC,KAAK,QAAQ,sBAAsB;AACxD,SAASC,WAAW,EAAEC,eAAe,QAAQ,0BAA0B;AASvE,MAAMC,0BAA0B,GAAG,MAAAA,CAAA,KAA8B;EAC/D,MAAMC,WAAW,GAAGL,QAAQ,CAACM,MAAM,CAAC;IAClCC,OAAO,EAAE,CACPL,WAAW,CAACM,OAAO,CAACC,cAAc,EAClCP,WAAW,CAACM,OAAO,CAACE,iBAAiB,CACtC;IACDC,GAAG,EAAE,CAACT,WAAW,CAACU,GAAG,CAACC,SAAS,CAAC;IAChCC,OAAO,EAAE;EACX,CAAC,CAAC;EAEF,MAAMC,MAAM,GAAG,MAAMZ,eAAe,CAACE,WAAW,CAAC;EAEjD,OAAOW,MAAM,CAACC,MAAM,CAACF,MAAM,CAAC,CAACG,KAAK,CAAEC,KAAK,IAAKA,KAAK,KAAK,SAAS,CAAC;AACpE,CAAC;AAED,OAAO,MAAMC,iBAAiB,GAAGA,CAAC;EAChCC,UAAU;EACVC,iBAAiB,GAAGlB;AACI,CAAC,GAAG,CAAC,CAAC,KAG3B;EACH,MAAM,CAACmB,KAAK,EAAEC,QAAQ,CAAC,GAAGzB,KAAK,CAAC0B,QAAQ,CACtCJ,UAAU,GAAG,KAAK,GAAG,aACvB,CAAC;EAEDtB,KAAK,CAAC2B,SAAS,CAAC,MAAM;IACpB,IAAI,CAACL,UAAU,EAAE;MACfG,QAAQ,CAAC,aAAa,CAAC;MAEvB;IACF;IAEA,MAAMG,YAAY,GAAGN,UAAU,CAACO,aAAa,CAAEC,SAAS,IAAK;MAC3DL,QAAQ,CACNK,SAAS,KAAK5B,KAAK,CAAC6B,SAAS,GACzB,IAAI,GACJD,SAAS,KAAK5B,KAAK,CAAC8B,WAAW,GAC7B,aAAa,GACbF,SAAS,KAAK5B,KAAK,CAAC+B,YAAY,GAC9B,cAAc,GACd,KACV,CAAC;IACH,CAAC,EAAE,IAAI,CAAC;IAER,OAAO,MAAML,YAAY,CAACM,MAAM,CAAC,CAAC;EACpC,CAAC,EAAE,CAACZ,UAAU,CAAC,CAAC;EAEhB,MAAMa,OAAO,GAAGnC,KAAK,CAACoC,WAAW,CAAC,YAAY;IAC5C,MAAMC,OAAO,GAAG,MAAMd,iBAAiB,CAAC,CAAC;IAEzC,IAAI,CAACc,OAAO,EAAE;MAACZ,QAAQ,CAAC,cAAc,CAAC;IAAC;IAExC,OAAOY,OAAO;EAChB,CAAC,EAAE,CAACd,iBAAiB,CAAC,CAAC;EAEvB,OAAO;IAAEC,KAAK;IAAED,iBAAiB,EAAEY;EAAQ,CAAC;AAC9C,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useBluetoothRuntime } from "./runtime-context.js";
|
|
5
|
+
export const useDeviceConnection = id => {
|
|
6
|
+
const runtime = useBluetoothRuntime();
|
|
7
|
+
const [status, setStatus] = React.useState(() => runtime.devices.find(device => device.id === id)?.status);
|
|
8
|
+
const [events, setEvents] = React.useState([]);
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
const unsubStatus = runtime.subscribe("status", value => {
|
|
11
|
+
if (value.deviceData.id === id) {
|
|
12
|
+
setStatus(value.status);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const unsubEvent = runtime.subscribe("connection", event => {
|
|
16
|
+
if (event.deviceData.id === id) {
|
|
17
|
+
setEvents(current => [...current, event]);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return () => {
|
|
21
|
+
unsubStatus();
|
|
22
|
+
unsubEvent();
|
|
23
|
+
};
|
|
24
|
+
}, [id, runtime]);
|
|
25
|
+
return {
|
|
26
|
+
status,
|
|
27
|
+
events
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=use-device-connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useBluetoothRuntime","useDeviceConnection","id","runtime","status","setStatus","useState","devices","find","device","events","setEvents","useEffect","unsubStatus","subscribe","value","deviceData","unsubEvent","event","current"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-device-connection.ts"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAK9B,SAASC,mBAAmB,QAAQ,sBAAmB;AAEvD,OAAO,MAAMC,mBAAmB,GAC9BC,EAAW,IAC6D;EACxE,MAAMC,OAAO,GAAGH,mBAAmB,CAAC,CAAC;EAErC,MAAM,CAACI,MAAM,EAAEC,SAAS,CAAC,GAAGN,KAAK,CAACO,QAAQ,CACxC,MAAMH,OAAO,CAACI,OAAO,CAACC,IAAI,CAAEC,MAAM,IAAKA,MAAM,CAACP,EAAE,KAAKA,EAAE,CAAC,EAAEE,MAC5D,CAAC;EAED,MAAM,CAACM,MAAM,EAAEC,SAAS,CAAC,GAAGZ,KAAK,CAACO,QAAQ,CAAmC,EAAE,CAAC;EAEhFP,KAAK,CAACa,SAAS,CAAC,MAAM;IACpB,MAAMC,WAAW,GAAGV,OAAO,CAACW,SAAS,CACnC,QAAQ,EACPC,KAAK,IAAK;MACT,IAAIA,KAAK,CAACC,UAAU,CAACd,EAAE,KAAKA,EAAE,EAAE;QAACG,SAAS,CAACU,KAAK,CAACX,MAAM,CAAC;MAAC;IAC3D,CACF,CAAC;IAED,MAAMa,UAAU,GAAGd,OAAO,CAACW,SAAS,CAAwB,YAAY,EAAGI,KAAK,IAAK;MACnF,IAAIA,KAAK,CAACF,UAAU,CAACd,EAAE,KAAKA,EAAE,EAAE;QAACS,SAAS,CAAEQ,OAAO,IAAK,CAAC,GAAGA,OAAO,EAAED,KAAK,CAAC,CAAC;MAAC;IAC/E,CAAC,CAAC;IAEF,OAAO,MAAM;MACXL,WAAW,CAAC,CAAC;MACbI,UAAU,CAAC,CAAC;IACd,CAAC;EACH,CAAC,EAAE,CAACf,EAAE,EAAEC,OAAO,CAAC,CAAC;EAEjB,OAAO;IAAEC,MAAM;IAAEM;EAAO,CAAC;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export const useHealthImport = ({
|
|
5
|
+
types,
|
|
6
|
+
background = false,
|
|
7
|
+
adapter
|
|
8
|
+
}) => {
|
|
9
|
+
const [enabled, setEnabled] = React.useState(false);
|
|
10
|
+
const [statusByType, setStatusByType] = React.useState({});
|
|
11
|
+
const [error, setError] = React.useState();
|
|
12
|
+
const refresh = React.useCallback(async () => {
|
|
13
|
+
try {
|
|
14
|
+
const entries = await Promise.all(types.map(async type => [type, await adapter.getStatus(type)]));
|
|
15
|
+
setStatusByType(Object.fromEntries(entries));
|
|
16
|
+
} catch (cause) {
|
|
17
|
+
setError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
18
|
+
}
|
|
19
|
+
}, [adapter, types]);
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
void refresh();
|
|
22
|
+
}, [refresh]);
|
|
23
|
+
const setEnabledForTypes = React.useCallback(async next => {
|
|
24
|
+
setError(undefined);
|
|
25
|
+
if (next) {
|
|
26
|
+
await adapter.request(types, background);
|
|
27
|
+
await refresh();
|
|
28
|
+
}
|
|
29
|
+
setEnabled(next);
|
|
30
|
+
}, [adapter, background, refresh, types]);
|
|
31
|
+
const notShared = types.filter(type => statusByType[type] === "refused");
|
|
32
|
+
return {
|
|
33
|
+
enabled,
|
|
34
|
+
setEnabled: setEnabledForTypes,
|
|
35
|
+
statusByType: statusByType,
|
|
36
|
+
notShared,
|
|
37
|
+
error
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=use-health-import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useHealthImport","types","background","adapter","enabled","setEnabled","useState","statusByType","setStatusByType","error","setError","refresh","useCallback","entries","Promise","all","map","type","getStatus","Object","fromEntries","cause","Error","String","useEffect","setEnabledForTypes","next","undefined","request","notShared","filter"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-health-import.ts"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAO9B,OAAO,MAAMC,eAAe,GAAGA,CAAuB;EACpDC,KAAK;EACLC,UAAU,GAAG,KAAK;EAClBC;AAKF,CAAC,KAMI;EACH,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAAC,KAAK,CAAC;EACnD,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGT,KAAK,CAACO,QAAQ,CAAyB,CAAC,CAAC,CAAC;EAClF,MAAM,CAACG,KAAK,EAAEC,QAAQ,CAAC,GAAGX,KAAK,CAACO,QAAQ,CAAQ,CAAC;EAEjD,MAAMK,OAAO,GAAGZ,KAAK,CAACa,WAAW,CAAC,YAAY;IAC5C,IAAI;MACF,MAAMC,OAAO,GAAG,MAAMC,OAAO,CAACC,GAAG,CAACd,KAAK,CAACe,GAAG,CAAC,MAAOC,IAAI,IAAK,CAACA,IAAI,EAAE,MAAMd,OAAO,CAACe,SAAS,CAACD,IAAI,CAAC,CAAU,CAAC,CAAC;MAE5GT,eAAe,CAACW,MAAM,CAACC,WAAW,CAACP,OAAO,CAAC,CAAC;IAC9C,CAAC,CAAC,OAAOQ,KAAK,EAAE;MACdX,QAAQ,CAACW,KAAK,YAAYC,KAAK,GAAGD,KAAK,GAAG,IAAIC,KAAK,CAACC,MAAM,CAACF,KAAK,CAAC,CAAC,CAAC;IACrE;EACF,CAAC,EAAE,CAAClB,OAAO,EAAEF,KAAK,CAAC,CAAC;EAEpBF,KAAK,CAACyB,SAAS,CAAC,MAAM;IAAE,KAAKb,OAAO,CAAC,CAAC;EAAE,CAAC,EAAE,CAACA,OAAO,CAAC,CAAC;EAErD,MAAMc,kBAAkB,GAAG1B,KAAK,CAACa,WAAW,CAAC,MAAOc,IAAa,IAAK;IACpEhB,QAAQ,CAACiB,SAAS,CAAC;IACnB,IAAID,IAAI,EAAE;MACR,MAAMvB,OAAO,CAACyB,OAAO,CAAC3B,KAAK,EAAEC,UAAU,CAAC;MACxC,MAAMS,OAAO,CAAC,CAAC;IACjB;IACAN,UAAU,CAACqB,IAAI,CAAC;EAClB,CAAC,EAAE,CAACvB,OAAO,EAAED,UAAU,EAAES,OAAO,EAAEV,KAAK,CAAC,CAAC;EAEzC,MAAM4B,SAAS,GAAG5B,KAAK,CAAC6B,MAAM,CAAEb,IAAI,IAAKV,YAAY,CAACU,IAAI,CAAC,KAAK,SAAS,CAAC;EAE1E,OAAO;IAAEb,OAAO;IAAEC,UAAU,EAAEoB,kBAAkB;IAAElB,YAAY,EAAEA,YAAqB;IAAEsB,SAAS;IAAEpB;EAAM,CAAC;AAC3G,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useBluetoothRuntime } from "./runtime-context.js";
|
|
5
|
+
export const useMeasurements = (onResult, {
|
|
6
|
+
policy = "all",
|
|
7
|
+
maxResults = 100
|
|
8
|
+
} = {}) => {
|
|
9
|
+
const runtime = useBluetoothRuntime();
|
|
10
|
+
const [measurements, setMeasurements] = React.useState([]);
|
|
11
|
+
const seen = React.useRef(new Set());
|
|
12
|
+
const onResultRef = React.useRef(onResult);
|
|
13
|
+
onResultRef.current = onResult;
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
return runtime.subscribe("result", result => {
|
|
16
|
+
if (seen.current.has(result.id)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
seen.current.add(result.id);
|
|
20
|
+
setMeasurements(current => [...current, result].slice(-maxResults));
|
|
21
|
+
onResultRef.current?.(result);
|
|
22
|
+
});
|
|
23
|
+
}, [maxResults, runtime]);
|
|
24
|
+
|
|
25
|
+
// The manager applies device policies at source; this is a host-side guard for
|
|
26
|
+
// consumers that want a single stream policy without changing the scan config.
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
if (policy === "all") {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
setMeasurements(current => {
|
|
32
|
+
const byKind = new Set();
|
|
33
|
+
return current.filter(result => {
|
|
34
|
+
const key = String(result.data.measurementTypeKey);
|
|
35
|
+
if (policy === "first-reading-per-kind-per-connection" && byKind.has(key)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
byKind.add(key);
|
|
39
|
+
return true;
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}, [policy]);
|
|
43
|
+
return {
|
|
44
|
+
measurements,
|
|
45
|
+
clear: () => {
|
|
46
|
+
seen.current.clear();
|
|
47
|
+
setMeasurements([]);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=use-measurements.js.map
|