@medipass/web-sdk 11.38.1-feature-eclipse-reporting.0 → 11.38.1-feature-typescript-claudia.2

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 (296) hide show
  1. package/.eslintrc.cjs +96 -0
  2. package/babel.config.js +2 -1
  3. package/lib/index.d.ts +262 -0
  4. package/lib/index.js +83 -3
  5. package/lib/{regions-7b23080d.js → regions-a0a28864.js} +2 -2
  6. package/lib/resources/accounts.d.ts +215 -0
  7. package/lib/resources/accounts.js +3 -3
  8. package/lib/resources/actions.d.ts +13 -0
  9. package/lib/resources/actions.js +3 -3
  10. package/lib/resources/api-keys.d.ts +24 -0
  11. package/lib/resources/api-keys.js +3 -3
  12. package/lib/resources/applications.d.ts +31 -0
  13. package/lib/resources/applications.js +3 -3
  14. package/lib/resources/attachments.d.ts +32 -0
  15. package/lib/resources/attachments.js +3 -3
  16. package/lib/resources/auth.d.ts +59 -0
  17. package/lib/resources/auth.js +3 -3
  18. package/lib/resources/bulk-submits.d.ts +17 -0
  19. package/lib/resources/bulk-submits.js +3 -3
  20. package/lib/resources/bulk-uploads.d.ts +26 -0
  21. package/lib/resources/bulk-uploads.js +3 -3
  22. package/lib/resources/business-profiles.d.ts +18 -0
  23. package/lib/resources/business-profiles.js +3 -3
  24. package/lib/resources/businesses.d.ts +132 -0
  25. package/lib/resources/businesses.js +3 -3
  26. package/lib/resources/claim-items.d.ts +31 -0
  27. package/lib/resources/claim-items.js +3 -3
  28. package/lib/resources/devices.d.ts +11 -0
  29. package/lib/resources/devices.js +3 -3
  30. package/lib/resources/doc-accounts.d.ts +32 -0
  31. package/lib/resources/doc-accounts.js +3 -3
  32. package/lib/resources/documents.d.ts +90 -0
  33. package/lib/resources/documents.js +3 -3
  34. package/lib/resources/emails.d.ts +14 -0
  35. package/lib/resources/emails.js +3 -3
  36. package/lib/resources/form-application-templates.d.ts +20 -0
  37. package/lib/resources/form-application-templates.js +3 -3
  38. package/lib/resources/form-applications.d.ts +27 -0
  39. package/lib/resources/form-applications.js +3 -3
  40. package/lib/resources/forms.d.ts +100 -0
  41. package/lib/resources/forms.js +3 -3
  42. package/lib/resources/funder-services.d.ts +8 -0
  43. package/lib/resources/funder-services.js +3 -3
  44. package/lib/resources/funder-settings.d.ts +8 -0
  45. package/lib/resources/funder-settings.js +3 -3
  46. package/lib/resources/funders.d.ts +5 -0
  47. package/lib/resources/funders.js +3 -3
  48. package/lib/resources/futures.d.ts +85 -0
  49. package/lib/resources/futures.js +3 -3
  50. package/lib/resources/health-fund-accounts.d.ts +78 -0
  51. package/lib/resources/health-fund-accounts.js +3 -3
  52. package/lib/resources/health-fund-settings.d.ts +39 -0
  53. package/lib/resources/health-fund-settings.js +3 -3
  54. package/lib/resources/healthfunds.d.ts +64 -0
  55. package/lib/resources/healthfunds.js +3 -3
  56. package/lib/resources/icditems.d.ts +14 -0
  57. package/lib/resources/icditems.js +3 -3
  58. package/lib/resources/invoice-scans.d.ts +26 -0
  59. package/lib/resources/invoice-scans.js +3 -3
  60. package/lib/resources/jhcs.d.ts +7 -0
  61. package/lib/resources/jhcs.js +3 -3
  62. package/lib/resources/kyc.d.ts +109 -0
  63. package/lib/resources/kyc.js +3 -3
  64. package/lib/resources/logs.d.ts +16 -0
  65. package/lib/resources/logs.js +3 -3
  66. package/lib/resources/members.d.ts +92 -0
  67. package/lib/resources/members.js +3 -3
  68. package/lib/resources/message-mappings.d.ts +9 -0
  69. package/lib/resources/message-mappings.js +3 -3
  70. package/lib/resources/minions.d.ts +40 -0
  71. package/lib/resources/minions.js +3 -3
  72. package/lib/resources/modalities.d.ts +19 -0
  73. package/lib/resources/modalities.js +3 -3
  74. package/lib/resources/notes.d.ts +17 -0
  75. package/lib/resources/notes.js +3 -3
  76. package/lib/resources/onboarding-applications.d.ts +52 -0
  77. package/lib/resources/onboarding-applications.js +3 -3
  78. package/lib/resources/onboarding-requests.d.ts +39 -0
  79. package/lib/resources/onboarding-requests.js +3 -3
  80. package/lib/resources/ops.d.ts +60 -0
  81. package/lib/resources/ops.js +3 -3
  82. package/lib/resources/organisations.d.ts +7 -0
  83. package/lib/resources/organisations.js +3 -3
  84. package/lib/resources/partners.d.ts +50 -0
  85. package/lib/resources/partners.js +3 -3
  86. package/lib/resources/patients.d.ts +44 -0
  87. package/lib/resources/patients.js +3 -3
  88. package/lib/resources/payments.d.ts +155 -0
  89. package/lib/resources/payments.js +3 -3
  90. package/lib/resources/pms.d.ts +43 -0
  91. package/lib/resources/pms.js +3 -3
  92. package/lib/resources/practice-profiles.d.ts +20 -0
  93. package/lib/resources/practice-profiles.js +3 -3
  94. package/lib/resources/practice-types.d.ts +6 -0
  95. package/lib/resources/practice-types.js +3 -3
  96. package/lib/resources/practices.d.ts +137 -0
  97. package/lib/resources/practices.js +3 -3
  98. package/lib/resources/products.d.ts +23 -0
  99. package/lib/resources/products.js +3 -3
  100. package/lib/resources/professional-categories.d.ts +23 -0
  101. package/lib/resources/professional-categories.js +3 -3
  102. package/lib/resources/provider-number-types.d.ts +16 -0
  103. package/lib/resources/provider-number-types.js +3 -3
  104. package/lib/resources/provider-registration-types.d.ts +15 -0
  105. package/lib/resources/provider-registration-types.js +3 -3
  106. package/lib/resources/provider-requests.d.ts +17 -0
  107. package/lib/resources/provider-requests.js +3 -3
  108. package/lib/resources/provider-types.d.ts +6 -0
  109. package/lib/resources/provider-types.js +3 -3
  110. package/lib/resources/ref-sources.d.ts +6 -0
  111. package/lib/resources/ref-sources.js +3 -3
  112. package/lib/resources/risk.d.ts +13 -0
  113. package/lib/resources/risk.js +3 -3
  114. package/lib/resources/rnas.d.ts +43 -0
  115. package/lib/resources/rnas.js +3 -3
  116. package/lib/resources/roles.d.ts +7 -0
  117. package/lib/resources/roles.js +3 -3
  118. package/lib/resources/self-checkout-sessions.d.ts +134 -0
  119. package/lib/resources/self-checkout-sessions.js +3 -3
  120. package/lib/resources/services.d.ts +88 -0
  121. package/lib/resources/services.js +3 -3
  122. package/lib/resources/settlements.d.ts +37 -0
  123. package/lib/resources/settlements.js +3 -3
  124. package/lib/resources/sign-up.d.ts +5 -0
  125. package/lib/resources/sign-up.js +3 -3
  126. package/lib/resources/specialties.d.ts +23 -0
  127. package/lib/resources/specialties.js +3 -3
  128. package/lib/resources/staff-profiles.d.ts +20 -0
  129. package/lib/resources/staff-profiles.js +3 -3
  130. package/lib/resources/staff.d.ts +242 -0
  131. package/lib/resources/staff.js +3 -3
  132. package/lib/resources/statistics.d.ts +56 -0
  133. package/lib/resources/statistics.js +3 -3
  134. package/lib/resources/subscriptions.d.ts +32 -0
  135. package/lib/resources/subscriptions.js +3 -3
  136. package/lib/resources/terminals.d.ts +71 -0
  137. package/lib/resources/terminals.js +3 -3
  138. package/lib/resources/transaction-export.d.ts +18 -0
  139. package/lib/resources/transaction-export.js +3 -3
  140. package/lib/resources/transactions.d.ts +466 -0
  141. package/lib/resources/transactions.js +3 -3
  142. package/lib/resources/triggers.d.ts +20 -0
  143. package/lib/resources/triggers.js +3 -3
  144. package/lib/resources/vendors.d.ts +9 -0
  145. package/lib/resources/vendors.js +3 -3
  146. package/lib/resources/verify.d.ts +9 -0
  147. package/lib/resources/verify.js +3 -3
  148. package/lib/resources/workers.d.ts +3 -0
  149. package/lib/resources/workers.js +3 -3
  150. package/lib/resources/workflow-exceptions.d.ts +5 -0
  151. package/lib/resources/workflow-exceptions.js +3 -3
  152. package/lib/services/aws.d.ts +54 -0
  153. package/lib/services/aws.js +3 -3
  154. package/lib/services/storage.d.ts +28 -0
  155. package/lib/services/storage.js +126 -18
  156. package/lib/services/version.d.ts +21 -0
  157. package/lib/services/version.js +3 -3
  158. package/lib/{staff-1ec3d500.js → staff-96febcd8.js} +345 -738
  159. package/lib/types/documents.d.ts +115 -0
  160. package/lib/types/documents.js +2 -0
  161. package/lib/types/forms.d.ts +67 -0
  162. package/lib/types/forms.js +2 -0
  163. package/lib/types/index.d.ts +42 -0
  164. package/lib/types/index.js +2 -0
  165. package/lib/types/message-mappings.d.ts +18 -0
  166. package/lib/types/message-mappings.js +2 -0
  167. package/lib/types/notes.d.ts +5 -0
  168. package/lib/types/notes.js +2 -0
  169. package/lib/types/products.d.ts +34 -0
  170. package/lib/types/products.js +2 -0
  171. package/lib/types/professional-categories.d.ts +20 -0
  172. package/lib/types/professional-categories.js +2 -0
  173. package/lib/types/specialties.d.ts +22 -0
  174. package/lib/types/specialties.js +2 -0
  175. package/lib/types/subscriptions.d.ts +52 -0
  176. package/lib/types/subscriptions.js +2 -0
  177. package/lib/utils/application.d.ts +1 -0
  178. package/lib/utils/application.js +3 -3
  179. package/lib/utils/base-urls/core.d.ts +19 -0
  180. package/lib/utils/base-urls/index.d.ts +37 -0
  181. package/lib/utils/base-urls/risk.d.ts +17 -0
  182. package/lib/utils/does-param-exist.d.ts +2 -0
  183. package/lib/utils/get-axios-error.d.ts +2 -0
  184. package/lib/utils/param-error.d.ts +3 -0
  185. package/lib/utils/professions.d.ts +3 -0
  186. package/lib/utils/professions.js +3 -3
  187. package/lib/utils/regions.d.ts +1 -0
  188. package/lib/utils/regions.js +2 -2
  189. package/lib/utils/request.d.ts +3 -0
  190. package/lib/utils/request.js +3 -3
  191. package/lib/utils/staff.d.ts +8 -0
  192. package/lib/utils/staff.js +3 -3
  193. package/package.json +19 -9
  194. package/tsconfig.json +33 -0
  195. package/types/globals.d.ts +7 -0
  196. package/types/index.d.ts +1 -0
  197. package/.eslintrc +0 -3
  198. package/lib/_types/documents.js.flow +0 -118
  199. package/lib/_types/forms.js.flow +0 -57
  200. package/lib/_types/index.js.flow +0 -47
  201. package/lib/_types/message-mappings.js.flow +0 -22
  202. package/lib/_types/notes.js.flow +0 -7
  203. package/lib/_types/products.js.flow +0 -40
  204. package/lib/_types/professional-categories.js.flow +0 -25
  205. package/lib/_types/specialties.js.flow +0 -27
  206. package/lib/_types/subscriptions.js.flow +0 -58
  207. package/lib/index.js.flow +0 -438
  208. package/lib/resources/accounts.js.flow +0 -445
  209. package/lib/resources/actions.js.flow +0 -25
  210. package/lib/resources/api-keys.js.flow +0 -54
  211. package/lib/resources/applications.js.flow +0 -60
  212. package/lib/resources/attachments.js.flow +0 -75
  213. package/lib/resources/auth.js.flow +0 -185
  214. package/lib/resources/bulk-submits.js.flow +0 -43
  215. package/lib/resources/bulk-uploads.js.flow +0 -56
  216. package/lib/resources/business-profiles.js.flow +0 -45
  217. package/lib/resources/businesses.js.flow +0 -267
  218. package/lib/resources/claim-items.js.flow +0 -76
  219. package/lib/resources/devices.js.flow +0 -64
  220. package/lib/resources/doc-accounts.js.flow +0 -61
  221. package/lib/resources/documents.js.flow +0 -216
  222. package/lib/resources/emails.js.flow +0 -96
  223. package/lib/resources/form-application-templates.js.flow +0 -52
  224. package/lib/resources/form-applications.js.flow +0 -62
  225. package/lib/resources/forms.js.flow +0 -222
  226. package/lib/resources/funder-services.js.flow +0 -17
  227. package/lib/resources/funder-settings.js.flow +0 -58
  228. package/lib/resources/funders.js.flow +0 -15
  229. package/lib/resources/futures.js.flow +0 -154
  230. package/lib/resources/health-fund-accounts.js.flow +0 -198
  231. package/lib/resources/health-fund-settings.js.flow +0 -104
  232. package/lib/resources/healthfunds.js.flow +0 -139
  233. package/lib/resources/icditems.js.flow +0 -36
  234. package/lib/resources/invoice-scans.js.flow +0 -56
  235. package/lib/resources/jhcs.js.flow +0 -20
  236. package/lib/resources/kyc.js.flow +0 -216
  237. package/lib/resources/logs.js.flow +0 -32
  238. package/lib/resources/members.js.flow +0 -196
  239. package/lib/resources/message-mappings.js.flow +0 -25
  240. package/lib/resources/minions.js.flow +0 -96
  241. package/lib/resources/modalities.js.flow +0 -46
  242. package/lib/resources/notes.js.flow +0 -112
  243. package/lib/resources/onboarding-applications.js.flow +0 -142
  244. package/lib/resources/onboarding-requests.js.flow +0 -97
  245. package/lib/resources/ops.js.flow +0 -116
  246. package/lib/resources/organisations.js.flow +0 -15
  247. package/lib/resources/partners.js.flow +0 -118
  248. package/lib/resources/patients.js.flow +0 -102
  249. package/lib/resources/payments.js.flow +0 -523
  250. package/lib/resources/pms.js.flow +0 -102
  251. package/lib/resources/practice-profiles.js.flow +0 -51
  252. package/lib/resources/practice-types.js.flow +0 -14
  253. package/lib/resources/practices.js.flow +0 -314
  254. package/lib/resources/products.js.flow +0 -48
  255. package/lib/resources/professional-categories.js.flow +0 -56
  256. package/lib/resources/provider-number-types.js.flow +0 -32
  257. package/lib/resources/provider-registration-types.js.flow +0 -32
  258. package/lib/resources/provider-requests.js.flow +0 -46
  259. package/lib/resources/provider-types.js.flow +0 -14
  260. package/lib/resources/ref-sources.js.flow +0 -16
  261. package/lib/resources/risk.js.flow +0 -29
  262. package/lib/resources/rnas.js.flow +0 -108
  263. package/lib/resources/roles.js.flow +0 -12
  264. package/lib/resources/self-checkout-sessions.js.flow +0 -382
  265. package/lib/resources/services.js.flow +0 -219
  266. package/lib/resources/settlements.js.flow +0 -97
  267. package/lib/resources/sign-up.js.flow +0 -15
  268. package/lib/resources/specialties.js.flow +0 -46
  269. package/lib/resources/staff-profiles.js.flow +0 -51
  270. package/lib/resources/staff.js.flow +0 -583
  271. package/lib/resources/statistics.js.flow +0 -147
  272. package/lib/resources/subscriptions.js.flow +0 -81
  273. package/lib/resources/terminals.js.flow +0 -161
  274. package/lib/resources/transaction-export.js.flow +0 -48
  275. package/lib/resources/transactions.js.flow +0 -1097
  276. package/lib/resources/triggers.js.flow +0 -36
  277. package/lib/resources/vendors.js.flow +0 -28
  278. package/lib/resources/verify.js.flow +0 -14
  279. package/lib/resources/workers.js.flow +0 -10
  280. package/lib/resources/workflow-exceptions.js.flow +0 -17
  281. package/lib/services/__mocks__/storage.js.flow +0 -30
  282. package/lib/services/aws.js.flow +0 -339
  283. package/lib/services/storage.js.flow +0 -92
  284. package/lib/services/version.js.flow +0 -73
  285. package/lib/storage-4b403caa.js +0 -1300
  286. package/lib/utils/application.js.flow +0 -23
  287. package/lib/utils/base-urls/core.js.flow +0 -18
  288. package/lib/utils/base-urls/index.js.flow +0 -7
  289. package/lib/utils/base-urls/risk.js.flow +0 -16
  290. package/lib/utils/does-param-exist.js.flow +0 -23
  291. package/lib/utils/get-axios-error.js.flow +0 -8
  292. package/lib/utils/param-error.js.flow +0 -8
  293. package/lib/utils/professions.js.flow +0 -66
  294. package/lib/utils/regions.js.flow +0 -21
  295. package/lib/utils/request.js.flow +0 -36
  296. package/lib/utils/staff.js.flow +0 -81
