@ovok/native 1.5.5 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (656) 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/services/devices/veroval/veroval-activity-sequencer.js +9 -3
  88. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.js.map +1 -1
  89. package/lib/commonjs/modules/bt-management/testing/fake-ble-manager.js +52 -0
  90. package/lib/commonjs/modules/bt-management/testing/fake-ble-manager.js.map +1 -0
  91. package/lib/commonjs/modules/bt-management/testing/index.js +28 -0
  92. package/lib/commonjs/modules/bt-management/testing/index.js.map +1 -0
  93. package/lib/commonjs/modules/bt-management/testing/recorded-frames.js +23 -0
  94. package/lib/commonjs/modules/bt-management/testing/recorded-frames.js.map +1 -0
  95. package/lib/commonjs/modules/bt-management/types/bluetooth-error.js +80 -0
  96. package/lib/commonjs/modules/bt-management/types/bluetooth-error.js.map +1 -0
  97. package/lib/commonjs/modules/bt-management/types/device-connection-event.js +6 -0
  98. package/lib/commonjs/modules/bt-management/types/device-connection-event.js.map +1 -0
  99. package/lib/commonjs/modules/bt-management/types/result-policy.js +6 -0
  100. package/lib/commonjs/modules/bt-management/types/result-policy.js.map +1 -0
  101. package/lib/commonjs/modules/bt-management/utils/result-identity.js +63 -0
  102. package/lib/commonjs/modules/bt-management/utils/result-identity.js.map +1 -0
  103. package/lib/commonjs/modules/data-sync/components/android/android-health-connect-authorization-provider.js +8 -2
  104. package/lib/commonjs/modules/data-sync/components/android/android-health-connect-authorization-provider.js.map +1 -1
  105. package/lib/commonjs/modules/data-sync/services/base-health-sync-service.js +23 -4
  106. package/lib/commonjs/modules/data-sync/services/base-health-sync-service.js.map +1 -1
  107. package/lib/commonjs/modules/data-sync/services/managers/data-processor.js +2 -2
  108. package/lib/commonjs/modules/data-sync/services/managers/data-processor.js.map +1 -1
  109. package/lib/commonjs/modules/data-sync/services/managers/sync-progress-manager.js +1 -1
  110. package/lib/commonjs/modules/data-sync/services/managers/sync-progress-manager.js.map +1 -1
  111. package/lib/commonjs/modules/data-sync/utils/retry-save.js +65 -0
  112. package/lib/commonjs/modules/data-sync/utils/retry-save.js.map +1 -0
  113. package/lib/commonjs/modules/helpers/form-items/form-field.js +2 -0
  114. package/lib/commonjs/modules/helpers/form-items/form-field.js.map +1 -1
  115. package/lib/commonjs/modules/helpers/index.js +12 -0
  116. package/lib/commonjs/modules/helpers/index.js.map +1 -1
  117. package/lib/commonjs/modules/helpers/utils/s-log.js +4 -13
  118. package/lib/commonjs/modules/helpers/utils/s-log.js.map +1 -1
  119. package/lib/commonjs/modules/helpers/utils/sentry-logger.js +28 -17
  120. package/lib/commonjs/modules/helpers/utils/sentry-logger.js.map +1 -1
  121. package/lib/commonjs/modules/helpers/utils/telemetry.js +143 -0
  122. package/lib/commonjs/modules/helpers/utils/telemetry.js.map +1 -0
  123. package/lib/commonjs/modules/image/components/optimized-image.js +24 -2
  124. package/lib/commonjs/modules/image/components/optimized-image.js.map +1 -1
  125. package/lib/commonjs/modules/questionnaire-response-form/components/content/questionnaire-content-error.js +18 -9
  126. package/lib/commonjs/modules/questionnaire-response-form/components/content/questionnaire-content-error.js.map +1 -1
  127. package/lib/commonjs/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.js +3 -2
  128. package/lib/commonjs/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.js.map +1 -1
  129. package/lib/commonjs/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.js +4 -2
  130. package/lib/commonjs/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.js.map +1 -1
  131. package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-form-provider.js +42 -17
  132. package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-form-provider.js.map +1 -1
  133. package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-navigation-provider.js +2 -1
  134. package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-navigation-provider.js.map +1 -1
  135. package/lib/commonjs/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.js.map +1 -1
  136. package/lib/commonjs/modules/tile/components/task-icon.js +2 -1
  137. package/lib/commonjs/modules/tile/components/task-icon.js.map +1 -1
  138. package/lib/commonjs/modules/ui/components/background-sync-setting.js +113 -0
  139. package/lib/commonjs/modules/ui/components/background-sync-setting.js.map +1 -0
  140. package/lib/commonjs/modules/ui/components/bluetooth-state-notice.js +105 -0
  141. package/lib/commonjs/modules/ui/components/bluetooth-state-notice.js.map +1 -0
  142. package/lib/commonjs/modules/ui/components/ecg-strip-viewer.js +165 -0
  143. package/lib/commonjs/modules/ui/components/ecg-strip-viewer.js.map +1 -0
  144. package/lib/commonjs/modules/ui/components/health-import-card.js +130 -0
  145. package/lib/commonjs/modules/ui/components/health-import-card.js.map +1 -0
  146. package/lib/commonjs/modules/ui/components/manual-entry-form.js +123 -0
  147. package/lib/commonjs/modules/ui/components/manual-entry-form.js.map +1 -0
  148. package/lib/commonjs/modules/ui/components/pairing-flow.js +222 -0
  149. package/lib/commonjs/modules/ui/components/pairing-flow.js.map +1 -0
  150. package/lib/commonjs/modules/ui/components/supported-devices-catalog-list.js +99 -0
  151. package/lib/commonjs/modules/ui/components/supported-devices-catalog-list.js.map +1 -0
  152. package/lib/commonjs/modules/ui/components/urine-test-result.js +94 -0
  153. package/lib/commonjs/modules/ui/components/urine-test-result.js.map +1 -0
  154. package/lib/commonjs/modules/ui/index.js +116 -0
  155. package/lib/commonjs/modules/ui/index.js.map +1 -0
  156. package/lib/commonjs/modules/ui/types.js +6 -0
  157. package/lib/commonjs/modules/ui/types.js.map +1 -0
  158. package/lib/commonjs/modules/ui/use-ovok-ui.js +51 -0
  159. package/lib/commonjs/modules/ui/use-ovok-ui.js.map +1 -0
  160. package/lib/module/index.js +1 -0
  161. package/lib/module/index.js.map +1 -1
  162. package/lib/module/modules/auth/delete-account-button/components/delete-account-button.js +2 -0
  163. package/lib/module/modules/auth/delete-account-button/components/delete-account-button.js.map +1 -1
  164. package/lib/module/modules/auth/hooks/use-rate-limit-cooldown.js +17 -0
  165. package/lib/module/modules/auth/hooks/use-rate-limit-cooldown.js.map +1 -0
  166. package/lib/module/modules/auth/hooks/use-session.js +85 -0
  167. package/lib/module/modules/auth/hooks/use-session.js.map +1 -0
  168. package/lib/module/modules/auth/index.js +4 -0
  169. package/lib/module/modules/auth/index.js.map +1 -1
  170. package/lib/module/modules/auth/logout-button/components/logout-button.js +3 -1
  171. package/lib/module/modules/auth/logout-button/components/logout-button.js.map +1 -1
  172. package/lib/module/modules/auth/register/components/form/inputs.js +48 -1
  173. package/lib/module/modules/auth/register/components/form/inputs.js.map +1 -1
  174. package/lib/module/modules/auth/register/components/form/register-button.js +4 -0
  175. package/lib/module/modules/auth/register/components/form/register-button.js.map +1 -1
  176. package/lib/module/modules/auth/register/components/form/register-form-provider.js +6 -0
  177. package/lib/module/modules/auth/register/components/form/register-form-provider.js.map +1 -1
  178. package/lib/module/modules/auth/reset-password/components/form/inputs.js +12 -0
  179. package/lib/module/modules/auth/reset-password/components/form/inputs.js.map +1 -1
  180. package/lib/module/modules/auth/reset-password/components/form/reset-password-button.js +4 -0
  181. package/lib/module/modules/auth/reset-password/components/form/reset-password-button.js.map +1 -1
  182. package/lib/module/modules/auth/reset-password/components/form/reset-password-form-provider.js +7 -1
  183. package/lib/module/modules/auth/reset-password/components/form/reset-password-form-provider.js.map +1 -1
  184. package/lib/module/modules/auth/session/components/session-list.js +76 -0
  185. package/lib/module/modules/auth/session/components/session-list.js.map +1 -0
  186. package/lib/module/modules/auth/session/events.js +13 -0
  187. package/lib/module/modules/auth/session/events.js.map +1 -0
  188. package/lib/module/modules/auth/session/index.js +4 -0
  189. package/lib/module/modules/auth/session/index.js.map +1 -0
  190. package/lib/module/modules/auth/session/types/session-list-props.js +4 -0
  191. package/lib/module/modules/auth/session/types/session-list-props.js.map +1 -0
  192. package/lib/module/modules/auth/sign-in/components/form/inputs.js +25 -0
  193. package/lib/module/modules/auth/sign-in/components/form/inputs.js.map +1 -1
  194. package/lib/module/modules/auth/sign-in/components/form/login-form-provider.js +48 -1
  195. package/lib/module/modules/auth/sign-in/components/form/login-form-provider.js.map +1 -1
  196. package/lib/module/modules/auth/sign-in/components/form/mfa-code-input.js +52 -0
  197. package/lib/module/modules/auth/sign-in/components/form/mfa-code-input.js.map +1 -0
  198. package/lib/module/modules/auth/sign-in/components/form/sign-in-with-email.js +2 -0
  199. package/lib/module/modules/auth/sign-in/components/form/sign-in-with-email.js.map +1 -1
  200. package/lib/module/modules/auth/sign-in/components/form/signin-button.js +13 -5
  201. package/lib/module/modules/auth/sign-in/components/form/signin-button.js.map +1 -1
  202. package/lib/module/modules/auth/types/session.js +2 -0
  203. package/lib/module/modules/auth/types/session.js.map +1 -0
  204. package/lib/module/modules/auth/utils/rate-limit.js +31 -0
  205. package/lib/module/modules/auth/utils/rate-limit.js.map +1 -0
  206. package/lib/module/modules/background-sync/android-bluetooth-foreground-service.js +3 -2
  207. package/lib/module/modules/background-sync/android-bluetooth-foreground-service.js.map +1 -1
  208. package/lib/module/modules/background-sync/background-safe-storage.js +74 -0
  209. package/lib/module/modules/background-sync/background-safe-storage.js.map +1 -0
  210. package/lib/module/modules/background-sync/index.js +1 -0
  211. package/lib/module/modules/background-sync/index.js.map +1 -1
  212. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +123 -21
  213. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  214. package/lib/module/modules/bt-management/hooks/runtime-context.js +82 -0
  215. package/lib/module/modules/bt-management/hooks/runtime-context.js.map +1 -0
  216. package/lib/module/modules/bt-management/hooks/use-background-sync.js +41 -0
  217. package/lib/module/modules/bt-management/hooks/use-background-sync.js.map +1 -0
  218. package/lib/module/modules/bt-management/hooks/use-bluetooth-state.js +45 -0
  219. package/lib/module/modules/bt-management/hooks/use-bluetooth-state.js.map +1 -0
  220. package/lib/module/modules/bt-management/hooks/use-device-connection.js +30 -0
  221. package/lib/module/modules/bt-management/hooks/use-device-connection.js.map +1 -0
  222. package/lib/module/modules/bt-management/hooks/use-health-import.js +40 -0
  223. package/lib/module/modules/bt-management/hooks/use-health-import.js.map +1 -0
  224. package/lib/module/modules/bt-management/hooks/use-measurements.js +51 -0
  225. package/lib/module/modules/bt-management/hooks/use-measurements.js.map +1 -0
  226. package/lib/module/modules/bt-management/hooks/use-nearby-devices.js +20 -0
  227. package/lib/module/modules/bt-management/hooks/use-nearby-devices.js.map +1 -0
  228. package/lib/module/modules/bt-management/hooks/use-paired-devices.js +43 -0
  229. package/lib/module/modules/bt-management/hooks/use-paired-devices.js.map +1 -0
  230. package/lib/module/modules/bt-management/index.js +13 -0
  231. package/lib/module/modules/bt-management/index.js.map +1 -1
  232. package/lib/module/modules/bt-management/services/background-sync/background-sync-coordinator.js +41 -4
  233. package/lib/module/modules/bt-management/services/background-sync/background-sync-coordinator.js.map +1 -1
  234. package/lib/module/modules/bt-management/services/bt-manager.js +75 -4
  235. package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
  236. package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js +57 -0
  237. package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
  238. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +111 -3
  239. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  240. package/lib/module/modules/bt-management/services/devices/measurement-state-machine.js +5 -3
  241. package/lib/module/modules/bt-management/services/devices/measurement-state-machine.js.map +1 -1
  242. package/lib/module/modules/bt-management/services/devices/spo/spo2.main-services.js +12 -0
  243. package/lib/module/modules/bt-management/services/devices/spo/spo2.main-services.js.map +1 -1
  244. package/lib/module/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.js +9 -3
  245. package/lib/module/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.js.map +1 -1
  246. package/lib/module/modules/bt-management/testing/fake-ble-manager.js +48 -0
  247. package/lib/module/modules/bt-management/testing/fake-ble-manager.js.map +1 -0
  248. package/lib/module/modules/bt-management/testing/index.js +5 -0
  249. package/lib/module/modules/bt-management/testing/index.js.map +1 -0
  250. package/lib/module/modules/bt-management/testing/recorded-frames.js +17 -0
  251. package/lib/module/modules/bt-management/testing/recorded-frames.js.map +1 -0
  252. package/lib/module/modules/bt-management/types/bluetooth-error.js +74 -0
  253. package/lib/module/modules/bt-management/types/bluetooth-error.js.map +1 -0
  254. package/lib/module/modules/bt-management/types/device-connection-event.js +4 -0
  255. package/lib/module/modules/bt-management/types/device-connection-event.js.map +1 -0
  256. package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
  257. package/lib/module/modules/bt-management/types/result-policy.js +4 -0
  258. package/lib/module/modules/bt-management/types/result-policy.js.map +1 -0
  259. package/lib/module/modules/bt-management/utils/result-identity.js +57 -0
  260. package/lib/module/modules/bt-management/utils/result-identity.js.map +1 -0
  261. package/lib/module/modules/data-sync/components/android/android-health-connect-authorization-provider.js +8 -2
  262. package/lib/module/modules/data-sync/components/android/android-health-connect-authorization-provider.js.map +1 -1
  263. package/lib/module/modules/data-sync/services/base-health-sync-service.js +23 -4
  264. package/lib/module/modules/data-sync/services/base-health-sync-service.js.map +1 -1
  265. package/lib/module/modules/data-sync/services/managers/data-processor.js +2 -2
  266. package/lib/module/modules/data-sync/services/managers/data-processor.js.map +1 -1
  267. package/lib/module/modules/data-sync/services/managers/sync-progress-manager.js +1 -1
  268. package/lib/module/modules/data-sync/services/managers/sync-progress-manager.js.map +1 -1
  269. package/lib/module/modules/data-sync/utils/retry-save.js +60 -0
  270. package/lib/module/modules/data-sync/utils/retry-save.js.map +1 -0
  271. package/lib/module/modules/helpers/form-items/form-field.js +2 -0
  272. package/lib/module/modules/helpers/form-items/form-field.js.map +1 -1
  273. package/lib/module/modules/helpers/index.js +1 -0
  274. package/lib/module/modules/helpers/index.js.map +1 -1
  275. package/lib/module/modules/helpers/utils/s-log.js +4 -12
  276. package/lib/module/modules/helpers/utils/s-log.js.map +1 -1
  277. package/lib/module/modules/helpers/utils/sentry-logger.js +26 -14
  278. package/lib/module/modules/helpers/utils/sentry-logger.js.map +1 -1
  279. package/lib/module/modules/helpers/utils/telemetry.js +131 -0
  280. package/lib/module/modules/helpers/utils/telemetry.js.map +1 -0
  281. package/lib/module/modules/image/components/optimized-image.js +25 -3
  282. package/lib/module/modules/image/components/optimized-image.js.map +1 -1
  283. package/lib/module/modules/questionnaire-response-form/components/content/questionnaire-content-error.js +20 -11
  284. package/lib/module/modules/questionnaire-response-form/components/content/questionnaire-content-error.js.map +1 -1
  285. package/lib/module/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.js +3 -2
  286. package/lib/module/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.js.map +1 -1
  287. package/lib/module/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.js +4 -2
  288. package/lib/module/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.js.map +1 -1
  289. package/lib/module/modules/questionnaire-response-form/components/questionnaire-form-provider.js +42 -17
  290. package/lib/module/modules/questionnaire-response-form/components/questionnaire-form-provider.js.map +1 -1
  291. package/lib/module/modules/questionnaire-response-form/components/questionnaire-navigation-provider.js +2 -1
  292. package/lib/module/modules/questionnaire-response-form/components/questionnaire-navigation-provider.js.map +1 -1
  293. package/lib/module/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.js.map +1 -1
  294. package/lib/module/modules/tile/components/task-icon.js +2 -1
  295. package/lib/module/modules/tile/components/task-icon.js.map +1 -1
  296. package/lib/module/modules/ui/components/background-sync-setting.js +107 -0
  297. package/lib/module/modules/ui/components/background-sync-setting.js.map +1 -0
  298. package/lib/module/modules/ui/components/bluetooth-state-notice.js +99 -0
  299. package/lib/module/modules/ui/components/bluetooth-state-notice.js.map +1 -0
  300. package/lib/module/modules/ui/components/ecg-strip-viewer.js +159 -0
  301. package/lib/module/modules/ui/components/ecg-strip-viewer.js.map +1 -0
  302. package/lib/module/modules/ui/components/health-import-card.js +124 -0
  303. package/lib/module/modules/ui/components/health-import-card.js.map +1 -0
  304. package/lib/module/modules/ui/components/manual-entry-form.js +117 -0
  305. package/lib/module/modules/ui/components/manual-entry-form.js.map +1 -0
  306. package/lib/module/modules/ui/components/pairing-flow.js +216 -0
  307. package/lib/module/modules/ui/components/pairing-flow.js.map +1 -0
  308. package/lib/module/modules/ui/components/supported-devices-catalog-list.js +93 -0
  309. package/lib/module/modules/ui/components/supported-devices-catalog-list.js.map +1 -0
  310. package/lib/module/modules/ui/components/urine-test-result.js +89 -0
  311. package/lib/module/modules/ui/components/urine-test-result.js.map +1 -0
  312. package/lib/module/modules/ui/index.js +13 -0
  313. package/lib/module/modules/ui/index.js.map +1 -0
  314. package/lib/module/modules/ui/types.js +4 -0
  315. package/lib/module/modules/ui/types.js.map +1 -0
  316. package/lib/module/modules/ui/use-ovok-ui.js +45 -0
  317. package/lib/module/modules/ui/use-ovok-ui.js.map +1 -0
  318. package/lib/typescript/commonjs/src/index.d.ts +1 -0
  319. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  320. package/lib/typescript/commonjs/src/modules/auth/delete-account-button/components/delete-account-button.d.ts.map +1 -1
  321. package/lib/typescript/commonjs/src/modules/auth/hooks/use-rate-limit-cooldown.d.ts +2 -0
  322. package/lib/typescript/commonjs/src/modules/auth/hooks/use-rate-limit-cooldown.d.ts.map +1 -0
  323. package/lib/typescript/commonjs/src/modules/auth/hooks/use-session.d.ts +16 -0
  324. package/lib/typescript/commonjs/src/modules/auth/hooks/use-session.d.ts.map +1 -0
  325. package/lib/typescript/commonjs/src/modules/auth/index.d.ts +4 -0
  326. package/lib/typescript/commonjs/src/modules/auth/index.d.ts.map +1 -1
  327. package/lib/typescript/commonjs/src/modules/auth/logout-button/components/logout-button.d.ts.map +1 -1
  328. package/lib/typescript/commonjs/src/modules/auth/register/components/form/inputs.d.ts.map +1 -1
  329. package/lib/typescript/commonjs/src/modules/auth/register/components/form/register-button.d.ts.map +1 -1
  330. package/lib/typescript/commonjs/src/modules/auth/register/components/form/register-form-provider.d.ts.map +1 -1
  331. package/lib/typescript/commonjs/src/modules/auth/reset-password/components/form/inputs.d.ts.map +1 -1
  332. package/lib/typescript/commonjs/src/modules/auth/reset-password/components/form/reset-password-button.d.ts.map +1 -1
  333. package/lib/typescript/commonjs/src/modules/auth/reset-password/components/form/reset-password-form-provider.d.ts.map +1 -1
  334. package/lib/typescript/commonjs/src/modules/auth/session/components/session-list.d.ts +4 -0
  335. package/lib/typescript/commonjs/src/modules/auth/session/components/session-list.d.ts.map +1 -0
  336. package/lib/typescript/commonjs/src/modules/auth/session/events.d.ts +5 -0
  337. package/lib/typescript/commonjs/src/modules/auth/session/events.d.ts.map +1 -0
  338. package/lib/typescript/commonjs/src/modules/auth/session/index.d.ts +3 -0
  339. package/lib/typescript/commonjs/src/modules/auth/session/index.d.ts.map +1 -0
  340. package/lib/typescript/commonjs/src/modules/auth/session/types/session-list-props.d.ts +5 -0
  341. package/lib/typescript/commonjs/src/modules/auth/session/types/session-list-props.d.ts.map +1 -0
  342. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/inputs.d.ts.map +1 -1
  343. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/login-form-provider.d.ts.map +1 -1
  344. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/mfa-code-input.d.ts +9 -0
  345. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/mfa-code-input.d.ts.map +1 -0
  346. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/sign-in-with-email.d.ts +4 -0
  347. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/sign-in-with-email.d.ts.map +1 -1
  348. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/signin-button.d.ts.map +1 -1
  349. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/sign-in.d.ts +4 -0
  350. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/sign-in.d.ts.map +1 -1
  351. package/lib/typescript/commonjs/src/modules/auth/sign-in/contexts/login-form-context.d.ts +2 -46
  352. package/lib/typescript/commonjs/src/modules/auth/sign-in/contexts/login-form-context.d.ts.map +1 -1
  353. package/lib/typescript/commonjs/src/modules/auth/sign-in/hooks/use-login-form.d.ts +1 -47
  354. package/lib/typescript/commonjs/src/modules/auth/sign-in/hooks/use-login-form.d.ts.map +1 -1
  355. package/lib/typescript/commonjs/src/modules/auth/sign-in/types/login-form-context-type.d.ts +11 -1
  356. package/lib/typescript/commonjs/src/modules/auth/sign-in/types/login-form-context-type.d.ts.map +1 -1
  357. package/lib/typescript/commonjs/src/modules/auth/types/session.d.ts +13 -0
  358. package/lib/typescript/commonjs/src/modules/auth/types/session.d.ts.map +1 -0
  359. package/lib/typescript/commonjs/src/modules/auth/utils/rate-limit.d.ts +11 -0
  360. package/lib/typescript/commonjs/src/modules/auth/utils/rate-limit.d.ts.map +1 -0
  361. package/lib/typescript/commonjs/src/modules/background-sync/android-bluetooth-foreground-service.d.ts.map +1 -1
  362. package/lib/typescript/commonjs/src/modules/background-sync/background-safe-storage.d.ts +29 -0
  363. package/lib/typescript/commonjs/src/modules/background-sync/background-safe-storage.d.ts.map +1 -0
  364. package/lib/typescript/commonjs/src/modules/background-sync/index.d.ts +1 -0
  365. package/lib/typescript/commonjs/src/modules/background-sync/index.d.ts.map +1 -1
  366. package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  367. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +46 -0
  368. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -0
  369. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-background-sync.d.ts +14 -0
  370. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-background-sync.d.ts.map +1 -0
  371. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bluetooth-state.d.ts +11 -0
  372. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bluetooth-state.d.ts.map +1 -0
  373. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-device-connection.d.ts +7 -0
  374. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-device-connection.d.ts.map +1 -0
  375. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-health-import.d.ts +16 -0
  376. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-health-import.d.ts.map +1 -0
  377. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-measurements.d.ts +11 -0
  378. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -0
  379. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-nearby-devices.d.ts +8 -0
  380. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-nearby-devices.d.ts.map +1 -0
  381. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-paired-devices.d.ts +16 -0
  382. package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-paired-devices.d.ts.map +1 -0
  383. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +13 -0
  384. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
  385. package/lib/typescript/commonjs/src/modules/bt-management/services/background-sync/background-sync-coordinator.d.ts.map +1 -1
  386. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +22 -0
  387. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  388. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +4 -0
  389. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
  390. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +9 -1
  391. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  392. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/measurement-state-machine.d.ts +3 -2
  393. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/measurement-state-machine.d.ts.map +1 -1
  394. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/spo/spo2.main-services.d.ts.map +1 -1
  395. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.d.ts +2 -0
  396. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.d.ts.map +1 -1
  397. package/lib/typescript/commonjs/src/modules/bt-management/testing/fake-ble-manager.d.ts +16 -0
  398. package/lib/typescript/commonjs/src/modules/bt-management/testing/fake-ble-manager.d.ts.map +1 -0
  399. package/lib/typescript/commonjs/src/modules/bt-management/testing/index.d.ts +3 -0
  400. package/lib/typescript/commonjs/src/modules/bt-management/testing/index.d.ts.map +1 -0
  401. package/lib/typescript/commonjs/src/modules/bt-management/testing/recorded-frames.d.ts +12 -0
  402. package/lib/typescript/commonjs/src/modules/bt-management/testing/recorded-frames.d.ts.map +1 -0
  403. package/lib/typescript/commonjs/src/modules/bt-management/types/background-sync.d.ts +3 -1
  404. package/lib/typescript/commonjs/src/modules/bt-management/types/background-sync.d.ts.map +1 -1
  405. package/lib/typescript/commonjs/src/modules/bt-management/types/bluetooth-error.d.ts +23 -0
  406. package/lib/typescript/commonjs/src/modules/bt-management/types/bluetooth-error.d.ts.map +1 -0
  407. package/lib/typescript/commonjs/src/modules/bt-management/types/btprovider-children-props.d.ts +4 -0
  408. package/lib/typescript/commonjs/src/modules/bt-management/types/btprovider-children-props.d.ts.map +1 -1
  409. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts +4 -0
  410. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  411. package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts +16 -0
  412. package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -0
  413. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +2 -0
  414. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  415. package/lib/typescript/commonjs/src/modules/bt-management/types/error-callback.d.ts +5 -2
  416. package/lib/typescript/commonjs/src/modules/bt-management/types/error-callback.d.ts.map +1 -1
  417. package/lib/typescript/commonjs/src/modules/bt-management/types/i-bt-managed-device.d.ts +1 -0
  418. package/lib/typescript/commonjs/src/modules/bt-management/types/i-bt-managed-device.d.ts.map +1 -1
  419. package/lib/typescript/commonjs/src/modules/bt-management/types/result-callback.d.ts +2 -0
  420. package/lib/typescript/commonjs/src/modules/bt-management/types/result-callback.d.ts.map +1 -1
  421. package/lib/typescript/commonjs/src/modules/bt-management/types/result-policy.d.ts +8 -0
  422. package/lib/typescript/commonjs/src/modules/bt-management/types/result-policy.d.ts.map +1 -0
  423. package/lib/typescript/commonjs/src/modules/bt-management/utils/result-identity.d.ts +10 -0
  424. package/lib/typescript/commonjs/src/modules/bt-management/utils/result-identity.d.ts.map +1 -0
  425. package/lib/typescript/commonjs/src/modules/data-sync/components/android/android-health-connect-authorization-provider.d.ts.map +1 -1
  426. package/lib/typescript/commonjs/src/modules/data-sync/services/base-health-sync-service.d.ts.map +1 -1
  427. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts +4 -0
  428. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
  429. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
  430. package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts +2 -0
  431. package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
  432. package/lib/typescript/commonjs/src/modules/data-sync/types/sync-progress.d.ts +1 -1
  433. package/lib/typescript/commonjs/src/modules/data-sync/types/sync-progress.d.ts.map +1 -1
  434. package/lib/typescript/commonjs/src/modules/data-sync/utils/retry-save.d.ts +5 -0
  435. package/lib/typescript/commonjs/src/modules/data-sync/utils/retry-save.d.ts.map +1 -0
  436. package/lib/typescript/commonjs/src/modules/helpers/form-items/form-field.d.ts +4 -1
  437. package/lib/typescript/commonjs/src/modules/helpers/form-items/form-field.d.ts.map +1 -1
  438. package/lib/typescript/commonjs/src/modules/helpers/index.d.ts +1 -0
  439. package/lib/typescript/commonjs/src/modules/helpers/index.d.ts.map +1 -1
  440. package/lib/typescript/commonjs/src/modules/helpers/utils/s-log.d.ts.map +1 -1
  441. package/lib/typescript/commonjs/src/modules/helpers/utils/sentry-logger.d.ts +7 -1
  442. package/lib/typescript/commonjs/src/modules/helpers/utils/sentry-logger.d.ts.map +1 -1
  443. package/lib/typescript/commonjs/src/modules/helpers/utils/telemetry.d.ts +68 -0
  444. package/lib/typescript/commonjs/src/modules/helpers/utils/telemetry.d.ts.map +1 -0
  445. package/lib/typescript/commonjs/src/modules/image/components/optimized-image.d.ts +1 -1
  446. package/lib/typescript/commonjs/src/modules/image/components/optimized-image.d.ts.map +1 -1
  447. package/lib/typescript/commonjs/src/modules/image/types/optimized-image-props.d.ts +4 -0
  448. package/lib/typescript/commonjs/src/modules/image/types/optimized-image-props.d.ts.map +1 -1
  449. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/content/questionnaire-content-error.d.ts.map +1 -1
  450. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.d.ts.map +1 -1
  451. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.d.ts.map +1 -1
  452. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/questionnaire-form-provider.d.ts.map +1 -1
  453. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/questionnaire-navigation-provider.d.ts.map +1 -1
  454. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.d.ts +1 -0
  455. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.d.ts.map +1 -1
  456. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/hooks/use-navigation-handlers.d.ts +1 -0
  457. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/hooks/use-navigation-handlers.d.ts.map +1 -1
  458. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/hooks/use-questionnaire-navigation.d.ts +1 -0
  459. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/hooks/use-questionnaire-navigation.d.ts.map +1 -1
  460. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/types/questionnaire-form-context-type.d.ts +2 -0
  461. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/types/questionnaire-form-context-type.d.ts.map +1 -1
  462. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/types/questionnaire-navigation-provider-props.d.ts +1 -0
  463. package/lib/typescript/commonjs/src/modules/questionnaire-response-form/types/questionnaire-navigation-provider-props.d.ts.map +1 -1
  464. package/lib/typescript/commonjs/src/modules/tile/components/task-icon.d.ts.map +1 -1
  465. package/lib/typescript/commonjs/src/modules/ui/components/background-sync-setting.d.ts +9 -0
  466. package/lib/typescript/commonjs/src/modules/ui/components/background-sync-setting.d.ts.map +1 -0
  467. package/lib/typescript/commonjs/src/modules/ui/components/bluetooth-state-notice.d.ts +12 -0
  468. package/lib/typescript/commonjs/src/modules/ui/components/bluetooth-state-notice.d.ts.map +1 -0
  469. package/lib/typescript/commonjs/src/modules/ui/components/ecg-strip-viewer.d.ts +17 -0
  470. package/lib/typescript/commonjs/src/modules/ui/components/ecg-strip-viewer.d.ts.map +1 -0
  471. package/lib/typescript/commonjs/src/modules/ui/components/health-import-card.d.ts +13 -0
  472. package/lib/typescript/commonjs/src/modules/ui/components/health-import-card.d.ts.map +1 -0
  473. package/lib/typescript/commonjs/src/modules/ui/components/manual-entry-form.d.ts +20 -0
  474. package/lib/typescript/commonjs/src/modules/ui/components/manual-entry-form.d.ts.map +1 -0
  475. package/lib/typescript/commonjs/src/modules/ui/components/pairing-flow.d.ts +15 -0
  476. package/lib/typescript/commonjs/src/modules/ui/components/pairing-flow.d.ts.map +1 -0
  477. package/lib/typescript/commonjs/src/modules/ui/components/supported-devices-catalog-list.d.ts +16 -0
  478. package/lib/typescript/commonjs/src/modules/ui/components/supported-devices-catalog-list.d.ts.map +1 -0
  479. package/lib/typescript/commonjs/src/modules/ui/components/urine-test-result.d.ts +10 -0
  480. package/lib/typescript/commonjs/src/modules/ui/components/urine-test-result.d.ts.map +1 -0
  481. package/lib/typescript/commonjs/src/modules/ui/index.d.ts +11 -0
  482. package/lib/typescript/commonjs/src/modules/ui/index.d.ts.map +1 -0
  483. package/lib/typescript/commonjs/src/modules/ui/types.d.ts +24 -0
  484. package/lib/typescript/commonjs/src/modules/ui/types.d.ts.map +1 -0
  485. package/lib/typescript/commonjs/src/modules/ui/use-ovok-ui.d.ts +7 -0
  486. package/lib/typescript/commonjs/src/modules/ui/use-ovok-ui.d.ts.map +1 -0
  487. package/lib/typescript/module/src/index.d.ts +1 -0
  488. package/lib/typescript/module/src/index.d.ts.map +1 -1
  489. package/lib/typescript/module/src/modules/auth/delete-account-button/components/delete-account-button.d.ts.map +1 -1
  490. package/lib/typescript/module/src/modules/auth/hooks/use-rate-limit-cooldown.d.ts +2 -0
  491. package/lib/typescript/module/src/modules/auth/hooks/use-rate-limit-cooldown.d.ts.map +1 -0
  492. package/lib/typescript/module/src/modules/auth/hooks/use-session.d.ts +16 -0
  493. package/lib/typescript/module/src/modules/auth/hooks/use-session.d.ts.map +1 -0
  494. package/lib/typescript/module/src/modules/auth/index.d.ts +4 -0
  495. package/lib/typescript/module/src/modules/auth/index.d.ts.map +1 -1
  496. package/lib/typescript/module/src/modules/auth/logout-button/components/logout-button.d.ts.map +1 -1
  497. package/lib/typescript/module/src/modules/auth/register/components/form/inputs.d.ts.map +1 -1
  498. package/lib/typescript/module/src/modules/auth/register/components/form/register-button.d.ts.map +1 -1
  499. package/lib/typescript/module/src/modules/auth/register/components/form/register-form-provider.d.ts.map +1 -1
  500. package/lib/typescript/module/src/modules/auth/reset-password/components/form/inputs.d.ts.map +1 -1
  501. package/lib/typescript/module/src/modules/auth/reset-password/components/form/reset-password-button.d.ts.map +1 -1
  502. package/lib/typescript/module/src/modules/auth/reset-password/components/form/reset-password-form-provider.d.ts.map +1 -1
  503. package/lib/typescript/module/src/modules/auth/session/components/session-list.d.ts +4 -0
  504. package/lib/typescript/module/src/modules/auth/session/components/session-list.d.ts.map +1 -0
  505. package/lib/typescript/module/src/modules/auth/session/events.d.ts +5 -0
  506. package/lib/typescript/module/src/modules/auth/session/events.d.ts.map +1 -0
  507. package/lib/typescript/module/src/modules/auth/session/index.d.ts +3 -0
  508. package/lib/typescript/module/src/modules/auth/session/index.d.ts.map +1 -0
  509. package/lib/typescript/module/src/modules/auth/session/types/session-list-props.d.ts +5 -0
  510. package/lib/typescript/module/src/modules/auth/session/types/session-list-props.d.ts.map +1 -0
  511. package/lib/typescript/module/src/modules/auth/sign-in/components/form/inputs.d.ts.map +1 -1
  512. package/lib/typescript/module/src/modules/auth/sign-in/components/form/login-form-provider.d.ts.map +1 -1
  513. package/lib/typescript/module/src/modules/auth/sign-in/components/form/mfa-code-input.d.ts +9 -0
  514. package/lib/typescript/module/src/modules/auth/sign-in/components/form/mfa-code-input.d.ts.map +1 -0
  515. package/lib/typescript/module/src/modules/auth/sign-in/components/form/sign-in-with-email.d.ts +4 -0
  516. package/lib/typescript/module/src/modules/auth/sign-in/components/form/sign-in-with-email.d.ts.map +1 -1
  517. package/lib/typescript/module/src/modules/auth/sign-in/components/form/signin-button.d.ts.map +1 -1
  518. package/lib/typescript/module/src/modules/auth/sign-in/components/sign-in.d.ts +4 -0
  519. package/lib/typescript/module/src/modules/auth/sign-in/components/sign-in.d.ts.map +1 -1
  520. package/lib/typescript/module/src/modules/auth/sign-in/contexts/login-form-context.d.ts +2 -46
  521. package/lib/typescript/module/src/modules/auth/sign-in/contexts/login-form-context.d.ts.map +1 -1
  522. package/lib/typescript/module/src/modules/auth/sign-in/hooks/use-login-form.d.ts +1 -47
  523. package/lib/typescript/module/src/modules/auth/sign-in/hooks/use-login-form.d.ts.map +1 -1
  524. package/lib/typescript/module/src/modules/auth/sign-in/types/login-form-context-type.d.ts +11 -1
  525. package/lib/typescript/module/src/modules/auth/sign-in/types/login-form-context-type.d.ts.map +1 -1
  526. package/lib/typescript/module/src/modules/auth/types/session.d.ts +13 -0
  527. package/lib/typescript/module/src/modules/auth/types/session.d.ts.map +1 -0
  528. package/lib/typescript/module/src/modules/auth/utils/rate-limit.d.ts +11 -0
  529. package/lib/typescript/module/src/modules/auth/utils/rate-limit.d.ts.map +1 -0
  530. package/lib/typescript/module/src/modules/background-sync/android-bluetooth-foreground-service.d.ts.map +1 -1
  531. package/lib/typescript/module/src/modules/background-sync/background-safe-storage.d.ts +29 -0
  532. package/lib/typescript/module/src/modules/background-sync/background-safe-storage.d.ts.map +1 -0
  533. package/lib/typescript/module/src/modules/background-sync/index.d.ts +1 -0
  534. package/lib/typescript/module/src/modules/background-sync/index.d.ts.map +1 -1
  535. package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  536. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +46 -0
  537. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -0
  538. package/lib/typescript/module/src/modules/bt-management/hooks/use-background-sync.d.ts +14 -0
  539. package/lib/typescript/module/src/modules/bt-management/hooks/use-background-sync.d.ts.map +1 -0
  540. package/lib/typescript/module/src/modules/bt-management/hooks/use-bluetooth-state.d.ts +11 -0
  541. package/lib/typescript/module/src/modules/bt-management/hooks/use-bluetooth-state.d.ts.map +1 -0
  542. package/lib/typescript/module/src/modules/bt-management/hooks/use-device-connection.d.ts +7 -0
  543. package/lib/typescript/module/src/modules/bt-management/hooks/use-device-connection.d.ts.map +1 -0
  544. package/lib/typescript/module/src/modules/bt-management/hooks/use-health-import.d.ts +16 -0
  545. package/lib/typescript/module/src/modules/bt-management/hooks/use-health-import.d.ts.map +1 -0
  546. package/lib/typescript/module/src/modules/bt-management/hooks/use-measurements.d.ts +11 -0
  547. package/lib/typescript/module/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -0
  548. package/lib/typescript/module/src/modules/bt-management/hooks/use-nearby-devices.d.ts +8 -0
  549. package/lib/typescript/module/src/modules/bt-management/hooks/use-nearby-devices.d.ts.map +1 -0
  550. package/lib/typescript/module/src/modules/bt-management/hooks/use-paired-devices.d.ts +16 -0
  551. package/lib/typescript/module/src/modules/bt-management/hooks/use-paired-devices.d.ts.map +1 -0
  552. package/lib/typescript/module/src/modules/bt-management/index.d.ts +13 -0
  553. package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
  554. package/lib/typescript/module/src/modules/bt-management/services/background-sync/background-sync-coordinator.d.ts.map +1 -1
  555. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +22 -0
  556. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  557. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +4 -0
  558. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
  559. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +9 -1
  560. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  561. package/lib/typescript/module/src/modules/bt-management/services/devices/measurement-state-machine.d.ts +3 -2
  562. package/lib/typescript/module/src/modules/bt-management/services/devices/measurement-state-machine.d.ts.map +1 -1
  563. package/lib/typescript/module/src/modules/bt-management/services/devices/spo/spo2.main-services.d.ts.map +1 -1
  564. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.d.ts +2 -0
  565. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval-activity-sequencer.d.ts.map +1 -1
  566. package/lib/typescript/module/src/modules/bt-management/testing/fake-ble-manager.d.ts +16 -0
  567. package/lib/typescript/module/src/modules/bt-management/testing/fake-ble-manager.d.ts.map +1 -0
  568. package/lib/typescript/module/src/modules/bt-management/testing/index.d.ts +3 -0
  569. package/lib/typescript/module/src/modules/bt-management/testing/index.d.ts.map +1 -0
  570. package/lib/typescript/module/src/modules/bt-management/testing/recorded-frames.d.ts +12 -0
  571. package/lib/typescript/module/src/modules/bt-management/testing/recorded-frames.d.ts.map +1 -0
  572. package/lib/typescript/module/src/modules/bt-management/types/background-sync.d.ts +3 -1
  573. package/lib/typescript/module/src/modules/bt-management/types/background-sync.d.ts.map +1 -1
  574. package/lib/typescript/module/src/modules/bt-management/types/bluetooth-error.d.ts +23 -0
  575. package/lib/typescript/module/src/modules/bt-management/types/bluetooth-error.d.ts.map +1 -0
  576. package/lib/typescript/module/src/modules/bt-management/types/btprovider-children-props.d.ts +4 -0
  577. package/lib/typescript/module/src/modules/bt-management/types/btprovider-children-props.d.ts.map +1 -1
  578. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts +4 -0
  579. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  580. package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts +16 -0
  581. package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -0
  582. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +2 -0
  583. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  584. package/lib/typescript/module/src/modules/bt-management/types/error-callback.d.ts +5 -2
  585. package/lib/typescript/module/src/modules/bt-management/types/error-callback.d.ts.map +1 -1
  586. package/lib/typescript/module/src/modules/bt-management/types/i-bt-managed-device.d.ts +1 -0
  587. package/lib/typescript/module/src/modules/bt-management/types/i-bt-managed-device.d.ts.map +1 -1
  588. package/lib/typescript/module/src/modules/bt-management/types/result-callback.d.ts +2 -0
  589. package/lib/typescript/module/src/modules/bt-management/types/result-callback.d.ts.map +1 -1
  590. package/lib/typescript/module/src/modules/bt-management/types/result-policy.d.ts +8 -0
  591. package/lib/typescript/module/src/modules/bt-management/types/result-policy.d.ts.map +1 -0
  592. package/lib/typescript/module/src/modules/bt-management/utils/result-identity.d.ts +10 -0
  593. package/lib/typescript/module/src/modules/bt-management/utils/result-identity.d.ts.map +1 -0
  594. package/lib/typescript/module/src/modules/data-sync/components/android/android-health-connect-authorization-provider.d.ts.map +1 -1
  595. package/lib/typescript/module/src/modules/data-sync/services/base-health-sync-service.d.ts.map +1 -1
  596. package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts +4 -0
  597. package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
  598. package/lib/typescript/module/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
  599. package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts +2 -0
  600. package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
  601. package/lib/typescript/module/src/modules/data-sync/types/sync-progress.d.ts +1 -1
  602. package/lib/typescript/module/src/modules/data-sync/types/sync-progress.d.ts.map +1 -1
  603. package/lib/typescript/module/src/modules/data-sync/utils/retry-save.d.ts +5 -0
  604. package/lib/typescript/module/src/modules/data-sync/utils/retry-save.d.ts.map +1 -0
  605. package/lib/typescript/module/src/modules/helpers/form-items/form-field.d.ts +4 -1
  606. package/lib/typescript/module/src/modules/helpers/form-items/form-field.d.ts.map +1 -1
  607. package/lib/typescript/module/src/modules/helpers/index.d.ts +1 -0
  608. package/lib/typescript/module/src/modules/helpers/index.d.ts.map +1 -1
  609. package/lib/typescript/module/src/modules/helpers/utils/s-log.d.ts.map +1 -1
  610. package/lib/typescript/module/src/modules/helpers/utils/sentry-logger.d.ts +7 -1
  611. package/lib/typescript/module/src/modules/helpers/utils/sentry-logger.d.ts.map +1 -1
  612. package/lib/typescript/module/src/modules/helpers/utils/telemetry.d.ts +68 -0
  613. package/lib/typescript/module/src/modules/helpers/utils/telemetry.d.ts.map +1 -0
  614. package/lib/typescript/module/src/modules/image/components/optimized-image.d.ts +1 -1
  615. package/lib/typescript/module/src/modules/image/components/optimized-image.d.ts.map +1 -1
  616. package/lib/typescript/module/src/modules/image/types/optimized-image-props.d.ts +4 -0
  617. package/lib/typescript/module/src/modules/image/types/optimized-image-props.d.ts.map +1 -1
  618. package/lib/typescript/module/src/modules/questionnaire-response-form/components/content/questionnaire-content-error.d.ts.map +1 -1
  619. package/lib/typescript/module/src/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-next-button.d.ts.map +1 -1
  620. package/lib/typescript/module/src/modules/questionnaire-response-form/components/navigation/questionnaire-navigation-submit-button.d.ts.map +1 -1
  621. package/lib/typescript/module/src/modules/questionnaire-response-form/components/questionnaire-form-provider.d.ts.map +1 -1
  622. package/lib/typescript/module/src/modules/questionnaire-response-form/components/questionnaire-navigation-provider.d.ts.map +1 -1
  623. package/lib/typescript/module/src/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.d.ts +1 -0
  624. package/lib/typescript/module/src/modules/questionnaire-response-form/contexts/questionnaire-navigation-context.d.ts.map +1 -1
  625. package/lib/typescript/module/src/modules/questionnaire-response-form/hooks/use-navigation-handlers.d.ts +1 -0
  626. package/lib/typescript/module/src/modules/questionnaire-response-form/hooks/use-navigation-handlers.d.ts.map +1 -1
  627. package/lib/typescript/module/src/modules/questionnaire-response-form/hooks/use-questionnaire-navigation.d.ts +1 -0
  628. package/lib/typescript/module/src/modules/questionnaire-response-form/hooks/use-questionnaire-navigation.d.ts.map +1 -1
  629. package/lib/typescript/module/src/modules/questionnaire-response-form/types/questionnaire-form-context-type.d.ts +2 -0
  630. package/lib/typescript/module/src/modules/questionnaire-response-form/types/questionnaire-form-context-type.d.ts.map +1 -1
  631. package/lib/typescript/module/src/modules/questionnaire-response-form/types/questionnaire-navigation-provider-props.d.ts +1 -0
  632. package/lib/typescript/module/src/modules/questionnaire-response-form/types/questionnaire-navigation-provider-props.d.ts.map +1 -1
  633. package/lib/typescript/module/src/modules/tile/components/task-icon.d.ts.map +1 -1
  634. package/lib/typescript/module/src/modules/ui/components/background-sync-setting.d.ts +9 -0
  635. package/lib/typescript/module/src/modules/ui/components/background-sync-setting.d.ts.map +1 -0
  636. package/lib/typescript/module/src/modules/ui/components/bluetooth-state-notice.d.ts +12 -0
  637. package/lib/typescript/module/src/modules/ui/components/bluetooth-state-notice.d.ts.map +1 -0
  638. package/lib/typescript/module/src/modules/ui/components/ecg-strip-viewer.d.ts +17 -0
  639. package/lib/typescript/module/src/modules/ui/components/ecg-strip-viewer.d.ts.map +1 -0
  640. package/lib/typescript/module/src/modules/ui/components/health-import-card.d.ts +13 -0
  641. package/lib/typescript/module/src/modules/ui/components/health-import-card.d.ts.map +1 -0
  642. package/lib/typescript/module/src/modules/ui/components/manual-entry-form.d.ts +20 -0
  643. package/lib/typescript/module/src/modules/ui/components/manual-entry-form.d.ts.map +1 -0
  644. package/lib/typescript/module/src/modules/ui/components/pairing-flow.d.ts +15 -0
  645. package/lib/typescript/module/src/modules/ui/components/pairing-flow.d.ts.map +1 -0
  646. package/lib/typescript/module/src/modules/ui/components/supported-devices-catalog-list.d.ts +16 -0
  647. package/lib/typescript/module/src/modules/ui/components/supported-devices-catalog-list.d.ts.map +1 -0
  648. package/lib/typescript/module/src/modules/ui/components/urine-test-result.d.ts +10 -0
  649. package/lib/typescript/module/src/modules/ui/components/urine-test-result.d.ts.map +1 -0
  650. package/lib/typescript/module/src/modules/ui/index.d.ts +11 -0
  651. package/lib/typescript/module/src/modules/ui/index.d.ts.map +1 -0
  652. package/lib/typescript/module/src/modules/ui/types.d.ts +24 -0
  653. package/lib/typescript/module/src/modules/ui/types.d.ts.map +1 -0
  654. package/lib/typescript/module/src/modules/ui/use-ovok-ui.d.ts +7 -0
  655. package/lib/typescript/module/src/modules/ui/use-ovok-ui.d.ts.map +1 -0
  656. package/package.json +145 -6
