react-native-timacare 3.3.36 → 3.3.38

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 (57) hide show
  1. package/lib/commonjs/screens/home/Store.js +1 -1
  2. package/lib/commonjs/screens/home/Store.js.flow +3 -3
  3. package/lib/commonjs/screens/home/Store.js.map +1 -1
  4. package/lib/commonjs/screens/home/index.js +1 -1
  5. package/lib/commonjs/screens/home/index.js.flow +1 -1
  6. package/lib/commonjs/screens/home/index.js.map +1 -1
  7. package/lib/commonjs/screens/quick-submit/store.js +1 -1
  8. package/lib/commonjs/screens/quick-submit/store.js.flow +1 -1
  9. package/lib/commonjs/screens/quick-submit/store.js.map +1 -1
  10. package/lib/commonjs/screens/sign-tima/ViewContract.js +1 -1
  11. package/lib/commonjs/screens/sign-tima/ViewContract.js.flow +1 -0
  12. package/lib/commonjs/screens/sign-tima/ViewContract.js.map +1 -1
  13. package/lib/commonjs/screens/toan-trinh-so/store.js +1 -1
  14. package/lib/commonjs/screens/toan-trinh-so/store.js.flow +270 -263
  15. package/lib/commonjs/screens/toan-trinh-so/store.js.map +1 -1
  16. package/lib/commonjs/sdkConfig.js +1 -1
  17. package/lib/commonjs/sdkConfig.js.flow +35 -14
  18. package/lib/commonjs/sdkConfig.js.map +1 -1
  19. package/lib/commonjs/services/api/api-problem.js +1 -1
  20. package/lib/commonjs/services/api/api-problem.js.flow +32 -31
  21. package/lib/commonjs/services/api/api-problem.js.map +1 -1
  22. package/lib/commonjs/services/api/api.js +1 -1
  23. package/lib/commonjs/services/api/api.js.flow +238 -0
  24. package/lib/commonjs/services/api/api.js.map +1 -1
  25. package/lib/module/screens/home/Store.js +1 -1
  26. package/lib/module/screens/home/Store.js.map +1 -1
  27. package/lib/module/screens/home/index.js +1 -1
  28. package/lib/module/screens/home/index.js.map +1 -1
  29. package/lib/module/screens/quick-submit/store.js +1 -1
  30. package/lib/module/screens/quick-submit/store.js.map +1 -1
  31. package/lib/module/screens/sign-tima/ViewContract.js +1 -1
  32. package/lib/module/screens/sign-tima/ViewContract.js.map +1 -1
  33. package/lib/module/screens/toan-trinh-so/store.js +1 -1
  34. package/lib/module/screens/toan-trinh-so/store.js.map +1 -1
  35. package/lib/module/sdkConfig.js +1 -1
  36. package/lib/module/sdkConfig.js.map +1 -1
  37. package/lib/module/services/api/api-problem.js +1 -1
  38. package/lib/module/services/api/api-problem.js.map +1 -1
  39. package/lib/module/services/api/api.js +1 -1
  40. package/lib/module/services/api/api.js.map +1 -1
  41. package/lib/typescript/screens/sign-tima/ViewContract.d.ts.map +1 -1
  42. package/lib/typescript/screens/toan-trinh-so/store.d.ts.map +1 -1
  43. package/lib/typescript/sdkConfig.d.ts +23 -0
  44. package/lib/typescript/sdkConfig.d.ts.map +1 -1
  45. package/lib/typescript/services/api/api-problem.d.ts +10 -10
  46. package/lib/typescript/services/api/api-problem.d.ts.map +1 -1
  47. package/lib/typescript/services/api/api.d.ts +43 -0
  48. package/lib/typescript/services/api/api.d.ts.map +1 -1
  49. package/package.json +1 -1
  50. package/src/screens/home/Store.tsx +3 -3
  51. package/src/screens/home/index.tsx +1 -1
  52. package/src/screens/quick-submit/store.tsx +1 -1
  53. package/src/screens/sign-tima/ViewContract.tsx +1 -0
  54. package/src/screens/toan-trinh-so/store.ts +270 -263
  55. package/src/sdkConfig.ts +35 -14
  56. package/src/services/api/api-problem.ts +32 -31
  57. package/src/services/api/api.ts +238 -0
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.initSDK=exports.getSDKConfig=void 0;var _AppStore=_interopRequireDefault(require("./AppStore"));var config=null;var initSDK=exports.initSDK=function initSDK(options){config=options;_AppStore.default.getDeviceId();_AppStore.default.getPublicIp();_AppStore.default.getAppId();_AppStore.default.getDevicePayload();};var getSDKConfig=exports.getSDKConfig=function getSDKConfig(){if(!config){throw new Error("SDK not initialized. Call initSDK() first.");}return config;};
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.initSDK=exports.getSDKConfig=void 0;var _AppStore=_interopRequireDefault(require("./AppStore"));var config=null;var initSDK=exports.initSDK=function initSDK(options){config=options;_AppStore.default.getDeviceId();_AppStore.default.getPublicIp();_AppStore.default.getAppId();_AppStore.default.getDevicePayload();};var getSDKConfig=exports.getSDKConfig=function getSDKConfig(){if(!config){throw new Error('SDK not initialized. Call initSDK() first.');}return config;};
2
2
  //# sourceMappingURL=sdkConfig.js.map
