@os1-platform/dispatch-mobile 3.1.9 → 3.2.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 (469) hide show
  1. package/README.md +0 -2
  2. package/android/.gradle/8.10.2/checksums/checksums.lock +0 -0
  3. package/android/.gradle/8.10.2/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/8.10.2/checksums/sha1-checksums.bin +0 -0
  5. package/android/.gradle/8.10.2/fileHashes/fileHashes.bin +0 -0
  6. package/android/.gradle/8.10.2/fileHashes/fileHashes.lock +0 -0
  7. package/android/.idea/caches/deviceStreaming.xml +25 -0
  8. package/android/build.gradle +3 -12
  9. package/android/gradle.properties +9 -4
  10. package/android/src/main/AndroidManifest.xml +2 -0
  11. package/android/src/main/java/com/dispatchsdk/utils/DispatchSdkUtils.kt +25 -10
  12. package/babel.config.js +1 -1
  13. package/lib/commonjs/analytics/sentry/SentrySdkConstants.js +4 -0
  14. package/lib/commonjs/analytics/sentry/SentrySdkConstants.js.map +1 -1
  15. package/lib/commonjs/components/executiontasks/captureInput/CaptureText.js +4 -4
  16. package/lib/commonjs/components/executiontasks/captureInput/CaptureText.js.map +1 -1
  17. package/lib/commonjs/components/executiontasks/collectPayment/components/CompletePayment.js +2 -2
  18. package/lib/commonjs/components/executiontasks/collectPayment/components/CompletePayment.js.map +1 -1
  19. package/lib/commonjs/components/executiontasks/collectPayment/components/InitPayment.js +4 -7
  20. package/lib/commonjs/components/executiontasks/collectPayment/components/InitPayment.js.map +1 -1
  21. package/lib/commonjs/components/executiontasks/collectPayment/components/PaymentContactDetails.js +7 -7
  22. package/lib/commonjs/components/executiontasks/collectPayment/components/PaymentContactDetails.js.map +1 -1
  23. package/lib/commonjs/components/executiontasks/collectPayment/components/ProcessPayment.js +20 -20
  24. package/lib/commonjs/components/executiontasks/collectPayment/components/ProcessPayment.js.map +1 -1
  25. package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js +4 -4
  26. package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
  27. package/lib/commonjs/components/executiontasks/doodle/SignatureET.js +4 -4
  28. package/lib/commonjs/components/executiontasks/doodle/SignatureET.js.map +1 -1
  29. package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js +4 -4
  30. package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
  31. package/lib/commonjs/components/executiontasks/forms/FormGenerator.js +12 -33
  32. package/lib/commonjs/components/executiontasks/forms/FormGenerator.js.map +1 -1
  33. package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js +4 -4
  34. package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
  35. package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js +4 -4
  36. package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
  37. package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js +4 -4
  38. package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js.map +1 -1
  39. package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js +4 -4
  40. package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js.map +1 -1
  41. package/lib/commonjs/components/executiontasks/pickup/PickupET.js.map +1 -1
  42. package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js +4 -4
  43. package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js.map +1 -1
  44. package/lib/commonjs/components/executiontasks/scan/ScanET.js +4 -4
  45. package/lib/commonjs/components/executiontasks/scan/ScanET.js.map +1 -1
  46. package/lib/commonjs/components/executiontasks/scan/interfaces.js +17 -1
  47. package/lib/commonjs/components/executiontasks/scan/interfaces.js.map +1 -1
  48. package/lib/commonjs/components/executiontasks/scan/sub_components/CScanner.js +4 -4
  49. package/lib/commonjs/components/executiontasks/scan/sub_components/CScanner.js.map +1 -1
  50. package/lib/commonjs/components/executiontasks/scan/sub_components/DropDownUtils.js +1 -1
  51. package/lib/commonjs/components/executiontasks/scan/sub_components/DropDownUtils.js.map +1 -1
  52. package/lib/commonjs/components/executiontasks/scan/sub_components/ERDropDown.js.map +1 -1
  53. package/lib/commonjs/components/executiontasks/scan/utils.js +12 -13
  54. package/lib/commonjs/components/executiontasks/scan/utils.js.map +1 -1
  55. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
  56. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -1
  57. package/lib/commonjs/components/executiontasks/validateOTP/components/ContactListView.js +4 -5
  58. package/lib/commonjs/components/executiontasks/validateOTP/components/ContactListView.js.map +1 -1
  59. package/lib/commonjs/components/executiontasks/validateOTP/components/OTPView.js +4 -4
  60. package/lib/commonjs/components/executiontasks/validateOTP/components/OTPView.js.map +1 -1
  61. package/lib/commonjs/components/executiontasks/verifyOtp/VerifyOtpET.js +5 -9
  62. package/lib/commonjs/components/executiontasks/verifyOtp/VerifyOtpET.js.map +1 -1
  63. package/lib/commonjs/components/widgets/CancelOrderDialog.js +2 -2
  64. package/lib/commonjs/components/widgets/CancelOrderDialog.js.map +1 -1
  65. package/lib/commonjs/components/widgets/SnackBarCustom.js +0 -3
  66. package/lib/commonjs/components/widgets/SnackBarCustom.js.map +1 -1
  67. package/lib/commonjs/components/widgets/Timer.js.map +1 -1
  68. package/lib/commonjs/database/DBManager.js +112 -0
  69. package/lib/commonjs/database/DBManager.js.map +1 -0
  70. package/lib/commonjs/database/dbUpdate.json +6 -0
  71. package/lib/commonjs/manager/dispatch/DispatchStateContainer.js.map +1 -1
  72. package/lib/commonjs/manager/dispatchCodes/EventCodeRepo.js +8 -9
  73. package/lib/commonjs/manager/dispatchCodes/EventCodeRepo.js.map +1 -1
  74. package/lib/commonjs/manager/dispatchCodes/ReasonCodeContainer.js +4 -4
  75. package/lib/commonjs/manager/dispatchCodes/ReasonCodeContainer.js.map +1 -1
  76. package/lib/commonjs/manager/dispatchCodes/ReasonCodeRepo.js +13 -10
  77. package/lib/commonjs/manager/dispatchCodes/ReasonCodeRepo.js.map +1 -1
  78. package/lib/commonjs/manager/location/LocationManager.js +0 -4
  79. package/lib/commonjs/manager/location/LocationManager.js.map +1 -1
  80. package/lib/commonjs/manager/sdk/DispatchSDKManager.js +7 -1
  81. package/lib/commonjs/manager/sdk/DispatchSDKManager.js.map +1 -1
  82. package/lib/commonjs/manager/sdk/callbacksHandler.js +1 -1
  83. package/lib/commonjs/manager/sdk/callbacksHandler.js.map +1 -1
  84. package/lib/commonjs/manager/syncmanager/DBConfig.js +6 -2
  85. package/lib/commonjs/manager/syncmanager/DBConfig.js.map +1 -1
  86. package/lib/commonjs/manager/syncmanager/database.js +117 -45
  87. package/lib/commonjs/manager/syncmanager/database.js.map +1 -1
  88. package/lib/commonjs/manager/syncmanager/document/DocumentManager.js +17 -22
  89. package/lib/commonjs/manager/syncmanager/document/DocumentManager.js.map +1 -1
  90. package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js +85 -75
  91. package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
  92. package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js +24 -26
  93. package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js.map +1 -1
  94. package/lib/commonjs/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
  95. package/lib/commonjs/models/execTasks/ETConfig.js +1 -0
  96. package/lib/commonjs/models/execTasks/ETConfig.js.map +1 -1
  97. package/lib/commonjs/models/sdk.js.map +1 -1
  98. package/lib/commonjs/native/signature/SignatureCapture.js +2 -2
  99. package/lib/commonjs/native/signature/SignatureCapture.js.map +1 -1
  100. package/lib/commonjs/network/client.js.map +1 -1
  101. package/lib/commonjs/ui/screens/ValidateOTPScreen.js.map +1 -1
  102. package/lib/commonjs/utils/Constants.js.map +1 -1
  103. package/lib/commonjs/utils/Logger.js +1 -1
  104. package/lib/commonjs/utils/Logger.js.map +1 -1
  105. package/lib/commonjs/utils/SdkUtils.js +5 -3
  106. package/lib/commonjs/utils/SdkUtils.js.map +1 -1
  107. package/lib/commonjs/utils/SyncManagerUtils.js +2 -0
  108. package/lib/commonjs/utils/SyncManagerUtils.js.map +1 -1
  109. package/lib/module/analytics/sentry/SentrySdkConstants.js +4 -0
  110. package/lib/module/analytics/sentry/SentrySdkConstants.js.map +1 -1
  111. package/lib/module/components/executiontasks/captureInput/CaptureText.js +3 -3
  112. package/lib/module/components/executiontasks/captureInput/CaptureText.js.map +1 -1
  113. package/lib/module/components/executiontasks/collectPayment/components/CompletePayment.js +2 -2
  114. package/lib/module/components/executiontasks/collectPayment/components/CompletePayment.js.map +1 -1
  115. package/lib/module/components/executiontasks/collectPayment/components/InitPayment.js +3 -6
  116. package/lib/module/components/executiontasks/collectPayment/components/InitPayment.js.map +1 -1
  117. package/lib/module/components/executiontasks/collectPayment/components/PaymentContactDetails.js +6 -6
  118. package/lib/module/components/executiontasks/collectPayment/components/PaymentContactDetails.js.map +1 -1
  119. package/lib/module/components/executiontasks/collectPayment/components/ProcessPayment.js +18 -18
  120. package/lib/module/components/executiontasks/collectPayment/components/ProcessPayment.js.map +1 -1
  121. package/lib/module/components/executiontasks/deliver/SLDeliverET.js +3 -3
  122. package/lib/module/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
  123. package/lib/module/components/executiontasks/doodle/SignatureET.js +3 -3
  124. package/lib/module/components/executiontasks/doodle/SignatureET.js.map +1 -1
  125. package/lib/module/components/executiontasks/dropCash/SLDropCash.js +3 -3
  126. package/lib/module/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
  127. package/lib/module/components/executiontasks/forms/FormGenerator.js +11 -32
  128. package/lib/module/components/executiontasks/forms/FormGenerator.js.map +1 -1
  129. package/lib/module/components/executiontasks/imageCapture/ImageCapture.js +4 -4
  130. package/lib/module/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
  131. package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js +3 -3
  132. package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
  133. package/lib/module/components/executiontasks/payments/init/InitPaymentET.js +3 -3
  134. package/lib/module/components/executiontasks/payments/init/InitPaymentET.js.map +1 -1
  135. package/lib/module/components/executiontasks/payments/processPayment/ProcessPaymentET.js +3 -3
  136. package/lib/module/components/executiontasks/payments/processPayment/ProcessPaymentET.js.map +1 -1
  137. package/lib/module/components/executiontasks/pickup/PickupET.js.map +1 -1
  138. package/lib/module/components/executiontasks/pickup/SLPickupET.js +3 -3
  139. package/lib/module/components/executiontasks/pickup/SLPickupET.js.map +1 -1
  140. package/lib/module/components/executiontasks/scan/ScanET.js +3 -3
  141. package/lib/module/components/executiontasks/scan/ScanET.js.map +1 -1
  142. package/lib/module/components/executiontasks/scan/interfaces.js +16 -0
  143. package/lib/module/components/executiontasks/scan/interfaces.js.map +1 -1
  144. package/lib/module/components/executiontasks/scan/sub_components/CScanner.js +5 -5
  145. package/lib/module/components/executiontasks/scan/sub_components/CScanner.js.map +1 -1
  146. package/lib/module/components/executiontasks/scan/sub_components/DropDownUtils.js +2 -2
  147. package/lib/module/components/executiontasks/scan/sub_components/DropDownUtils.js.map +1 -1
  148. package/lib/module/components/executiontasks/scan/sub_components/ERDropDown.js.map +1 -1
  149. package/lib/module/components/executiontasks/scan/utils.js +13 -14
  150. package/lib/module/components/executiontasks/scan/utils.js.map +1 -1
  151. package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
  152. package/lib/module/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -1
  153. package/lib/module/components/executiontasks/validateOTP/components/ContactListView.js +3 -4
  154. package/lib/module/components/executiontasks/validateOTP/components/ContactListView.js.map +1 -1
  155. package/lib/module/components/executiontasks/validateOTP/components/OTPView.js +3 -3
  156. package/lib/module/components/executiontasks/validateOTP/components/OTPView.js.map +1 -1
  157. package/lib/module/components/executiontasks/verifyOtp/VerifyOtpET.js +6 -9
  158. package/lib/module/components/executiontasks/verifyOtp/VerifyOtpET.js.map +1 -1
  159. package/lib/module/components/widgets/CancelOrderDialog.js +1 -1
  160. package/lib/module/components/widgets/CancelOrderDialog.js.map +1 -1
  161. package/lib/module/components/widgets/SnackBarCustom.js +0 -2
  162. package/lib/module/components/widgets/SnackBarCustom.js.map +1 -1
  163. package/lib/module/components/widgets/Timer.js.map +1 -1
  164. package/lib/module/database/DBManager.js +104 -0
  165. package/lib/module/database/DBManager.js.map +1 -0
  166. package/lib/module/database/dbUpdate.json +6 -0
  167. package/lib/module/manager/dispatch/DispatchStateContainer.js.map +1 -1
  168. package/lib/module/manager/dispatchCodes/EventCodeRepo.js +7 -7
  169. package/lib/module/manager/dispatchCodes/EventCodeRepo.js.map +1 -1
  170. package/lib/module/manager/dispatchCodes/ReasonCodeContainer.js +4 -4
  171. package/lib/module/manager/dispatchCodes/ReasonCodeContainer.js.map +1 -1
  172. package/lib/module/manager/dispatchCodes/ReasonCodeRepo.js +13 -8
  173. package/lib/module/manager/dispatchCodes/ReasonCodeRepo.js.map +1 -1
  174. package/lib/module/manager/location/LocationManager.js +0 -4
  175. package/lib/module/manager/location/LocationManager.js.map +1 -1
  176. package/lib/module/manager/sdk/DispatchSDKManager.js +7 -1
  177. package/lib/module/manager/sdk/DispatchSDKManager.js.map +1 -1
  178. package/lib/module/manager/sdk/callbacksHandler.js +0 -2
  179. package/lib/module/manager/sdk/callbacksHandler.js.map +1 -1
  180. package/lib/module/manager/syncmanager/DBConfig.js +5 -1
  181. package/lib/module/manager/syncmanager/DBConfig.js.map +1 -1
  182. package/lib/module/manager/syncmanager/database.js +117 -43
  183. package/lib/module/manager/syncmanager/database.js.map +1 -1
  184. package/lib/module/manager/syncmanager/document/DocumentManager.js +16 -20
  185. package/lib/module/manager/syncmanager/document/DocumentManager.js.map +1 -1
  186. package/lib/module/manager/syncmanager/document/DocumentSyncManager.js +85 -75
  187. package/lib/module/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
  188. package/lib/module/manager/syncmanager/events/ETEventsManager.js +20 -22
  189. package/lib/module/manager/syncmanager/events/ETEventsManager.js.map +1 -1
  190. package/lib/module/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
  191. package/lib/module/models/execTasks/ETConfig.js +1 -0
  192. package/lib/module/models/execTasks/ETConfig.js.map +1 -1
  193. package/lib/module/models/sdk.js.map +1 -1
  194. package/lib/module/native/signature/SignatureCapture.js +2 -2
  195. package/lib/module/native/signature/SignatureCapture.js.map +1 -1
  196. package/lib/module/network/client.js.map +1 -1
  197. package/lib/module/ui/screens/ValidateOTPScreen.js.map +1 -1
  198. package/lib/module/utils/Constants.js.map +1 -1
  199. package/lib/module/utils/Logger.js +1 -1
  200. package/lib/module/utils/Logger.js.map +1 -1
  201. package/lib/module/utils/SdkUtils.js +5 -3
  202. package/lib/module/utils/SdkUtils.js.map +1 -1
  203. package/lib/module/utils/SyncManagerUtils.js +2 -0
  204. package/lib/module/utils/SyncManagerUtils.js.map +1 -1
  205. package/lib/typescript/babel.config.d.ts +1 -0
  206. package/lib/typescript/jest.config.d.ts +7 -0
  207. package/lib/typescript/jest.setup.d.ts +1 -0
  208. package/lib/typescript/scripts/bootstrap.d.ts +1 -0
  209. package/lib/typescript/{components → src/components}/executiontasks/scan/interfaces.d.ts +15 -0
  210. package/lib/typescript/{components → src/components}/executiontasks/validateOTP/ValidateOTPSchema.d.ts +1 -1
  211. package/lib/typescript/{components → src/components}/widgets/CancelOrderDialog.d.ts +1 -1
  212. package/lib/typescript/{components → src/components}/widgets/SnackBarCustom.d.ts +3 -2
  213. package/lib/typescript/src/components/widgets/Timer.d.ts +6 -0
  214. package/lib/typescript/src/database/DBManager.d.ts +1 -0
  215. package/lib/typescript/{manager → src/manager}/dispatchCodes/EventCodeRepo.d.ts +1 -1
  216. package/lib/typescript/{manager → src/manager}/dispatchCodes/ReasonCodeRepo.d.ts +5 -3
  217. package/lib/typescript/{manager → src/manager}/syncmanager/DBConfig.d.ts +5 -1
  218. package/lib/typescript/src/manager/syncmanager/database.d.ts +31 -0
  219. package/lib/typescript/{manager → src/manager}/syncmanager/document/DocumentManager.d.ts +2 -3
  220. package/lib/typescript/{manager → src/manager}/syncmanager/document/DocumentSyncManager.d.ts +1 -2
  221. package/lib/typescript/{network → src/network}/client.d.ts +2 -2
  222. package/lib/typescript/{utils → src/utils}/Constants.d.ts +4 -0
  223. package/package.json +76 -104
  224. package/src/components/executiontasks/captureInput/CaptureText.tsx +6 -6
  225. package/src/components/executiontasks/collectPayment/components/CompletePayment.tsx +2 -3
  226. package/src/components/executiontasks/collectPayment/components/InitPayment.tsx +3 -7
  227. package/src/components/executiontasks/collectPayment/components/PaymentContactDetails.tsx +3 -4
  228. package/src/components/executiontasks/collectPayment/components/ProcessPayment.tsx +4 -5
  229. package/src/components/executiontasks/deliver/SLDeliverET.tsx +3 -4
  230. package/src/components/executiontasks/doodle/SignatureET.tsx +4 -4
  231. package/src/components/executiontasks/dropCash/SLDropCash.tsx +3 -4
  232. package/src/components/executiontasks/forms/FormGenerator.tsx +38 -55
  233. package/src/components/executiontasks/imageCapture/ImageCapture.tsx +5 -7
  234. package/src/components/executiontasks/payments/completePayment/CompletePaymentET.tsx +3 -4
  235. package/src/components/executiontasks/payments/init/InitPaymentET.tsx +3 -4
  236. package/src/components/executiontasks/payments/processPayment/ProcessPaymentET.tsx +3 -4
  237. package/src/components/executiontasks/pickup/PickupET.tsx +3 -9
  238. package/src/components/executiontasks/pickup/SLPickupET.tsx +3 -4
  239. package/src/components/executiontasks/scan/ScanET.tsx +3 -4
  240. package/src/components/executiontasks/scan/interfaces.ts +16 -0
  241. package/src/components/executiontasks/scan/sub_components/CScanner.tsx +7 -6
  242. package/src/components/executiontasks/scan/sub_components/DropDownUtils.ts +2 -2
  243. package/src/components/executiontasks/scan/sub_components/ERDropDown.tsx +0 -1
  244. package/src/components/executiontasks/scan/utils.ts +13 -13
  245. package/src/components/executiontasks/validateOTP/ValidateOTPET.tsx +5 -0
  246. package/src/components/executiontasks/validateOTP/ValidateOTPSchema.ts +1 -1
  247. package/src/components/executiontasks/validateOTP/components/ContactListView.tsx +3 -11
  248. package/src/components/executiontasks/validateOTP/components/OTPView.tsx +3 -4
  249. package/src/components/executiontasks/verifyOtp/VerifyOtpET.tsx +8 -16
  250. package/src/components/widgets/CancelOrderDialog.tsx +2 -2
  251. package/src/components/widgets/SnackBarCustom.tsx +2 -4
  252. package/src/components/widgets/Timer.tsx +0 -1
  253. package/src/database/DBManager.ts +118 -0
  254. package/src/database/dbUpdate.json +6 -0
  255. package/src/manager/dispatch/DispatchStateContainer.tsx +5 -25
  256. package/src/manager/dispatchCodes/EventCodeRepo.ts +8 -12
  257. package/src/manager/dispatchCodes/ReasonCodeContainer.ts +5 -5
  258. package/src/manager/dispatchCodes/ReasonCodeRepo.ts +17 -15
  259. package/src/manager/location/LocationManager.ts +1 -8
  260. package/src/manager/sdk/DispatchSDKManager.ts +12 -4
  261. package/src/manager/sdk/callbacksHandler.ts +3 -8
  262. package/src/manager/syncmanager/DBConfig.ts +6 -1
  263. package/src/manager/syncmanager/database.ts +130 -71
  264. package/src/manager/syncmanager/document/DocumentManager.ts +19 -24
  265. package/src/manager/syncmanager/document/DocumentSyncManager.ts +95 -82
  266. package/src/manager/syncmanager/events/ETEventsManager.ts +30 -35
  267. package/src/manager/syncmanager/events/EventsSyncManager.ts +1 -1
  268. package/src/models/sdk.ts +2 -6
  269. package/src/native/signature/SignatureCapture.tsx +4 -3
  270. package/src/network/client.ts +2 -2
  271. package/src/ui/screens/ValidateOTPScreen.tsx +2 -4
  272. package/src/utils/Constants.ts +6 -1
  273. package/src/utils/Logger.ts +2 -1
  274. package/src/utils/SdkUtils.ts +6 -7
  275. package/src/utils/SyncManagerUtils.ts +1 -0
  276. package/tsconfig.build.json +1 -1
  277. package/tsconfig.json +2 -3
  278. package/lib/typescript/components/widgets/Timer.d.ts +0 -7
  279. package/lib/typescript/manager/syncmanager/database.d.ts +0 -7
  280. /package/lib/typescript/{analytics → src/analytics}/firebase/FirebaseLogging.d.ts +0 -0
  281. /package/lib/typescript/{analytics → src/analytics}/sentry/SentryAnalyticsSingleton.d.ts +0 -0
  282. /package/lib/typescript/{analytics → src/analytics}/sentry/SentryAnalyticsUtils.d.ts +0 -0
  283. /package/lib/typescript/{analytics → src/analytics}/sentry/SentryModels.d.ts +0 -0
  284. /package/lib/typescript/{analytics → src/analytics}/sentry/SentrySdkConstants.d.ts +0 -0
  285. /package/lib/typescript/{components → src/components}/dispatch/DispatchExecNavigator.d.ts +0 -0
  286. /package/lib/typescript/{components → src/components}/executiontasks/CompletedWFSchema.d.ts +0 -0
  287. /package/lib/typescript/{components → src/components}/executiontasks/ExecutionTasksIndex.d.ts +0 -0
  288. /package/lib/typescript/{components → src/components}/executiontasks/cancellation/CancelET.d.ts +0 -0
  289. /package/lib/typescript/{components → src/components}/executiontasks/cancellation/CancellationSchema.d.ts +0 -0
  290. /package/lib/typescript/{components → src/components}/executiontasks/captureInput/CaptureInputSchema.d.ts +0 -0
  291. /package/lib/typescript/{components → src/components}/executiontasks/captureInput/CaptureText.d.ts +0 -0
  292. /package/lib/typescript/{components → src/components}/executiontasks/captureInput/utils.d.ts +0 -0
  293. /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/CollectPayment.d.ts +0 -0
  294. /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/CollectPaymentSchema.d.ts +0 -0
  295. /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/PaymentStyles.d.ts +0 -0
  296. /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/PaymentUtils.d.ts +0 -0
  297. /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/components/CompletePayment.d.ts +0 -0
  298. /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/components/CustomContactsModal.d.ts +0 -0
  299. /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/components/InitPayment.d.ts +0 -0
  300. /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/components/PaymentContactDetails.d.ts +0 -0
  301. /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/components/ProcessPayment.d.ts +0 -0
  302. /package/lib/typescript/{components → src/components}/executiontasks/deliver/DeliverET.d.ts +0 -0
  303. /package/lib/typescript/{components → src/components}/executiontasks/deliver/DeliverETInput.d.ts +0 -0
  304. /package/lib/typescript/{components → src/components}/executiontasks/deliver/SLDeliverET.d.ts +0 -0
  305. /package/lib/typescript/{components → src/components}/executiontasks/display/DisplayModalET.d.ts +0 -0
  306. /package/lib/typescript/{components → src/components}/executiontasks/display/DisplaySchema.d.ts +0 -0
  307. /package/lib/typescript/{components → src/components}/executiontasks/doodle/SignatureET.d.ts +0 -0
  308. /package/lib/typescript/{components → src/components}/executiontasks/doodle/SignatureSchema.d.ts +0 -0
  309. /package/lib/typescript/{components → src/components}/executiontasks/dropCash/DropCashET.d.ts +0 -0
  310. /package/lib/typescript/{components → src/components}/executiontasks/dropCash/DropCashSchema.d.ts +0 -0
  311. /package/lib/typescript/{components → src/components}/executiontasks/dropCash/SLDropCash.d.ts +0 -0
  312. /package/lib/typescript/{components → src/components}/executiontasks/forms/FormGenerator.d.ts +0 -0
  313. /package/lib/typescript/{components → src/components}/executiontasks/forms/FormSchema.d.ts +0 -0
  314. /package/lib/typescript/{components → src/components}/executiontasks/forms/widgets/DateTimeWidget.d.ts +0 -0
  315. /package/lib/typescript/{components → src/components}/executiontasks/forms/widgets/DropdownWidget.d.ts +0 -0
  316. /package/lib/typescript/{components → src/components}/executiontasks/forms/widgets/QRBarcodeScannerWidget.d.ts +0 -0
  317. /package/lib/typescript/{components → src/components}/executiontasks/forms/widgets/TimeRangeSelector.d.ts +0 -0
  318. /package/lib/typescript/{components → src/components}/executiontasks/httpRequest/HttpEtUtils.d.ts +0 -0
  319. /package/lib/typescript/{components → src/components}/executiontasks/httpRequest/HttpRequestET.d.ts +0 -0
  320. /package/lib/typescript/{components → src/components}/executiontasks/httpRequest/HttpRequestETSchema.d.ts +0 -0
  321. /package/lib/typescript/{components → src/components}/executiontasks/imageCapture/CaptureSchema.d.ts +0 -0
  322. /package/lib/typescript/{components → src/components}/executiontasks/imageCapture/CaptureUtils.d.ts +0 -0
  323. /package/lib/typescript/{components → src/components}/executiontasks/imageCapture/ImageCapture.d.ts +0 -0
  324. /package/lib/typescript/{components → src/components}/executiontasks/payments/PaymentStyles.d.ts +0 -0
  325. /package/lib/typescript/{components → src/components}/executiontasks/payments/PaymentUtils.d.ts +0 -0
  326. /package/lib/typescript/{components → src/components}/executiontasks/payments/completePayment/CompletePaymentET.d.ts +0 -0
  327. /package/lib/typescript/{components → src/components}/executiontasks/payments/completePayment/CompletePaymentSchema.d.ts +0 -0
  328. /package/lib/typescript/{components → src/components}/executiontasks/payments/init/InitPaymentET.d.ts +0 -0
  329. /package/lib/typescript/{components → src/components}/executiontasks/payments/init/InitPaymentSchema.d.ts +0 -0
  330. /package/lib/typescript/{components → src/components}/executiontasks/payments/processPayment/ProcessPaymentET.d.ts +0 -0
  331. /package/lib/typescript/{components → src/components}/executiontasks/payments/processPayment/ProcessPaymentSchema.d.ts +0 -0
  332. /package/lib/typescript/{components → src/components}/executiontasks/pickup/PickpSchema.d.ts +0 -0
  333. /package/lib/typescript/{components → src/components}/executiontasks/pickup/PickupET.d.ts +0 -0
  334. /package/lib/typescript/{components → src/components}/executiontasks/pickup/SLPickupET.d.ts +0 -0
  335. /package/lib/typescript/{components → src/components}/executiontasks/scan/ScanET.d.ts +0 -0
  336. /package/lib/typescript/{components → src/components}/executiontasks/scan/ScanSchema.d.ts +0 -0
  337. /package/lib/typescript/{components → src/components}/executiontasks/scan/constants.d.ts +0 -0
  338. /package/lib/typescript/{components → src/components}/executiontasks/scan/modalConstant.d.ts +0 -0
  339. /package/lib/typescript/{components → src/components}/executiontasks/scan/sub_components/CScanner.d.ts +0 -0
  340. /package/lib/typescript/{components → src/components}/executiontasks/scan/sub_components/DropDownUtils.d.ts +0 -0
  341. /package/lib/typescript/{components → src/components}/executiontasks/scan/sub_components/ERDropDown.d.ts +0 -0
  342. /package/lib/typescript/{components → src/components}/executiontasks/scan/sub_components/SummaryPage.d.ts +0 -0
  343. /package/lib/typescript/{components → src/components}/executiontasks/scan/utils.d.ts +0 -0
  344. /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/ValidateOTPET.d.ts +0 -0
  345. /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/ValidateOtpStyles.d.ts +0 -0
  346. /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/components/ContactListView.d.ts +0 -0
  347. /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/components/OTPView.d.ts +0 -0
  348. /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/components/VerificationComplete.d.ts +0 -0
  349. /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/constants.d.ts +0 -0
  350. /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/sub-components/ContactCard.d.ts +0 -0
  351. /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/sub-components/OTPInput.d.ts +0 -0
  352. /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/sub-components/ResendOTPButton.d.ts +0 -0
  353. /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/utils.d.ts +0 -0
  354. /package/lib/typescript/{components → src/components}/executiontasks/verifyInput/VerifyInputSchema.d.ts +0 -0
  355. /package/lib/typescript/{components → src/components}/executiontasks/verifyLocation/GeofenceUtils.d.ts +0 -0
  356. /package/lib/typescript/{components → src/components}/executiontasks/verifyLocation/VerifyLocSchema.d.ts +0 -0
  357. /package/lib/typescript/{components → src/components}/executiontasks/verifyLocation/VerifyLocationET.d.ts +0 -0
  358. /package/lib/typescript/{components → src/components}/executiontasks/verifyOtp/VerifyOtpET.d.ts +0 -0
  359. /package/lib/typescript/{components → src/components}/executiontasks/verifyOtp/VerifyOtpSchema.d.ts +0 -0
  360. /package/lib/typescript/{components → src/components}/utils/Scale.d.ts +0 -0
  361. /package/lib/typescript/{components → src/components}/utils/index.d.ts +0 -0
  362. /package/lib/typescript/{components → src/components}/widgets/AlertDisplay.d.ts +0 -0
  363. /package/lib/typescript/{components → src/components}/widgets/Card.d.ts +0 -0
  364. /package/lib/typescript/{components → src/components}/widgets/ConfirmCancelModal.d.ts +0 -0
  365. /package/lib/typescript/{components → src/components}/widgets/GoBackModal.d.ts +0 -0
  366. /package/lib/typescript/{components → src/components}/widgets/IconButton.d.ts +0 -0
  367. /package/lib/typescript/{components → src/components}/widgets/ModalWidget.d.ts +0 -0
  368. /package/lib/typescript/{components → src/components}/widgets/ProgressDialog.d.ts +0 -0
  369. /package/lib/typescript/{components → src/components}/widgets/SearchBar.d.ts +0 -0
  370. /package/lib/typescript/{components → src/components}/widgets/SplitTextInput.d.ts +0 -0
  371. /package/lib/typescript/{components → src/components}/widgets/TabsComponent.d.ts +0 -0
  372. /package/lib/typescript/{components → src/components}/widgets/Toaster.d.ts +0 -0
  373. /package/lib/typescript/{config → src/config}/DispatchSDKConfig.d.ts +0 -0
  374. /package/lib/typescript/{constants → src/constants}/apiConstants.d.ts +0 -0
  375. /package/lib/typescript/{constants → src/constants}/constants.d.ts +0 -0
  376. /package/lib/typescript/{constants → src/constants}/statuscode.d.ts +0 -0
  377. /package/lib/typescript/{errors → src/errors}/BaseError.d.ts +0 -0
  378. /package/lib/typescript/{errors → src/errors}/ErrorCodes.d.ts +0 -0
  379. /package/lib/typescript/{events → src/events}/EventDispatcher.d.ts +0 -0
  380. /package/lib/typescript/{events → src/events}/EventListener.d.ts +0 -0
  381. /package/lib/typescript/{events → src/events}/constants.d.ts +0 -0
  382. /package/lib/typescript/{events → src/events}/index.d.ts +0 -0
  383. /package/lib/typescript/{events → src/events}/interface.d.ts +0 -0
  384. /package/lib/typescript/{icons → src/icons}/CircleMark.d.ts +0 -0
  385. /package/lib/typescript/{icons → src/icons}/FailedIcon.d.ts +0 -0
  386. /package/lib/typescript/{icons → src/icons}/FailureCloseIcon.d.ts +0 -0
  387. /package/lib/typescript/{icons → src/icons}/ScanIcon.d.ts +0 -0
  388. /package/lib/typescript/{icons → src/icons}/SuccessCompleteIcon.d.ts +0 -0
  389. /package/lib/typescript/{icons → src/icons}/file.d.ts +0 -0
  390. /package/lib/typescript/{icons → src/icons}/index.d.ts +0 -0
  391. /package/lib/typescript/{icons → src/icons}/interface.d.ts +0 -0
  392. /package/lib/typescript/{index.d.ts → src/index.d.ts} +0 -0
  393. /package/lib/typescript/{locale → src/locale}/Str.d.ts +0 -0
  394. /package/lib/typescript/{locale → src/locale}/i18n.d.ts +0 -0
  395. /package/lib/typescript/{locale → src/locale}/util.d.ts +0 -0
  396. /package/lib/typescript/{manager → src/manager}/dispatch/DispatchStateContainer.d.ts +0 -0
  397. /package/lib/typescript/{manager → src/manager}/dispatchCodes/EventCodeContainer.d.ts +0 -0
  398. /package/lib/typescript/{manager → src/manager}/dispatchCodes/ReasonCodeContainer.d.ts +0 -0
  399. /package/lib/typescript/{manager → src/manager}/jobRemoval/JobRemovalManager.d.ts +0 -0
  400. /package/lib/typescript/{manager → src/manager}/location/LocationManager.d.ts +0 -0
  401. /package/lib/typescript/{manager → src/manager}/sdk/DispatchSDKManager.d.ts +0 -0
  402. /package/lib/typescript/{manager → src/manager}/sdk/DispatchSdkCache.d.ts +0 -0
  403. /package/lib/typescript/{manager → src/manager}/sdk/callbacksHandler.d.ts +0 -0
  404. /package/lib/typescript/{manager → src/manager}/syncmanager/AppSyncManager.d.ts +0 -0
  405. /package/lib/typescript/{manager → src/manager}/syncmanager/NativeSyncManager.d.ts +0 -0
  406. /package/lib/typescript/{manager → src/manager}/syncmanager/constants.d.ts +0 -0
  407. /package/lib/typescript/{manager → src/manager}/syncmanager/document/DocumentHttpClient.d.ts +0 -0
  408. /package/lib/typescript/{manager → src/manager}/syncmanager/document/models.d.ts +0 -0
  409. /package/lib/typescript/{manager → src/manager}/syncmanager/events/ETEventsManager.d.ts +0 -0
  410. /package/lib/typescript/{manager → src/manager}/syncmanager/events/EventsGraphQLClient.d.ts +0 -0
  411. /package/lib/typescript/{manager → src/manager}/syncmanager/events/EventsSyncManager.d.ts +0 -0
  412. /package/lib/typescript/{manager → src/manager}/syncmanager/events/SyncHttpClient.d.ts +0 -0
  413. /package/lib/typescript/{models → src/models}/DispatchModels.d.ts +0 -0
  414. /package/lib/typescript/{models → src/models}/ReasonCodes.d.ts +0 -0
  415. /package/lib/typescript/{models → src/models}/auth.d.ts +0 -0
  416. /package/lib/typescript/{models → src/models}/execTasks/ETBaseModels.d.ts +0 -0
  417. /package/lib/typescript/{models → src/models}/execTasks/ETConfig.d.ts +0 -0
  418. /package/lib/typescript/{models → src/models}/execution.d.ts +0 -0
  419. /package/lib/typescript/{models → src/models}/fcm.d.ts +0 -0
  420. /package/lib/typescript/{models → src/models}/sdk.d.ts +0 -0
  421. /package/lib/typescript/{native → src/native}/LocationModule.d.ts +0 -0
  422. /package/lib/typescript/{native → src/native}/PermissionModule.d.ts +0 -0
  423. /package/lib/typescript/{native → src/native}/signature/SignatureCapture.d.ts +0 -0
  424. /package/lib/typescript/{network → src/network}/GraphQLClient.d.ts +0 -0
  425. /package/lib/typescript/{network → src/network}/NetworkClient.d.ts +0 -0
  426. /package/lib/typescript/{network → src/network}/NetworkUtils.d.ts +0 -0
  427. /package/lib/typescript/{network → src/network}/Queries.d.ts +0 -0
  428. /package/lib/typescript/{res → src/res}/strings.d.ts +0 -0
  429. /package/lib/typescript/{resources → src/resources}/Login.d.ts +0 -0
  430. /package/lib/typescript/{resources → src/resources}/network.d.ts +0 -0
  431. /package/lib/typescript/{styles → src/styles}/SdkColors.d.ts +0 -0
  432. /package/lib/typescript/{styles → src/styles}/executionTasks/CommonStyles.d.ts +0 -0
  433. /package/lib/typescript/{ui → src/ui}/screens/CancellationScreen.d.ts +0 -0
  434. /package/lib/typescript/{ui → src/ui}/screens/CaptureInputScreen.d.ts +0 -0
  435. /package/lib/typescript/{ui → src/ui}/screens/CollectPaymentScreen.d.ts +0 -0
  436. /package/lib/typescript/{ui → src/ui}/screens/CompleteObjectiveScreen.d.ts +0 -0
  437. /package/lib/typescript/{ui → src/ui}/screens/DeliverScreen.d.ts +0 -0
  438. /package/lib/typescript/{ui → src/ui}/screens/DisplayScreen.d.ts +0 -0
  439. /package/lib/typescript/{ui → src/ui}/screens/DoodleScreen.d.ts +0 -0
  440. /package/lib/typescript/{ui → src/ui}/screens/DropCashScreen.d.ts +0 -0
  441. /package/lib/typescript/{ui → src/ui}/screens/ETScreensIndex.d.ts +0 -0
  442. /package/lib/typescript/{ui → src/ui}/screens/FormsScreen.d.ts +0 -0
  443. /package/lib/typescript/{ui → src/ui}/screens/GeofenceScreen.d.ts +0 -0
  444. /package/lib/typescript/{ui → src/ui}/screens/HttpRequestScreen.d.ts +0 -0
  445. /package/lib/typescript/{ui → src/ui}/screens/ImageCaptureScreen.d.ts +0 -0
  446. /package/lib/typescript/{ui → src/ui}/screens/PaymentScreen.d.ts +0 -0
  447. /package/lib/typescript/{ui → src/ui}/screens/PickupScreen.d.ts +0 -0
  448. /package/lib/typescript/{ui → src/ui}/screens/ScanScreen.d.ts +0 -0
  449. /package/lib/typescript/{ui → src/ui}/screens/StartWorkFlowScreen.d.ts +0 -0
  450. /package/lib/typescript/{ui → src/ui}/screens/ValidateOTPScreen.d.ts +0 -0
  451. /package/lib/typescript/{ui → src/ui}/screens/WithBaseDispatchScreen.d.ts +0 -0
  452. /package/lib/typescript/{ui → src/ui}/uiConfig/RouteParams.d.ts +0 -0
  453. /package/lib/typescript/{utils → src/utils}/ApiUtils.d.ts +0 -0
  454. /package/lib/typescript/{utils → src/utils}/Enums.d.ts +0 -0
  455. /package/lib/typescript/{utils → src/utils}/ExecTaskUtils.d.ts +0 -0
  456. /package/lib/typescript/{utils → src/utils}/Logger.d.ts +0 -0
  457. /package/lib/typescript/{utils → src/utils}/NetworkUtil.d.ts +0 -0
  458. /package/lib/typescript/{utils → src/utils}/SdkUtils.d.ts +0 -0
  459. /package/lib/typescript/{utils → src/utils}/SyncManagerUtils.d.ts +0 -0
  460. /package/lib/typescript/{utils → src/utils}/context/paymentContext.d.ts +0 -0
  461. /package/lib/typescript/{utils → src/utils}/context/valdiateOTPContext.d.ts +0 -0
  462. /package/lib/typescript/{utils → src/utils}/fcm/FCM.d.ts +0 -0
  463. /package/lib/typescript/{utils → src/utils}/fcm/FcmUtils.d.ts +0 -0
  464. /package/lib/typescript/{utils → src/utils}/helper.d.ts +0 -0
  465. /package/lib/typescript/{utils → src/utils}/hooks/useModal.d.ts +0 -0
  466. /package/lib/typescript/{utils → src/utils}/hooks/useTimer.d.ts +0 -0
  467. /package/lib/typescript/{utils → src/utils}/loginHelper.d.ts +0 -0
  468. /package/lib/typescript/{utils → src/utils}/storage.d.ts +0 -0
  469. /package/lib/typescript/{utils → src/utils}/utils.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","PermissionModule","LocationModule","LocationManager","constructor","_defineProperty","checkForLocationPermissions","console","log","OS","foregroundPermission","requestForegroundPermissions","startUpdates","stopLocationUpdates","getInstance","instance","startLocationUpdates","subscription","addLocationListener","location","lastLocationAndroid","getLastLocation","latitude","toString","longitude","accuracy","lastLocationiOS","removeLocationListener","error","_LocationManager"],"sources":["LocationManager.ts"],"sourcesContent":["import * as Location from 'expo-location';\nimport { Accuracy, LocationObject } from 'expo-location';\nimport Logger, { LOG_TYPE } from '../../utils/Logger';\nimport { EmitterSubscription, Platform } from 'react-native';\nimport PermissionModule from '../../native/PermissionModule';\nimport LocationModule, { LocationType } from '../../native/LocationModule';\n\nexport default class LocationManager {\n private static instance: LocationManager;\n private lastLocationAndroid: LocationType | null = null;\n private lastLocationiOS: LocationType | null = null;\n private stopUpdate: { remove(): void } | undefined;\n private subscription: EmitterSubscription | null = null;\n\n public async checkForLocationPermissions(): Promise<boolean> {\n console.log(\"checkForLocationPermissions\");\n if (Platform.OS === 'ios') {\n // old code checking for permissions using expo-location\n // let permissionResponse = await Location.getForegroundPermissionsAsync();\n // if (permissionResponse.status === 'granted') {\n // this.startUpdates();\n // return true;\n // } else {\n // let { status } = await Location.requestForegroundPermissionsAsync();\n // if (status === 'granted') {\n // this.startUpdates();\n // return true;\n // } else {\n // this.stopLocationUpdates();\n // return false;\n // }\n // }\n let foregroundPermission = await PermissionModule.requestForegroundPermissions();\n if (foregroundPermission) {\n this.startUpdates();\n return true;\n } else {\n this.stopLocationUpdates();\n return false;\n }\n }\n if (Platform.OS === 'android') {\n let foregroundPermission = await PermissionModule.requestForegroundPermissions();\n if (foregroundPermission) {\n this.startUpdates();\n return true;\n } else {\n this.stopLocationUpdates();\n return false;\n }\n }\n return true;\n }\n\n public static getInstance(): LocationManager {\n if (!LocationManager.instance) {\n LocationManager.instance = new LocationManager();\n }\n return LocationManager.instance;\n }\n\n public startUpdates() {\n if (Platform.OS === 'android') {\n LocationModule.startLocationUpdates();\n this.subscription = LocationModule.addLocationListener((location) => {\n console.log('Location updated:', location);\n if (location != null) {\n this.lastLocationAndroid = location\n }\n });\n }\n\n if (Platform.OS === 'ios') {\n console.log(\"startUpdates\");\n LocationModule.startLocationUpdates();\n // this.subscription = LocationModule.addLocationListener((location) => {\n // console.log('Location updated:', location);\n // if (location != null) {\n // this.lastLocationiOS = location\n // }\n // });\n }\n }\n\n public async getLastLocation(): Promise<DLocation> {\n if (Platform.OS === 'android' && this.lastLocationAndroid != null) {\n console.log(\"lastLocationAndroid:\", this.lastLocationAndroid);\n return {\n latitude: this.lastLocationAndroid.latitude.toString(),\n longitude: this.lastLocationAndroid.longitude.toString(),\n accuracy: this.lastLocationAndroid.accuracy.toString(),\n };\n }\n if (Platform.OS === 'ios') {\n this.lastLocationiOS = await LocationModule.getLastLocation();\n console.log(\"lastLocationiOS:\", this.lastLocationiOS);\n if(this.lastLocationiOS){\n return {\n latitude: this.lastLocationiOS.latitude.toString(),\n longitude: this.lastLocationiOS.longitude.toString(),\n accuracy: this.lastLocationiOS.accuracy.toString(),\n };\n }\n }\n return {\n latitude: 'null',\n longitude: 'null',\n accuracy: 'null',\n };\n }\n\n\n public stopLocationUpdates() {\n try {\n // code for android\n if (Platform.OS === 'android') {\n if (this.subscription) {\n LocationModule.removeLocationListener(this.subscription);\n }\n }\n\n // code for ios\n if (Platform.OS === 'ios') {\n if (this.subscription) {\n LocationModule.removeLocationListener(this.subscription);\n }\n }\n } catch (error: any) { }\n }\n}\n\nexport interface DLocation {\n latitude: string;\n longitude: string;\n accuracy: string;\n}\n"],"mappings":";;;;AAGA,SAA8BA,QAAQ,QAAQ,cAAc;AAC5D,OAAOC,gBAAgB,MAAM,+BAA+B;AAC5D,OAAOC,cAAc,MAAwB,6BAA6B;AAE1E,eAAe,MAAMC,eAAe,CAAC;EAAAC,YAAA;IAAAC,eAAA,8BAEgB,IAAI;IAAAA,eAAA,0BACR,IAAI;IAAAA,eAAA;IAAAA,eAAA,uBAEA,IAAI;EAAA;EAEvD,MAAaC,2BAA2BA,CAAA,EAAqB;IAC3DC,OAAO,CAACC,GAAG,CAAC,6BAA6B,CAAC;IAC1C,IAAIR,QAAQ,CAACS,EAAE,KAAK,KAAK,EAAE;MACzB;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,IAAIC,oBAAoB,GAAG,MAAMT,gBAAgB,CAACU,4BAA4B,CAAC,CAAC;MAChF,IAAID,oBAAoB,EAAE;QACxB,IAAI,CAACE,YAAY,CAAC,CAAC;QACnB,OAAO,IAAI;MACb,CAAC,MAAM;QACL,IAAI,CAACC,mBAAmB,CAAC,CAAC;QAC1B,OAAO,KAAK;MACd;IACF;IACA,IAAIb,QAAQ,CAACS,EAAE,KAAK,SAAS,EAAE;MAC7B,IAAIC,oBAAoB,GAAG,MAAMT,gBAAgB,CAACU,4BAA4B,CAAC,CAAC;MAChF,IAAID,oBAAoB,EAAE;QACxB,IAAI,CAACE,YAAY,CAAC,CAAC;QACnB,OAAO,IAAI;MACb,CAAC,MAAM;QACL,IAAI,CAACC,mBAAmB,CAAC,CAAC;QAC1B,OAAO,KAAK;MACd;IACF;IACA,OAAO,IAAI;EACb;EAEA,OAAcC,WAAWA,CAAA,EAAoB;IAC3C,IAAI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B,eAAe,CAAC,CAAC;MAC7Dd,OAAO,CAACC,GAAG,CAAC,kBAAkB,EAAE,IAAI,CAACkB,eAAe,CAAC;MACrD,IAAG,IAAI,CAACA,eAAe,EAAC;QACtB,OAAO;UACLJ,QAAQ,EAAE,IAAI,CAACI,eAAe,CAACJ,QAAQ,CAACC,QAAQ,CAAC,CAAC;UAClDC,SAAS,EAAE,IAAI,CAACE,eAAe,CAACF,SAAS,CAACD,QAAQ,CAAC,CAAC;UACpDE,QAAQ,EAAE,IAAI,CAACC,eAAe,CAACD,QAAQ,CAACF,QAAQ,CAAC;QACnD,CAAC;MACH;IACF;IACA,OAAO;MACLD,QAAQ,EAAE,MAAM;MAChBE,SAAS,EAAE,MAAM;MACjBC,QAAQ,EAAE;IACZ,CAAC;EACH;EAGOZ,mBAAmBA,CAAA,EAAG;IAC3B,IAAI;MACF;MACA,IAAIb,QAAQ,CAACS,EAAE,KAAK,SAAS,EAAE;QAC7B,IAAI,IAAI,CAACQ,YAAY,EAAE;UACrBf,cAAc,CAACyB,sBAAsB,CAAC,IAAI,CAACV,YAAY,CAAC;QAC1D;MACF;;MAEA;MACA,IAAIjB,QAAQ,CAACS,EAAE,KAAK,KAAK,EAAE;QACzB,IAAI,IAAI,CAACQ,YAAY,EAAE;UACrBf,cAAc,CAACyB,sBAAsB,CAAC,IAAI,CAACV,YAAY,CAAC;QAC1D;MACF;IACF,CAAC,CAAC,OAAOW,KAAU,EAAE,CAAE;EACzB;AACF;AAACC,gBAAA,GA1HoB1B,eAAe;AAAAE,eAAA,CAAfF,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["Platform","PermissionModule","LocationModule","LocationManager","constructor","_defineProperty","checkForLocationPermissions","OS","foregroundPermission","requestForegroundPermissions","startUpdates","stopLocationUpdates","getInstance","instance","startLocationUpdates","subscription","addLocationListener","location","lastLocationAndroid","console","log","getLastLocation","latitude","toString","longitude","accuracy","lastLocationiOS","removeLocationListener","error","_LocationManager"],"sources":["LocationManager.ts"],"sourcesContent":["import { EmitterSubscription, Platform } from 'react-native';\nimport PermissionModule from '../../native/PermissionModule';\nimport LocationModule, { LocationType } from '../../native/LocationModule';\n\nexport default class LocationManager {\n private static instance: LocationManager;\n private lastLocationAndroid: LocationType | null = null;\n private lastLocationiOS: LocationType | null = null;\n private stopUpdate: { remove(): void } | undefined;\n private subscription: EmitterSubscription | null = null;\n\n public async checkForLocationPermissions(): Promise<boolean> {\n if (Platform.OS === 'ios') {\n // old code checking for permissions using expo-location\n // let permissionResponse = await Location.getForegroundPermissionsAsync();\n // if (permissionResponse.status === 'granted') {\n // this.startUpdates();\n // return true;\n // } else {\n // let { status } = await Location.requestForegroundPermissionsAsync();\n // if (status === 'granted') {\n // this.startUpdates();\n // return true;\n // } else {\n // this.stopLocationUpdates();\n // return false;\n // }\n // }\n let foregroundPermission = await PermissionModule.requestForegroundPermissions();\n if (foregroundPermission) {\n this.startUpdates();\n return true;\n } else {\n this.stopLocationUpdates();\n return false;\n }\n }\n if (Platform.OS === 'android') {\n let foregroundPermission = await PermissionModule.requestForegroundPermissions();\n if (foregroundPermission) {\n this.startUpdates();\n return true;\n } else {\n this.stopLocationUpdates();\n return false;\n }\n }\n return true;\n }\n\n public static getInstance(): LocationManager {\n if (!LocationManager.instance) {\n LocationManager.instance = new LocationManager();\n }\n return LocationManager.instance;\n }\n\n public startUpdates() {\n if (Platform.OS === 'android') {\n LocationModule.startLocationUpdates();\n this.subscription = LocationModule.addLocationListener((location) => {\n if (location != null) {\n this.lastLocationAndroid = location\n }\n });\n }\n\n if (Platform.OS === 'ios') {\n console.log(\"startUpdates\");\n LocationModule.startLocationUpdates();\n // this.subscription = LocationModule.addLocationListener((location) => {\n // console.log('Location updated:', location);\n // if (location != null) {\n // this.lastLocationiOS = location\n // }\n // });\n }\n }\n\n public async getLastLocation(): Promise<DLocation> {\n if (Platform.OS === 'android' && this.lastLocationAndroid != null) {\n return {\n latitude: this.lastLocationAndroid.latitude.toString(),\n longitude: this.lastLocationAndroid.longitude.toString(),\n accuracy: this.lastLocationAndroid.accuracy.toString(),\n };\n }\n if (Platform.OS === 'ios') {\n this.lastLocationiOS = await LocationModule.getLastLocation();\n if (this.lastLocationiOS) {\n return {\n latitude: this.lastLocationiOS.latitude.toString(),\n longitude: this.lastLocationiOS.longitude.toString(),\n accuracy: this.lastLocationiOS.accuracy.toString(),\n };\n }\n }\n return {\n latitude: 'null',\n longitude: 'null',\n accuracy: 'null',\n };\n }\n\n\n public stopLocationUpdates() {\n try {\n // code for android\n if (Platform.OS === 'android') {\n if (this.subscription) {\n LocationModule.removeLocationListener(this.subscription);\n }\n }\n\n // code for ios\n if (Platform.OS === 'ios') {\n if (this.subscription) {\n LocationModule.removeLocationListener(this.subscription);\n }\n }\n } catch (error: any) { }\n }\n}\n\nexport interface DLocation {\n latitude: string;\n longitude: string;\n accuracy: string;\n}\n"],"mappings":";;;;AAAA,SAA8BA,QAAQ,QAAQ,cAAc;AAC5D,OAAOC,gBAAgB,MAAM,+BAA+B;AAC5D,OAAOC,cAAc,MAAwB,6BAA6B;AAE1E,eAAe,MAAMC,eAAe,CAAC;EAAAC,YAAA;IAAAC,eAAA,8BAEgB,IAAI;IAAAA,eAAA,0BACR,IAAI;IAAAA,eAAA;IAAAA,eAAA,uBAEA,IAAI;EAAA;EAEvD,MAAaC,2BAA2BA,CAAA,EAAqB;IAC3D,IAAIN,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;MACzB;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,IAAIC,oBAAoB,GAAG,MAAMP,gBAAgB,CAACQ,4BAA4B,CAAC,CAAC;MAChF,IAAID,oBAAoB,EAAE;QACxB,IAAI,CAACE,YAAY,CAAC,CAAC;QACnB,OAAO,IAAI;MACb,CAAC,MAAM;QACL,IAAI,CAACC,mBAAmB,CAAC,CAAC;QAC1B,OAAO,KAAK;MACd;IACF;IACA,IAAIX,QAAQ,CAACO,EAAE,KAAK,SAAS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,IAAI,CAACP,mBAAmB,CAACO,QAAQ,CAACF,QAAQ,CAAC;MACvD,CAAC;IACH;IACA,IAAIvB,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;MACzB,IAAI,CAACmB,eAAe,GAAG,MAAMxB,cAAc,CAACmB,eAAe,CAAC,CAAC;MAC7D,IAAI,IAAI,CAACK,eAAe,EAAE;QACxB,OAAO;UACLJ,QAAQ,EAAE,IAAI,CAACI,eAAe,CAACJ,QAAQ,CAACC,QAAQ,CAAC,CAAC;UAClDC,SAAS,EAAE,IAAI,CAACE,eAAe,CAACF,SAAS,CAACD,QAAQ,CAAC,CAAC;UACpDE,QAAQ,EAAE,IAAI,CAACC,eAAe,CAACD,QAAQ,CAACF,QAAQ,CAAC;QACnD,CAAC;MACH;IACF;IACA,OAAO;MACLD,QAAQ,EAAE,MAAM;MAChBE,SAAS,EAAE,MAAM;MACjBC,QAAQ,EAAE;IACZ,CAAC;EACH;EAGOd,mBAAmBA,CAAA,EAAG;IAC3B,IAAI;MACF;MACA,IAAIX,QAAQ,CAACO,EAAE,KAAK,SAAS,EAAE;QAC7B,IAAI,IAAI,CAACQ,YAAY,EAAE;UACrBb,cAAc,CAACyB,sBAAsB,CAAC,IAAI,CAACZ,YAAY,CAAC;QAC1D;MACF;;MAEA;MACA,IAAIf,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;QACzB,IAAI,IAAI,CAACQ,YAAY,EAAE;UACrBb,cAAc,CAACyB,sBAAsB,CAAC,IAAI,CAACZ,YAAY,CAAC;QAC1D;MACF;IACF,CAAC,CAAC,OAAOa,KAAU,EAAE,CAAE;EACzB;AACF;AAACC,gBAAA,GAtHoB1B,eAAe;AAAAE,eAAA,CAAfF,eAAe","ignoreList":[]}
@@ -20,6 +20,7 @@ import { pushBulkEventForSync } from '../../utils/SyncManagerUtils';
20
20
  import callbackHandler from './callbacksHandler';
21
21
  import { DispatchExecutor as dispatchExecutor } from '@os1-platform/platform-coreos-execution-engine-sdk';
22
22
  import { MAX_RETRY_COUNT } from '../syncmanager/constants';
23
+ import { initAndUpdateDatabase } from '../../database/DBManager';
23
24
  export class DispatchSDKManager {
24
25
  constructor() {
25
26
  _defineProperty(this, "cache", DispatchSdkCache.getInstance());
@@ -49,11 +50,16 @@ export class DispatchSDKManager {
49
50
  enableNative: true,
50
51
  environment: sdkConfig.sentry.env,
51
52
  dsn: sdkConfig.sentry.dsn,
52
- tracesSampleRate: 1.0
53
+ tracesSampleRate: 1.0,
54
+ enableAutoSessionTracking: true,
55
+ enableAutoPerformanceTracing: false,
56
+ attachStacktrace: true,
57
+ maxBreadcrumbs: 50
53
58
  });
54
59
  }
55
60
  await SdkUtils.checkMandatory();
56
61
  await this.cache.setObjectInCache(this.keys.SDK_CONFIG, sdkConfig);
62
+ await initAndUpdateDatabase();
57
63
  GraphQLClient.init(sdkConfig.tenantBaseURL);
58
64
  AppSyncManager.initAppSync(sdkConfig.tenantBaseURL, sdkConfig.syncRetryCount ?? MAX_RETRY_COUNT);
59
65
  LocationManager.getInstance().startUpdates();
@@ -1 +1 @@
1
- {"version":3,"names":["DispatchSdkCache","LocationManager","AppSyncManager","Logger","ReasonCodeContainer","GraphQLClient","isMandatoryKeysPresent","isTokenExpired","BaseError","ErrorCodes","SdkUtils","Sentry","EventCodeRepo","Storage","pushBulkEventForSync","callbackHandler","DispatchExecutor","dispatchExecutor","MAX_RETRY_COUNT","DispatchSDKManager","constructor","_defineProperty","getInstance","KEYS","instance","initDispatchSDK","sdkConfig","_sdkConfig$sentry","_sdkConfig$callbacks","_sdkConfig$callbacks2","_sdkConfig$callbacks3","_sdkConfig$callbacks4","InvalidArgumentError","accessToken","ACCESS_TOKEN_EXPIRED","sentry","enabled","init","enableNative","environment","env","dsn","tracesSampleRate","checkMandatory","cache","setObjectInCache","keys","SDK_CONFIG","tenantBaseURL","initAppSync","syncRetryCount","startUpdates","eventMapping","saveEventCode","fetchReasonCode","setLogging","enableLogging","storage","callbacks","fetchPhoneNumbersCallback","fetchDateTimeCallback","tokenRefreshCallback","fetchSDSEmailAndPhoneNumbersCallback","_sdkConfig$callbacks5","storeMultipleKeysCallback","setSharedItems","readMultipleKeysCallback","getSharedItems","deleteMultipleKeysCallback","removeSharedItems","eventBulkSyncCallback","debugLevelLog","startSDKSyncManager","logCora","removeLocationUpdates","stopLocationUpdates","_DispatchSDKManager"],"sources":["DispatchSDKManager.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport DispatchSdkCache from './DispatchSdkCache';\nimport LocationManager from '../location/LocationManager';\nimport AppSyncManager from '../syncmanager/AppSyncManager';\nimport Logger from '../../utils/Logger';\nimport ReasonCodeContainer from '../dispatchCodes/ReasonCodeContainer';\nimport GraphQLClient from '../../network/GraphQLClient';\nimport { isMandatoryKeysPresent, isTokenExpired } from '../../utils/utils';\nimport { BaseError } from '../../errors/BaseError';\nimport ErrorCodes from '../../errors/ErrorCodes';\nimport SdkUtils from '../../utils/SdkUtils';\nimport * as Sentry from '@sentry/react-native';\nimport type { DispatchSDKConfig } from '../../models/sdk';\nimport EventCodeRepo from '../dispatchCodes/EventCodeRepo';\nimport Storage from '../../utils/storage';\nimport { pushBulkEventForSync } from '../../utils/SyncManagerUtils';\nimport callbackHandler from './callbacksHandler';\nimport { DispatchExecutor as dispatchExecutor } from '@os1-platform/platform-coreos-execution-engine-sdk';\nimport { MAX_RETRY_COUNT } from '../syncmanager/constants';\n\nexport class DispatchSDKManager {\n private static instance: DispatchSDKManager;\n private cache: DispatchSdkCache = DispatchSdkCache.getInstance();\n private keys = DispatchSdkCache.KEYS;\n\n private constructor() { }\n\n public static getInstance(): DispatchSDKManager {\n if (!DispatchSDKManager.instance) {\n DispatchSDKManager.instance = new DispatchSDKManager();\n }\n return DispatchSDKManager.instance;\n }\n\n /**\n * Call this init method with username,userID & authentication tokens\n * @param sdkConfig\n */\n public async initDispatchSDK(sdkConfig: DispatchSDKConfig) {\n if (\n !isMandatoryKeysPresent(sdkConfig, [\n 'tenantID',\n 'userID',\n 'userName',\n 'tenantBaseURL',\n 'domain',\n 'accessToken',\n ])\n ) {\n throw new BaseError(\n ErrorCodes.InvalidArgumentError,\n 'Invalid/Missing Argument Passed in SdkConfig'\n );\n }\n if (isTokenExpired(sdkConfig.accessToken)) {\n throw new BaseError(\n ErrorCodes.ACCESS_TOKEN_EXPIRED,\n 'JWT Token Expired!'\n );\n }\n if (sdkConfig.sentry && sdkConfig.sentry?.enabled) {\n Sentry.init({\n enableNative: true,\n environment: sdkConfig.sentry.env,\n dsn: sdkConfig.sentry.dsn,\n tracesSampleRate: 1.0,\n });\n }\n await SdkUtils.checkMandatory();\n await this.cache.setObjectInCache(this.keys.SDK_CONFIG, sdkConfig);\n GraphQLClient.init(sdkConfig.tenantBaseURL);\n AppSyncManager.initAppSync(\n sdkConfig.tenantBaseURL,\n sdkConfig.syncRetryCount ?? MAX_RETRY_COUNT\n );\n LocationManager.getInstance().startUpdates();\n if (sdkConfig.eventMapping) {\n EventCodeRepo.getInstance().saveEventCode(sdkConfig.eventMapping);\n }\n await ReasonCodeContainer.getInstance().fetchReasonCode();\n Logger.getInstance().setLogging(sdkConfig.enableLogging ?? true, sdkConfig);\n let storage = Storage.getInstance();\n\n if (\n sdkConfig.callbacks?.fetchPhoneNumbersCallback &&\n sdkConfig?.callbacks?.fetchDateTimeCallback &&\n sdkConfig?.callbacks?.tokenRefreshCallback &&\n sdkConfig?.callbacks?.fetchSDSEmailAndPhoneNumbersCallback\n ) {\n await callbackHandler.init(\n sdkConfig.callbacks.fetchPhoneNumbersCallback,\n sdkConfig.callbacks.fetchDateTimeCallback,\n sdkConfig.callbacks.tokenRefreshCallback,\n sdkConfig?.callbacks?.fetchSDSEmailAndPhoneNumbersCallback\n );\n }\n await dispatchExecutor.init(\n {\n storeMultipleKeysCallback: storage.setSharedItems,\n readMultipleKeysCallback: storage.getSharedItems,\n deleteMultipleKeysCallback: storage.removeSharedItems,\n eventBulkSyncCallback: pushBulkEventForSync,\n },\n sdkConfig.debugLevelLog ? 'debug' : 'emerg'\n );\n AppSyncManager.getInstance().startSDKSyncManager();\n Logger.getInstance().logCora(\"Info\", \"Dispatch SDK Initialized\");\n }\n\n public removeLocationUpdates() {\n LocationManager.getInstance().stopLocationUpdates();\n }\n}\n"],"mappings":";;;;AAAA;AACA,OAAOA,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAAe,MAAM,6BAA6B;AACzD,OAAOC,cAAc,MAAM,+BAA+B;AAC1D,OAAOC,MAAM,MAAM,oBAAoB;AACvC,OAAOC,mBAAmB,MAAM,sCAAsC;AACtE,OAAOC,aAAa,MAAM,6BAA6B;AACvD,SAASC,sBAAsB,EAAEC,cAAc,QAAQ,mBAAmB;AAC1E,SAASC,SAAS,QAAQ,wBAAwB;AAClD,OAAOC,UAAU,MAAM,yBAAyB;AAChD,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,OAAO,KAAKC,MAAM,MAAM,sBAAsB;AAE9C,OAAOC,aAAa,MAAM,gCAAgC;AAC1D,OAAOC,OAAO,MAAM,qBAAqB;AACzC,SAASC,oBAAoB,QAAQ,8BAA8B;AACnE,OAAOC,eAAe,MAAM,oBAAoB;AAChD,SAASC,gBAAgB,IAAIC,gBAAgB,QAAQ,oDAAoD;AACzG,SAASC,eAAe,QAAQ,0BAA0B;AAE1D,OAAO,MAAMC,kBAAkB,CAAC;EAKtBC,WAAWA,CAAA,EAAG;IAAAC,eAAA,gBAHYrB,gBAAgB,CAACsB,WAAW,CAAC,CAAC;IAAAD,eAAA,eACjDrB,gBAAgB,CAACuB,IAAI;EAEZ;EAExB,OAAcD,WAAWA,CAAA,EAAuB;IAC9C,IAAI,CAACH,kBAAkB,CAACK,QAAQ,EAAE;MAChCL,kBAAkB,CAACK,QAAQ,GAAG,IAAIL,kBAAkB,CAAC,CAAC;IACxD;IACA,OAAOA,kBAAkB,CAACK,QAAQ;EACpC;;EAEA;AACF;AACA;AACA;EACE,MAAaC,eAAeA,CAACC,SAA4B,EAAE;IAAA,IAA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AAC,EACDY,SAAS,CAAC6C,aAAa,GAAG,OAAO,GAAG,OACtC,CAAC;IACDrE,cAAc,CAACoB,WAAW,CAAC,CAAC,CAACkD,mBAAmB,CAAC,CAAC;IAClDrE,MAAM,CAACmB,WAAW,CAAC,CAAC,CAACmD,OAAO,CAAC,MAAM,EAAE,0BAA0B,CAAC;EAClE;EAEOC,qBAAqBA,CAAA,EAAG;IAC7BzE,eAAe,CAACqB,WAAW,CAAC,CAAC,CAACqD,mBAAmB,CAAC,CAAC;EACrD;AACF;AAACC,mBAAA,GA5FYzD,kBAAkB;AAAAE,eAAA,CAAlBF,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["DispatchSdkCache","LocationManager","AppSyncManager","Logger","ReasonCodeContainer","GraphQLClient","isMandatoryKeysPresent","isTokenExpired","BaseError","ErrorCodes","SdkUtils","Sentry","EventCodeRepo","Storage","pushBulkEventForSync","callbackHandler","DispatchExecutor","dispatchExecutor","MAX_RETRY_COUNT","initAndUpdateDatabase","DispatchSDKManager","constructor","_defineProperty","getInstance","KEYS","instance","initDispatchSDK","sdkConfig","_sdkConfig$sentry","_sdkConfig$callbacks","_sdkConfig$callbacks2","_sdkConfig$callbacks3","_sdkConfig$callbacks4","InvalidArgumentError","accessToken","ACCESS_TOKEN_EXPIRED","sentry","enabled","init","enableNative","environment","env","dsn","tracesSampleRate","enableAutoSessionTracking","enableAutoPerformanceTracing","attachStacktrace","maxBreadcrumbs","checkMandatory","cache","setObjectInCache","keys","SDK_CONFIG","tenantBaseURL","initAppSync","syncRetryCount","startUpdates","eventMapping","saveEventCode","fetchReasonCode","setLogging","enableLogging","storage","callbacks","fetchPhoneNumbersCallback","fetchDateTimeCallback","tokenRefreshCallback","fetchSDSEmailAndPhoneNumbersCallback","_sdkConfig$callbacks5","storeMultipleKeysCallback","setSharedItems","readMultipleKeysCallback","getSharedItems","deleteMultipleKeysCallback","removeSharedItems","eventBulkSyncCallback","debugLevelLog","startSDKSyncManager","logCora","removeLocationUpdates","stopLocationUpdates","_DispatchSDKManager"],"sources":["DispatchSDKManager.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport DispatchSdkCache from './DispatchSdkCache';\nimport LocationManager from '../location/LocationManager';\nimport AppSyncManager from '../syncmanager/AppSyncManager';\nimport Logger from '../../utils/Logger';\nimport ReasonCodeContainer from '../dispatchCodes/ReasonCodeContainer';\nimport GraphQLClient from '../../network/GraphQLClient';\nimport { isMandatoryKeysPresent, isTokenExpired } from '../../utils/utils';\nimport { BaseError } from '../../errors/BaseError';\nimport ErrorCodes from '../../errors/ErrorCodes';\nimport SdkUtils from '../../utils/SdkUtils';\nimport * as Sentry from '@sentry/react-native';\nimport type { DispatchSDKConfig } from '../../models/sdk';\nimport EventCodeRepo from '../dispatchCodes/EventCodeRepo';\nimport Storage from '../../utils/storage';\nimport { pushBulkEventForSync } from '../../utils/SyncManagerUtils';\nimport callbackHandler from './callbacksHandler';\nimport { DispatchExecutor as dispatchExecutor } from '@os1-platform/platform-coreos-execution-engine-sdk';\nimport { MAX_RETRY_COUNT } from '../syncmanager/constants';\nimport { initAndUpdateDatabase } from '../../database/DBManager';\n\nexport class DispatchSDKManager {\n private static instance: DispatchSDKManager;\n private cache: DispatchSdkCache = DispatchSdkCache.getInstance();\n private keys = DispatchSdkCache.KEYS;\n\n private constructor() { }\n\n public static getInstance(): DispatchSDKManager {\n if (!DispatchSDKManager.instance) {\n DispatchSDKManager.instance = new DispatchSDKManager();\n }\n return DispatchSDKManager.instance;\n }\n\n /**\n * Call this init method with username,userID & authentication tokens\n * @param sdkConfig\n */\n public async initDispatchSDK(sdkConfig: DispatchSDKConfig) {\n if (\n !isMandatoryKeysPresent(sdkConfig, [\n 'tenantID',\n 'userID',\n 'userName',\n 'tenantBaseURL',\n 'domain',\n 'accessToken',\n ])\n ) {\n throw new BaseError(ErrorCodes.InvalidArgumentError, 'Invalid/Missing Argument Passed in SdkConfig');\n }\n \n if (isTokenExpired(sdkConfig.accessToken)) {\n throw new BaseError(\n ErrorCodes.ACCESS_TOKEN_EXPIRED,\n 'JWT Token Expired!'\n );\n }\n \n if (sdkConfig.sentry && sdkConfig.sentry?.enabled) {\n Sentry.init({\n enableNative: true,\n environment: sdkConfig.sentry.env,\n dsn: sdkConfig.sentry.dsn,\n tracesSampleRate: 1.0,\n enableAutoSessionTracking: true,\n enableAutoPerformanceTracing: false,\n attachStacktrace: true,\n maxBreadcrumbs: 50,\n });\n }\n \n await SdkUtils.checkMandatory();\n \n await this.cache.setObjectInCache(this.keys.SDK_CONFIG, sdkConfig);\n await initAndUpdateDatabase()\n GraphQLClient.init(sdkConfig.tenantBaseURL);\n AppSyncManager.initAppSync(\n sdkConfig.tenantBaseURL,\n sdkConfig.syncRetryCount ?? MAX_RETRY_COUNT\n );\n LocationManager.getInstance().startUpdates();\n if (sdkConfig.eventMapping) {\n EventCodeRepo.getInstance().saveEventCode(sdkConfig.eventMapping);\n }\n await ReasonCodeContainer.getInstance().fetchReasonCode();\n \n Logger.getInstance().setLogging(sdkConfig.enableLogging ?? true, sdkConfig);\n let storage = Storage.getInstance();\n\n if (\n sdkConfig.callbacks?.fetchPhoneNumbersCallback &&\n sdkConfig?.callbacks?.fetchDateTimeCallback &&\n sdkConfig?.callbacks?.tokenRefreshCallback &&\n sdkConfig?.callbacks?.fetchSDSEmailAndPhoneNumbersCallback\n ) {\n await callbackHandler.init(\n sdkConfig.callbacks.fetchPhoneNumbersCallback,\n sdkConfig.callbacks.fetchDateTimeCallback,\n sdkConfig.callbacks.tokenRefreshCallback,\n sdkConfig?.callbacks?.fetchSDSEmailAndPhoneNumbersCallback\n );\n }\n await dispatchExecutor.init(\n {\n storeMultipleKeysCallback: storage.setSharedItems,\n readMultipleKeysCallback: storage.getSharedItems,\n deleteMultipleKeysCallback: storage.removeSharedItems,\n eventBulkSyncCallback: pushBulkEventForSync,\n },\n sdkConfig.debugLevelLog ? 'debug' : 'emerg'\n );\n AppSyncManager.getInstance().startSDKSyncManager();\n Logger.getInstance().logCora(\"Info\", \"Dispatch SDK Initialized\");\n }\n\n public removeLocationUpdates() {\n LocationManager.getInstance().stopLocationUpdates();\n }\n}\n"],"mappings":";;;;AAAA;AACA,OAAOA,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAAe,MAAM,6BAA6B;AACzD,OAAOC,cAAc,MAAM,+BAA+B;AAC1D,OAAOC,MAAM,MAAM,oBAAoB;AACvC,OAAOC,mBAAmB,MAAM,sCAAsC;AACtE,OAAOC,aAAa,MAAM,6BAA6B;AACvD,SAASC,sBAAsB,EAAEC,cAAc,QAAQ,mBAAmB;AAC1E,SAASC,SAAS,QAAQ,wBAAwB;AAClD,OAAOC,UAAU,MAAM,yBAAyB;AAChD,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,OAAO,KAAKC,MAAM,MAAM,sBAAsB;AAE9C,OAAOC,aAAa,MAAM,gCAAgC;AAC1D,OAAOC,OAAO,MAAM,qBAAqB;AACzC,SAASC,oBAAoB,QAAQ,8BAA8B;AACnE,OAAOC,eAAe,MAAM,oBAAoB;AAChD,SAASC,gBAAgB,IAAIC,gBAAgB,QAAQ,oDAAoD;AACzG,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,qBAAqB,QAAQ,0BAA0B;AAEhE,OAAO,MAAMC,kBAAkB,CAAC;EAKtBC,WAAWA,CAAA,EAAG;IAAAC,eAAA,gBAHYtB,gBAAgB,CAACuB,WAAW,CAAC,CAAC;IAAAD,eAAA,eACjDtB,gBAAgB,CAACwB,IAAI;EAEZ;EAExB,OAAcD,WAAWA,CAAA,EAAuB;IAC9C,IAAI,CAACH,kBAAkB,CAACK,QAAQ,EAAE;MAChCL,kBAAkB,CAACK,QAAQ,GAAG,IAAIL,kBAAkB,CAAC,CAAC;IACxD;IACA,OAAOA,kBAAkB,CAACK,QAAQ;EACpC;;EAEA;AACF;AACA;AACA;EACE,MAAaC,eAAeA,CAACC,SAA4B,EAAE;IAAA,IAAAC,iBAAA,EAAAC,oBAAA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CAACQ,cAAc;MACjDC,wBAAwB,EAAET,OAAO,CAACU,cAAc;MAChDC,0BAA0B,EAAEX,OAAO,CAACY,iBAAiB;MACrDC,qBAAqB,EAAE7D;IACzB,CAAC,EACDa,SAAS,CAACiD,aAAa,GAAG,OAAO,GAAG,OACtC,CAAC;IACD1E,cAAc,CAACqB,WAAW,CAAC,CAAC,CAACsD,mBAAmB,CAAC,CAAC;IAClD1E,MAAM,CAACoB,WAAW,CAAC,CAAC,CAACuD,OAAO,CAAC,MAAM,EAAE,0BAA0B,CAAC;EAClE;EAEOC,qBAAqBA,CAAA,EAAG;IAC7B9E,eAAe,CAACsB,WAAW,CAAC,CAAC,CAACyD,mBAAmB,CAAC,CAAC;EACrD;AACF;AAACC,mBAAA,GAnGY7D,kBAAkB;AAAAE,eAAA,CAAlBF,kBAAkB","ignoreList":[]}
@@ -1,8 +1,6 @@
1
1
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
- /* eslint-disable @typescript-eslint/no-unused-vars */
5
-
6
4
  import DispatchSdkCache from './DispatchSdkCache';
7
5
  import { BaseError } from '../../errors/BaseError';
8
6
  import ErrorCodes from '../../errors/ErrorCodes';
@@ -1 +1 @@
1
- {"version":3,"names":["DispatchSdkCache","BaseError","ErrorCodes","CallbacksHandler","constructor","_defineProperty","init","phoneCallback","dateTimeCallBack","tokenRefreshCallback","emailAndPhoneCallback","_callbackToFetchPhoneNumbers","_callbackToFetchDateTime","_callbackRefreshToken","_callbackfetchSDSEmailAndPhone","getPhoneNumbers","sdsIds","getEmailAndPhoneNumbers","getDateTime","refresheAndUpdateToken","SyncManagerNotInitialized","token","length","sdkConfig","getInstance","getObjectFromCache","KEYS","SDK_CONFIG","accessToken","headers","cache","keys","setObjectInCache","ACCESS_TOKEN_EXPIRED","callbackHandler"],"sources":["callbacksHandler.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { DispatchSDKConfig } from 'src/models/sdk';\nimport DispatchSdkCache from './DispatchSdkCache';\nimport { BaseError } from '../../errors/BaseError';\nimport ErrorCodes from '../../errors/ErrorCodes';\nimport { EmailAndPhoneResponse } from '../../components/executiontasks/validateOTP/ValidateOTPSchema';\n\nclass CallbacksHandler {\n private _callbackToFetchPhoneNumbers!: (\n sdsIds: string[]\n ) => Promise<{ key: string; value: string[] }>;\n\n private _callbackToFetchDateTime!: () => Promise<string>;\n private _callbackRefreshToken!: () => Promise<string>;\n private _callbackfetchSDSEmailAndPhone: (\n sdsIds: string[]\n ) => Promise<Record<string, EmailAndPhoneResponse>>;\n\n public init(\n phoneCallback: (\n sdsIds: string[]\n ) => Promise<{ key: string; value: string[] }>,\n dateTimeCallBack: () => Promise<string>,\n tokenRefreshCallback: () => Promise<string>,\n emailAndPhoneCallback: (\n sdsIds: string[]\n ) => Promise<Record<string, EmailAndPhoneResponse>>\n ) {\n this._callbackToFetchPhoneNumbers = phoneCallback;\n this._callbackToFetchDateTime = dateTimeCallBack;\n this._callbackRefreshToken = tokenRefreshCallback;\n this._callbackfetchSDSEmailAndPhone = emailAndPhoneCallback;\n }\n\n public async getPhoneNumbers(\n sdsIds: string[]\n ): Promise<{ key: string; value: string[] } | null> {\n if (!this._callbackToFetchPhoneNumbers) return null;\n else {\n return await this._callbackToFetchPhoneNumbers(sdsIds);\n }\n }\n\n // Method to get email and phone numbers\n public async getEmailAndPhoneNumbers(\n sdsIds: string[]\n ): Promise<Record<string, EmailAndPhoneResponse>> {\n return await this._callbackfetchSDSEmailAndPhone(sdsIds);\n }\n\n public async getDateTime(): Promise<string | ''> {\n if (!this._callbackToFetchDateTime) return '';\n else {\n return await this._callbackToFetchDateTime();\n }\n }\n\n public async refresheAndUpdateToken() {\n if (!this._callbackRefreshToken) {\n throw new BaseError(\n ErrorCodes.SyncManagerNotInitialized,\n 'Dispatch SDK Not Initalised'\n );\n } else {\n let token = await this._callbackRefreshToken();\n if (token && token.length != 0) {\n let sdkConfig =\n (await DispatchSdkCache.getInstance().getObjectFromCache(\n DispatchSdkCache.KEYS.SDK_CONFIG\n )) as DispatchSDKConfig;\n sdkConfig.accessToken = token;\n var headers = sdkConfig.headers;\n if (headers) {\n headers['x-coreos-access'] = token;\n sdkConfig.headers = headers;\n }\n let cache: DispatchSdkCache = DispatchSdkCache.getInstance();\n let keys = DispatchSdkCache.KEYS;\n cache.setObjectInCache(keys.SDK_CONFIG, sdkConfig);\n } else {\n throw new BaseError(\n ErrorCodes.ACCESS_TOKEN_EXPIRED,\n 'Unable to refresh token'\n );\n }\n }\n }\n}\nconst callbackHandler = new CallbacksHandler();\nexport default callbackHandler;\n"],"mappings":";;;AAAA;;AAEA,OAAOA,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,SAAS,QAAQ,wBAAwB;AAClD,OAAOC,UAAU,MAAM,yBAAyB;AAGhD,MAAMC,gBAAgB,CAAC;EAAAC,YAAA;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;EAAA;EAWdC,IAAIA,CACTC,aAE8C,EAC9CC,gBAAuC,EACvCC,oBAA2C,EAC3CC,qBAEmD,EACnD;IACA,IAAI,CAACC,4BAA4B,GAAGJ,aAAa;IACjD,IAAI,CAACK,wBAAwB,GAAGJ,gBAAgB;IAChD,IAAI,CAACK,qBAAqB,GAAGJ,oBAAoB;IACjD,IAAI,CAACK,8BAA8B,GAAGJ,qBAAqB;EAC7D;EAEA,MAAaK,eAAeA,CAC1BC,MAAgB,EACkC;IAClD,IAAI,CAAC,IAAI,CAACL,4BAA4B,E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SAAS,CACjBC,UAAU,CAAC+B,oBAAoB,EAC/B,yBACF,CAAC;MACH;IACF;EACF;AACF;AACA,MAAMC,eAAe,GAAG,IAAI/B,gBAAgB,CAAC,CAAC;AAC9C,eAAe+B,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["DispatchSdkCache","BaseError","ErrorCodes","CallbacksHandler","constructor","_defineProperty","init","phoneCallback","dateTimeCallBack","tokenRefreshCallback","emailAndPhoneCallback","_callbackToFetchPhoneNumbers","_callbackToFetchDateTime","_callbackRefreshToken","_callbackfetchSDSEmailAndPhone","getPhoneNumbers","sdsIds","getEmailAndPhoneNumbers","getDateTime","refresheAndUpdateToken","SyncManagerNotInitialized","token","length","sdkConfig","getInstance","getObjectFromCache","KEYS","SDK_CONFIG","accessToken","headers","cache","keys","setObjectInCache","ACCESS_TOKEN_EXPIRED","callbackHandler"],"sources":["callbacksHandler.ts"],"sourcesContent":["import { DispatchSDKConfig } from '../../models/sdk';\nimport DispatchSdkCache from './DispatchSdkCache';\nimport { BaseError } from '../../errors/BaseError';\nimport ErrorCodes from '../../errors/ErrorCodes';\nimport { EmailAndPhoneResponse } from '../../components/executiontasks/validateOTP/ValidateOTPSchema';\n\nclass CallbacksHandler {\n private _callbackToFetchPhoneNumbers!: (\n sdsIds: string[]\n ) => Promise<{ key: string; value: string[] }>;\n\n private _callbackToFetchDateTime!: () => Promise<string>;\n private _callbackRefreshToken!: () => Promise<string>;\n private _callbackfetchSDSEmailAndPhone: (\n sdsIds: string[]\n ) => Promise<Record<string, EmailAndPhoneResponse>>;\n\n public init(\n phoneCallback: (sdsIds: string[]) => Promise<{ key: string; value: string[] }>,\n dateTimeCallBack: () => Promise<string>,\n tokenRefreshCallback: () => Promise<string>,\n emailAndPhoneCallback: (sdsIds: string[]) => Promise<Record<string, EmailAndPhoneResponse>>\n ) {\n this._callbackToFetchPhoneNumbers = phoneCallback;\n this._callbackToFetchDateTime = dateTimeCallBack;\n this._callbackRefreshToken = tokenRefreshCallback;\n this._callbackfetchSDSEmailAndPhone = emailAndPhoneCallback;\n }\n\n public async getPhoneNumbers(\n sdsIds: string[]\n ): Promise<{ key: string; value: string[] } | null> {\n if (!this._callbackToFetchPhoneNumbers) return null;\n else {\n return await this._callbackToFetchPhoneNumbers(sdsIds);\n }\n }\n\n // Method to get email and phone numbers\n public async getEmailAndPhoneNumbers(\n sdsIds: string[]\n ): Promise<Record<string, EmailAndPhoneResponse>> {\n return await this._callbackfetchSDSEmailAndPhone(sdsIds);\n }\n\n public async getDateTime(): Promise<string | ''> {\n if (!this._callbackToFetchDateTime) return '';\n else {\n return await this._callbackToFetchDateTime();\n }\n }\n\n public async refresheAndUpdateToken() {\n if (!this._callbackRefreshToken) {\n throw new BaseError(\n ErrorCodes.SyncManagerNotInitialized,\n 'Dispatch SDK Not Initalised'\n );\n } else {\n let token = await this._callbackRefreshToken();\n if (token && token.length != 0) {\n let sdkConfig =\n (await DispatchSdkCache.getInstance().getObjectFromCache(\n DispatchSdkCache.KEYS.SDK_CONFIG\n )) as DispatchSDKConfig;\n sdkConfig.accessToken = token;\n var headers = sdkConfig.headers;\n if (headers) {\n headers['x-coreos-access'] = token;\n sdkConfig.headers = headers;\n }\n let cache: DispatchSdkCache = DispatchSdkCache.getInstance();\n let keys = DispatchSdkCache.KEYS;\n cache.setObjectInCache(keys.SDK_CONFIG, sdkConfig);\n } else {\n throw new BaseError(\n ErrorCodes.ACCESS_TOKEN_EXPIRED,\n 'Unable to refresh token'\n );\n }\n }\n }\n}\nconst callbackHandler = new CallbacksHandler();\nexport default callbackHandler;\n"],"mappings":";;;AACA,OAAOA,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,SAAS,QAAQ,wBAAwB;AAClD,OAAOC,UAAU,MAAM,yBAAyB;AAGhD,MAAMC,gBAAgB,CAAC;EAAAC,YAAA;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;EAAA;EAWdC,IAAIA,CACTC,aAA8E,EAC9EC,gBAAuC,EACvC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AAiB,CAAC,GAAGR,KAAK;UAClCE,SAAS,CAACM,OAAO,GAAGA,OAAO;QAC7B;QACA,IAAIC,KAAuB,GAAG9B,gBAAgB,CAACwB,WAAW,CAAC,CAAC;QAC5D,IAAIO,IAAI,GAAG/B,gBAAgB,CAAC0B,IAAI;QAChCI,KAAK,CAACE,gBAAgB,CAACD,IAAI,CAACJ,UAAU,EAAEJ,SAAS,CAAC;MACpD,CAAC,MAAM;QACL,MAAM,IAAItB,SAAS,CACjBC,UAAU,CAAC+B,oBAAoB,EAC/B,yBACF,CAAC;MACH;IACF;EACF;AACF;AACA,MAAMC,eAAe,GAAG,IAAI/B,gBAAgB,CAAC,CAAC;AAC9C,eAAe+B,eAAe","ignoreList":[]}
@@ -4,7 +4,7 @@ export let DispatchSyncType = /*#__PURE__*/function (DispatchSyncType) {
4
4
  DispatchSyncType["DISPATCH_SUB_STATUS_UPDATE"] = "DISPATCH_SUB_STATUS_UPDATE";
5
5
  return DispatchSyncType;
6
6
  }({});
7
- export const DATABASE_NAME = 'OS1_Driver_App_DB';
7
+ export const DATABASE_NAME = 'DispatchSDK_DB';
8
8
  export const EVENTS_TABLE = 'EVENTS_TABLE';
9
9
  export const REASONS_TABLE = 'REASONS_TABLE';
10
10
  export const EVENT_CODES_TABLE = 'EVENT_CODES_TABLE';
@@ -60,6 +60,10 @@ export const EventColumns = {
60
60
  DESCRIPTION: 'description',
61
61
  SUCCESS_EVENT: 'successEvent'
62
62
  };
63
+ export const VERSION_TABLE = 'VERSION_TABLE';
64
+ export const VERSION_COLUMNS = {
65
+ VERSION_NO: 'versionNo'
66
+ };
63
67
 
64
68
  // NEW CODE
65
69
 
@@ -1 +1 @@
1
- {"version":3,"names":["DispatchSyncType","DATABASE_NAME","EVENTS_TABLE","REASONS_TABLE","EVENT_CODES_TABLE","EVENTS_COLUMNS","ID","SEQUENCE","PAYLOAD","SYNCED","CONFIG","SYNC_TYPE","META","SYNC_ERROR","DISPATCH_ID","DATA_LENGTH","ATTEMPT_COUNT","DOCUMENT_TABLE","DOCUMENT_COLUMNS","DATA","BASE64","FILE_PATH","FILE_NAME","FILE_TYPE","FMS_FOLDER_ID","FMS_ID","PRIORITY","DESCRIPTION","JOB_ID","OBJECTIVE_REF","GEO_TIMESTAMP","PROCESSED_FILE_PATH","SyncMethod","ReasonColums","CODE","IS_ENABLED","SYSTEM_DEFINED","EventColumns","SUCCESS_EVENT","WORKFLOW_INSTANCE_TABLE","WORKFLOW_INSTANCE_COLUMNS","WORKFLOW_INSTANCE_ID","MERGED_WORKFLOW_INSTANCE_ID","SCANNABLE_ID","INITIAL_MERGED_WORKFLOW_INSTANCE_ID","STATUS","JOB_WF_ID","DISPLAY_DATA","WORKFLOW_ID"],"sources":["DBConfig.ts"],"sourcesContent":["import { IDispatch } from '@os1-platform/platform-coreos-execution-engine-sdk';\nexport type ExecEngineSyncType = IDispatch.SyncType;\n\nexport enum DispatchSyncType {\n DEFAULT = 'DEFAULT',\n DISPATCH_UPDATE = 'DISPATCH_UPDATE',\n DISPATCH_SUB_STATUS_UPDATE = 'DISPATCH_SUB_STATUS_UPDATE',\n}\n\nexport const DATABASE_NAME = 'OS1_Driver_App_DB';\nexport const EVENTS_TABLE = 'EVENTS_TABLE';\nexport const REASONS_TABLE = 'REASONS_TABLE';\nexport const EVENT_CODES_TABLE = 'EVENT_CODES_TABLE';\n\nexport const EVENTS_COLUMNS = {\n ID: 'id',\n SEQUENCE: 'seq_number',\n PAYLOAD: 'payload',\n SYNCED: 'synced',\n CONFIG: 'config',\n SYNC_TYPE: 'sync_type',\n META: 'meta',\n SYNC_ERROR: 'sync_error',\n DISPATCH_ID: 'dispatch_id',\n DATA_LENGTH: 'data_length',\n ATTEMPT_COUNT: 'attempt_count',\n};\n\nexport const DOCUMENT_TABLE = 'DOCUMENTS_TABLE';\nexport const DOCUMENT_COLUMNS = {\n ID: 'id',\n DATA: 'data',\n BASE64: 'base64',\n FILE_PATH: 'file_path',\n FILE_NAME: 'file_name',\n FILE_TYPE: 'file_type',\n SYNCED: 'synced',\n FMS_FOLDER_ID: 'fms_folder_id',\n FMS_ID: 'fms_id',\n PRIORITY: 'priority',\n DESCRIPTION: 'desc',\n SYNC_ERROR: 'sync_error',\n DISPATCH_ID: 'dispatch_id',\n JOB_ID: 'job_id',\n OBJECTIVE_REF: 'objective_ref',\n ATTEMPT_COUNT: 'attempt_count',\n GEO_TIMESTAMP: 'geo_timestamp',\n PROCESSED_FILE_PATH: 'processed_file_path',\n};\nexport type DocumentRow = {\n id: number;\n data: string;\n base64: boolean;\n file_path: string;\n file_name: string;\n file_type: string;\n synced: boolean;\n fms_folder_id: string;\n fms_id: string;\n priority: number;\n desc: string;\n sync_error: string;\n dispatch_id: string;\n job_id: string;\n objective_ref: string;\n geo_timestamp: string;\n processed_file_path: string;\n attempt_count: number;\n};\nexport type EventRow = {\n id: number;\n payload: string;\n synced: boolean;\n config: string;\n sync_type: ExecEngineSyncType | DispatchSyncType;\n objective_ref: string;\n sync_error: string;\n dispatch_id: string;\n attempt_count: number;\n};\n\nexport enum SyncMethod {\n POST = 'POST',\n PUT = 'PUT',\n GET = 'GET',\n DELETE = 'DELETE',\n}\nexport const ReasonColums = {\n CODE: 'reasonCode',\n DESCRIPTION: 'description',\n IS_ENABLED: 'isEnabled',\n SYSTEM_DEFINED: 'isSystemDefined',\n};\nexport interface ReasonsRow {\n description: string;\n isEnabled: boolean;\n reasonCode: string;\n isSystemDefined: boolean;\n}\n\nexport interface EventsRow {\n description: string;\n successEvent: boolean;\n eventCode: string;\n}\n\nexport const EventColumns = {\n CODE: 'eventCode',\n DESCRIPTION: 'description',\n SUCCESS_EVENT: 'successEvent',\n};\n\n// NEW CODE\nexport interface BulkEvent {\n syncType: ExecEngineSyncType | DispatchSyncType;\n dispatchId: string;\n data: any;\n meta?: any; // updatedBy, code, status, timestamp, [{jobId,wfId}]\n}\n\n// OLD CODE\n// export interface BulkEvent {\n// syncType: SyncType;\n// dispatchId: string;\n// data: string;\n// config: string;\n// sequence: number;\n// meta?: any;\n// }\n\nexport interface WFUpdateBulkEventData {\n [customETName: string]: EventETData;\n}\n\nexport interface EventETData {\n output: any;\n}\n\nexport interface WIUpdateOutputPayload {\n dispatchId: string;\n updatedBy: any;\n workflows: Array<WorkflowUpdatePayload>;\n}\n\nexport interface WorkflowUpdatePayload {\n status: string;\n timestamp: number;\n attemptId: 1;\n code: string;\n data: any;\n meta?: any;\n __unmerged?: Array<UnmergedData>;\n}\n\nexport interface UnmergedData {\n workflowInstanceId: string;\n jobId: string;\n data?: any;\n}\n\nexport interface CustodyData {\n dispatchId: string;\n jobId: string;\n custodyEntity: string;\n custodyLocationId: string;\n custodyEntityAmount: number;\n custodyEntityId: string;\n}\n\nexport const WORKFLOW_INSTANCE_TABLE = 'WF_INSTANCE_TABLE';\nexport const WORKFLOW_INSTANCE_COLUMNS = {\n WORKFLOW_INSTANCE_ID: 'WFIId',\n MERGED_WORKFLOW_INSTANCE_ID: 'MWFIId',\n JOB_ID: 'jobId',\n SCANNABLE_ID: 'scannableId',\n INITIAL_MERGED_WORKFLOW_INSTANCE_ID: 'InitialMWFIId',\n STATUS: 'status',\n JOB_WF_ID: 'jobWfId',\n DISPLAY_DATA: 'displayData',\n WORKFLOW_ID: 'WFId',\n};\n\nexport interface SyncManagerPayload {\n data: {\n action: ExecEngineSyncType | DispatchSyncType;\n payload: any;\n };\n length: number;\n}\n"],"mappings":"AAGA,WAAYA,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAM5B,OAAO,MAAMC,aAAa,GAAG,mBAAmB;AAChD,OAAO,MAAMC,YAAY,GAAG,cAAc;AAC1C,OAAO,MAAMC,aAAa,GAAG,eAAe;AAC5C,OAAO,MAAMC,iBAAiB,GAAG,mBAAmB;AAEpD,OAAO,MAAMC,cAAc,GAAG;EAC5BC,EAAE,EAAE,IAAI;EACRC,QAAQ,EAAE,YAAY;EACtB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AAuB,GAAG,mBAAmB;AAC1D,OAAO,MAAMC,yBAAyB,GAAG;EACvCC,oBAAoB,EAAE,OAAO;EAC7BC,2BAA2B,EAAE,QAAQ;EACrCd,MAAM,EAAE,OAAO;EACfe,YAAY,EAAE,aAAa;EAC3BC,mCAAmC,EAAE,eAAe;EACpDC,MAAM,EAAE,QAAQ;EAChBC,SAAS,EAAE,SAAS;EACpBC,YAAY,EAAE,aAAa;EAC3BC,WAAW,EAAE;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["DispatchSyncType","DATABASE_NAME","EVENTS_TABLE","REASONS_TABLE","EVENT_CODES_TABLE","EVENTS_COLUMNS","ID","SEQUENCE","PAYLOAD","SYNCED","CONFIG","SYNC_TYPE","META","SYNC_ERROR","DISPATCH_ID","DATA_LENGTH","ATTEMPT_COUNT","DOCUMENT_TABLE","DOCUMENT_COLUMNS","DATA","BASE64","FILE_PATH","FILE_NAME","FILE_TYPE","FMS_FOLDER_ID","FMS_ID","PRIORITY","DESCRIPTION","JOB_ID","OBJECTIVE_REF","GEO_TIMESTAMP","PROCESSED_FILE_PATH","SyncMethod","ReasonColums","CODE","IS_ENABLED","SYSTEM_DEFINED","EventColumns","SUCCESS_EVENT","VERSION_TABLE","VERSION_COLUMNS","VERSION_NO","WORKFLOW_INSTANCE_TABLE","WORKFLOW_INSTANCE_COLUMNS","WORKFLOW_INSTANCE_ID","MERGED_WORKFLOW_INSTANCE_ID","SCANNABLE_ID","INITIAL_MERGED_WORKFLOW_INSTANCE_ID","STATUS","JOB_WF_ID","DISPLAY_DATA","WORKFLOW_ID"],"sources":["DBConfig.ts"],"sourcesContent":["import { IDispatch } from '@os1-platform/platform-coreos-execution-engine-sdk';\nexport type ExecEngineSyncType = IDispatch.SyncType;\n\nexport enum DispatchSyncType {\n DEFAULT = 'DEFAULT',\n DISPATCH_UPDATE = 'DISPATCH_UPDATE',\n DISPATCH_SUB_STATUS_UPDATE = 'DISPATCH_SUB_STATUS_UPDATE',\n}\n\nexport const DATABASE_NAME = 'DispatchSDK_DB';\nexport const EVENTS_TABLE = 'EVENTS_TABLE';\nexport const REASONS_TABLE = 'REASONS_TABLE';\nexport const EVENT_CODES_TABLE = 'EVENT_CODES_TABLE';\n\nexport const EVENTS_COLUMNS = {\n ID: 'id',\n SEQUENCE: 'seq_number',\n PAYLOAD: 'payload',\n SYNCED: 'synced',\n CONFIG: 'config',\n SYNC_TYPE: 'sync_type',\n META: 'meta',\n SYNC_ERROR: 'sync_error',\n DISPATCH_ID: 'dispatch_id',\n DATA_LENGTH: 'data_length',\n ATTEMPT_COUNT: 'attempt_count',\n};\n\nexport const DOCUMENT_TABLE = 'DOCUMENTS_TABLE';\nexport const DOCUMENT_COLUMNS = {\n ID: 'id',\n DATA: 'data',\n BASE64: 'base64',\n FILE_PATH: 'file_path',\n FILE_NAME: 'file_name',\n FILE_TYPE: 'file_type',\n SYNCED: 'synced',\n FMS_FOLDER_ID: 'fms_folder_id',\n FMS_ID: 'fms_id',\n PRIORITY: 'priority',\n DESCRIPTION: 'desc',\n SYNC_ERROR: 'sync_error',\n DISPATCH_ID: 'dispatch_id',\n JOB_ID: 'job_id',\n OBJECTIVE_REF: 'objective_ref',\n ATTEMPT_COUNT: 'attempt_count',\n GEO_TIMESTAMP: 'geo_timestamp',\n PROCESSED_FILE_PATH: 'processed_file_path',\n};\nexport type DocumentRow = {\n id: number;\n data: string;\n base64: boolean;\n file_path: string;\n file_name: string;\n file_type: string;\n synced: boolean;\n fms_folder_id: string;\n fms_id: string;\n priority: number;\n desc: string;\n sync_error: string;\n dispatch_id: string;\n job_id: string;\n objective_ref: string;\n geo_timestamp: string;\n processed_file_path: string;\n attempt_count: number;\n};\nexport type EventRow = {\n id: number;\n payload: string;\n synced: boolean;\n config: string;\n sync_type: ExecEngineSyncType | DispatchSyncType;\n objective_ref: string;\n sync_error: string;\n dispatch_id: string;\n attempt_count: number;\n};\n\nexport enum SyncMethod {\n POST = 'POST',\n PUT = 'PUT',\n GET = 'GET',\n DELETE = 'DELETE',\n}\nexport const ReasonColums = {\n CODE: 'reasonCode',\n DESCRIPTION: 'description',\n IS_ENABLED: 'isEnabled',\n SYSTEM_DEFINED: 'isSystemDefined',\n};\nexport interface ReasonsRow {\n description: string;\n isEnabled: boolean;\n reasonCode: string;\n isSystemDefined: boolean;\n}\n\nexport interface EventsRow {\n description: string;\n successEvent: boolean;\n eventCode: string;\n}\n\nexport const EventColumns = {\n CODE: 'eventCode',\n DESCRIPTION: 'description',\n SUCCESS_EVENT: 'successEvent',\n};\n\nexport const VERSION_TABLE = 'VERSION_TABLE';\nexport const VERSION_COLUMNS = {\n VERSION_NO: 'versionNo'\n};\n\n// NEW CODE\nexport interface BulkEvent {\n syncType: ExecEngineSyncType | DispatchSyncType;\n dispatchId: string;\n data: any;\n meta?: any; // updatedBy, code, status, timestamp, [{jobId,wfId}]\n}\n\n// OLD CODE\n// export interface BulkEvent {\n// syncType: SyncType;\n// dispatchId: string;\n// data: string;\n// config: string;\n// sequence: number;\n// meta?: any;\n// }\n\nexport interface WFUpdateBulkEventData {\n [customETName: string]: EventETData;\n}\n\nexport interface EventETData {\n output: any;\n}\n\nexport interface WIUpdateOutputPayload {\n dispatchId: string;\n updatedBy: any;\n workflows: Array<WorkflowUpdatePayload>;\n}\n\nexport interface WorkflowUpdatePayload {\n status: string;\n timestamp: number;\n attemptId: 1;\n code: string;\n data: any;\n meta?: any;\n __unmerged?: Array<UnmergedData>;\n}\n\nexport interface UnmergedData {\n workflowInstanceId: string;\n jobId: string;\n data?: any;\n}\n\nexport interface CustodyData {\n dispatchId: string;\n jobId: string;\n custodyEntity: string;\n custodyLocationId: string;\n custodyEntityAmount: number;\n custodyEntityId: string;\n}\n\nexport const WORKFLOW_INSTANCE_TABLE = 'WF_INSTANCE_TABLE';\nexport const WORKFLOW_INSTANCE_COLUMNS = {\n WORKFLOW_INSTANCE_ID: 'WFIId',\n MERGED_WORKFLOW_INSTANCE_ID: 'MWFIId',\n JOB_ID: 'jobId',\n SCANNABLE_ID: 'scannableId',\n INITIAL_MERGED_WORKFLOW_INSTANCE_ID: 'InitialMWFIId',\n STATUS: 'status',\n JOB_WF_ID: 'jobWfId',\n DISPLAY_DATA: 'displayData',\n WORKFLOW_ID: 'WFId',\n};\n\nexport interface SyncManagerPayload {\n data: {\n action: ExecEngineSyncType | DispatchSyncType;\n payload: any;\n };\n length: number;\n}\n"],"mappings":"AAGA,WAAYA,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAM5B,OAAO,MAAMC,aAAa,GAAG,gBAAgB;AAC7C,OAAO,MAAMC,YAAY,GAAG,cAAc;AAC1C,OAAO,MAAMC,aAAa,GAAG,eAAe;AAC5C,OAAO,MAAMC,iBAAiB,GAAG,mBAAmB;AAEpD,OAAO,MAAMC,cAAc,GAAG;EAC5BC,EAAE,EAAE,IAAI;EACRC,QAAQ,EAAE,YAAY;EACtBC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE,QAAQ;EAChBC,SAAS,EAAE,WAAW;EACtBC,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,YAAY;EACxBC,WAAW,EAAE,aAAa;EAC1BC,WAAW,EAAE,aAAa;EAC1BC,aAAa,EAAE;AACjB,CAAC;AAED,OAAO,MAAMC,cAAc,GAAG,iBAAiB;AAC/C,OAAO,MAAMC,gBAAgB,GAAG;EAC9BZ,EAAE,EAAE,IAAI;EACRa,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,QAAQ;EAChBC,SAAS,EAAE,WAAW;EACtBC,SAAS,EAAE,WAAW;EACtBC,SAAS,EAAE,WAAW;EACtBd,MAAM,EAAE,QAAQ;EAChBe,aAAa,EAAE,eAAe;EAC9BC,MAAM,EAAE,QAAQ;EAChBC,QAAQ,EAAE,UAAU;EACpBC,WAAW,EAAE,MAAM;EACnBd,UAAU,EAAE,YAAY;EACxBC,WAAW,EAAE,aAAa;EAC1Bc,MAAM,EAAE,QAAQ;EAChBC,aAAa,EAAE,eAAe;EAC9Bb,aAAa,EAAE,eAAe;EAC9Bc,aAAa,EAAE,eAAe;EAC9BC,mBAAmB,EAAE;AACvB,CAAC;AAiCD,WAAYC,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAMtB,OAAO,MAAMC,YAAY,GAAG;EAC1BC,IAAI,EAAE,YAAY;EAClBP,WAAW,EAAE,aAAa;EAC1BQ,UAAU,EAAE,WAAW;EACvBC,cAAc,EAAE;AAClB,CAAC;AAcD,OAAO,MAAMC,YAAY,GAAG;EAC1BH,IAAI,EAAE,WAAW;EACjBP,WAAW,EAAE,aAAa;EAC1BW,aAAa,EAAE;AACjB,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG,eAAe;AAC5C,OAAO,MAAMC,eAAe,GAAG;EAC7BC,UAAU,EAAE;AACd,CAAC;;AAED;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyCA,OAAO,MAAMC,uBAAuB,GAAG,mBAAmB;AAC1D,OAAO,MAAMC,yBAAyB,GAAG;EACvCC,oBAAoB,EAAE,OAAO;EAC7BC,2BAA2B,EAAE,QAAQ;EACrCjB,MAAM,EAAE,OAAO;EACfkB,YAAY,EAAE,aAAa;EAC3BC,mCAAmC,EAAE,eAAe;EACpDC,MAAM,EAAE,QAAQ;EAChBC,SAAS,EAAE,SAAS;EACpBC,YAAY,EAAE,aAAa;EAC3BC,WAAW,EAAE;AACf,CAAC","ignoreList":[]}
@@ -1,54 +1,128 @@
1
- import * as SQLite from 'expo-sqlite';
1
+ var _SQLDatabase;
2
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
4
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
2
5
  import * as DBConfig from './DBConfig';
3
6
  import { isEmptyOrBlank } from '../../utils/utils';
4
7
  import { BaseError } from '../../errors/BaseError';
5
8
  import BaseErrorCodes from '../../errors/ErrorCodes';
6
9
  import Logger, { LOG_TYPE } from '../../utils/Logger';
7
- let dbConnection;
8
- function openDatabase() {
9
- return SQLite.openDatabase(DBConfig.DATABASE_NAME);
10
- }
11
- export function executeQuery(query, args) {
12
- return new Promise((resolve, reject) => {
13
- if (isEmptyOrBlank(query)) {
14
- reject(new BaseError(BaseErrorCodes.InvalidArgumentError, 'SQL Query is null or empty'));
15
- return;
10
+ import { openDatabaseSync } from 'expo-sqlite';
11
+
12
+ // Legacy type for backward compatibility
13
+
14
+ class SQLDatabase {
15
+ constructor() {
16
+ _defineProperty(this, "db", void 0);
17
+ this.db = openDatabaseSync(DBConfig.DATABASE_NAME);
18
+ }
19
+ static getInstance() {
20
+ if (!SQLDatabase.instance) {
21
+ SQLDatabase.instance = new SQLDatabase();
16
22
  }
17
- if (!dbConnection) dbConnection = openDatabase();
18
- dbConnection.transaction(tx => {
19
- tx.executeSql(query, args, (_, sqlResultSet) => {
23
+ return SQLDatabase.instance;
24
+ }
25
+ executeSetDataQuery(query, args) {
26
+ return new Promise((resolve, reject) => {
27
+ if (isEmptyOrBlank(query)) {
28
+ reject(new BaseError(BaseErrorCodes.InvalidArgumentError, 'SQL Query is null or empty'));
29
+ return;
30
+ }
31
+ try {
32
+ const result = this.db.runSync(query, args);
33
+ const sqlResultSet = {
34
+ insertId: result.lastInsertRowId,
35
+ rowsAffected: result.changes,
36
+ rows: {
37
+ _array: [],
38
+ length: 0,
39
+ item: index => null
40
+ }
41
+ };
20
42
  resolve(sqlResultSet);
21
- }, (_, sqlError) => {
22
- reject(sqlError);
23
- return false;
24
- });
43
+ } catch (error) {
44
+ reject(error);
45
+ }
25
46
  });
26
- });
27
- }
28
- export function executeBulkQuery(_queryData) {
29
- return new Promise((resolve, reject) => {
30
- let _sqlResultSet = [];
31
- if (!dbConnection) dbConnection = openDatabase();
32
- dbConnection.transaction(tx => {
33
- _queryData.forEach(_q => {
34
- tx.executeSql(_q.query, _q.args, (_, sqlResultSet) => {
35
- _sqlResultSet.push(sqlResultSet);
36
- // resolve(sqlResultSet);
37
- }
38
- /* (_, sqlError) => {
39
- _sqlError.push(sqlError);
40
- // reject(sqlError);
41
- return false;
42
- } */);
43
- });
44
- }, error => {
45
- Logger.getInstance().logEvent('executeBulkQuery err: ', JSON.stringify(error), LOG_TYPE.SDK_ERROR);
46
- reject(error);
47
- // return false;
48
- }, () => {
49
- Logger.getInstance().logEvent('executeBulkQuery success: ', JSON.stringify(_sqlResultSet), LOG_TYPE.SDK_DEBUG);
50
- resolve(true);
47
+ }
48
+ executeGetDataQuery(query, args) {
49
+ return new Promise((resolve, reject) => {
50
+ if (isEmptyOrBlank(query)) {
51
+ reject(new BaseError(BaseErrorCodes.InvalidArgumentError, 'SQL Query is null or empty'));
52
+ return;
53
+ }
54
+ try {
55
+ const result = this.db.getAllSync(query, args);
56
+ const sqlResultSet = {
57
+ insertId: undefined,
58
+ rowsAffected: 0,
59
+ rows: {
60
+ _array: result,
61
+ length: result.length,
62
+ item: index => result[index] || null
63
+ }
64
+ };
65
+ resolve(sqlResultSet);
66
+ } catch (error) {
67
+ reject(error);
68
+ }
69
+ });
70
+ }
71
+ executeBulkQuery(_queryData) {
72
+ return new Promise(async (resolve, reject) => {
73
+ try {
74
+ await this.db.withExclusiveTransactionAsync(async () => {
75
+ for (const _q of _queryData) {
76
+ this.db.runSync(_q.query, _q.args);
77
+ }
78
+ });
79
+ Logger.getInstance().logEvent('executeBulkQuery success: ', JSON.stringify(_queryData.length + ' queries executed'), LOG_TYPE.SDK_DEBUG);
80
+ resolve(true);
81
+ } catch (error) {
82
+ Logger.getInstance().logEvent('executeBulkQuery err: ', JSON.stringify(error), LOG_TYPE.SDK_ERROR);
83
+ reject(error);
84
+ }
85
+ });
86
+ }
87
+
88
+ /**
89
+ * Executes an array of SQL DML statements.
90
+ *
91
+ * @param {Array<{query: string, args: any[]}>} input - The array of queries to execute.
92
+ * @return {Promise<SQLResultSet>} A promise that resolves with the SQL result set.
93
+ */
94
+ executeStatementsInTxn(input) {
95
+ return new Promise(async (resolve, reject) => {
96
+ if (input.some(_i => isEmptyOrBlank(_i.sqlSmt))) {
97
+ reject(new Error('Statement is null or empty'));
98
+ return;
99
+ }
100
+ try {
101
+ const resultSet = [];
102
+ await this.db.withExclusiveTransactionAsync(async () => {
103
+ for (const item of input) {
104
+ const result = await this.db.runAsync(item.sqlSmt, item.args);
105
+ const sqlResultSet = {
106
+ insertId: result.lastInsertRowId,
107
+ rowsAffected: result.changes,
108
+ rows: {
109
+ _array: [],
110
+ length: 0,
111
+ item: index => null
112
+ }
113
+ };
114
+ resultSet.push(sqlResultSet);
115
+ }
116
+ });
117
+ resolve(resultSet);
118
+ } catch (error) {
119
+ reject(error);
120
+ }
51
121
  });
52
- });
122
+ }
53
123
  }
124
+ _SQLDatabase = SQLDatabase;
125
+ _defineProperty(SQLDatabase, "instance", void 0);
126
+ const Database = SQLDatabase.getInstance();
127
+ export default Database;
54
128
  //# sourceMappingURL=database.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SQLite","DBConfig","isEmptyOrBlank","BaseError","BaseErrorCodes","Logger","LOG_TYPE","dbConnection","openDatabase","DATABASE_NAME","executeQuery","query","args","Promise","resolve","reject","InvalidArgumentError","transaction","tx","executeSql","_","sqlResultSet","sqlError","executeBulkQuery","_queryData","_sqlResultSet","forEach","_q","push","error","getInstance","logEvent","JSON","stringify","SDK_ERROR","SDK_DEBUG"],"sources":["database.ts"],"sourcesContent":["import * as SQLite from 'expo-sqlite';\nimport * as DBConfig from './DBConfig';\nimport type { SQLResultSet, WebSQLDatabase } from 'expo-sqlite';\nimport { isEmptyOrBlank } from '../../utils/utils';\nimport { BaseError } from '../../errors/BaseError';\nimport BaseErrorCodes from '../../errors/ErrorCodes';\nimport Logger, { LOG_TYPE } from '../../utils/Logger';\n\nlet dbConnection: WebSQLDatabase | null;\n\nfunction openDatabase(): WebSQLDatabase {\n return SQLite.openDatabase(DBConfig.DATABASE_NAME);\n}\n\nexport interface ExecQuery {\n query: string;\n args: any[];\n}\n\nexport function executeQuery(\n query: string,\n args: any[]\n): Promise<SQLResultSet> {\n return new Promise((resolve, reject) => {\n if (isEmptyOrBlank(query)) {\n reject(\n new BaseError(\n BaseErrorCodes.InvalidArgumentError,\n 'SQL Query is null or empty'\n )\n );\n return;\n }\n if (!dbConnection) dbConnection = openDatabase();\n dbConnection.transaction((tx) => {\n tx.executeSql(\n query,\n args,\n (_, sqlResultSet) => {\n resolve(sqlResultSet);\n },\n (_, sqlError) => {\n reject(sqlError);\n return false;\n }\n );\n });\n });\n}\n\nexport function executeBulkQuery(_queryData: ExecQuery[]): Promise<boolean> {\n return new Promise((resolve, reject) => {\n let _sqlResultSet: SQLResultSet[] = [];\n\n if (!dbConnection) dbConnection = openDatabase();\n dbConnection.transaction(\n (tx) => {\n _queryData.forEach((_q) => {\n tx.executeSql(\n _q.query,\n _q.args,\n (_, sqlResultSet) => {\n _sqlResultSet.push(sqlResultSet);\n // resolve(sqlResultSet);\n }\n /* (_, sqlError) => {\n _sqlError.push(sqlError);\n // reject(sqlError);\n return false;\n } */\n );\n });\n },\n (error) => {\n Logger.getInstance().logEvent(\n 'executeBulkQuery err: ',\n JSON.stringify(error),\n LOG_TYPE.SDK_ERROR\n );\n reject(error);\n // return false;\n },\n () => {\n Logger.getInstance().logEvent(\n 'executeBulkQuery success: ',\n JSON.stringify(_sqlResultSet),\n LOG_TYPE.SDK_DEBUG\n );\n resolve(true);\n }\n );\n });\n}\n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,CACrBC,EAAE,IAAK;MACNM,UAAU,CAACE,OAAO,CAAEC,EAAE,IAAK;QACzBT,EAAE,CAACC,UAAU,CACXQ,EAAE,CAAChB,KAAK,EACRgB,EAAE,CAACf,IAAI,EACP,CAACQ,CAAC,EAAEC,YAAY,KAAK;UACnBI,aAAa,CAACG,IAAI,CAACP,YAAY,CAAC;UAChC;QACF;QACA;AACZ;AACA;AACA;AACA,YACU,CAAC;MACH,CAAC,CAAC;IACJ,CAAC,EACAQ,KAAK,IAAK;MACTxB,MAAM,CAACyB,WAAW,CAAC,CAAC,CAACC,QAAQ,CAC3B,wBAAwB,EACxBC,IAAI,CAACC,SAAS,CAACJ,KAAK,CAAC,EACrBvB,QAAQ,CAAC4B,SACX,CAAC;MACDnB,MAAM,CAACc,KAAK,CAAC;MACb;IACF,CAAC,EACD,MAAM;MACJxB,MAAM,CAACyB,WAAW,CAAC,CAAC,CAACC,QAAQ,CAC3B,4BAA4B,EAC5BC,IAAI,CAACC,SAAS,CAACR,aAAa,CAAC,EAC7BnB,QAAQ,CAAC6B,SACX,CAAC;MACDrB,OAAO,CAAC,IAAI,CAAC;IACf,CACF,CAAC;EACH,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["DBConfig","isEmptyOrBlank","BaseError","BaseErrorCodes","Logger","LOG_TYPE","openDatabaseSync","SQLDatabase","constructor","_defineProperty","db","DATABASE_NAME","getInstance","instance","executeSetDataQuery","query","args","Promise","resolve","reject","InvalidArgumentError","result","runSync","sqlResultSet","insertId","lastInsertRowId","rowsAffected","changes","rows","_array","length","item","index","error","executeGetDataQuery","getAllSync","undefined","executeBulkQuery","_queryData","withExclusiveTransactionAsync","_q","logEvent","JSON","stringify","SDK_DEBUG","SDK_ERROR","executeStatementsInTxn","input","some","_i","sqlSmt","Error","resultSet","runAsync","push","_SQLDatabase","Database"],"sources":["database.ts"],"sourcesContent":["import * as DBConfig from './DBConfig';\nimport { isEmptyOrBlank } from '../../utils/utils';\nimport { BaseError } from '../../errors/BaseError';\nimport BaseErrorCodes from '../../errors/ErrorCodes';\nimport Logger, { LOG_TYPE } from '../../utils/Logger';\nimport type { ExecQuery } from '../../utils/Constants';\nimport { openDatabaseSync, SQLiteDatabase } from 'expo-sqlite';\n\n// Legacy type for backward compatibility\nexport interface SQLResultSet {\n insertId?: number;\n rowsAffected: number;\n rows: {\n _array: any[];\n length: number;\n item: (index: number) => any;\n };\n}\n\n\nclass SQLDatabase {\n private static instance: SQLDatabase;\n private db: SQLiteDatabase;\n\n private constructor() {\n this.db = openDatabaseSync(DBConfig.DATABASE_NAME);\n }\n\n public static getInstance(): SQLDatabase {\n if (!SQLDatabase.instance) {\n SQLDatabase.instance = new SQLDatabase();\n }\n return SQLDatabase.instance;\n }\n\n executeSetDataQuery(query: string, args: any[]): Promise<SQLResultSet> {\n return new Promise((resolve, reject) => {\n if (isEmptyOrBlank(query)) {\n reject(new BaseError( BaseErrorCodes.InvalidArgumentError, 'SQL Query is null or empty'));\n return;\n }\n try {\n const result = this.db.runSync(query, args);\n const sqlResultSet: SQLResultSet = {\n insertId: result.lastInsertRowId,\n rowsAffected: result.changes,\n rows: {\n _array: [],\n length: 0,\n item: (index: number) => null\n }\n };\n resolve(sqlResultSet);\n } catch (error) {\n reject(error);\n }\n });\n }\n\n executeGetDataQuery(query: string, args: any[]): Promise<any> {\n return new Promise((resolve, reject) => {\n if (isEmptyOrBlank(query)) {\n reject(new BaseError( BaseErrorCodes.InvalidArgumentError, 'SQL Query is null or empty'));\n return;\n }\n \n try {\n const result = this.db.getAllSync(query, args);\n const sqlResultSet: SQLResultSet = {\n insertId: undefined,\n rowsAffected: 0,\n rows: {\n _array: result,\n length: result.length,\n item: (index: number) => result[index] || null\n }\n };\n resolve(sqlResultSet);\n } catch (error) {\n reject(error);\n }\n });\n }\n\n executeBulkQuery(_queryData: ExecQuery[]): Promise<boolean> {\n return new Promise(async (resolve, reject) => {\n try {\n await this.db.withExclusiveTransactionAsync(async () => {\n for (const _q of _queryData) {\n this.db.runSync(_q.query, _q.args);\n }\n });\n \n Logger.getInstance().logEvent(\n 'executeBulkQuery success: ',\n JSON.stringify(_queryData.length + ' queries executed'),\n LOG_TYPE.SDK_DEBUG\n );\n resolve(true);\n } catch (error) {\n Logger.getInstance().logEvent(\n 'executeBulkQuery err: ',\n JSON.stringify(error),\n LOG_TYPE.SDK_ERROR\n );\n reject(error);\n }\n });\n }\n\n /**\n * Executes an array of SQL DML statements.\n *\n * @param {Array<{query: string, args: any[]}>} input - The array of queries to execute.\n * @return {Promise<SQLResultSet>} A promise that resolves with the SQL result set.\n */\n executeStatementsInTxn(input: { sqlSmt: string; args: any[] }[]): Promise<SQLResultSet[]> {\n return new Promise(async (resolve, reject) => {\n if (input.some((_i) => isEmptyOrBlank(_i.sqlSmt))) {\n reject(new Error('Statement is null or empty'));\n return;\n }\n\n try {\n const resultSet: SQLResultSet[] = [];\n \n await this.db.withExclusiveTransactionAsync(async () => {\n for (const item of input) {\n const result = await this.db.runAsync(item.sqlSmt, item.args);\n const sqlResultSet: SQLResultSet = {\n insertId: result.lastInsertRowId,\n rowsAffected: result.changes,\n rows: {\n _array: [],\n length: 0,\n item: (index: number) => null\n }\n };\n resultSet.push(sqlResultSet);\n }\n });\n\n resolve(resultSet);\n } catch (error) {\n reject(error);\n }\n });\n }\n}\n\nconst Database = SQLDatabase.getInstance();\nexport default Database;\n"],"mappings":";;;;AAAA,OAAO,KAAKA,QAAQ,MAAM,YAAY;AACtC,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,wBAAwB;AAClD,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,MAAM,IAAIC,QAAQ,QAAQ,oBAAoB;AAErD,SAASC,gBAAgB,QAAwB,aAAa;;AAE9D;;AAYA,MAAMC,WAAW,CAAC;EAIRC,WAAWA,CAAA,EAAG;IAAAC,eAAA;IACpB,IAAI,CAACC,EAAE,GAAGJ,gBAAgB,CAACN,QAAQ,CAACW,aAAa,CA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C,EAA2B;IACxF,OAAO,IAAI9B,OAAO,CAAC,OAAOC,OAAO,EAAEC,MAAM,KAAK;MAC5C,IAAI4B,KAAK,CAACC,IAAI,CAAEC,EAAE,IAAKhD,cAAc,CAACgD,EAAE,CAACC,MAAM,CAAC,CAAC,EAAE;QACjD/B,MAAM,CAAC,IAAIgC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC/C;MACF;MAEA,IAAI;QACF,MAAMC,SAAyB,GAAG,EAAE;QAEpC,MAAM,IAAI,CAAC1C,EAAE,CAAC6B,6BAA6B,CAAC,YAAY;UACtD,KAAK,MAAMR,IAAI,IAAIgB,KAAK,EAAE;YACxB,MAAM1B,MAAM,GAAG,MAAM,IAAI,CAACX,EAAE,CAAC2C,QAAQ,CAACtB,IAAI,CAACmB,MAAM,EAAEnB,IAAI,CAACf,IAAI,CAAC;YAC7D,MAAMO,YAA0B,GAAG;cACjCC,QAAQ,EAAEH,MAAM,CAACI,eAAe;cAChCC,YAAY,EAAEL,MAAM,CAACM,OAAO;cAC5BC,IAAI,EAAE;gBACJC,MAAM,EAAE,EAAE;gBACVC,MAAM,EAAE,CAAC;gBACTC,IAAI,EAAGC,KAAa,IAAK;cAC3B;YACF,CAAC;YACDoB,SAAS,CAACE,IAAI,CAAC/B,YAAY,CAAC;UAC9B;QACF,CAAC,CAAC;QAEFL,OAAO,CAACkC,SAAS,CAAC;MACpB,CAAC,CAAC,OAAOnB,KAAK,EAAE;QACdd,MAAM,CAACc,KAAK,CAAC;MACf;IACF,CAAC,CAAC;EACJ;AACF;AAACsB,YAAA,GAhIKhD,WAAW;AAAAE,eAAA,CAAXF,WAAW;AAkIjB,MAAMiD,QAAQ,GAAGjD,WAAW,CAACK,WAAW,CAAC,CAAC;AAC1C,eAAe4C,QAAQ","ignoreList":[]}
@@ -4,7 +4,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
4
4
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
5
  import { DOCUMENT_COLUMNS, DOCUMENT_TABLE } from '../DBConfig';
6
6
  import { MAX_RETRY_COUNT, PROCESS_MAX_RETRIED_ROWS } from '../constants';
7
- import * as Database from '../database';
7
+ import Database from '../database';
8
8
  export default class DocumentManager {
9
9
  constructor() {}
10
10
  static async getInstance() {
@@ -16,7 +16,7 @@ export default class DocumentManager {
16
16
  return DocumentManager.instance;
17
17
  }
18
18
  async init() {
19
- await Database.executeQuery(`CREATE TABLE IF NOT EXISTS ${DOCUMENT_TABLE} (\
19
+ await Database.executeSetDataQuery(`CREATE TABLE IF NOT EXISTS ${DOCUMENT_TABLE} (\
20
20
  ${DOCUMENT_COLUMNS.ID} INTEGER PRIMARY KEY AUTOINCREMENT,\
21
21
  ${DOCUMENT_COLUMNS.DATA} TEXT,\
22
22
  ${DOCUMENT_COLUMNS.BASE64} INTEGER NOT NULL DEFAULT 0,\
@@ -35,10 +35,10 @@ export default class DocumentManager {
35
35
  ${DOCUMENT_COLUMNS.DESCRIPTION} TEXT);`, []);
36
36
  }
37
37
  async truncateDocumentTable() {
38
- await Database.executeQuery(`DELETE FROM ${DOCUMENT_TABLE};`, []);
38
+ await Database.executeSetDataQuery(`DELETE FROM ${DOCUMENT_TABLE};`, []);
39
39
  }
40
40
  async insertDocument(fmsFolderID, desc, dspID, base64, fileName, fileType, data, filePath, geoTimeStamp, processedFilePath, priority) {
41
- return await Database.executeQuery(`INSERT INTO ${DOCUMENT_TABLE}(\
41
+ return await Database.executeSetDataQuery(`INSERT INTO ${DOCUMENT_TABLE}(\
42
42
  ${DOCUMENT_COLUMNS.DATA},\
43
43
  ${DOCUMENT_COLUMNS.DISPATCH_ID},\
44
44
  ${DOCUMENT_COLUMNS.FMS_FOLDER_ID},\
@@ -54,54 +54,50 @@ export default class DocumentManager {
54
54
  }
55
55
  async getAllDocuments(dispatchID) {
56
56
  if (!dispatchID) {
57
- const resultSet = await Database.executeQuery(`SELECT * FROM ${DOCUMENT_TABLE};`, []);
57
+ const resultSet = await Database.executeGetDataQuery(`SELECT * FROM ${DOCUMENT_TABLE};`, []);
58
58
  return resultSet.rows._array;
59
59
  } else {
60
- const resultSet = await Database.executeQuery(`SELECT * FROM ${DOCUMENT_TABLE}\
60
+ const resultSet = await Database.executeGetDataQuery(`SELECT * FROM ${DOCUMENT_TABLE}\
61
61
  WHERE ${DOCUMENT_COLUMNS.DISPATCH_ID} =?;`, [dispatchID]);
62
62
  return resultSet.rows._array;
63
63
  }
64
64
  }
65
65
  async getAllUnsyncedDocs() {
66
66
  if (PROCESS_MAX_RETRIED_ROWS) {
67
- let resultSet = await Database.executeQuery(`SELECT * from ${DOCUMENT_TABLE}\
68
- WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0;`, []);
67
+ let resultSet = await Database.executeGetDataQuery(`SELECT * from ${DOCUMENT_TABLE} WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0;`, []);
69
68
  return resultSet.rows._array;
70
69
  } else {
71
- let resultSet = await Database.executeQuery(`SELECT * from ${DOCUMENT_TABLE}\
70
+ let resultSet = await Database.executeGetDataQuery(`SELECT * from ${DOCUMENT_TABLE}\
72
71
  WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0 AND ${DOCUMENT_COLUMNS.ATTEMPT_COUNT} < ${MAX_RETRY_COUNT};`, []);
73
72
  return resultSet.rows._array;
74
73
  }
75
74
  }
76
75
  deleteAllSyncedDocuments(dispatchID) {
77
- return Database.executeQuery(`DELETE FROM ${DOCUMENT_TABLE}\
76
+ return Database.executeSetDataQuery(`DELETE FROM ${DOCUMENT_TABLE}\
78
77
  WHERE ${DOCUMENT_COLUMNS.SYNCED} = 1 and ${DOCUMENT_COLUMNS.DISPATCH_ID} = ?;`, [dispatchID]);
79
78
  }
80
79
  async markDocumentSynced(id, fmsID) {
81
80
  if (!id || !fmsID) return;
82
- await Database.executeQuery(`UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.SYNCED} = 1,${DOCUMENT_COLUMNS.FMS_ID} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [fmsID, id]);
81
+ await Database.executeSetDataQuery(`UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.SYNCED} = 1,${DOCUMENT_COLUMNS.FMS_ID} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [fmsID, id]);
83
82
  }
84
83
 
85
84
  // This function will actualy update the document row with sync and attempt count.
86
85
  async markDocumentSyncedWithAttempt(id, fmsID, attempt, sync) {
87
86
  if (!id) return;
88
- await Database.executeQuery(`UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.SYNCED} = ?,${DOCUMENT_COLUMNS.FMS_ID} = ?,${DOCUMENT_COLUMNS.ATTEMPT_COUNT} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [sync, fmsID, attempt, id]);
87
+ await Database.executeSetDataQuery(`UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.SYNCED} = ?,${DOCUMENT_COLUMNS.FMS_ID} = ?,${DOCUMENT_COLUMNS.ATTEMPT_COUNT} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [sync, fmsID, attempt, id]);
89
88
  }
90
89
  // This function is updating processed_file_path column for the base64 overlayed data and overlayed image file for POD. Also if it is base 64 then it is also storing temprary file path in file_path as original bae64 image.
91
90
  async updateProcesedFilePath(id, origialFilePath, processedFilePath) {
92
91
  if (!id || !processedFilePath) return;
93
- await Database.executeQuery(`UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.FILE_PATH} = ?, ${DOCUMENT_COLUMNS.PROCESSED_FILE_PATH} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [origialFilePath, processedFilePath, id]);
92
+ await Database.executeSetDataQuery(`UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.FILE_PATH} = ?, ${DOCUMENT_COLUMNS.PROCESSED_FILE_PATH} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [origialFilePath, processedFilePath, id]);
94
93
  }
95
94
  async updateDocSyncError(id, uploadError) {
96
95
  if (!id) throw new TypeError('Document ID cannot be null');
97
- await Database.executeQuery(`UPDATE ${DOCUMENT_TABLE}\
98
- SET \
99
- ${DOCUMENT_COLUMNS.SYNC_ERROR} = ?\
100
- WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [uploadError, id]);
96
+ await Database.executeSetDataQuery(`UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.SYNC_ERROR} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [uploadError, id]);
101
97
  }
102
98
  async updateDocPriority(id, priority) {
103
99
  if (!id) throw new TypeError('Document ID cannot be null');
104
- await Database.executeQuery(`UPDATE ${DOCUMENT_TABLE}\
100
+ await Database.executeSetDataQuery(`UPDATE ${DOCUMENT_TABLE}\
105
101
  SET \
106
102
  ${DOCUMENT_COLUMNS.PRIORITY} = ?\
107
103
  WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [priority, id]);
@@ -109,12 +105,12 @@ export default class DocumentManager {
109
105
  async getUnsyncedDocument() {
110
106
  // If it is allowed max_retried_rows are allowed to process then it will refetch those data which are even have tried max attempt otherwise it will skip those events.
111
107
  if (PROCESS_MAX_RETRIED_ROWS) {
112
- let rs = await Database.executeQuery(`SELECT * from ${DOCUMENT_TABLE}\
108
+ let rs = await Database.executeGetDataQuery(`SELECT * from ${DOCUMENT_TABLE}\
113
109
  WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0 \
114
110
  ORDER BY ${DOCUMENT_COLUMNS.PRIORITY} ASC LIMIT 1;`, []);
115
111
  return rs.rows._array;
116
112
  } else {
117
- let rs = await Database.executeQuery(`SELECT * from ${DOCUMENT_TABLE}\
113
+ let rs = await Database.executeGetDataQuery(`SELECT * from ${DOCUMENT_TABLE}\
118
114
  WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0 AND ${DOCUMENT_COLUMNS.ATTEMPT_COUNT} < ${MAX_RETRY_COUNT} \
119
115
  ORDER BY ${DOCUMENT_COLUMNS.PRIORITY} ASC LIMIT 1;`, []);
120
116
  return rs.rows._array;