@abihealth/goapp-react-native 1.18.0 → 1.19.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 (66) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/common/api/consultation.d.ts +4 -6
  3. package/dist/common/api/consultation.js +28 -70
  4. package/dist/common/api/models/auth.d.ts +0 -8
  5. package/dist/common/api/models/consultation.d.ts +0 -1
  6. package/dist/common/api/models/partner.d.ts +3 -0
  7. package/dist/common/api/models/partner.js +2 -0
  8. package/dist/common/api/partner.d.ts +2 -0
  9. package/dist/common/api/partner.js +10 -0
  10. package/dist/common/api/user.d.ts +3 -0
  11. package/dist/common/api/user.js +7 -1
  12. package/dist/common/components/Header/ConsultationHeader.d.ts +3 -0
  13. package/dist/common/components/Header/ConsultationHeader.js +28 -0
  14. package/dist/common/components/{Header.d.ts → Header/index.d.ts} +1 -2
  15. package/dist/common/components/{Header.js → Header/index.js} +2 -2
  16. package/dist/common/components/Input.d.ts +2 -1
  17. package/dist/common/components/Input.js +14 -3
  18. package/dist/common/components/SlideUp.js +1 -4
  19. package/dist/common/contexts/ConsultationContext.js +50 -81
  20. package/dist/common/contexts/LoaderContext.d.ts +8 -0
  21. package/dist/common/contexts/LoaderContext.js +86 -0
  22. package/dist/common/hooks/useConsultation.js +24 -8
  23. package/dist/common/hooks/useLoader.d.ts +8 -0
  24. package/dist/common/hooks/useLoader.js +15 -0
  25. package/dist/common/icons/CaseFolderIcon.d.ts +3 -0
  26. package/dist/common/icons/CaseFolderIcon.js +55 -0
  27. package/dist/common/icons/NoCaseFoundIcon.js +1 -1
  28. package/dist/common/locale/translations/en.base.json +3 -0
  29. package/dist/common/screens/AnswerScreen.js +2 -5
  30. package/dist/common/screens/MatchScreen.js +2 -3
  31. package/dist/common/screens/MatchingScreen.js +2 -3
  32. package/dist/common/screens/NotValidActiveTypeScreen.d.ts +7 -0
  33. package/dist/common/screens/NotValidActiveTypeScreen.js +35 -0
  34. package/dist/common/screens/PreparingSummaryScreen.js +2 -3
  35. package/dist/common/screens/RatingScreen.js +2 -3
  36. package/dist/common/types/components.d.ts +15 -0
  37. package/dist/form-prescriptions/api/models/prescription.d.ts +5 -0
  38. package/dist/form-prescriptions/api/prescription.d.ts +3 -1
  39. package/dist/form-prescriptions/api/prescription.js +8 -3
  40. package/dist/form-prescriptions/components/FormPrescription.js +5 -4
  41. package/dist/form-prescriptions/components/IndicationCategory.js +12 -8
  42. package/dist/form-prescriptions/components/IndicationSurveyButton.js +5 -2
  43. package/dist/form-prescriptions/components/Questionnaire/QuestionnaireQuestion/OpenEnded.js +1 -1
  44. package/dist/form-prescriptions/components/SearchableDropdown.d.ts +1 -1
  45. package/dist/form-prescriptions/components/SearchableDropdown.js +2 -2
  46. package/dist/form-prescriptions/components/loaders/HomeLoader.d.ts +1 -0
  47. package/dist/form-prescriptions/components/loaders/HomeLoader.js +35 -0
  48. package/dist/form-prescriptions/components/loaders/QuestionnaireLoader.d.ts +1 -0
  49. package/dist/form-prescriptions/components/loaders/QuestionnaireLoader.js +68 -0
  50. package/dist/form-prescriptions/contexts/IndicationSurveyContext.js +2 -3
  51. package/dist/form-prescriptions/hooks/useIndicationSurvey.js +10 -6
  52. package/dist/form-prescriptions/hooks/useIndicationSurveyAnswers.js +6 -1
  53. package/dist/form-prescriptions/hooks/useScreens.js +2 -1
  54. package/dist/form-prescriptions/screens/HomeScreen.js +50 -8
  55. package/dist/form-prescriptions/screens/QuestionnaireScreen.js +12 -10
  56. package/dist/form-prescriptions/screens/ReasonScreen.d.ts +2 -0
  57. package/dist/form-prescriptions/screens/ReasonScreen.js +161 -0
  58. package/dist/form-prescriptions/types/screens.d.ts +4 -3
  59. package/dist/form-prescriptions/types/screens.js +4 -3
  60. package/dist/video-consultations/api/video.d.ts +2 -1
  61. package/dist/video-consultations/api/video.js +10 -5
  62. package/dist/video-consultations/components/VideoConsultation.js +2 -2
  63. package/dist/video-consultations/screens/ProcessingPrescriptionScreen.js +3 -2
  64. package/package.json +1 -3
  65. package/dist/common/screens/NotValidActiveType.d.ts +0 -2
  66. package/dist/common/screens/NotValidActiveType.js +0 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.19.0](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.18.1...goapp-react-native-v1.19.0) (2025-03-25)