@@ -1,24 +1,45 @@
1
- import appStore from "./AppStore";
1
+ import appStore from './AppStore';
2
+
3
+ /**
4
+ * Minimal shape of the @react-native-community/netinfo module.
5
+ * Injected by the host app so the SDK can detect offline state without
6
+ * taking a hard native dependency. Optional — when omitted, the SDK simply
7
+ * skips fast-fail offline handling and relies on request timeouts + retries.
8
+ */
9
+ export type NetInfoLike = {
10
+ fetch: () => Promise<{ isConnected: boolean | null }>;
11
+ addEventListener: (
12
+ listener: (state: { isConnected: boolean | null }) => void
13
+ ) => () => void;
14
+ };
2
15
 
3
16
  export type SDKConfig = {
4
- baseUrl: string;
5
- token?: string;
6
- timeout?: number;
17
+ baseUrl: string;
18
+ token?: string;
19
+ timeout?: number;
20
+ logout?: () => void;
21
+ /**
22
+ * Optional NetInfo module (pass the default export of
23
+ * '@react-native-community/netinfo'). Enables instant "no connection"
24
+ * failures instead of waiting for a timeout on weak networks.
25
+ */
26
+ netInfo?: NetInfoLike;
27
+ /** Timeout (ms) for idempotent GET requests. Defaults to 30000. */
28
+ getTimeout?: number;
7
29
  };
8
30
  let config: SDKConfig | null = null;
9
31
 
10
32
  export const initSDK = (options: SDKConfig) => {
11
- config = options;
12
- appStore.getDeviceId();
13
- appStore.getPublicIp();
14
- appStore.getAppId();
15
- appStore.getDevicePayload();
33
+ config = options;
34
+ appStore.getDeviceId();
35
+ appStore.getPublicIp();
36
+ appStore.getAppId();
37
+ appStore.getDevicePayload();
16
38
  };
17
39
 
18
40
  export const getSDKConfig = (): SDKConfig => {
19
- if (!config) {
20
- throw new Error("SDK not initialized. Call initSDK() first.");
21
- }
22
- return config;
41
+ if (!config) {
42
+ throw new Error('SDK not initialized. Call initSDK() first.');
43
+ }
44
+ return config;
23
45
  };
