@abihealth/goapp-react-native 1.17.0 → 1.18.1

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 (36) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/common/assets/ChevronIcon.d.ts +6 -0
  3. package/dist/common/assets/ChevronIcon.js +43 -0
  4. package/dist/common/assets/ChevronIcon.tsx +12 -0
  5. package/dist/common/assets/SearchGlassIcon.d.ts +3 -0
  6. package/dist/common/assets/SearchGlassIcon.js +48 -0
  7. package/dist/common/assets/SearchGlassIcon.tsx +19 -0
  8. package/dist/common/components/AnswerScreen/PrescriptionCard/index.js +1 -1
  9. package/dist/common/icons/CloseIcon.d.ts +3 -1
  10. package/dist/common/icons/CloseIcon.js +2 -2
  11. package/dist/common/screens/AnswerScreen.js +2 -1
  12. package/dist/form-prescriptions/api/prescription.d.ts +3 -1
  13. package/dist/form-prescriptions/api/prescription.js +6 -1
  14. package/dist/form-prescriptions/components/FormPrescription.js +0 -2
  15. package/dist/form-prescriptions/components/IndicationCategory.d.ts +3 -0
  16. package/dist/form-prescriptions/components/IndicationCategory.js +75 -0
  17. package/dist/form-prescriptions/components/IndicationSurveyButton.d.ts +1 -1
  18. package/dist/form-prescriptions/components/IndicationSurveyButton.js +10 -8
  19. package/dist/form-prescriptions/components/Questionnaire/QuestionnaireQuestion/OpenEnded.js +1 -1
  20. package/dist/form-prescriptions/components/Questionnaire/QuestionnaireQuestion/SingleChoice.js +3 -3
  21. package/dist/form-prescriptions/components/SearchableDropdown.d.ts +90 -0
  22. package/dist/form-prescriptions/components/SearchableDropdown.js +212 -0
  23. package/dist/form-prescriptions/contexts/IndicationSurveyContext.js +6 -0
  24. package/dist/form-prescriptions/hooks/useIndicationSurvey.d.ts +3 -2
  25. package/dist/form-prescriptions/hooks/useIndicationSurvey.js +9 -1
  26. package/dist/form-prescriptions/mocks/indication-survey.d.ts +2 -2
  27. package/dist/form-prescriptions/mocks/indication-survey.js +44 -44
  28. package/dist/form-prescriptions/screens/HomeScreen.js +18 -33
  29. package/dist/form-prescriptions/types/indications.d.ts +2 -2
  30. package/dist/index.d.ts +5 -3
  31. package/dist/index.js +7 -3
  32. package/dist/video-consultations/screens/DeliveryAddressScreen.js +1 -2
  33. package/dist/video-consultations/screens/ProcessingPrescriptionScreen.js +3 -2
  34. package/package.json +13 -13
  35. package/dist/common/api/models/common.d.ts +0 -3
  36. package/dist/common/api/models/common.js +0 -2
