@hedia/recommendation-screen 2.1.73 → 2.1.74-alpha.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 (408) hide show
  1. package/lib/commonjs/RecommendationScreen.js +768 -0
  2. package/lib/commonjs/RecommendationScreen.js.map +1 -0
  3. package/lib/commonjs/assets/IconsSVG/Close.js +20 -0
  4. package/lib/commonjs/assets/IconsSVG/Close.js.map +1 -0
  5. package/lib/commonjs/assets/IconsSVG/CloseOutlined.js +28 -0
  6. package/lib/commonjs/assets/IconsSVG/CloseOutlined.js.map +1 -0
  7. package/lib/commonjs/assets/IconsSVG/Edit.js +23 -0
  8. package/lib/commonjs/assets/IconsSVG/Edit.js.map +1 -0
  9. package/lib/commonjs/assets/IconsSVG/activity/Cycling.js +43 -0
  10. package/lib/commonjs/assets/IconsSVG/activity/Cycling.js.map +1 -0
  11. package/lib/commonjs/assets/IconsSVG/activity/Running.js +33 -0
  12. package/lib/commonjs/assets/IconsSVG/activity/Running.js.map +1 -0
  13. package/lib/commonjs/assets/IconsSVG/activity/Stretching.js +33 -0
  14. package/lib/commonjs/assets/IconsSVG/activity/Stretching.js.map +1 -0
  15. package/lib/commonjs/assets/IconsSVG/activity/Swimming.js +48 -0
  16. package/lib/commonjs/assets/IconsSVG/activity/Swimming.js.map +1 -0
  17. package/lib/commonjs/assets/IconsSVG/activity/Walking.js +38 -0
  18. package/lib/commonjs/assets/IconsSVG/activity/Walking.js.map +1 -0
  19. package/lib/commonjs/assets/IconsSVG/mood/Happy.js +34 -0
  20. package/lib/commonjs/assets/IconsSVG/mood/Happy.js.map +1 -0
  21. package/lib/commonjs/assets/IconsSVG/mood/Neutral.js +34 -0
  22. package/lib/commonjs/assets/IconsSVG/mood/Neutral.js.map +1 -0
  23. package/lib/commonjs/assets/IconsSVG/mood/Sad.js +34 -0
  24. package/lib/commonjs/assets/IconsSVG/mood/Sad.js.map +1 -0
  25. package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js +34 -0
  26. package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js.map +1 -0
  27. package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js +34 -0
  28. package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js.map +1 -0
  29. package/lib/commonjs/components/ExitModal.js +124 -0
  30. package/lib/commonjs/components/ExitModal.js.map +1 -0
  31. package/lib/commonjs/components/InfoBars.js +123 -0
  32. package/lib/commonjs/components/InfoBars.js.map +1 -0
  33. package/lib/commonjs/components/InvisibleNumberInput.js +150 -0
  34. package/lib/commonjs/components/InvisibleNumberInput.js.map +1 -0
  35. package/lib/commonjs/components/LineSeparator.js +27 -0
  36. package/lib/commonjs/components/LineSeparator.js.map +1 -0
  37. package/lib/commonjs/components/RecentInsulin.js +105 -0
  38. package/lib/commonjs/components/RecentInsulin.js.map +1 -0
  39. package/lib/commonjs/components/RecommendationModal.js +302 -0
  40. package/lib/commonjs/components/RecommendationModal.js.map +1 -0
  41. package/lib/commonjs/components/RecommendedCarbs.js +289 -0
  42. package/lib/commonjs/components/RecommendedCarbs.js.map +1 -0
  43. package/lib/commonjs/components/RecommendedInsulin.js +208 -0
  44. package/lib/commonjs/components/RecommendedInsulin.js.map +1 -0
  45. package/lib/commonjs/components/Remeasure.js +131 -0
  46. package/lib/commonjs/components/Remeasure.js.map +1 -0
  47. package/lib/commonjs/components/Text.js +25 -0
  48. package/lib/commonjs/components/Text.js.map +1 -0
  49. package/lib/commonjs/components/TimeoutModal.js +113 -0
  50. package/lib/commonjs/components/TimeoutModal.js.map +1 -0
  51. package/lib/commonjs/components/TransferToLogbook.js +83 -0
  52. package/lib/commonjs/components/TransferToLogbook.js.map +1 -0
  53. package/lib/commonjs/components/activity/Activity.js +112 -0
  54. package/lib/commonjs/components/activity/Activity.js.map +1 -0
  55. package/lib/commonjs/components/activity/ActivityIcon.js +86 -0
  56. package/lib/commonjs/components/activity/ActivityIcon.js.map +1 -0
  57. package/lib/commonjs/components/activity/ActivityIntensity.js +65 -0
  58. package/lib/commonjs/components/activity/ActivityIntensity.js.map +1 -0
  59. package/lib/commonjs/components/mood/Emotion.js +86 -0
  60. package/lib/commonjs/components/mood/Emotion.js.map +1 -0
  61. package/lib/commonjs/components/mood/MoodIcon.js +107 -0
  62. package/lib/commonjs/components/mood/MoodIcon.js.map +1 -0
  63. package/lib/commonjs/components/styles/fonts.js +154 -0
  64. package/lib/commonjs/components/styles/fonts.js.map +1 -0
  65. package/lib/commonjs/index.js +21 -0
  66. package/lib/commonjs/index.js.map +1 -0
  67. package/lib/commonjs/locales/da/translations.json +82 -0
  68. package/lib/commonjs/locales/de/translations.json +81 -0
  69. package/lib/commonjs/locales/en/translations.json +84 -0
  70. package/lib/commonjs/locales/es/translations.json +81 -0
  71. package/lib/commonjs/locales/fr/translations.json +81 -0
  72. package/lib/commonjs/locales/it/translations.json +81 -0
  73. package/lib/commonjs/locales/translate.js +63 -0
  74. package/lib/commonjs/locales/translate.js.map +1 -0
  75. package/lib/commonjs/types/enum.js +179 -0
  76. package/lib/commonjs/types/enum.js.map +1 -0
  77. package/lib/commonjs/types/types.js +6 -0
  78. package/lib/commonjs/types/types.js.map +1 -0
  79. package/lib/commonjs/utils/AttentionMessages.js +141 -0
  80. package/lib/commonjs/utils/AttentionMessages.js.map +1 -0
  81. package/lib/commonjs/utils/Constants.js +138 -0
  82. package/lib/commonjs/utils/Constants.js.map +1 -0
  83. package/lib/commonjs/utils/RecommendationError.js +116 -0
  84. package/lib/commonjs/utils/RecommendationError.js.map +1 -0
  85. package/lib/commonjs/utils/RecommendationUtils.js +212 -0
  86. package/lib/commonjs/utils/RecommendationUtils.js.map +1 -0
  87. package/lib/commonjs/utils/Translations.js +22 -0
  88. package/lib/commonjs/utils/Translations.js.map +1 -0
  89. package/lib/commonjs/utils/Utils.js +162 -0
  90. package/lib/commonjs/utils/Utils.js.map +1 -0
  91. package/lib/commonjs/utils/Validations.js +468 -0
  92. package/lib/commonjs/utils/Validations.js.map +1 -0
  93. package/lib/module/RecommendationScreen.js +758 -0
  94. package/lib/module/RecommendationScreen.js.map +1 -0
  95. package/lib/module/assets/IconsSVG/Close.js +11 -0
  96. package/lib/module/assets/IconsSVG/Close.js.map +1 -0
  97. package/lib/module/assets/IconsSVG/CloseOutlined.js +19 -0
  98. package/lib/module/assets/IconsSVG/CloseOutlined.js.map +1 -0
  99. package/lib/module/assets/IconsSVG/Edit.js +14 -0
  100. package/lib/module/assets/IconsSVG/Edit.js.map +1 -0
  101. package/lib/module/assets/IconsSVG/activity/Cycling.js +34 -0
  102. package/lib/module/assets/IconsSVG/activity/Cycling.js.map +1 -0
  103. package/lib/module/assets/IconsSVG/activity/Running.js +24 -0
  104. package/lib/module/assets/IconsSVG/activity/Running.js.map +1 -0
  105. package/lib/module/assets/IconsSVG/activity/Stretching.js +24 -0
  106. package/lib/module/assets/IconsSVG/activity/Stretching.js.map +1 -0
  107. package/lib/module/assets/IconsSVG/activity/Swimming.js +39 -0
  108. package/lib/module/assets/IconsSVG/activity/Swimming.js.map +1 -0
  109. package/lib/module/assets/IconsSVG/activity/Walking.js +29 -0
  110. package/lib/module/assets/IconsSVG/activity/Walking.js.map +1 -0
  111. package/lib/module/assets/IconsSVG/mood/Happy.js +25 -0
  112. package/lib/module/assets/IconsSVG/mood/Happy.js.map +1 -0
  113. package/lib/module/assets/IconsSVG/mood/Neutral.js +25 -0
  114. package/lib/module/assets/IconsSVG/mood/Neutral.js.map +1 -0
  115. package/lib/module/assets/IconsSVG/mood/Sad.js +25 -0
  116. package/lib/module/assets/IconsSVG/mood/Sad.js.map +1 -0
  117. package/lib/module/assets/IconsSVG/mood/SemiHappy.js +25 -0
  118. package/lib/module/assets/IconsSVG/mood/SemiHappy.js.map +1 -0
  119. package/lib/module/assets/IconsSVG/mood/SemiSad.js +25 -0
  120. package/lib/module/assets/IconsSVG/mood/SemiSad.js.map +1 -0
  121. package/lib/module/components/ExitModal.js +114 -0
  122. package/lib/module/components/ExitModal.js.map +1 -0
  123. package/lib/module/components/InfoBars.js +114 -0
  124. package/lib/module/components/InfoBars.js.map +1 -0
  125. package/lib/module/components/InvisibleNumberInput.js +142 -0
  126. package/lib/module/components/InvisibleNumberInput.js.map +1 -0
  127. package/lib/module/components/LineSeparator.js +19 -0
  128. package/lib/module/components/LineSeparator.js.map +1 -0
  129. package/lib/module/components/RecentInsulin.js +97 -0
  130. package/lib/module/components/RecentInsulin.js.map +1 -0
  131. package/lib/module/components/RecommendationModal.js +291 -0
  132. package/lib/module/components/RecommendationModal.js.map +1 -0
  133. package/lib/module/components/RecommendedCarbs.js +281 -0
  134. package/lib/module/components/RecommendedCarbs.js.map +1 -0
  135. package/lib/module/components/RecommendedInsulin.js +200 -0
  136. package/lib/module/components/RecommendedInsulin.js.map +1 -0
  137. package/lib/module/components/Remeasure.js +123 -0
  138. package/lib/module/components/Remeasure.js.map +1 -0
  139. package/lib/module/components/Text.js +16 -0
  140. package/lib/module/components/Text.js.map +1 -0
  141. package/lib/module/components/TimeoutModal.js +103 -0
  142. package/lib/module/components/TimeoutModal.js.map +1 -0
  143. package/lib/module/components/TransferToLogbook.js +75 -0
  144. package/lib/module/components/TransferToLogbook.js.map +1 -0
  145. package/lib/module/components/activity/Activity.js +104 -0
  146. package/lib/module/components/activity/Activity.js.map +1 -0
  147. package/lib/module/components/activity/ActivityIcon.js +78 -0
  148. package/lib/module/components/activity/ActivityIcon.js.map +1 -0
  149. package/lib/module/components/activity/ActivityIntensity.js +57 -0
  150. package/lib/module/components/activity/ActivityIntensity.js.map +1 -0
  151. package/lib/module/components/mood/Emotion.js +78 -0
  152. package/lib/module/components/mood/Emotion.js.map +1 -0
  153. package/lib/module/components/mood/MoodIcon.js +97 -0
  154. package/lib/module/components/mood/MoodIcon.js.map +1 -0
  155. package/lib/module/components/styles/fonts.js +145 -0
  156. package/lib/module/components/styles/fonts.js.map +1 -0
  157. package/lib/module/index.js +5 -0
  158. package/lib/module/index.js.map +1 -0
  159. package/lib/module/locales/da/translations.json +82 -0
  160. package/lib/module/locales/de/translations.json +81 -0
  161. package/lib/module/locales/en/translations.json +84 -0
  162. package/lib/module/locales/es/translations.json +81 -0
  163. package/lib/module/locales/fr/translations.json +81 -0
  164. package/lib/module/locales/it/translations.json +81 -0
  165. package/lib/module/locales/translate.js +55 -0
  166. package/lib/module/locales/translate.js.map +1 -0
  167. package/lib/module/types/enum.js +170 -0
  168. package/lib/module/types/enum.js.map +1 -0
  169. package/lib/module/types/types.js.map +1 -0
  170. package/lib/module/utils/AttentionMessages.js +131 -0
  171. package/lib/module/utils/AttentionMessages.js.map +1 -0
  172. package/{dist/src → lib/module}/utils/Constants.js +78 -35
  173. package/lib/module/utils/Constants.js.map +1 -0
  174. package/{dist/src → lib/module}/utils/RecommendationError.js +28 -6
  175. package/lib/module/utils/RecommendationError.js.map +1 -0
  176. package/{dist/src → lib/module}/utils/RecommendationUtils.js +89 -90
  177. package/lib/module/utils/RecommendationUtils.js.map +1 -0
  178. package/{dist/src → lib/module}/utils/Translations.js +5 -3
  179. package/lib/module/utils/Translations.js.map +1 -0
  180. package/lib/module/utils/Utils.js +155 -0
  181. package/lib/module/utils/Utils.js.map +1 -0
  182. package/{dist/src → lib/module}/utils/Validations.js +155 -128
  183. package/lib/module/utils/Validations.js.map +1 -0
  184. package/{dist/src → lib/typescript}/RecommendationScreen.d.ts +2 -1
  185. package/lib/typescript/RecommendationScreen.d.ts.map +1 -0
  186. package/{dist/src → lib/typescript}/assets/IconsSVG/Close.d.ts +1 -0
  187. package/lib/typescript/assets/IconsSVG/Close.d.ts.map +1 -0
  188. package/{dist/src → lib/typescript}/assets/IconsSVG/CloseOutlined.d.ts +1 -0
  189. package/lib/typescript/assets/IconsSVG/CloseOutlined.d.ts.map +1 -0
  190. package/{dist/src → lib/typescript}/assets/IconsSVG/Edit.d.ts +1 -0
  191. package/lib/typescript/assets/IconsSVG/Edit.d.ts.map +1 -0
  192. package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Cycling.d.ts +1 -0
  193. package/lib/typescript/assets/IconsSVG/activity/Cycling.d.ts.map +1 -0
  194. package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Running.d.ts +1 -0
  195. package/lib/typescript/assets/IconsSVG/activity/Running.d.ts.map +1 -0
  196. package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Stretching.d.ts +1 -0
  197. package/lib/typescript/assets/IconsSVG/activity/Stretching.d.ts.map +1 -0
  198. package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Swimming.d.ts +1 -0
  199. package/lib/typescript/assets/IconsSVG/activity/Swimming.d.ts.map +1 -0
  200. package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Walking.d.ts +1 -0
  201. package/lib/typescript/assets/IconsSVG/activity/Walking.d.ts.map +1 -0
  202. package/{dist/src → lib/typescript}/assets/IconsSVG/mood/Happy.d.ts +1 -0
  203. package/lib/typescript/assets/IconsSVG/mood/Happy.d.ts.map +1 -0
  204. package/{dist/src → lib/typescript}/assets/IconsSVG/mood/Neutral.d.ts +1 -0
  205. package/lib/typescript/assets/IconsSVG/mood/Neutral.d.ts.map +1 -0
  206. package/{dist/src → lib/typescript}/assets/IconsSVG/mood/Sad.d.ts +1 -0
  207. package/lib/typescript/assets/IconsSVG/mood/Sad.d.ts.map +1 -0
  208. package/{dist/src → lib/typescript}/assets/IconsSVG/mood/SemiHappy.d.ts +1 -0
  209. package/lib/typescript/assets/IconsSVG/mood/SemiHappy.d.ts.map +1 -0
  210. package/{dist/src → lib/typescript}/assets/IconsSVG/mood/SemiSad.d.ts +1 -0
  211. package/lib/typescript/assets/IconsSVG/mood/SemiSad.d.ts.map +1 -0
  212. package/{dist/src → lib/typescript}/components/ExitModal.d.ts +1 -0
  213. package/lib/typescript/components/ExitModal.d.ts.map +1 -0
  214. package/{dist/src → lib/typescript}/components/InfoBars.d.ts +1 -0
  215. package/lib/typescript/components/InfoBars.d.ts.map +1 -0
  216. package/{dist/src → lib/typescript}/components/InvisibleNumberInput.d.ts +1 -0
  217. package/lib/typescript/components/InvisibleNumberInput.d.ts.map +1 -0
  218. package/{dist/src → lib/typescript}/components/LineSeparator.d.ts +1 -0
  219. package/lib/typescript/components/LineSeparator.d.ts.map +1 -0
  220. package/{dist/src → lib/typescript}/components/RecentInsulin.d.ts +1 -0
  221. package/lib/typescript/components/RecentInsulin.d.ts.map +1 -0
  222. package/{dist/src → lib/typescript}/components/RecommendationModal.d.ts +1 -0
  223. package/lib/typescript/components/RecommendationModal.d.ts.map +1 -0
  224. package/{dist/src → lib/typescript}/components/RecommendedCarbs.d.ts +1 -0
  225. package/lib/typescript/components/RecommendedCarbs.d.ts.map +1 -0
  226. package/{dist/src → lib/typescript}/components/RecommendedInsulin.d.ts +1 -0
  227. package/lib/typescript/components/RecommendedInsulin.d.ts.map +1 -0
  228. package/{dist/src → lib/typescript}/components/Remeasure.d.ts +1 -0
  229. package/lib/typescript/components/Remeasure.d.ts.map +1 -0
  230. package/{dist/src → lib/typescript}/components/Text.d.ts +1 -0
  231. package/lib/typescript/components/Text.d.ts.map +1 -0
  232. package/{dist/src → lib/typescript}/components/TimeoutModal.d.ts +1 -0
  233. package/lib/typescript/components/TimeoutModal.d.ts.map +1 -0
  234. package/{dist/src → lib/typescript}/components/TransferToLogbook.d.ts +1 -0
  235. package/lib/typescript/components/TransferToLogbook.d.ts.map +1 -0
  236. package/{dist/src → lib/typescript}/components/activity/Activity.d.ts +1 -0
  237. package/lib/typescript/components/activity/Activity.d.ts.map +1 -0
  238. package/{dist/src → lib/typescript}/components/activity/ActivityIcon.d.ts +1 -0
  239. package/lib/typescript/components/activity/ActivityIcon.d.ts.map +1 -0
  240. package/{dist/src → lib/typescript}/components/activity/ActivityIntensity.d.ts +1 -0
  241. package/lib/typescript/components/activity/ActivityIntensity.d.ts.map +1 -0
  242. package/{dist/src → lib/typescript}/components/mood/Emotion.d.ts +1 -0
  243. package/lib/typescript/components/mood/Emotion.d.ts.map +1 -0
  244. package/{dist/src → lib/typescript}/components/mood/MoodIcon.d.ts +1 -0
  245. package/lib/typescript/components/mood/MoodIcon.d.ts.map +1 -0
  246. package/{dist/src → lib/typescript}/components/styles/fonts.d.ts +1 -0
  247. package/lib/typescript/components/styles/fonts.d.ts.map +1 -0
  248. package/lib/typescript/index.d.ts +5 -0
  249. package/lib/typescript/index.d.ts.map +1 -0
  250. package/{dist/src → lib/typescript}/locales/translate.d.ts +1 -0
  251. package/lib/typescript/locales/translate.d.ts.map +1 -0
  252. package/{dist/src → lib/typescript}/types/enum.d.ts +1 -0
  253. package/lib/typescript/types/enum.d.ts.map +1 -0
  254. package/{dist/src → lib/typescript}/types/types.d.ts +1 -0
  255. package/lib/typescript/types/types.d.ts.map +1 -0
  256. package/{dist/src → lib/typescript}/utils/AttentionMessages.d.ts +1 -0
  257. package/lib/typescript/utils/AttentionMessages.d.ts.map +1 -0
  258. package/{dist/src → lib/typescript}/utils/Constants.d.ts +1 -0
  259. package/lib/typescript/utils/Constants.d.ts.map +1 -0
  260. package/{dist/src → lib/typescript}/utils/RecommendationError.d.ts +1 -0
  261. package/lib/typescript/utils/RecommendationError.d.ts.map +1 -0
  262. package/{dist/src → lib/typescript}/utils/RecommendationUtils.d.ts +1 -0
  263. package/lib/typescript/utils/RecommendationUtils.d.ts.map +1 -0
  264. package/{dist/src → lib/typescript}/utils/Translations.d.ts +1 -0
  265. package/lib/typescript/utils/Translations.d.ts.map +1 -0
  266. package/{dist/src → lib/typescript}/utils/Utils.d.ts +1 -0
  267. package/lib/typescript/utils/Utils.d.ts.map +1 -0
  268. package/{dist/src → lib/typescript}/utils/Validations.d.ts +1 -0
  269. package/lib/typescript/utils/Validations.d.ts.map +1 -0
  270. package/package.json +27 -7
  271. package/src/RecommendationScreen.tsx +854 -0
  272. package/src/assets/IconsSVG/Close.tsx +13 -0
  273. package/src/assets/IconsSVG/CloseOutlined.tsx +23 -0
  274. package/src/assets/IconsSVG/Edit.tsx +16 -0
  275. package/src/assets/IconsSVG/activity/Cycling.tsx +41 -0
  276. package/src/assets/IconsSVG/activity/Running.tsx +29 -0
  277. package/src/assets/IconsSVG/activity/Stretching.tsx +29 -0
  278. package/src/assets/IconsSVG/activity/Swimming.tsx +47 -0
  279. package/src/assets/IconsSVG/activity/Walking.tsx +35 -0
  280. package/src/assets/IconsSVG/mood/Happy.tsx +30 -0
  281. package/src/assets/IconsSVG/mood/Neutral.tsx +30 -0
  282. package/src/assets/IconsSVG/mood/Sad.tsx +30 -0
  283. package/src/assets/IconsSVG/mood/SemiHappy.tsx +30 -0
  284. package/src/assets/IconsSVG/mood/SemiSad.tsx +30 -0
  285. package/src/components/ExitModal.tsx +134 -0
  286. package/src/components/InfoBars.tsx +122 -0
  287. package/src/components/InvisibleNumberInput.tsx +170 -0
  288. package/src/components/LineSeparator.tsx +29 -0
  289. package/src/components/RecentInsulin.tsx +109 -0
  290. package/src/components/RecommendationModal.tsx +319 -0
  291. package/src/components/RecommendedCarbs.tsx +303 -0
  292. package/src/components/RecommendedInsulin.tsx +219 -0
  293. package/src/components/Remeasure.tsx +135 -0
  294. package/src/components/Text.tsx +27 -0
  295. package/src/components/TimeoutModal.tsx +121 -0
  296. package/src/components/TransferToLogbook.tsx +92 -0
  297. package/src/components/activity/Activity.tsx +107 -0
  298. package/src/components/activity/ActivityIcon.tsx +77 -0
  299. package/src/components/activity/ActivityIntensity.tsx +67 -0
  300. package/src/components/mood/Emotion.tsx +97 -0
  301. package/src/components/mood/MoodIcon.tsx +91 -0
  302. package/src/components/styles/fonts.ts +145 -0
  303. package/src/index.ts +5 -0
  304. package/src/locales/da/translations.json +82 -0
  305. package/src/locales/de/translations.json +81 -0
  306. package/src/locales/en/translations.json +84 -0
  307. package/src/locales/es/translations.json +81 -0
  308. package/src/locales/fr/translations.json +81 -0
  309. package/src/locales/it/translations.json +81 -0
  310. package/src/locales/translate.ts +62 -0
  311. package/src/types/enum.ts +164 -0
  312. package/src/types/types.ts +19 -0
  313. package/src/utils/AttentionMessages.ts +167 -0
  314. package/src/utils/Constants.ts +77 -0
  315. package/src/utils/RecommendationError.ts +182 -0
  316. package/src/utils/RecommendationUtils.ts +232 -0
  317. package/src/utils/Translations.ts +17 -0
  318. package/src/utils/Utils.ts +156 -0
  319. package/src/utils/Validations.ts +490 -0
  320. package/dist/index.d.ts +0 -5
  321. package/dist/index.js +0 -6
  322. package/dist/index.js.map +0 -1
  323. package/dist/src/RecommendationScreen.js +0 -537
  324. package/dist/src/RecommendationScreen.js.map +0 -1
  325. package/dist/src/assets/IconsSVG/Close.js +0 -7
  326. package/dist/src/assets/IconsSVG/Close.js.map +0 -1
  327. package/dist/src/assets/IconsSVG/CloseOutlined.js +0 -9
  328. package/dist/src/assets/IconsSVG/CloseOutlined.js.map +0 -1
  329. package/dist/src/assets/IconsSVG/Edit.js +0 -8
  330. package/dist/src/assets/IconsSVG/Edit.js.map +0 -1
  331. package/dist/src/assets/IconsSVG/activity/Cycling.js +0 -12
  332. package/dist/src/assets/IconsSVG/activity/Cycling.js.map +0 -1
  333. package/dist/src/assets/IconsSVG/activity/Running.js +0 -10
  334. package/dist/src/assets/IconsSVG/activity/Running.js.map +0 -1
  335. package/dist/src/assets/IconsSVG/activity/Stretching.js +0 -10
  336. package/dist/src/assets/IconsSVG/activity/Stretching.js.map +0 -1
  337. package/dist/src/assets/IconsSVG/activity/Swimming.js +0 -13
  338. package/dist/src/assets/IconsSVG/activity/Swimming.js.map +0 -1
  339. package/dist/src/assets/IconsSVG/activity/Walking.js +0 -11
  340. package/dist/src/assets/IconsSVG/activity/Walking.js.map +0 -1
  341. package/dist/src/assets/IconsSVG/mood/Happy.js +0 -11
  342. package/dist/src/assets/IconsSVG/mood/Happy.js.map +0 -1
  343. package/dist/src/assets/IconsSVG/mood/Neutral.js +0 -11
  344. package/dist/src/assets/IconsSVG/mood/Neutral.js.map +0 -1
  345. package/dist/src/assets/IconsSVG/mood/Sad.js +0 -11
  346. package/dist/src/assets/IconsSVG/mood/Sad.js.map +0 -1
  347. package/dist/src/assets/IconsSVG/mood/SemiHappy.js +0 -11
  348. package/dist/src/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
  349. package/dist/src/assets/IconsSVG/mood/SemiSad.js +0 -11
  350. package/dist/src/assets/IconsSVG/mood/SemiSad.js.map +0 -1
  351. package/dist/src/components/ExitModal.js +0 -91
  352. package/dist/src/components/ExitModal.js.map +0 -1
  353. package/dist/src/components/InfoBars.js +0 -98
  354. package/dist/src/components/InfoBars.js.map +0 -1
  355. package/dist/src/components/InvisibleNumberInput.js +0 -123
  356. package/dist/src/components/InvisibleNumberInput.js.map +0 -1
  357. package/dist/src/components/LineSeparator.js +0 -17
  358. package/dist/src/components/LineSeparator.js.map +0 -1
  359. package/dist/src/components/RecentInsulin.js +0 -90
  360. package/dist/src/components/RecentInsulin.js.map +0 -1
  361. package/dist/src/components/RecommendationModal.js +0 -241
  362. package/dist/src/components/RecommendationModal.js.map +0 -1
  363. package/dist/src/components/RecommendedCarbs.js +0 -234
  364. package/dist/src/components/RecommendedCarbs.js.map +0 -1
  365. package/dist/src/components/RecommendedInsulin.js +0 -166
  366. package/dist/src/components/RecommendedInsulin.js.map +0 -1
  367. package/dist/src/components/Remeasure.js +0 -103
  368. package/dist/src/components/Remeasure.js.map +0 -1
  369. package/dist/src/components/Text.js +0 -14
  370. package/dist/src/components/Text.js.map +0 -1
  371. package/dist/src/components/TimeoutModal.js +0 -84
  372. package/dist/src/components/TimeoutModal.js.map +0 -1
  373. package/dist/src/components/TransferToLogbook.js +0 -68
  374. package/dist/src/components/TransferToLogbook.js.map +0 -1
  375. package/dist/src/components/activity/Activity.js +0 -93
  376. package/dist/src/components/activity/Activity.js.map +0 -1
  377. package/dist/src/components/activity/ActivityIcon.js +0 -66
  378. package/dist/src/components/activity/ActivityIcon.js.map +0 -1
  379. package/dist/src/components/activity/ActivityIntensity.js +0 -55
  380. package/dist/src/components/activity/ActivityIntensity.js.map +0 -1
  381. package/dist/src/components/mood/Emotion.js +0 -69
  382. package/dist/src/components/mood/Emotion.js.map +0 -1
  383. package/dist/src/components/mood/MoodIcon.js +0 -68
  384. package/dist/src/components/mood/MoodIcon.js.map +0 -1
  385. package/dist/src/components/styles/fonts.js +0 -145
  386. package/dist/src/components/styles/fonts.js.map +0 -1
  387. package/dist/src/locales/da/translations.json +0 -82
  388. package/dist/src/locales/de/translations.json +0 -81
  389. package/dist/src/locales/en/translations.json +0 -84
  390. package/dist/src/locales/es/translations.json +0 -81
  391. package/dist/src/locales/fr/translations.json +0 -81
  392. package/dist/src/locales/it/translations.json +0 -81
  393. package/dist/src/locales/translate.js +0 -53
  394. package/dist/src/locales/translate.js.map +0 -1
  395. package/dist/src/types/enum.js +0 -154
  396. package/dist/src/types/enum.js.map +0 -1
  397. package/dist/src/types/types.js.map +0 -1
  398. package/dist/src/utils/AttentionMessages.js +0 -123
  399. package/dist/src/utils/AttentionMessages.js.map +0 -1
  400. package/dist/src/utils/Constants.js.map +0 -1
  401. package/dist/src/utils/RecommendationError.js.map +0 -1
  402. package/dist/src/utils/RecommendationUtils.js.map +0 -1
  403. package/dist/src/utils/Translations.js.map +0 -1
  404. package/dist/src/utils/Utils.js +0 -142
  405. package/dist/src/utils/Utils.js.map +0 -1
  406. package/dist/src/utils/Validations.js.map +0 -1
  407. package/dist/tsconfig.tsbuildinfo +0 -1
  408. /package/{dist/src → lib/module}/types/types.js +0 -0
