@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.
- package/lib/commonjs/RecommendationScreen.js +768 -0
- package/lib/commonjs/RecommendationScreen.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/Close.js +20 -0
- package/lib/commonjs/assets/IconsSVG/Close.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/CloseOutlined.js +28 -0
- package/lib/commonjs/assets/IconsSVG/CloseOutlined.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/Edit.js +23 -0
- package/lib/commonjs/assets/IconsSVG/Edit.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/activity/Cycling.js +43 -0
- package/lib/commonjs/assets/IconsSVG/activity/Cycling.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/activity/Running.js +33 -0
- package/lib/commonjs/assets/IconsSVG/activity/Running.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/activity/Stretching.js +33 -0
- package/lib/commonjs/assets/IconsSVG/activity/Stretching.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/activity/Swimming.js +48 -0
- package/lib/commonjs/assets/IconsSVG/activity/Swimming.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/activity/Walking.js +38 -0
- package/lib/commonjs/assets/IconsSVG/activity/Walking.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/mood/Happy.js +34 -0
- package/lib/commonjs/assets/IconsSVG/mood/Happy.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/mood/Neutral.js +34 -0
- package/lib/commonjs/assets/IconsSVG/mood/Neutral.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/mood/Sad.js +34 -0
- package/lib/commonjs/assets/IconsSVG/mood/Sad.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js +34 -0
- package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js.map +1 -0
- package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js +34 -0
- package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js.map +1 -0
- package/lib/commonjs/components/ExitModal.js +124 -0
- package/lib/commonjs/components/ExitModal.js.map +1 -0
- package/lib/commonjs/components/InfoBars.js +123 -0
- package/lib/commonjs/components/InfoBars.js.map +1 -0
- package/lib/commonjs/components/InvisibleNumberInput.js +150 -0
- package/lib/commonjs/components/InvisibleNumberInput.js.map +1 -0
- package/lib/commonjs/components/LineSeparator.js +27 -0
- package/lib/commonjs/components/LineSeparator.js.map +1 -0
- package/lib/commonjs/components/RecentInsulin.js +105 -0
- package/lib/commonjs/components/RecentInsulin.js.map +1 -0
- package/lib/commonjs/components/RecommendationModal.js +302 -0
- package/lib/commonjs/components/RecommendationModal.js.map +1 -0
- package/lib/commonjs/components/RecommendedCarbs.js +289 -0
- package/lib/commonjs/components/RecommendedCarbs.js.map +1 -0
- package/lib/commonjs/components/RecommendedInsulin.js +208 -0
- package/lib/commonjs/components/RecommendedInsulin.js.map +1 -0
- package/lib/commonjs/components/Remeasure.js +131 -0
- package/lib/commonjs/components/Remeasure.js.map +1 -0
- package/lib/commonjs/components/Text.js +25 -0
- package/lib/commonjs/components/Text.js.map +1 -0
- package/lib/commonjs/components/TimeoutModal.js +113 -0
- package/lib/commonjs/components/TimeoutModal.js.map +1 -0
- package/lib/commonjs/components/TransferToLogbook.js +83 -0
- package/lib/commonjs/components/TransferToLogbook.js.map +1 -0
- package/lib/commonjs/components/activity/Activity.js +112 -0
- package/lib/commonjs/components/activity/Activity.js.map +1 -0
- package/lib/commonjs/components/activity/ActivityIcon.js +86 -0
- package/lib/commonjs/components/activity/ActivityIcon.js.map +1 -0
- package/lib/commonjs/components/activity/ActivityIntensity.js +65 -0
- package/lib/commonjs/components/activity/ActivityIntensity.js.map +1 -0
- package/lib/commonjs/components/mood/Emotion.js +86 -0
- package/lib/commonjs/components/mood/Emotion.js.map +1 -0
- package/lib/commonjs/components/mood/MoodIcon.js +107 -0
- package/lib/commonjs/components/mood/MoodIcon.js.map +1 -0
- package/lib/commonjs/components/styles/fonts.js +154 -0
- package/lib/commonjs/components/styles/fonts.js.map +1 -0
- package/lib/commonjs/index.js +21 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/locales/da/translations.json +82 -0
- package/lib/commonjs/locales/de/translations.json +81 -0
- package/lib/commonjs/locales/en/translations.json +84 -0
- package/lib/commonjs/locales/es/translations.json +81 -0
- package/lib/commonjs/locales/fr/translations.json +81 -0
- package/lib/commonjs/locales/it/translations.json +81 -0
- package/lib/commonjs/locales/translate.js +63 -0
- package/lib/commonjs/locales/translate.js.map +1 -0
- package/lib/commonjs/types/enum.js +179 -0
- package/lib/commonjs/types/enum.js.map +1 -0
- package/lib/commonjs/types/types.js +6 -0
- package/lib/commonjs/types/types.js.map +1 -0
- package/lib/commonjs/utils/AttentionMessages.js +141 -0
- package/lib/commonjs/utils/AttentionMessages.js.map +1 -0
- package/lib/commonjs/utils/Constants.js +138 -0
- package/lib/commonjs/utils/Constants.js.map +1 -0
- package/lib/commonjs/utils/RecommendationError.js +116 -0
- package/lib/commonjs/utils/RecommendationError.js.map +1 -0
- package/lib/commonjs/utils/RecommendationUtils.js +212 -0
- package/lib/commonjs/utils/RecommendationUtils.js.map +1 -0
- package/lib/commonjs/utils/Translations.js +22 -0
- package/lib/commonjs/utils/Translations.js.map +1 -0
- package/lib/commonjs/utils/Utils.js +162 -0
- package/lib/commonjs/utils/Utils.js.map +1 -0
- package/lib/commonjs/utils/Validations.js +468 -0
- package/lib/commonjs/utils/Validations.js.map +1 -0
- package/lib/module/RecommendationScreen.js +758 -0
- package/lib/module/RecommendationScreen.js.map +1 -0
- package/lib/module/assets/IconsSVG/Close.js +11 -0
- package/lib/module/assets/IconsSVG/Close.js.map +1 -0
- package/lib/module/assets/IconsSVG/CloseOutlined.js +19 -0
- package/lib/module/assets/IconsSVG/CloseOutlined.js.map +1 -0
- package/lib/module/assets/IconsSVG/Edit.js +14 -0
- package/lib/module/assets/IconsSVG/Edit.js.map +1 -0
- package/lib/module/assets/IconsSVG/activity/Cycling.js +34 -0
- package/lib/module/assets/IconsSVG/activity/Cycling.js.map +1 -0
- package/lib/module/assets/IconsSVG/activity/Running.js +24 -0
- package/lib/module/assets/IconsSVG/activity/Running.js.map +1 -0
- package/lib/module/assets/IconsSVG/activity/Stretching.js +24 -0
- package/lib/module/assets/IconsSVG/activity/Stretching.js.map +1 -0
- package/lib/module/assets/IconsSVG/activity/Swimming.js +39 -0
- package/lib/module/assets/IconsSVG/activity/Swimming.js.map +1 -0
- package/lib/module/assets/IconsSVG/activity/Walking.js +29 -0
- package/lib/module/assets/IconsSVG/activity/Walking.js.map +1 -0
- package/lib/module/assets/IconsSVG/mood/Happy.js +25 -0
- package/lib/module/assets/IconsSVG/mood/Happy.js.map +1 -0
- package/lib/module/assets/IconsSVG/mood/Neutral.js +25 -0
- package/lib/module/assets/IconsSVG/mood/Neutral.js.map +1 -0
- package/lib/module/assets/IconsSVG/mood/Sad.js +25 -0
- package/lib/module/assets/IconsSVG/mood/Sad.js.map +1 -0
- package/lib/module/assets/IconsSVG/mood/SemiHappy.js +25 -0
- package/lib/module/assets/IconsSVG/mood/SemiHappy.js.map +1 -0
- package/lib/module/assets/IconsSVG/mood/SemiSad.js +25 -0
- package/lib/module/assets/IconsSVG/mood/SemiSad.js.map +1 -0
- package/lib/module/components/ExitModal.js +114 -0
- package/lib/module/components/ExitModal.js.map +1 -0
- package/lib/module/components/InfoBars.js +114 -0
- package/lib/module/components/InfoBars.js.map +1 -0
- package/lib/module/components/InvisibleNumberInput.js +142 -0
- package/lib/module/components/InvisibleNumberInput.js.map +1 -0
- package/lib/module/components/LineSeparator.js +19 -0
- package/lib/module/components/LineSeparator.js.map +1 -0
- package/lib/module/components/RecentInsulin.js +97 -0
- package/lib/module/components/RecentInsulin.js.map +1 -0
- package/lib/module/components/RecommendationModal.js +291 -0
- package/lib/module/components/RecommendationModal.js.map +1 -0
- package/lib/module/components/RecommendedCarbs.js +281 -0
- package/lib/module/components/RecommendedCarbs.js.map +1 -0
- package/lib/module/components/RecommendedInsulin.js +200 -0
- package/lib/module/components/RecommendedInsulin.js.map +1 -0
- package/lib/module/components/Remeasure.js +123 -0
- package/lib/module/components/Remeasure.js.map +1 -0
- package/lib/module/components/Text.js +16 -0
- package/lib/module/components/Text.js.map +1 -0
- package/lib/module/components/TimeoutModal.js +103 -0
- package/lib/module/components/TimeoutModal.js.map +1 -0
- package/lib/module/components/TransferToLogbook.js +75 -0
- package/lib/module/components/TransferToLogbook.js.map +1 -0
- package/lib/module/components/activity/Activity.js +104 -0
- package/lib/module/components/activity/Activity.js.map +1 -0
- package/lib/module/components/activity/ActivityIcon.js +78 -0
- package/lib/module/components/activity/ActivityIcon.js.map +1 -0
- package/lib/module/components/activity/ActivityIntensity.js +57 -0
- package/lib/module/components/activity/ActivityIntensity.js.map +1 -0
- package/lib/module/components/mood/Emotion.js +78 -0
- package/lib/module/components/mood/Emotion.js.map +1 -0
- package/lib/module/components/mood/MoodIcon.js +97 -0
- package/lib/module/components/mood/MoodIcon.js.map +1 -0
- package/lib/module/components/styles/fonts.js +145 -0
- package/lib/module/components/styles/fonts.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/locales/da/translations.json +82 -0
- package/lib/module/locales/de/translations.json +81 -0
- package/lib/module/locales/en/translations.json +84 -0
- package/lib/module/locales/es/translations.json +81 -0
- package/lib/module/locales/fr/translations.json +81 -0
- package/lib/module/locales/it/translations.json +81 -0
- package/lib/module/locales/translate.js +55 -0
- package/lib/module/locales/translate.js.map +1 -0
- package/lib/module/types/enum.js +170 -0
- package/lib/module/types/enum.js.map +1 -0
- package/lib/module/types/types.js.map +1 -0
- package/lib/module/utils/AttentionMessages.js +131 -0
- package/lib/module/utils/AttentionMessages.js.map +1 -0
- package/{dist/src → lib/module}/utils/Constants.js +78 -35
- package/lib/module/utils/Constants.js.map +1 -0
- package/{dist/src → lib/module}/utils/RecommendationError.js +28 -6
- package/lib/module/utils/RecommendationError.js.map +1 -0
- package/{dist/src → lib/module}/utils/RecommendationUtils.js +89 -90
- package/lib/module/utils/RecommendationUtils.js.map +1 -0
- package/{dist/src → lib/module}/utils/Translations.js +5 -3
- package/lib/module/utils/Translations.js.map +1 -0
- package/lib/module/utils/Utils.js +155 -0
- package/lib/module/utils/Utils.js.map +1 -0
- package/{dist/src → lib/module}/utils/Validations.js +155 -128
- package/lib/module/utils/Validations.js.map +1 -0
- package/{dist/src → lib/typescript}/RecommendationScreen.d.ts +2 -1
- package/lib/typescript/RecommendationScreen.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/Close.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/Close.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/CloseOutlined.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/CloseOutlined.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/Edit.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/Edit.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Cycling.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/activity/Cycling.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Running.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/activity/Running.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Stretching.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/activity/Stretching.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Swimming.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/activity/Swimming.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/activity/Walking.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/activity/Walking.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/mood/Happy.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/mood/Happy.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/mood/Neutral.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/mood/Neutral.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/mood/Sad.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/mood/Sad.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/mood/SemiHappy.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/mood/SemiHappy.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/assets/IconsSVG/mood/SemiSad.d.ts +1 -0
- package/lib/typescript/assets/IconsSVG/mood/SemiSad.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/ExitModal.d.ts +1 -0
- package/lib/typescript/components/ExitModal.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/InfoBars.d.ts +1 -0
- package/lib/typescript/components/InfoBars.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/InvisibleNumberInput.d.ts +1 -0
- package/lib/typescript/components/InvisibleNumberInput.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/LineSeparator.d.ts +1 -0
- package/lib/typescript/components/LineSeparator.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/RecentInsulin.d.ts +1 -0
- package/lib/typescript/components/RecentInsulin.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/RecommendationModal.d.ts +1 -0
- package/lib/typescript/components/RecommendationModal.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/RecommendedCarbs.d.ts +1 -0
- package/lib/typescript/components/RecommendedCarbs.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/RecommendedInsulin.d.ts +1 -0
- package/lib/typescript/components/RecommendedInsulin.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/Remeasure.d.ts +1 -0
- package/lib/typescript/components/Remeasure.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/Text.d.ts +1 -0
- package/lib/typescript/components/Text.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/TimeoutModal.d.ts +1 -0
- package/lib/typescript/components/TimeoutModal.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/TransferToLogbook.d.ts +1 -0
- package/lib/typescript/components/TransferToLogbook.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/activity/Activity.d.ts +1 -0
- package/lib/typescript/components/activity/Activity.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/activity/ActivityIcon.d.ts +1 -0
- package/lib/typescript/components/activity/ActivityIcon.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/activity/ActivityIntensity.d.ts +1 -0
- package/lib/typescript/components/activity/ActivityIntensity.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/mood/Emotion.d.ts +1 -0
- package/lib/typescript/components/mood/Emotion.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/mood/MoodIcon.d.ts +1 -0
- package/lib/typescript/components/mood/MoodIcon.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/components/styles/fonts.d.ts +1 -0
- package/lib/typescript/components/styles/fonts.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/locales/translate.d.ts +1 -0
- package/lib/typescript/locales/translate.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/types/enum.d.ts +1 -0
- package/lib/typescript/types/enum.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/types/types.d.ts +1 -0
- package/lib/typescript/types/types.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/AttentionMessages.d.ts +1 -0
- package/lib/typescript/utils/AttentionMessages.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/Constants.d.ts +1 -0
- package/lib/typescript/utils/Constants.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/RecommendationError.d.ts +1 -0
- package/lib/typescript/utils/RecommendationError.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/RecommendationUtils.d.ts +1 -0
- package/lib/typescript/utils/RecommendationUtils.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/Translations.d.ts +1 -0
- package/lib/typescript/utils/Translations.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/Utils.d.ts +1 -0
- package/lib/typescript/utils/Utils.d.ts.map +1 -0
- package/{dist/src → lib/typescript}/utils/Validations.d.ts +1 -0
- package/lib/typescript/utils/Validations.d.ts.map +1 -0
- package/package.json +27 -7
- package/src/RecommendationScreen.tsx +854 -0
- package/src/assets/IconsSVG/Close.tsx +13 -0
- package/src/assets/IconsSVG/CloseOutlined.tsx +23 -0
- package/src/assets/IconsSVG/Edit.tsx +16 -0
- package/src/assets/IconsSVG/activity/Cycling.tsx +41 -0
- package/src/assets/IconsSVG/activity/Running.tsx +29 -0
- package/src/assets/IconsSVG/activity/Stretching.tsx +29 -0
- package/src/assets/IconsSVG/activity/Swimming.tsx +47 -0
- package/src/assets/IconsSVG/activity/Walking.tsx +35 -0
- package/src/assets/IconsSVG/mood/Happy.tsx +30 -0
- package/src/assets/IconsSVG/mood/Neutral.tsx +30 -0
- package/src/assets/IconsSVG/mood/Sad.tsx +30 -0
- package/src/assets/IconsSVG/mood/SemiHappy.tsx +30 -0
- package/src/assets/IconsSVG/mood/SemiSad.tsx +30 -0
- package/src/components/ExitModal.tsx +134 -0
- package/src/components/InfoBars.tsx +122 -0
- package/src/components/InvisibleNumberInput.tsx +170 -0
- package/src/components/LineSeparator.tsx +29 -0
- package/src/components/RecentInsulin.tsx +109 -0
- package/src/components/RecommendationModal.tsx +319 -0
- package/src/components/RecommendedCarbs.tsx +303 -0
- package/src/components/RecommendedInsulin.tsx +219 -0
- package/src/components/Remeasure.tsx +135 -0
- package/src/components/Text.tsx +27 -0
- package/src/components/TimeoutModal.tsx +121 -0
- package/src/components/TransferToLogbook.tsx +92 -0
- package/src/components/activity/Activity.tsx +107 -0
- package/src/components/activity/ActivityIcon.tsx +77 -0
- package/src/components/activity/ActivityIntensity.tsx +67 -0
- package/src/components/mood/Emotion.tsx +97 -0
- package/src/components/mood/MoodIcon.tsx +91 -0
- package/src/components/styles/fonts.ts +145 -0
- package/src/index.ts +5 -0
- package/src/locales/da/translations.json +82 -0
- package/src/locales/de/translations.json +81 -0
- package/src/locales/en/translations.json +84 -0
- package/src/locales/es/translations.json +81 -0
- package/src/locales/fr/translations.json +81 -0
- package/src/locales/it/translations.json +81 -0
- package/src/locales/translate.ts +62 -0
- package/src/types/enum.ts +164 -0
- package/src/types/types.ts +19 -0
- package/src/utils/AttentionMessages.ts +167 -0
- package/src/utils/Constants.ts +77 -0
- package/src/utils/RecommendationError.ts +182 -0
- package/src/utils/RecommendationUtils.ts +232 -0
- package/src/utils/Translations.ts +17 -0
- package/src/utils/Utils.ts +156 -0
- package/src/utils/Validations.ts +490 -0
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -6
- package/dist/index.js.map +0 -1
- package/dist/src/RecommendationScreen.js +0 -537
- package/dist/src/RecommendationScreen.js.map +0 -1
- package/dist/src/assets/IconsSVG/Close.js +0 -7
- package/dist/src/assets/IconsSVG/Close.js.map +0 -1
- package/dist/src/assets/IconsSVG/CloseOutlined.js +0 -9
- package/dist/src/assets/IconsSVG/CloseOutlined.js.map +0 -1
- package/dist/src/assets/IconsSVG/Edit.js +0 -8
- package/dist/src/assets/IconsSVG/Edit.js.map +0 -1
- package/dist/src/assets/IconsSVG/activity/Cycling.js +0 -12
- package/dist/src/assets/IconsSVG/activity/Cycling.js.map +0 -1
- package/dist/src/assets/IconsSVG/activity/Running.js +0 -10
- package/dist/src/assets/IconsSVG/activity/Running.js.map +0 -1
- package/dist/src/assets/IconsSVG/activity/Stretching.js +0 -10
- package/dist/src/assets/IconsSVG/activity/Stretching.js.map +0 -1
- package/dist/src/assets/IconsSVG/activity/Swimming.js +0 -13
- package/dist/src/assets/IconsSVG/activity/Swimming.js.map +0 -1
- package/dist/src/assets/IconsSVG/activity/Walking.js +0 -11
- package/dist/src/assets/IconsSVG/activity/Walking.js.map +0 -1
- package/dist/src/assets/IconsSVG/mood/Happy.js +0 -11
- package/dist/src/assets/IconsSVG/mood/Happy.js.map +0 -1
- package/dist/src/assets/IconsSVG/mood/Neutral.js +0 -11
- package/dist/src/assets/IconsSVG/mood/Neutral.js.map +0 -1
- package/dist/src/assets/IconsSVG/mood/Sad.js +0 -11
- package/dist/src/assets/IconsSVG/mood/Sad.js.map +0 -1
- package/dist/src/assets/IconsSVG/mood/SemiHappy.js +0 -11
- package/dist/src/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
- package/dist/src/assets/IconsSVG/mood/SemiSad.js +0 -11
- package/dist/src/assets/IconsSVG/mood/SemiSad.js.map +0 -1
- package/dist/src/components/ExitModal.js +0 -91
- package/dist/src/components/ExitModal.js.map +0 -1
- package/dist/src/components/InfoBars.js +0 -98
- package/dist/src/components/InfoBars.js.map +0 -1
- package/dist/src/components/InvisibleNumberInput.js +0 -123
- package/dist/src/components/InvisibleNumberInput.js.map +0 -1
- package/dist/src/components/LineSeparator.js +0 -17
- package/dist/src/components/LineSeparator.js.map +0 -1
- package/dist/src/components/RecentInsulin.js +0 -90
- package/dist/src/components/RecentInsulin.js.map +0 -1
- package/dist/src/components/RecommendationModal.js +0 -241
- package/dist/src/components/RecommendationModal.js.map +0 -1
- package/dist/src/components/RecommendedCarbs.js +0 -234
- package/dist/src/components/RecommendedCarbs.js.map +0 -1
- package/dist/src/components/RecommendedInsulin.js +0 -166
- package/dist/src/components/RecommendedInsulin.js.map +0 -1
- package/dist/src/components/Remeasure.js +0 -103
- package/dist/src/components/Remeasure.js.map +0 -1
- package/dist/src/components/Text.js +0 -14
- package/dist/src/components/Text.js.map +0 -1
- package/dist/src/components/TimeoutModal.js +0 -84
- package/dist/src/components/TimeoutModal.js.map +0 -1
- package/dist/src/components/TransferToLogbook.js +0 -68
- package/dist/src/components/TransferToLogbook.js.map +0 -1
- package/dist/src/components/activity/Activity.js +0 -93
- package/dist/src/components/activity/Activity.js.map +0 -1
- package/dist/src/components/activity/ActivityIcon.js +0 -66
- package/dist/src/components/activity/ActivityIcon.js.map +0 -1
- package/dist/src/components/activity/ActivityIntensity.js +0 -55
- package/dist/src/components/activity/ActivityIntensity.js.map +0 -1
- package/dist/src/components/mood/Emotion.js +0 -69
- package/dist/src/components/mood/Emotion.js.map +0 -1
- package/dist/src/components/mood/MoodIcon.js +0 -68
- package/dist/src/components/mood/MoodIcon.js.map +0 -1
- package/dist/src/components/styles/fonts.js +0 -145
- package/dist/src/components/styles/fonts.js.map +0 -1
- package/dist/src/locales/da/translations.json +0 -82
- package/dist/src/locales/de/translations.json +0 -81
- package/dist/src/locales/en/translations.json +0 -84
- package/dist/src/locales/es/translations.json +0 -81
- package/dist/src/locales/fr/translations.json +0 -81
- package/dist/src/locales/it/translations.json +0 -81
- package/dist/src/locales/translate.js +0 -53
- package/dist/src/locales/translate.js.map +0 -1
- package/dist/src/types/enum.js +0 -154
- package/dist/src/types/enum.js.map +0 -1
- package/dist/src/types/types.js.map +0 -1
- package/dist/src/utils/AttentionMessages.js +0 -123
- package/dist/src/utils/AttentionMessages.js.map +0 -1
- package/dist/src/utils/Constants.js.map +0 -1
- package/dist/src/utils/RecommendationError.js.map +0 -1
- package/dist/src/utils/RecommendationUtils.js.map +0 -1
- package/dist/src/utils/Translations.js.map +0 -1
- package/dist/src/utils/Utils.js +0 -142
- package/dist/src/utils/Utils.js.map +0 -1
- package/dist/src/utils/Validations.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/{dist/src → lib/module}/types/types.js +0 -0
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* Helper functions for processing and categorising user inputs for determining which warnings and messages to display.
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
import moment from "moment";
|
|
6
7
|
import { BgLevel, RecommendationReminders } from "../types/enum";
|
|
7
8
|
import { addPostponeActivityMessageUnder5MMOL, AttentionMessage, Messages } from "./AttentionMessages";
|
|
8
9
|
import { SEVERE_HYPERGLYCEMIA_START_MMOL } from "./Constants";
|
|
9
10
|
import { CurrentBGLError } from "./RecommendationError";
|
|
10
11
|
import { Utils } from "./Utils";
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* Determine the category of the blood glucose level based on the numerical value of the BGL itself and potentially the most recent previously entered BGL.
|
|
13
15
|
*
|
|
@@ -26,37 +28,36 @@ import { Utils } from "./Utils";
|
|
|
26
28
|
* @returns Indication of the category that the blood glucose level belongs to {@link BgLevel}.
|
|
27
29
|
*/
|
|
28
30
|
export function getBGLevel(currentBGL, latestLogbookFrom6Hours) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
return BgLevel.UnsupportedBGLevel;
|
|
31
|
+
if (currentBGL === null) {
|
|
32
|
+
return BgLevel.BGLevelNotProvided;
|
|
33
|
+
}
|
|
34
|
+
if (currentBGL >= 1.1 && currentBGL <= 2) {
|
|
35
|
+
return BgLevel.SevereHypoglycemia;
|
|
36
|
+
}
|
|
37
|
+
if (currentBGL > 2 && currentBGL <= 3.5) {
|
|
38
|
+
return BgLevel.Hypoglycemia;
|
|
39
|
+
}
|
|
40
|
+
if (currentBGL > 3.5 && currentBGL <= 4) {
|
|
41
|
+
return BgLevel.MildHypoglycemia;
|
|
42
|
+
}
|
|
43
|
+
if (currentBGL > 4 && currentBGL < 5) {
|
|
44
|
+
return BgLevel.NormoglycemiaUnder5MMOL;
|
|
45
|
+
}
|
|
46
|
+
if (currentBGL >= 5 && currentBGL <= 7) {
|
|
47
|
+
return BgLevel.Normoglycemia;
|
|
48
|
+
}
|
|
49
|
+
if (currentBGL > 7 && currentBGL < 15) {
|
|
50
|
+
return BgLevel.MildHyperglycemia;
|
|
51
|
+
}
|
|
52
|
+
if (currentBGL > 15 && currentBGL <= 33.3 && latestLogbookFrom6Hours ? isSevereHyperglycemia(latestLogbookFrom6Hours) : false) {
|
|
53
|
+
return BgLevel.SevereHyperglycemia;
|
|
54
|
+
}
|
|
55
|
+
if (currentBGL >= 15 && currentBGL <= 33.3) {
|
|
56
|
+
return BgLevel.Hyperglycemia;
|
|
57
|
+
}
|
|
58
|
+
return BgLevel.UnsupportedBGLevel;
|
|
59
59
|
}
|
|
60
|
+
|
|
60
61
|
/**
|
|
61
62
|
* Calculate the initial value for the calibration reminder time slider.
|
|
62
63
|
*
|
|
@@ -76,26 +77,25 @@ export function getBGLevel(currentBGL, latestLogbookFrom6Hours) {
|
|
|
76
77
|
* @returns The initial value of the remeasurement reminder timer slider in hours {@link RecommendationReminders}.
|
|
77
78
|
*/
|
|
78
79
|
export function getReminder(bgLevel, carbohydrates, userReminder, activity) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
throw CurrentBGLError();
|
|
97
|
-
}
|
|
80
|
+
const reminder = userReminder === undefined ? RecommendationReminders.HediaReminderDefault : userReminder;
|
|
81
|
+
switch (bgLevel) {
|
|
82
|
+
case BgLevel.SevereHypoglycemia:
|
|
83
|
+
case BgLevel.Hypoglycemia:
|
|
84
|
+
case BgLevel.MildHypoglycemia:
|
|
85
|
+
return RecommendationReminders.Reminder15Minutes;
|
|
86
|
+
case BgLevel.NormoglycemiaUnder5MMOL:
|
|
87
|
+
case BgLevel.Normoglycemia:
|
|
88
|
+
case BgLevel.MildHyperglycemia:
|
|
89
|
+
case BgLevel.BGLevelNotProvided:
|
|
90
|
+
return carbohydrates || activity ? reminder : RecommendationReminders.ReminderOff;
|
|
91
|
+
case BgLevel.Hyperglycemia:
|
|
92
|
+
case BgLevel.SevereHyperglycemia:
|
|
93
|
+
return isActivityWithin15Minutes(activity) ? RecommendationReminders.Reminder15Minutes : RecommendationReminders.Reminder60Minutes;
|
|
94
|
+
default:
|
|
95
|
+
throw CurrentBGLError();
|
|
96
|
+
}
|
|
98
97
|
}
|
|
98
|
+
|
|
99
99
|
/**
|
|
100
100
|
* Get the attention message that fits with the user’s entered blood glucose level and activity.
|
|
101
101
|
*
|
|
@@ -121,34 +121,33 @@ export function getReminder(bgLevel, carbohydrates, userReminder, activity) {
|
|
|
121
121
|
* @returns The appropriate attention message {@link AttentionMessage} to display to the user or null if there is no message to be displayed.
|
|
122
122
|
*/
|
|
123
123
|
export function getAttentionMessage(bgLevel, activity) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
throw CurrentBGLError();
|
|
150
|
-
}
|
|
124
|
+
const key = Utils.getKeyFromValue(BgLevel, bgLevel);
|
|
125
|
+
const isAttentionMessageNull = AttentionMessage[key] === null;
|
|
126
|
+
const isWithin15Minutes = isActivityWithin15Minutes(activity);
|
|
127
|
+
switch (bgLevel) {
|
|
128
|
+
case BgLevel.BGLevelNotProvided:
|
|
129
|
+
case BgLevel.Normoglycemia:
|
|
130
|
+
case BgLevel.MildHyperglycemia:
|
|
131
|
+
return null;
|
|
132
|
+
case BgLevel.NormoglycemiaUnder5MMOL:
|
|
133
|
+
return isWithin15Minutes ? AttentionMessage.NormoglycemiaActivityUnder5MMOL() : null;
|
|
134
|
+
case BgLevel.SevereHypoglycemia:
|
|
135
|
+
case BgLevel.Hypoglycemia:
|
|
136
|
+
case BgLevel.MildHypoglycemia:
|
|
137
|
+
return isWithin15Minutes && !isAttentionMessageNull ?
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
139
|
+
addPostponeActivityMessageUnder5MMOL(AttentionMessage[key]()) :
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
141
|
+
AttentionMessage[key]();
|
|
142
|
+
case BgLevel.Hyperglycemia:
|
|
143
|
+
return isWithin15Minutes ? AttentionMessage.HyperglycemiaActivity() : null;
|
|
144
|
+
case BgLevel.SevereHyperglycemia:
|
|
145
|
+
return isWithin15Minutes ? AttentionMessage.SevereHyperglycemiaActivity() : AttentionMessage.SevereHyperglycemia();
|
|
146
|
+
default:
|
|
147
|
+
throw CurrentBGLError();
|
|
148
|
+
}
|
|
151
149
|
}
|
|
150
|
+
|
|
152
151
|
/**
|
|
153
152
|
* Determine based on on the previously measured BGL if the hyperglycemia should be categorized as severe.
|
|
154
153
|
*
|
|
@@ -159,14 +158,17 @@ export function getAttentionMessage(bgLevel, activity) {
|
|
|
159
158
|
* @returns True if the BGL from the previous logbook entry is above the threshold for severe hyperglycemia. False otherwise.
|
|
160
159
|
*/
|
|
161
160
|
export function isSevereHyperglycemia(logbook) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
if (logbook !== null && logbook !== undefined) {
|
|
162
|
+
const {
|
|
163
|
+
blood_glucose_millimolar
|
|
164
|
+
} = logbook;
|
|
165
|
+
if (blood_glucose_millimolar !== null) {
|
|
166
|
+
return blood_glucose_millimolar > SEVERE_HYPERGLYCEMIA_START_MMOL;
|
|
167
167
|
}
|
|
168
|
-
|
|
168
|
+
}
|
|
169
|
+
return false;
|
|
169
170
|
}
|
|
171
|
+
|
|
170
172
|
/**
|
|
171
173
|
* Determine whether an activity is either ongoing or is starting within 15 minutes from now.
|
|
172
174
|
*
|
|
@@ -177,11 +179,10 @@ export function isSevereHyperglycemia(logbook) {
|
|
|
177
179
|
* @returns Indication of whether the activity is ongoing or imminent.
|
|
178
180
|
*/
|
|
179
181
|
export function isActivityWithin15Minutes(activity) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
.utc(activity?.activityDate)
|
|
183
|
-
.isBetween(moment.utc().subtract(minutes, `minutes`), moment.utc().add(15, `minutes`));
|
|
182
|
+
const minutes = activity?.activityDuration;
|
|
183
|
+
return moment.utc(activity?.activityDate).isBetween(moment.utc().subtract(minutes, `minutes`), moment.utc().add(15, `minutes`));
|
|
184
184
|
}
|
|
185
|
+
|
|
185
186
|
/**
|
|
186
187
|
* The appropriate message for informing the user if the insulin recommendation was limited.
|
|
187
188
|
*
|
|
@@ -194,9 +195,7 @@ export function isActivityWithin15Minutes(activity) {
|
|
|
194
195
|
* If no limitation message should be displayed to the user then null is returned.
|
|
195
196
|
*/
|
|
196
197
|
export function getLimitationMessage(wasLimited, activityReduction) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
: Messages.RecommendationWasLimited();
|
|
200
|
-
return wasLimited ? message : null;
|
|
198
|
+
const message = activityReduction ? Messages.RecommendationWasLimitedActivity(activityReduction) : Messages.RecommendationWasLimited();
|
|
199
|
+
return wasLimited ? message : null;
|
|
201
200
|
}
|
|
202
201
|
//# sourceMappingURL=RecommendationUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["moment","BgLevel","RecommendationReminders","addPostponeActivityMessageUnder5MMOL","AttentionMessage","Messages","SEVERE_HYPERGLYCEMIA_START_MMOL","CurrentBGLError","Utils","getBGLevel","currentBGL","latestLogbookFrom6Hours","BGLevelNotProvided","SevereHypoglycemia","Hypoglycemia","MildHypoglycemia","NormoglycemiaUnder5MMOL","Normoglycemia","MildHyperglycemia","isSevereHyperglycemia","SevereHyperglycemia","Hyperglycemia","UnsupportedBGLevel","getReminder","bgLevel","carbohydrates","userReminder","activity","reminder","undefined","HediaReminderDefault","Reminder15Minutes","ReminderOff","isActivityWithin15Minutes","Reminder60Minutes","getAttentionMessage","key","getKeyFromValue","isAttentionMessageNull","isWithin15Minutes","NormoglycemiaActivityUnder5MMOL","HyperglycemiaActivity","SevereHyperglycemiaActivity","logbook","blood_glucose_millimolar","minutes","activityDuration","utc","activityDate","isBetween","subtract","add","getLimitationMessage","wasLimited","activityReduction","message","RecommendationWasLimitedActivity","RecommendationWasLimited"],"sourceRoot":"../../../src","sources":["utils/RecommendationUtils.ts"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,QAAQ;AAI3B,SAASC,OAAO,EAAEC,uBAAuB,QAAQ,eAAe;AAChE,SAASC,oCAAoC,EAAEC,gBAAgB,EAAEC,QAAQ,QAAQ,qBAAqB;AACtG,SAASC,+BAA+B,QAAQ,aAAa;AAC7D,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,KAAK,QAAQ,SAAS;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CACzBC,UAAyB,EACzBC,uBAA2D,EACjD;EACV,IAAID,UAAU,KAAK,IAAI,EAAE;IACxB,OAAOT,OAAO,CAACW,kBAAkB;EAClC;EACA,IAAIF,UAAU,IAAI,GAAG,IAAIA,UAAU,IAAI,CAAC,EAAE;IACzC,OAAOT,OAAO,CAACY,kBAAkB;EAClC;EACA,IAAIH,UAAU,GAAG,CAAC,IAAIA,UAAU,IAAI,GAAG,EAAE;IACxC,OAAOT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AC9BjD,QAAQ,CAACmD,gCAAgC,CAACF,iBAAiB,CAAC,GAC5DjD,QAAQ,CAACoD,wBAAwB,EAAE;EACtC,OAAOJ,UAAU,GAAGE,OAAO,GAAG,IAAI;AACnC"}
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
* Used for storing Record type objects that contains translations about certain settings that needs to be presented to the user.
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
import { t } from "../locales/translate";
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* Object used for storing the translations of a physical activity intensity in order to be presented to the user
|
|
8
10
|
*/
|
|
9
11
|
export const ActivityIntensityTranslations = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
light: () => t(`Light`),
|
|
13
|
+
moderate: () => t(`Moderate`),
|
|
14
|
+
hard: () => t(`Hard`)
|
|
13
15
|
};
|
|
14
16
|
//# sourceMappingURL=Translations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["t","ActivityIntensityTranslations","light","moderate","hard"],"sourceRoot":"../../../src","sources":["utils/Translations.ts"],"mappings":"AAAA;AACA;AACA;AACA;;AAIA,SAASA,CAAC,QAAQ,sBAAsB;;AAExC;AACA;AACA;AACA,OAAO,MAAMC,6BAAqF,GAAG;EACpGC,KAAK,EAAEA,CAAA,KAAcF,CAAC,CAAE,OAAM,CAAC;EAC/BG,QAAQ,EAAEA,CAAA,KAAcH,CAAC,CAAE,UAAS,CAAC;EACrCI,IAAI,EAAEA,CAAA,KAAcJ,CAAC,CAAE,MAAK;AAC7B,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { BloodGlucoseUnit, BloodKetonesUnit, UserSettings } from "@hedia/types";
|
|
2
|
+
import { MGDL_PER_MMOLL_BGL, MGDL_PER_MMOLL_BKL } from "./Constants";
|
|
3
|
+
const InjectionMethod = UserSettings.Enums.InjectionMethod;
|
|
4
|
+
const {
|
|
5
|
+
PenHalf,
|
|
6
|
+
PenWhole,
|
|
7
|
+
Pump
|
|
8
|
+
} = InjectionMethod;
|
|
9
|
+
|
|
10
|
+
/** Helper functions used for displaying data to the user. */
|
|
11
|
+
export class Utils {
|
|
12
|
+
/**
|
|
13
|
+
* Get the inverse of the precision to an insulin amount should be rounded based on the user’s injection method.
|
|
14
|
+
*
|
|
15
|
+
* Steps:
|
|
16
|
+
* 1. Use a switch statement to return the appropriate number depending on the value of the method argument:
|
|
17
|
+
* - If PenWhole, return 1.
|
|
18
|
+
* - If PenHalf, return 2.
|
|
19
|
+
* - If Pump, return 10.
|
|
20
|
+
* - Otherwise throw an exception.
|
|
21
|
+
* @param method The method by which the user injects insulin.
|
|
22
|
+
* @returns The inverse of the precision to which an insulin amount should be rounded based on the user’s injection method.
|
|
23
|
+
*/
|
|
24
|
+
static getRounding(method) {
|
|
25
|
+
switch (method) {
|
|
26
|
+
case PenWhole:
|
|
27
|
+
return 1;
|
|
28
|
+
case PenHalf:
|
|
29
|
+
return 2;
|
|
30
|
+
case Pump:
|
|
31
|
+
return 10;
|
|
32
|
+
default:
|
|
33
|
+
throw Error(`Unsupported InjectionMethod: ${method}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Round an insulin amount to the precision that is dictated by the user’s injection method.
|
|
39
|
+
*
|
|
40
|
+
* Steps:
|
|
41
|
+
* 1. Get the inverse rounding precision by calling getRounding() with injectMethod as argument.
|
|
42
|
+
* 2. Return the rounded insulin amount calculated by the following operations:
|
|
43
|
+
* - Multiply the insulin value prop by the inverse rounding precision.
|
|
44
|
+
* - Round to the nearest whole number.
|
|
45
|
+
* - Divide by the inverse rounding precision and return the result.
|
|
46
|
+
* @param value The amount of insulin to be rounded.
|
|
47
|
+
* @param injectMethod The method by which the user injects insulin.
|
|
48
|
+
* @returns The rounded insulin amount.
|
|
49
|
+
*/
|
|
50
|
+
static roundValue(value, injectMethod) {
|
|
51
|
+
const rounding = Utils.getRounding(injectMethod);
|
|
52
|
+
return Math.round(value * rounding) / rounding;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Determine whether a numerical value is in the given closed interval.
|
|
57
|
+
*
|
|
58
|
+
* Steps:
|
|
59
|
+
* 1. If value is null then return false. (Note that we only need to check explicitly for null comparing it
|
|
60
|
+
* to a number returns true while comparing undefined to a number returns false).
|
|
61
|
+
* 2. Evaluate whether value >= the interval argument’s min property && value <= the interval argument’s max property and return the result.
|
|
62
|
+
* @param value The number that will be checked for membership of the interval.
|
|
63
|
+
* @param interval The interval to compare the value to.
|
|
64
|
+
* @returns Boolean value indicating whether the value is in the closed interval.
|
|
65
|
+
*/
|
|
66
|
+
static isInRange(value, interval) {
|
|
67
|
+
if (value === null) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
return value >= interval.min && value <= interval.max;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Convert a blood glucose level value from mmol/L to mg/dL.
|
|
75
|
+
*
|
|
76
|
+
* Steps:
|
|
77
|
+
* 1. Return the result of rounding the product of multiplying value with MGDL_PER_MMOLL_BGL.
|
|
78
|
+
* @param value The blood glucose level value in mmol/L to be converted.
|
|
79
|
+
* @returns The blood glucose value in mg/dL that corresponds to the given value in mmol/L.
|
|
80
|
+
*/
|
|
81
|
+
static convertBGLToMGDL(value) {
|
|
82
|
+
return Math.round(value * MGDL_PER_MMOLL_BGL);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Depending on the blood glucose unit passed, returns the value as a string or returns a stringified call to the convertBGLToMGDL method.
|
|
87
|
+
*
|
|
88
|
+
* Steps:
|
|
89
|
+
* 1. Using a ternary operator on the unit argument return the passed value argument in case unit is a MMOL_L.
|
|
90
|
+
* Otherwise, return a call to the convertBGLToMGDL method with the value passed as an argument.
|
|
91
|
+
* @param value The blood glucose level value in mmol/L to be converted.
|
|
92
|
+
* @param unit The blood glucose measurement unit.
|
|
93
|
+
* @returns The blood glucose value that will be displayed to the user.
|
|
94
|
+
*/
|
|
95
|
+
static displayedBGLValue(value, unit) {
|
|
96
|
+
return unit === BloodGlucoseUnit.MMOL_L ? value.toFixed(1) : `${Utils.convertBGLToMGDL(value)}`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Convert a blood ketones concentration from mmol/L to mg/dL.
|
|
101
|
+
* Steps:
|
|
102
|
+
* 1. Return the result of rounding the product of multiplying value with MGDL_PER_MMOLL_BKL.
|
|
103
|
+
* @param value The blood ketones concentration in mmol/L to be converted.
|
|
104
|
+
* @returns The blood ketones concentration in mg/dL that corresponds to the given value in mmol/L.
|
|
105
|
+
*/
|
|
106
|
+
static convertBKLToMGDL(value) {
|
|
107
|
+
return Math.round(value * MGDL_PER_MMOLL_BKL);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Depending on the blood ketone unit passed, returns the value as a string or returns a call to the convertBKLToMGDL method.
|
|
112
|
+
*
|
|
113
|
+
* Steps:
|
|
114
|
+
* 1. Using a ternary operator on the unit argument return the passed value argument in case unit is a MMOL_L.
|
|
115
|
+
* Otherwise, return a call to the convertBKLToMGDL method with the value passed as an argument.
|
|
116
|
+
* @param value The blood ketone level value in mmol/L to be converted.
|
|
117
|
+
* @param unit The blood ketone measurement unit.
|
|
118
|
+
* @returns The blood ketone value that will be displayed to the user.
|
|
119
|
+
*/
|
|
120
|
+
static displayedBKLValue(value, unit) {
|
|
121
|
+
return unit === BloodKetonesUnit.MMOL_L ? value.toFixed(1) : `${Utils.convertBKLToMGDL(value)}`;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Format a measurement unit for displaying to the user. More concrete, it is used to display the litre symbol with uppercase "L".
|
|
126
|
+
*
|
|
127
|
+
* Steps:
|
|
128
|
+
* 1. Set unitWithoutLastLetter to be unit except for the last character.
|
|
129
|
+
* 2. Set lastLetterUppercase to be the last letter of unit converted to uppercase.
|
|
130
|
+
* 3. Return unitWithoutLastLetter concatenated with lastLetterUppercase.
|
|
131
|
+
* @param unit The measurement unit to format.
|
|
132
|
+
* @returns The measurement unit formatted for displaying to the user.
|
|
133
|
+
*/
|
|
134
|
+
static formatUnit = unit => {
|
|
135
|
+
const unitWithoutLastLetter = unit.substring(0, unit.length - 1);
|
|
136
|
+
const lastLetterUppercase = unit.substring(unit.length - 1, unit.length).toUpperCase();
|
|
137
|
+
return `${unitWithoutLastLetter}${lastLetterUppercase}`;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Returns the key of key/value object when passing the key value as argument.
|
|
142
|
+
*
|
|
143
|
+
* Steps:
|
|
144
|
+
* 1. Save all the values of the keys object into the values constant
|
|
145
|
+
* 2. From the array of keys, return the one at the index of the first occurence of the value in the values constant
|
|
146
|
+
* @param keys The keys of the T object.
|
|
147
|
+
* @param value The value for the requested key.
|
|
148
|
+
* @returns The key of the passed value.
|
|
149
|
+
*/
|
|
150
|
+
static getKeyFromValue(keys, value) {
|
|
151
|
+
const values = Object.values(keys);
|
|
152
|
+
return Object.keys(keys)[values.indexOf(value)];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=Utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BloodGlucoseUnit","BloodKetonesUnit","UserSettings","MGDL_PER_MMOLL_BGL","MGDL_PER_MMOLL_BKL","InjectionMethod","Enums","PenHalf","PenWhole","Pump","Utils","getRounding","method","Error","roundValue","value","injectMethod","rounding","Math","round","isInRange","interval","min","max","convertBGLToMGDL","displayedBGLValue","unit","MMOL_L","toFixed","convertBKLToMGDL","displayedBKLValue","formatUnit","unitWithoutLastLetter","substring","length","lastLetterUppercase","toUpperCase","getKeyFromValue","keys","values","Object","indexOf"],"sourceRoot":"../../../src","sources":["utils/Utils.ts"],"mappings":"AAAA,SAASA,gBAA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