@@ -0,0 +1,212 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ var __importDefault = (this && this.__importDefault) || function (mod) {
47
+ return (mod && mod.__esModule) ? mod : { "default": mod };
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.getStyles = exports.SearchableDropDown = void 0;
51
+ var SearchGlassIcon_1 = __importDefault(require("../../common/assets/SearchGlassIcon"));
52
+ var Modal_1 = require("../../common/components/Modal");
53
+ var ModalHeader_1 = require("../../common/components/Modal/ModalHeader");
54
+ var useTheme_1 = require("../../common/hooks/useTheme");
55
+ var CloseIcon_1 = require("../../common/icons/CloseIcon");
56
+ var DropdownIcon_1 = __importDefault(require("../../common/icons/DropdownIcon"));
57
+ var platform_1 = require("../../common/utils/platform");
58
+ var useIndicationSurvey_1 = require("../hooks/useIndicationSurvey");
59
+ var react_1 = __importStar(require("react"));
60
+ var react_i18next_1 = require("react-i18next");
61
+ var react_native_1 = require("react-native");
62
+ var SearchableDropDown = function (props) {
63
+ var _a = props.items, items = _a === void 0 ? [] : _a, defaultIndex = props.defaultIndex, _b = props.placeholder, placeholder = _b === void 0 ? 'Search...' : _b, placeholderTextColor = props.placeholderTextColor, _c = props.underlineColorAndroid, underlineColorAndroid = _c === void 0 ? 'transparent' : _c, onTextChange = props.onTextChange, onItemSelect = props.onItemSelect, onFocus = props.onFocus;
64
+ var t = (0, react_i18next_1.useTranslation)().t;
65
+ var theme = (0, useTheme_1.useTheme)();
66
+ var styles = (0, exports.getStyles)(theme);
67
+ var onSelectIndication = (0, useIndicationSurvey_1.useIndicationSurvey)().onSelectIndication;
68
+ var inputRef = (0, react_1.useRef)(null);
69
+ var _d = (0, react_1.useState)(), item = _d[0], setItem = _d[1];
70
+ var _e = (0, react_1.useState)(items), listItems = _e[0], setListItems = _e[1];
71
+ var _f = (0, react_1.useState)(false), focus = _f[0], setFocus = _f[1];
72
+ var _g = (0, react_1.useState)(''), searchTerm = _g[0], setSearchTerm = _g[1];
73
+ (0, react_1.useEffect)(function () {
74
+ setListItems(items === null || items === void 0 ? void 0 : items.filter(function (item) { var _a; return (_a = item === null || item === void 0 ? void 0 : item.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm === null || searchTerm === void 0 ? void 0 : searchTerm.toLowerCase()); }));
75
+ onTextChange === null || onTextChange === void 0 ? void 0 : onTextChange(searchTerm);
76
+ }, [searchTerm, items]);
77
+ var searchItems = function (searchText) {
78
+ setSearchTerm(searchText);
79
+ };
80
+ (0, react_1.useEffect)(function () {
81
+ setListItems(items);
82
+ }, [items]);
83
+ (0, react_1.useEffect)(function () {
84
+ onItemSelect === null || onItemSelect === void 0 ? void 0 : onItemSelect(item === null || item === void 0 ? void 0 : item.value);
85
+ }, [item]);
86
+ var renderItem = function (_a) {
87
+ var item = _a.item;
88
+ return (<react_native_1.TouchableOpacity style={styles.itemContainer} onPress={function () {
89
+ setFocus(false);
90
+ setItem(item);
91
+ if (inputRef.current)
92
+ inputRef.current.clear();
93
+ react_native_1.Keyboard.dismiss();
94
+ onSelectIndication(item.value);
95
+ }}>
96
+ <react_native_1.Text style={styles.itemText}>{item.label}</react_native_1.Text>
97
+ <react_native_1.Text style={styles.itemCategory}>{item.category}</react_native_1.Text>
98
+ </react_native_1.TouchableOpacity>);
99
+ };
100
+ return (<>
101
+ <react_native_1.TouchableOpacity style={styles.wrapperContainer} onPress={function () {
102
+ setFocus(true);
103
+ setTimeout(function () {
104
+ var _a;
105
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
106
+ }, 500);
107
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus();
108
+ }}>
109
+ <SearchGlassIcon_1.default />
110
+ <react_native_1.Text style={[styles.input, { color: (item === null || item === void 0 ? void 0 : item.label) ? theme.palette.black : placeholderTextColor }]}>{(item === null || item === void 0 ? void 0 : item.label) || placeholder}</react_native_1.Text>
111
+ <DropdownIcon_1.default />
112
+ </react_native_1.TouchableOpacity>
113
+
114
+ <Modal_1.Modal visible={focus} onRequestClose={function () {
115
+ if (inputRef.current)
116
+ inputRef.current.clear();
117
+ setFocus(false);
118
+ }} modalStyle={styles.modal}>
119
+ <ModalHeader_1.ModalHeader title={t('prescription.categories.searchbar')} onCancel={function () { return setFocus(false); }}/>
120
+ <react_native_1.View style={styles.modalContent}>
121
+ <react_native_1.View style={styles.wrapperContainer}>
122
+ <SearchGlassIcon_1.default />
123
+ <react_native_1.TextInput underlineColorAndroid={underlineColorAndroid} maxLength={80} ref={inputRef} onFocus={function () { return setFocus(true); }} onChangeText={searchItems} style={styles.input} placeholderTextColor={placeholderTextColor} placeholder={placeholder}/>
124
+ <react_native_1.TouchableOpacity onPress={function () {
125
+ var _a;
126
+ setSearchTerm('');
127
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.clear();
128
+ }}>
129
+ <CloseIcon_1.CloseIcon color={theme.palette.black} width={12} height={12}/>
130
+ </react_native_1.TouchableOpacity>
131
+ </react_native_1.View>
132
+
133
+ {(listItems === null || listItems === void 0 ? void 0 : listItems.length) > 0 ? (<react_native_1.FlatList keyboardShouldPersistTaps="always" showsVerticalScrollIndicator={true} data={listItems} keyExtractor={function (item) { return item.value; }} renderItem={renderItem} style={[styles.listContainer, platform_1.isWeb && { maxHeight: 360 }]} persistentScrollbar scrollEnabled={true}/>) : (<react_native_1.View style={styles.notFoundContainer}>
134
+ <react_native_1.Text style={[styles.itemText, styles.center]}>{t('prescription.categories.no_results.title')}</react_native_1.Text>
135
+ <react_native_1.Text style={[styles.itemCategory, styles.center]}>{t('prescription.categories.no_results.description')}</react_native_1.Text>
136
+ </react_native_1.View>)}
137
+ </react_native_1.View>
138
+ </Modal_1.Modal>
139
+ </>);
140
+ };
141
+ exports.SearchableDropDown = SearchableDropDown;
142
+ var getStyles = function (_a) {
143
+ var palette = _a.palette, spacing = _a.spacing, font = _a.font, borderRadius = _a.borderRadius;
144
+ return react_native_1.StyleSheet.create({
145
+ listContainer: {
146
+ backgroundColor: palette.white,
147
+ width: '100%',
148
+ paddingHorizontal: spacing.sm,
149
+ borderRadius: borderRadius.md,
150
+ flex: 1,
151
+ minHeight: 75
152
+ },
153
+ itemContainer: {
154
+ width: '100%',
155
+ justifyContent: 'center',
156
+ alignSelf: 'center',
157
+ borderBottomWidth: 1,
158
+ borderBottomColor: palette.grey.light,
159
+ paddingVertical: spacing.md,
160
+ gap: spacing.xxs
161
+ },
162
+ notFoundContainer: {
163
+ backgroundColor: palette.white,
164
+ borderRadius: borderRadius.md,
165
+ padding: spacing.md
166
+ },
167
+ itemText: {
168
+ color: palette.black,
169
+ fontSize: font.base.size,
170
+ fontWeight: 'bold'
171
+ },
172
+ itemCategory: {
173
+ color: palette.grey.dark,
174
+ fontSize: font.sm.size,
175
+ paddingLeft: spacing.sm
176
+ },
177
+ modal: {
178
+ height: '80%',
179
+ backgroundColor: palette.grey.light
180
+ },
181
+ modalContent: {
182
+ padding: spacing.sm,
183
+ gap: spacing.sm,
184
+ flex: 1
185
+ },
186
+ wrapperContainer: {
187
+ backgroundColor: palette.white,
188
+ flexDirection: 'row',
189
+ alignItems: 'center',
190
+ height: 54,
191
+ width: '100%',
192
+ borderColor: palette.grey.base,
193
+ borderWidth: 1,
194
+ borderRadius: borderRadius.md,
195
+ padding: spacing.sm,
196
+ marginBottom: spacing.sm,
197
+ flex: 1,
198
+ minHeight: 54,
199
+ maxHeight: 54,
200
+ justifyContent: 'space-between'
201
+ },
202
+ input: __assign({ flex: 1, borderWidth: 0, paddingHorizontal: spacing.sm, fontSize: font.base.size, color: palette.black }, react_native_1.Platform.select({
203
+ web: {
204
+ outlineWidth: 0
205
+ }
206
+ })),
207
+ center: {
208
+ textAlign: 'center'
209
+ }
210
+ });
211
+ };
212
+ exports.getStyles = getStyles;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IndicationSurveyProvider = exports.IndicationSurveyContext = void 0;
4
4
  var useTranslation_1 = require("../../common/hooks/useTranslation");
5
+ var prescription_1 = require("../api/prescription");
5
6
  var indication_survey_1 = require("../mocks/indication-survey");
6
7
  var screens_1 = require("../types/screens");
7
8
  var react_1 = require("react");
@@ -27,6 +28,11 @@ var IndicationSurveyProvider = function (_a) {
27
28
  var _d = (0, react_1.useState)(1), questionnaireStep = _d[0], setQuestionnaireStep = _d[1];
28
29
  var _e = (0, react_1.useState)(indication_survey_1.INDICATION_SURVEY_MOCK), indicationSurvey = _e[0], setIndicationSurvey = _e[1]; // TODO: remove mock when merged with HOME screen
29
30
  var _f = (0, react_1.useState)(null), indicationSurveyAnswers = _f[0], setIndicationSurveyAnswers = _f[1];
31
+ (0, react_1.useEffect)(function () {
32
+ (0, prescription_1.getIndicationSurveyList)().then(function (response) {
33
+ setIndicationCategories(response);
34
+ });
35
+ }, []);
30
36
  (0, react_1.useEffect)(function () {
31
37
  if (!indicationSurvey)
32
38
  return setIndicationSurveyAnswers(null);
@@ -1,6 +1,6 @@
1
1
  export declare const useIndicationSurvey: () => {
2
- indicationCategories: import("../..").IndicationCategory[];
3
- setIndicationCategories: import("react").Dispatch<import("react").SetStateAction<import("../..").IndicationCategory[]>>;
2
+ indicationCategories: import("../..").IndicationCategoryType[];
3
+ setIndicationCategories: import("react").Dispatch<import("react").SetStateAction<import("../..").IndicationCategoryType[]>>;
4
4
  questionnaireStep: number;
5
5
  nextStep: () => void;
6
6
  previousStep: () => void;
@@ -8,4 +8,5 @@ export declare const useIndicationSurvey: () => {
8
8
  setIndicationSurvey: import("react").Dispatch<import("react").SetStateAction<import("../types/indications").IndicationSurveyQuestions>>;
9
9
  currentQuestion: import("../types/indications").IndicationQuestion;
10
10
  resetIndicationSurvey: () => void;
11
+ onSelectIndication: (indicationId: string) => void;
11
12
  };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useIndicationSurvey = void 0;
4
+ var prescription_1 = require("../api/prescription");
4
5
  var IndicationSurveyContext_1 = require("../contexts/IndicationSurveyContext");
5
6
  var screens_1 = require("../types/screens");
6
7
  var react_1 = require("react");
@@ -26,6 +27,12 @@ var useIndicationSurvey = function () {
26
27
  removeLastAnswer();
27
28
  setQuestionnaireStep(function (prev) { return prev - 1; });
28
29
  };
30
+ var onSelectIndication = function (indicationId) {
31
+ (0, prescription_1.getIndicationSurvey)(indicationId).then(function (response) {
32
+ setIndicationSurvey(response);
33
+ setCurrentScreen(screens_1.FORM_PRESCRIPTION_SCREENS.QUESTIONNAIRE);
34
+ });
35
+ };
29
36
  return {
30
37
  indicationCategories: indicationCategories,
31
38
  setIndicationCategories: setIndicationCategories,
@@ -35,7 +42,8 @@ var useIndicationSurvey = function () {
35
42
  indicationSurvey: indicationSurvey,
36
43
  setIndicationSurvey: setIndicationSurvey,
37
44
  currentQuestion: currentQuestion,
38
- resetIndicationSurvey: resetIndicationSurvey
45
+ resetIndicationSurvey: resetIndicationSurvey,
46
+ onSelectIndication: onSelectIndication
39
47
  };
40
48
  };
41
49
  exports.useIndicationSurvey = useIndicationSurvey;
@@ -10,8 +10,8 @@ export declare const INDICATION_SURVEY_MOCK: {
10
10
  order: number;
11
11
  answers: {
12
12
  id: number;
13
- titleKey: any;
14
- text: string;
13
+ key: any;
14
+ value: string;
15
15
  indicationSurveyQuestionId: number;
16
16
  isExitLogic: boolean;
17
17
  order: number;
@@ -15,16 +15,16 @@ exports.INDICATION_SURVEY_MOCK = {
15
15
  answers: [
16
16
  {
17
17
  id: 107,
18
- titleKey: null,
19
- text: 'choice.yes',
18
+ key: null,
19
+ value: 'choice.yes',
20
20
  indicationSurveyQuestionId: 98,
21
21
  isExitLogic: false,
22
22
  order: 1
23
23
  },
24
24
  {
25
25
  id: 127,
26
- titleKey: null,
27
- text: 'choice.no',
26
+ key: null,
27
+ value: 'choice.no',
28
28
  indicationSurveyQuestionId: 98,
29
29
  isExitLogic: true,
30
30
  order: 2
@@ -40,16 +40,16 @@ exports.INDICATION_SURVEY_MOCK = {
40
40
  answers: [
41
41
  {
42
42
  id: 147,
43
- titleKey: null,
44
- text: 'choice.yes',
43
+ key: null,
44
+ value: 'choice.yes',
45
45
  indicationSurveyQuestionId: 117,
46
46
  isExitLogic: true,
47
47
  order: 1
48
48
  },
49
49
  {
50
50
  id: 164,
51
- titleKey: null,
52
- text: 'choice.no',
51
+ key: null,
52
+ value: 'choice.no',
53
53
  indicationSurveyQuestionId: 117,
54
54
  isExitLogic: false,
55
55
  order: 2
@@ -65,16 +65,16 @@ exports.INDICATION_SURVEY_MOCK = {
65
65
  answers: [
66
66
  {
67
67
  id: 185,
68
- titleKey: null,
69
- text: 'choice.yes',
68
+ key: null,
69
+ value: 'choice.yes',
70
70
  indicationSurveyQuestionId: 138,
71
71
  isExitLogic: true,
72
72
  order: 1
73
73
  },
74
74
  {
75
75
  id: 196,
76
- titleKey: null,
77
- text: 'choice.no',
76
+ key: null,
77
+ value: 'choice.no',
78
78
  indicationSurveyQuestionId: 138,
79
79
  isExitLogic: false,
80
80
  order: 2
@@ -90,16 +90,16 @@ exports.INDICATION_SURVEY_MOCK = {
90
90
  answers: [
91
91
  {
92
92
  id: 218,
93
- titleKey: null,
94
- text: 'choice.yes',
93
+ key: null,
94
+ value: 'choice.yes',
95
95
  indicationSurveyQuestionId: 170,
96
96
  isExitLogic: true,
97
97
  order: 1
98
98
  },
99
99
  {
100
100
  id: 235,
101
- titleKey: null,
102
- text: 'choice.no',
101
+ key: null,
102
+ value: 'choice.no',
103
103
  indicationSurveyQuestionId: 170,
104
104
  isExitLogic: false,
105
105
  order: 2
@@ -115,16 +115,16 @@ exports.INDICATION_SURVEY_MOCK = {
115
115
  answers: [
116
116
  {
117
117
  id: 252,
118
- titleKey: null,
119
- text: 'choice.yes',
118
+ key: null,
119
+ value: 'choice.yes',
120
120
  indicationSurveyQuestionId: 189,
121
121
  isExitLogic: true,
122
122
  order: 1
123
123
  },
124
124
  {
125
125
  id: 272,
126
- titleKey: null,
127
- text: 'choice.no',
126
+ key: null,
127
+ value: 'choice.no',
128
128
  indicationSurveyQuestionId: 189,
129
129
  isExitLogic: false,
130
130
  order: 2
@@ -140,16 +140,16 @@ exports.INDICATION_SURVEY_MOCK = {
140
140
  answers: [
141
141
  {
142
142
  id: 288,
143
- titleKey: null,
144
- text: 'choice.yes',
143
+ key: null,
144
+ value: 'choice.yes',
145
145
  indicationSurveyQuestionId: 210,
146
146
  isExitLogic: true,
147
147
  order: 1
148
148
  },
149
149
  {
150
150
  id: 302,
151
- titleKey: null,
152
- text: 'choice.no',
151
+ key: null,
152
+ value: 'choice.no',
153
153
  indicationSurveyQuestionId: 210,
154
154
  isExitLogic: false,
155
155
  order: 2
@@ -165,16 +165,16 @@ exports.INDICATION_SURVEY_MOCK = {
165
165
  answers: [
166
166
  {
167
167
  id: 323,
168
- titleKey: null,
169
- text: 'choice.yes',
168
+ key: null,
169
+ value: 'choice.yes',
170
170
  indicationSurveyQuestionId: 229,
171
171
  isExitLogic: true,
172
172
  order: 1
173
173
  },
174
174
  {
175
175
  id: 331,
176
- titleKey: null,
177
- text: 'choice.no',
176
+ key: null,
177
+ value: 'choice.no',
178
178
  indicationSurveyQuestionId: 229,
179
179
  isExitLogic: false,
180
180
  order: 2
@@ -190,16 +190,16 @@ exports.INDICATION_SURVEY_MOCK = {
190
190
  answers: [
191
191
  {
192
192
  id: 355,
193
- titleKey: null,
194
- text: 'choice.yes',
193
+ key: null,
194
+ value: 'choice.yes',
195
195
  indicationSurveyQuestionId: 250,
196
196
  isExitLogic: true,
197
197
  order: 1
198
198
  },
199
199
  {
200
200
  id: 361,
201
- titleKey: null,
202
- text: 'choice.no',
201
+ key: null,
202
+ value: 'choice.no',
203
203
  indicationSurveyQuestionId: 250,
204
204
  isExitLogic: false,
205
205
  order: 2
@@ -223,16 +223,16 @@ exports.INDICATION_SURVEY_MOCK = {
223
223
  answers: [
224
224
  {
225
225
  id: 600,
226
- titleKey: null,
227
- text: 'choice.understand_agree',
226
+ key: null,
227
+ value: 'choice.understand_agree',
228
228
  indicationSurveyQuestionId: 459,
229
229
  isExitLogic: false,
230
230
  order: 1
231
231
  },
232
232
  {
233
233
  id: 601,
234
- titleKey: null,
235
- text: 'choice.not_understand_not_agree',
234
+ key: null,
235
+ value: 'choice.not_understand_not_agree',
236
236
  indicationSurveyQuestionId: 459,
237
237
  isExitLogic: true,
238
238
  order: 2
@@ -248,16 +248,16 @@ exports.INDICATION_SURVEY_MOCK = {
248
248
  answers: [
249
249
  {
250
250
  id: 608,
251
- titleKey: null,
252
- text: 'choice.understand_agree',
251
+ key: null,
252
+ value: 'choice.understand_agree',
253
253
  indicationSurveyQuestionId: 470,
254
254
  isExitLogic: false,
255
255
  order: 1
256
256
  },
257
257
  {
258
258
  id: 609,
259
- titleKey: null,
260
- text: 'choice.not_understand_not_agree',
259
+ key: null,
260
+ value: 'choice.not_understand_not_agree',
261
261
  indicationSurveyQuestionId: 470,
262
262
  isExitLogic: true,
263
263
  order: 2
@@ -273,16 +273,16 @@ exports.INDICATION_SURVEY_MOCK = {
273
273
  answers: [
274
274
  {
275
275
  id: 611,
276
- titleKey: null,
277
- text: 'choice.understand_agree',
276
+ key: null,
277
+ value: 'choice.understand_agree',
278
278
  indicationSurveyQuestionId: 475,
279
279
  isExitLogic: false,
280
280
  order: 1
281
281
  },
282
282
  {
283
283
  id: 613,
284
- titleKey: null,
285
- text: 'choice.not_understand_not_agree',
284
+ key: null,
285
+ value: 'choice.not_understand_not_agree',
286
286
  indicationSurveyQuestionId: 475,
287
287
  isExitLogic: true,
288
288
  order: 2
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
10
7
  }
11
- return t;
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
12
10
  };
13
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -19,7 +17,9 @@ var Header_1 = require("../../common/components/Header");
19
17
  var ScreenWrapper_1 = require("../../common/components/ScreenWrapper");
20
18
  var useTheme_1 = require("../../common/hooks/useTheme");
21
19
  var useTranslation_1 = require("../../common/hooks/useTranslation");
22
- var IndicationSurveyButton_1 = __importDefault(require("../components/IndicationSurveyButton"));
20
+ var IndicationCategory_1 = __importDefault(require("../components/IndicationCategory"));
21
+ var SearchableDropdown_1 = require("../components/SearchableDropdown");
22
+ var useIndicationSurvey_1 = require("../hooks/useIndicationSurvey");
23
23
  var FormPrescriptionIcon_1 = require("../icons/FormPrescriptionIcon");
24
24
  var react_1 = __importDefault(require("react"));
25
25
  var react_native_1 = require("react-native");
@@ -27,30 +27,15 @@ var HomeScreen = function () {
27
27
  var t = (0, useTranslation_1.useTranslation)().t;
28
28
  var theme = (0, useTheme_1.useTheme)();
29
29
  var styles = getStyles(theme);
30
+ var indicationCategories = (0, useIndicationSurvey_1.useIndicationSurvey)().indicationCategories;
31
+ var searchableItems = indicationCategories.reduce(function (acc, indicationCategory) { return __spreadArray(__spreadArray([], acc, true), indicationCategory.indications.map(function (indication) { return ({
32
+ label: indication.textKey,
33
+ value: indication.id,
34
+ category: indicationCategory.textKey
35
+ }); }), true); }, []);
30
36
  return (<ScreenWrapper_1.ScreenWrapper header={<Header_1.Header title={t('general.consultation.prescriptionRequest.title')} leftIcon={<FormPrescriptionIcon_1.FormPrescriptionIcon />}/>} containerStyle={styles.container}>
31
- {[
32
- {
33
- id: 13,
34
- textKey: 'indication.title.314316147',
35
- iconUrl: 'https://assets.abi.ai/indication-surveys/acid-reflux-icon.svg',
36
- order: 1
37
- },
38
- {
39
- id: 14,
40
- textKey: 'indication.title.314316009',
41
- iconUrl: 'https://assets.abi.ai/indication-surveys/acid-reflux-icon.svg',
42
- order: 2
43
- },
44
- {
45
- id: 15,
46
- textKey: 'indication.title.314315777',
47
- iconUrl: 'https://assets.abi.ai/indication-surveys/acid-reflux-icon.svg',
48
- order: 3
49
- }
50
- ].map(function (_a) {
51
- var id = _a.id, indicationSurvey = __rest(_a, ["id"]);
52
- return (<IndicationSurveyButton_1.default key={id} id={id} {...indicationSurvey}/>);
53
- })}
37
+ <SearchableDropdown_1.SearchableDropDown items={searchableItems} placeholder={t('prescription.categories.searchbar')}/>
38
+ {indicationCategories.map(function (indicationCategory) { return (<IndicationCategory_1.default key={indicationCategory.id} {...indicationCategory}/>); })}
54
39
  </ScreenWrapper_1.ScreenWrapper>);
55
40
  };
56
41
  exports.HomeScreen = HomeScreen;
@@ -1,7 +1,7 @@
1
1
  export interface IndicationQuestionAnswerOption {
2
2
  id: number;
3
- titleKey: null;
4
- text: string;
3
+ key: string | null;
4
+ value: string;
5
5
  indicationSurveyQuestionId: number;
6
6
  isExitLogic: boolean;
7
7
  order: number;
package/dist/index.d.ts CHANGED
@@ -52,9 +52,11 @@ import { Theme } from './common/types/theme';
52
52
  import { isAndroid, isIOS } from './common/utils/platform';
53
53
  import { getProfessionalLabel } from './common/utils/professional';
54
54
  import { requiredCheckbox, requiredString, validPhone } from './common/utils/zod';
55
- import { IndicationCategory } from './form-prescriptions/api/models/prescription';
55
+ import { IndicationCategory as IndicationCategoryType } from './form-prescriptions/api/models/prescription';
56
56
  import { FormPrescription } from './form-prescriptions/components/FormPrescription';
57
- import { HomeScreen } from './form-prescriptions/screens/HomeScreen';
57
+ import { IndicationCategory } from './form-prescriptions/components/IndicationCategory';
58
+ import { SearchableDropDown } from './form-prescriptions/components/SearchableDropdown';
59
+ import { HomeScreen as PrescriptionHomeScreen } from './form-prescriptions/screens/HomeScreen';
58
60
  import { CallingAnimation } from './video-consultations/animations/CallingAnimation';
59
61
  import AgoraWrapper from './video-consultations/components/AgoraWrapper';
60
62
  import { EndVideoCallModal } from './video-consultations/components/Modal/EndVideoCallModal';
@@ -66,4 +68,4 @@ import { JoinVideoCallScreen } from './video-consultations/screens/JoinVideoCall
66
68
  import { ProcessingPrescriptionScreen } from './video-consultations/screens/ProcessingPrescriptionScreen';
67
69
  import VideoCallScreen from './video-consultations/screens/VideoCallScreen';
68
70
  export { AbiLogoIcon, AgoraWrapper, Animation, AnswerScreen, AttachmentPreviewModal, authorization, BackArrowIcon, BackgroundPattern, Button, CallingAnimation, CancelConsultationButton, CancelModal, Card, CASE_TYPE, Checkbox, CloseConsultationModal, CloseIcon, Consultation, CONSULTATION_STATUS, // TODO check this after last refactor
69
- ConsultationProvider, DateInput, DeliveryAddressScreen, DoctorIcon, DoctorProfileCard, DoctorProfileModal, EndingVideoScreen, EndVideoCallModal, FadeIn, FindingAnimation, FormPrescription, FormWrapper, getProfessionalLabel, Header, HKDeliveryAddressSchema, HomeScreen, HorizontalLoadingAnimation, IndicationCategory, InfoIcon, Input, isAndroid, isIOS, JoinVideoCallScreen, License, LoadingCircleAnimation, LoadingDotsAnimation, MatchingScreen, MatchScreen, Modal, NoConsultationFoundScreen, PhoneInput, PlaneIcon, PreparingSummaryScreen, Prescription, PRESCRIPTION_STATUS, ProcessingPrescriptionScreen, Professional, Question, QuestionType, RatingScreen, Reminder, requiredCheckbox, requiredString, ScreenWrapper, Select, Slide, Text, TextConsultationIcon, Theme, TwoOptionsModal, useConsultation, useTheme, useTranslation, validPhone, VideoCallScreen, VideoConsultation, VideoConsultationIcon };
71
+ ConsultationProvider, DateInput, DeliveryAddressScreen, DoctorIcon, DoctorProfileCard, DoctorProfileModal, EndingVideoScreen, EndVideoCallModal, FadeIn, FindingAnimation, FormPrescription, FormWrapper, getProfessionalLabel, Header, HKDeliveryAddressSchema, HorizontalLoadingAnimation, IndicationCategory, IndicationCategoryType, InfoIcon, Input, isAndroid, isIOS, JoinVideoCallScreen, License, LoadingCircleAnimation, LoadingDotsAnimation, MatchingScreen, MatchScreen, Modal, NoConsultationFoundScreen, PhoneInput, PlaneIcon, PreparingSummaryScreen, Prescription, PRESCRIPTION_STATUS, PrescriptionHomeScreen, ProcessingPrescriptionScreen, Professional, Question, QuestionType, RatingScreen, Reminder, requiredCheckbox, requiredString, ScreenWrapper, SearchableDropDown, Select, Slide, Text, TextConsultationIcon, Theme, TwoOptionsModal, useConsultation, useTheme, useTranslation, validPhone, VideoCallScreen, VideoConsultation, VideoConsultationIcon };
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PRESCRIPTION_STATUS = exports.PreparingSummaryScreen = exports.PlaneIcon = exports.PhoneInput = exports.NoConsultationFoundScreen = exports.Modal = exports.MatchScreen = exports.MatchingScreen = exports.LoadingDotsAnimation = exports.LoadingCircleAnimation = exports.JoinVideoCallScreen = exports.isIOS = exports.isAndroid = exports.Input = exports.InfoIcon = exports.HorizontalLoadingAnimation = exports.HomeScreen = exports.HKDeliveryAddressSchema = exports.Header = exports.getProfessionalLabel = exports.FormWrapper = exports.FormPrescription = exports.FindingAnimation = exports.FadeIn = exports.EndVideoCallModal = exports.EndingVideoScreen = exports.DoctorProfileModal = exports.DoctorProfileCard = exports.DoctorIcon = exports.DeliveryAddressScreen = exports.DateInput = exports.ConsultationProvider = exports.CONSULTATION_STATUS = exports.CloseIcon = exports.CloseConsultationModal = exports.Checkbox = exports.CASE_TYPE = exports.Card = exports.CancelModal = exports.CancelConsultationButton = exports.CallingAnimation = exports.Button = exports.BackgroundPattern = exports.BackArrowIcon = exports.authorization = exports.AttachmentPreviewModal = exports.AnswerScreen = exports.Animation = exports.AgoraWrapper = exports.AbiLogoIcon = void 0;
7
- exports.VideoConsultationIcon = exports.VideoConsultation = exports.VideoCallScreen = exports.validPhone = exports.useTranslation = exports.useTheme = exports.useConsultation = exports.TwoOptionsModal = exports.TextConsultationIcon = exports.Text = exports.Slide = exports.Select = exports.ScreenWrapper = exports.requiredString = exports.requiredCheckbox = exports.Reminder = exports.RatingScreen = exports.QuestionType = exports.ProcessingPrescriptionScreen = void 0;
6
+ exports.PRESCRIPTION_STATUS = exports.PreparingSummaryScreen = exports.PlaneIcon = exports.PhoneInput = exports.NoConsultationFoundScreen = exports.Modal = exports.MatchScreen = exports.MatchingScreen = exports.LoadingDotsAnimation = exports.LoadingCircleAnimation = exports.JoinVideoCallScreen = exports.isIOS = exports.isAndroid = exports.Input = exports.InfoIcon = exports.IndicationCategory = exports.HorizontalLoadingAnimation = exports.HKDeliveryAddressSchema = exports.Header = exports.getProfessionalLabel = exports.FormWrapper = exports.FormPrescription = exports.FindingAnimation = exports.FadeIn = exports.EndVideoCallModal = exports.EndingVideoScreen = exports.DoctorProfileModal = exports.DoctorProfileCard = exports.DoctorIcon = exports.DeliveryAddressScreen = exports.DateInput = exports.ConsultationProvider = exports.CONSULTATION_STATUS = exports.CloseIcon = exports.CloseConsultationModal = exports.Checkbox = exports.CASE_TYPE = exports.Card = exports.CancelModal = exports.CancelConsultationButton = exports.CallingAnimation = exports.Button = exports.BackgroundPattern = exports.BackArrowIcon = exports.authorization = exports.AttachmentPreviewModal = exports.AnswerScreen = exports.Animation = exports.AgoraWrapper = exports.AbiLogoIcon = void 0;
7
+ exports.VideoConsultationIcon = exports.VideoConsultation = exports.VideoCallScreen = exports.validPhone = exports.useTranslation = exports.useTheme = exports.useConsultation = exports.TwoOptionsModal = exports.TextConsultationIcon = exports.Text = exports.Slide = exports.Select = exports.SearchableDropDown = exports.ScreenWrapper = exports.requiredString = exports.requiredCheckbox = exports.Reminder = exports.RatingScreen = exports.QuestionType = exports.ProcessingPrescriptionScreen = exports.PrescriptionHomeScreen = void 0;
8
8
  var Animation_1 = require("./common/animations/Animation");
9
9
  Object.defineProperty(exports, "Animation", { enumerable: true, get: function () { return Animation_1.Animation; } });
10
10
  var FindingAnimation_1 = require("./common/animations/FindingAnimation");
@@ -116,8 +116,12 @@ Object.defineProperty(exports, "requiredString", { enumerable: true, get: functi
116
116
  Object.defineProperty(exports, "validPhone", { enumerable: true, get: function () { return zod_1.validPhone; } });
117
117
  var FormPrescription_1 = require("./form-prescriptions/components/FormPrescription");
118
118
  Object.defineProperty(exports, "FormPrescription", { enumerable: true, get: function () { return FormPrescription_1.FormPrescription; } });
119
+ var IndicationCategory_1 = require("./form-prescriptions/components/IndicationCategory");
120
+ Object.defineProperty(exports, "IndicationCategory", { enumerable: true, get: function () { return IndicationCategory_1.IndicationCategory; } });
121
+ var SearchableDropdown_1 = require("./form-prescriptions/components/SearchableDropdown");
122
+ Object.defineProperty(exports, "SearchableDropDown", { enumerable: true, get: function () { return SearchableDropdown_1.SearchableDropDown; } });
119
123
  var HomeScreen_1 = require("./form-prescriptions/screens/HomeScreen");
120
- Object.defineProperty(exports, "HomeScreen", { enumerable: true, get: function () { return HomeScreen_1.HomeScreen; } });
124
+ Object.defineProperty(exports, "PrescriptionHomeScreen", { enumerable: true, get: function () { return HomeScreen_1.HomeScreen; } });
121
125
  var CallingAnimation_1 = require("./video-consultations/animations/CallingAnimation");
122
126
  Object.defineProperty(exports, "CallingAnimation", { enumerable: true, get: function () { return CallingAnimation_1.CallingAnimation; } });
123
127
  var AgoraWrapper_1 = __importDefault(require("./video-consultations/components/AgoraWrapper"));