@@ -0,0 +1,200 @@
1
+ import React from "react";
2
+ import { Alert, StyleSheet, TouchableOpacity, View } from "react-native";
3
+ import { BolusCalculator } from "@hedia/types";
4
+ import Edit from "../assets/IconsSVG/Edit";
5
+ import { t } from "../locales/translate";
6
+ import { Testing } from "../types/enum";
7
+ import { Messages } from "../utils/AttentionMessages";
8
+ import { colors } from "../utils/Constants";
9
+ import { Utils } from "../utils/Utils";
10
+ import InvisibleNumberInput from "./InvisibleNumberInput";
11
+ import { FONTS } from "./styles/fonts";
12
+ import Text from "./Text";
13
+ const {
14
+ RecommendedInsulinTestIds
15
+ } = Testing.Id;
16
+ const SAFETY_INSULIN_LIMIT = BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
17
+
18
+ /** Input field for displaying the entered amount of insulin (which defaults to HDA’s recommendation) and allowing the user to edit it. */
19
+ export default class RecommendedInsulin extends React.Component {
20
+ /** Initialise the state partialInput variable with undefined */
21
+ state = {
22
+ partialInput: undefined
23
+ };
24
+ /**
25
+ * Function taking no arguments and returning no value.
26
+ * Will be bound to the function that activates input for InvisibleNumberInput when that component has been mounted.
27
+ */
28
+
29
+ /**
30
+ * Called immediately after updating occurs. Not called for the initial render.
31
+ * The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
32
+ *
33
+ * Steps:
34
+ * 1. If the value of the enteredInsulin prop was changed, set the partialInput state variable to the new value.
35
+ * @param prevProps The previous component props
36
+ */
37
+ componentDidUpdate(prevProps) {
38
+ const {
39
+ enteredInsulin
40
+ } = this.props;
41
+ if (prevProps.enteredInsulin !== enteredInsulin) {
42
+ this.setState({
43
+ partialInput: enteredInsulin?.toString()
44
+ });
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Handle what should happen when the InsulinRecommendation component has been pressed.
50
+ * Uses the InvisibleNumberInput child component to enable the user to input the amount of insulin that hey are taking.
51
+ *
52
+ * Steps:
53
+ * 1. Call the callbackInput() member method.
54
+ */
55
+ handleOnPress = () => {
56
+ this.callbackInput?.();
57
+ };
58
+
59
+ /**
60
+ * Passed to the InvisibleNumberInput child component as a callback function to be called every time the content of the input field changes.
61
+ *
62
+ * Steps:
63
+ * 1. Assign a new local variable, replacedZero, with the value of the insulin argument string
64
+ * except for the first character if insulin is longer than 1 character and starts with a '0' but doesn’t start with ‘0.’.
65
+ * Otherwise set it to insulin. This would be better handled by converting it to a number: replacedZero = Number(insulin);
66
+ * 2. Save replacedZero to the partialInput state variable.
67
+ * 3. Return replacedZero
68
+ * @param insulin The contents of the input field.
69
+ * @returns The partially cleaned input.
70
+ */
71
+ updatePartially = insulin => {
72
+ const replacedZero = insulin.length > 1 && insulin.startsWith(`0`) && !insulin.startsWith(`0.`) ? insulin.substring(1) : insulin;
73
+ this.setState({
74
+ partialInput: replacedZero
75
+ });
76
+ return replacedZero;
77
+ };
78
+
79
+ /**
80
+ * Handle what happens when input in the InvisibleNumberInput child component is completed.
81
+ *
82
+ * Steps:
83
+ * 1. Get the rounded insulin amount using the value argument and the injectionMethod prop as arguments for the Utils.roundValue() function.
84
+ * 2. Get the adjusted safety insulin limit (due to activity) by multiplying the activity reduction factor (which is 1 minus the activityReduction prop) with the SAFETY_INSULIN_LIMIT constant.
85
+ * 3. If the rounded value exceeds the adjusted safety threshold:
86
+ * - Call the updatePartially() method with the adjusted safety threshold to set the insulin amount to the capped value.
87
+ * - Return an Alert with a message about the insulin limit.
88
+ * 4. Call the updatePartially() method with the rounded value to set the entered insulin value.
89
+ * 5. Call the updateRecommendedInsulin callback function prop with rounded as the argument to report back the updated insulin amount to the parent RecommendationScreen component.
90
+ * @param value The numerical value of the input field at completion.
91
+ */
92
+ handleUpdatedInsulin = value => {
93
+ const rounded = Utils.roundValue(value, this.props.injectionMethod);
94
+
95
+ // https://hedia.atlassian.net/browse/HDA-795
96
+ const limited = (1 - (this.props.activityReduction ?? 0)) * SAFETY_INSULIN_LIMIT;
97
+ if (rounded > limited) {
98
+ this.setState({
99
+ partialInput: this.props.insulinRecommendation?.toString() ?? null
100
+ });
101
+ this.props.updateRecommendedInsulin(this.props.insulinRecommendation);
102
+ return Alert.alert(t(`Attention`), Messages.InsulinInputWasLimited(this.props.activityReduction), [{
103
+ text: t(`OK`)
104
+ }]);
105
+ }
106
+ this.updatePartially(`${rounded}`);
107
+ this.props.updateRecommendedInsulin(rounded);
108
+ };
109
+
110
+ /**
111
+ * Render a JSX element to display the insulin input field with the current insulin amount value
112
+ * and using an InvisibleNumberInput component to enable input when the insulin amount is tapped.
113
+ */
114
+ render = () => {
115
+ const shownInsulin = this.state.partialInput ?? this.props.insulinRecommendation ?? `0`;
116
+ const {
117
+ EditRecommendedInsulin,
118
+ EditRecommendedInsulinIcon,
119
+ ShownInsulinText,
120
+ InvisibleInsulinInput
121
+ } = RecommendedInsulinTestIds;
122
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TouchableOpacity, {
123
+ testID: EditRecommendedInsulin,
124
+ onPress: this.handleOnPress,
125
+ style: style.container
126
+ }, /*#__PURE__*/React.createElement(Text, {
127
+ style: style.titleText
128
+ }, t(`Recommended amount of insulin`)), /*#__PURE__*/React.createElement(Text, {
129
+ style: style.insulinText,
130
+ testID: ShownInsulinText
131
+ }, shownInsulin), /*#__PURE__*/React.createElement(Text, {
132
+ style: style.unitsText
133
+ }, t(`Units`)), /*#__PURE__*/React.createElement(View, {
134
+ style: style.enterManually
135
+ }, Edit({
136
+ color: colors.teal,
137
+ style: style.editIcon,
138
+ testID: EditRecommendedInsulinIcon
139
+ }), /*#__PURE__*/React.createElement(Text, {
140
+ style: style.editText
141
+ }, t(`Enter Manually`)))), /*#__PURE__*/React.createElement(InvisibleNumberInput, {
142
+ testID: InvisibleInsulinInput,
143
+ decimalPlaces: 1,
144
+ maxLength: 4,
145
+ negativeAllowed: false,
146
+ cleanPartialInput: false,
147
+ partialInput: this.updatePartially,
148
+ onEnd: this.handleUpdatedInsulin,
149
+ visible: visible => this.callbackInput = visible,
150
+ startValue: `${shownInsulin}`
151
+ }));
152
+ };
153
+ }
154
+ const style = StyleSheet.create({
155
+ container: {
156
+ borderRadius: 5,
157
+ padding: 16,
158
+ backgroundColor: colors.deepPurple,
159
+ marginBottom: 32,
160
+ minHeight: 200
161
+ },
162
+ editText: {
163
+ ...FONTS.Poppins.regular_SM,
164
+ color: colors.teal,
165
+ textAlign: `center`
166
+ },
167
+ unitsText: {
168
+ ...FONTS.Poppins.medium_XS,
169
+ color: colors.white,
170
+ textAlign: `center`,
171
+ marginTop: -16,
172
+ marginBottom: 16
173
+ },
174
+ insulinText: {
175
+ ...FONTS.Oswald.bold_7XL,
176
+ color: colors.white,
177
+ textAlign: `center`,
178
+ minHeight: 110,
179
+ lineHeight: 90,
180
+ letterSpacing: 6,
181
+ justifyContent: `center`
182
+ },
183
+ titleText: {
184
+ ...FONTS.Poppins.medium_Base,
185
+ color: colors.white,
186
+ textAlign: `center`,
187
+ marginBottom: 16
188
+ },
189
+ editIcon: {
190
+ height: 16,
191
+ width: 16,
192
+ marginRight: 4,
193
+ alignSelf: `center`
194
+ },
195
+ enterManually: {
196
+ flexDirection: `row`,
197
+ justifyContent: `center`
198
+ }
199
+ });
200
+ //# sourceMappingURL=RecommendedInsulin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Alert","StyleSheet","TouchableOpacity","View","BolusCalculator","Edit","t","Testing","Messages","colors","Utils","InvisibleNumberInput","FONTS","Text","RecommendedInsulinTestIds","Id","SAFETY_INSULIN_LIMIT","Constants","RecommendedInsulin","Component","state","partialInput","undefined","componentDidUpdate","prevProps","enteredInsulin","props","setState","toString","handleOnPress","callbackInput","updatePartially","insulin","replacedZero","length","startsWith","substring","handleUpdatedInsulin","value","rounded","roundValue","injectionMethod","limited","activityReduction","insulinRecommendation","updateRecommendedInsulin","alert","InsulinInputWasLimited","text","render","shownInsulin","EditRecommendedInsulin","EditRecommendedInsulinIcon","ShownInsulinText","InvisibleInsulinInput","createElement","Fragment","testID","onPress","style","container","titleText","insulinText","unitsText","enterManually","color","teal","editIcon","editText","decimalPlaces","maxLength","negativeAllowed","cleanPartialInput","onEnd","visible","startValue","create","borderRadius","padding","backgroundColor","deepPurple","marginBottom","minHeight","Poppins","regular_SM","textAlign","medium_XS","white","marginTop","Oswald","bold_7XL","lineHeight","letterSpacing","justifyContent","medium_Base","height","width","marginRight","alignSelf","flexDirection"],"sourceRoot":"../../../src","sources":["components/RecommendedInsulin.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAExE,SAASC,eAAe,QAAsB,cAAc;AAE5D,OAAOC,IAAI,MAAM,yBAAyB;AAC1C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,CAAC;EACDlC,aAAa,EAAE;IACdmC,aAAa,EAAG,KAAI;IACpBN,cAAc,EAAG;EAClB;AACD,CAAC,CAAC"}
@@ -0,0 +1,123 @@
1
+ import Slider from "@react-native-community/slider";
2
+ import React from "react";
3
+ import { StyleSheet, View } from "react-native";
4
+ import { t } from "../locales/translate";
5
+ import { Testing } from "../types/enum";
6
+ import { colors } from "../utils/Constants";
7
+ import { FONTS } from "./styles/fonts";
8
+ import Text from "./Text";
9
+ /**
10
+ * The Remeasure component has a slider child component that the user can drag to change
11
+ * when they will get a reminder notification about measuring their BGL again.
12
+ */
13
+ export default class Remeasure extends React.Component {
14
+ constructor(props) {
15
+ super(props);
16
+ this.state = {
17
+ remeasureTime: props.remeasureTime
18
+ };
19
+ }
20
+
21
+ /**
22
+ * Steps:
23
+ * 1. Use limitTime() to limit/clamp the value of remeasureTime in the range 0 to 6.
24
+ * 2. Call the onSliderChange prop callback function with the limited value as argument.
25
+ * @param remeasureTime The value of the remeasurement slider.
26
+ */
27
+ handleSliderChange = remeasureTime => {
28
+ this.setState({
29
+ remeasureTime
30
+ });
31
+ const limited = this.limitTime(remeasureTime);
32
+ this.props.onSliderChange(limited);
33
+ };
34
+
35
+ /**
36
+ * Steps:
37
+ * 1.Use Math.min() and Math.max() to clamp remeasureTime in the range 0 to 6 and return the result.
38
+ * @param remeasureTime The value of the remeasurement slider.
39
+ * @returns The limited remeasurement time in hours
40
+ */
41
+ limitTime = remeasureTime => {
42
+ return Math.min(Math.max(0, remeasureTime), 6);
43
+ };
44
+
45
+ /**
46
+ * Compose a JSX element for displaying the currently selected remeasurement time along
47
+ * with a horizontal slider for changing it in increments of 0.5 hours in the range 0 to 6.
48
+ */
49
+ render() {
50
+ const measure = this.state.remeasureTime > 0;
51
+ const limited = this.limitTime(this.state.remeasureTime);
52
+ const {
53
+ RemeasureHours,
54
+ RemeasureSlider
55
+ } = Testing.Id.RemeasureTestIds;
56
+ return /*#__PURE__*/React.createElement(View, {
57
+ style: styles.container
58
+ }, /*#__PURE__*/React.createElement(View, {
59
+ style: styles.textContainer
60
+ }, /*#__PURE__*/React.createElement(Text, {
61
+ style: styles.remeasureLabel,
62
+ maxFontSizeMultiplier: 1
63
+ }, t(`Remind me to remeasure in`)), /*#__PURE__*/React.createElement(View, {
64
+ style: styles.valueUnitContainer
65
+ }, /*#__PURE__*/React.createElement(Text, {
66
+ style: styles.value,
67
+ testID: RemeasureHours,
68
+ maxFontSizeMultiplier: 1
69
+ }, measure ? limited : t(`OFF`)), measure && /*#__PURE__*/React.createElement(Text, {
70
+ style: styles.units,
71
+ maxFontSizeMultiplier: 1
72
+ }, t(`hours`)))), /*#__PURE__*/React.createElement(Slider, {
73
+ testID: RemeasureSlider,
74
+ maximumTrackTintColor: colors.mistBlue,
75
+ minimumTrackTintColor: colors.blue,
76
+ thumbTintColor: colors.white,
77
+ maximumValue: 6,
78
+ minimumValue: 0,
79
+ step: 0.5,
80
+ onValueChange: this.handleSliderChange,
81
+ value: limited
82
+ }));
83
+ }
84
+ }
85
+ const styles = StyleSheet.create({
86
+ container: {
87
+ flexDirection: `column`,
88
+ marginVertical: 32
89
+ },
90
+ textContainer: {
91
+ flexDirection: `row`,
92
+ marginBottom: 18
93
+ },
94
+ remeasureLabel: {
95
+ ...FONTS.Poppins.regular_Base,
96
+ color: colors.white,
97
+ flex: 7,
98
+ alignSelf: `center`
99
+ },
100
+ offText: {
101
+ ...FONTS.Poppins.bold_Base,
102
+ color: colors.white
103
+ },
104
+ valueUnitContainer: {
105
+ flex: 3,
106
+ justifyContent: `center`,
107
+ alignItems: `baseline`,
108
+ flexDirection: `row`,
109
+ alignSelf: `center`
110
+ },
111
+ value: {
112
+ ...FONTS.Poppins.medium_2XL,
113
+ textAlign: `right`,
114
+ color: colors.white
115
+ },
116
+ units: {
117
+ ...FONTS.Poppins.regular_XS,
118
+ textAlign: `left`,
119
+ paddingLeft: 4,
120
+ color: colors.white
121
+ }
122
+ });
123
+ //# sourceMappingURL=Remeasure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Slider","React","StyleSheet","View","t","Testing","colors","FONTS","Text","Remeasure","Component","constructor","props","state","remeasureTime","handleSliderChange","setState","limited","limitTime","onSliderChange","Math","min","max","render","measure","RemeasureHours","RemeasureSlider","Id","RemeasureTestIds","createElement","style","styles","container","textContainer","remeasureLabel","maxFontSizeMultiplier","valueUnitContainer","value","testID","units","maximumTrackTintColor","mistBlue","minimumTrackTintColor","blue","thumbTintColor","white","maximumValue","minimumValue","step","onValueChange","create","flexDirection","marginVertical","marginBottom","Poppins","regular_Base","color","flex","alignSelf","offText","bold_Base","justifyContent","alignItems","medium_2XL","textAlign","regular_XS","paddingLeft"],"sourceRoot":"../../../src","sources":["components/Remeasure.tsx"],"mappings":"AAAA,OAAOA,MAAM,MAAM,gCAAgC;AACnD,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,SAASC,CAAC,QAAQ,sBAAsB;AACxC,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,KAAK,QAAQ,gBAAgB;AACtC,OAAOC,IAAI,MAAM,QAAQ;AAezB;AACA;AACA;AACA;AACA,eAAe,MAAMC,SAAS,SAASR,KAAK,CAACS,SAAS,CAAiB;EACtEC,WAAWA,CAACC,KAAa,EAAE;IAC1B,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,KAAK,GAAG;MAAEC,aAAa,EAAEF,KAAK,CAACE;IAAc,CAAC;EACpD;;EAEA;AACD;AACA;AACA;AACA;AACA;EACQC,kBAAkB,GAAID,aAAqB,IAAW;IAC5D,IAAI,CAACE,QAAQ,CAAC;MAAEF;IAAc,CAAC,CAAC;IAChC,MAAMG,OAAO,GAAG,IAAI,CAACC,SAAS,CAACJ,aAAa,CAAC;IAC7C,IAAI,CAACF,KAAK,CAACO,cAAc,CAACF,OAAO,CAAC;EACnC,CAAC;;EAED;AACD;A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AAE,CAAC;IACdV,KAAK,EAAElD,MAAM,CAACuC;EACf;AACD,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ import * as React from "react";
3
+ import { StyleSheet, Text as RNText } from "react-native";
4
+ import { FONTS } from "./styles/fonts";
5
+ const maxFontSizeMultiplier = 1.235;
6
+ const Text = props => /*#__PURE__*/React.createElement(RNText, _extends({}, props, {
7
+ style: [styles.defaultText, props.style],
8
+ maxFontSizeMultiplier: maxFontSizeMultiplier
9
+ }), props.children);
10
+ const styles = StyleSheet.create({
11
+ defaultText: {
12
+ ...FONTS.Poppins.regular_Base
13
+ }
14
+ });
15
+ export default Text;
16
+ //# sourceMappingURL=Text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","StyleSheet","Text","RNText","FONTS","maxFontSizeMultiplier","props","createElement","_extends","style","styles","defaultText","children","create","Poppins","regular_Base"],"sourceRoot":"../../../src","sources":["components/Text.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,EAAEC,IAAI,IAAIC,MAAM,QAA8B,cAAc;AAE/E,SAAqBC,KAAK,QAAQ,gBAAgB;AAElD,MAAMC,qBAAqB,GAAG,KAAK;AAUnC,MAAMH,IAAI,GAAII,KAA2B,iBACxCN,KAAA,CAAAO,aAAA,CAACJ,MAAM,EAAAK,QAAA,KAAKF,KAAK;EAAEG,KAAK,EAAE,CAACC,MAAM,CAACC,WAAW,EAAEL,KAAK,CAACG,KAAK,CAAE;EAACJ,qBAAqB,EAAEA;AAAsB,IACxGC,KAAK,CAACM,QAAQ,CAEhB;AAED,MAAMF,MAAM,GAAGT,UAAU,CAACY,MAAM,CAAC;EAChCF,WAAW,EAAE;IACZ,GAAGP,KAAK,CAACU,OAAO,CAACC;EAClB;AACD,CAAC,CAAC;AACF,eAAeb,IAAI"}
@@ -0,0 +1,103 @@
1
+ import * as React from "react";
2
+ import { StatusBar, StyleSheet, TouchableOpacity, View } from "react-native";
3
+ import ReactNativeModal from "react-native-modal";
4
+ import { Testing } from "../types/enum";
5
+ import { colors } from "../utils/Constants";
6
+ import { FONTS } from "./styles/fonts";
7
+ import Text from "./Text";
8
+ const {
9
+ TimeOutModalTestIds
10
+ } = Testing.Id;
11
+ /** Display a modal with two buttons for the user to choose between. */
12
+ export default class TimeoutModal extends React.Component {
13
+ /** Compose a JSX element for displaying the modal. */
14
+ render() {
15
+ return /*#__PURE__*/React.createElement(ReactNativeModal, {
16
+ style: style.container,
17
+ isVisible: this.props.isVisible,
18
+ onModalHide: this.props.onModalHide,
19
+ animationIn: `fadeIn`,
20
+ animationOut: `fadeOut`
21
+ }, /*#__PURE__*/React.createElement(StatusBar, {
22
+ backgroundColor: colors.black
23
+ }), /*#__PURE__*/React.createElement(View, {
24
+ style: style.modalContainer
25
+ }, /*#__PURE__*/React.createElement(View, {
26
+ style: style.textContainer
27
+ }, /*#__PURE__*/React.createElement(Text, {
28
+ style: style.title
29
+ }, this.props.title), /*#__PURE__*/React.createElement(Text, {
30
+ style: style.message
31
+ }, this.props.message)), /*#__PURE__*/React.createElement(View, {
32
+ style: style.buttonContainer
33
+ }, /*#__PURE__*/React.createElement(TouchableOpacity, {
34
+ testID: TimeOutModalTestIds.FirstOption,
35
+ onPress: this.props.firstOption,
36
+ style: [style.button, {
37
+ backgroundColor: colors.teal,
38
+ marginBottom: 16
39
+ }]
40
+ }, /*#__PURE__*/React.createElement(Text, {
41
+ style: style.textFirstButton
42
+ }, this.props.textFirstOption)), /*#__PURE__*/React.createElement(TouchableOpacity, {
43
+ testID: TimeOutModalTestIds.SecondOption,
44
+ onPress: this.props.secondOption,
45
+ style: style.button
46
+ }, /*#__PURE__*/React.createElement(Text, {
47
+ style: style.textSecondButton
48
+ }, this.props.textSecondOption)))));
49
+ }
50
+ }
51
+ /** @internal */
52
+ const style = StyleSheet.create({
53
+ container: {
54
+ margin: 0,
55
+ justifyContent: `center`,
56
+ backgroundColor: colors.transparentBlack
57
+ },
58
+ modalContainer: {
59
+ margin: 16,
60
+ padding: 24,
61
+ backgroundColor: colors.semiDarkBlue,
62
+ borderRadius: 24
63
+ },
64
+ textContainer: {
65
+ alignSelf: `flex-start`,
66
+ marginBottom: 24
67
+ },
68
+ title: {
69
+ ...FONTS.Poppins.bold_XL,
70
+ color: colors.white,
71
+ textAlign: `center`,
72
+ marginBottom: 24
73
+ },
74
+ message: {
75
+ ...FONTS.Poppins.regular_Base,
76
+ color: colors.lightBlue,
77
+ textAlign: `center`
78
+ },
79
+ buttonContainer: {
80
+ flexDirection: `column`,
81
+ justifyContent: `space-around`
82
+ },
83
+ button: {
84
+ borderRadius: 50,
85
+ borderWidth: 1,
86
+ borderColor: colors.teal
87
+ },
88
+ textFirstButton: {
89
+ ...FONTS.Poppins.bold_LG,
90
+ textAlign: `center`,
91
+ color: colors.black,
92
+ paddingHorizontal: 16,
93
+ paddingVertical: 12
94
+ },
95
+ textSecondButton: {
96
+ ...FONTS.Poppins.bold_LG,
97
+ textAlign: `center`,
98
+ color: colors.teal,
99
+ paddingHorizontal: 16,
100
+ paddingVertical: 12
101
+ }
102
+ });
103
+ //# sourceMappingURL=TimeoutModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","StatusBar","StyleSheet","TouchableOpacity","View","ReactNativeModal","Testing","colors","FONTS","Text","TimeOutModalTestIds","Id","TimeoutModal","Component","render","createElement","style","container","isVisible","props","onModalHide","animationIn","animationOut","backgroundColor","black","modalContainer","textContainer","title","message","buttonContainer","testID","FirstOption","onPress","firstOption","button","teal","marginBottom","textFirstButton","textFirstOption","SecondOption","secondOption","textSecondButton","textSecondOption","create","margin","justifyContent","transparentBlack","padding","semiDarkBlue","borderRadius","alignSelf","Poppins","bold_XL","color","white","textAlign","regular_Base","lightBlue","flexDirection","borderWidth","borderColor","bold_LG","paddingHorizontal","paddingVertical"],"sourceRoot":"../../../src","sources":["components/TimeoutModal.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,SAAS,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAC5E,OAAOC,gBAAgB,MAAM,oBAAoB;AAEjD,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,KAAK,QAAQ,gBAAgB;AACtC,OAAOC,IAAI,MAAM,QAAQ;AAEzB,MAAM;EAAEC;AAAoB,CAAC,GAAGJ,OAAO,CAACK,EAAE;AAqB1C;AACA,eAAe,MAAMC,YAAY,SAASZ,KAAK,CAACa,SAAS,CAAqB;EAC7E;EACOC,MAAMA,CAAA,EAAgB;IAC5B,oBACCd,KAAA,CAAAe,aAAA,CAACV,gBAAgB;MAChBW,KAAK,EAAEA,KAAK,CAACC,SAAU;MACvBC,SAAS,EAAE,IAAI,CAACC,KAAK,CAACD,SAAU;MAChCE,WAAW,EAAE,IAAI,CAACD,KAAK,CAACC,WAAY;MACpCC,WAAW,EAAG,QAAQ;MACtBC,YAAY,EAAG;IAAS,gBAExBtB,KAAA,CAAAe,aAAA,CAACd,SAAS;MAACsB,eAAe,EAAEhB,MAAM,CAACiB;IAAM,EAAG,eAC5CxB,KAAA,CAAAe,aAAA,CAACX,IAAI;MAACY,KAAK,EAAEA,KAAK,CAACS;IAAe,gBACjCzB,KAAA,CAAAe,aAAA,CAACX,IAAI;MAACY,KAAK,EAAEA,KAAK,CAACU;IAAc,gBAChC1B,KAAA,CAAAe,aAAA,CAACN,IAAI;MAACO,KAAK,EAAEA,KAAK,CAACW;IAAM,GAAE,IAAI,CAACR,KAAK,CAACQ,KAAK,CAAQ,eACnD3B,KAAA,CAAAe,aAAA,CAACN,IAAI;MAACO,KAAK,EAAEA,KAAK,CAACY;IAAQ,G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vBd,YAAY,EAAE;EACf,CAAC;EACDT,KAAK,EAAE;IACN,GAAGnB,KAAK,CAAC2C,OAAO,CAACC,OAAO;IACxBC,KAAK,EAAE9C,MAAM,CAAC+C,KAAK;IACnBC,SAAS,EAAG,QAAO;IACnBnB,YAAY,EAAE;EACf,CAAC;EACDR,OAAO,EAAE;IACR,GAAGpB,KAAK,CAAC2C,OAAO,CAACK,YAAY;IAC7BH,KAAK,EAAE9C,MAAM,CAACkD,SAAS;IACvBF,SAAS,EAAG;EACb,CAAC;EACD1B,eAAe,EAAE;IAChB6B,aAAa,EAAG,QAAO;IACvBb,cAAc,EAAG;EAClB,CAAC;EACDX,MAAM,EAAE;IACPe,YAAY,EAAE,EAAE;IAChBU,WAAW,EAAE,CAAC;IACdC,WAAW,EAAErD,MAAM,CAAC4B;EACrB,CAAC;EACDE,eAAe,EAAE;IAChB,GAAG7B,KAAK,CAAC2C,OAAO,CAACU,OAAO;IACxBN,SAAS,EAAG,QAAO;IACnBF,KAAK,EAAE9C,MAAM,CAACiB,KAAK;IACnBsC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE;EAClB,CAAC;EACDtB,gBAAgB,EAAE;IACjB,GAAGjC,KAAK,CAAC2C,OAAO,CAACU,OAAO;IACxBN,SAAS,EAAG,QAAO;IACnBF,KAAK,EAAE9C,MAAM,CAAC4B,IAAI;IAClB2B,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE;EAClB;AACD,CAAC,CAAC"}
@@ -0,0 +1,75 @@
1
+ import React from "react";
2
+ import { StyleSheet, TouchableOpacity, View } from "react-native";
3
+ import { t } from "../locales/translate";
4
+ import { Testing } from "../types/enum";
5
+ import { colors } from "../utils/Constants";
6
+ import { FONTS } from "./styles/fonts";
7
+ import Text from "./Text";
8
+ /**
9
+ * Render a button for transferring the recommendation to a logbook entry.
10
+ * The button has a visually distinct pressed state to signal to the user that the button was actually activated before returning to the dashboard screen.
11
+ */
12
+ export default class TransferToLogbook extends React.Component {
13
+ /** Initialise the state pressed variable with false */
14
+ state = {
15
+ pressed: false
16
+ };
17
+
18
+ /**
19
+ * Handle what happens when the button is pressed.
20
+ *
21
+ * Steps:
22
+ * 1. Toggle the pressed state to the opposite of its current value.
23
+ * 2. Call the transfer prop callback function.
24
+ */
25
+ handlePress = () => {
26
+ this.setState({
27
+ pressed: !this.state.pressed
28
+ });
29
+ this.props.transfer();
30
+ };
31
+
32
+ /**
33
+ * Steps:
34
+ * 1. If the visible prop is false, display an empty space to keep the correct margins in the screen.
35
+ * 2. Return a JSX element to display a touchable button (that is disabled when the pressed state is true)
36
+ * @returns JSX element for displaying the transfer button
37
+ */
38
+ render() {
39
+ if (!this.props.visible) {
40
+ return;
41
+ }
42
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
43
+ testID: Testing.Id.TransferToLogbookTestIds.TransferButton,
44
+ onPress: this.handlePress,
45
+ disabled: this.state.pressed,
46
+ style: addToLogbookStyles.container
47
+ }, /*#__PURE__*/React.createElement(View, {
48
+ style: addToLogbookStyles.textContainer
49
+ }, /*#__PURE__*/React.createElement(Text, {
50
+ style: addToLogbookStyles.transferText
51
+ }, t(`Transfer to logbook`))));
52
+ }
53
+ }
54
+ const addToLogbookStyles = StyleSheet.create({
55
+ container: {
56
+ minWidth: 230,
57
+ borderRadius: 50,
58
+ backgroundColor: colors.teal,
59
+ marginBottom: 32,
60
+ justifyContent: `center`,
61
+ alignSelf: `center`
62
+ },
63
+ textContainer: {
64
+ flexDirection: `row`,
65
+ justifyContent: `center`
66
+ },
67
+ transferText: {
68
+ ...FONTS.Poppins.bold_Base,
69
+ color: colors.black,
70
+ paddingVertical: 12,
71
+ paddingHorizontal: 16,
72
+ textAlign: `center`
73
+ }
74
+ });
75
+ //# sourceMappingURL=TransferToLogbook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","StyleSheet","TouchableOpacity","View","t","Testing","colors","FONTS","Text","TransferToLogbook","Component","state","pressed","handlePress","setState","props","transfer","render","visible","createElement","testID","Id","TransferToLogbookTestIds","TransferButton","onPress","disabled","style","addToLogbookStyles","container","textContainer","transferText","create","minWidth","borderRadius","backgroundColor","teal","marginBottom","justifyContent","alignSelf","flexDirection","Poppins","bold_Base","color","black","paddingVertical","paddingHorizontal","textAlign"],"sourceRoot":"../../../src","sources":["components/TransferToLogbook.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAEjE,SAASC,CAAC,QAAQ,sBAAsB;AACxC,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,KAAK,QAAQ,gBAAgB;AACtC,OAAOC,IAAI,MAAM,QAAQ;AAczB;AACA;AACA;AACA;AACA,eAAe,MAAMC,iBAAiB,SAAST,KAAK,CAACU,SAAS,CAAiB;EAC9E;EACOC,KAAK,GAAW;IACtBC,OAAO,EAAE;EACV,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;EACQC,WAAW,GAAGA,CAAA,KAAY;IAChC,IAAI,CAACC,QAAQ,CAAC;MACbF,OAAO,EAAE,CAAC,IAAI,CAACD,KAAK,CAACC;IACtB,CAAC,CAAC;IACF,IAAI,CAACG,KAAK,CAACC,QAAQ,EAAE;EACtB,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;EACQC,MAAMA,CAAA,EAAG;IACf,IAAI,CAAC,IAAI,CAACF,KAAK,CAACG,OAAO,EAAE;MACxB;IACD;IAEA,oBACClB,KAAA,CAAAmB,aAAA,CAACjB,gBAAgB;MAChBkB,MAAM,EAAEf,OAAO,CAACgB,EAAE,CAACC,wBAAwB,CAACC,cAAe;MAC3DC,OAAO,EAAE,IAAI,CAACX,WAAY;MAC1BY,QAAQ,EAAE,IAAI,CAACd,KAAK,CAACC,OAAQ;MAC7Bc,KAAK,EAAEC,kBAAkB,CAACC;IAAU,gBAEpC5B,KAAA,CAAAmB,aAAA,CAAChB,IAAI;MAACuB,KAAK,EAAEC,kBAAkB,CAACE;IAAc,gBAC7C7B,KAAA,CAAAmB,aAAA,CAACX,IAAI;MAACkB,KAAK,EAAEC,kBAAkB,CAACG;IAAa,GAAE1B,CAAC,CAAE,qBAAoB,CAAC,CAAQ,CACzE,CACW;EAErB;AACD;AAEA,MAAMuB,kBAAkB,GAAG1B,UAAU,CAAC8B,MAAM,CAAC;EAC5CH,SAAS,EAAE;IACVI,QAAQ,EAAE,GAAG;IACbC,YAAY,EAAE,EAAE;IAChBC,eAAe,EAAE5B,MAAM,CAAC6B,IAAI;IAC5BC,YAAY,EAAE,EAAE;IAChBC,cAAc,EAAG,QAAO;IACxBC,SAAS,EAAG;EACb,CAAC;EACDT,aAAa,EAAE;IACdU,aAAa,EAAG,KAAI;IACpBF,cAAc,EAAG;EAClB,CAAC;EACDP,YAAY,EAAE;IACb,GAAGvB,KAAK,CAACiC,OAAO,CAACC,SAAS;IAC1BC,KAAK,EAAEpC,MAAM,CAACqC,KAAK;IACnBC,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE,EAAE;IACrBC,SAAS,EAAG;EACb;AACD,CAAC,CAAC"}
@@ -0,0 +1,104 @@
1
+ import React from "react";
2
+ import { StyleSheet, View } from "react-native";
3
+ import { t } from "../../locales/translate";
4
+ import { Testing } from "../../types/enum";
5
+ import { colors } from "../../utils/Constants";
6
+ import { infoStyles } from "../InfoBars";
7
+ import { FONTS } from "../styles/fonts";
8
+ import Text from "../Text";
9
+ import ActivityIcon from "./ActivityIcon";
10
+ import ActivityIntensity from "./ActivityIntensity";
11
+ /**
12
+ * Component for displaying a summary of the entered physical activity along with the effect it has on the insulin recommendation.
13
+ */
14
+ export default class Activity extends React.Component {
15
+ /**
16
+ * Steps:
17
+ * 1. Unpack activity, activityType, activityReduction, and activityTitle from props.
18
+ * 2. Compute the reductionPercentage by multiplying the activityReduction prop by 100 and rounding to the nearest integer.
19
+ * 3. Generate and return the JSX element to display the following on the screen:
20
+ * - Print the activity duration.
21
+ * - Display the ActivityIcon that corresponds to the type of activity.
22
+ * - Display the ActivityIntensity for the activity.
23
+ * - Print the reductionPercentage.
24
+ * @returns JSX Element containing all the user's physical activity details
25
+ */
26
+ render() {
27
+ const {
28
+ activity,
29
+ activityType,
30
+ activityReduction,
31
+ activityTitle
32
+ } = this.props;
33
+ const reductionPercentage = ((activityReduction ?? 0) * 100).toFixed(0);
34
+ return /*#__PURE__*/React.createElement(View, {
35
+ style: styles.container
36
+ }, /*#__PURE__*/React.createElement(View, {
37
+ style: styles.activityTextContainer
38
+ }, /*#__PURE__*/React.createElement(View, {
39
+ style: infoStyles.labelContainer
40
+ }, /*#__PURE__*/React.createElement(Text, {
41
+ style: styles.label
42
+ }, t(`Activity`))), /*#__PURE__*/React.createElement(View, {
43
+ style: infoStyles.valueUnitContainer
44
+ }, /*#__PURE__*/React.createElement(Text, {
45
+ style: infoStyles.value,
46
+ testID: Testing.Id.ActivityTestIds.ActivityDuration
47
+ }, activity.activityDuration), /*#__PURE__*/React.createElement(Text, {
48
+ style: infoStyles.units
49
+ }, t(`min`)))), /*#__PURE__*/React.createElement(ActivityIcon, {
50
+ activityType: activityType,
51
+ activityTitle: activityTitle
52
+ }), /*#__PURE__*/React.createElement(ActivityIntensity, {
53
+ activityIntensity: activity.activityIntensity
54
+ }), /*#__PURE__*/React.createElement(Text, {
55
+ style: styles.infoText
56
+ }, t(`Based on the selected activity your insulin recommendation is reduced by:`)), /*#__PURE__*/React.createElement(View, {
57
+ style: styles.reductionContainer
58
+ }, /*#__PURE__*/React.createElement(Text, {
59
+ style: styles.reductionPercentage,
60
+ testID: Testing.Id.ActivityTestIds.ActivityReduction
61
+ }, reductionPercentage), /*#__PURE__*/React.createElement(Text, {
62
+ style: styles.percentage
63
+ }, `%`)));
64
+ }
65
+ }
66
+ const styles = StyleSheet.create({
67
+ container: {
68
+ flex: 1,
69
+ marginTop: 8,
70
+ padding: 16,
71
+ borderWidth: 1,
72
+ borderColor: colors.dustyDarkBlue,
73
+ borderRadius: 5
74
+ },
75
+ activityTextContainer: {
76
+ flex: 1,
77
+ flexDirection: `row`,
78
+ marginBottom: 6,
79
+ alignItems: `center`
80
+ },
81
+ infoText: {
82
+ ...FONTS.Poppins.regular_Base,
83
+ color: colors.lightBlue,
84
+ marginBottom: 4
85
+ },
86
+ reductionContainer: {
87
+ flexDirection: `row`,
88
+ alignItems: `baseline`
89
+ },
90
+ reductionPercentage: {
91
+ ...FONTS.Poppins.medium_2XL,
92
+ color: colors.white
93
+ },
94
+ percentage: {
95
+ ...FONTS.Poppins.regular_XS,
96
+ color: colors.white,
97
+ marginLeft: 4
98
+ },
99
+ label: {
100
+ ...FONTS.Poppins.regular_Base,
101
+ color: colors.white
102
+ }
103
+ });
104
+ //# sourceMappingURL=Activity.js.map