@ovok/native 1.5.6 → 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.
Files changed (643) hide show
  1. package/README.md +27 -17
  2. package/app.plugin.js +104 -0
  3. package/lib/commonjs/index.js +11 -0
  4. package/lib/commonjs/index.js.map +1 -1
  5. package/lib/commonjs/modules/auth/delete-account-button/components/delete-account-button.js +2 -0
  6. package/lib/commonjs/modules/auth/delete-account-button/components/delete-account-button.js.map +1 -1
  7. package/lib/commonjs/modules/auth/hooks/use-rate-limit-cooldown.js +23 -0
  8. package/lib/commonjs/modules/auth/hooks/use-rate-limit-cooldown.js.map +1 -0
  9. package/lib/commonjs/modules/auth/hooks/use-session.js +91 -0
  10. package/lib/commonjs/modules/auth/hooks/use-session.js.map +1 -0
  11. package/lib/commonjs/modules/auth/index.js +44 -0
  12. package/lib/commonjs/modules/auth/index.js.map +1 -1
  13. package/lib/commonjs/modules/auth/logout-button/components/logout-button.js +3 -1
  14. package/lib/commonjs/modules/auth/logout-button/components/logout-button.js.map +1 -1
  15. package/lib/commonjs/modules/auth/register/components/form/inputs.js +48 -1
  16. package/lib/commonjs/modules/auth/register/components/form/inputs.js.map +1 -1
  17. package/lib/commonjs/modules/auth/register/components/form/register-button.js +4 -0
  18. package/lib/commonjs/modules/auth/register/components/form/register-button.js.map +1 -1
  19. package/lib/commonjs/modules/auth/register/components/form/register-form-provider.js +6 -0
  20. package/lib/commonjs/modules/auth/register/components/form/register-form-provider.js.map +1 -1
  21. package/lib/commonjs/modules/auth/reset-password/components/form/inputs.js +12 -0
  22. package/lib/commonjs/modules/auth/reset-password/components/form/inputs.js.map +1 -1
  23. package/lib/commonjs/modules/auth/reset-password/components/form/reset-password-button.js +4 -0
  24. package/lib/commonjs/modules/auth/reset-password/components/form/reset-password-button.js.map +1 -1
  25. package/lib/commonjs/modules/auth/reset-password/components/form/reset-password-form-provider.js +7 -1
  26. package/lib/commonjs/modules/auth/reset-password/components/form/reset-password-form-provider.js.map +1 -1
  27. package/lib/commonjs/modules/auth/session/components/session-list.js +82 -0
  28. package/lib/commonjs/modules/auth/session/components/session-list.js.map +1 -0
  29. package/lib/commonjs/modules/auth/session/events.js +19 -0
  30. package/lib/commonjs/modules/auth/session/events.js.map +1 -0
  31. package/lib/commonjs/modules/auth/session/index.js +13 -0
  32. package/lib/commonjs/modules/auth/session/index.js.map +1 -0
  33. package/lib/commonjs/modules/auth/session/types/session-list-props.js +6 -0
  34. package/lib/commonjs/modules/auth/session/types/session-list-props.js.map +1 -0
  35. package/lib/commonjs/modules/auth/sign-in/components/form/inputs.js +25 -0
  36. package/lib/commonjs/modules/auth/sign-in/components/form/inputs.js.map +1 -1
  37. package/lib/commonjs/modules/auth/sign-in/components/form/login-form-provider.js +48 -1
  38. package/lib/commonjs/modules/auth/sign-in/components/form/login-form-provider.js.map +1 -1
  39. package/lib/commonjs/modules/auth/sign-in/components/form/mfa-code-input.js +58 -0
  40. package/lib/commonjs/modules/auth/sign-in/components/form/mfa-code-input.js.map +1 -0
  41. package/lib/commonjs/modules/auth/sign-in/components/form/sign-in-with-email.js +2 -0
  42. package/lib/commonjs/modules/auth/sign-in/components/form/sign-in-with-email.js.map +1 -1
  43. package/lib/commonjs/modules/auth/sign-in/components/form/signin-button.js +13 -5
  44. package/lib/commonjs/modules/auth/sign-in/components/form/signin-button.js.map +1 -1
  45. package/lib/commonjs/modules/auth/types/session.js +2 -0
  46. package/lib/commonjs/modules/auth/types/session.js.map +1 -0
  47. package/lib/commonjs/modules/auth/utils/rate-limit.js +37 -0
  48. package/lib/commonjs/modules/auth/utils/rate-limit.js.map +1 -0
  49. package/lib/commonjs/modules/background-sync/android-bluetooth-foreground-service.js +3 -2
  50. package/lib/commonjs/modules/background-sync/android-bluetooth-foreground-service.js.map +1 -1
  51. package/lib/commonjs/modules/background-sync/background-safe-storage.js +79 -0
  52. package/lib/commonjs/modules/background-sync/background-safe-storage.js.map +1 -0
  53. package/lib/commonjs/modules/background-sync/index.js +11 -0
  54. package/lib/commonjs/modules/background-sync/index.js.map +1 -1
  55. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js +123 -21
  56. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  57. package/lib/commonjs/modules/bt-management/hooks/runtime-context.js +91 -0
  58. package/lib/commonjs/modules/bt-management/hooks/runtime-context.js.map +1 -0
  59. package/lib/commonjs/modules/bt-management/hooks/use-background-sync.js +47 -0
  60. package/lib/commonjs/modules/bt-management/hooks/use-background-sync.js.map +1 -0
  61. package/lib/commonjs/modules/bt-management/hooks/use-bluetooth-state.js +51 -0
  62. package/lib/commonjs/modules/bt-management/hooks/use-bluetooth-state.js.map +1 -0
  63. package/lib/commonjs/modules/bt-management/hooks/use-device-connection.js +36 -0
  64. package/lib/commonjs/modules/bt-management/hooks/use-device-connection.js.map +1 -0
  65. package/lib/commonjs/modules/bt-management/hooks/use-health-import.js +46 -0
  66. package/lib/commonjs/modules/bt-management/hooks/use-health-import.js.map +1 -0
  67. package/lib/commonjs/modules/bt-management/hooks/use-measurements.js +57 -0
  68. package/lib/commonjs/modules/bt-management/hooks/use-measurements.js.map +1 -0
  69. package/lib/commonjs/modules/bt-management/hooks/use-nearby-devices.js +26 -0
  70. package/lib/commonjs/modules/bt-management/hooks/use-nearby-devices.js.map +1 -0
  71. package/lib/commonjs/modules/bt-management/hooks/use-paired-devices.js +49 -0
  72. package/lib/commonjs/modules/bt-management/hooks/use-paired-devices.js.map +1 -0
  73. package/lib/commonjs/modules/bt-management/index.js +143 -0
  74. package/lib/commonjs/modules/bt-management/index.js.map +1 -1
  75. package/lib/commonjs/modules/bt-management/services/background-sync/background-sync-coordinator.js +41 -4
  76. package/lib/commonjs/modules/bt-management/services/background-sync/background-sync-coordinator.js.map +1 -1
  77. package/lib/commonjs/modules/bt-management/services/bt-manager.js +75 -4
  78. package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
  79. package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js +57 -0
  80. package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
  81. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +111 -3
  82. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  83. package/lib/commonjs/modules/bt-management/services/devices/measurement-state-machine.js +5 -3
  84. package/lib/commonjs/modules/bt-management/services/devices/measurement-state-machine.js.map +1 -1
  85. package/lib/commonjs/modules/bt-management/services/devices/spo/spo2.main-services.js +12 -0
  86. package/lib/commonjs/modules/bt-management/services/devices/spo/spo2.main-services.js.map +1 -1
  87. package/lib/commonjs/modules/bt-management/testing/fake-ble-manager.js +52 -0
  88. package/lib/commonjs/modules/bt-management/testing/fake-ble-manager.js.map +1 -0
  89. package/lib/commonjs/modules/bt-management/testing/index.js +28 -0
  90. package/lib/commonjs/modules/bt-management/testing/index.js.map +1 -0
  91. package/lib/commonjs/modules/bt-management/testing/recorded-frames.js +23 -0
  92. package/lib/commonjs/modules/bt-management/testing/recorded-frames.js.map +1 -0
  93. package/lib/commonjs/modules/bt-management/types/bluetooth-error.js +80 -0
  94. package/lib/commonjs/modules/bt-management/types/bluetooth-error.js.map +1 -0
  95. package/lib/commonjs/modules/bt-management/types/device-connection-event.js +6 -0
  96. package/lib/commonjs/modules/bt-management/types/device-connection-event.js.map +1 -0
  97. package/lib/commonjs/modules/bt-management/types/result-policy.js +6 -0
  98. package/lib/commonjs/modules/bt-management/types/result-policy.js.map +1 -0
  99. package/lib/commonjs/modules/bt-management/utils/result-identity.js +63 -0
  100. package/lib/commonjs/modules/bt-management/utils/result-identity.js.map +1 -0
  101. package/lib/commonjs/modules/data-sync/components/android/android-health-connect-authorization-provider.js +8 -2
  102. package/lib/commonjs/modules/data-sync/components/android/android-health-connect-authorization-provider.js.map +1 -1
  103. package/lib/commonjs/modules/data-sync/services/base-health-sync-service.js +23 -4
  104. package/lib/commonjs/modules/data-sync/services/base-health-sync-service.js.map +1 -1
  105. package/lib/commonjs/modules/data-sync/services/managers/data-processor.js +2 -2
  106. package/lib/commonjs/modules/data-sync/services/managers/data-processor.js.map +1 -1
  107. package/lib/commonjs/modules/data-sync/services/managers/sync-progress-manager.js +1 -1
  108. package/lib/commonjs/modules/data-sync/services/managers/sync-progress-manager.js.map +1 -1
  109. package/lib/commonjs/modules/data-sync/utils/retry-save.js +65 -0
  110. package/lib/commonjs/modules/data-sync/utils/retry-save.js.map +1 -0
  111. package/lib/commonjs/modules/helpers/form-items/form-field.js +2 -0
  112. package/lib/commonjs/modules/helpers/form-items/form-field.js.map +1 -1
  113. package/lib/commonjs/modules/helpers/index.js +12 -0
  114. package/lib/commonjs/modules/helpers/index.js.map +1 -1
  115. package/lib/commonjs/modules/helpers/utils/s-log.js +4 -13
  116. package/lib/commonjs/modules/helpers/utils/s-log.js.map +1 -1
  117. package/lib/commonjs/modules/helpers/utils/sentry-logger.js +28 -17
  118. package/lib/commonjs/modules/helpers/utils/sentry-logger.js.map +1 -1
  119. package/lib/commonjs/modules/helpers/utils/telemetry.js +143 -0
  120. package/lib/commonjs/modules/helpers/utils/telemetry.js.map +1 -0
  121. package/lib/commonjs/modules/image/components/optimized-image.js +24 -2
  122. package/lib/commonjs/modules/image/components/optimized-image.js.map +1 -1
  123. package/lib/commonjs/modules/questionnaire-response-form/components/content/questionnaire-content-error.js +18 -9
  124. package/lib/commonjs/modules/questionnaire-response-form/components/content/questionnaire-content-error.js.map +1 -1
  125. package/lib/commonjs/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.js +3 -2
  126. package/lib/commonjs/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.js.map +1 -1
  127. package/lib/commonjs/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.js +4 -2
  128. package/lib/commonjs/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.js.map +1 -1
  129. package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-form-provider.js +42 -17
  130. package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-form-provider.js.map +1 -1
  131. package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-navigation-provider.js +2 -1
  132. package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-navigation-provider.js.map +1 -1
  133. package/lib/commonjs/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.js.map +1 -1
  134. package/lib/commonjs/modules/tile/components/task-icon.js +2 -1
  135. package/lib/commonjs/modules/tile/components/task-icon.js.map +1 -1
  136. package/lib/commonjs/modules/ui/components/background-sync-setting.js +113 -0
  137. package/lib/commonjs/modules/ui/components/background-sync-setting.js.map +1 -0
  138. package/lib/commonjs/modules/ui/components/bluetooth-state-notice.js +105 -0
  139. package/lib/commonjs/modules/ui/components/bluetooth-state-notice.js.map +1 -0
  140. package/lib/commonjs/modules/ui/components/ecg-strip-viewer.js +165 -0
  141. package/lib/commonjs/modules/ui/components/ecg-strip-viewer.js.map +1 -0
  142. package/lib/commonjs/modules/ui/components/health-import-card.js +130 -0
  143. package/lib/commonjs/modules/ui/components/health-import-card.js.map +1 -0
  144. package/lib/commonjs/modules/ui/components/manual-entry-form.js +123 -0
  145. package/lib/commonjs/modules/ui/components/manual-entry-form.js.map +1 -0
  146. package/lib/commonjs/modules/ui/components/pairing-flow.js +222 -0
  147. package/lib/commonjs/modules/ui/components/pairing-flow.js.map +1 -0
  148. package/lib/commonjs/modules/ui/components/supported-devices-catalog-list.js +99 -0
  149. package/lib/commonjs/modules/ui/components/supported-devices-catalog-list.js.map +1 -0
  150. package/lib/commonjs/modules/ui/components/urine-test-result.js +94 -0
  151. package/lib/commonjs/modules/ui/components/urine-test-result.js.map +1 -0
  152. package/lib/commonjs/modules/ui/index.js +116 -0
  153. package/lib/commonjs/modules/ui/index.js.map +1 -0
  154. package/lib/commonjs/modules/ui/types.js +6 -0
  155. package/lib/commonjs/modules/ui/types.js.map +1 -0
  156. package/lib/commonjs/modules/ui/use-ovok-ui.js +51 -0
  157. package/lib/commonjs/modules/ui/use-ovok-ui.js.map +1 -0
  158. package/lib/module/index.js +1 -0
  159. package/lib/module/index.js.map +1 -1
  160. package/lib/module/modules/auth/delete-account-button/components/delete-account-button.js +2 -0
  161. package/lib/module/modules/auth/delete-account-button/components/delete-account-button.js.map +1 -1
  162. package/lib/module/modules/auth/hooks/use-rate-limit-cooldown.js +17 -0
  163. package/lib/module/modules/auth/hooks/use-rate-limit-cooldown.js.map +1 -0
  164. package/lib/module/modules/auth/hooks/use-session.js +85 -0
  165. package/lib/module/modules/auth/hooks/use-session.js.map +1 -0
  166. package/lib/module/modules/auth/index.js +4 -0
  167. package/lib/module/modules/auth/index.js.map +1 -1
  168. package/lib/module/modules/auth/logout-button/components/logout-button.js +3 -1
  169. package/lib/module/modules/auth/logout-button/components/logout-button.js.map +1 -1
  170. package/lib/module/modules/auth/register/components/form/inputs.js +48 -1
  171. package/lib/module/modules/auth/register/components/form/inputs.js.map +1 -1
  172. package/lib/module/modules/auth/register/components/form/register-button.js +4 -0
  173. package/lib/module/modules/auth/register/components/form/register-button.js.map +1 -1
  174. package/lib/module/modules/auth/register/components/form/register-form-provider.js +6 -0
  175. package/lib/module/modules/auth/register/components/form/register-form-provider.js.map +1 -1
  176. package/lib/module/modules/auth/reset-password/components/form/inputs.js +12 -0
  177. package/lib/module/modules/auth/reset-password/components/form/inputs.js.map +1 -1
  178. package/lib/module/modules/auth/reset-password/components/form/reset-password-button.js +4 -0
  179. package/lib/module/modules/auth/reset-password/components/form/reset-password-button.js.map +1 -1
  180. package/lib/module/modules/auth/reset-password/components/form/reset-password-form-provider.js +7 -1
  181. package/lib/module/modules/auth/reset-password/components/form/reset-password-form-provider.js.map +1 -1
  182. package/lib/module/modules/auth/session/components/session-list.js +76 -0
  183. package/lib/module/modules/auth/session/components/session-list.js.map +1 -0
  184. package/lib/module/modules/auth/session/events.js +13 -0
  185. package/lib/module/modules/auth/session/events.js.map +1 -0
  186. package/lib/module/modules/auth/session/index.js +4 -0
  187. package/lib/module/modules/auth/session/index.js.map +1 -0
  188. package/lib/module/modules/auth/session/types/session-list-props.js +4 -0
  189. package/lib/module/modules/auth/session/types/session-list-props.js.map +1 -0
  190. package/lib/module/modules/auth/sign-in/components/form/inputs.js +25 -0
  191. package/lib/module/modules/auth/sign-in/components/form/inputs.js.map +1 -1
  192. package/lib/module/modules/auth/sign-in/components/form/login-form-provider.js +48 -1
  193. package/lib/module/modules/auth/sign-in/components/form/login-form-provider.js.map +1 -1
  194. package/lib/module/modules/auth/sign-in/components/form/mfa-code-input.js +52 -0
  195. package/lib/module/modules/auth/sign-in/components/form/mfa-code-input.js.map +1 -0
  196. package/lib/module/modules/auth/sign-in/components/form/sign-in-with-email.js +2 -0
  197. package/lib/module/modules/auth/sign-in/components/form/sign-in-with-email.js.map +1 -1
  198. package/lib/module/modules/auth/sign-in/components/form/signin-button.js +13 -5
  199. package/lib/module/modules/auth/sign-in/components/form/signin-button.js.map +1 -1
  200. package/lib/module/modules/auth/types/session.js +2 -0
  201. package/lib/module/modules/auth/types/session.js.map +1 -0
  202. package/lib/module/modules/auth/utils/rate-limit.js +31 -0
  203. package/lib/module/modules/auth/utils/rate-limit.js.map +1 -0
  204. package/lib/module/modules/background-sync/android-bluetooth-foreground-service.js +3 -2
  205. package/lib/module/modules/background-sync/android-bluetooth-foreground-service.js.map +1 -1
  206. package/lib/module/modules/background-sync/background-safe-storage.js +74 -0
  207. package/lib/module/modules/background-sync/background-safe-storage.js.map +1 -0
  208. package/lib/module/modules/background-sync/index.js +1 -0
  209. package/lib/module/modules/background-sync/index.js.map +1 -1
  210. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +123 -21
  211. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  212. package/lib/module/modules/bt-management/hooks/runtime-context.js +82 -0
  213. package/lib/module/modules/bt-management/hooks/runtime-context.js.map +1 -0
  214. package/lib/module/modules/bt-management/hooks/use-background-sync.js +41 -0
  215. package/lib/module/modules/bt-management/hooks/use-background-sync.js.map +1 -0
  216. package/lib/module/modules/bt-management/hooks/use-bluetooth-state.js +45 -0
  217. package/lib/module/modules/bt-management/hooks/use-bluetooth-state.js.map +1 -0
  218. package/lib/module/modules/bt-management/hooks/use-device-connection.js +30 -0
  219. package/lib/module/modules/bt-management/hooks/use-device-connection.js.map +1 -0
  220. package/lib/module/modules/bt-management/hooks/use-health-import.js +40 -0
  221. package/lib/module/modules/bt-management/hooks/use-health-import.js.map +1 -0
  222. package/lib/module/modules/bt-management/hooks/use-measurements.js +51 -0
  223. package/lib/module/modules/bt-management/hooks/use-measurements.js.map +1 -0
  224. package/lib/module/modules/bt-management/hooks/use-nearby-devices.js +20 -0
  225. package/lib/module/modules/bt-management/hooks/use-nearby-devices.js.map +1 -0
  226. package/lib/module/modules/bt-management/hooks/use-paired-devices.js +43 -0
  227. package/lib/module/modules/bt-management/hooks/use-paired-devices.js.map +1 -0
  228. package/lib/module/modules/bt-management/index.js +13 -0
  229. package/lib/module/modules/bt-management/index.js.map +1 -1
  230. package/lib/module/modules/bt-management/services/background-sync/background-sync-coordinator.js +41 -4
  231. package/lib/module/modules/bt-management/services/background-sync/background-sync-coordinator.js.map +1 -1
  232. package/lib/module/modules/bt-management/services/bt-manager.js +75 -4
  233. package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
  234. package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js +57 -0
  235. package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
  236. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +111 -3
  237. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  238. package/lib/module/modules/bt-management/services/devices/measurement-state-machine.js +5 -3
  239. package/lib/module/modules/bt-management/services/devices/measurement-state-machine.js.map +1 -1
  240. package/lib/module/modules/bt-management/services/devices/spo/spo2.main-services.js +12 -0
  241. package/lib/module/modules/bt-management/services/devices/spo/spo2.main-services.js.map +1 -1
  242. package/lib/module/modules/bt-management/testing/fake-ble-manager.js +48 -0
  243. package/lib/module/modules/bt-management/testing/fake-ble-manager.js.map +1 -0
  244. package/lib/module/modules/bt-management/testing/index.js +5 -0
  245. package/lib/module/modules/bt-management/testing/index.js.map +1 -0
  246. package/lib/module/modules/bt-management/testing/recorded-frames.js +17 -0
  247. package/lib/module/modules/bt-management/testing/recorded-frames.js.map +1 -0
  248. package/lib/module/modules/bt-management/types/bluetooth-error.js +74 -0
  249. package/lib/module/modules/bt-management/types/bluetooth-error.js.map +1 -0
  250. package/lib/module/modules/bt-management/types/device-connection-event.js +4 -0
  251. package/lib/module/modules/bt-management/types/device-connection-event.js.map +1 -0
  252. package/lib/module/modules/bt-management/types/result-policy.js +4 -0
  253. package/lib/module/modules/bt-management/types/result-policy.js.map +1 -0
  254. package/lib/module/modules/bt-management/utils/result-identity.js +57 -0
  255. package/lib/module/modules/bt-management/utils/result-identity.js.map +1 -0
  256. package/lib/module/modules/data-sync/components/android/android-health-connect-authorization-provider.js +8 -2
  257. package/lib/module/modules/data-sync/components/android/android-health-connect-authorization-provider.js.map +1 -1
  258. package/lib/module/modules/data-sync/services/base-health-sync-service.js +23 -4
  259. package/lib/module/modules/data-sync/services/base-health-sync-service.js.map +1 -1
  260. package/lib/module/modules/data-sync/services/managers/data-processor.js +2 -2
  261. package/lib/module/modules/data-sync/services/managers/data-processor.js.map +1 -1
  262. package/lib/module/modules/data-sync/services/managers/sync-progress-manager.js +1 -1
  263. package/lib/module/modules/data-sync/services/managers/sync-progress-manager.js.map +1 -1
  264. package/lib/module/modules/data-sync/utils/retry-save.js +60 -0
  265. package/lib/module/modules/data-sync/utils/retry-save.js.map +1 -0
  266. package/lib/module/modules/helpers/form-items/form-field.js +2 -0
  267. package/lib/module/modules/helpers/form-items/form-field.js.map +1 -1
  268. package/lib/module/modules/helpers/index.js +1 -0
  269. package/lib/module/modules/helpers/index.js.map +1 -1
  270. package/lib/module/modules/helpers/utils/s-log.js +4 -12
  271. package/lib/module/modules/helpers/utils/s-log.js.map +1 -1
  272. package/lib/module/modules/helpers/utils/sentry-logger.js +26 -14
  273. package/lib/module/modules/helpers/utils/sentry-logger.js.map +1 -1
  274. package/lib/module/modules/helpers/utils/telemetry.js +131 -0
  275. package/lib/module/modules/helpers/utils/telemetry.js.map +1 -0
  276. package/lib/module/modules/image/components/optimized-image.js +25 -3
  277. package/lib/module/modules/image/components/optimized-image.js.map +1 -1
  278. package/lib/module/modules/questionnaire-response-form/components/content/questionnaire-content-error.js +20 -11
  279. package/lib/module/modules/questionnaire-response-form/components/content/questionnaire-content-error.js.map +1 -1
  280. package/lib/module/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.js +3 -2
  281. package/lib/module/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.js.map +1 -1
  282. package/lib/module/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.js +4 -2
  283. package/lib/module/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.js.map +1 -1
  284. package/lib/module/modules/questionnaire-response-form/components/questionnaire-form-provider.js +42 -17
  285. package/lib/module/modules/questionnaire-response-form/components/questionnaire-form-provider.js.map +1 -1
  286. package/lib/module/modules/questionnaire-response-form/components/questionnaire-navigation-provider.js +2 -1
  287. package/lib/module/modules/questionnaire-response-form/components/questionnaire-navigation-provider.js.map +1 -1
  288. package/lib/module/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.js.map +1 -1
  289. package/lib/module/modules/tile/components/task-icon.js +2 -1
  290. package/lib/module/modules/tile/components/task-icon.js.map +1 -1
  291. package/lib/module/modules/ui/components/background-sync-setting.js +107 -0
  292. package/lib/module/modules/ui/components/background-sync-setting.js.map +1 -0
  293. package/lib/module/modules/ui/components/bluetooth-state-notice.js +99 -0
  294. package/lib/module/modules/ui/components/bluetooth-state-notice.js.map +1 -0
  295. package/lib/module/modules/ui/components/ecg-strip-viewer.js +159 -0
  296. package/lib/module/modules/ui/components/ecg-strip-viewer.js.map +1 -0
  297. package/lib/module/modules/ui/components/health-import-card.js +124 -0
  298. package/lib/module/modules/ui/components/health-import-card.js.map +1 -0
  299. package/lib/module/modules/ui/components/manual-entry-form.js +117 -0
  300. package/lib/module/modules/ui/components/manual-entry-form.js.map +1 -0
  301. package/lib/module/modules/ui/components/pairing-flow.js +216 -0
  302. package/lib/module/modules/ui/components/pairing-flow.js.map +1 -0
  303. package/lib/module/modules/ui/components/supported-devices-catalog-list.js +93 -0
  304. package/lib/module/modules/ui/components/supported-devices-catalog-list.js.map +1 -0
  305. package/lib/module/modules/ui/components/urine-test-result.js +89 -0
  306. package/lib/module/modules/ui/components/urine-test-result.js.map +1 -0
  307. package/lib/module/modules/ui/index.js +13 -0
  308. package/lib/module/modules/ui/index.js.map +1 -0
  309. package/lib/module/modules/ui/types.js +4 -0
  310. package/lib/module/modules/ui/types.js.map +1 -0
  311. package/lib/module/modules/ui/use-ovok-ui.js +45 -0
  312. package/lib/module/modules/ui/use-ovok-ui.js.map +1 -0
  313. package/lib/typescript/commonjs/src/index.d.ts +1 -0
  314. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  315. package/lib/typescript/commonjs/src/modules/auth/delete-account-button/components/delete-account-button.d.ts.map +1 -1
  316. package/lib/typescript/commonjs/src/modules/auth/hooks/use-rate-limit-cooldown.d.ts +2 -0
  317. package/lib/typescript/commonjs/src/modules/auth/hooks/use-rate-limit-cooldown.d.ts.map +1 -0
  318. package/lib/typescript/commonjs/src/modules/auth/hooks/use-session.d.ts +16 -0
  319. package/lib/typescript/commonjs/src/modules/auth/hooks/use-session.d.ts.map +1 -0
  320. package/lib/typescript/commonjs/src/modules/auth/index.d.ts +4 -0
  321. package/lib/typescript/commonjs/src/modules/auth/index.d.ts.map +1 -1
  322. package/lib/typescript/commonjs/src/modules/auth/logout-button/components/logout-button.d.ts.map +1 -1
  323. package/lib/typescript/commonjs/src/modules/auth/register/components/form/inputs.d.ts.map +1 -1
  324. package/lib/typescript/commonjs/src/modules/auth/register/components/form/register-button.d.ts.map +1 -1
  325. package/lib/typescript/commonjs/src/modules/auth/register/components/form/register-form-provider.d.ts.map +1 -1
  326. package/lib/typescript/commonjs/src/modules/auth/reset-password/components/form/inputs.d.ts.map +1 -1
  327. package/lib/typescript/commonjs/src/modules/auth/reset-password/components/form/reset-password-button.d.ts.map +1 -1
  328. package/lib/typescript/commonjs/src/modules/auth/reset-password/components/form/reset-password-form-provider.d.ts.map +1 -1
  329. package/lib/typescript/commonjs/src/modules/auth/session/components/session-list.d.ts +4 -0
  330. package/lib/typescript/commonjs/src/modules/auth/session/components/session-list.d.ts.map +1 -0
  331. package/lib/typescript/commonjs/src/modules/auth/session/events.d.ts +5 -0
  332. package/lib/typescript/commonjs/src/modules/auth/session/events.d.ts.map +1 -0
  333. package/lib/typescript/commonjs/src/modules/auth/session/index.d.ts +3 -0
  334. package/lib/typescript/commonjs/src/modules/auth/session/index.d.ts.map +1 -0
  335. package/lib/typescript/commonjs/src/modules/auth/session/types/session-list-props.d.ts +5 -0
  336. package/lib/typescript/commonjs/src/modules/auth/session/types/session-list-props.d.ts.map +1 -0
  337. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/inputs.d.ts.map +1 -1
  338. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/login-form-provider.d.ts.map +1 -1
  339. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/mfa-code-input.d.ts +9 -0
  340. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/mfa-code-input.d.ts.map +1 -0
  341. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/sign-in-with-email.d.ts +4 -0
  342. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/sign-in-with-email.d.ts.map +1 -1
  343. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/signin-button.d.ts.map +1 -1
  344. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/sign-in.d.ts +4 -0
  345. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/sign-in.d.ts.map +1 -1
  346. package/lib/typescript/commonjs/src/modules/auth/sign-in/contexts/login-form-context.d.ts +2 -46
  347. package/lib/typescript/commonjs/src/modules/auth/sign-in/contexts/login-form-context.d.ts.map +1 -1
  348. package/lib/typescript/commonjs/src/modules/auth/sign-in/hooks/use-login-form.d.ts +1 -47
  349. package/lib/typescript/commonjs/src/modules/auth/sign-in/hooks/use-login-form.d.ts.map +1 -1
  350. package/lib/typescript/commonjs/src/modules/auth/sign-in/types/login-form-context-type.d.ts +11 -1
  351. package/lib/typescript/commonjs/src/modules/auth/sign-in/types/login-form-context-type.d.ts.map +1 -1
  352. package/lib/typescript/commonjs/src/modules/auth/types/session.d.ts +13 -0
  353. package/lib/typescript/commonjs/src/modules/auth/types/session.d.ts.map +1 -0
  354. package/lib/typescript/commonjs/src/modules/auth/utils/rate-limit.d.ts +11 -0
  355. package/lib/typescript/commonjs/src/modules/auth/utils/rate-limit.d.ts.map +1 -0
  356. package/lib/typescript/commonjs/src/modules/background-sync/android-bluetooth-foreground-service.d.ts.map +1 -1
  357. package/lib/typescript/commonjs/src/modules/background-sync/background-safe-storage.d.ts +29 -0
  358. package/lib/typescript/commonjs/src/modules/background-sync/background-safe-storage.d.ts.map +1 -0
  359. package/lib/typescript/commonjs/src/modules/background-sync/index.d.ts +1 -0
  360. package/lib/typescript/commonjs/src/modules/background-sync/index.d.ts.map +1 -1
  361. package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  362. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +46 -0
  363. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -0
  364. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-background-sync.d.ts +14 -0
  365. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-background-sync.d.ts.map +1 -0
  366. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bluetooth-state.d.ts +11 -0
  367. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bluetooth-state.d.ts.map +1 -0
  368. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-device-connection.d.ts +7 -0
  369. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-device-connection.d.ts.map +1 -0
  370. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-health-import.d.ts +16 -0
  371. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-health-import.d.ts.map +1 -0
  372. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-measurements.d.ts +11 -0
  373. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -0
  374. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-nearby-devices.d.ts +8 -0
  375. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-nearby-devices.d.ts.map +1 -0
  376. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-paired-devices.d.ts +16 -0
  377. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-paired-devices.d.ts.map +1 -0
  378. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +13 -0
  379. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
  380. package/lib/typescript/commonjs/src/modules/bt-management/services/background-sync/background-sync-coordinator.d.ts.map +1 -1
  381. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +22 -0
  382. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  383. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +4 -0
  384. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
  385. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +9 -1
  386. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  387. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/measurement-state-machine.d.ts +3 -2
  388. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/measurement-state-machine.d.ts.map +1 -1
  389. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/spo/spo2.main-services.d.ts.map +1 -1
  390. package/lib/typescript/commonjs/src/modules/bt-management/testing/fake-ble-manager.d.ts +16 -0
  391. package/lib/typescript/commonjs/src/modules/bt-management/testing/fake-ble-manager.d.ts.map +1 -0
  392. package/lib/typescript/commonjs/src/modules/bt-management/testing/index.d.ts +3 -0
  393. package/lib/typescript/commonjs/src/modules/bt-management/testing/index.d.ts.map +1 -0
  394. package/lib/typescript/commonjs/src/modules/bt-management/testing/recorded-frames.d.ts +12 -0
  395. package/lib/typescript/commonjs/src/modules/bt-management/testing/recorded-frames.d.ts.map +1 -0
  396. package/lib/typescript/commonjs/src/modules/bt-management/types/background-sync.d.ts +3 -1
  397. package/lib/typescript/commonjs/src/modules/bt-management/types/background-sync.d.ts.map +1 -1
  398. package/lib/typescript/commonjs/src/modules/bt-management/types/bluetooth-error.d.ts +23 -0
  399. package/lib/typescript/commonjs/src/modules/bt-management/types/bluetooth-error.d.ts.map +1 -0
  400. package/lib/typescript/commonjs/src/modules/bt-management/types/btprovider-children-props.d.ts +4 -0
  401. package/lib/typescript/commonjs/src/modules/bt-management/types/btprovider-children-props.d.ts.map +1 -1
  402. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts +4 -0
  403. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  404. package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts +16 -0
  405. package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -0
  406. package/lib/typescript/commonjs/src/modules/bt-management/types/error-callback.d.ts +5 -2
  407. package/lib/typescript/commonjs/src/modules/bt-management/types/error-callback.d.ts.map +1 -1
  408. package/lib/typescript/commonjs/src/modules/bt-management/types/i-bt-managed-device.d.ts +1 -0
  409. package/lib/typescript/commonjs/src/modules/bt-management/types/i-bt-managed-device.d.ts.map +1 -1
  410. package/lib/typescript/commonjs/src/modules/bt-management/types/result-callback.d.ts +2 -0
  411. package/lib/typescript/commonjs/src/modules/bt-management/types/result-callback.d.ts.map +1 -1
  412. package/lib/typescript/commonjs/src/modules/bt-management/types/result-policy.d.ts +8 -0
  413. package/lib/typescript/commonjs/src/modules/bt-management/types/result-policy.d.ts.map +1 -0
  414. package/lib/typescript/commonjs/src/modules/bt-management/utils/result-identity.d.ts +10 -0
  415. package/lib/typescript/commonjs/src/modules/bt-management/utils/result-identity.d.ts.map +1 -0
  416. package/lib/typescript/commonjs/src/modules/data-sync/components/android/android-health-connect-authorization-provider.d.ts.map +1 -1
  417. package/lib/typescript/commonjs/src/modules/data-sync/services/base-health-sync-service.d.ts.map +1 -1
  418. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts +4 -0
  419. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
  420. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
  421. package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts +2 -0
  422. package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
  423. package/lib/typescript/commonjs/src/modules/data-sync/types/sync-progress.d.ts +1 -1
  424. package/lib/typescript/commonjs/src/modules/data-sync/types/sync-progress.d.ts.map +1 -1
  425. package/lib/typescript/commonjs/src/modules/data-sync/utils/retry-save.d.ts +5 -0
  426. package/lib/typescript/commonjs/src/modules/data-sync/utils/retry-save.d.ts.map +1 -0
  427. package/lib/typescript/commonjs/src/modules/helpers/form-items/form-field.d.ts +4 -1
  428. package/lib/typescript/commonjs/src/modules/helpers/form-items/form-field.d.ts.map +1 -1
  429. package/lib/typescript/commonjs/src/modules/helpers/index.d.ts +1 -0
  430. package/lib/typescript/commonjs/src/modules/helpers/index.d.ts.map +1 -1
  431. package/lib/typescript/commonjs/src/modules/helpers/utils/s-log.d.ts.map +1 -1
  432. package/lib/typescript/commonjs/src/modules/helpers/utils/sentry-logger.d.ts +7 -1
  433. package/lib/typescript/commonjs/src/modules/helpers/utils/sentry-logger.d.ts.map +1 -1
  434. package/lib/typescript/commonjs/src/modules/helpers/utils/telemetry.d.ts +68 -0
  435. package/lib/typescript/commonjs/src/modules/helpers/utils/telemetry.d.ts.map +1 -0
  436. package/lib/typescript/commonjs/src/modules/image/components/optimized-image.d.ts +1 -1
  437. package/lib/typescript/commonjs/src/modules/image/components/optimized-image.d.ts.map +1 -1
  438. package/lib/typescript/commonjs/src/modules/image/types/optimized-image-props.d.ts +4 -0
  439. package/lib/typescript/commonjs/src/modules/image/types/optimized-image-props.d.ts.map +1 -1
  440. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/content/questionnaire-content-error.d.ts.map +1 -1
  441. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.d.ts.map +1 -1
  442. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.d.ts.map +1 -1
  443. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/questionnaire-form-provider.d.ts.map +1 -1
  444. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/questionnaire-navigation-provider.d.ts.map +1 -1
  445. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.d.ts +1 -0
  446. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.d.ts.map +1 -1
  447. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/hooks/use-navigation-handlers.d.ts +1 -0
  448. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/hooks/use-navigation-handlers.d.ts.map +1 -1
  449. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/hooks/use-questionnaire-navigation.d.ts +1 -0
  450. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/hooks/use-questionnaire-navigation.d.ts.map +1 -1
  451. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/types/questionnaire-form-context-type.d.ts +2 -0
  452. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/types/questionnaire-form-context-type.d.ts.map +1 -1
  453. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/types/questionnaire-navigation-provider-props.d.ts +1 -0
  454. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/types/questionnaire-navigation-provider-props.d.ts.map +1 -1
  455. package/lib/typescript/commonjs/src/modules/tile/components/task-icon.d.ts.map +1 -1
  456. package/lib/typescript/commonjs/src/modules/ui/components/background-sync-setting.d.ts +9 -0
  457. package/lib/typescript/commonjs/src/modules/ui/components/background-sync-setting.d.ts.map +1 -0
  458. package/lib/typescript/commonjs/src/modules/ui/components/bluetooth-state-notice.d.ts +12 -0
  459. package/lib/typescript/commonjs/src/modules/ui/components/bluetooth-state-notice.d.ts.map +1 -0
  460. package/lib/typescript/commonjs/src/modules/ui/components/ecg-strip-viewer.d.ts +17 -0
  461. package/lib/typescript/commonjs/src/modules/ui/components/ecg-strip-viewer.d.ts.map +1 -0
  462. package/lib/typescript/commonjs/src/modules/ui/components/health-import-card.d.ts +13 -0
  463. package/lib/typescript/commonjs/src/modules/ui/components/health-import-card.d.ts.map +1 -0
  464. package/lib/typescript/commonjs/src/modules/ui/components/manual-entry-form.d.ts +20 -0
  465. package/lib/typescript/commonjs/src/modules/ui/components/manual-entry-form.d.ts.map +1 -0
  466. package/lib/typescript/commonjs/src/modules/ui/components/pairing-flow.d.ts +15 -0
  467. package/lib/typescript/commonjs/src/modules/ui/components/pairing-flow.d.ts.map +1 -0
  468. package/lib/typescript/commonjs/src/modules/ui/components/supported-devices-catalog-list.d.ts +16 -0
  469. package/lib/typescript/commonjs/src/modules/ui/components/supported-devices-catalog-list.d.ts.map +1 -0
  470. package/lib/typescript/commonjs/src/modules/ui/components/urine-test-result.d.ts +10 -0
  471. package/lib/typescript/commonjs/src/modules/ui/components/urine-test-result.d.ts.map +1 -0
  472. package/lib/typescript/commonjs/src/modules/ui/index.d.ts +11 -0
  473. package/lib/typescript/commonjs/src/modules/ui/index.d.ts.map +1 -0
  474. package/lib/typescript/commonjs/src/modules/ui/types.d.ts +24 -0
  475. package/lib/typescript/commonjs/src/modules/ui/types.d.ts.map +1 -0
  476. package/lib/typescript/commonjs/src/modules/ui/use-ovok-ui.d.ts +7 -0
  477. package/lib/typescript/commonjs/src/modules/ui/use-ovok-ui.d.ts.map +1 -0
  478. package/lib/typescript/module/src/index.d.ts +1 -0
  479. package/lib/typescript/module/src/index.d.ts.map +1 -1
  480. package/lib/typescript/module/src/modules/auth/delete-account-button/components/delete-account-button.d.ts.map +1 -1
  481. package/lib/typescript/module/src/modules/auth/hooks/use-rate-limit-cooldown.d.ts +2 -0
  482. package/lib/typescript/module/src/modules/auth/hooks/use-rate-limit-cooldown.d.ts.map +1 -0
  483. package/lib/typescript/module/src/modules/auth/hooks/use-session.d.ts +16 -0
  484. package/lib/typescript/module/src/modules/auth/hooks/use-session.d.ts.map +1 -0
  485. package/lib/typescript/module/src/modules/auth/index.d.ts +4 -0
  486. package/lib/typescript/module/src/modules/auth/index.d.ts.map +1 -1
  487. package/lib/typescript/module/src/modules/auth/logout-button/components/logout-button.d.ts.map +1 -1
  488. package/lib/typescript/module/src/modules/auth/register/components/form/inputs.d.ts.map +1 -1
  489. package/lib/typescript/module/src/modules/auth/register/components/form/register-button.d.ts.map +1 -1
  490. package/lib/typescript/module/src/modules/auth/register/components/form/register-form-provider.d.ts.map +1 -1
  491. package/lib/typescript/module/src/modules/auth/reset-password/components/form/inputs.d.ts.map +1 -1
  492. package/lib/typescript/module/src/modules/auth/reset-password/components/form/reset-password-button.d.ts.map +1 -1
  493. package/lib/typescript/module/src/modules/auth/reset-password/components/form/reset-password-form-provider.d.ts.map +1 -1
  494. package/lib/typescript/module/src/modules/auth/session/components/session-list.d.ts +4 -0
  495. package/lib/typescript/module/src/modules/auth/session/components/session-list.d.ts.map +1 -0
  496. package/lib/typescript/module/src/modules/auth/session/events.d.ts +5 -0
  497. package/lib/typescript/module/src/modules/auth/session/events.d.ts.map +1 -0
  498. package/lib/typescript/module/src/modules/auth/session/index.d.ts +3 -0
  499. package/lib/typescript/module/src/modules/auth/session/index.d.ts.map +1 -0
  500. package/lib/typescript/module/src/modules/auth/session/types/session-list-props.d.ts +5 -0
  501. package/lib/typescript/module/src/modules/auth/session/types/session-list-props.d.ts.map +1 -0
  502. package/lib/typescript/module/src/modules/auth/sign-in/components/form/inputs.d.ts.map +1 -1
  503. package/lib/typescript/module/src/modules/auth/sign-in/components/form/login-form-provider.d.ts.map +1 -1
  504. package/lib/typescript/module/src/modules/auth/sign-in/components/form/mfa-code-input.d.ts +9 -0
  505. package/lib/typescript/module/src/modules/auth/sign-in/components/form/mfa-code-input.d.ts.map +1 -0
  506. package/lib/typescript/module/src/modules/auth/sign-in/components/form/sign-in-with-email.d.ts +4 -0
  507. package/lib/typescript/module/src/modules/auth/sign-in/components/form/sign-in-with-email.d.ts.map +1 -1
  508. package/lib/typescript/module/src/modules/auth/sign-in/components/form/signin-button.d.ts.map +1 -1
  509. package/lib/typescript/module/src/modules/auth/sign-in/components/sign-in.d.ts +4 -0
  510. package/lib/typescript/module/src/modules/auth/sign-in/components/sign-in.d.ts.map +1 -1
  511. package/lib/typescript/module/src/modules/auth/sign-in/contexts/login-form-context.d.ts +2 -46
  512. package/lib/typescript/module/src/modules/auth/sign-in/contexts/login-form-context.d.ts.map +1 -1
  513. package/lib/typescript/module/src/modules/auth/sign-in/hooks/use-login-form.d.ts +1 -47
  514. package/lib/typescript/module/src/modules/auth/sign-in/hooks/use-login-form.d.ts.map +1 -1
  515. package/lib/typescript/module/src/modules/auth/sign-in/types/login-form-context-type.d.ts +11 -1
  516. package/lib/typescript/module/src/modules/auth/sign-in/types/login-form-context-type.d.ts.map +1 -1
  517. package/lib/typescript/module/src/modules/auth/types/session.d.ts +13 -0
  518. package/lib/typescript/module/src/modules/auth/types/session.d.ts.map +1 -0
  519. package/lib/typescript/module/src/modules/auth/utils/rate-limit.d.ts +11 -0
  520. package/lib/typescript/module/src/modules/auth/utils/rate-limit.d.ts.map +1 -0
  521. package/lib/typescript/module/src/modules/background-sync/android-bluetooth-foreground-service.d.ts.map +1 -1
  522. package/lib/typescript/module/src/modules/background-sync/background-safe-storage.d.ts +29 -0
  523. package/lib/typescript/module/src/modules/background-sync/background-safe-storage.d.ts.map +1 -0
  524. package/lib/typescript/module/src/modules/background-sync/index.d.ts +1 -0
  525. package/lib/typescript/module/src/modules/background-sync/index.d.ts.map +1 -1
  526. package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  527. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +46 -0
  528. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -0
  529. package/lib/typescript/module/src/modules/bt-management/hooks/use-background-sync.d.ts +14 -0
  530. package/lib/typescript/module/src/modules/bt-management/hooks/use-background-sync.d.ts.map +1 -0
  531. package/lib/typescript/module/src/modules/bt-management/hooks/use-bluetooth-state.d.ts +11 -0
  532. package/lib/typescript/module/src/modules/bt-management/hooks/use-bluetooth-state.d.ts.map +1 -0
  533. package/lib/typescript/module/src/modules/bt-management/hooks/use-device-connection.d.ts +7 -0
  534. package/lib/typescript/module/src/modules/bt-management/hooks/use-device-connection.d.ts.map +1 -0
  535. package/lib/typescript/module/src/modules/bt-management/hooks/use-health-import.d.ts +16 -0
  536. package/lib/typescript/module/src/modules/bt-management/hooks/use-health-import.d.ts.map +1 -0
  537. package/lib/typescript/module/src/modules/bt-management/hooks/use-measurements.d.ts +11 -0
  538. package/lib/typescript/module/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -0
  539. package/lib/typescript/module/src/modules/bt-management/hooks/use-nearby-devices.d.ts +8 -0
  540. package/lib/typescript/module/src/modules/bt-management/hooks/use-nearby-devices.d.ts.map +1 -0
  541. package/lib/typescript/module/src/modules/bt-management/hooks/use-paired-devices.d.ts +16 -0
  542. package/lib/typescript/module/src/modules/bt-management/hooks/use-paired-devices.d.ts.map +1 -0
  543. package/lib/typescript/module/src/modules/bt-management/index.d.ts +13 -0
  544. package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
  545. package/lib/typescript/module/src/modules/bt-management/services/background-sync/background-sync-coordinator.d.ts.map +1 -1
  546. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +22 -0
  547. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  548. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +4 -0
  549. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
  550. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +9 -1
  551. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  552. package/lib/typescript/module/src/modules/bt-management/services/devices/measurement-state-machine.d.ts +3 -2
  553. package/lib/typescript/module/src/modules/bt-management/services/devices/measurement-state-machine.d.ts.map +1 -1
  554. package/lib/typescript/module/src/modules/bt-management/services/devices/spo/spo2.main-services.d.ts.map +1 -1
  555. package/lib/typescript/module/src/modules/bt-management/testing/fake-ble-manager.d.ts +16 -0
  556. package/lib/typescript/module/src/modules/bt-management/testing/fake-ble-manager.d.ts.map +1 -0
  557. package/lib/typescript/module/src/modules/bt-management/testing/index.d.ts +3 -0
  558. package/lib/typescript/module/src/modules/bt-management/testing/index.d.ts.map +1 -0
  559. package/lib/typescript/module/src/modules/bt-management/testing/recorded-frames.d.ts +12 -0
  560. package/lib/typescript/module/src/modules/bt-management/testing/recorded-frames.d.ts.map +1 -0
  561. package/lib/typescript/module/src/modules/bt-management/types/background-sync.d.ts +3 -1
  562. package/lib/typescript/module/src/modules/bt-management/types/background-sync.d.ts.map +1 -1
  563. package/lib/typescript/module/src/modules/bt-management/types/bluetooth-error.d.ts +23 -0
  564. package/lib/typescript/module/src/modules/bt-management/types/bluetooth-error.d.ts.map +1 -0
  565. package/lib/typescript/module/src/modules/bt-management/types/btprovider-children-props.d.ts +4 -0
  566. package/lib/typescript/module/src/modules/bt-management/types/btprovider-children-props.d.ts.map +1 -1
  567. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts +4 -0
  568. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  569. package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts +16 -0
  570. package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -0
  571. package/lib/typescript/module/src/modules/bt-management/types/error-callback.d.ts +5 -2
  572. package/lib/typescript/module/src/modules/bt-management/types/error-callback.d.ts.map +1 -1
  573. package/lib/typescript/module/src/modules/bt-management/types/i-bt-managed-device.d.ts +1 -0
  574. package/lib/typescript/module/src/modules/bt-management/types/i-bt-managed-device.d.ts.map +1 -1
  575. package/lib/typescript/module/src/modules/bt-management/types/result-callback.d.ts +2 -0
  576. package/lib/typescript/module/src/modules/bt-management/types/result-callback.d.ts.map +1 -1
  577. package/lib/typescript/module/src/modules/bt-management/types/result-policy.d.ts +8 -0
  578. package/lib/typescript/module/src/modules/bt-management/types/result-policy.d.ts.map +1 -0
  579. package/lib/typescript/module/src/modules/bt-management/utils/result-identity.d.ts +10 -0
  580. package/lib/typescript/module/src/modules/bt-management/utils/result-identity.d.ts.map +1 -0
  581. package/lib/typescript/module/src/modules/data-sync/components/android/android-health-connect-authorization-provider.d.ts.map +1 -1
  582. package/lib/typescript/module/src/modules/data-sync/services/base-health-sync-service.d.ts.map +1 -1
  583. package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts +4 -0
  584. package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
  585. package/lib/typescript/module/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
  586. package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts +2 -0
  587. package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
  588. package/lib/typescript/module/src/modules/data-sync/types/sync-progress.d.ts +1 -1
  589. package/lib/typescript/module/src/modules/data-sync/types/sync-progress.d.ts.map +1 -1
  590. package/lib/typescript/module/src/modules/data-sync/utils/retry-save.d.ts +5 -0
  591. package/lib/typescript/module/src/modules/data-sync/utils/retry-save.d.ts.map +1 -0
  592. package/lib/typescript/module/src/modules/helpers/form-items/form-field.d.ts +4 -1
  593. package/lib/typescript/module/src/modules/helpers/form-items/form-field.d.ts.map +1 -1
  594. package/lib/typescript/module/src/modules/helpers/index.d.ts +1 -0
  595. package/lib/typescript/module/src/modules/helpers/index.d.ts.map +1 -1
  596. package/lib/typescript/module/src/modules/helpers/utils/s-log.d.ts.map +1 -1
  597. package/lib/typescript/module/src/modules/helpers/utils/sentry-logger.d.ts +7 -1
  598. package/lib/typescript/module/src/modules/helpers/utils/sentry-logger.d.ts.map +1 -1
  599. package/lib/typescript/module/src/modules/helpers/utils/telemetry.d.ts +68 -0
  600. package/lib/typescript/module/src/modules/helpers/utils/telemetry.d.ts.map +1 -0
  601. package/lib/typescript/module/src/modules/image/components/optimized-image.d.ts +1 -1
  602. package/lib/typescript/module/src/modules/image/components/optimized-image.d.ts.map +1 -1
  603. package/lib/typescript/module/src/modules/image/types/optimized-image-props.d.ts +4 -0
  604. package/lib/typescript/module/src/modules/image/types/optimized-image-props.d.ts.map +1 -1
  605. package/lib/typescript/module/src/modules/questionnaire-response-form/components/content/questionnaire-content-error.d.ts.map +1 -1
  606. package/lib/typescript/module/src/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.d.ts.map +1 -1
  607. package/lib/typescript/module/src/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.d.ts.map +1 -1
  608. package/lib/typescript/module/src/modules/questionnaire-response-form/components/questionnaire-form-provider.d.ts.map +1 -1
  609. package/lib/typescript/module/src/modules/questionnaire-response-form/components/questionnaire-navigation-provider.d.ts.map +1 -1
  610. package/lib/typescript/module/src/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.d.ts +1 -0
  611. package/lib/typescript/module/src/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.d.ts.map +1 -1
  612. package/lib/typescript/module/src/modules/questionnaire-response-form/hooks/use-navigation-handlers.d.ts +1 -0
  613. package/lib/typescript/module/src/modules/questionnaire-response-form/hooks/use-navigation-handlers.d.ts.map +1 -1
  614. package/lib/typescript/module/src/modules/questionnaire-response-form/hooks/use-questionnaire-navigation.d.ts +1 -0
  615. package/lib/typescript/module/src/modules/questionnaire-response-form/hooks/use-questionnaire-navigation.d.ts.map +1 -1
  616. package/lib/typescript/module/src/modules/questionnaire-response-form/types/questionnaire-form-context-type.d.ts +2 -0
  617. package/lib/typescript/module/src/modules/questionnaire-response-form/types/questionnaire-form-context-type.d.ts.map +1 -1
  618. package/lib/typescript/module/src/modules/questionnaire-response-form/types/questionnaire-navigation-provider-props.d.ts +1 -0
  619. package/lib/typescript/module/src/modules/questionnaire-response-form/types/questionnaire-navigation-provider-props.d.ts.map +1 -1
  620. package/lib/typescript/module/src/modules/tile/components/task-icon.d.ts.map +1 -1
  621. package/lib/typescript/module/src/modules/ui/components/background-sync-setting.d.ts +9 -0
  622. package/lib/typescript/module/src/modules/ui/components/background-sync-setting.d.ts.map +1 -0
  623. package/lib/typescript/module/src/modules/ui/components/bluetooth-state-notice.d.ts +12 -0
  624. package/lib/typescript/module/src/modules/ui/components/bluetooth-state-notice.d.ts.map +1 -0
  625. package/lib/typescript/module/src/modules/ui/components/ecg-strip-viewer.d.ts +17 -0
  626. package/lib/typescript/module/src/modules/ui/components/ecg-strip-viewer.d.ts.map +1 -0
  627. package/lib/typescript/module/src/modules/ui/components/health-import-card.d.ts +13 -0
  628. package/lib/typescript/module/src/modules/ui/components/health-import-card.d.ts.map +1 -0
  629. package/lib/typescript/module/src/modules/ui/components/manual-entry-form.d.ts +20 -0
  630. package/lib/typescript/module/src/modules/ui/components/manual-entry-form.d.ts.map +1 -0
  631. package/lib/typescript/module/src/modules/ui/components/pairing-flow.d.ts +15 -0
  632. package/lib/typescript/module/src/modules/ui/components/pairing-flow.d.ts.map +1 -0
  633. package/lib/typescript/module/src/modules/ui/components/supported-devices-catalog-list.d.ts +16 -0
  634. package/lib/typescript/module/src/modules/ui/components/supported-devices-catalog-list.d.ts.map +1 -0
  635. package/lib/typescript/module/src/modules/ui/components/urine-test-result.d.ts +10 -0
  636. package/lib/typescript/module/src/modules/ui/components/urine-test-result.d.ts.map +1 -0
  637. package/lib/typescript/module/src/modules/ui/index.d.ts +11 -0
  638. package/lib/typescript/module/src/modules/ui/index.d.ts.map +1 -0
  639. package/lib/typescript/module/src/modules/ui/types.d.ts +24 -0
  640. package/lib/typescript/module/src/modules/ui/types.d.ts.map +1 -0
  641. package/lib/typescript/module/src/modules/ui/use-ovok-ui.d.ts +7 -0
  642. package/lib/typescript/module/src/modules/ui/use-ovok-ui.d.ts.map +1 -0
  643. package/package.json +145 -6