@@ -9,10 +9,12 @@ var _reactNative = require("react-native");
9
9
  var _index = require("../../background-sync/index.js");
10
10
  var _useDeviceList = require("../../bt-device/components/hooks/use-device-list.js");
11
11
  var _sentryLogger = require("../../helpers/utils/sentry-logger.js");
12
+ var _runtimeContext = require("../hooks/runtime-context.js");
12
13
  var _backgroundBleManager = require("../services/background-sync/background-ble-manager.js");
13
14
  var _backgroundServiceUuids = require("../services/background-sync/background-service-uuids.js");
14
15
  var _backgroundSyncCoordinator = require("../services/background-sync/background-sync-coordinator.js");
15
16
  var _btManager = require("../services/bt-manager.js");
17
+ var _bluetoothError = require("../types/bluetooth-error.js");
16
18
  var _jsxRuntime = require("react/jsx-runtime");
17
19
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
18
20
  /* eslint-disable max-lines */
@@ -26,10 +28,13 @@ const BTProviderChildWrapper = exports.BTProviderChildWrapper = /*#__PURE__*/Rea
26
28
  onDeviceFound,
27
29
  onError,
28
30
  onDeviceStatusChanged,
31
+ onConnectionEvent,
29
32
  onResult,
33
+ resultPolicies,
30
34
  backgroundSync