24
-
@@ -1 +1 @@
1
- {"version":3,"names":["_AppStore","_interopRequireDefault","require","config","initSDK","exports","options","appStore","getDeviceId","getPublicIp","getAppId","getDevicePayload","getSDKConfig","Error"],"sourceRoot":"../../src","sources":["sdkConfig.ts"],"mappings":"wLAAA,IAAAA,SAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAOA,GAAI,CAAAC,MAAwB,CAAG,IAAI,CAE5B,GAAM,CAAAC,OAAO,CAAAC,OAAA,CAAAD,OAAA,CAAG,QAAV,CAAAA,OAAOA,CAAIE,OAAkB,CAAK,CAC3CH,MAAM,CAAGG,OAAO,CAChBC,iBAAQ,CAACC,WAAW,CAAC,CAAC,CACtBD,iBAAQ,CAACE,WAAW,CAAC,CAAC,CACtBF,iBAAQ,CAACG,QAAQ,CAAC,CAAC,CACnBH,iBAAQ,CAACI,gBAAgB,CAAC,CAAC,CAC/B,CAAC,CAEM,GAAM,CAAAC,YAAY,CAAAP,OAAA,CAAAO,YAAA,CAAG,QAAf,CAAAA,YAAYA,CAAA,CAAoB,CACzC,GAAI,CAACT,MAAM,CAAE,CACT,KAAM,IAAI,CAAAU,KAAK,CAAC,4CAA4C,CAAC,CACjE,CACA,MAAO,CAAAV,MAAM,CACjB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_AppStore","_interopRequireDefault","require","config","initSDK","exports","options","appStore","getDeviceId","getPublicIp","getAppId","getDevicePayload","getSDKConfig","Error"],"sourceRoot":"../../src","sources":["sdkConfig.ts"],"mappings":"wLAAA,IAAAA,SAAA,CAAAC,sBAAA,CAAAC,OAAA,gBA6BA,GAAI,CAAAC,MAAwB,CAAG,IAAI,CAE5B,GAAM,CAAAC,OAAO,CAAAC,OAAA,CAAAD,OAAA,CAAG,QAAV,CAAAA,OAAOA,CAAIE,OAAkB,CAAK,CAC7CH,MAAM,CAAGG,OAAO,CAChBC,iBAAQ,CAACC,WAAW,CAAC,CAAC,CACtBD,iBAAQ,CAACE,WAAW,CAAC,CAAC,CACtBF,iBAAQ,CAACG,QAAQ,CAAC,CAAC,CACnBH,iBAAQ,CAACI,gBAAgB,CAAC,CAAC,CAC7B,CAAC,CAEM,GAAM,CAAAC,YAAY,CAAAP,OAAA,CAAAO,YAAA,CAAG,QAAf,CAAAA,YAAYA,CAAA,CAAoB,CAC3C,GAAI,CAACT,MAAM,CAAE,CACX,KAAM,IAAI,CAAAU,KAAK,CAAC,4CAA4C,CAAC,CAC/D,CACA,MAAO,CAAAV,MAAM,CACf,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.getGeneralApiProblem=getGeneralApiProblem;var _log=require("../../utils/log");function getGeneralApiProblem(response){(0,_log.myLog)(response);switch(response.problem){case"CONNECTION_ERROR":return{kind:"cannot-connect",temporary:true};case"NETWORK_ERROR":return{kind:"cannot-connect",temporary:true};case"TIMEOUT_ERROR":return{kind:"timeout",temporary:true};case"SERVER_ERROR":return{kind:"server"};case"UNKNOWN_ERROR":return{kind:"unknown",temporary:true};case"CLIENT_ERROR":switch(response.status){case 401:return{kind:"unauthorized"};case 403:return{kind:"forbidden"};case 404:return{kind:"not-found"};default:return{kind:"rejected"};}case"CANCEL_ERROR":return null;}return null;}
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.getGeneralApiProblem=getGeneralApiProblem;function getGeneralApiProblem(response){switch(response.problem){case'CONNECTION_ERROR':return{kind:'cannot-connect',temporary:true};case'NETWORK_ERROR':return{kind:'cannot-connect',temporary:true};case'TIMEOUT_ERROR':return{kind:'timeout',temporary:true};case'SERVER_ERROR':return{kind:'server'};case'UNKNOWN_ERROR':return{kind:'unknown',temporary:true};case'CLIENT_ERROR':switch(response.status){case 401:return{kind:'unauthorized'};case 403:return{kind:'forbidden'};case 404:return{kind:'not-found'};default:return{kind:'rejected'};}case'CANCEL_ERROR':return null;}return null;}
2
2
  //# sourceMappingURL=api-problem.js.map
@@ -1,77 +1,78 @@
1
1
  //@ts-nocheck