4
+
5
+
6
+ ### Features
7
+
8
+ * Add loaders for home and questionnaire screens ([#148](https://github.com/abiglobalhealth/react-native-sdk/issues/148)) ([0b51ed6](https://github.com/abiglobalhealth/react-native-sdk/commit/0b51ed66fdee93dcdf02c60d1b4e30405e7fe4b5))
9
+ * add reason screen ([#149](https://github.com/abiglobalhealth/react-native-sdk/issues/149)) ([b17c0a9](https://github.com/abiglobalhealth/react-native-sdk/commit/b17c0a963e8673c12685fecfa2cbafd9ae9da547))
10
+ * Include Not Valid Active Type Screen and related updates ([#152](https://github.com/abiglobalhealth/react-native-sdk/issues/152)) ([9e20b4c](https://github.com/abiglobalhealth/react-native-sdk/commit/9e20b4cc7152b812a5b0edd7759986ec63bf46c0))
11
+ * including custom components of prescription home screen ([#153](https://github.com/abiglobalhealth/react-native-sdk/issues/153)) ([dfa76e2](https://github.com/abiglobalhealth/react-native-sdk/commit/dfa76e27ffeb2db1a171e6ce94e18e1cae8e1328))
12
+ * remove jwt-token and use partner endpoint ([#156](https://github.com/abiglobalhealth/react-native-sdk/issues/156)) ([7e88636](https://github.com/abiglobalhealth/react-native-sdk/commit/7e88636efc8341818f9be76cab2eb748ab2be7aa))
13
+ * remove Sentry ([#155](https://github.com/abiglobalhealth/react-native-sdk/issues/155)) ([47a2dc6](https://github.com/abiglobalhealth/react-native-sdk/commit/47a2dc60fab684c4b48eea7dfe707b37e6743639))
14
+
15
+ ## [1.18.1](https://github.com/abiglobalhealth/react-native-sdk/compare/goapp-react-native-v1.18.0...goapp-react-native-v1.18.1) (2025-03-19)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * undefined processing prescription screen in custom components ([#146](https://github.com/abiglobalhealth/react-native-sdk/issues/146)) ([9d9a6f4](https://github.com/abiglobalhealth/react-native-sdk/commit/9d9a6f44d37581bdbc1883ff55a93a4fda4f7a93))
21
+
3
22
  ## [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
23
 
5
24
 
@@ -1,6 +1,4 @@
1
- import { CancelConsultationRequest, CloseConsultationRequest, ConsultationRequest, CreateConsultationRequest, GetActiveConsultationRequest, RateConsultationRequest } from './models/consultation';
2
- export declare const createConsultation: ConsultationRequest<CreateConsultationRequest>;
3
- export declare const getActiveConsultation: ConsultationRequest<GetActiveConsultationRequest>;
4
- export declare const cancelConsultation: ConsultationRequest<CancelConsultationRequest>;
5
- export declare const closeConsultation: ConsultationRequest<CloseConsultationRequest>;
6
- export declare const rateConsultation: ConsultationRequest<RateConsultationRequest>;
1
+ import { CancelConsultationRequest, CloseConsultationRequest, ConsultationResponse, RateConsultationRequest } from './models/consultation';
2
+ export declare const cancelConsultation: (_: CancelConsultationRequest) => Promise<ConsultationResponse>;
3
+ export declare const closeConsultation: (_: CloseConsultationRequest) => Promise<ConsultationResponse>;
4
+ export declare const rateConsultation: (body: RateConsultationRequest) => Promise<ConsultationResponse>;
@@ -1,80 +1,38 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
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]];
10
+ }
11
+ return t;
10
12
  };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var _a;
39
13
  Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.rateConsultation = exports.closeConsultation = exports.cancelConsultation = exports.getActiveConsultation = exports.createConsultation = void 0;
41
- var consultation_1 = require("../types/consultation");
14
+ exports.rateConsultation = exports.closeConsultation = exports.cancelConsultation = void 0;
42
15
  var config_1 = require("./config");
43
- var CONSULTATION_URLS = (_a = {},
44
- _a[consultation_1.CASE_TYPE.VIDEO] = 'video-consultation',
45
- _a);
46
- var SEARCH_CONSULTATION_URL = "/search";
16
+ var CONSULTATION_URL = 'consultation';
47
17
  var CANCEL_CONSULTATION_URL = "/cancel";
48
18
  var CLOSE_CONSULTATION_URL = "/close";
49
- var RATE_CONSULTATION_URL = "/rating";
50
- var createConsultation = function (caseType) { return function (body) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
51
- return [2 /*return*/, config_1.axios.post(CONSULTATION_URLS[caseType], body).then(function (response) { return response === null || response === void 0 ? void 0 : response.data; })];
52
- }); }); }; };
53
- exports.createConsultation = createConsultation;
54
- var getActiveConsultation = function (caseType) {
55
- return function (_a) {
56
- var userId = _a.userId;
57
- return config_1.axios.get("".concat(CONSULTATION_URLS[caseType]).concat(SEARCH_CONSULTATION_URL, "?userId=").concat(userId)).then(function (response) { return response === null || response === void 0 ? void 0 : response.data; });
58
- };
19
+ var RATE_CONSULTATION_URL = "/rate";
20
+ var cancelConsultation = function (_a) {
21
+ var consultationId = _a.consultationId, body = __rest(_a, ["consultationId"]);
22
+ return config_1.axios.patch("".concat(CONSULTATION_URL, "/").concat(consultationId).concat(CANCEL_CONSULTATION_URL), body).then(function (response) { return response === null || response === void 0 ? void 0 : response.data; });
59
23
  };
60
- exports.getActiveConsultation = getActiveConsultation;
61
- var cancelConsultation = function (caseType) { return function (body) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
62
- return [2 /*return*/, config_1.axios.patch("".concat(CONSULTATION_URLS[caseType]).concat(CANCEL_CONSULTATION_URL), body).then(function (response) { return response === null || response === void 0 ? void 0 : response.data; })];
63
- }); }); }; };
64
24
  exports.cancelConsultation = cancelConsultation;