@@ -5,10 +5,13 @@ import { Linking, Platform } from "react-native";
5
5
  import { ScanMode, State } from "react-native-ble-plx";
6
6
  import { slog } from "../../helpers/index.js";
7
7
  import { sentryLogger } from "../../helpers/utils/sentry-logger.js";
8
+ import { addOvokSpanEvent, recordOvokMetric } from "../../helpers/utils/telemetry.js";
9
+ import { toBluetoothError } from "../types/bluetooth-error.js";
8
10
  import { DeviceCreator } from "./device-creator.js";
9
11
  class BTManager {
10
12
  static MAX_DEVICES = 15; // Safety limit to prevent unbounded growth
11
13
  devices = new Map();
14
+ forgottenDeviceIds = new Set();
12
15
  eventSubscriptions = [];
13
16
  scanGeneration = 0;
14
17
  scanActive = false;
@@ -36,10 +39,12 @@ class BTManager {
36
39
  this.onDeviceFoundCallback = undefined;
37
40
  this.onResultCallback = undefined;
38
41
  this.onDeviceStatusChangedCallback = undefined;
42
+ this.onConnectionEventCallback = undefined;
39
43
  this.devices.forEach(device => {
40
44
  device.destroy();
41
45
  });
42
46
  this.devices.clear();
47
+ this.forgottenDeviceIds.clear();
43
48
  this.deviceCreator.destroy();
44
49
  };
45
50
  startScan = () => {
@@ -77,7 +82,7 @@ class BTManager {
77
82
  subscription = this.bleManager.onStateChange(onStateChange, true);
78
83
  } catch (error) {
79
84
  this.onErrorCallback?.({
80
- error: error instanceof Error ? error : String(error)
85
+ error: toBluetoothError(error)
81
86
  });
82
87
  return;
83
88
  }
@@ -116,11 +121,44 @@ class BTManager {
116
121
  this.onDeviceFoundCallback = undefined;
117
122
  this.onResultCallback = undefined;
118
123
  this.onDeviceStatusChangedCallback = undefined;
124
+ this.onConnectionEventCallback = undefined;
119
125
  this.devices.forEach(device => {
120
126
  device.destroy();
121
127
  });
122
128
  this.devices.clear();
123
129
  };
130
+
131
+ /**
132
+ * Pauses discovery without tearing down devices or their callbacks.
133
+ *
134
+ * Use this when an app temporarily stops scanning, for example while it is in the
135
+ * background but an already-connected device may still deliver a measurement.
136
+ */
137
+ pauseScan = () => {
138
+ if (this.destroyed) {
139
+ return;
140
+ }
141
+ sentryLogger("info", "BT_MANAGER: Pausing scan");
142
+ this.scanGeneration += 1;
143
+ this.scanActive = false;
144
+ this.scanStarting = false;
145
+ this.removeStateChangeListener();
146
+ this.bleManager.stopDeviceScan();
147
+ };
148
+
149
+ /**
150
+ * Resumes discovery without clearing devices or callbacks.
151
+ *
152
+ * Restarting unconditionally also recovers when an app stopped the underlying BLE scan
153
+ * directly while BTManager still believed it was active.
154
+ */
155
+ resumeScan = () => {
156
+ if (this.destroyed) {
157
+ return;
158
+ }
159
+ sentryLogger("info", "BT_MANAGER: Resuming scan");
160
+ this.restartScan();
161
+ };
124
162
  restartScan = () => {
125
163
  if (this.destroyed) {
126
164
  return;
@@ -171,16 +209,35 @@ class BTManager {
171
209
  });
172
210
  this.scanActive = true;
173
211
  sentryLogger("info", "BT_MANAGER: Scan started (continuous mode)");
212
+ addOvokSpanEvent("bluetooth.scan.started", {
213
+ platform: Platform.OS,
214
+ background: this.backgroundScanEnabled
215
+ });
174
216
  } catch (error) {
175
217
  this.onErrorCallback?.({
176
- error: error instanceof Error ? error : String(error)
218
+ error: toBluetoothError(error)
177
219
  });
178
220
  } finally {
179
221
  this.scanStarting = false;
180
222
  }
181
223
  };
182
224
  restoreDevices = devices => {
183
- devices.forEach(device => this.onScanResult(null, device));
225
+ devices.forEach(device => {
226
+ this.forgottenDeviceIds.delete(device.id);
227
+ this.onScanResult(null, device);
228
+ });
229
+ };
230
+
231
+ /** Disconnects one device and prevents it from being re-created by later advertisements. */
232
+ forget = async deviceId => {
233
+ this.forgottenDeviceIds.add(deviceId);
234
+ this.autoConnectCandidates.delete(deviceId);
235
+ const device = this.devices.get(deviceId);
236
+ if (!device) {
237
+ return;
238
+ }
239
+ this.devices.delete(deviceId);
240
+ await device.disconnect();
184
241
  };
185
242
  onDeviceFound = callback => {
186
243
  sentryLogger("info", "BT_MANAGER: Setting onDeviceFound callback");
@@ -194,6 +251,10 @@ class BTManager {
194
251
  sentryLogger("info", "BT_MANAGER: Setting onDeviceStatusChanged callback");
195
252
  this.onDeviceStatusChangedCallback = callback;
196
253
  };
254
+ onConnectionEvent = callback => {
255
+ sentryLogger("info", "BT_MANAGER: Setting onConnectionEvent callback");
256
+ this.onConnectionEventCallback = callback;
257
+ };
197
258
  onResult = callback => {
198
259
  sentryLogger("info", "BT_MANAGER: Setting onResult callback");
199
260
  this.onResultCallback = callback;
@@ -205,7 +266,7 @@ class BTManager {
205
266
  try {
206
267
  if (error) {
207
268
  this.onErrorCallback?.({
208
- error: error
269
+ error: toBluetoothError(error)
209
270
  });
210
271
  sentryLogger("error", "BT_MANAGER: Scan result error", {
211
272
  error: error instanceof Error ? error.message : error
@@ -226,6 +287,9 @@ class BTManager {
226
287
  if (!device) {
227
288
  return;
228
289
  }
290
+ if (this.forgottenDeviceIds.has(device.id)) {
291
+ return;
292
+ }
229
293
  if (this.devices.has(device.id)) {
230
294
  return;
231
295
  }
@@ -248,14 +312,21 @@ class BTManager {
248
312
  deviceName,
249
313
  onError: this.onErrorCallback?.bind(this),
250
314
  onDeviceStatusChanged: this.onDeviceStatusChangedCallback?.bind(this),
315
+ onConnectionEvent: this.onConnectionEventCallback?.bind(this),
251
316
  onResult: this.onResultCallback?.bind(this),
252
317
  oneReadingPerConnection: this.options.oneReadingPerConnection,
253
318
  deliveredEcgFileNames: this.options.deliveredEcgFileNames,
319
+ resultPolicy: this.options.resultPolicies?.[deviceName],
254
320
  onDeviceDisconnected: () => {
255
321
  this.removeDeviceFromFoundedDevices?.bind(this)(device.id);
256
322
  }
257
323
  });
258
324
  this.devices.set(device.id, deviceClass);
325
+ recordOvokMetric("ovok.devices.found", 1, {
326
+ deviceId: device.id,
327
+ model: deviceName,
328
+ platform: Platform.OS
329
+ });
259
330
  this.onDeviceFoundCallback?.(deviceClass, this);
260
331
  this.queueAutoConnect(deviceClass);
261
332
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"names":["Linking","Platform","ScanMode","State","slog","sentryLogger","DeviceCreator","BTManager","MAX_DEVICES","devices","Map","eventSubscriptions","scanGeneration","scanActive","scanStarting","destroyed","autoConnectCandidates","constructor","bleManager","acceptedDevices","options","deviceCreator","backgroundScanEnabled","backgroundEnabled","destroy","stopScan","autoConnectTimer","clearTimeout","undefined","onErrorCallback","onDeviceFoundCallback","onResultCallback","onDeviceStatusChangedCallback","forEach","device","clear","startScan","stateChangeListener","generation","subscription","poweredOnBeforeSubscription","onStateChange","state","PoweredOn","removeStateChangeListener","startDeviceScan","OS","sendIntent","error","Error","String","push","setBackgroundScanEnabled","enabled","restartScan","stopDeviceScan","sub","remove","index","indexOf","splice","serviceUUIDs","length","scanMode","LowPower","Balanced","onScanResult","restoreDevices","onDeviceFound","callback","onError","onDeviceStatusChanged","onResult","message","advertisedName","name","trim","localName","has","id","deviceName","getDeviceName","size","deviceId","currentSize","deviceClass","createDevice","bind","oneReadingPerConnection","deliveredEcgFileNames","onDeviceDisconnected","removeDeviceFromFoundedDevices","set","queueAutoConnect","autoConnect","setTimeout","values","connect","onDeviceSelectionRequired","select","selected","Math","max","autoConnectDelayMs","get","delete"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/services/bt-manager.ts"],"mappings":";;AAAA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,cAAc;AAChD,SAIEC,QAAQ,EACRC,KAAK,QAEA,sBAAsB;AAE7B,SAASC,IAAI,QAAQ,wBAAe;AACpC,SAASC,YAAY,QAAQ,sCAAmC;AAOhE,SAASC,aAAa,QAAQ,qBAAkB;AAyBhD,MAAMC,SAAS,CAAsC;EACnD,OAAwBC,WAAW,GAAG,EAAE,CAAC,CAAC;EAClCC,OAAO,GAAG,IAAIC,GAAG,CAA0C,CAAC;EAG5DC,kBAAkB,GAAmB,EAAE;EACvCC,cAAc,GAAG,CAAC;EAClBC,UAAU,GAAG,KAAK;EAClBC,YAAY,GAAG,KAAK;EACpBC,SAAS,GAAG,KAAK;EAIjBC,qBAAqB,GAAG,IAAIN,GAAG,CAA0C,CAAC;EAGlFO,WAAWA,CACQC,UAAsB,EACtBC,eAAkB,EAClBC,OAAyB,GAAG,CAAC,CAAC,EAC/C;IAAA,KAHiBF,UAAsB,GAAtBA,UAAsB;IAAA,KACtBC,eAAkB,GAAlBA,eAAkB;IAAA,KAClBC,OAAyB,GAAzBA,OAAyB;IAE1C,IAAI,CAACC,aAAa,GAAG,IAAIf,aAAa,CAAC,IAAI,CAACa,eAAe,CAAC;IAC5D,IAAI,CAACG,qBAAqB,GAAGF,OAAO,CAACG,iBAAiB,KAAK,IAAI;EACjE;EAEOC,OAAO,GAAGA,CAAA,KAAM;IACrBnB,YAAY,CAAC,MAAM,EAAE,kCAAkC,CAAC;IAExD,IAAI,CAACU,SAAS,GAAG,IAAI;IACrB,IAAI,CAACU,QAAQ,CAAC,CAAC;IACf,IAAI,IAAI,CAACC,gBAAgB,EAAE;MACzBC,YAAY,CAAC,IAAI,CAACD,gBAAgB,CAAC;MACnC,IAAI,CAACA,gBAAgB,GAAGE,SAAS;IACnC;;IAEA;IACA,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E,yBAAyB,GAAG;UACvCzF,OAAO,EAAEA,OAAuC;UAChD0F,MAAM,EAAE,MAAOC,QAAQ,IAAK;YAC1B,MAAMA,QAAQ,CAACH,OAAO,CAAC,CAAC;UAC1B;QACF,CAAC,CAAC;MACJ;IACF,CAAC,EAAEI,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAClF,OAAO,CAACmF,kBAAkB,IAAI,GAAG,CAAC,CAAC;EACzD,CAAC;EAEOZ,8BAA8B,GAAIR,QAAgB,IAAK;IAC7D9E,YAAY,CACV,MAAM,EACN,2EAA2E,EAC3E;MACE8E,QAAQ;MACRH,UAAU,EAAE,IAAI,CAACvE,OAAO,CAAC+F,GAAG,CAACrB,QAAQ,CAAC,EAAEjD,MAAM,EAAEyC;IAClD,CACF,CAAC;IACD,IAAI,CAAClE,OAAO,CAACgG,MAAM,CAACtB,QAAQ,CAAC;EAC/B,CAAC;AACH;AAEA,SAAS5E,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["Linking","Platform","ScanMode","State","slog","sentryLogger","addOvokSpanEvent","recordOvokMetric","toBluetoothError","DeviceCreator","BTManager","MAX_DEVICES","devices","Map","forgottenDeviceIds","Set","eventSubscriptions","scanGeneration","scanActive","scanStarting","destroyed","autoConnectCandidates","constructor","bleManager","acceptedDevices","options","deviceCreator","backgroundScanEnabled","backgroundEnabled","destroy","stopScan","autoConnectTimer","clearTimeout","undefined","onErrorCallback","onDeviceFoundCallback","onResultCallback","onDeviceStatusChangedCallback","onConnectionEventCallback","forEach","device","clear","startScan","stateChangeListener","generation","subscription","poweredOnBeforeSubscription","onStateChange","state","PoweredOn","removeStateChangeListener","startDeviceScan","OS","sendIntent","error","push","setBackgroundScanEnabled","enabled","restartScan","stopDeviceScan","sub","remove","pauseScan","resumeScan","index","indexOf","splice","serviceUUIDs","length","scanMode","LowPower","Balanced","onScanResult","platform","background","restoreDevices","delete","id","forget","deviceId","add","get","disconnect","onDeviceFound","callback","onError","onDeviceStatusChanged","onConnectionEvent","onResult","Error","message","advertisedName","name","trim","localName","has","deviceName","getDeviceName","size","currentSize","deviceClass","createDevice","bind","oneReadingPerConnection","deliveredEcgFileNames","resultPolicy","resultPolicies","onDeviceDisconnected","removeDeviceFromFoundedDevices","set","model","queueAutoConnect","autoConnect","setTimeout","values","connect","onDeviceSelectionRequired","select","selected","Math","max","autoConnectDelayMs"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/services/bt-manager.ts"],"mappings":";;AAAA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,cAAc;AAChD,SAIEC,QAAQ,EACRC,KAAK,QAEA,sBAAsB;AAE7B,SAASC,IAAI,QAAQ,wBAAe;AACpC,SAASC,YAAY,QAAQ,sCAAmC;AAChE,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,kCAA+B;AAElF,SAASC,gBAAgB,QAAQ,6BAA0B;AAQ3D,SAASC,aAAa,QAAQ,qBAAkB;AA0BhD,MAAMC,SAAS,CAAsC;EACnD,OAAwBC,WAAW,GAAG,EAAE,CAAC,CAAC;EAClCC,OAAO,GAAG,IAAIC,GAAG,CAA0C,CAAC;EAC5DC,kBAAkB,GAAG,IAAIC,GAAG,CAAS,CAAC;EAGtCC,kBAAkB,GAAmB,EAAE;EACvCC,cAAc,GAAG,CAAC;EAClBC,UAAU,GAAG,KAAK;EAClBC,YAAY,GAAG,KAAK;EACpBC,SAAS,GAAG,KAAK;EAIjBC,qBAAqB,GAAG,IAAIR,GAAG,CAA0C,CAAC;EAGlFS,WAAWA,CACQC,UAAsB,EACtBC,eAAkB,EAClBC,OAAyB,GAAG,CAAC,CAAC,EAC/C;IAAA,KAHiBF,UAAsB,GAAtBA,UAAsB;IAAA,KACtBC,eAAkB,GAAlBA,eAAkB;IAAA,KAClBC,OAAyB,GAAzBA,OAAyB;IAE1C,IAAI,CAACC,aAAa,GAAG,IAAIjB,aAAa,CAAC,IAAI,CAACe,eAAe,CAAC;IAC5D,IAAI,CAACG,qBAAqB,GAAGF,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GAAG,CAAC,CAAC;EACzD,CAAC;EAEOb,8BAA8B,GAAI7B,QAAgB,IAAK;IAC7D1E,YAAY,CACV,MAAM,EACN,2EAA2E,EAC3E;MACE0E,QAAQ;MACRiB,UAAU,EAAE,IAAI,CAACpF,OAAO,CAACqE,GAAG,CAACF,QAAQ,CAAC,EAAEvC,MAAM,EAAEoD;IAClD,CACF,CAAC;IACD,IAAI,CAAChF,OAAO,CAACgE,MAAM,CAACG,QAAQ,CAAC;EAC/B,CAAC;AACH;AAEA,SAASrE,SAAS","ignoreList":[]}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
 
3
+ /* eslint-disable max-lines */
4
+
3
5
  import { sentryLogger } from "../../../helpers/utils/sentry-logger.js";
6
+ import { addOvokSpanEvent, recordOvokDuration, recordOvokMetric, startOvokSpan } from "../../../helpers/utils/telemetry.js";
4
7
  import { DeviceStatus } from "../../types/device-status.js";
5
8
  import { base64ToHex } from "../../utils/base-64-to-hex.js";
6
9
  import { BTCommandWriter } from "./bt-command-writer.js";
@@ -15,21 +18,55 @@ export class BTConnectionHandler {
15
18
  this.writer = new BTCommandWriter(device, callbacks.onError);
16
19
  }
17
20
  connect = async () => {
21
+ const startedAt = Date.now();
22
+ const span = startOvokSpan("bluetooth.connect", {
23
+ deviceId: this.device.id,
24
+ deviceName: this.device.name ?? "unknown"
25
+ });
18
26
  try {
19
27
  await this.connectWithRetries();
20
28
  await this.requestPreferredMtu();
21
29
  await this.device.discoverAllServicesAndCharacteristics();
22
30
  await readDeviceInformation(this.device, this.callbacks.onDeviceInfo);
31
+ await this.readBatteryLevel();
23
32
  this.callbacks.onStatusChanged?.(DeviceStatus.CONNECTED);
24
33
  this.onDisconnectSubscription = this.device.onDisconnected(this.onDeviceDisconnected);
25
34
  await this.subscribeToAllCharacteristics();
35
+ span?.setStatus?.({
36
+ code: 1
37
+ });
26
38
  } catch (error) {
27
39
  sentryLogger("error", "BT_MANAGER: Error connecting to device", {
28
40
  error: error instanceof Error ? error.message : error,
29
41
  deviceName: this.device.name
30
42
  });
31
43
  this.callbacks.onError?.(error);
44
+ if (/pair|bond|authentication|passkey|pin/i.test(String(error))) {
45
+ recordOvokMetric("ovok.pairing.failures", 1, {
46
+ deviceId: this.device.id,
47
+ deviceName: this.device.name ?? "unknown"
48
+ });
49
+ addOvokSpanEvent("pairing.failed", {
50
+ deviceId: this.device.id,
51
+ deviceName: this.device.name ?? "unknown"
52
+ });
53
+ this.callbacks.onConnectionEvent?.({
54
+ kind: "pairing",
55
+ pairingCodeRequired: true
56
+ });
57
+ }
32
58
  this.callbacks.onStatusChanged?.(DeviceStatus.DISCONNECTED);
59
+ span?.recordException?.(error instanceof Error ? error : String(error));
60
+ span?.setStatus?.({
61
+ code: 2,
62
+ message: error instanceof Error ? error.message : String(error)
63
+ });
64
+ } finally {
65
+ recordOvokDuration("ovok.device.connection.duration", Date.now() - startedAt, {
66
+ deviceId: this.device.id,
67
+ deviceName: this.device.name ?? "unknown"
68
+ });
69
+ span?.end();
33
70
  }
34
71
  };
35
72
  destroy = () => {
@@ -64,6 +101,26 @@ export class BTConnectionHandler {
64
101
  });
65
102
  }
66
103
  };
104
+
105
+ /** Reads the standard Battery Service when a peripheral exposes it. */
106
+ readBatteryLevel = async () => {
107
+ try {
108
+ const characteristic = await this.device.readCharacteristicForService("180F", "2A19");
109
+ if (!characteristic.value) {
110
+ return;
111
+ }
112
+ const value = Number.parseInt(base64ToHex(characteristic.value)[0] ?? "", 16);
113
+ if (value === undefined || value > 100) {
114
+ return;
115
+ }
116
+ this.callbacks.onConnectionEvent?.({
117
+ kind: "battery",
118
+ batteryLevel: value
119
+ });
120
+ } catch {
121
+ // Battery is optional. A device without the standard service must still connect.
122
+ }
123
+ };
67
124
  connectWithRetries = async () => {
68
125
  const maxRetries = 5;
69
126
  const retryDelay = 1000;
@@ -1 +1 @@
1
- {"version":3,"names":["sentryLogger","DeviceStatus","base64ToHex","BTCommandWriter","readDeviceInformation","BTConnectionHandler","characteristicSubscriptions","constructor","device","mainServices","callbacks","preferredMtu","writer","onError","connect","connectWithRetries","requestPreferredMtu","discoverAllServicesAndCharacteristics","onDeviceInfo","onStatusChanged","CONNECTED","onDisconnectSubscription","onDisconnected","onDeviceDisconnected","subscribeToAllCharacteristics","error","Error","message","deviceName","name","DISCONNECTED","destroy","forEach","sub","remove","reset","sendCommands","commands","send","negotiated","requestMTU","useNegotiatedMtu","mtu","deviceId","id","requestedMtu","String","maxRetries","retryDelay","maxDelay","connected","retryCount","isConnected","errorCode","willRetry","Promise","resolve","setTimeout","Math","min","pow","isNormalDisconnect","mainService","monitorUuid","monitorUuids","subscription","monitorCharacteristicForService","uuid","result","value","hexValue","onDataReceived","push","initialCommands","length","onCommandSent"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/bt-connection-handler.ts"],"mappings":";;AAEA,SAASA,YAAY,QAAQ,yCAAsC;AAEnE,SAASC,YAAY,QAAQ,8BAA2B;AAExD,SAASC,WAAW,QAAQ,+BAA4B;AAExD,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,qBAAqB,QAAQ,4BAAyB;AAkB/D,OAAO,MAAMC,mBAAmB,CAAC;EAEvBC,2BAA2B,GAAmB,EAAE;EAGxDC,WAAWA,CACQC,MAAc,EACdC,YAA2C,EAC3CC,SAAqC,EACrCC,YAAqB,EACtC;IAAA,KAJiBH,MAAc,GAAdA,MAAc;IAAA,KACdC,YAA2C,GAA3CA,YAA2C;IAAA,KAC3CC,SAAqC,GAArCA,SAAqC;IAAA,KACrCC,YAAqB,GAArBA,YAAqB;IAEtC,IAAI,CAACC,MAAM,GAAG,IAAIT,eAAe,CAACK,MAAM,EAAEE,SAAS,CAACG,OAAO,CAAC;EAC9D;EAEOC,OAAO,GAAG,MAAAA,CAAA,KAAY;IAC3B,IAAI;MACF,MAAM,IAAI,CAACC,kBAAkB,CAAC,CAAC;MAC/B,MAAM,IAAI,CAACC,mBAAmB,CAAC,CAAC;MAEhC,MAAM,IAAI,CAACR,MAA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kD,EAClD;QACEyB,KAAK,EAAEA,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACE,OAAO,GAAGF,KAAK;QACrDG,UAAU,EAAE,IAAI,CAACpB,MAAM,CAACqB;MAC1B,CACF,CAAC;MACD,IAAI,CAACnB,SAAS,CAACG,OAAO,GAAGY,KAAyB,CAAC;IACrD;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["sentryLogger","addOvokSpanEvent","recordOvokDuration","recordOvokMetric","startOvokSpan","DeviceStatus","base64ToHex","BTCommandWriter","readDeviceInformation","BTConnectionHandler","characteristicSubscriptions","constructor","device","mainServices","callbacks","preferredMtu","writer","onError","connect","startedAt","Date","now","span","deviceId","id","deviceName","name","connectWithRetries","requestPreferredMtu","discoverAllServicesAndCharacteristics","onDeviceInfo","readBatteryLevel","onStatusChanged","CONNECTED","onDisconnectSubscription","onDisconnected","onDeviceDisconnected","subscribeToAllCharacteristics","setStatus","code","error","Error","message","test","String","onConnectionEvent","kind","pairingCodeRequired","DISCONNECTED","recordException","end","destroy","forEach","sub","remove","reset","sendCommands","commands","send","negotiated","requestMTU","useNegotiatedMtu","mtu","requestedMtu","characteristic","readCharacteristicForService","value","Number","parseInt","undefined","batteryLevel","maxRetries","retryDelay","maxDelay","connected","retryCount","isConnected","errorCode","willRetry","Promise","resolve","setTimeout","Math","min","pow","isNormalDisconnect","mainService","monitorUuid","monitorUuids","subscription","monitorCharacteristicForService","uuid","result","hexValue","onDataReceived","push","initialCommands","length","onCommandSent"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/bt-connection-handler.ts"],"mappings":";;AAAA;;AAIA,SAASA,YAAY,QAAQ,yCAAsC;AACnE,SACEC,gBAAgB,EAChBC,kBAAkB,EAClBC,gBAAgB,EAChBC,aAAa,QACR,qCAAkC;AAGzC,SAASC,YAAY,QAAQ,8BAA2B;AAExD,SAASC,WAAW,QAAQ,+BAA4B;AAExD,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC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CAAClF,SAAS,CAACoF,aAAa,GAAG,CAAC;MAClC;IACF,CAAC,CAAC,OAAO1D,KAAK,EAAE;MACdxC,YAAY,CACV,OAAO,EACP,kDAAkD,EAClD;QACEwC,KAAK,EAAEA,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACE,OAAO,GAAGF,KAAK;QACrDf,UAAU,EAAE,IAAI,CAACb,MAAM,CAACc;MAC1B,CACF,CAAC;MACD,IAAI,CAACZ,SAAS,CAACG,OAAO,GAAGuB,KAAyB,CAAC;IACrD;EACF,CAAC;AACH","ignoreList":[]}
@@ -3,7 +3,10 @@
3
3
  /* eslint-disable max-lines */
4
4
 
5
5
  import { sentryLogger } from "../../../helpers/utils/sentry-logger.js";
6
+ import { addOvokSpanEvent, recordOvokMetric } from "../../../helpers/utils/telemetry.js";
7
+ import { BluetoothError, toBluetoothError } from "../../types/bluetooth-error.js";
6
8
  import { DeviceStatus } from "../../types/device-status.js";
9
+ import { createStableResultId } from "../../utils/result-identity.js";
7
10
  import { summariseMeasurementForLog } from "../../utils/summarise-measurement-for-log.js";
8
11
  import { supportedMeasurementTypeKeys } from "../../utils/supported-measurement-type-keys.js";
9
12
  import { BTConnectionHandler } from "./bt-connection-handler.js";
@@ -11,6 +14,9 @@ import { BTDataProcessor } from "./bt-data-processor.js";
11
14
  import { pollingSequencerFor } from "./polling-command-sequencer.js";
12
15
  export class BTManagedDevice {
13
16
  resultReportedThisConnection = false;
17
+ reportedMeasurementKinds = new Set();
18
+ reportedDailyTotals = new Set();
19
+ historyResultCount = 0;
14
20
 
15
21
  /**
16
22
  * The timeout in milliseconds for the stuck data.
@@ -63,11 +69,14 @@ export class BTManagedDevice {
63
69
  onError: onErrorCallback,
64
70
  onDeviceStatusChanged: onDeviceStatusChangedCallback,
65
71
  onResult: onResultCallback,
72
+ onConnectionEvent: onConnectionEventCallback,
66
73
  onDeviceDisconnected: onDeviceDisconnectedCallback,
67
- oneReadingPerConnection
74
+ oneReadingPerConnection,
75
+ resultPolicy
68
76
  }) {
69
77
  this.device = device;
70
78
  this.oneReadingPerConnection = oneReadingPerConnection === true;
79
+ this.resultPolicy = resultPolicy;
71
80
  sentryLogger("info", "BT_MANAGER: Creating BTManagedDevice", {
72
81
  deviceId: device.id,
73
82
  deviceName: deviceName
@@ -89,6 +98,12 @@ export class BTManagedDevice {
89
98
  deviceData: this.deviceData,
90
99
  deviceName: this.deviceData.name
91
100
  });
101
+ addOvokSpanEvent("device.status_changed", {
102
+ deviceId: this.deviceData.id,
103
+ model: this.deviceData.name,
104
+ status,
105
+ measurementTypeKey: measurementTypeKey ?? "unknown"
106
+ });
92
107
  onDeviceStatusChangedCallback?.({
93
108
  deviceData: this.deviceData,
94
109
  status: status,
@@ -101,9 +116,21 @@ export class BTManagedDevice {
101
116
  deviceData: this.deviceData,
102
117
  deviceName: this.deviceData.name
103
118
  });
119
+ const normalized = toBluetoothError(error);
120
+ if (error && (typeof error === "object" || typeof error === "function")) {
121
+ try {
122
+ Object.defineProperty(error, "ovokCode", {
123
+ value: normalized.code,
124
+ configurable: true,
125
+ enumerable: false
126
+ });
127
+ } catch {
128
+ // Some native error objects are frozen; the original error is still delivered.
129
+ }
130
+ }
104
131
  onErrorCallback?.({
105
132
  deviceData: this.deviceData,
106
- error: error
133
+ error: error instanceof BluetoothError ? normalized : error
107
134
  });
108
135
  };
109
136
  this.onResult = ({
@@ -113,18 +140,73 @@ export class BTManagedDevice {
113
140
  if (this.oneReadingPerConnection && this.resultReportedThisConnection) {
114
141
  return;
115
142
  }
143
+ const measurementTypeKey = data.measurementTypeKey;
144
+ const policy = this.resultPolicy?.byMeasurement?.[measurementTypeKey] ?? this.resultPolicy?.default ?? "all";
145
+ if (policy === "first-reading-per-kind-per-connection") {
146
+ if (this.reportedMeasurementKinds.has(measurementTypeKey)) {
147
+ return;
148
+ }
149
+ this.reportedMeasurementKinds.add(measurementTypeKey);
150
+ }
151
+ if (policy === "daily-totals-only") {
152
+ const temporal = data;
153
+ const end = temporal.end instanceof Date ? temporal.end : undefined;
154
+ const now = new Date();
155
+
156
+ // Activity totals are useful only after their day has closed. Devices that
157
+ // do not expose an interval are not filtered by this policy.
158
+ if (end && end.getTime() > now.getTime()) {
159
+ return;
160
+ }
161
+ const day = temporal.end ?? temporal.start ?? temporal.recordedAt;
162
+ if (day instanceof Date) {
163
+ const key = `${measurementTypeKey}:${day.toISOString().slice(0, 10)}`;
164
+ if (this.reportedDailyTotals.has(key)) {
165
+ return;
166
+ }
167
+ this.reportedDailyTotals.add(key);
168
+ }
169
+ }
116
170
  this.resultReportedThisConnection = true;
171
+ this.historyResultCount += 1;
172
+ recordOvokMetric("ovok.readings.received", 1, {
173
+ deviceId: this.deviceData.id,
174
+ model: this.deviceData.name,
175
+ measurementTypeKey
176
+ });
177
+ addOvokSpanEvent("reading.received", {
178
+ deviceId: this.deviceData.id,
179
+ model: this.deviceData.name,
180
+ measurementTypeKey
181
+ });
117
182
  sentryLogger("info", "BT_MANAGER: Calling onResult callback", {
118
183
  data: summariseMeasurementForLog(data),
119
184
  deviceData: this.deviceData,
120
185
  deviceName: this.deviceData.name
121
186
  });
122
- onResultCallback?.({
187
+ onConnectionEventCallback?.({
188
+ deviceData: this.deviceData,
189
+ kind: "history-download",
190
+ progress: {
191
+ current: this.historyResultCount
192
+ }
193
+ });
194
+ const result = {
123
195
  deviceData: this.deviceData,
124
196
  data
197
+ };
198
+
199
+ // Keep the new identity available to consumers while preserving the enumerable
200
+ // callback shape used by 1.5 integrations. Queue adapters materialize it below.
201
+ Object.defineProperty(result, "id", {
202
+ value: createStableResultId(this.deviceData, data),
203
+ enumerable: false,
204
+ writable: false
125
205
  });
206
+ onResultCallback?.(result);
126
207
  };
127
208
  this.onDeviceDisconnected = onDeviceDisconnectedCallback;
209
+ this.onConnectionEvent = onConnectionEventCallback;
128
210
  }
129
211
  destroy = () => {
130
212
  sentryLogger("info", "BT_MANAGER: Destroying device", {
@@ -136,9 +218,25 @@ export class BTManagedDevice {
136
218
  this.onError = undefined;
137
219
  this.onDeviceStatusChanged = undefined;
138
220
  this.onResult = undefined;
221
+ this.onConnectionEvent = undefined;
222
+ };
223
+
224
+ /** Stops this device's subscriptions and closes its BLE connection. */
225
+ disconnect = async () => {
226
+ this.destroy();
227
+ try {
228
+ await this.device.cancelConnection();
229
+ } catch (error) {
230
+ sentryLogger("info", "BT_MANAGER: Device was already disconnected", {
231
+ deviceId: this.device.id,
232
+ error: error instanceof Error ? error.message : String(error)
233
+ });
234
+ }
139
235
  };
140
236
  connect = async () => {
141
237
  this.resultReportedThisConnection = false;
238
+ this.reportedMeasurementKinds.clear();
239
+ this.historyResultCount = 0;
142
240
 
143
241
  // To access the abstract property in the constructor, we need to set it here
144
242
  this.deviceData.measurementTypes = supportedMeasurementTypeKeys(this.mainServices);
@@ -146,12 +244,22 @@ export class BTManagedDevice {
146
244
  this.connectionHandler = new BTConnectionHandler(this.device, this.mainServices, {
147
245
  onStatusChanged: status => {
148
246
  this.onDeviceStatusChanged?.bind(this)(status);
247
+ if (status === DeviceStatus.CONNECTED) {
248
+ this.onConnectionEvent?.({
249
+ deviceData: this.deviceData,
250
+ kind: "bonded"
251
+ });
252
+ }
149
253
  if (status === DeviceStatus.DISCONNECTED) {
150
254
  this.onDeviceDisconnected?.();
151
255
  this.destroy();
152
256
  }
153
257
  },
154
258
  onError: error => this.onError?.bind(this)(error),
259
+ onConnectionEvent: event => this.onConnectionEvent?.({
260
+ deviceData: this.deviceData,
261
+ ...event
262
+ }),
155
263
  onDataReceived: (uuid, hexValue) => {
156
264
  this.dataProcessor?.processData(uuid, hexValue);
157
265
  },
@@ -1 +1 @@
1
- {"version":3,"names":["sentryLogger","DeviceStatus","summariseMeasurementForLog","supportedMeasurementTypeKeys","BTConnectionHandler","BTDataProcessor","pollingSequencerFor","BTManagedDevice","resultReportedThisConnection","constructor","device","deviceName","onError","onErrorCallback","onDeviceStatusChanged","onDeviceStatusChangedCallback","onResult","onResultCallback","onDeviceDisconnected","onDeviceDisconnectedCallback","oneReadingPerConnection","deviceId","id","deviceData","name","localName","manufacturerData","sn","measurementTypes","status","measurementTypeKey","error","Error","message","caseType","_","data","destroy","connectionHandler","dataProcessor","undefined","connect","mainServices","sequencer","createCommandSequencer","onStatusChanged","bind","DISCONNECTED","onDataReceived","uuid","hexValue","processData","onDeviceInfo","info","manufacturerName","model","serialNumber","initialCommands","onCommandSent","armStuckTimeout","isNormalDisconnect","preferredMtu","stuckDataTimeout","onStreamStart","validatePackage","parsedData","collectedValues","handleSuccessResult","nextCommand","frame","sendCommands","commands","handleDependentResult","frameReader"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/bt-managed-device.ts"],"mappings":";;AAAA;;AAKA,SAASA,YAAY,QAAQ,yCAAsC;AAOnE,SAASC,YAAY,QAAQ,8BAA2B;AAMxD,SAASC,0BAA0B,QAAQ,8CAA2C;AACtF,SAASC,4BAA4B,QAAQ,gDAA6C;AAE1F,SAASC,mBAAmB,QAAQ,4BAAyB;AAC7D,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,mBAAmB,QAAQ,gCAA6B;AAEjE,OAAO,MAAeC,eAAe,CAErC;EAQUC,4BAA4B,GAAG,KAAK;;EAG5C;AACF;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAOE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;;EAiBEC,WAAWA,CACOC,MAAc,EAE9B;IACEC,UAAU;IACVC,OAAO,EAAEC,eAAe;IACxBC,qBAAqB,EAAEC,6BAA6B;IACpDC,QAAQ,EAAEC,gBAAgB;IAC1BC,oBAAoB,EAAEC,4BAA4B;IAClDC;EACqB,CAAC,EACxB;IAAA,KAVgBV,MAAc,GAAdA,MAAc;IAW9B,IAAI,CAACU,uBAAuB,GAAGA,uBAAuB,KAAK,IAAI;IAC/DpB,YAAY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oothError","toBluetoothError","DeviceStatus","createStableResultId","summariseMeasurementForLog","supportedMeasurementTypeKeys","BTConnectionHandler","BTDataProcessor","pollingSequencerFor","BTManagedDevice","resultReportedThisConnection","reportedMeasurementKinds","Set","reportedDailyTotals","historyResultCount","constructor","device","deviceName","onError","onErrorCallback","onDeviceStatusChanged","onDeviceStatusChangedCallback","onResult","onResultCallback","onConnectionEvent","onConnectionEventCallback","onDeviceDisconnected","onDeviceDisconnectedCallback","oneReadingPerConnection","resultPolicy","deviceId","id","deviceData","name","localName","manufacturerData","sn","measurementTypes","status","measurementTypeKey","model","error","Error","message","normalized","Object","defineProperty","value","code","configurable","enumerable","caseType","_","data","policy","byMeasurement","default","has","add","temporal","end","Date","undefined","now","getTime","day","start","recordedAt","key","toISOString","slice","kind","progress","current","result","writable","destroy","connectionHandler","dataProcessor","disconnect","cancelConnection","String","connect","clear","mainServices","sequencer","createCommandSequencer","onStatusChanged","bind","CONNECTED","DISCONNECTED","event","onDataReceived","uuid","hexValue","processData","onDeviceInfo","info","manufacturerName","serialNumber","initialCommands","onCommandSent","armStuckTimeout","isNormalDisconnect","preferredMtu","stuckDataTimeout","onStreamStart","validatePackage","parsedData","collectedValues","handleSuccessResult","nextCommand","frame","sendCommands","commands","handleDependentResult","frameReader"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/bt-managed-device.ts"],"mappings":";;AAAA;;AAKA,SAASA,YAAY,QAAQ,yCAAsC;AACnE,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,qCAAkC;AACrF,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,gCAA6B;AAQ9E,SAASC,YAAY,QAAQ,8BAA2B;AAOxD,SAASC,oBAAoB,QAAQ,gCAA6B;AAClE,SAASC,0BAA0B,QAAQ,8CAA2C;AACtF,SAASC,4BAA4B,QAAQ,gDAA6C;AAE1F,SAASC,mBAAmB,QAAQ,4BAAyB;AAC7D,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,mBAA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OAAO,EAAEsE,IAAI,CAAC,IAAI,CAAC,CAAC/C,KAAyB,CAAC;QACrD;MACF,CAAC;MACDsE,WAAW,EAAGC,KAAK,IAAK3B,SAAS,CAAC0B,WAAW,CAACC,KAAK,CAAC;MACpDC,YAAY,EAAGC,QAAQ,IACrB,KAAK,IAAI,CAACrC,iBAAiB,EAAEoC,YAAY,CAACC,QAAQ,CAAC;MACrDhG,OAAO,EAAE,IAAI,CAACA,OAAO,EAAEsE,IAAI,CAAC,IAAI,CAAC;MACjC2B,qBAAqB,EAAE,IAAI,CAACA,qBAAqB,EAAE3B,IAAI,CAAC,IAAI;IAC9D,CAAC,EACD,IAAI,CAAC4B,WACP,CAAC;IAED,MAAM,IAAI,CAACvC,iBAAiB,CAACK,OAAO,CAAC,CAAC;EACxC,CAAC;AACH","ignoreList":[]}
@@ -8,8 +8,8 @@ import { DeviceStatus } from "../../types/device-status.js";
8
8
  *
9
9
  * A result is reported whether or not a stream preceded it, because a device already
10
10
  * holding a finished measurement when the app connects has a real reading to hand over.
11
- * Repeats are suppressed on the case transition rather than on the values, so a second
12
- * measurement that happens to read the same as the first is still reported.
11
+ * Identical result frames are suppressed, while a changed frame in the same case is still
12
+ * reported as a new measurement.
13
13
  */
14
14
  export class MeasurementStateMachine {
15
15
  isMeasuring = false;
@@ -19,6 +19,7 @@ export class MeasurementStateMachine {
19
19
  reset = () => {
20
20
  this.isMeasuring = false;
21
21
  this.lastCaseValue = undefined;
22
+ this.lastFrame = undefined;
22
23
  };
23
24
  advance = ({
24
25
  parsingCase,
@@ -26,8 +27,9 @@ export class MeasurementStateMachine {
26
27
  parsedData
27
28
  }, frame) => {
28
29
  const isResult = parsingCase.caseType === CaseType.RESULT;
29
- const isRepeatedResult = isResult && parsingCase.caseValue === this.lastCaseValue;
30
+ const isRepeatedResult = isResult && parsingCase.caseValue === this.lastCaseValue && this.lastFrame?.join("").toLowerCase() === frame.join("").toLowerCase();
30
31
  this.lastCaseValue = parsingCase.caseValue;
32
+ this.lastFrame = [...frame];
31
33
  if (parsingCase.caseType === CaseType.STREAM && !this.isMeasuring) {
32
34
  this.startMeasuring(measurementTypeKey);
33
35
  }
@@ -1 +1 @@
1
- {"version":3,"names":["CaseType","DeviceStatus","MeasurementStateMachine","isMeasuring","constructor","callbacks","reset","lastCaseValue","undefined","advance","parsingCase","measurementTypeKey","parsedData","frame","isResult","caseType","RESULT","isRepeatedResult","caseValue","STREAM","startMeasuring","OTHER","stopMeasuring","keepMeasuring","onResult","onStreamStart","onStatusChanged","MEASURING","CONNECTED"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/measurement-state-machine.ts"],"mappings":";;AAEA,SAASA,QAAQ,QAAQ,0BAAuB;AAEhD,SAASC,YAAY,QAAQ,8BAA2B;AAexD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,CAAwB;EAClDC,WAAW,GAAY,KAAK;EAGpCC,WAAWA,CAAkBC,SAAoC,EAAE;IAAA,KAAtCA,SAAoC,GAApCA,SAAoC;EAAG;EAE7DC,KAAK,GAAGA,CAAA,KAAY;IACzB,IAAI,CAACH,WAAW,GAAG,KAAK;IACxB,IAAI,CAACI,aAAa,GAAGC,SAAS;EAChC,CAAC;EAEMC,OAAO,GAAGA,CACf;IACEC,WAAW;IACXC,kBAAkB;IAClBC;EAC+B,CAAC,EAClCC,KAAe,KACN;IACT,MAAMC,QAAQ,GAAGJ,WAAW,CAACK,QAAQ,KAAKf,QAAQ,CAACgB,MAAM;IAEzD,MAAMC,gBAAgB,GACpBH,QAAQ,IAAIJ,WAAW,CAACQ,SAAS,KAAK,IAAI,CAACX,aAAa;IAE1D,IAAI,CAACA,aAAa,GAAGG,WAAW,CAACQ,SAAS;IAE1C,IAAIR,WAAW,CAACK,QAAQ,KAAKf,QAAQ,CAACmB,MAAM,IAAI,CAAC,IAAI,CAAChB,WAAW,EAAE;MACjE,IAAI,CAACiB,cAAc,CAACT,kBAAkB,CAAC;IACzC;IAEA,IAAI,IAAI,CAACR,WAAW,IAAIO,WAAW,CAACK,QAAQ,KAAKf,QAAQ,CAACqB,KAAK,EAAE;MAC/D,IAAI,CAACC,aAAa,CAACX,kBAAkB,CAAC;IACxC;IAEA,IAAIM,gBAAgB,EAAE;MACpB;IACF;IAEA,IAAIM,aAAa,GAAG,KAAK;IAEzB,IAAI,IAAI,CAACpB,WAAW,IAAIW,QAAQ,EAAE;MAChCS,aAAa,GAAG,IAAI,CAAClB,SAAS,CAACmB,QAAQ,GAAGZ,UAAU,EAAEC,KAAK,CAAC,IAAI,KAAK;IACvE;IAEA,IAAIC,QAAQ,IAAI,CAACS,aAAa,EAAE;MAC9B,IAAI,CAACD,aAAa,CAACX,kBAAkB,CAAC;IACxC;EACF,CAAC;EAEOS,cAAc,GAAIT,kBAAuC,IAAW;IAC1E,IAAI,CAACN,SAAS,CAACoB,aAAa,GAAG,CAAC;IAChC,IAAI,CAACpB,SAAS,CAACqB,eAAe,GAAGzB,YAAY,CAAC0B,SAAS,EAAEhB,kBAAkB,CAAC;IAC5E,IAAI,CAACR,WAAW,GAAG,IAAI;EACzB,CAAC;EAEOmB,aAAa,GAAIX,kBAAuC,IAAW;IACzE,IAAI,CAACR,WAAW,GAAG,KAAK;IACxB,IAAI,CAACE,SAAS,CAACqB,eAAe,GAC5BzB,YAAY,CAAC2B,SAAS,EACtBjB,kBACF,CAAC;EACH,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["CaseType","DeviceStatus","MeasurementStateMachine","isMeasuring","constructor","callbacks","reset","lastCaseValue","undefined","lastFrame","advance","parsingCase","measurementTypeKey","parsedData","frame","isResult","caseType","RESULT","isRepeatedResult","caseValue","join","toLowerCase","STREAM","startMeasuring","OTHER","stopMeasuring","keepMeasuring","onResult","onStreamStart","onStatusChanged","MEASURING","CONNECTED"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/measurement-state-machine.ts"],"mappings":";;AAEA,SAASA,QAAQ,QAAQ,0BAAuB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