2
- import { ApiResponse } from "apisauce"
3
- import { myLog } from "../../utils/log"
2
+ import { ApiResponse } from 'apisauce';
3
+ import { myLog } from '../../utils/log';
4
4
 
5
5
  export type GeneralApiProblem =
6
6
  /**
7
7
  * Times up.
8
8
  */
9
- | { kind: "timeout"; temporary: true }
9
+ | { kind: 'timeout'; temporary: true }
10
10
  /**
11
11
  * Cannot connect to the server for some reason.
12
12
  */
13
- | { kind: "cannot-connect"; temporary: true }
13
+ | { kind: 'cannot-connect'; temporary: true }
14
14
  /**
15
15
  * The server experienced a problem. Any 5xx error.
16
16
  */
17
- | { kind: "server" }
17
+ | { kind: 'server' }
18
18
  /**
19
19
  * We're not allowed because we haven't identified ourself. This is 401.
20
20
  */
21
- | { kind: "unauthorized" }
21
+ | { kind: 'unauthorized' }
22
22
  /**
23
23
  * We don't have access to perform that request. This is 403.
24
24
  */
25
- | { kind: "forbidden" }
25
+ | { kind: 'forbidden' }
26
26
  /**
27
27
  * Unable to find that resource. This is a 404.
28
28
  */
29
- | { kind: "not-found" }
29
+ | { kind: 'not-found' }
30
30
  /**
31
31
  * All other 4xx series errors.
32
32
  */
33
- | { kind: "rejected" }
33
+ | { kind: 'rejected' }
34
34
  /**
35
35
  * Something truly unexpected happened. Most likely can try again. This is a catch all.
36
36
  */
37
- | { kind: "unknown"; temporary: true }
37
+ | { kind: 'unknown'; temporary: true }
38
38
  /**
39
39
  * The data we received is not in the expected format.
40
40
  */
41
- | { kind: "bad-data" }
41
+ | { kind: 'bad-data' };
42
42
 
43
43
  /**
44
44
  * Attempts to get a common cause of problems from an api response.
45
45
  *
46
46
  * @param response The api response.
47
47
  */
