@abihealth/goapp-react-native 1.17.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +12 -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/package.json +13 -13
  34. package/dist/common/api/models/common.d.ts +0 -3
  35. package/dist/common/api/models/common.js +0 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.18.0](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.17.0...goapp-react-native-v1.18.0) (2025-03-19)
4
+
5
+
6
+ ### Features
7
+
8
+ * Add indication survey and searchable dropdown features ([#139](https://github.com/abiglobalhealth/react-native-sdk/issues/139)) ([782b022](https://github.com/abiglobalhealth/react-native-sdk/commit/782b022ce2d693c3746c2635120b03a02a56c13f))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * answer screen theme in prescription card ([#145](https://github.com/abiglobalhealth/react-native-sdk/issues/145)) ([0f321a1](https://github.com/abiglobalhealth/react-native-sdk/commit/0f321a12ebb693c4e1c29c824a76c1b260524ad3))
14
+
3
15
  ## [1.17.0](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.16.0...goapp-react-native-v1.17.0) (2025-03-18)
4
16
 
5
17
 
@@ -0,0 +1,6 @@
1
+ import { ColorValue, ViewStyle } from 'react-native';
2
+ declare const ChevronIcon: ({ color, style }: {
3
+ color: ColorValue;
4
+ style?: ViewStyle;
5
+ }) => import("react").JSX.Element;
6
+ export default ChevronIcon;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ var react_native_svg_1 = __importStar(require("react-native-svg"));
37
+ var ChevronIcon = function (_a) {
38
+ var color = _a.color, style = _a.style;
39
+ return (<react_native_svg_1.default width={12} height={8} fill="none" viewBox="0 0 12 8" style={style}>
40
+ <react_native_svg_1.Path fill={color} d="M5.997 7.381a.93.93 0 0 1-.71-.287L.239 2.046A.815.815 0 0 1 0 1.46.794.794 0 0 1 .24.863.807.807 0 0 1 .83.619c.231 0 .429.081.592.244l4.574 4.574L10.572.863a.814.814 0 0 1 .587-.239.795.795 0 0 1 .597.239c.163.162.244.36.244.591 0 .232-.081.43-.244.592L6.708 7.094a.93.93 0 0 1-.71.287Z"/>
41
+ </react_native_svg_1.default>);
42
+ };
43
+ exports.default = ChevronIcon;
@@ -0,0 +1,12 @@
1
+ import { ColorValue, ViewStyle } from 'react-native'
2
+ import Svg, { Path } from 'react-native-svg'
3
+
4
+ const ChevronIcon = ({ color, style }: { color: ColorValue; style?: ViewStyle }) => (
5
+ <Svg width={12} height={8} fill="none" viewBox="0 0 12 8" style={style}>
6
+ <Path
7
+ fill={color}
8
+ d="M5.997 7.381a.93.93 0 0 1-.71-.287L.239 2.046A.815.815 0 0 1 0 1.46.794.794 0 0 1 .24.863.807.807 0 0 1 .83.619c.231 0 .429.081.592.244l4.574 4.574L10.572.863a.814.814 0 0 1 .587-.239.795.795 0 0 1 .597.239c.163.162.244.36.244.591 0 .232-.081.43-.244.592L6.708 7.094a.93.93 0 0 1-.71.287Z"
9
+ />
10
+ </Svg>
11
+ )
12
+ export default ChevronIcon
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const SearchGlassIcon: () => React.JSX.Element;
3
+ export default SearchGlassIcon;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ var React = __importStar(require("react"));
37
+ var react_native_svg_1 = __importStar(require("react-native-svg"));
38
+ var SearchGlassIcon = function () { return (<react_native_svg_1.default width={24} height={24} fill="none">
39
+ <react_native_svg_1.G clipPath="url(#a)">
40
+ <react_native_svg_1.Path fill="#757575" d="m23.485 21.487-4.594-4.594a10.44 10.44 0 0 0 2.157-6.367c0-2.811-1.095-5.455-3.084-7.443A10.457 10.457 0 0 0 10.521 0a10.457 10.457 0 0 0-7.443 3.083c-4.104 4.104-4.104 10.782 0 14.886a10.456 10.456 0 0 0 7.443 3.083 10.44 10.44 0 0 0 6.367-2.156l4.594 4.595c.277.276.64.415 1.002.415s.725-.139 1.001-.415a1.416 1.416 0 0 0 0-2.004ZM5.081 15.966c-3-3-2.999-7.88 0-10.88a7.644 7.644 0 0 1 5.44-2.253c2.055 0 3.987.8 5.44 2.253a7.643 7.643 0 0 1 2.253 5.44c0 2.055-.8 3.987-2.253 5.44a7.642 7.642 0 0 1-5.44 2.253c-2.055 0-3.987-.8-5.44-2.253Z"/>
41
+ </react_native_svg_1.G>
42
+ <react_native_svg_1.Defs>
43
+ <react_native_svg_1.ClipPath id="a">
44
+ <react_native_svg_1.Path fill="#fff" d="M0 0h24v24H0z"/>
45
+ </react_native_svg_1.ClipPath>
46
+ </react_native_svg_1.Defs>
47
+ </react_native_svg_1.default>); };
48
+ exports.default = SearchGlassIcon;
@@ -0,0 +1,19 @@
1
+ import * as React from 'react'
2
+ import Svg, { ClipPath, Defs, G, Path } from 'react-native-svg'
3
+
4
+ const SearchGlassIcon = () => (
5
+ <Svg width={24} height={24} fill="none">
6
+ <G clipPath="url(#a)">
7
+ <Path
8
+ fill="#757575"
9
+ d="m23.485 21.487-4.594-4.594a10.44 10.44 0 0 0 2.157-6.367c0-2.811-1.095-5.455-3.084-7.443A10.457 10.457 0 0 0 10.521 0a10.457 10.457 0 0 0-7.443 3.083c-4.104 4.104-4.104 10.782 0 14.886a10.456 10.456 0 0 0 7.443 3.083 10.44 10.44 0 0 0 6.367-2.156l4.594 4.595c.277.276.64.415 1.002.415s.725-.139 1.001-.415a1.416 1.416 0 0 0 0-2.004ZM5.081 15.966c-3-3-2.999-7.88 0-10.88a7.644 7.644 0 0 1 5.44-2.253c2.055 0 3.987.8 5.44 2.253a7.643 7.643 0 0 1 2.253 5.44c0 2.055-.8 3.987-2.253 5.44a7.642 7.642 0 0 1-5.44 2.253c-2.055 0-3.987-.8-5.44-2.253Z"
10
+ />
11
+ </G>
12
+ <Defs>
13
+ <ClipPath id="a">
14
+ <Path fill="#fff" d="M0 0h24v24H0z" />
15
+ </ClipPath>
16
+ </Defs>
17
+ </Svg>
18
+ )
19
+ export default SearchGlassIcon
@@ -22,7 +22,7 @@ var PrescriptionCard = function (_a) {
22
22
  var screens = (0, useCustomComponents_1.useCustomComponents)().screens;
23
23
  var medication = [prescription.data.medication, prescription.data.quantity].join(', ');
24
24
  return (<Card_1.Card type="prescription" style={[styles.container, (_c = (_b = screens === null || screens === void 0 ? void 0 : screens.AnswerScreen) === null || _b === void 0 ? void 0 : _b.prescriptionCard) === null || _c === void 0 ? void 0 : _c.containerStyle]}>
25
- {((_e = (_d = screens.AnswerScreen) === null || _d === void 0 ? void 0 : _d.prescriptionCard) === null || _e === void 0 ? void 0 : _e.customComponent) ? (<screens.AnswerScreen.prescriptionCard.customComponent prescription={prescription}/>) : (<react_native_1.View style={styles.innerContainer}>
25
+ {((_e = (_d = screens === null || screens === void 0 ? void 0 : screens.AnswerScreen) === null || _d === void 0 ? void 0 : _d.prescriptionCard) === null || _e === void 0 ? void 0 : _e.customComponent) ? (<screens.AnswerScreen.prescriptionCard.customComponent prescription={prescription}/>) : (<react_native_1.View style={styles.innerContainer}>
26
26
  <react_native_1.View style={styles.header}>
27
27
  <PillsIcon_1.PillsIcon />
28
28
  <Text_1.Text bold>{t('prescription.request.details')}</Text_1.Text>
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ColorValue } from 'react-native';
3
- export declare const CloseIcon: ({ color }: {
3
+ export declare const CloseIcon: ({ color, width, height }: {
4
4
  color?: ColorValue;
5
+ width?: number;
6
+ height?: number;
5
7
  }) => React.JSX.Element;
@@ -41,10 +41,10 @@ var useTheme_1 = require("../hooks/useTheme");
41
41
  var react_1 = __importDefault(require("react"));
42
42
  var react_native_svg_1 = __importStar(require("react-native-svg"));
43
43
  var CloseIcon = function (_a) {
44
- var color = _a.color;
44
+ var color = _a.color, _b = _a.width, width = _b === void 0 ? 20 : _b, _c = _a.height, height = _c === void 0 ? 20 : _c;
45
45
  var palette = (0, useTheme_1.useTheme)().palette;
46
46
  var parsedColor = color || palette.white;
47
- return (<react_native_svg_1.default width={20} height={20} viewBox="0 0 20 20" fill="none">
47
+ return (<react_native_svg_1.default width={width} height={height} viewBox="0 0 20 20" fill="none">
48
48
  <react_native_svg_1.Path d="M19.2969 1.39831C18.8039 0.884786 18.0076 0.884786 17.5146 1.39831L11.3333 7.82396L5.15207 1.38514C4.65908 0.871619 3.86272 0.871619 3.36974 1.38514C2.87675 1.89867 2.87675 2.72821 3.36974 3.24174L9.551 9.68056L3.36974 16.1194C2.87675 16.6329 2.87675 17.4624 3.36974 17.976C3.86272 18.4895 4.65908 18.4895 5.15207 17.976L11.3333 11.5371L17.5146 17.976C18.0076 18.4895 18.8039 18.4895 19.2969 17.976C19.7899 17.4624 19.7899 16.6329 19.2969 16.1194L13.1157 9.68056L19.2969 3.24174C19.7773 2.74138 19.7773 1.89867 19.2969 1.39831Z" fill={parsedColor}/>
49
49
  </react_native_svg_1.default>);
50
50
  };
@@ -60,7 +60,8 @@ var AnswerScreen = function (_a) {
60
60
  var scrollRef = (0, react_1.useRef)(null);
61
61
  var consultation = (0, useConsultation_1.useConsultation)().consultation;
62
62
  var _c = (0, react_1.useState)(false), showCloseConsultation = _c[0], setShowCloseConsultation = _c[1];
63
- var AnswerScreen = (0, useCustomComponents_1.useCustomComponents)().screens.AnswerScreen;
63
+ var screens = (0, useCustomComponents_1.useCustomComponents)().screens;
64
+ var AnswerScreen = screens === null || screens === void 0 ? void 0 : screens.AnswerScreen;
64
65
  var scrollEnd = function () { var _a; return (_a = scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollToEnd({ animated: true }); };
65
66
  (0, react_1.useEffect)(function () { return scrollEnd(); }, [showCloseConsultation]);
66
67
  (0, react_1.useEffect)(function () {
@@ -1,2 +1,4 @@
1
- import { IndicationCategory } from './models/prescription';
1
+ import { IndicationCategory } from '../api/models/prescription';
2
+ import { IndicationSurveyQuestions } from '../types/indications';
2
3
  export declare const getIndicationSurveyList: () => Promise<IndicationCategory[]>;
4
+ export declare const getIndicationSurvey: (id: string) => Promise<IndicationSurveyQuestions>;
@@ -3,8 +3,13 @@ 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.getIndicationSurveyList = void 0;
6
+ exports.getIndicationSurvey = exports.getIndicationSurveyList = void 0;
7
7
  var axios_1 = __importDefault(require("axios"));
8
8
  var INDICATION_SURVEY_LIST_URL = '/prescription/indication-survey/list';
9
+ var INDICATION_SURVEY_URL = '/prescription/indication-survey/';
9
10
  var getIndicationSurveyList = function () { return axios_1.default.get(INDICATION_SURVEY_LIST_URL).then(function (response) { return response === null || response === void 0 ? void 0 : response.data; }); };
10
11
  exports.getIndicationSurveyList = getIndicationSurveyList;
12
+ var getIndicationSurvey = function (id) {
13
+ return axios_1.default.get("".concat(INDICATION_SURVEY_URL).concat(id)).then(function (response) { return response === null || response === void 0 ? void 0 : response.data; });
14
+ };
15
+ exports.getIndicationSurvey = getIndicationSurvey;
@@ -35,8 +35,6 @@ var ConsultationScreen = function () {
35
35
  var commonScreen = (0, screens_1.getCommonScreen)(consultation);
36
36
  if (commonScreen)
37
37
  return commonScreen;
38
- if (!consultation)
39
- return <HomeScreen_1.HomeScreen />;
40
38
  var status = consultation.status;
41
39
  switch (status) {
42
40
  default:
@@ -0,0 +1,3 @@
1
+ import { IndicationCategory as IndicationCategoryProps } from '../api/models/prescription';
2
+ export declare const IndicationCategory: ({ iconUrl, textKey, indications }: IndicationCategoryProps) => import("react").JSX.Element;
3
+ export default IndicationCategory;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.IndicationCategory = void 0;
7
+ var ChevronIcon_1 = __importDefault(require("../../common/assets/ChevronIcon"));
8
+ var Text_1 = require("../../common/components/Text");
9
+ var useTheme_1 = require("../../common/hooks/useTheme");
10
+ var react_1 = require("react");
11
+ var react_i18next_1 = require("react-i18next");
12
+ var react_native_1 = require("react-native");
13
+ var react_native_svg_1 = require("react-native-svg");
14
+ var IndicationSurveyButton_1 = __importDefault(require("./IndicationSurveyButton"));
15
+ var IndicationCategory = function (_a) {
16
+ var iconUrl = _a.iconUrl, textKey = _a.textKey, indications = _a.indications;
17
+ var t = (0, react_i18next_1.useTranslation)().t;
18
+ var theme = (0, useTheme_1.useTheme)();
19
+ var styles = getStyles(theme);
20
+ var _b = (0, react_1.useState)(false), open = _b[0], setOpen = _b[1];
21
+ return (<react_native_1.View style={styles.container}>
22
+ <react_native_1.View style={styles.titleContainer}>
23
+ <react_native_1.View style={styles.titleWrapper}>
24
+ <react_native_svg_1.SvgUri uri={iconUrl} style={styles.icon} accessibilityLabel={t(textKey)} width={16} height={16}/>
25
+ <Text_1.Text bold style={styles.title}>
26
+ {t(textKey)}
27
+ </Text_1.Text>
28
+ </react_native_1.View>
29
+ <react_native_1.TouchableOpacity onPress={function () { return setOpen(!open); }}>
30
+ <ChevronIcon_1.default color={open ? theme.palette.primary.base : theme.palette.black} style={open ? { transform: [{ rotate: '180deg' }] } : undefined}/>
31
+ </react_native_1.TouchableOpacity>
32
+ </react_native_1.View>
33
+ <react_native_1.View style={[styles.buttonsContainer, { display: open ? 'flex' : 'none' }]}>
34
+ {indications.map(function (indication) { return (<IndicationSurveyButton_1.default key={indication.textKey} {...indication}/>); })}
35
+ </react_native_1.View>
36
+ </react_native_1.View>);
37
+ };
38
+ exports.IndicationCategory = IndicationCategory;
39
+ exports.default = exports.IndicationCategory;
40
+ var getStyles = function (_a) {
41
+ var palette = _a.palette, spacing = _a.spacing;
42
+ return react_native_1.StyleSheet.create({
43
+ container: {
44
+ width: '100%',
45
+ paddingVertical: spacing.md,
46
+ borderBottomWidth: 1,
47
+ borderBottomColor: palette.white
48
+ },
49
+ titleContainer: {
50
+ justifyContent: 'space-between',
51
+ flexDirection: 'row',
52
+ alignItems: 'center',
53
+ flex: 1,
54
+ width: '100%'
55
+ },
56
+ titleWrapper: {
57
+ flexDirection: 'row',
58
+ overflow: 'hidden',
59
+ alignItems: 'center',
60
+ marginRight: spacing.sm,
61
+ flex: 1
62
+ },
63
+ buttonsContainer: {
64
+ width: '100%',
65
+ paddingTop: spacing.md,
66
+ gap: spacing.xs
67
+ },
68
+ icon: {
69
+ marginRight: spacing.xs
70
+ },
71
+ title: {
72
+ textTransform: 'uppercase'
73
+ }
74
+ });
75
+ };
@@ -1,3 +1,3 @@
1
1
  import { IndicationSurveyList } from '../api/models/prescription';
2
- export declare const IndicationSurveyButton: ({ iconUrl, textKey }: IndicationSurveyList) => import("react").JSX.Element;
2
+ export declare const IndicationSurveyButton: ({ iconUrl, id, textKey }: IndicationSurveyList) => import("react").JSX.Element;
3
3
  export default IndicationSurveyButton;
@@ -3,17 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IndicationSurveyButton = void 0;
4
4
  var Text_1 = require("../../common/components/Text");
5
5
  var useTheme_1 = require("../../common/hooks/useTheme");
6
+ var useIndicationSurvey_1 = require("../hooks/useIndicationSurvey");
6
7
  var react_i18next_1 = require("react-i18next");
7
8
  var react_native_1 = require("react-native");
9
+ var react_native_svg_1 = require("react-native-svg");
8
10
  var IndicationSurveyButton = function (_a) {
9
- var iconUrl = _a.iconUrl, textKey = _a.textKey;
11
+ var iconUrl = _a.iconUrl, id = _a.id, textKey = _a.textKey;
10
12
  var t = (0, react_i18next_1.useTranslation)().t;
11
13
  var theme = (0, useTheme_1.useTheme)();
12
14
  var styles = getStyles(theme);
13
- return (<react_native_1.View style={[styles.container, theme.shadows.soft]}>
14
- <react_native_1.Image source={{ uri: iconUrl }} style={styles.icon} accessibilityLabel={t(textKey)}/>
15
+ var onSelectIndication = (0, useIndicationSurvey_1.useIndicationSurvey)().onSelectIndication;
16
+ return (<react_native_1.TouchableOpacity style={[styles.container, theme.shadows.soft]} onPress={function () { return onSelectIndication(id.toString()); }}>
17
+ <react_native_svg_1.SvgUri uri={iconUrl} style={styles.icon} accessibilityLabel={t(textKey)} width={16} height={16}/>
15
18
  <Text_1.Text>{t(textKey)}</Text_1.Text>
16
- </react_native_1.View>);
19
+ </react_native_1.TouchableOpacity>);
17
20
  };
18
21
  exports.IndicationSurveyButton = IndicationSurveyButton;
19
22
  exports.default = exports.IndicationSurveyButton;
@@ -21,16 +24,15 @@ var getStyles = function (_a) {
21
24
  var borderRadius = _a.borderRadius, palette = _a.palette, spacing = _a.spacing;
22
25
  return react_native_1.StyleSheet.create({
23
26
  container: {
27
+ width: '100%',
24
28
  borderRadius: borderRadius.md,
25
29
  backgroundColor: palette.white,
26
30
  flexDirection: 'row',
27
- alignItems: 'flex-start',
28
- justifyContent: 'center',
31
+ alignItems: 'center',
29
32
  padding: spacing.sm
30
33
  },
31
34
  icon: {
32
- width: 16,
33
- height: 16
35
+ marginRight: spacing.xs
34
36
  }
35
37
  });
36
38
  };
@@ -60,7 +60,7 @@ var OpenEnded = function () {
60
60
  return __generator(this, function (_a) {
61
61
  addAnswer({
62
62
  id: 'textArea',
63
- value: data.answer
63
+ value: (data === null || data === void 0 ? void 0 : data.answer) || ''
64
64
  });
65
65
  nextStep();
66
66
  return [2 /*return*/];
@@ -51,8 +51,8 @@ var SingleChoice = function () {
51
51
  return setShowExitLogic(true);
52
52
  addAnswer({
53
53
  id: answer.id,
54
- key: answer.titleKey,
55
- value: t(answer.text)
54
+ key: answer.value,
55
+ value: t(answer.value)
56
56
  });
57
57
  nextStep();
58
58
  };
@@ -65,7 +65,7 @@ var SingleChoice = function () {
65
65
  {currentQuestion.answers
66
66
  .sort(function (a, z) { return a.order - z.order; })
67
67
  .map(function (answer) { return (<Button_1.Button key={answer.id} radio variant="secondary" onPress={function () { return handleSaveAnswer(answer); }}>
68
- {t(answer.text)}
68
+ {t(answer.value)}
69
69
  </Button_1.Button>); })}
70
70
  </>);
71
71
  };
@@ -0,0 +1,90 @@
1
+ import { Theme } from '../../common/types/theme';
2
+ import React from 'react';
3
+ export type Item = {
4
+ label: string;
5
+ category?: string;
6
+ value: string;
7
+ };
8
+ interface SearchableDropDownProps {
9
+ items?: Item[];
10
+ defaultIndex?: number;
11
+ placeholder?: string;
12
+ placeholderTextColor?: string;
13
+ underlineColorAndroid?: string;
14
+ loading?: boolean;
15
+ onTextChange?: (_: string) => void;
16
+ onItemSelect?: (_?: any) => void;
17
+ onFocus?: () => void;
18
+ }
19
+ export declare const SearchableDropDown: (props: SearchableDropDownProps) => React.JSX.Element;
20
+ export declare const getStyles: ({ palette, spacing, font, borderRadius }: Theme) => {
21
+ listContainer: {
22
+ backgroundColor: import("react-native").ColorValue;
23
+ width: "100%";
24
+ paddingHorizontal: number;
25
+ borderRadius: number;
26
+ flex: number;
27
+ minHeight: number;
28
+ };
29
+ itemContainer: {
30
+ width: "100%";
31
+ justifyContent: "center";
32
+ alignSelf: "center";
33
+ borderBottomWidth: number;
34
+ borderBottomColor: import("react-native").ColorValue;
35
+ paddingVertical: number;
36
+ gap: number;
37
+ };
38
+ notFoundContainer: {
39
+ backgroundColor: import("react-native").ColorValue;
40
+ borderRadius: number;
41
+ padding: number;
42
+ };
43
+ itemText: {
44
+ color: import("react-native").ColorValue;
45
+ fontSize: number;
46
+ fontWeight: "bold";
47
+ };
48
+ itemCategory: {
49
+ color: import("react-native").ColorValue;
50
+ fontSize: number;
51
+ paddingLeft: number;
52
+ };
53
+ modal: {
54
+ height: "80%";
55
+ backgroundColor: import("react-native").ColorValue;
56
+ };
57
+ modalContent: {
58
+ padding: number;
59
+ gap: number;
60
+ flex: number;
61
+ };
62
+ wrapperContainer: {
63
+ backgroundColor: import("react-native").ColorValue;
64
+ flexDirection: "row";
65
+ alignItems: "center";
66
+ height: number;
67
+ width: "100%";
68
+ borderColor: import("react-native").ColorValue;
69
+ borderWidth: number;
70
+ borderRadius: number;
71
+ padding: number;
72
+ marginBottom: number;
73
+ flex: number;
74
+ minHeight: number;
75
+ maxHeight: number;
76
+ justifyContent: "space-between";
77
+ };
78
+ input: {
79
+ outlineWidth: number;
80
+ flex: number;
81
+ borderWidth: number;
82
+ paddingHorizontal: number;
83
+ fontSize: number;
84
+ color: import("react-native").ColorValue;
85
+ };
86
+ center: {
87
+ textAlign: "center";
88
+ };
89
+ };
90
+ export {};
@@ -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"));
@@ -105,14 +105,13 @@ var DeliveryAddressScreen = function () {
105
105
  var styles = getStyles(theme);
106
106
  var _a = (0, useConsultation_1.useConsultation)(), consultation = _a.consultation, updateConsultation = _a.updateConsultation;
107
107
  var _b = (0, react_1.useState)(false), loading = _b[0], setLoading = _b[1];
108
- var _c = (0, react_1.useState)(null), error = _c[0], setError = _c[1];
108
+ var _c = (0, react_1.useState)(false), error = _c[0], setError = _c[1];
109
109
  var onSubmit = function (data) { return __awaiter(void 0, void 0, void 0, function () {
110
110
  return __generator(this, function (_a) {
111
111
  setError(false);
112
112
  setLoading(true);
113
113
  (0, video_1.updateDeliveryAddress)(consultation === null || consultation === void 0 ? void 0 : consultation.id, __assign(__assign({}, data), { country: t('country.hk') }))
114
114
  .then(function (res) {
115
- console.log('esta es la respuesta', res);
116
115
  updateConsultation(res);
117
116
  })
118
117
  .catch(function () { return setError(true); })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abihealth/goapp-react-native",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -14,17 +14,6 @@
14
14
  "main": "./dist/index.js",
15
15
  "types": "./dist/index.d.ts",
16
16
  "type": "module",
17
- "scripts": {
18
- "copy-assets:common": "mkdir -p dist/common/assets && cp -r src/common/assets dist/common || true",
19
- "copy-assets:video-consultations": "mkdir -p dist/video-consultations/assets && cp -r src/video-consultations/assets dist/video-consultations || true",
20
- "build": "rm -rf dist && pnpm copy-assets:common && pnpm copy-assets:video-consultations && tsc && tsc-alias",
21
- "build:watch": "concurrently --kill-others \"tsc -w\" \"tsc-alias -w\"",
22
- "start": "pnpm build:watch",
23
- "start:ios": "pnpm start",
24
- "type-check": "tsc --noEmit",
25
- "lint": "eslint --fix",
26
- "update-phrase": "npx -y phrase-cli pull"
27
- },
28
17
  "dependencies": {
29
18
  "@sentry/react-native": "^6.7.0",
30
19
  "axios": "^1.7.9",
@@ -56,5 +45,16 @@
56
45
  },
57
46
  "exports": {
58
47
  ".": "./dist/index.js"
48
+ },
49
+ "scripts": {
50
+ "copy-assets:common": "mkdir -p dist/common/assets && cp -r src/common/assets dist/common || true",
51
+ "copy-assets:video-consultations": "mkdir -p dist/video-consultations/assets && cp -r src/video-consultations/assets dist/video-consultations || true",
52
+ "build": "rm -rf dist && pnpm copy-assets:common && pnpm copy-assets:video-consultations && tsc && tsc-alias",
53
+ "build:watch": "concurrently --kill-others \"tsc -w\" \"tsc-alias -w\"",
54
+ "start": "pnpm build:watch",
55
+ "start:ios": "pnpm start",
56
+ "type-check": "tsc --noEmit",
57
+ "lint": "eslint --fix",
58
+ "update-phrase": "npx -y phrase-cli pull"
59
59
  }
60
- }
60
+ }
@@ -1,3 +0,0 @@
1
- export interface SuccessResponse {
2
- success: boolean;
3
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });