@hedia/recommendation-screen 1.0.6 → 1.0.7

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 (117) hide show
  1. package/App.jsx +4 -3
  2. package/Changelog.md +0 -0
  3. package/README.md +0 -0
  4. package/android/app/BUCK +0 -0
  5. package/android/app/build.gradle +0 -0
  6. package/android/app/build_defs.bzl +0 -0
  7. package/android/app/debug.keystore +0 -0
  8. package/android/app/proguard-rules.pro +0 -0
  9. package/android/app/src/debug/AndroidManifest.xml +0 -0
  10. package/android/app/src/debug/java/com/hediarecommendationscreen/ReactNativeFlipper.java +0 -0
  11. package/android/app/src/main/AndroidManifest.xml +0 -0
  12. package/android/app/src/main/java/com/hediarecommendationscreen/MainActivity.java +0 -0
  13. package/android/app/src/main/java/com/hediarecommendationscreen/MainApplication.java +0 -0
  14. package/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  15. package/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  16. package/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  17. package/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  18. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  19. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  20. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  21. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  22. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  23. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  24. package/android/app/src/main/res/values/strings.xml +0 -0
  25. package/android/app/src/main/res/values/styles.xml +0 -0
  26. package/android/build.gradle +0 -0
  27. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  28. package/android/gradle/wrapper/gradle-wrapper.properties +0 -0
  29. package/android/gradle.properties +0 -0
  30. package/android/gradlew +188 -188
  31. package/android/gradlew.bat +0 -0
  32. package/android/settings.gradle +0 -0
  33. package/index.d.ts +0 -0
  34. package/index.js +0 -0
  35. package/index.ts +0 -0
  36. package/ios/HediaRecommendationScreen/AppDelegate.h +0 -0
  37. package/ios/HediaRecommendationScreen/AppDelegate.m +0 -0
  38. package/ios/HediaRecommendationScreen/Base.lproj/LaunchScreen.xib +0 -0
  39. package/ios/HediaRecommendationScreen/Images.xcassets/AppIcon.appiconset/Contents.json +0 -0
  40. package/ios/HediaRecommendationScreen/Images.xcassets/Contents.json +0 -0
  41. package/ios/HediaRecommendationScreen/Info.plist +0 -0
  42. package/ios/HediaRecommendationScreen/main.m +0 -0
  43. package/ios/HediaRecommendationScreen-tvOS/Info.plist +0 -0
  44. package/ios/HediaRecommendationScreen-tvOSTests/Info.plist +0 -0
  45. package/ios/HediaRecommendationScreen.xcodeproj/project.pbxproj +0 -0
  46. package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen-tvOS.xcscheme +0 -0
  47. package/ios/HediaRecommendationScreen.xcodeproj/xcshareddata/xcschemes/HediaRecommendationScreen.xcscheme +0 -0
  48. package/ios/HediaRecommendationScreenTests/HediaRecommendationScreenTests.m +0 -0
  49. package/ios/HediaRecommendationScreenTests/Info.plist +0 -0
  50. package/ios/Podfile +0 -0
  51. package/package.json +1 -1
  52. package/src/RecommendationScreen.d.ts +1 -0
  53. package/src/RecommendationScreen.jsx +18 -1
  54. package/src/RecommendationScreen.tsx +26 -4
  55. package/src/assets/happy.png +0 -0
  56. package/src/assets/happy_active.png +0 -0
  57. package/src/assets/neutral.png +0 -0
  58. package/src/assets/neutral_active.png +0 -0
  59. package/src/assets/sad.png +0 -0
  60. package/src/assets/sad_active.png +0 -0
  61. package/src/assets/semi_happy.png +0 -0
  62. package/src/assets/semi_happy_active.png +0 -0
  63. package/src/assets/semi_sad.png +0 -0
  64. package/src/assets/semi_sad_active.png +0 -0
  65. package/src/components/Emotion.d.ts +0 -0
  66. package/src/components/Emotion.jsx +0 -0
  67. package/src/components/Emotion.tsx +0 -0
  68. package/src/components/Header.d.ts +0 -0
  69. package/src/components/Header.jsx +0 -0
  70. package/src/components/Header.tsx +0 -0
  71. package/src/components/Icon.js +0 -0
  72. package/src/components/InfoBars.d.ts +0 -0
  73. package/src/components/InfoBars.jsx +2 -1
  74. package/src/components/InfoBars.tsx +3 -1
  75. package/src/components/InvisibleNumberInput.d.ts +0 -0
  76. package/src/components/InvisibleNumberInput.jsx +0 -0
  77. package/src/components/InvisibleNumberInput.tsx +0 -0
  78. package/src/components/MoodIcon.d.ts +0 -0
  79. package/src/components/MoodIcon.jsx +0 -0
  80. package/src/components/MoodIcon.tsx +0 -0
  81. package/src/components/RecentInsulin.d.ts +0 -0
  82. package/src/components/RecentInsulin.jsx +0 -0
  83. package/src/components/RecentInsulin.tsx +0 -0
  84. package/src/components/RecommendedCarbs.d.ts +0 -0
  85. package/src/components/RecommendedCarbs.jsx +2 -1
  86. package/src/components/RecommendedCarbs.tsx +3 -1
  87. package/src/components/RecommendedInsulin.d.ts +0 -0
  88. package/src/components/RecommendedInsulin.jsx +0 -0
  89. package/src/components/RecommendedInsulin.tsx +0 -0
  90. package/src/components/Remeasure.d.ts +0 -0
  91. package/src/components/Remeasure.jsx +0 -0
  92. package/src/components/Remeasure.tsx +0 -0
  93. package/src/components/TransferToLogbook.d.ts +0 -0
  94. package/src/components/TransferToLogbook.jsx +0 -0
  95. package/src/components/TransferToLogbook.tsx +0 -0
  96. package/src/locale/da/messages.js +1 -1
  97. package/src/locale/da/messages.po +20 -12
  98. package/src/locale/en/messages.js +1 -1
  99. package/src/locale/en/messages.po +19 -11
  100. package/src/locale/i18nUtils.d.ts +0 -0
  101. package/src/locale/i18nUtils.js +0 -0
  102. package/src/locale/i18nUtils.ts +0 -0
  103. package/src/types/enum.d.ts +9 -1
  104. package/src/types/enum.js +10 -1
  105. package/src/types/enum.ts +9 -0
  106. package/src/types/types.d.ts +0 -0
  107. package/src/types/types.js +0 -0
  108. package/src/types/types.ts +0 -0
  109. package/src/utils/Constants.d.ts +0 -0
  110. package/src/utils/Constants.js +0 -0
  111. package/src/utils/Constants.ts +0 -0
  112. package/src/utils/RecommendationError.d.ts +2 -0
  113. package/src/utils/RecommendationError.js +3 -1
  114. package/src/utils/RecommendationError.ts +12 -0
  115. package/src/utils/Utils.d.ts +0 -0
  116. package/src/utils/Utils.js +0 -0
  117. package/src/utils/Utils.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { ScrollView, StyleSheet, Text, View } from "react-native";
