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.
- package/lib/commonjs/screens/home/Store.js +1 -1
- package/lib/commonjs/screens/home/Store.js.flow +3 -3
- package/lib/commonjs/screens/home/Store.js.map +1 -1
- package/lib/commonjs/screens/home/index.js +1 -1
- package/lib/commonjs/screens/home/index.js.flow +1 -1
- package/lib/commonjs/screens/home/index.js.map +1 -1
- package/lib/commonjs/screens/quick-submit/store.js +1 -1
- package/lib/commonjs/screens/quick-submit/store.js.flow +1 -1
- package/lib/commonjs/screens/quick-submit/store.js.map +1 -1
- package/lib/commonjs/screens/sign-tima/ViewContract.js +1 -1
- package/lib/commonjs/screens/sign-tima/ViewContract.js.flow +1 -0
- package/lib/commonjs/screens/sign-tima/ViewContract.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/store.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/store.js.flow +270 -263
- package/lib/commonjs/screens/toan-trinh-so/store.js.map +1 -1
- package/lib/commonjs/sdkConfig.js +1 -1
- package/lib/commonjs/sdkConfig.js.flow +35 -14
- package/lib/commonjs/sdkConfig.js.map +1 -1
- package/lib/commonjs/services/api/api-problem.js +1 -1
- package/lib/commonjs/services/api/api-problem.js.flow +32 -31
- package/lib/commonjs/services/api/api-problem.js.map +1 -1
- package/lib/commonjs/services/api/api.js +1 -1
- package/lib/commonjs/services/api/api.js.flow +238 -0
- package/lib/commonjs/services/api/api.js.map +1 -1
- package/lib/module/screens/home/Store.js +1 -1
- package/lib/module/screens/home/Store.js.map +1 -1
- package/lib/module/screens/home/index.js +1 -1
- package/lib/module/screens/home/index.js.map +1 -1
- package/lib/module/screens/quick-submit/store.js +1 -1
- package/lib/module/screens/quick-submit/store.js.map +1 -1
- package/lib/module/screens/sign-tima/ViewContract.js +1 -1
- package/lib/module/screens/sign-tima/ViewContract.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/store.js +1 -1
- package/lib/module/screens/toan-trinh-so/store.js.map +1 -1
- package/lib/module/sdkConfig.js +1 -1
- package/lib/module/sdkConfig.js.map +1 -1
- package/lib/module/services/api/api-problem.js +1 -1
- package/lib/module/services/api/api-problem.js.map +1 -1
- package/lib/module/services/api/api.js +1 -1
- package/lib/module/services/api/api.js.map +1 -1
- package/lib/typescript/screens/sign-tima/ViewContract.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/store.d.ts.map +1 -1
- package/lib/typescript/sdkConfig.d.ts +23 -0
- package/lib/typescript/sdkConfig.d.ts.map +1 -1
- package/lib/typescript/services/api/api-problem.d.ts +10 -10
- package/lib/typescript/services/api/api-problem.d.ts.map +1 -1
- package/lib/typescript/services/api/api.d.ts +43 -0
- package/lib/typescript/services/api/api.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/screens/home/Store.tsx +3 -3
- package/src/screens/home/index.tsx +1 -1
- package/src/screens/quick-submit/store.tsx +1 -1
- package/src/screens/sign-tima/ViewContract.tsx +1 -0
- package/src/screens/toan-trinh-so/store.ts +270 -263
- package/src/sdkConfig.ts +35 -14
- package/src/services/api/api-problem.ts +32 -31
- 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(
|
|
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
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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,
|
|
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;
|
|
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
|
|
3
|
-
import { myLog } from
|
|
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:
|
|
9
|
+
| { kind: 'timeout'; temporary: true }
|
|
10
10
|
/**
|
|
11
11
|
* Cannot connect to the server for some reason.
|
|
12
12
|
*/
|
|
13
|
-
| { kind:
|
|
13
|
+
| { kind: 'cannot-connect'; temporary: true }
|
|
14
14
|
/**
|
|
15
15
|
* The server experienced a problem. Any 5xx error.
|
|
16
16
|
*/
|
|
17
|
-
| { kind:
|
|
17
|
+
| { kind: 'server' }
|
|
18
18
|
/**
|
|
19
19
|
* We're not allowed because we haven't identified ourself. This is 401.
|
|
20
20
|
*/
|
|
21
|
-
| { kind:
|
|
21
|
+
| { kind: 'unauthorized' }
|
|
22
22
|
/**
|
|
23
23
|
* We don't have access to perform that request. This is 403.
|
|
24
24
|
*/
|
|
25
|
-
| { kind:
|
|
25
|
+
| { kind: 'forbidden' }
|
|
26
26
|
/**
|
|
27
27
|
* Unable to find that resource. This is a 404.
|
|
28
28
|
*/
|
|
29
|
-
| { kind:
|
|
29
|
+
| { kind: 'not-found' }
|
|
30
30
|
/**
|
|
31
31
|
* All other 4xx series errors.
|
|
32
32
|
*/
|
|
33
|
-
| { kind:
|
|
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:
|
|
37
|
+
| { kind: 'unknown'; temporary: true }
|
|
38
38
|
/**
|
|
39
39
|
* The data we received is not in the expected format.
|
|
40
40
|
*/
|
|
41
|
-
| { kind:
|
|
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(
|
|
49
|
-
|
|
48
|
+
export function getGeneralApiProblem(
|
|
49
|
+
response: ApiResponse<any>
|
|
50
|
+
): GeneralApiProblem | void {
|
|
50
51
|
switch (response.problem) {
|
|
51
|
-
case
|
|
52
|
-
return { kind:
|
|
53
|
-
case
|
|
54
|
-
return { kind:
|
|
55
|
-
case
|
|
56
|
-
return { kind:
|
|
57
|
-
case
|
|
58
|
-
return { kind:
|
|
59
|
-
case
|
|
60
|
-
return { kind:
|
|
61
|
-
case
|
|
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:
|
|
65
|
+
return { kind: 'unauthorized' };
|
|
65
66
|
case 403:
|
|
66
|
-
return { kind:
|
|
67
|
+
return { kind: 'forbidden' };
|
|
67
68
|
case 404:
|
|
68
|
-
return { kind:
|
|
69
|
+
return { kind: 'not-found' };
|
|
69
70
|
default:
|
|
70
|
-
return { kind:
|
|
71
|
+
return { kind: 'rejected' };
|
|
71
72
|
}
|
|
72
|
-
case
|
|
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":["
|
|
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":[]}
|