31
35
  }) => {
32
36
  const btManagerRef = React.useRef(null);
37
+ const runtimeRef = React.useRef((0, _runtimeContext.createBluetoothRuntime)(bleManager));
33
38
  const backgroundSyncRef = React.useRef(backgroundSync);
34
39
  const backgroundSyncCoordinatorRef = React.useRef(null);
35
40
  const {
@@ -40,6 +45,7 @@ const BTProviderChildWrapper = exports.BTProviderChildWrapper = /*#__PURE__*/Rea
40
45
  if (!acceptedDevices.length) {
41
46
  return;
42
47
  }
48
+ const runtime = runtimeRef.current;
43
49
  (0, _sentryLogger.sentryLogger)("info", "Creating BTManager");
44
50
  const currentBackgroundSync = backgroundSyncRef.current;
45
51
  const isBackgroundEnabled = currentBackgroundSync?.enabled === true;
@@ -54,6 +60,9 @@ const BTProviderChildWrapper = exports.BTProviderChildWrapper = /*#__PURE__*/Rea
54
60
  }),
55
61
  ...(deliveredEcgFileNames === undefined ? {} : {
56
62
  deliveredEcgFileNames
63
+ }),
64
+ ...(resultPolicies === undefined ? {} : {
65
+ resultPolicies
57
66
  })