3
- import { BGUnit, InjectionMethod, Languages, MoodEnum } from "./types/enum";
2
+ import { ScrollView, StyleSheet, View, YellowBox } from "react-native";
3
+ import { BGUnit, InjectionMethod, Languages, Milliseconds, MoodEnum } from "./types/enum";
4
4
  import { BACKGROUND_COLOUR_PURPLE, BORDER_COLOUR_TEAL, BORDER_COLOUR_WHITE } from "./utils/Constants";
5
5
 
6
6
  import Header, { headerStyles } from "./components/Header";
@@ -14,11 +14,15 @@ import * as Calculator from "@hedia/recommendation-calculator";
14
14
  import { I18nProvider } from "@lingui/react";
15
15
  import Emotion from "./components/Emotion";
16
16
  import TransferToLogbook from "./components/TransferToLogbook";
17
- import { RecommendationError } from "./utils/RecommendationError";
17
+ import { RecommendationError, SevereHypoglycemiaError, TimeoutLimitError } from "./utils/RecommendationError";
18
18
 
19
19
  import { changeLanguage, i18n } from "./locale/i18nUtils";
20
20
  import { Utils } from "./utils/Utils";
21
21
 
22
+ // Ignoring long timer warnings
23
+ // https://github.com/facebook/react-native/issues/12981#issuecomment-652745831
24
+ YellowBox.ignoreWarnings([`Setting a timer`]);
25
+
22
26
  interface IResult {
23
27
  suggested: number;
24
28
  entered?: number;
@@ -54,23 +58,36 @@ interface IState {
54
58
  }
55
59
 
56
60
  export default class RecommendationScreen extends React.Component<IRecommendationProps, IState> {
61
+ private readonly timer: NodeJS.Timeout;
62
+
57
63
  constructor(props: IRecommendationProps) {
58
64
  super(props);
59
65
 
60
66
  changeLanguage(props.language);
61
67
 
68
+ // Handle >= 1.1, <= 2 mmol/L (SevereHypoglycemia)
69
+ const { currentBGL, recentBoluses } = props?.calculatorParams;
70
+ if (currentBGL <= 2 && currentBGL >= 1.1) {
71
+ props.onError(SevereHypoglycemiaError);
72
+ }
73
+
62
74
  const { bolus, carbRecommendation, activityReduction } = Calculator.calculateRecommendation(
63
75
  props.calculatorParams,
64
76
  );
77
+
65
78
  this.state = {
66
79
  remeasureTime: 1.5,
67
- showRecentInsulin: true,
80
+ showRecentInsulin: recentBoluses?.length === 0,
68
81
  insulinRecommendation: Utils.roundValue(bolus, props.injectionMethod),
69
82
  activityReduction,
70
83
  carbRecommendation,
71
84
  activeInsulin: 0.0,
72
85
  selectedMood: 0,
73
86
  };
87
+
88
+ this.timer = setTimeout(() => {
89
+ props.onError(TimeoutLimitError);
90
+ }, Milliseconds.Minute * 15);
74
91
  }
75
92
 
76
93
  public updateRemeasureTime = (remeasureTime: number) => {
@@ -112,6 +129,11 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
112
129
  };
113
130
 
114
131
  public handleTransfer = () => {
132
+ // TODO: Handle Errors/Warnings
133
+ // 300 carbs.
134
+ // < 5 mmol && activity
135
+ // > 2, <= 3.5 mmol/L
136
+
115
137
  this.props.transferToLogbook(
116
138
  {
117
139
  suggested: this.state.carbRecommendation,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -10,6 +10,7 @@ const Constants_1 = require("../utils/Constants");
10
10
  const Header_1 = require("./Header");
11
11
  class InfoBars extends react_1.default.Component {
12
12
  render() {
13
+ const displayedValue = this.props.value ?? (this.props.showZeroAsDash ? `-.-` : `0`);
13
14
  return (<react_native_1.View style={exports.infoStyles.container}>
14
15
  <react_native_1.View style={exports.infoStyles.margin}>
15
16
  <react_native_1.View style={exports.infoStyles.border}>
@@ -19,7 +20,7 @@ class InfoBars extends react_1.default.Component {
19
20
  </react_native_1.View>
20
21
  <react_native_1.View style={exports.infoStyles.valueUnitContainer}>
21
22
  <react_native_1.View style={exports.infoStyles.valueContainer}>
22
- <react_native_1.Text style={exports.infoStyles.value}>{this.props.value ? this.props.value : `-.-`}</react_native_1.Text>
23
+ <react_native_1.Text style={exports.infoStyles.value}>{displayedValue}</react_native_1.Text>
23
24
  </react_native_1.View>
24
25
  <react_native_1.View style={exports.infoStyles.unitContainer}>
25
26
  <react_native_1.Text style={exports.infoStyles.units}>{this.props.units}</react_native_1.Text>
@@ -12,6 +12,8 @@ export interface IProps {
12
12
 
13
13
  export default class InfoBars extends React.Component<IProps> {
14
14
  public render() {
15
+ const displayedValue = this.props.value ?? (this.props.showZeroAsDash ? `-.-` : `0`);
16
+
15
17
  return (
16
18
  <View style={infoStyles.container}>
17
19
  <View style={infoStyles.margin}>
@@ -22,7 +24,7 @@ export default class InfoBars extends React.Component<IProps> {
22
24
  </View>
23
25
  <View style={infoStyles.valueUnitContainer}>
24
26
  <View style={infoStyles.valueContainer}>
25
- <Text style={infoStyles.value}>{this.props.value ? this.props.value : `-.-`}</Text>
27
+ <Text style={infoStyles.value}>{displayedValue}</Text>
26
28
  </View>
27
29
  <View style={infoStyles.unitContainer}>
28
30
  <Text style={infoStyles.units}>{this.props.units}</Text>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -35,6 +35,7 @@ class RecommendedCarbs extends react_1.default.Component {
35
35
  }
36
36
  };
37
37
  this.renderRecommendedCarbs = () => {
38
+ const shownCarbs = this.state.partialInput ?? Math.round(Number(this.props.recommendedCarbs));
38
39
  return (<react_1.default.Fragment>
39
40
  <react_native_1.View style={calculationStyles.borderContainer}>
40
41
  <react_native_1.View style={calculationStyles.recommendedContainer}>
@@ -50,7 +51,7 @@ class RecommendedCarbs extends react_1.default.Component {
50
51
  <react_native_1.TouchableOpacity accessibilityLabel="editRecommendedCarbsButton" onPress={this.showTextInput} style={[calculationStyles.valueUnitContainer, calculationStyles.recommendedBorder]}>
51
52
  <react_native_1.View style={calculationStyles.valueContainer}>
52
53
  <react_native_1.Text style={[calculationStyles.value, { color: Constants_1.BORDER_COLOUR_TEAL }]}>
53
- +{this.state.partialInput ?? this.props.recommendedCarbs}
54
+ +{shownCarbs}
54
55
  </react_native_1.Text>
55
56
  </react_native_1.View>
56
57
  <react_native_1.View style={[calculationStyles.unitContainer]}>
@@ -58,6 +58,8 @@ export default class RecommendedCarbs extends React.Component<IProps, IState> {
58
58
  };
59
59
 
60
60
  public renderRecommendedCarbs = () => {
61
+ const shownCarbs = this.state.partialInput ?? Math.round(Number(this.props.recommendedCarbs));
62
+
61
63
  return (
62
64
  <React.Fragment>
63
65
  <View style={calculationStyles.borderContainer}>
@@ -85,7 +87,7 @@ export default class RecommendedCarbs extends React.Component<IProps, IState> {
85
87
  >
86
88
  <View style={calculationStyles.valueContainer}>
87
89
  <Text style={[calculationStyles.value, { color: BORDER_COLOUR_TEAL }]}>
88
- +{this.state.partialInput ?? this.props.recommendedCarbs}
90
+ +{shownCarbs}
89
91
  </Text>
90
92
  </View>
91
93
  <View style={[calculationStyles.unitContainer]}>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1 +1 @@
1
- /* eslint-disable */module.exports={languageData:{"plurals":function(n,ord){var s=String(n).split("."),i=s[0],t0=Number(s[0])==n;if(ord)return"other";return n==1||!t0&&(i==0||i==1)?"one":"other"}},messages:{"Active Insulin":"Aktiv Insulin","Additional":"Supplerende","Blood Glucose Level":"Blodsukkerniveau","Entered":"Indtastet","Food":"Mad","Have you taken insulin within the last 4 hours?":"Har du taget insulin inden for de sidste 4 timer?","Hedia does not support insulin recommendations related to strenuous activity.":"Hedia underst\xF8tter ikke insulin anbefalinger relateret til anstrengende aktivitet.","Hedia does not support insulin recommendations with more than 300g carbohydrates present.":"Hedia underst\xF8tter ikke insulin anbefalinger hvori mere end 300g kulhydrater er tilstede.","How are you feeling?":"Hvordan har du det?","INSULIN\nRECOMMENDATION":"INSULIN\nANBEFALING","Insulin limit reached, for your safety Hedia will not recommend more than this.":"Insulingr\xE6nsen i Hedia er n\xE5et, for din sikkerhed vil der ikke blive anbefalet mere end dette.","No":"Nej","OFF":"OFF","Please verify your activity interval settings are set up correctly.":"Kontroller at dine indstillinger for aktivitetsintervaller er opsat korrekt.","Recommended":"Anbefalet","Recommended amount of insulin":"Anbefalet enhed(er) af insulin","Remind me to remeasure in":"P\xE5mind mig at genm\xE5le om","Total":"Total","Transfer to logbook":"Overf\xF8r til logbog","Transfered to logbook":"Overf\xF8rt til logbok","Units":"Enheder","Yes":"Ja","g carbs":"g carbs","hours":"timer","units":"enheder"}};
1
+ /* eslint-disable */module.exports={languageData:{"plurals":function(n,ord){var s=String(n).split("."),i=s[0],t0=Number(s[0])==n;if(ord)return"other";return n==1||!t0&&(i==0||i==1)?"one":"other"}},messages:{"Active Insulin":"Aktiv Insulin","Additional":"Supplerende","Blood Glucose Level":"Blodsukkerniveau","Entered":"Indtastet","Food":"Mad","Have you taken insulin within the last 4 hours?":"Har du taget insulin inden for de sidste 4 timer?","Hedia does not support insulin recommendations related to strenuous activity.":"Hedia underst\xF8tter ikke insulin anbefalinger relateret til anstrengende aktivitet.","Hedia does not support insulin recommendations with more than 300g carbohydrates present.":"Hedia underst\xF8tter ikke insulin anbefalinger hvori mere end 300g kulhydrater er tilstede.","How are you feeling?":"Hvordan har du det?","INSULIN\nRECOMMENDATION":"INSULIN\nANBEFALING","Insulin limit reached, for your safety Hedia will not recommend more than this.":"Insulingr\xE6nsen i Hedia er n\xE5et, for din sikkerhed vil der ikke blive anbefalet mere end dette.","More than 15 minutes has passed since this calculation was started.\nPlease go through the calculation steps with new measurements to ensure a safe recommendation.":"Der er g\xE5et mere end 15 minutter siden udregningen blev startet.\nG\xE5 venligst gennem udregningstrinnene igen med nye m\xE5linger for at sikre en sikker anbefaling.","No":"Nej","OFF":"OFF","Please verify your activity interval settings are set up correctly.":"Kontroller at dine indstillinger for aktivitetsintervaller er opsat korrekt.","Recommended":"Anbefalet","Recommended amount of insulin":"Anbefalet enhed(er) af insulin","Remind me to remeasure in":"P\xE5mind mig at genm\xE5le om","Total":"Sum","Transfer to logbook":"Overf\xF8r til logbog","Transfered to logbook":"Overf\xF8rt til logbok","Units":"Enheder","Yes":"Ja","g carbs":"g carbs","hours":"timer","units":"enheder"}};
@@ -13,23 +13,23 @@ msgstr ""
13
13
  "Language-Team: \n"
14
14
  "Plural-Forms: \n"
15
15
 
16
- #: src/RecommendationScreen.tsx:77
16
+ #: src/RecommendationScreen.tsx:86
17
17
  msgid "Active Insulin"
18
18
  msgstr "Aktiv Insulin"
19
19
 
20
- #: src/components/RecommendedCarbs.tsx:44
20
+ #: src/components/RecommendedCarbs.tsx:45
21
21
  msgid "Additional"
22
22
  msgstr "Supplerende"
23
23
 
24
- #: src/RecommendationScreen.tsx:78
24
+ #: src/RecommendationScreen.tsx:87
25
25
  msgid "Blood Glucose Level"
26
26
  msgstr "Blodsukkerniveau"
27
27
 
28
- #: src/components/RecommendedCarbs.tsx:99
28
+ #: src/components/RecommendedCarbs.tsx:100
29
29
  msgid "Entered"
30
30
  msgstr "Indtastet"
31
31
 
32
- #: src/components/RecommendedCarbs.tsx:98
32
+ #: src/components/RecommendedCarbs.tsx:99
33
33
  msgid "Food"
34
34
  msgstr "Mad"
35
35
 
@@ -61,6 +61,14 @@ msgstr ""
61
61
  msgid "Insulin limit reached, for your safety Hedia will not recommend more than this."
62
62
  msgstr "Insulingrænsen i Hedia er nået, for din sikkerhed vil der ikke blive anbefalet mere end dette."
63
63
 
64
+ #: src/utils/RecommendationError.ts:13
65
+ msgid ""
66
+ "More than 15 minutes has passed since this calculation was started.\n"
67
+ "Please go through the calculation steps with new measurements to ensure a safe recommendation."
68
+ msgstr ""
69
+ "Der er gået mere end 15 minutter siden udregningen blev startet.\n"
70
+ "Gå venligst gennem udregningstrinnene igen med nye målinger for at sikre en sikker anbefaling."
71
+
64
72
  #: src/components/RecentInsulin.tsx:24
65
73
  msgid "No"
66
74
  msgstr "Nej"
@@ -73,7 +81,7 @@ msgstr "OFF"
73
81
  msgid "Please verify your activity interval settings are set up correctly."
74
82
  msgstr "Kontroller at dine indstillinger for aktivitetsintervaller er opsat korrekt."
75
83
 
76
- #: src/components/RecommendedCarbs.tsx:41
84
+ #: src/components/RecommendedCarbs.tsx:42
77
85
  msgid "Recommended"
78
86
  msgstr "Anbefalet"
79
87
 
@@ -86,9 +94,9 @@ msgstr "Anbefalet enhed(er) af insulin"
86
94
  msgid "Remind me to remeasure in"
87
95
  msgstr "Påmind mig at genmåle om"
88
96
 
89
- #: src/components/RecommendedCarbs.tsx:66
97
+ #: src/components/RecommendedCarbs.tsx:67
90
98
  msgid "Total"
91
- msgstr "Total"
99
+ msgstr "Sum"
92
100
 
93
101
  #: src/components/TransferToLogbook.tsx:24
94
102
  msgid "Transfer to logbook"
@@ -106,9 +114,9 @@ msgstr "Enheder"
106
114
  msgid "Yes"
107
115
  msgstr "Ja"
108
116
 
109
- #: src/components/RecommendedCarbs.tsx:58
110
- #: src/components/RecommendedCarbs.tsx:68
111
- #: src/components/RecommendedCarbs.tsx:101
117
+ #: src/components/RecommendedCarbs.tsx:59
118
+ #: src/components/RecommendedCarbs.tsx:69
119
+ #: src/components/RecommendedCarbs.tsx:102
112
120
  msgid "g carbs"
113
121
  msgstr "g carbs"
114
122
 
@@ -116,6 +124,6 @@ msgstr "g carbs"
116
124
  msgid "hours"
117
125
  msgstr "timer"
118
126
 
119
- #: src/RecommendationScreen.tsx:77
127
+ #: src/RecommendationScreen.tsx:86
120
128
  msgid "units"
121
129
  msgstr "enheder"
@@ -1 +1 @@
1
- /* eslint-disable */module.exports={languageData:{"plurals":function(n,ord){var s=String(n).split("."),v0=!s[1],t0=Number(s[0])==n,n10=t0&&s[0].slice(-1),n100=t0&&s[0].slice(-2);if(ord)return n10==1&&n100!=11?"one":n10==2&&n100!=12?"two":n10==3&&n100!=13?"few":"other";return n==1&&v0?"one":"other"}},messages:{"Active Insulin":"Active Insulin","Additional":"Additional","Blood Glucose Level":"Blood Glucose Level","Entered":"Entered","Food":"Food","Have you taken insulin within the last 4 hours?":"Have you taken insulin within the last 4 hours?","Hedia does not support insulin recommendations related to strenuous activity.":"Hedia does not support insulin recommendations related to strenuous activity.","Hedia does not support insulin recommendations with more than 300g carbohydrates present.":"Hedia does not support insulin recommendations with more than 300g carbohydrates present.","How are you feeling?":"How are you feeling?","INSULIN\nRECOMMENDATION":"INSULIN\nRECOMMENDATION","Insulin limit reached, for your safety Hedia will not recommend more than this.":"Insulin limit reached, for your safety Hedia will not recommend more than this.","No":"No","OFF":"OFF","Please verify your activity interval settings are set up correctly.":"Please verify your activity interval settings are set up correctly.","Recommended":"Recommended","Recommended amount of insulin":"Recommended amount of insulin","Remind me to remeasure in":"Remind me to remeasure in","Total":"Total","Transfer to logbook":"Transfer to logbook","Transfered to logbook":"Transfered to logbook","Units":"Units","Yes":"Yes","g carbs":"g carbs","hours":"hours","units":"units"}};
1
+ /* eslint-disable */module.exports={languageData:{"plurals":function(n,ord){var s=String(n).split("."),v0=!s[1],t0=Number(s[0])==n,n10=t0&&s[0].slice(-1),n100=t0&&s[0].slice(-2);if(ord)return n10==1&&n100!=11?"one":n10==2&&n100!=12?"two":n10==3&&n100!=13?"few":"other";return n==1&&v0?"one":"other"}},messages:{"Active Insulin":"Active Insulin","Additional":"Additional","Blood Glucose Level":"Blood Glucose Level","Entered":"Entered","Food":"Food","Have you taken insulin within the last 4 hours?":"Have you taken insulin within the last 4 hours?","Hedia does not support insulin recommendations related to strenuous activity.":"Hedia does not support insulin recommendations related to strenuous activity.","Hedia does not support insulin recommendations with more than 300g carbohydrates present.":"Hedia does not support insulin recommendations with more than 300g carbohydrates present.","How are you feeling?":"How are you feeling?","INSULIN\nRECOMMENDATION":"INSULIN\nRECOMMENDATION","Insulin limit reached, for your safety Hedia will not recommend more than this.":"Insulin limit reached, for your safety Hedia will not recommend more than this.","More than 15 minutes has passed since this calculation was started.\nPlease go through the calculation steps with new measurements to ensure a safe recommendation.":"More than 15 minutes has passed since this calculation was started.\nPlease go through the calculation steps with new measurements to ensure a safe recommendation.","No":"No","OFF":"OFF","Please verify your activity interval settings are set up correctly.":"Please verify your activity interval settings are set up correctly.","Recommended":"Recommended","Recommended amount of insulin":"Recommended amount of insulin","Remind me to remeasure in":"Remind me to remeasure in","Total":"Total","Transfer to logbook":"Transfer to logbook","Transfered to logbook":"Transfered to logbook","Units":"Units","Yes":"Yes","g carbs":"g carbs","hours":"hours","units":"units"}};
@@ -13,23 +13,23 @@ msgstr ""
13
13
  "Language-Team: \n"
14
14
  "Plural-Forms: \n"
15
15
 
16
- #: src/RecommendationScreen.tsx:77
16
+ #: src/RecommendationScreen.tsx:86
17
17
  msgid "Active Insulin"
18
18
  msgstr "Active Insulin"
19
19
 
20
- #: src/components/RecommendedCarbs.tsx:44
20
+ #: src/components/RecommendedCarbs.tsx:45
21
21
  msgid "Additional"
22
22
  msgstr "Additional"
23
23
 
24
- #: src/RecommendationScreen.tsx:78
24
+ #: src/RecommendationScreen.tsx:87
25
25
  msgid "Blood Glucose Level"
26
26
  msgstr "Blood Glucose Level"
27
27
 
28
- #: src/components/RecommendedCarbs.tsx:99
28
+ #: src/components/RecommendedCarbs.tsx:100
29
29
  msgid "Entered"
30
30
  msgstr "Entered"
31
31
 
32
- #: src/components/RecommendedCarbs.tsx:98
32
+ #: src/components/RecommendedCarbs.tsx:99
33
33
  msgid "Food"
34
34
  msgstr "Food"
35
35
 
@@ -61,6 +61,14 @@ msgstr ""
61
61
  msgid "Insulin limit reached, for your safety Hedia will not recommend more than this."
62
62
  msgstr "Insulin limit reached, for your safety Hedia will not recommend more than this."
63
63
 
64
+ #: src/utils/RecommendationError.ts:13
65
+ msgid ""
66
+ "More than 15 minutes has passed since this calculation was started.\n"
67
+ "Please go through the calculation steps with new measurements to ensure a safe recommendation."
68
+ msgstr ""
69
+ "More than 15 minutes has passed since this calculation was started.\n"
70
+ "Please go through the calculation steps with new measurements to ensure a safe recommendation."
71
+
64
72
  #: src/components/RecentInsulin.tsx:24
65
73
  msgid "No"
66
74
  msgstr "No"
@@ -73,7 +81,7 @@ msgstr "OFF"
73
81
  msgid "Please verify your activity interval settings are set up correctly."
74
82
  msgstr "Please verify your activity interval settings are set up correctly."
75
83
 
76
- #: src/components/RecommendedCarbs.tsx:41
84
+ #: src/components/RecommendedCarbs.tsx:42
77
85
  msgid "Recommended"
78
86
  msgstr "Recommended"
79
87
 
@@ -86,7 +94,7 @@ msgstr "Recommended amount of insulin"
86
94
  msgid "Remind me to remeasure in"
87
95
  msgstr "Remind me to remeasure in"
88
96
 
89
- #: src/components/RecommendedCarbs.tsx:66
97
+ #: src/components/RecommendedCarbs.tsx:67
90
98
  msgid "Total"
91
99
  msgstr "Total"
92
100
 
@@ -106,9 +114,9 @@ msgstr "Units"
106
114
  msgid "Yes"
107
115
  msgstr "Yes"
108
116
 
109
- #: src/components/RecommendedCarbs.tsx:58
110
- #: src/components/RecommendedCarbs.tsx:68
111
- #: src/components/RecommendedCarbs.tsx:101
117
+ #: src/components/RecommendedCarbs.tsx:59
118
+ #: src/components/RecommendedCarbs.tsx:69
119
+ #: src/components/RecommendedCarbs.tsx:102
112
120
  msgid "g carbs"
113
121
  msgstr "g carbs"
114
122
 
@@ -116,6 +124,6 @@ msgstr "g carbs"
116
124
  msgid "hours"
117
125
  msgstr "hours"
118
126
 
119
- #: src/RecommendationScreen.tsx:77
127
+ #: src/RecommendationScreen.tsx:86
120
128
  msgid "units"
121
129
  msgstr "units"
File without changes
File without changes
File without changes
@@ -22,5 +22,13 @@ export declare enum RecommendationErrorEnum {
22
22
  ActivityOutOfRange = 0,
23
23
  ActivityNull = 1,
24
24
  CarbohydrateLimit = 2,
25
- InsulinLimit = 3
25
+ InsulinLimit = 3,
26
+ SevereHypoglycemia = 4,
27
+ TimeoutLimit = 5
28
+ }
29
+ export declare enum Milliseconds {
30
+ Second = 1000,
31
+ Minute = 60000,
32
+ Hour = 3600000,
33
+ Day = 86400000
26
34
  }
package/src/types/enum.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RecommendationErrorEnum = exports.Languages = exports.InjectionMethod = exports.BGUnit = exports.MoodEnum = void 0;
3
+ exports.Milliseconds = exports.RecommendationErrorEnum = exports.Languages = exports.InjectionMethod = exports.BGUnit = exports.MoodEnum = void 0;
4
4
  var MoodEnum;
5
5
  (function (MoodEnum) {
6
6
  MoodEnum[MoodEnum["Sad"] = 1] = "Sad";
@@ -31,4 +31,13 @@ var RecommendationErrorEnum;
31
31
  RecommendationErrorEnum[RecommendationErrorEnum["ActivityNull"] = 1] = "ActivityNull";
32
32
  RecommendationErrorEnum[RecommendationErrorEnum["CarbohydrateLimit"] = 2] = "CarbohydrateLimit";
33
33
  RecommendationErrorEnum[RecommendationErrorEnum["InsulinLimit"] = 3] = "InsulinLimit";
34
+ RecommendationErrorEnum[RecommendationErrorEnum["SevereHypoglycemia"] = 4] = "SevereHypoglycemia";
35
+ RecommendationErrorEnum[RecommendationErrorEnum["TimeoutLimit"] = 5] = "TimeoutLimit";
34
36
  })(RecommendationErrorEnum = exports.RecommendationErrorEnum || (exports.RecommendationErrorEnum = {}));
37
+ var Milliseconds;
38
+ (function (Milliseconds) {
39
+ Milliseconds[Milliseconds["Second"] = 1000] = "Second";
40
+ Milliseconds[Milliseconds["Minute"] = 60000] = "Minute";
41
+ Milliseconds[Milliseconds["Hour"] = 3600000] = "Hour";
42
+ Milliseconds[Milliseconds["Day"] = 86400000] = "Day";
43
+ })(Milliseconds = exports.Milliseconds || (exports.Milliseconds = {}));
package/src/types/enum.ts CHANGED
@@ -27,4 +27,13 @@ export enum RecommendationErrorEnum {
27
27
  ActivityNull,
28
28
  CarbohydrateLimit,
29
29
  InsulinLimit,
30
+ SevereHypoglycemia,
31
+ TimeoutLimit,
32
+ }
33
+
34
+ export enum Milliseconds {
35
+ Second = 1000,
36
+ Minute = 60000,
37
+ Hour = 3600000,
38
+ Day = 86400000,
30
39
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -7,3 +7,5 @@ export declare const ActivityRangeError: RecommendationError;
7
7
  export declare const ActivityNullError: RecommendationError;
8
8
  export declare const CarbohydrateLimitError: RecommendationError;
9
9
  export declare const InsulinLimitError: RecommendationError;
10
+ export declare const SevereHypoglycemiaError: RecommendationError;
11
+ export declare const TimeoutLimitError: RecommendationError;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InsulinLimitError = exports.CarbohydrateLimitError = exports.ActivityNullError = exports.ActivityRangeError = exports.RecommendationError = void 0;
3
+ exports.TimeoutLimitError = exports.SevereHypoglycemiaError = exports.InsulinLimitError = exports.CarbohydrateLimitError = exports.ActivityNullError = exports.ActivityRangeError = exports.RecommendationError = void 0;
4
4
  const i18nUtils_1 = require("../locale/i18nUtils");
5
5
  const enum_1 = require("../types/enum");
6
6
  class RecommendationError extends Error {
@@ -14,3 +14,5 @@ exports.ActivityRangeError = new RecommendationError(i18nUtils_1.i18n._("Hedia d
14
14
  exports.ActivityNullError = new RecommendationError(i18nUtils_1.i18n._("Please verify your activity interval settings are set up correctly."), enum_1.RecommendationErrorEnum.ActivityNull);
15
15
  exports.CarbohydrateLimitError = new RecommendationError(i18nUtils_1.i18n._("Hedia does not support insulin recommendations with more than 300g carbohydrates present."), enum_1.RecommendationErrorEnum.CarbohydrateLimit);
16
16
  exports.InsulinLimitError = new RecommendationError(i18nUtils_1.i18n._("Insulin limit reached, for your safety Hedia will not recommend more than this."), enum_1.RecommendationErrorEnum.InsulinLimit);
17
+ exports.SevereHypoglycemiaError = new RecommendationError(i18nUtils_1.i18n._("CRITICALLY low blood glucose levels!\nPlease take glucagon if possible or consume carbohydrates as soon as possible, and seek medical attention!"), enum_1.RecommendationErrorEnum.SevereHypoglycemia);
18
+ exports.TimeoutLimitError = new RecommendationError(i18nUtils_1.i18n._("More than 15 minutes has passed since this calculation was started.\nPlease go through the calculation steps with new measurements to ensure a safe recommendation."), enum_1.RecommendationErrorEnum.TimeoutLimit);
@@ -26,3 +26,15 @@ export const InsulinLimitError = new RecommendationError(
26
26
  i18n._("Insulin limit reached, for your safety Hedia will not recommend more than this."),
27
27
  RecommendationErrorEnum.InsulinLimit,
28
28
  );
29
+ export const SevereHypoglycemiaError = new RecommendationError(
30
+ i18n._(
31
+ "CRITICALLY low blood glucose levels!\nPlease take glucagon if possible or consume carbohydrates as soon as possible, and seek medical attention!",
32
+ ),
33
+ RecommendationErrorEnum.SevereHypoglycemia,
34
+ );
35
+ export const TimeoutLimitError = new RecommendationError(
36
+ i18n._(
37
+ "More than 15 minutes has passed since this calculation was started.\nPlease go through the calculation steps with new measurements to ensure a safe recommendation.",
38
+ ),
39
+ RecommendationErrorEnum.TimeoutLimit,
40
+ );
File without changes
File without changes
File without changes