65
- var closeConsultation = function (caseType) { return function (body) { return __awaiter(void 0, void 0, void 0, function () {
66
- return __generator(this, function (_a) {
67
- return [2 /*return*/, config_1.axios
68
- .patch("".concat(CONSULTATION_URLS[caseType]).concat(CLOSE_CONSULTATION_URL), body)
69
- .then(function (response) { return response === null || response === void 0 ? void 0 : response.data; })];
70
- });
71
- }); }; };
25
+ var closeConsultation = function (_a) {
26
+ var consultationId = _a.consultationId, body = __rest(_a, ["consultationId"]);
27
+ return config_1.axios
28
+ .patch("".concat(CONSULTATION_URL, "/").concat(consultationId).concat(CLOSE_CONSULTATION_URL), body)
29
+ .then(function (response) { return response === null || response === void 0 ? void 0 : response.data; });
30
+ };
72
31
  exports.closeConsultation = closeConsultation;
73
- var rateConsultation = function (caseType) { return function (body) { return __awaiter(void 0, void 0, void 0, function () {
74
- return __generator(this, function (_a) {
75
- return [2 /*return*/, config_1.axios
76
- .post("".concat(CONSULTATION_URLS[caseType]).concat(RATE_CONSULTATION_URL), body)
77
- .then(function (response) { return response === null || response === void 0 ? void 0 : response.data; })];
78
- });
79
- }); }; };
32
+ var rateConsultation = function (_a) {
33
+ var consultationId = _a.consultationId, body = __rest(_a, ["consultationId"]);
34
+ return config_1.axios
35
+ .post("".concat(CONSULTATION_URL, "/").concat(consultationId).concat(RATE_CONSULTATION_URL), body)
36
+ .then(function (response) { return response === null || response === void 0 ? void 0 : response.data; });
37
+ };
80
38
  exports.rateConsultation = rateConsultation;