58
67
  };
59
68
  const btManager = Object.keys(managerOptions).length ? new _btManager.BTManager(bleManager, acceptedDevices, managerOptions) : new _btManager.BTManager(bleManager, acceptedDevices);
@@ -81,12 +90,13 @@ const BTProviderChildWrapper = exports.BTProviderChildWrapper = /*#__PURE__*/Rea
81
90
  });
82
91
  } catch (error) {
83
92
  onError?.({
84
- error: error instanceof Error ? error : String(error)
93
+ error: (0, _bluetoothError.toBluetoothError)(error)
85
94
  });
86
95
  }
87
96
  }
88
97
  }) : null;
89
98
  btManagerRef.current = btManager;
99
+ runtime.setManager(btManager);
90
100
  backgroundSyncCoordinatorRef.current = coordinator;
91
101
  btManager.setBackgroundScanEnabled(isBackgroundEnabled && _reactNative.AppState.currentState !== "active");
92
102
  btManager.startScan();
@@ -94,52 +104,112 @@ const BTProviderChildWrapper = exports.BTProviderChildWrapper = /*#__PURE__*/Rea
94
104
  (0, _sentryLogger.sentryLogger)("info", "Destroying scan service");
95
105
  backgroundSyncCoordinatorRef.current = null;
96
106
  btManagerRef.current = null;