@@ -1,36 +0,0 @@
1
- // @flow
2
- import request from '../utils/request';
3
- import doesParamExist from '../utils/does-param-exist';
4
- import { type MedipassRequestOpts } from '../_types';
5
-
6
- const pathTrigger = triggerId => `/triggers/${triggerId}`;
7
- const PATH__TRIGGERS = '/triggers';
8
- const PATH__TRIGGER_CATEGORIES = '/triggercategories';
9
-
10
- /**
11
- * Get trigger
12
- * @param {String} triggerId - Trigger ID
13
- * @param {Object} opts - Additional options
14
- */
15
- export const getTrigger = async (triggerId: string, opts?: MedipassRequestOpts = {}): Promise<Object> => {
16
- doesParamExist({ triggerId }, opts.hyperMediaEndpoint);
17
- return request({ ...opts, path: pathTrigger(triggerId) }, { method: 'get' });
18
- };
19
-
20
- /**
21
- * Get triggers
22
- * @param {Object} query - Query parameters
23
- * @param {Object} opts - Additional options
24
- */
25
- export const getTriggers = async (query?: Object = {}, opts?: MedipassRequestOpts = {}): Promise<Object> => {
26
- return request({ ...opts, path: PATH__TRIGGERS }, { method: 'get', params: query });
27
- };
28
-
29
- /**
30
- * Get trigger categories
31
- * @param {Object} query - Query parameters
32
- * @param {Object} opts - Additional options
33
- */
34
- export const getTriggerCategories = async (query?: Object = {}, opts?: MedipassRequestOpts = {}): Promise<Object> => {
35
- return request({ ...opts, path: PATH__TRIGGER_CATEGORIES }, { method: 'get', params: query });
36
- };
@@ -1,28 +0,0 @@
1
- // @flow
2
-
3
- import doesParamExist from '../utils/does-param-exist';
4
- import request from '../utils/request';
5
- import type { MedipassRequestOpts, PaginatedQuery } from '../_types';
6
-
7
- export const pathHealthFundVendors = (healthFundId: string) => `/healthfunds/${healthFundId}/vendors`;
8
- export const pathHealthFundVendor = (healthFundId: string, vendorId: string) =>
9
- `/healthfunds/${healthFundId}/vendors/${vendorId}`;
10
-
11
- export const getHealthFundVendor = (
12
- healthFundId: string,
13
- vendorId: string,
14
- query?: ?{ includeDeleted: boolean },
15
- opts?: MedipassRequestOpts = {}
16
- ): Promise<Object> => {
17
- doesParamExist({ healthFundId, vendorId }, opts.hyperMediaEndpoint);
18
- return request({ ...opts, path: pathHealthFundVendor(healthFundId, vendorId) }, { method: 'get', params: query });
19
- };
20
-
21
- export const getHealthFundVendors = (
22
- healthFundId: string,
23
- query?: ?{ ...PaginatedQuery, searchText?: string },
24
- opts?: MedipassRequestOpts = {}
25
- ): Promise<Object> => {
26
- doesParamExist({ healthFundId }, opts.hyperMediaEndpoint);
27
- return request({ ...opts, path: pathHealthFundVendors(healthFundId) }, { method: 'get', params: query });
28
- };
@@ -1,14 +0,0 @@
1
- // @flow
2
- import request from '../utils/request';
3
- import { type MedipassRequestOpts } from '../_types';
4
-
5
- export const PATH__MEDICARE_VERIFY = '/medicare/verify';
6
-
7
- /**
8
- * Verify medicare details
9
- * @param {Object} body - Request body
10
- * @param {Object} opts - Additional options
11
- */
12
- export const verifyMedicare = async (body: Object, opts?: MedipassRequestOpts = {}): Promise<Object> => {
13
- return request({ ...opts, path: PATH__MEDICARE_VERIFY }, { method: 'POST', data: body });
14
- };
@@ -1,10 +0,0 @@
1
- // @flow
2
-
3
- import request from '../utils/request';
4
- import type { MedipassRequestOpts } from '../_types';
5
-
6
- export const pathSendWorkerMessage = () => `/workers/messages`;
7
-
8
- export const sendWorkerMessage = (body: Object, opts?: MedipassRequestOpts = {}): Promise<Object> => {
9
- return request({ ...opts, path: pathSendWorkerMessage() }, { method: 'post', data: body });
10
- };
@@ -1,17 +0,0 @@
1
- // @flow
2
-
3
- import doesParamExist from '../utils/does-param-exist';
4
- import request from '../utils/request';
5
- import type { MedipassRequestOpts, PaginatedQuery } from '../_types';
6
-
7
- export const pathHealthFundWorkflowExceptions = (healthFundId: string) =>
8
- `/healthfunds/${healthFundId}/workflowexceptions`;
9
-
10
- export const getHealthFundWorkflowExceptions = (
11
- healthFundId: string,
12
- query?: ?{ ...PaginatedQuery, searchText?: string },
13
- opts?: MedipassRequestOpts = {}
14
- ): Promise<Object> => {
15
- doesParamExist({ healthFundId }, opts.hyperMediaEndpoint);
16
- return request({ ...opts, path: pathHealthFundWorkflowExceptions(healthFundId) }, { method: 'get', params: query });
17
- };
@@ -1,30 +0,0 @@
1
- const storage = jest.genMockFromModule('../storage');
2
-
3
- export const mockAccount = { _id: 'mockAccountId' };
4
- export const mockAccountId = mockAccount._id;
5
- export const mockDevice = { deviceId: 'mockDeviceId' };
6
- export const mockTokens = { account: 'mockAccountToken', session: 'mockSessionToken' };
7
- export const mockIsSuperAdmin = false;
8
-
9
- const store = {
10
- account: mockAccount,
11
- accountId: mockAccountId,
12
- device: mockDevice,
13
- tokens: mockTokens,
14
- isSuperAdmin: mockIsSuperAdmin
15
- };
16
-
17
- const newStorage = {
18
- ...storage,
19
- clearAll: jest.fn(),
20
- get: key => store[key],
21
- set: (key, val) => {
22
- store[key] = val;
23
- },
24
- remove: key => {
25
- delete store[key];
26
- },
27
- onboardingStatus: { remove: jest.fn() }
28
- };
29
-
30
- export default newStorage;
@@ -1,339 +0,0 @@
1
- // @flow
2
-
3
- import axios from 'axios';
4
-
5
- import { getHealthFundFormUploadUrl } from '../resources/forms';
6
- import { getClaimAttachmentUrl } from '../resources/attachments';
7
- import { getManualFormUploadUrl } from '../resources/forms';
8
- import { getBusinessPracticeUploadUrl, updateBusinessPractice } from '../resources/practices';
9
- import { getBusinessStaffUploadUrl, updateBusinessStaffMember } from '../resources/staff';
10
- import { getInvoiceScanUploadUrl } from '../resources/invoice-scans';
11
- import { getBulkUploadUrl } from '../resources/bulk-uploads';
12
- import { getTrustDocumentUploadUrl } from '../resources/kyc';
13
- import ParamError from '../utils/param-error';
14
-
15
- /**
16
- * Upload health fund form file to S3
17
- * @param {String} healthFundId - Health fund ID
18
- * @param {Object} file - File
19
- */
20
- export const uploadHealthFundFormFileToS3 = async (healthFundId: string, file: any, opts?: Object): Promise<Object> => {
21
- const awsAxios = axios.create();
22
-
23
- if (!healthFundId) {
24
- throw new ParamError('healthFundId');
25
- }
26
- if (!file) {
27
- throw new ParamError('file');
28
- }
29
-
30
- try {
31
- const { signedPost, s3Url } = await getHealthFundFormUploadUrl(
32
- healthFundId,
33
- { contentType: file.type, fileName: file.name },
34
- opts
35
- );
36
- // eslint-disable-next-line
37
- var bodyFormData = new FormData();
38
- for (var key in signedPost.fields) {
39
- bodyFormData.append(key, signedPost.fields[key]);
40
- }
41
- bodyFormData.append('file', file);
42
- await awsAxios.post(signedPost.url, bodyFormData);
43
- return { publicUrl: s3Url };
44
- } catch (err) {
45
- throw err;
46
- }
47
- };
48
-
49
- /**
50
- * Upload scanned application to S3
51
- * @param {String} businessId
52
- * @param {String} practiceId
53
- * @param {String} formId
54
- * @param {Object} file - File
55
- */
56
- export const uploadScannedApplicationToS3 = async (
57
- businessId: string,
58
- practiceId: string,
59
- formId: string,
60
- file: any,
61
- opts?: Object
62
- ): Promise<Object> => {
63
- const awsAxios = axios.create();
64
-
65
- if (!businessId) {
66
- throw new ParamError('businessId');
67
- }
68
- if (!practiceId) {
69
- throw new ParamError('practiceId');
70
- }
71
- if (!formId) {
72
- throw new ParamError('formId');
73
- }
74
- if (!file) {
75
- throw new ParamError('file');
76
- }
77
-
78
- try {
79
- const { signedPost, s3Url } = await getManualFormUploadUrl(
80
- businessId,
81
- practiceId,
82
- formId,
83
- { contentType: file.type, fileName: file.name },
84
- opts
85
- );
86
- // eslint-disable-next-line
87
- var bodyFormData = new FormData();
88
- for (var key in signedPost.fields) {
89
- bodyFormData.append(key, signedPost.fields[key]);
90
- }
91
- bodyFormData.append('file', file);
92
- await awsAxios.post(signedPost.url, bodyFormData);
93
- return { publicUrl: s3Url };
94
- } catch (err) {
95
- throw err;
96
- }
97
- };
98
-
99
- /**
100
- * Upload claim attachment to S3
101
- * @param {String} businessId - Business ID
102
- * @param {String} practiceId - Practice ID
103
- * @param {String} staffId - Staff ID
104
- * @param {Object} file - File
105
- */
106
- export const uploadClaimAttachmentToS3 = async (
107
- businessId: string,
108
- practiceId: string,
109
- staffId: string,
110
- healthFundId: string,
111
- file: any,
112
- opts?: Object
113
- ): Promise<Object> => {
114
- const awsAxios = axios.create();
115
-
116
- if (!businessId) {
117
- throw new ParamError('businessId');
118
- }
119
- if (!practiceId) {
120
- throw new ParamError('practiceId');
121
- }
122
- if (!staffId) {
123
- throw new ParamError('staffId');
124
- }
125
- if (!healthFundId) {
126
- throw new ParamError('healthFundId');
127
- }
128
- if (!file) {
129
- throw new ParamError('file');
130
- }
131
-
132
- try {
133
- const { signedPost, s3Url, s3SignedUrlId } = await getClaimAttachmentUrl(
134
- businessId,
135
- practiceId,
136
- staffId,
137
- { contentType: file.type, fileName: file.name, healthFundId: healthFundId, contentLength: file.size },
138
- opts
139
- );
140
- // eslint-disable-next-line
141
- var bodyFormData = new FormData();
142
- for (var key in signedPost.fields) {
143
- bodyFormData.append(key, signedPost.fields[key]);
144
- }
145
- bodyFormData.append('file', file);
146
- await awsAxios.post(signedPost.url, bodyFormData);
147
- return { s3Url, s3SignedUrlId };
148
- } catch (err) {
149
- throw err;
150
- }
151
- };
152
-
153
- /**
154
- * Upload business practice image to S3
155
- * @param {String} businessId - Business ID
156
- * @param {String} practiceId - Practice ID
157
- * @param {Object} file - File
158
- */
159
- export const uploadBusinessPracticeImageToS3 = async (
160
- businessId: string,
161
- practiceId: string,
162
- file: any
163
- ): Promise<Object> => {
164
- const awsAxios = axios.create();
165
-
166
- if (!businessId) {
167
- throw new ParamError('businessId');
168
- }
169
- if (!practiceId) {
170
- throw new ParamError('practiceId');
171
- }
172
- if (!file) {
173
- throw new ParamError('file');
174
- }
175
-
176
- try {
177
- const { signedPost, s3Url } = await getBusinessPracticeUploadUrl(businessId, practiceId, {
178
- contentType: file.type
179
- });
180
- // eslint-disable-next-line
181
- var bodyFormData = new FormData();
182
- for (var key in signedPost.fields) {
183
- bodyFormData.append(key, signedPost.fields[key]);
184
- }
185
- bodyFormData.append('file', file);
186
- await awsAxios.post(signedPost.url, bodyFormData);
187
- const data = await updateBusinessPractice(businessId, practiceId, { logoUrl: s3Url });
188
- return data;
189
- } catch (err) {
190
- throw err;
191
- }
192
- };
193
-
194
- /**
195
- * Upload business staff image to S3
196
- * @param {String} businessId - Business ID
197
- * @param {String} practiceId - Staff ID
198
- * @param {Object} file - File
199
- */
200
- export const uploadBusinessStaffMemberImageToS3 = async (
201
- businessId: string,
202
- staffId: string,
203
- file: any
204
- ): Promise<Object> => {
205
- const awsAxios = axios.create();
206
-
207
- if (!businessId) {
208
- throw new ParamError('businessId');
209
- }
210
- if (!staffId) {
211
- throw new ParamError('staffId');
212
- }
213
- if (!file) {
214
- throw new ParamError('file');
215
- }
216
-
217
- try {
218
- const { signedPost, s3Url } = await getBusinessStaffUploadUrl(businessId, staffId, file.type);
219
-
220
- // eslint-disable-next-line
221
- var bodyFormData = new FormData();
222
- for (var key in signedPost.fields) {
223
- bodyFormData.append(key, signedPost.fields[key]);
224
- }
225
- bodyFormData.append('file', file);
226
- await awsAxios.post(signedPost.url, bodyFormData);
227
- const data = await updateBusinessStaffMember(businessId, staffId, { profilePictureUrl: s3Url });
228
- return data;
229
- } catch (err) {
230
- throw err;
231
- }
232
- };
233
-
234
- /**
235
- * Upload invoice scan to S3
236
- * @param {String} businessId - Business ID
237
- * @param {Object} file - File
238
- */
239
- export const uploadInvoiceScanToS3 = async (businessId: string, file: any, opts?: Object): Promise<Object> => {
240
- const awsAxios = axios.create();
241
-
242
- if (!businessId) {
243
- throw new ParamError('businessId');
244
- }
245
- if (!file) {
246
- throw new ParamError('file');
247
- }
248
-
249
- try {
250
- const { signedPost, s3Url, s3SignedUrlId } = await getInvoiceScanUploadUrl(
251
- businessId,
252
- { contentType: file.type, fileName: file.name, contentLength: file.size },
253
- opts
254
- );
255
- // eslint-disable-next-line
256
- var bodyFormData = new FormData();
257
- for (var key in signedPost.fields) {
258
- bodyFormData.append(key, signedPost.fields[key]);
259
- }
260
- bodyFormData.append('file', file);
261
- await awsAxios.post(signedPost.url, bodyFormData);
262
- return { s3Url, s3SignedUrlId };
263
- } catch (err) {
264
- throw err;
265
- }
266
- };
267
-
268
- /**
269
- * Upload bulk upload CSV to S3
270
- * @param {String} businessId - Business ID
271
- * @param {Object} file - File
272
- */
273
- export const uploadBulkUploadCSVToS3 = async (businessId: string, file: any, opts?: Object): Promise<Object> => {
274
- const awsAxios = axios.create();
275
-
276
- if (!businessId) {
277
- throw new ParamError('businessId');
278
- }
279
- if (!file) {
280
- throw new ParamError('file');
281
- }
282
-
283
- let contentType = file.type;
284
- if (file.name.includes('.csv') || file.path.includes('.csv')) {
285
- contentType = 'text/csv';
286
- }
287
-
288
- try {
289
- const { signedPost, s3Url, s3SignedUrlId } = await getBulkUploadUrl(
290
- businessId,
291
- { contentType, fileName: file.name, contentLength: file.size },
292
- opts
293
- );
294
- // eslint-disable-next-line
295
- var bodyFormData = new FormData();
296
- for (var key in signedPost.fields) {
297
- bodyFormData.append(key, signedPost.fields[key]);
298
- }
299
- bodyFormData.append('file', file);
300
- await awsAxios.post(signedPost.url, bodyFormData);
301
- return { s3Url, s3SignedUrlId };
302
- } catch (err) {
303
- throw err;
304
- }
305
- };
306
-
307
- /**
308
- * Upload business kyc trust document to S3
309
- * @param {String} businessId - Business ID
310
- * @param {Object} file - File
311
- */
312
- export const uploadKycTrustDocumentToS3 = async (businessId: string, file: any, opts?: Object): Promise<Object> => {
313
- const awsAxios = axios.create();
314
-
315
- if (!businessId) {
316
- throw new ParamError('businessId');
317
- }
318
- if (!file) {
319
- throw new ParamError('file');
320
- }
321
-
322
- try {
323
- const { signedPost, s3Url, s3SignedUrlId } = await getTrustDocumentUploadUrl(
324
- businessId,
325
- { contentType: file.type, fileName: file.name, contentLength: file.size },
326
- opts
327
- );
328
- // eslint-disable-next-line
329
- var bodyFormData = new FormData();
330
- for (var key in signedPost.fields) {
331
- bodyFormData.append(key, signedPost.fields[key]);
332
- }
333
- bodyFormData.append('file', file);
334
- await awsAxios.post(signedPost.url, bodyFormData);
335
- return { s3Url, s3SignedUrlId };
336
- } catch (err) {
337
- throw err;
338
- }
339
- };
@@ -1,92 +0,0 @@
1
- // @flow
2
-
3
- // $FlowFixMe
4
- import storageEngine from 'store/src/store-engine';
5
- import localStorage from 'store/storages/localStorage';
6
- import sessionStorage from 'store/storages/sessionStorage';
7
- import masked from 'masked';
8
- import { VERY_SENSITIVE_KEYS } from '@medipass/utils/sensitive-keys';
9
-
10
- const STORAGE_PREFIX = 'medipass-web-sdk';
11
- const PERSIST_KEYS = ['_persist', 'device', 'savedEmail', 'rememberEmail', 'region'];
12
-
13
- export type StoreType = 'default' | 'session';
14
- export type CommonOpts = { storeType?: StoreType };
15
- export type SetOpts = { ...CommonOpts, override?: boolean };
16
-
17
- const noopStore = { get: (key) => {}, remove: (key) => {}, each: (val, key) => {}, set: (key, val) => {} }; // eslint-disable-line
18
- const stores = {
19
- default:
20
- typeof window !== 'undefined' && window.navigator.cookieEnabled
21
- ? storageEngine.createStore(localStorage)
22
- : noopStore,
23
- session:
24
- typeof window !== 'undefined' && window.navigator.cookieEnabled
25
- ? storageEngine.createStore(sessionStorage)
26
- : noopStore
27
- };
28
- const storeTypes = Object.keys(stores);
29
-
30
- export const clearAll = (opts?: CommonOpts = {}) => {
31
- function clear(storeType) {
32
- stores[storeType].each((val, key) => {
33
- key = key.replace(`${STORAGE_PREFIX}.`, '');
34
-
35
- const shouldPersist = PERSIST_KEYS.some(persistKey => key.includes(persistKey));
36
- if (shouldPersist) {
37
- return;
38
- }
39
-
40
- stores[storeType].remove(`${STORAGE_PREFIX}.${key}`);
41
- });
42
- }
43
-
44
- // If a store type has been chosen, then clear all from that store type. Otherwise, clear all from every store type.
45
- if (opts.storeType) {
46
- clear(opts.storeType);
47
- } else {
48
- storeTypes.forEach(storeType => clear(storeType));
49
- }
50
- };
51
-
52
- export const get = (key: string, opts?: CommonOpts = {}) => {
53
- const storeType = opts.storeType || 'default';
54
- return stores[storeType].get(`${STORAGE_PREFIX}.${key}`);
55
- };
56
-
57
- export const remove = (key: string, opts?: CommonOpts = {}) => {
58
- // If a store type has been chosen, then clear all from that store type. Otherwise, clear all from every store type.
59
- if (opts.storeType) {
60
- stores[opts.storeType].remove(`${STORAGE_PREFIX}.${key}`);
61
- } else {
62
- storeTypes.forEach(storeType => stores[storeType].remove(`${STORAGE_PREFIX}.${key}`));
63
- }
64
- };
65
-
66
- export const set = (key: string, val: any, opts?: SetOpts = {}) => {
67
- const storeType = opts.storeType || 'default';
68
-
69
- if (opts && opts.override) {
70
- stores[storeType].set(
71
- `${STORAGE_PREFIX}.${key}`,
72
- masked({ ...get(key), ...val }, VERY_SENSITIVE_KEYS, { omitKeys: true })
73
- );
74
- return;
75
- }
76
- stores[storeType].set(`${STORAGE_PREFIX}.${key}`, masked(val, VERY_SENSITIVE_KEYS, { omitKeys: true }));
77
- };
78
-
79
- const _createStorageResource = (key: string) => ({
80
- get: () => get(key),
81
- set: (value: any, opts?: SetOpts) => set(key, value, opts),
82
- remove: () => remove(key)
83
- });
84
-
85
- export default {
86
- clearAll,
87
- remove,
88
- get,
89
- set,
90
- onboardingStatus: _createStorageResource('onboardingStatus'),
91
- previousCreatePHITransactionFormValues: _createStorageResource('previousTransactionFormValues')
92
- };
@@ -1,73 +0,0 @@
1
- // @flow
2
-
3
- import axios from 'axios';
4
- // $FlowFixMe
5
- import compareVersions from 'compare-versions';
6
- import _get from 'lodash/get';
7
-
8
- import MedipassWebSdk from '../index';
9
-
10
- /**
11
- * Get current app version
12
- */
13
- export const getCurrentAppVersion = (): string => _get(MedipassWebSdk, 'appVersion');
14
-
15
- /**
16
- * Set current app version
17
- */
18
- export const setCurrentAppVersion = (version: ?string): void => {
19
- MedipassWebSdk.appVersion = version;
20
- };
21
-
22
- /**
23
- * Fetch latest app version
24
- */
25
- export const fetchLatestAppVersion = async (): Promise<?string> => {
26
- const versionAxios = axios.create();
27
-
28
- try {
29
- const res = await versionAxios.get('/manifest.json');
30
- return _get(res, 'data.app_version');
31
- } catch (err) {
32
- if (_get(err, 'response.status') === 404) {
33
- return null;
34
- }
35
- throw err;
36
- }
37
- };
38
-
39
- /**
40
- * Fetch minimum app version
41
- */
42
- export const fetchMinimumAppVerson = async (): ?string => {
43
- try {
44
- const res = await MedipassWebSdk.applications.getSelfApplication();
45
- // $FlowFixMe
46
- return _get(res, 'minVersion');
47
- } catch (err) {
48
- throw err;
49
- }
50
- };
51
-
52
- /**
53
- * Check app version
54
- * Checks if the app is up-to-date
55
- */
56
- export const checkAppVersion = async (): Object => {
57
- const currentVersion = getCurrentAppVersion();
58
- const latestVersion = await fetchLatestAppVersion();
59
- const minimumVersion = await fetchMinimumAppVerson();
60
-
61
- if (!latestVersion || !currentVersion) {
62
- return {};
63
- }
64
-
65
- const versions = { currentVersion, latestVersion, minimumVersion };
66
- if (minimumVersion && compareVersions(currentVersion, minimumVersion) < 0) {
67
- return { ...versions, requiresUpdate: true, isForced: true };
68
- }
69
- if (compareVersions(currentVersion, latestVersion) !== 0) {
70
- return { ...versions, requiresUpdate: true };
71
- }
72
- return { ...versions, requiresUpdate: false };
73
- };