@@ -6,11 +6,3 @@ export interface AuthorizationRequest {
6
6
  export interface AuthorizationResponse {
7
7
  access_token: string;
8
8
  }
9
- export interface DecodedToken {
10
- connection: string;
11
- exp: number;
12
- iat: number;
13
- id: string;
14
- name: string;
15
- slug: string;
16
- }
@@ -63,7 +63,6 @@ export declare const rateConsultationRequestSchema: z.ZodObject<z.objectUtil.ext
63
63
  }>;
64
64
  export type ConsultationResponse = z.infer<typeof consultationResponseSchema>;
65
65
  export type CreateConsultationRequest = z.infer<typeof createConsultationRequestSchema>;
66
- export type GetActiveConsultationRequest = z.infer<typeof getActiveConsultationRequestSchema>;
67
66
  export type CancelConsultationRequest = z.infer<typeof cancelConsultationRequestSchema>;
68
67
  export type CloseConsultationRequest = z.infer<typeof closeConsultationRequestSchema>;
69
68
  export type RateConsultationRequest = z.infer<typeof rateConsultationRequestSchema>;
@@ -0,0 +1,3 @@
1
+ export type GetPartnerInfoResponse = {
2
+ slug: string;
3
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { GetPartnerInfoResponse } from './models/partner';
2
+ export declare const getPartnerInfo: () => Promise<GetPartnerInfoResponse>;
@@ -0,0 +1,10 @@
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.getPartnerInfo = void 0;
7
+ var axios_1 = __importDefault(require("axios"));
8
+ var PARTNER_URL = 'partner';
9
+ var getPartnerInfo = function () { return axios_1.default.get(PARTNER_URL).then(function (response) { return response === null || response === void 0 ? void 0 : response.data; }); };
10
+ exports.getPartnerInfo = getPartnerInfo;
@@ -1,2 +1,5 @@
1
1
  import { GetUserRequest } from './models/user';
2
2
  export declare const getUser: ({ userId }: GetUserRequest) => Promise<import("../types/user").User>;
3
+ export declare const getActiveConsultation: ({ userId }: GetUserRequest) => Promise<{
4
+ consultation?: import("../..").Consultation;
5
+ }>;
@@ -1,10 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUser = void 0;
3
+ exports.getActiveConsultation = exports.getUser = void 0;
4
4
  var config_1 = require("./config");
5
5
  var USER_URL = "/user";
6
+ var ACTIVE_CONSULTATION_URL = "/active-consultation";
6
7
  var getUser = function (_a) {
7
8
  var userId = _a.userId;
8
9
  return config_1.axios.get("".concat(USER_URL, "/").concat(userId)).then(function (response) { return response === null || response === void 0 ? void 0 : response.data; });
9
10
  };
10
11
  exports.getUser = getUser;
12
+ var getActiveConsultation = function (_a) {
13
+ var userId = _a.userId;
14
+ return config_1.axios.get("".concat(USER_URL, "/").concat(userId).concat(ACTIVE_CONSULTATION_URL)).then(function (response) { return response === null || response === void 0 ? void 0 : response.data; });
15
+ };
16
+ exports.getActiveConsultation = getActiveConsultation;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { HeaderProps } from '.';
3
+ export declare const ConsultationHeader: (props: HeaderProps) => React.JSX.Element;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ var _a;
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ConsultationHeader = void 0;
8
+ var useConsultation_1 = require("../../hooks/useConsultation");
9
+ var consultation_1 = require("../../types/consultation");
10
+ var FormPrescriptionIcon_1 = require("../../../form-prescriptions/icons/FormPrescriptionIcon");
11
+ var VideoConsultationIcon_1 = require("../../../video-consultations/icons/VideoConsultationIcon");
12
+ var react_1 = __importDefault(require("react"));
13
+ var react_i18next_1 = require("react-i18next");
14
+ var _1 = require(".");
15
+ var CONSULTATION_ICON = (_a = {},
16
+ _a[consultation_1.CASE_TYPE.VIDEO] = <VideoConsultationIcon_1.VideoConsultationIcon />,
17
+ _a[consultation_1.CASE_TYPE.PRESCRIPTION] = <FormPrescriptionIcon_1.FormPrescriptionIcon />,
18
+ _a[consultation_1.CASE_TYPE.MENTAL] = null,
19
+ _a[consultation_1.CASE_TYPE.MEDICAL] = null,
20
+ _a[consultation_1.CASE_TYPE.VOICE] = null // TODO: Add icon when service is available
21
+ ,
22
+ _a);
23
+ var ConsultationHeader = function (props) {
24
+ var t = (0, react_i18next_1.useTranslation)().t;
25
+ var consultation = (0, useConsultation_1.useConsultation)().consultation;
26
+ return <_1.Header title={t("general.consultation.".concat(consultation.type, ".title"))} leftIcon={CONSULTATION_ICON[consultation.type]} {...props}/>;
27
+ };
28
+ exports.ConsultationHeader = ConsultationHeader;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- type HeaderProps = {
2
+ export type HeaderProps = {
3
3
  leftIcon?: React.ReactNode;
4
4
  centerIcon?: React.ReactNode;
5
5
  rightIcon?: React.ReactNode;
@@ -7,4 +7,3 @@ type HeaderProps = {
7
7
  description?: string;
8
8
  };
9
9
  export declare const Header: ({ leftIcon, centerIcon, rightIcon, title, description }: HeaderProps) => React.JSX.Element;
10
- export {};
@@ -45,10 +45,10 @@ var __importStar = (this && this.__importStar) || (function () {
45
45
  })();
46
46
  Object.defineProperty(exports, "__esModule", { value: true });
47
47
  exports.Header = void 0;
48
- var useTheme_1 = require("../hooks/useTheme");
48
+ var useTheme_1 = require("../../hooks/useTheme");
49
49
  var react_1 = __importStar(require("react"));
50
50
  var react_native_1 = require("react-native");
51
- var Text_1 = require("./Text");
51
+ var Text_1 = require("../Text");
52
52
  var ALIGNMENTS = {
53
53
  left: 'flex-start',
54
54
  right: 'flex-end',
@@ -3,6 +3,7 @@ import { TextInputProps } from 'react-native';
3
3
  interface InputProps extends TextInputProps {
4
4
  label?: string;
5
5
  error?: string;
6
+ minLength?: number;
6
7
  }
7
- export declare const Input: ({ label, error, id, ...props }: PropsWithChildren<InputProps>) => import("react").JSX.Element;
8
+ export declare const Input: ({ label, error, id, minLength, ...props }: PropsWithChildren<InputProps>) => import("react").JSX.Element;
8
9
  export default Input;
@@ -18,11 +18,14 @@ exports.Input = void 0;
18
18
  var useCustomComponents_1 = require("../hooks/useCustomComponents");
19
19
  var useForm_1 = require("../hooks/useForm");
20
20
  var useTheme_1 = require("../hooks/useTheme");
21
+ var useTranslation_1 = require("../hooks/useTranslation");
21
22
  var react_1 = require("react");
22
23
  var react_native_1 = require("react-native");
23
24
  var FormControl_1 = __importDefault(require("./FormControl"));
25
+ var Text_1 = require("./Text");
24
26
  var Input = function (_a) {
25
- var label = _a.label, error = _a.error, id = _a.id, props = __rest(_a, ["label", "error", "id"]);
27
+ var label = _a.label, error = _a.error, id = _a.id, minLength = _a.minLength, props = __rest(_a, ["label", "error", "id", "minLength"]);
28
+ var t = (0, useTranslation_1.useTranslation)().t;
26
29
  var theme = (0, useTheme_1.useTheme)();
27
30
  var Input = (0, useCustomComponents_1.useCustomComponents)().Input;
28
31
  var styles = getStyles(theme);
@@ -47,8 +50,15 @@ var Input = function (_a) {
47
50
  var formError = errors === null || errors === void 0 ? void 0 : errors[id];
48
51
  var formValue = data === null || data === void 0 ? void 0 : data[id];
49
52
  var err = formError || error;
53
+ var placeholderColor = (Input === null || Input === void 0 ? void 0 : Input.placeholderTextColor) || theme.palette.grey.base;
50
54
  return (<FormControl_1.default label={label} error={err} name={id}>
51
- <react_native_1.TextInput {...props} id={id} style={[styles.input, focused && styles.focused, err && styles.error, props.style, Input === null || Input === void 0 ? void 0 : Input.containerStyle]} onFocus={onFocus} onBlur={onBlur} placeholderTextColor={Input === null || Input === void 0 ? void 0 : Input.placeholderTextColor} value={formValue || props.value} onChangeText={onChangeText} editable={!loading} accessibilityLabel="input" accessibilityLabelledBy={id} accessibilityState={{ busy: loading, disabled: loading }}/>
55
+ <react_native_1.View style={{ position: 'relative' }}>
56
+ <react_native_1.TextInput {...props} id={id} style={[styles.input, focused && styles.focused, err && styles.error, props.style, Input === null || Input === void 0 ? void 0 : Input.containerStyle]} onFocus={onFocus} onBlur={onBlur} placeholderTextColor={placeholderColor} value={formValue || props.value} onChangeText={onChangeText} editable={!loading} accessibilityLabel="input" accessibilityLabelledBy={id} accessibilityState={{ busy: loading, disabled: loading }}/>
57
+
58
+ {props.multiline && !!minLength && (!formValue || (formValue === null || formValue === void 0 ? void 0 : formValue.length) < minLength) && (<react_native_1.View style={styles.hintContainer}>
59
+ <Text_1.Text color={placeholderColor}>{t('inputs.textarea.min_length', { minLength: minLength })}</Text_1.Text>
60
+ </react_native_1.View>)}
61
+ </react_native_1.View>
52
62
  </FormControl_1.default>);
53
63
  };
54
64
  exports.Input = Input;
@@ -71,6 +81,7 @@ var getStyles = function (_a) {
71
81
  },
72
82
  error: {
73
83
  borderColor: palette.error
74
- }
84
+ },
85
+ hintContainer: { position: 'absolute', bottom: 4, width: '100%', alignItems: 'center', justifyContent: 'center' }
75
86
  });
76
87
  };
@@ -54,10 +54,7 @@ var Slide = function (_a) {
54
54
  transform: [{ translateY: slideAnim }]
55
55
  },
56
56
  style
57
- ]} onLayout={function (e) {
58
- // Log height of the view
59
- console.log(e.nativeEvent.layout.height);
60
- }}>
57
+ ]}>
61
58
  {children}