107
+ runtime.setManager(undefined);
97
108
  btManager.destroy();
98
109
  };
99
- }, [acceptedDevices, backgroundSync?.enabled, backgroundSync?.maxRetries, backgroundSync?.retryBackoffMs, backgroundSync?.serviceUUIDs, backgroundSync?.storage, backgroundSync?.storageKey, backgroundSync?.notifications?.enabled, backgroundSync?.notifications?.title, backgroundSync?.notifications?.body, backgroundSync?.notifications?.data, bleManager, deliveredEcgFileNames, onError, oneReadingPerConnection]);
110
+ }, [acceptedDevices, backgroundSync?.enabled, backgroundSync?.maxRetries, backgroundSync?.retryBackoffMs, backgroundSync?.serviceUUIDs, backgroundSync?.storage, backgroundSync?.storageKey, backgroundSync?.notifications?.enabled, backgroundSync?.notifications?.title, backgroundSync?.notifications?.body, backgroundSync?.notifications?.data, bleManager, deliveredEcgFileNames, resultPolicies, onError, oneReadingPerConnection]);
100
111
  React.useEffect(() => {
101
- if (!onDeviceFound || !acceptedDevices.length) {
112
+ if (!acceptedDevices.length) {
113
+ return;
114
+ }
115
+ const runtime = runtimeRef.current;
116
+ const hasRuntimeListener = runtime.hasListeners("deviceFound");
117
+ if (!onDeviceFound && !hasRuntimeListener) {
118
+ return;
119
+ }
120
+ const manager = btManagerRef.current;
121
+ if (!manager) {
102
122
  return;
103
123
  }
104
- btManagerRef.current?.onDeviceFound(onDeviceFound);
124
+ if (onDeviceFound && !hasRuntimeListener) {
125
+ manager.onDeviceFound(onDeviceFound);
126
+ return () => {
127
+ manager.onDeviceFound(undefined);
128
+ };
129
+ }
130
+ manager.onDeviceFound((device, deviceManager) => {
131
+ runtime.upsertDevice(device);
132
+ runtime.emit("deviceFound", device);
133
+ return onDeviceFound?.(device, deviceManager) ?? Promise.resolve();
134
+ });
105
135
  return () => {
106
- btManagerRef.current?.onDeviceFound(undefined);
136
+ manager.onDeviceFound(undefined);
107
137
  };
108
138
  }, [onDeviceFound, acceptedDevices]);
109
139
  React.useEffect(() => {
110
- if (!onError || !acceptedDevices.length) {
140
+ if (!acceptedDevices.length) {
141
+ return;
142
+ }
143
+ const runtime = runtimeRef.current;
144
+ const hasRuntimeListener = runtime.hasListeners("error");
145
+ if (!onError && !hasRuntimeListener) {
111
146
  return;
112
147
  }
113
- btManagerRef.current?.onError(onError);
148
+ const manager = btManagerRef.current;
149
+ if (!manager) {
150
+ return;
151
+ }
152
+ if (onError && !hasRuntimeListener) {
153
+ manager.onError(onError);
154
+ return () => {
155
+ manager.onError(undefined);
156
+ };
157
+ }
158
+ manager.onError(data => {
159
+ runtime.emit("error", data);
160
+ onError?.(data);
161
+ });
114
162
  return () => {
115
- btManagerRef.current?.onError(undefined);
163
+ manager.onError(undefined);
116
164
  };
117
165
  }, [onError, acceptedDevices]);
118
166
  React.useEffect(() => {
119
167
  if (!acceptedDevices.length) {
120
168
  return;
121
169
  }
170
+ const runtime = runtimeRef.current;
171
+ const requiresBridge = backgroundSync?.enabled === true || runtime.hasListeners("result");
172
+ if (!onResult && !requiresBridge) {
173
+ return;
174
+ }
175
+ const manager = btManagerRef.current;
176
+ if (!manager) {
177
+ return;
178
+ }
179
+ if (onResult && !requiresBridge) {
180
+ manager.onResult(onResult);
181
+ return () => {
182
+ manager.onResult(undefined);
183
+ };
184
+ }
122
185
  const callback = backgroundSync?.enabled === true ? data => {
123
186
  onResult?.(data);
124
187
  const coordinator = backgroundSyncCoordinatorRef.current;
125
188
  if (coordinator) {
126
189
  void coordinator.enqueue(data).catch(error => {
127
190
  onError?.({
128
- error: error instanceof Error ? error : String(error)
191
+ error: (0, _bluetoothError.toBluetoothError)(error)
129
192
  });
130
193
  });
131
194
  }
132
195
  } : onResult;
133
- if (!callback) {
196
+ if (!acceptedDevices.length) {
134
197
  return;
135
198
  }
136
- btManagerRef.current?.onResult(callback);
199
+ manager.onResult(data => {
200
+ runtime.emit("result", data);
201
+ callback?.(data);
202
+ });
137
203
  return () => {
138
- btManagerRef.current?.onResult(undefined);
204
+ manager.onResult(undefined);
139
205
  };
140
206
  }, [backgroundSync?.enabled, onError, onResult, acceptedDevices]);
141
207
  React.useEffect(() => {
142
- if (!onDeviceStatusChanged || !acceptedDevices.length) {
208
+ if (!acceptedDevices.length) {
209
+ return;
210
+ }
211
+ const runtime = runtimeRef.current;
212
+ if (!onDeviceStatusChanged && !runtime.hasListeners("status")) {
143
213
  return;
144
214
  }
145
215
  btManagerRef.current?.onDeviceStatusChanged(({
@@ -147,6 +217,15 @@ const BTProviderChildWrapper = exports.BTProviderChildWrapper = /*#__PURE__*/Rea
147
217
  deviceData,
148
218
  measurementTypeKey
149
219
  }) => {
220
+ runtime.setDeviceStatus({
221
+ deviceData,
222
+ status
223
+ });
224
+ runtime.emit("status", {
225
+ status,
226
+ deviceData,
227
+ measurementTypeKey
228
+ });
150
229
  setDeviceListItems(prev => {
151
230
  const newList = [...prev];
152
231
  const index = newList.findIndex(item => item.deviceType === deviceData.name);
@@ -159,7 +238,7 @@ const BTProviderChildWrapper = exports.BTProviderChildWrapper = /*#__PURE__*/Rea
159
238
  };
160
239
  return newList;
161
240
  });
162
- onDeviceStatusChanged({
241
+ onDeviceStatusChanged?.({
163
242
  status,
164
243
  deviceData,
165
244
  measurementTypeKey
@@ -169,6 +248,26 @@ const BTProviderChildWrapper = exports.BTProviderChildWrapper = /*#__PURE__*/Rea
169
248
  btManagerRef.current?.onDeviceStatusChanged(undefined);
170
249
  };
171
250
  }, [onDeviceStatusChanged, acceptedDevices, setDeviceListItems]);
251
+ React.useEffect(() => {
252
+ if (!acceptedDevices.length) {
253
+ return;
254
+ }
255
+ const runtime = runtimeRef.current;
256
+ if (!onConnectionEvent && !runtime.hasListeners("connection")) {
257
+ return;
258
+ }
259
+ const manager = btManagerRef.current;
260
+ if (!manager || typeof manager.onConnectionEvent !== "function") {
261
+ return;
262
+ }
263
+ manager.onConnectionEvent(event => {
264
+ runtime.emit("connection", event);
265
+ onConnectionEvent?.(event);
266
+ });
267
+ return () => {
268
+ manager.onConnectionEvent(undefined);
269
+ };
270
+ }, [onConnectionEvent, acceptedDevices]);
172
271
  React.useEffect(() => {
173
272
  if (!acceptedDevices.length || backgroundSync?.enabled !== true) {
174
273
  return;
@@ -182,7 +281,7 @@ const BTProviderChildWrapper = exports.BTProviderChildWrapper = /*#__PURE__*/Rea
182
281
  resetExhausted: true
183
282
  }).catch(error => {
184
283
  onError?.({
185
- error: error instanceof Error ? error : String(error)
284
+ error: (0, _bluetoothError.toBluetoothError)(error)
186
285
  });
187
286
  });
188
287
  }, [acceptedDevices, backgroundSync?.enabled, backgroundSync?.restoreStateIdentifier, onError]);
@@ -195,7 +294,7 @@ const BTProviderChildWrapper = exports.BTProviderChildWrapper = /*#__PURE__*/Rea
195
294
  resetExhausted: true
196
295
  }).catch(error => {
197
296
  onError?.({
198
- error: error instanceof Error ? error : String(error)
297
+ error: (0, _bluetoothError.toBluetoothError)(error)
199
298
  });
200
299
  });
201
300
  }
@@ -204,11 +303,14 @@ const BTProviderChildWrapper = exports.BTProviderChildWrapper = /*#__PURE__*/Rea
204
303
  listener.remove();
205
304
  };
206
305
  }, [onError]);
207
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.AndroidBluetoothForegroundService, {
208
- enabled: backgroundSync?.enabled === true,
209
- options: backgroundSync?.android?.foregroundService,
210
- onError: onError,
211
- children: children
306
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_runtimeContext.BluetoothRuntimeProvider, {
307
+ runtime: runtimeRef.current,
308
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.AndroidBluetoothForegroundService, {
309
+ enabled: backgroundSync?.enabled === true,
310
+ options: backgroundSync?.android?.foregroundService,
311
+ onError: onError,
312
+ children: children
313
+ })
212
314
  });
213
315
  });
214
316
  //# sourceMappingURL=bt-provider-child-wrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","_interopRequireWildcard","require","_reactNative","_index","_useDeviceList","_sentryLogger","_backgroundBleManager","_backgroundServiceUuids","_backgroundSyncCoordinator","_btManager","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","BTProviderChildWrapper","exports","memo","bleManager","acceptedDevices","children","oneReadingPerConnection","deliveredEcgFileNames","onDeviceFound","onError","onDeviceStatusChanged","onResult","backgroundSync","btManagerRef","useRef","backgroundSyncRef","backgroundSyncCoordinatorRef","setDeviceListItems","useDeviceList","current","useEffect","length","sentryLogger","currentBackgroundSync","isBackgroundEnabled","enabled","backgroundOptions","backgroundEnabled","serviceUUIDs","getBackgroundServiceUUIDs","undefined","managerOptions","btManager","keys","BTManager","coordinator","BackgroundSyncCoordinator","result","latest","notifications","body","data","showPushNotification","title","deviceData","name","error","Error","String","setBackgroundScanEnabled","AppState","currentState","startScan","destroy","maxRetries","retryBackoffMs","storage","storageKey","callback","enqueue","catch","status","measurementTypeKey","prev","newList","index","findIndex","item","deviceType","restoredState","getRestoredBleState","restoreStateIdentifier","connectedPeripherals","restoreDevices","flush","includeExhausted","resetExhausted","listener","addEventListener","state","remove","jsx","AndroidBluetoothForegroundService","options","android","foregroundService"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/components/bt-provider-child-wrapper.tsx"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAIA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAL,OAAA;AACA,IAAAM,uBAAA,GAAAN,OAAA;AACA,IAAAO,0BAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAAmD,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAD,wBAAAW,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAb,uBAAA,YAAAA,CAAAW,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CA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K,IAAK;MAC9DlE,YAAY,CAACM,OAAO,EAAE8B,wBAAwB,CAC5ClC,iBAAiB,CAACI,OAAO,EAAEM,OAAO,KAAK,IAAI,IAAIsD,KAAK,KAAK,QAC3D,CAAC;MACD,IAAIA,KAAK,KAAK,QAAQ,EAAE;QACtB,KAAK/D,4BAA4B,CAACG,OAAO,EAAEuD,KAAK,CAAC;UAC/CC,gBAAgB,EAAE,IAAI;UACtBC,cAAc,EAAE;QAClB,CAAC,CAAC,CAAChB,KAAK,CAAEd,KAAc,IAAK;UAC3BrC,OAAO,GAAG;YACRqC,KAAK,EAAEA,KAAK,YAAYC,KAAK,GAAGD,KAAK,GAAGE,MAAM,CAACF,KAAK;UACtD,CAAC,CAAC;QACJ,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;IAEF,OAAO,MAAM;MACX+B,QAAQ,CAACG,MAAM,CAAC,CAAC;IACnB,CAAC;EACH,CAAC,EAAE,CAACvE,OAAO,CAAC,CAAC;EAEb,oBACE,IAAA7B,WAAA,CAAAqG,GAAA,EAAC5G,MAAA,CAAA6G,iCAAiC;IAChCzD,OAAO,EAAEb,cAAc,EAAEa,OAAO,KAAK,IAAK;IAC1C0D,OAAO,EAAEvE,cAAc,EAAEwE,OAAO,EAAEC,iBAAkB;IACpD5E,OAAO,EAAEA,OAAQ;IAAAJ,QAAA,EAEhBA;EAAQ,CACwB,CAAC;AAExC,CACF,CAEsB","ignoreList":[]}