48
- export function getGeneralApiProblem(response: ApiResponse<any>): GeneralApiProblem | void {
49
- myLog(response)
48
+ export function getGeneralApiProblem(
49
+ response: ApiResponse<any>
50
+ ): GeneralApiProblem | void {
50
51
  switch (response.problem) {
51
- case "CONNECTION_ERROR":
52
- return { kind: "cannot-connect", temporary: true }
53
- case "NETWORK_ERROR":
54
- return { kind: "cannot-connect", temporary: true }
55
- case "TIMEOUT_ERROR":
56
- return { kind: "timeout", temporary: true }
57
- case "SERVER_ERROR":
58
- return { kind: "server" }
59
- case "UNKNOWN_ERROR":
60
- return { kind: "unknown", temporary: true }
61
- case "CLIENT_ERROR":
52
+ case 'CONNECTION_ERROR':
53
+ return { kind: 'cannot-connect', temporary: true };
54
+ case 'NETWORK_ERROR':
55
+ return { kind: 'cannot-connect', temporary: true };
56
+ case 'TIMEOUT_ERROR':
57
+ return { kind: 'timeout', temporary: true };
58
+ case 'SERVER_ERROR':
59
+ return { kind: 'server' };
60
+ case 'UNKNOWN_ERROR':
61
+ return { kind: 'unknown', temporary: true };
62
+ case 'CLIENT_ERROR':
62
63
  switch (response.status) {
63
64
  case 401:
64
- return { kind: "unauthorized" }
65
+ return { kind: 'unauthorized' };
65
66
  case 403:
66
- return { kind: "forbidden" }
67
+ return { kind: 'forbidden' };
67
68
  case 404:
68
- return { kind: "not-found" }
69
+ return { kind: 'not-found' };
69
70
  default:
70
- return { kind: "rejected" }
71
+ return { kind: 'rejected' };
71
72
  }
72
- case "CANCEL_ERROR":
73
- return null
73
+ case 'CANCEL_ERROR':
74
+ return null;
74
75
  }
75
76
 
76
- return null
77
+ return null;
77
78
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_log","require","getGeneralApiProblem","response","myLog","problem","kind","temporary","status"],"sourceRoot":"../../../../src","sources":["services/api/api-problem.ts"],"mappings":"2GAEA,IAAAA,IAAA,CAAAC,OAAA,oBA6CO,QAAS,CAAAC,oBAAoBA,CAACC,QAA0B,CAA4B,CACzF,GAAAC,UAAK,EAACD,QAAQ,CAAC,CACf,OAAQA,QAAQ,CAACE,OAAO,EACtB,IAAK,kBAAkB,CACrB,MAAO,CAAEC,IAAI,CAAE,gBAAgB,CAAEC,SAAS,CAAE,IAAK,CAAC,CACpD,IAAK,eAAe,CAClB,MAAO,CAAED,IAAI,CAAE,gBAAgB,CAAEC,SAAS,CAAE,IAAK,CAAC,CACpD,IAAK,eAAe,CAClB,MAAO,CAAED,IAAI,CAAE,SAAS,CAAEC,SAAS,CAAE,IAAK,CAAC,CAC7C,IAAK,cAAc,CACjB,MAAO,CAAED,IAAI,CAAE,QAAS,CAAC,CAC3B,IAAK,eAAe,CAClB,MAAO,CAAEA,IAAI,CAAE,SAAS,CAAEC,SAAS,CAAE,IAAK,CAAC,CAC7C,IAAK,cAAc,CACjB,OAAQJ,QAAQ,CAACK,MAAM,EACrB,IAAK,IAAG,CACN,MAAO,CAAEF,IAAI,CAAE,cAAe,CAAC,CACjC,IAAK,IAAG,CACN,MAAO,CAAEA,IAAI,CAAE,WAAY,CAAC,CAC9B,IAAK,IAAG,CACN,MAAO,CAAEA,IAAI,CAAE,WAAY,CAAC,CAC9B,QACE,MAAO,CAAEA,IAAI,CAAE,UAAW,CAAC,CAC/B,CACF,IAAK,cAAc,CACjB,MAAO,KAAI,CACf,CAEA,MAAO,KAAI,CACb","ignoreList":[]}
1
+ {"version":3,"names":["getGeneralApiProblem","response","problem","kind","temporary","status"],"sourceRoot":"../../../../src","sources":["services/api/api-problem.ts"],"mappings":"2GA+CO,QAAS,CAAAA,oBAAoBA,CAClCC,QAA0B,CACA,CAC1B,OAAQA,QAAQ,CAACC,OAAO,EACtB,IAAK,kBAAkB,CACrB,MAAO,CAAEC,IAAI,CAAE,gBAAgB,CAAEC,SAAS,CAAE,IAAK,CAAC,CACpD,IAAK,eAAe,CAClB,MAAO,CAAED,IAAI,CAAE,gBAAgB,CAAEC,SAAS,CAAE,IAAK,CAAC,CACpD,IAAK,eAAe,CAClB,MAAO,CAAED,IAAI,CAAE,SAAS,CAAEC,SAAS,CAAE,IAAK,CAAC,CAC7C,IAAK,cAAc,CACjB,MAAO,CAAED,IAAI,CAAE,QAAS,CAAC,CAC3B,IAAK,eAAe,CAClB,MAAO,CAAEA,IAAI,CAAE,SAAS,CAAEC,SAAS,CAAE,IAAK,CAAC,CAC7C,IAAK,cAAc,CACjB,OAAQH,QAAQ,CAACI,MAAM,EACrB,IAAK,IAAG,CACN,MAAO,CAAEF,IAAI,CAAE,cAAe,CAAC,CACjC,IAAK,IAAG,CACN,MAAO,CAAEA,IAAI,CAAE,WAAY,CAAC,CAC9B,IAAK,IAAG,CACN,MAAO,CAAEA,IAAI,CAAE,WAAY,CAAC,CAC9B,QACE,MAAO,CAAEA,IAAI,CAAE,UAAW,CAAC,CAC/B,CACF,IAAK,cAAc,CACjB,MAAO,KAAI,CACf,CAEA,MAAO,KAAI,CACb","ignoreList":[]}