62
59
  </react_native_1.Animated.View>);
63
60
  };
@@ -1,37 +1,4 @@
1
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
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -74,30 +41,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
74
41
  Object.defineProperty(exports, "__esModule", { value: true });
75
42
  exports.ConsultationProvider = exports.ConsultationContext = void 0;
76
43
  var config_1 = require("../api/config");
77
- var consultation_1 = require("../api/consultation");
44
+ var partner_1 = require("../api/partner");
78
45
  var user_1 = require("../api/user");
79
46
  var websocket_1 = require("../api/websocket");
80
47
  var i18n_1 = __importDefault(require("../locale/i18n"));
81
- var consultation_2 = require("../types/consultation");
82
48
  var theme_1 = require("../types/theme");
83
- var Sentry = __importStar(require("@sentry/react-native"));
84
49
  var axios_1 = require("axios");
85
- var jwt_decode_1 = require("jwt-decode");
86
50
  var react_1 = require("react");
87
51
  var react_i18next_1 = require("react-i18next");
88
52
  var ThemeContext_1 = require("./ThemeContext");
89
- Sentry.init({
90
- dsn: 'https://96715a92da01f75091f8996d706f825a@o509172.ingest.us.sentry.io/4508844894912512',
91
- spotlight: __DEV__,
92
- tracesSampleRate: 1.0,
93
- profilesSampleRate: 1.0,
94
- environment: __DEV__ ? 'development' : 'production',
95
- beforeSend: function (event) {
96
- if (__DEV__)
97
- return null;
98
- return event;
99
- }
100
- });
101
53
  // eslint-disable-next-line react-refresh/only-export-components