1
+ {"version":3,"names":["React","_interopRequireWildcard","require","_reactNative","_index","_useDeviceList","_sentryLogger","_runtimeContext","_backgroundBleManager","_backgroundServiceUuids","_backgroundSyncCoordinator","_btManager","_bluetoothError","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","BTProviderChildWrapper","exports","memo","bleManager","acceptedDevices","children","oneReadingPerConnection","deliveredEcgFileNames","onDeviceFound","onError","onDeviceStatusChanged","onConnectionEvent","onResult","resultPolicies","backgroundSync","btManagerRef","useRef","runtimeRef","createBluetoothRuntime","backgroundSyncRef","backgroundSyncCoordinatorRef","setDeviceListItems","useDeviceList","current","useEffect","length","runtime","sentryLogger","currentBackgroundSync","isBackgroundEnabled","enabled","backgroundOptions","backgroundEnabled","serviceUUIDs","getBackgroundServiceUUIDs","undefined","managerOptions","btManager","keys","BTManager","coordinator","BackgroundSyncCoordinator","result","latest","notifications","body","data","showPushNotification","title","deviceData","name","error","toBluetoothError","setManager","setBackgroundScanEnabled","AppState","currentState","startScan","destroy","maxRetries","retryBackoffMs","storage","storageKey","hasRuntimeListener","hasListeners","manager","device","deviceManager","upsertDevice","emit","Promise","resolve","requiresBridge","callback","enqueue","catch","status","measurementTypeKey","setDeviceStatus","prev","newList","index","findIndex","item","deviceType","event","restoredState","getRestoredBleState","restoreStateIdentifier","connectedPeripherals","restoreDevices","flush","includeExhausted","resetExhausted","listener","addEventListener","state","remove","jsx","BluetoothRuntimeProvider","AndroidBluetoothForegroundService","options","android","foregroundService"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/components/bt-provider-child-wrapper.tsx"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAIA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAN,OAAA;AACA,IAAAO,uBAAA,GAAAP,OAAA;AACA,IAAAQ,0BAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAEA,IAAAU,eAAA,GAAAV,OAAA;AAA4D,IAAAW,WAAA,GAAAX,OAAA;AAAA,SAAAD,wBAAAa,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAf,uBAAA,YA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,CAAC,EAAE,CAACxF,OAAO,CAAC,CAAC;EAEb,oBACE,IAAA7B,WAAA,CAAAsH,GAAA,EAAC5H,eAAA,CAAA6H,wBAAwB;IAACzE,OAAO,EAAET,UAAU,CAACM,OAAQ;IAAAlB,QAAA,eACtD,IAAAzB,WAAA,CAAAsH,GAAA,EAAC/H,MAAA,CAAAiI,iCAAiC;MAChCtE,OAAO,EAAEhB,cAAc,EAAEgB,OAAO,KAAK,IAAK;MAC1CuE,OAAO,EAAEvF,cAAc,EAAEwF,OAAO,EAAEC,iBAAkB;MACpD9F,OAAO,EAAEA,OAAQ;MAAAJ,QAAA,EAEhBA;IAAQ,CACwB;EAAC,CACV,CAAC;AAE/B,CACF,CAEsB","ignoreList":[]}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useRuntimeEvent = exports.useBluetoothRuntime = exports.createBluetoothRuntime = exports.BluetoothRuntimeProvider = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
+ /* eslint-disable import/group-exports */
11
+
12
+ const RuntimeContext = /*#__PURE__*/React.createContext(null);
13
+ const createBluetoothRuntime = bleManager => {
14
+ const listeners = new Map();
15
+ let currentManager;
16
+ let currentDevices = [];
17
+ const subscribers = new Set();
18
+ return {
19
+ bleManager,
20
+ get manager() {
21
+ return currentManager;
22
+ },
23
+ get devices() {
24
+ return currentDevices;
25
+ },
26
+ subscribe: (event, callback) => {
27
+ const eventListeners = listeners.get(event) ?? new Set();
28
+ eventListeners.add(callback);
29
+ listeners.set(event, eventListeners);
30
+ return () => eventListeners.delete(callback);
31
+ },
32
+ hasListeners: event => (listeners.get(event)?.size ?? 0) > 0,
33
+ emit: (event, value) => {
34
+ listeners.get(event)?.forEach(callback => callback(value));
35
+ subscribers.forEach(notify => notify());
36
+ },
37
+ setManager: manager => {
38
+ currentManager = manager;
39
+ subscribers.forEach(notify => notify());
40
+ },
41
+ upsertDevice: device => {
42
+ const existing = currentDevices.findIndex(item => item.id === device.id);
43
+ const next = {
44
+ id: device.id,
45
+ deviceData: device.deviceData,
46
+ device,
47
+ status: existing === -1 ? undefined : currentDevices[existing]?.status
48
+ };
49
+ currentDevices = existing === -1 ? [...currentDevices, next] : currentDevices.map((item, index) => index === existing ? next : item);
50
+ subscribers.forEach(notify => notify());
51
+ },
52
+ setDeviceStatus: ({
53
+ deviceData,
54
+ status
55
+ }) => {
56
+ currentDevices = currentDevices.map(item => item.id === deviceData.id ? {
57
+ ...item,
58
+ deviceData,
59
+ status
60
+ } : item);
61
+ subscribers.forEach(notify => notify());
62
+ }
63
+ };
64
+ };
65
+ exports.createBluetoothRuntime = createBluetoothRuntime;
66
+ const BluetoothRuntimeProvider = ({
67
+ runtime,
68
+ children
69
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(RuntimeContext.Provider, {
70
+ value: runtime,
71
+ children: children
72
+ });
73
+ exports.BluetoothRuntimeProvider = BluetoothRuntimeProvider;
74
+ const useBluetoothRuntime = () => {
75
+ const runtime = React.useContext(RuntimeContext);
76
+ if (!runtime) {
77
+ throw new Error("Bluetooth hooks must be rendered inside BTProvider");
78
+ }
79
+ return runtime;
80
+ };
81
+ exports.useBluetoothRuntime = useBluetoothRuntime;
82
+ const useRuntimeEvent = (event, callback) => {
83
+ const runtime = useBluetoothRuntime();
84
+ const callbackRef = React.useRef(callback);
85
+ callbackRef.current = callback;
86
+ React.useEffect(() => runtime.subscribe(event, value => callbackRef.current(value)), [event, runtime]);
87
+ };
88
+
89
+ /** Typed union exposed when a host listens to every accepted device. */
90
+ exports.useRuntimeEvent = useRuntimeEvent;
91
+ //# sourceMappingURL=runtime-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","_interopRequireWildcard","require","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","RuntimeContext","createContext","createBluetoothRuntime","bleManager","listeners","Map","currentManager","currentDevices","subscribers","Set","manager","devices","subscribe","event","callback","eventListeners","add","delete","hasListeners","size","emit","value","forEach","notify","setManager","upsertDevice","device","existing","findIndex","item","id","next","deviceData","status","undefined","map","index","setDeviceStatus","exports","BluetoothRuntimeProvider","runtime","children","jsx","Provider","useBluetoothRuntime","useContext","Error","useRuntimeEvent","callbackRef","useRef","current","useEffect"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/runtime-context.tsx"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAA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K,EAAE2B,OAAO,CACjB,CAAC;AACH,CAAC;;AAED;AAAAF,OAAA,CAAAS,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useBackgroundSync = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _runtimeContext = require("./runtime-context.js");
9
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
+ /* eslint-disable import/group-exports */
11
+
12
+ const useBackgroundSync = ({
13
+ enabled: initialEnabled = false,
14
+ canEnable,
15
+ onEnabledChange
16
+ } = {}) => {
17
+ const runtime = (0, _runtimeContext.useBluetoothRuntime)();
18
+ const [enabled, setEnabledState] = React.useState(initialEnabled);
19
+ const [error, setError] = React.useState();
20
+ const [status, setStatus] = React.useState(initialEnabled ? "on" : "off");
21
+ const setEnabled = React.useCallback(async next => {
22
+ setError(undefined);
23
+ if (next && canEnable && !(await canEnable())) {
24
+ setStatus("restricted");
25
+ return;
26
+ }
27
+ try {
28
+ runtime.manager?.setBackgroundScanEnabled(next);
29
+ await onEnabledChange?.(next);
30
+ setEnabledState(next);
31
+ setStatus(next ? "on" : "off");
32
+ } catch (cause) {
33
+ const nextError = cause instanceof Error ? cause : new Error(String(cause));
34
+ setError(nextError);
35
+ setStatus("blocked");
36
+ }
37
+ }, [canEnable, onEnabledChange, runtime]);
38
+ return {
39
+ enabled,
40
+ setEnabled,
41
+ status,
42
+ error,
43
+ reason: status === "restricted" ? "background access is restricted" : undefined
44
+ };
45
+ };
46
+ exports.useBackgroundSync = useBackgroundSync;
47
+ //# sourceMappingURL=use-background-sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","_interopRequireWildcard","require","_runtimeContext","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","useBackgroundSync","enabled","initialEnabled","canEnable","onEnabledChange","runtime","useBluetoothRuntime","setEnabledState","useState","error","setError","status","setStatus","setEnabled","useCallback","next","undefined","manager","setBackgroundScanEnabled","cause","nextError","Error","String","reason","exports"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-background-sync.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAAwD,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,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AAK,EAAE;MACd,MAAMC,SAAS,GAAGD,KAAK,YAAYE,KAAK,GAAGF,KAAK,GAAG,IAAIE,KAAK,CAACC,MAAM,CAACH,KAAK,CAAC,CAAC;MAE3ET,QAAQ,CAACU,SAAS,CAAC;MACnBR,SAAS,CAAC,SAAS,CAAC;IACtB;EACF,CAAC,EAAE,CAACT,SAAS,EAAEC,eAAe,EAAEC,OAAO,CAAC,CAAC;EAEzC,OAAO;IAAEJ,OAAO;IAAEY,UAAU;IAAEF,MAAM;IAAEF,KAAK;IAAEc,MAAM,EAAEZ,MAAM,KAAK,YAAY,GAAG,iCAAiC,GAAGK;EAAU,CAAC;AAChI,CAAC;AAACQ,OAAA,CAAAxB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useBluetoothState = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeBlePlx = require("react-native-ble-plx");
10
+ var _reactNativePermissions = require("react-native-permissions");
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ /* eslint-disable import/group-exports */
13
+
14
+ const requestBluetoothPermission = async () => {
15
+ const permissions = _reactNative.Platform.select({
16
+ android: [_reactNativePermissions.PERMISSIONS.ANDROID.BLUETOOTH_SCAN, _reactNativePermissions.PERMISSIONS.ANDROID.BLUETOOTH_CONNECT],
17
+ ios: [_reactNativePermissions.PERMISSIONS.IOS.BLUETOOTH],
18
+ default: []
19
+ });
20
+ const result = await (0, _reactNativePermissions.requestMultiple)(permissions);
21
+ return Object.values(result).every(value => value === "granted");
22
+ };
23
+ const useBluetoothState = ({
24
+ bleManager,
25
+ requestPermission = requestBluetoothPermission
26
+ } = {}) => {
27
+ const [state, setState] = React.useState(bleManager ? "off" : "unsupported");
28
+ React.useEffect(() => {
29
+ if (!bleManager) {
30
+ setState("unsupported");
31
+ return;
32
+ }
33
+ const subscription = bleManager.onStateChange(nextState => {
34
+ setState(nextState === _reactNativeBlePlx.State.PoweredOn ? "on" : nextState === _reactNativeBlePlx.State.Unsupported ? "unsupported" : nextState === _reactNativeBlePlx.State.Unauthorized ? "unauthorized" : "off");
35
+ }, true);
36
+ return () => subscription.remove();
37
+ }, [bleManager]);
38
+ const request = React.useCallback(async () => {
39
+ const granted = await requestPermission();
40
+ if (!granted) {
41
+ setState("unauthorized");
42
+ }
43
+ return granted;
44
+ }, [requestPermission]);
45
+ return {
46
+ state,
47
+ requestPermission: request
48
+ };
49
+ };
50
+ exports.useBluetoothState = useBluetoothState;
51
+ //# sourceMappingURL=use-bluetooth-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","_interopRequireWildcard","require","_reactNative","_reactNativeBlePlx","_reactNativePermissions","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","requestBluetoothPermission","permissions","Platform","select","android","PERMISSIONS","ANDROID","BLUETOOTH_SCAN","BLUETOOTH_CONNECT","ios","IOS","BLUETOOTH","result","requestMultiple","values","every","value","useBluetoothState","bleManager","requestPermission","state","setState","useState","useEffect","subscription","onStateChange","nextState","State","PoweredOn","Unsupported","Unauthorized","remove","request","useCallback","granted","exports"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-bluetooth-state.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,u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OAAOa,OAAO;EAChB,CAAC,EAAE,CAACf,iBAAiB,CAAC,CAAC;EAEvB,OAAO;IAAEC,KAAK;IAAED,iBAAiB,EAAEa;EAAQ,CAAC;AAC9C,CAAC;AAACG,OAAA,CAAAlB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useDeviceConnection = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _runtimeContext = require("./runtime-context.js");
9
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
+ const useDeviceConnection = id => {
11
+ const runtime = (0, _runtimeContext.useBluetoothRuntime)();
12
+ const [status, setStatus] = React.useState(() => runtime.devices.find(device => device.id === id)?.status);
13
+ const [events, setEvents] = React.useState([]);
14
+ React.useEffect(() => {
15
+ const unsubStatus = runtime.subscribe("status", value => {
16
+ if (value.deviceData.id === id) {
17
+ setStatus(value.status);
18
+ }
19
+ });
20
+ const unsubEvent = runtime.subscribe("connection", event => {
21
+ if (event.deviceData.id === id) {
22
+ setEvents(current => [...current, event]);
23
+ }
24
+ });
25
+ return () => {
26
+ unsubStatus();
27
+ unsubEvent();
28
+ };
29
+ }, [id, runtime]);
30
+ return {
31
+ status,
32
+ events
33
+ };
34
+ };
35
+ exports.useDeviceConnection = useDeviceConnection;
36
+ //# sourceMappingURL=use-device-connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","_interopRequireWildcard","require","_runtimeContext","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","useDeviceConnection","id","runtime","useBluetoothRuntime","status","setStatus","useState","devices","find","device","events","setEvents","useEffect","unsubStatus","subscribe","value","deviceData","unsubEvent","event","current","exports"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-device-connection.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAKA,IAAAC,eAAA,GAAAD,OAAA;AAAwD,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA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"use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useHealthImport = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
9
+ const useHealthImport = ({
10
+ types,
11
+ background = false,
12
+ adapter
13
+ }) => {
14
+ const [enabled, setEnabled] = React.useState(false);
15
+ const [statusByType, setStatusByType] = React.useState({});
16
+ const [error, setError] = React.useState();
17
+ const refresh = React.useCallback(async () => {
18
+ try {
19
+ const entries = await Promise.all(types.map(async type => [type, await adapter.getStatus(type)]));
20
+ setStatusByType(Object.fromEntries(entries));
21
+ } catch (cause) {
22
+ setError(cause instanceof Error ? cause : new Error(String(cause)));
23
+ }
24
+ }, [adapter, types]);
25
+ React.useEffect(() => {
26
+ void refresh();
27
+ }, [refresh]);
28
+ const setEnabledForTypes = React.useCallback(async next => {
29
+ setError(undefined);
30
+ if (next) {
31
+ await adapter.request(types, background);
32
+ await refresh();
33
+ }
34
+ setEnabled(next);
35
+ }, [adapter, background, refresh, types]);
36
+ const notShared = types.filter(type => statusByType[type] === "refused");
37
+ return {
38
+ enabled,
39
+ setEnabled: setEnabledForTypes,
40
+ statusByType: statusByType,
41
+ notShared,
42
+ error
43
+ };
44
+ };
45
+ exports.useHealthImport = useHealthImport;
46
+ //# sourceMappingURL=use-health-import.js.map