102
54
  exports.ConsultationContext = (0, react_1.createContext)({
103
55
  region: 'ape1',
@@ -121,67 +73,88 @@ var ConsultationProvider = function (_a) {
121
73
  var _g = (0, react_1.useState)(null), slug = _g[0], setSlug = _g[1];
122
74
  var handleError = function (e) {
123
75
  console.error('🚨 Error caught on handler', e);
124
- Sentry.captureException(e, { level: 'error' });
125
76
  onError(e);
126
77
  };
127
78
  var initialise = function () { return __awaiter(void 0, void 0, void 0, function () {
128
- var userResponse, e_1, activeConsultation, e_2, ws, e_3;
79
+ var partnerInfo, e_1, userResponse, e_2, activeConsultation, e_3, ws, e_4;
129
80
  return __generator(this, function (_a) {
130
81
  switch (_a.label) {
131
82
  case 0:
132
83
  _a.trys.push([0, 2, , 3]);
133
- return [4 /*yield*/, (0, user_1.getUser)({ userId: userId })
134
- // Alert.alert(`👤 User: ${JSON.stringify(userResponse)}`)
135
- ];
84
+ return [4 /*yield*/, (0, partner_1.getPartnerInfo)()];
136
85
  case 1:
137
- userResponse = _a.sent();
138
- // Alert.alert(`👤 User: ${JSON.stringify(userResponse)}`)
139
- setUser(userResponse);
86
+ partnerInfo = _a.sent();
87
+ setSlug(partnerInfo.slug);
140
88
  return [3 /*break*/, 3];
141
89
  case 2:
142
90
  e_1 = _a.sent();
143
- console.error('Error getting user', e_1);
91
+ console.error('Error getting partner info', e_1);
144
92
  throw e_1;
145
93
  case 3:
146
94
  _a.trys.push([3, 5, , 6]);
147
- return [4 /*yield*/, (0, consultation_1.getActiveConsultation)(consultation_2.CASE_TYPE.VIDEO)({ userId: userId })];
95
+ return [4 /*yield*/, (0, user_1.getUser)({ userId: userId })];
148
96
  case 4:
149
- activeConsultation = _a.sent();
150
- console.log('⏮️ Active:', activeConsultation.consultation);
151
- // Alert.alert(`⏮️ Active: ${JSON.stringify(activeConsultation.consultation)}`)
152
- setConsultation(activeConsultation === null || activeConsultation === void 0 ? void 0 : activeConsultation.consultation);
97
+ userResponse = _a.sent();
98
+ setUser(userResponse);
153
99
  return [3 /*break*/, 6];
154
100
  case 5:
155
101
  e_2 = _a.sent();
156
- if ((0, axios_1.isAxiosError)(e_2) && e_2.status === 404) {
102
+ console.error('Error getting user', e_2);
103
+ throw e_2;
104
+ case 6:
105
+ _a.trys.push([6, 8, , 9]);
106
+ return [4 /*yield*/, (0, user_1.getActiveConsultation)({ userId: userId })];
107
+ case 7:
108
+ activeConsultation = _a.sent();
109
+ console.log('⏮️ Active:', activeConsultation.consultation);
110
+ setConsultation(activeConsultation === null || activeConsultation === void 0 ? void 0 : activeConsultation.consultation);
111
+ return [3 /*break*/, 9];
112
+ case 8:
113
+ e_3 = _a.sent();
114
+ if ((0, axios_1.isAxiosError)(e_3) && e_3.status === 404) {
157
115
  setConsultation(null);
158
116
  }
159
117
  else {
160
- console.error('Error getting active consultation', e_2);
161
- throw e_2;
118
+ console.error('Error getting active consultation', e_3);
119
+ throw e_3;
162
120
  }
163
- return [3 /*break*/, 6];
164
- case 6:
165
- _a.trys.push([6, 8, , 9]);
121
+ return [3 /*break*/, 9];
122
+ case 9:
123
+ _a.trys.push([9, 11, , 12]);
166
124
  return [4 /*yield*/, (0, websocket_1.connectWebsocket)({ token: token, userId: userId, region: region })];
167
- case 7:
125
+ case 10:
168
126
  ws = _a.sent();
169
127
  console.log('🔗 Websocket connected');
170
- // Alert.alert('🔗 Websocket connected')
171
128
  setWebsocket(ws);
172
- return [3 /*break*/, 9];
173
- case 8:
174
- e_3 = _a.sent();
175
- console.error('Error connecting to websocket', e_3);
176
- throw e_3;
177
- case 9: return [2 /*return*/];
129
+ return [3 /*break*/, 12];
130
+ case 11:
131
+ e_4 = _a.sent();
132
+ console.error('Error connecting to websocket', e_4);
133
+ throw e_4;
134
+ case 12: return [2 /*return*/];
178
135
  }
179
136
  });
180
137
  }); };
181
138
  (0, react_1.useEffect)(function () {
139
+ var _a, _b;
182
140
  if (!token || !region || !userId)
183
141
  return;
184
142
  (0, config_1.configureAxios)({ token: token, region: region });
143
+ (_a = config_1.axios === null || config_1.axios === void 0 ? void 0 : config_1.axios.interceptors) === null || _a === void 0 ? void 0 : _a.request.use(function (config) {
144
+ var method = config.method, url = config.url, data = config.data;
145
+ console.log({
146
+ service: 'API Rest',
147
+ message: "".concat(method === null || method === void 0 ? void 0 : method.toUpperCase(), " ").concat(url, " ").concat(data !== undefined ? "- body: ".concat(JSON.stringify(data)) : ' ')
148
+ });
149
+ return config;
150
+ });
151
+ (_b = config_1.axios === null || config_1.axios === void 0 ? void 0 : config_1.axios.interceptors) === null || _b === void 0 ? void 0 : _b.response.use(function (response) {
152
+ console.info({
153
+ service: 'API Rest Response',
154
+ message: JSON.stringify(response === null || response === void 0 ? void 0 : response.data)
155
+ });
156
+ return response;
157
+ });
185
158
  initialise().catch(function (e) {
186
159
  console.error('Error initialising', e);
187
160
  // Alert.alert('Error initialising', `${e.message}\n${JSON.stringify(e)}`)
@@ -193,10 +166,6 @@ var ConsultationProvider = function (_a) {
193
166
  websocket === null || websocket === void 0 ? void 0 : websocket.close();
194
167
  };
195
168
  }, [token, region, userId]);
196
- (0, react_1.useEffect)(function () {
197
- var decodedJwt = (0, jwt_decode_1.jwtDecode)(token);
198
- setSlug(decodedJwt.slug);
199
- }, [token]);
200
169
  (0, react_1.useEffect)(function () {
201
170
  console.log('WS changed', websocket);
202
171
  if (!websocket)
@@ -0,0 +1,8 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ import { Animated } from 'react-native';
3
+ interface ILoaderContext {
4
+ interpolatedBackground: Animated.AnimatedInterpolation<string | number> | string;
5
+ }
6
+ export declare const LoaderContext: React.Context<ILoaderContext>;
7
+ export declare const LoaderProvider: ({ children }: PropsWithChildren<{}>) => React.JSX.Element;
8
+ export {};