@os1-platform/dispatch-mobile 2.1.2 → 2.1.3

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 (619) hide show
  1. package/dispatch-mobile.podspec +35 -0
  2. package/ios/DispatchSdk-Bridging-Header.h +3 -0
  3. package/ios/DispatchSdk.m +9 -0
  4. package/ios/DispatchSdk.swift +8 -0
  5. package/ios/DispatchSdk.xcodeproj/project.pbxproj +317 -0
  6. package/ios/EventEmitter.swift +21 -0
  7. package/ios/EventsConstant.swift +13 -0
  8. package/ios/RNEventEmitter.m +15 -0
  9. package/ios/RNEventEmitter.swift +24 -0
  10. package/lib/commonjs/components/dispatch/DispatchExecNavigator.js +3 -4
  11. package/lib/commonjs/components/dispatch/DispatchExecNavigator.js.map +1 -1
  12. package/lib/commonjs/components/executiontasks/cancellation/CancelET.js +13 -8
  13. package/lib/commonjs/components/executiontasks/cancellation/CancelET.js.map +1 -1
  14. package/lib/commonjs/components/executiontasks/captureInput/CaptureText.js +3 -4
  15. package/lib/commonjs/components/executiontasks/captureInput/CaptureText.js.map +1 -1
  16. package/lib/commonjs/components/executiontasks/deliver/DeliverET.js +3 -4
  17. package/lib/commonjs/components/executiontasks/deliver/DeliverET.js.map +1 -1
  18. package/lib/commonjs/components/executiontasks/deliver/DeliverETInput.js.map +1 -1
  19. package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js +112 -27
  20. package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
  21. package/lib/commonjs/components/executiontasks/display/DisplayModalET.js +7 -8
  22. package/lib/commonjs/components/executiontasks/display/DisplayModalET.js.map +1 -1
  23. package/lib/commonjs/components/executiontasks/doodle/SignatureET.js +113 -48
  24. package/lib/commonjs/components/executiontasks/doodle/SignatureET.js.map +1 -1
  25. package/lib/commonjs/components/executiontasks/doodle/SignatureSchema.js.map +1 -1
  26. package/lib/commonjs/components/executiontasks/dropCash/DropCashET.js +3 -4
  27. package/lib/commonjs/components/executiontasks/dropCash/DropCashET.js.map +1 -1
  28. package/lib/commonjs/components/executiontasks/dropCash/DropCashSchema.js.map +1 -1
  29. package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js +7 -8
  30. package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
  31. package/lib/commonjs/components/executiontasks/forms/FormGenerator.js +6 -7
  32. package/lib/commonjs/components/executiontasks/forms/FormGenerator.js.map +1 -1
  33. package/lib/commonjs/components/executiontasks/forms/FormSchema.js.map +1 -1
  34. package/lib/commonjs/components/executiontasks/forms/widgets/DateTimeWidget.js +4 -5
  35. package/lib/commonjs/components/executiontasks/forms/widgets/DateTimeWidget.js.map +1 -1
  36. package/lib/commonjs/components/executiontasks/forms/widgets/DropdownWidget.js +3 -4
  37. package/lib/commonjs/components/executiontasks/forms/widgets/DropdownWidget.js.map +1 -1
  38. package/lib/commonjs/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.js +3 -4
  39. package/lib/commonjs/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.js.map +1 -1
  40. package/lib/commonjs/components/executiontasks/forms/widgets/TimeRangeSelector.js +3 -4
  41. package/lib/commonjs/components/executiontasks/forms/widgets/TimeRangeSelector.js.map +1 -1
  42. package/lib/commonjs/components/executiontasks/httpRequest/HttpRequestET.js +3 -4
  43. package/lib/commonjs/components/executiontasks/httpRequest/HttpRequestET.js.map +1 -1
  44. package/lib/commonjs/components/executiontasks/imageCapture/CaptureSchema.js.map +1 -1
  45. package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js +138 -25
  46. package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
  47. package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js +228 -132
  48. package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
  49. package/lib/commonjs/components/executiontasks/imageCapture/camera.svg +3 -0
  50. package/lib/commonjs/components/executiontasks/imageCapture/circle-xmark.svg +5 -0
  51. package/lib/commonjs/components/executiontasks/payments/PaymentStyles.js +6 -7
  52. package/lib/commonjs/components/executiontasks/payments/PaymentStyles.js.map +1 -1
  53. package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js +6 -7
  54. package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
  55. package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentSchema.js.map +1 -1
  56. package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js +4 -5
  57. package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js.map +1 -1
  58. package/lib/commonjs/components/executiontasks/payments/init/InitPaymentSchema.js.map +1 -1
  59. package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js +4 -5
  60. package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js.map +1 -1
  61. package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentSchema.js.map +1 -1
  62. package/lib/commonjs/components/executiontasks/pickup/PickpSchema.js.map +1 -1
  63. package/lib/commonjs/components/executiontasks/pickup/PickupET.js +3 -4
  64. package/lib/commonjs/components/executiontasks/pickup/PickupET.js.map +1 -1
  65. package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js +89 -17
  66. package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js.map +1 -1
  67. package/lib/commonjs/components/executiontasks/scan/ScanET.js +14 -15
  68. package/lib/commonjs/components/executiontasks/scan/ScanET.js.map +1 -1
  69. package/lib/commonjs/components/executiontasks/scan/ScanSchema.js +1 -2
  70. package/lib/commonjs/components/executiontasks/scan/ScanSchema.js.map +1 -1
  71. package/lib/commonjs/components/executiontasks/scan/constants.js +6 -12
  72. package/lib/commonjs/components/executiontasks/scan/constants.js.map +1 -1
  73. package/lib/commonjs/components/executiontasks/scan/interfaces.js +4 -8
  74. package/lib/commonjs/components/executiontasks/scan/interfaces.js.map +1 -1
  75. package/lib/commonjs/components/executiontasks/scan/sub_components/CScanner.js +4 -5
  76. package/lib/commonjs/components/executiontasks/scan/sub_components/CScanner.js.map +1 -1
  77. package/lib/commonjs/components/executiontasks/scan/sub_components/ERDropDown.js +5 -6
  78. package/lib/commonjs/components/executiontasks/scan/sub_components/ERDropDown.js.map +1 -1
  79. package/lib/commonjs/components/executiontasks/scan/sub_components/SummaryPage.js +8 -9
  80. package/lib/commonjs/components/executiontasks/scan/sub_components/SummaryPage.js.map +1 -1
  81. package/lib/commonjs/components/executiontasks/scan/utils.js +2 -2
  82. package/lib/commonjs/components/executiontasks/scan/utils.js.map +1 -1
  83. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js +8 -9
  84. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
  85. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js +1 -2
  86. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -1
  87. package/lib/commonjs/components/executiontasks/validateOTP/constants.js +6 -12
  88. package/lib/commonjs/components/executiontasks/validateOTP/constants.js.map +1 -1
  89. package/lib/commonjs/components/executiontasks/validateOTP/sub-components/OTPInput.js +5 -6
  90. package/lib/commonjs/components/executiontasks/validateOTP/sub-components/OTPInput.js.map +1 -1
  91. package/lib/commonjs/components/executiontasks/validateOTP/utils.js +2 -2
  92. package/lib/commonjs/components/executiontasks/validateOTP/utils.js.map +1 -1
  93. package/lib/commonjs/components/executiontasks/verifyLocation/GeofenceUtils.js +2 -2
  94. package/lib/commonjs/components/executiontasks/verifyLocation/GeofenceUtils.js.map +1 -1
  95. package/lib/commonjs/components/executiontasks/verifyLocation/VerifyLocationET.js +3 -4
  96. package/lib/commonjs/components/executiontasks/verifyLocation/VerifyLocationET.js.map +1 -1
  97. package/lib/commonjs/components/executiontasks/verifyOtp/VerifyOtpET.js +3 -4
  98. package/lib/commonjs/components/executiontasks/verifyOtp/VerifyOtpET.js.map +1 -1
  99. package/lib/commonjs/components/widgets/AlertDisplay.js +14 -9
  100. package/lib/commonjs/components/widgets/AlertDisplay.js.map +1 -1
  101. package/lib/commonjs/components/widgets/CancelOrderDialog.js +5 -6
  102. package/lib/commonjs/components/widgets/CancelOrderDialog.js.map +1 -1
  103. package/lib/commonjs/components/widgets/Card.js +2 -3
  104. package/lib/commonjs/components/widgets/Card.js.map +1 -1
  105. package/lib/commonjs/components/widgets/GoBackModal.js +1 -2
  106. package/lib/commonjs/components/widgets/GoBackModal.js.map +1 -1
  107. package/lib/commonjs/components/widgets/IconButton.js +1 -2
  108. package/lib/commonjs/components/widgets/IconButton.js.map +1 -1
  109. package/lib/commonjs/components/widgets/ModalWidget.js +3 -4
  110. package/lib/commonjs/components/widgets/ModalWidget.js.map +1 -1
  111. package/lib/commonjs/components/widgets/ProgressDialog.js +2 -3
  112. package/lib/commonjs/components/widgets/ProgressDialog.js.map +1 -1
  113. package/lib/commonjs/components/widgets/SearchBar.js +1 -2
  114. package/lib/commonjs/components/widgets/SearchBar.js.map +1 -1
  115. package/lib/commonjs/components/widgets/SnackBarCustom.js +3 -5
  116. package/lib/commonjs/components/widgets/SnackBarCustom.js.map +1 -1
  117. package/lib/commonjs/components/widgets/SplitTextInput.js +3 -4
  118. package/lib/commonjs/components/widgets/SplitTextInput.js.map +1 -1
  119. package/lib/commonjs/components/widgets/TabsComponent.js +3 -4
  120. package/lib/commonjs/components/widgets/TabsComponent.js.map +1 -1
  121. package/lib/commonjs/config/DispatchSDKConfig.js +1 -2
  122. package/lib/commonjs/config/DispatchSDKConfig.js.map +1 -1
  123. package/lib/commonjs/constants/apiConstants.js +2 -4
  124. package/lib/commonjs/constants/apiConstants.js.map +1 -1
  125. package/lib/commonjs/constants/constants.js +11 -22
  126. package/lib/commonjs/constants/constants.js.map +1 -1
  127. package/lib/commonjs/constants/statuscode.js +1 -2
  128. package/lib/commonjs/constants/statuscode.js.map +1 -1
  129. package/lib/commonjs/errors/ErrorCodes.js +7 -14
  130. package/lib/commonjs/errors/ErrorCodes.js.map +1 -1
  131. package/lib/commonjs/events/EventDispatcher.js +5 -3
  132. package/lib/commonjs/events/EventDispatcher.js.map +1 -1
  133. package/lib/commonjs/events/EventListener.js +1 -2
  134. package/lib/commonjs/events/EventListener.js.map +1 -1
  135. package/lib/commonjs/events/constants.js +1 -2
  136. package/lib/commonjs/events/constants.js.map +1 -1
  137. package/lib/commonjs/events/index.js +1 -2
  138. package/lib/commonjs/events/index.js.map +1 -1
  139. package/lib/commonjs/icons/ScanIcon.js +1 -2
  140. package/lib/commonjs/icons/ScanIcon.js.map +1 -1
  141. package/lib/commonjs/icons/circleMark.svg +3 -0
  142. package/lib/commonjs/icons/file.js +1 -2
  143. package/lib/commonjs/icons/file.js.map +1 -1
  144. package/lib/commonjs/index.js +15 -2
  145. package/lib/commonjs/index.js.map +1 -1
  146. package/lib/commonjs/locale/Str.js +21 -0
  147. package/lib/commonjs/locale/Str.js.map +1 -0
  148. package/lib/commonjs/locale/en.json +7 -0
  149. package/lib/commonjs/locale/i18n.js +32 -0
  150. package/lib/commonjs/locale/i18n.js.map +1 -0
  151. package/lib/commonjs/locale/util.js +27 -0
  152. package/lib/commonjs/locale/util.js.map +1 -0
  153. package/lib/commonjs/manager/dispatch/DispatchStateContainer.js +5 -3
  154. package/lib/commonjs/manager/dispatch/DispatchStateContainer.js.map +1 -1
  155. package/lib/commonjs/manager/dispatchCodes/EventCodeContainer.js +2 -0
  156. package/lib/commonjs/manager/dispatchCodes/EventCodeContainer.js.map +1 -1
  157. package/lib/commonjs/manager/dispatchCodes/EventCodeRepo.js +4 -2
  158. package/lib/commonjs/manager/dispatchCodes/EventCodeRepo.js.map +1 -1
  159. package/lib/commonjs/manager/dispatchCodes/ReasonCodeContainer.js +4 -2
  160. package/lib/commonjs/manager/dispatchCodes/ReasonCodeContainer.js.map +1 -1
  161. package/lib/commonjs/manager/dispatchCodes/ReasonCodeRepo.js +4 -2
  162. package/lib/commonjs/manager/dispatchCodes/ReasonCodeRepo.js.map +1 -1
  163. package/lib/commonjs/manager/location/LocationManager.js +7 -4
  164. package/lib/commonjs/manager/location/LocationManager.js.map +1 -1
  165. package/lib/commonjs/manager/sdk/DispatchSDKManager.js +4 -2
  166. package/lib/commonjs/manager/sdk/DispatchSDKManager.js.map +1 -1
  167. package/lib/commonjs/manager/sdk/DispatchSdkCache.js +2 -0
  168. package/lib/commonjs/manager/sdk/DispatchSdkCache.js.map +1 -1
  169. package/lib/commonjs/manager/sdk/callbacksHandler.js +1 -2
  170. package/lib/commonjs/manager/sdk/callbacksHandler.js.map +1 -1
  171. package/lib/commonjs/manager/syncmanager/AppSyncManager.js +4 -2
  172. package/lib/commonjs/manager/syncmanager/AppSyncManager.js.map +1 -1
  173. package/lib/commonjs/manager/syncmanager/DBConfig.js +15 -26
  174. package/lib/commonjs/manager/syncmanager/DBConfig.js.map +1 -1
  175. package/lib/commonjs/manager/syncmanager/NativeSyncManager.js +1 -2
  176. package/lib/commonjs/manager/syncmanager/NativeSyncManager.js.map +1 -1
  177. package/lib/commonjs/manager/syncmanager/constants.js +5 -10
  178. package/lib/commonjs/manager/syncmanager/constants.js.map +1 -1
  179. package/lib/commonjs/manager/syncmanager/database.js +2 -2
  180. package/lib/commonjs/manager/syncmanager/database.js.map +1 -1
  181. package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js +5 -4
  182. package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js.map +1 -1
  183. package/lib/commonjs/manager/syncmanager/document/DocumentManager.js +4 -2
  184. package/lib/commonjs/manager/syncmanager/document/DocumentManager.js.map +1 -1
  185. package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js +4 -2
  186. package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
  187. package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js +15 -3
  188. package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js.map +1 -1
  189. package/lib/commonjs/manager/syncmanager/events/EventsSyncManager.js +4 -2
  190. package/lib/commonjs/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
  191. package/lib/commonjs/models/DispatchModels.js +1 -2
  192. package/lib/commonjs/models/DispatchModels.js.map +1 -1
  193. package/lib/commonjs/models/execTasks/ETConfig.js +6 -12
  194. package/lib/commonjs/models/execTasks/ETConfig.js.map +1 -1
  195. package/lib/commonjs/models/fcm.js.map +1 -1
  196. package/lib/commonjs/models/sdk.js +1 -2
  197. package/lib/commonjs/models/sdk.js.map +1 -1
  198. package/lib/commonjs/native/signature/SignatureCapture.js +1 -2
  199. package/lib/commonjs/native/signature/SignatureCapture.js.map +1 -1
  200. package/lib/commonjs/network/GraphQLClient.js +48 -4
  201. package/lib/commonjs/network/GraphQLClient.js.map +1 -1
  202. package/lib/commonjs/network/Queries.js +5 -10
  203. package/lib/commonjs/network/Queries.js.map +1 -1
  204. package/lib/commonjs/res/strings.js +1 -2
  205. package/lib/commonjs/res/strings.js.map +1 -1
  206. package/lib/commonjs/resources/Login.js +1 -2
  207. package/lib/commonjs/resources/Login.js.map +1 -1
  208. package/lib/commonjs/resources/network.js +1 -2
  209. package/lib/commonjs/resources/network.js.map +1 -1
  210. package/lib/commonjs/styles/SdkColors.js +2 -4
  211. package/lib/commonjs/styles/SdkColors.js.map +1 -1
  212. package/lib/commonjs/styles/executionTasks/CommonStyles.js +8 -11
  213. package/lib/commonjs/styles/executionTasks/CommonStyles.js.map +1 -1
  214. package/lib/commonjs/ui/screens/CancellationScreen.js +3 -4
  215. package/lib/commonjs/ui/screens/CancellationScreen.js.map +1 -1
  216. package/lib/commonjs/ui/screens/CaptureInputScreen.js +5 -5
  217. package/lib/commonjs/ui/screens/CaptureInputScreen.js.map +1 -1
  218. package/lib/commonjs/ui/screens/CompleteObjectiveScreen.js +3 -4
  219. package/lib/commonjs/ui/screens/CompleteObjectiveScreen.js.map +1 -1
  220. package/lib/commonjs/ui/screens/DeliverScreen.js +36 -10
  221. package/lib/commonjs/ui/screens/DeliverScreen.js.map +1 -1
  222. package/lib/commonjs/ui/screens/DisplayScreen.js +3 -4
  223. package/lib/commonjs/ui/screens/DisplayScreen.js.map +1 -1
  224. package/lib/commonjs/ui/screens/DoodleScreen.js +27 -6
  225. package/lib/commonjs/ui/screens/DoodleScreen.js.map +1 -1
  226. package/lib/commonjs/ui/screens/DropCashScreen.js +29 -10
  227. package/lib/commonjs/ui/screens/DropCashScreen.js.map +1 -1
  228. package/lib/commonjs/ui/screens/FormsScreen.js +25 -5
  229. package/lib/commonjs/ui/screens/FormsScreen.js.map +1 -1
  230. package/lib/commonjs/ui/screens/GeofenceScreen.js +3 -4
  231. package/lib/commonjs/ui/screens/GeofenceScreen.js.map +1 -1
  232. package/lib/commonjs/ui/screens/HttpRequestScreen.js +1 -2
  233. package/lib/commonjs/ui/screens/HttpRequestScreen.js.map +1 -1
  234. package/lib/commonjs/ui/screens/ImageCaptureScreen.js +27 -9
  235. package/lib/commonjs/ui/screens/ImageCaptureScreen.js.map +1 -1
  236. package/lib/commonjs/ui/screens/PaymentScreen.js +31 -10
  237. package/lib/commonjs/ui/screens/PaymentScreen.js.map +1 -1
  238. package/lib/commonjs/ui/screens/PickupScreen.js +38 -10
  239. package/lib/commonjs/ui/screens/PickupScreen.js.map +1 -1
  240. package/lib/commonjs/ui/screens/ScanScreen.js +3 -4
  241. package/lib/commonjs/ui/screens/ScanScreen.js.map +1 -1
  242. package/lib/commonjs/ui/screens/StartWorkFlowScreen.js +8 -7
  243. package/lib/commonjs/ui/screens/StartWorkFlowScreen.js.map +1 -1
  244. package/lib/commonjs/ui/screens/ValidateOTPScreen.js +3 -4
  245. package/lib/commonjs/ui/screens/ValidateOTPScreen.js.map +1 -1
  246. package/lib/commonjs/ui/screens/WithBaseDispatchScreen.js +4 -4
  247. package/lib/commonjs/ui/screens/WithBaseDispatchScreen.js.map +1 -1
  248. package/lib/commonjs/ui/uiConfig/RouteParams.js +1 -2
  249. package/lib/commonjs/ui/uiConfig/RouteParams.js.map +1 -1
  250. package/lib/commonjs/utils/ApiUtils.js +2 -4
  251. package/lib/commonjs/utils/ApiUtils.js.map +1 -1
  252. package/lib/commonjs/utils/Logger.js +10 -9
  253. package/lib/commonjs/utils/Logger.js.map +1 -1
  254. package/lib/commonjs/utils/NetworkUtil.js +1 -2
  255. package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
  256. package/lib/commonjs/utils/SdkUtils.js +12 -8
  257. package/lib/commonjs/utils/SdkUtils.js.map +1 -1
  258. package/lib/commonjs/utils/SyncManagerUtils.js +2 -2
  259. package/lib/commonjs/utils/SyncManagerUtils.js.map +1 -1
  260. package/lib/commonjs/utils/fcm/FCM.js +3 -4
  261. package/lib/commonjs/utils/fcm/FCM.js.map +1 -1
  262. package/lib/commonjs/utils/fcm/FcmUtils.js +14 -2
  263. package/lib/commonjs/utils/fcm/FcmUtils.js.map +1 -1
  264. package/lib/commonjs/utils/helper.js +46 -4
  265. package/lib/commonjs/utils/helper.js.map +1 -1
  266. package/lib/commonjs/utils/hooks/useModal.js +3 -4
  267. package/lib/commonjs/utils/hooks/useModal.js.map +1 -1
  268. package/lib/commonjs/utils/hooks/useTimer.js +1 -2
  269. package/lib/commonjs/utils/hooks/useTimer.js.map +1 -1
  270. package/lib/commonjs/utils/loginHelper.js +1 -2
  271. package/lib/commonjs/utils/loginHelper.js.map +1 -1
  272. package/lib/commonjs/utils/storage.js +71 -13
  273. package/lib/commonjs/utils/storage.js.map +1 -1
  274. package/lib/module/components/dispatch/DispatchExecNavigator.js.map +1 -1
  275. package/lib/module/components/executiontasks/cancellation/CancelET.js +11 -5
  276. package/lib/module/components/executiontasks/cancellation/CancelET.js.map +1 -1
  277. package/lib/module/components/executiontasks/deliver/DeliverETInput.js.map +1 -1
  278. package/lib/module/components/executiontasks/deliver/SLDeliverET.js +112 -25
  279. package/lib/module/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
  280. package/lib/module/components/executiontasks/display/DisplayModalET.js +5 -5
  281. package/lib/module/components/executiontasks/display/DisplayModalET.js.map +1 -1
  282. package/lib/module/components/executiontasks/doodle/SignatureET.js +111 -45
  283. package/lib/module/components/executiontasks/doodle/SignatureET.js.map +1 -1
  284. package/lib/module/components/executiontasks/doodle/SignatureSchema.js.map +1 -1
  285. package/lib/module/components/executiontasks/dropCash/DropCashSchema.js.map +1 -1
  286. package/lib/module/components/executiontasks/dropCash/SLDropCash.js +5 -5
  287. package/lib/module/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
  288. package/lib/module/components/executiontasks/forms/FormGenerator.js +4 -4
  289. package/lib/module/components/executiontasks/forms/FormGenerator.js.map +1 -1
  290. package/lib/module/components/executiontasks/forms/FormSchema.js.map +1 -1
  291. package/lib/module/components/executiontasks/forms/widgets/DateTimeWidget.js +1 -1
  292. package/lib/module/components/executiontasks/forms/widgets/DateTimeWidget.js.map +1 -1
  293. package/lib/module/components/executiontasks/imageCapture/CaptureSchema.js.map +1 -1
  294. package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js +133 -21
  295. package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
  296. package/lib/module/components/executiontasks/imageCapture/ImageCapture.js +226 -130
  297. package/lib/module/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
  298. package/lib/module/components/executiontasks/imageCapture/camera.svg +3 -0
  299. package/lib/module/components/executiontasks/imageCapture/circle-xmark.svg +5 -0
  300. package/lib/module/components/executiontasks/payments/PaymentStyles.js +6 -6
  301. package/lib/module/components/executiontasks/payments/PaymentStyles.js.map +1 -1
  302. package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js +4 -4
  303. package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
  304. package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentSchema.js.map +1 -1
  305. package/lib/module/components/executiontasks/payments/init/InitPaymentET.js +1 -1
  306. package/lib/module/components/executiontasks/payments/init/InitPaymentET.js.map +1 -1
  307. package/lib/module/components/executiontasks/payments/init/InitPaymentSchema.js.map +1 -1
  308. package/lib/module/components/executiontasks/payments/processPayment/ProcessPaymentET.js +1 -1
  309. package/lib/module/components/executiontasks/payments/processPayment/ProcessPaymentET.js.map +1 -1
  310. package/lib/module/components/executiontasks/payments/processPayment/ProcessPaymentSchema.js.map +1 -1
  311. package/lib/module/components/executiontasks/pickup/PickpSchema.js.map +1 -1
  312. package/lib/module/components/executiontasks/pickup/SLPickupET.js +89 -16
  313. package/lib/module/components/executiontasks/pickup/SLPickupET.js.map +1 -1
  314. package/lib/module/components/executiontasks/scan/ScanET.js +12 -12
  315. package/lib/module/components/executiontasks/scan/ScanET.js.map +1 -1
  316. package/lib/module/components/executiontasks/scan/sub_components/CScanner.js +2 -2
  317. package/lib/module/components/executiontasks/scan/sub_components/CScanner.js.map +1 -1
  318. package/lib/module/components/executiontasks/scan/sub_components/ERDropDown.js +3 -3
  319. package/lib/module/components/executiontasks/scan/sub_components/ERDropDown.js.map +1 -1
  320. package/lib/module/components/executiontasks/scan/sub_components/SummaryPage.js +6 -6
  321. package/lib/module/components/executiontasks/scan/sub_components/SummaryPage.js.map +1 -1
  322. package/lib/module/components/executiontasks/scan/utils.js.map +1 -1
  323. package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js +6 -6
  324. package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
  325. package/lib/module/components/executiontasks/validateOTP/sub-components/OTPInput.js +3 -3
  326. package/lib/module/components/executiontasks/validateOTP/sub-components/OTPInput.js.map +1 -1
  327. package/lib/module/components/widgets/AlertDisplay.js +12 -7
  328. package/lib/module/components/widgets/AlertDisplay.js.map +1 -1
  329. package/lib/module/components/widgets/CancelOrderDialog.js +3 -3
  330. package/lib/module/components/widgets/CancelOrderDialog.js.map +1 -1
  331. package/lib/module/components/widgets/Card.js +1 -1
  332. package/lib/module/components/widgets/Card.js.map +1 -1
  333. package/lib/module/components/widgets/ModalWidget.js +3 -3
  334. package/lib/module/components/widgets/ModalWidget.js.map +1 -1
  335. package/lib/module/components/widgets/ProgressDialog.js +2 -2
  336. package/lib/module/components/widgets/ProgressDialog.js.map +1 -1
  337. package/lib/module/components/widgets/SnackBarCustom.js +2 -2
  338. package/lib/module/components/widgets/SnackBarCustom.js.map +1 -1
  339. package/lib/module/constants/constants.js +1 -1
  340. package/lib/module/constants/constants.js.map +1 -1
  341. package/lib/module/events/EventDispatcher.js +5 -2
  342. package/lib/module/events/EventDispatcher.js.map +1 -1
  343. package/lib/module/icons/circleMark.svg +3 -0
  344. package/lib/module/index.js +4 -2
  345. package/lib/module/index.js.map +1 -1
  346. package/lib/module/locale/Str.js +15 -0
  347. package/lib/module/locale/Str.js.map +1 -0
  348. package/lib/module/locale/en.json +7 -0
  349. package/lib/module/locale/i18n.js +25 -0
  350. package/lib/module/locale/i18n.js.map +1 -0
  351. package/lib/module/locale/util.js +18 -0
  352. package/lib/module/locale/util.js.map +1 -0
  353. package/lib/module/manager/dispatch/DispatchStateContainer.js +3 -1
  354. package/lib/module/manager/dispatch/DispatchStateContainer.js.map +1 -1
  355. package/lib/module/manager/dispatchCodes/EventCodeContainer.js +2 -0
  356. package/lib/module/manager/dispatchCodes/EventCodeContainer.js.map +1 -1
  357. package/lib/module/manager/dispatchCodes/EventCodeRepo.js +2 -0
  358. package/lib/module/manager/dispatchCodes/EventCodeRepo.js.map +1 -1
  359. package/lib/module/manager/dispatchCodes/ReasonCodeContainer.js +2 -0
  360. package/lib/module/manager/dispatchCodes/ReasonCodeContainer.js.map +1 -1
  361. package/lib/module/manager/dispatchCodes/ReasonCodeRepo.js +2 -0
  362. package/lib/module/manager/dispatchCodes/ReasonCodeRepo.js.map +1 -1
  363. package/lib/module/manager/location/LocationManager.js +2 -0
  364. package/lib/module/manager/location/LocationManager.js.map +1 -1
  365. package/lib/module/manager/sdk/DispatchSDKManager.js +2 -0
  366. package/lib/module/manager/sdk/DispatchSDKManager.js.map +1 -1
  367. package/lib/module/manager/sdk/DispatchSdkCache.js +2 -0
  368. package/lib/module/manager/sdk/DispatchSdkCache.js.map +1 -1
  369. package/lib/module/manager/syncmanager/AppSyncManager.js +2 -0
  370. package/lib/module/manager/syncmanager/AppSyncManager.js.map +1 -1
  371. package/lib/module/manager/syncmanager/DBConfig.js +1 -0
  372. package/lib/module/manager/syncmanager/DBConfig.js.map +1 -1
  373. package/lib/module/manager/syncmanager/document/DocumentManager.js +2 -0
  374. package/lib/module/manager/syncmanager/document/DocumentManager.js.map +1 -1
  375. package/lib/module/manager/syncmanager/document/DocumentSyncManager.js +2 -0
  376. package/lib/module/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
  377. package/lib/module/manager/syncmanager/events/ETEventsManager.js +13 -1
  378. package/lib/module/manager/syncmanager/events/ETEventsManager.js.map +1 -1
  379. package/lib/module/manager/syncmanager/events/EventsSyncManager.js +2 -0
  380. package/lib/module/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
  381. package/lib/module/models/fcm.js.map +1 -1
  382. package/lib/module/network/GraphQLClient.js +48 -3
  383. package/lib/module/network/GraphQLClient.js.map +1 -1
  384. package/lib/module/styles/executionTasks/CommonStyles.js +2 -1
  385. package/lib/module/styles/executionTasks/CommonStyles.js.map +1 -1
  386. package/lib/module/ui/screens/CaptureInputScreen.js +2 -1
  387. package/lib/module/ui/screens/CaptureInputScreen.js.map +1 -1
  388. package/lib/module/ui/screens/DeliverScreen.js +33 -6
  389. package/lib/module/ui/screens/DeliverScreen.js.map +1 -1
  390. package/lib/module/ui/screens/DoodleScreen.js +24 -2
  391. package/lib/module/ui/screens/DoodleScreen.js.map +1 -1
  392. package/lib/module/ui/screens/DropCashScreen.js +26 -6
  393. package/lib/module/ui/screens/DropCashScreen.js.map +1 -1
  394. package/lib/module/ui/screens/FormsScreen.js +22 -1
  395. package/lib/module/ui/screens/FormsScreen.js.map +1 -1
  396. package/lib/module/ui/screens/ImageCaptureScreen.js +24 -5
  397. package/lib/module/ui/screens/ImageCaptureScreen.js.map +1 -1
  398. package/lib/module/ui/screens/PaymentScreen.js +28 -6
  399. package/lib/module/ui/screens/PaymentScreen.js.map +1 -1
  400. package/lib/module/ui/screens/PickupScreen.js +35 -6
  401. package/lib/module/ui/screens/PickupScreen.js.map +1 -1
  402. package/lib/module/ui/screens/StartWorkFlowScreen.js +6 -4
  403. package/lib/module/ui/screens/StartWorkFlowScreen.js.map +1 -1
  404. package/lib/module/ui/screens/WithBaseDispatchScreen.js +1 -0
  405. package/lib/module/ui/screens/WithBaseDispatchScreen.js.map +1 -1
  406. package/lib/module/utils/Logger.js +2 -0
  407. package/lib/module/utils/Logger.js.map +1 -1
  408. package/lib/module/utils/SdkUtils.js +11 -7
  409. package/lib/module/utils/SdkUtils.js.map +1 -1
  410. package/lib/module/utils/fcm/FcmUtils.js +11 -0
  411. package/lib/module/utils/fcm/FcmUtils.js.map +1 -1
  412. package/lib/module/utils/helper.js +46 -4
  413. package/lib/module/utils/helper.js.map +1 -1
  414. package/lib/module/utils/storage.js +69 -10
  415. package/lib/module/utils/storage.js.map +1 -1
  416. package/lib/typescript/components/executiontasks/deliver/DeliverETInput.d.ts +5 -0
  417. package/lib/typescript/components/executiontasks/doodle/SignatureSchema.d.ts +1 -0
  418. package/lib/typescript/components/executiontasks/dropCash/DropCashSchema.d.ts +1 -0
  419. package/lib/typescript/components/executiontasks/forms/FormSchema.d.ts +1 -0
  420. package/lib/typescript/components/executiontasks/imageCapture/CaptureSchema.d.ts +1 -0
  421. package/lib/typescript/components/executiontasks/imageCapture/CaptureUtils.d.ts +6 -1
  422. package/lib/typescript/components/executiontasks/imageCapture/ImageCapture.d.ts +1 -2
  423. package/lib/typescript/components/executiontasks/payments/PaymentStyles.d.ts +4 -5
  424. package/lib/typescript/components/executiontasks/payments/completePayment/CompletePaymentSchema.d.ts +1 -0
  425. package/lib/typescript/components/executiontasks/payments/init/InitPaymentSchema.d.ts +1 -0
  426. package/lib/typescript/components/executiontasks/payments/processPayment/ProcessPaymentSchema.d.ts +1 -0
  427. package/lib/typescript/components/executiontasks/pickup/PickpSchema.d.ts +2 -0
  428. package/lib/typescript/components/widgets/SnackBarCustom.d.ts +1 -1
  429. package/lib/typescript/constants/constants.d.ts +1 -1
  430. package/lib/typescript/index.d.ts +4 -2
  431. package/lib/typescript/locale/Str.d.ts +13 -0
  432. package/lib/typescript/locale/i18n.d.ts +3 -0
  433. package/lib/typescript/locale/util.d.ts +2 -0
  434. package/lib/typescript/manager/syncmanager/DBConfig.d.ts +2 -1
  435. package/lib/typescript/models/fcm.d.ts +3 -0
  436. package/lib/typescript/styles/executionTasks/CommonStyles.d.ts +1 -0
  437. package/lib/typescript/utils/fcm/FcmUtils.d.ts +2 -1
  438. package/lib/typescript/utils/helper.d.ts +4 -3
  439. package/lib/typescript/utils/storage.d.ts +3 -2
  440. package/package.json +22 -7
  441. package/src/@types/assets/index.d.ts +6 -0
  442. package/src/components/dispatch/DispatchExecNavigator.tsx +273 -0
  443. package/src/components/executiontasks/CompletedWFSchema.ts +24 -0
  444. package/src/components/executiontasks/ExecutionTasksIndex.ts +137 -0
  445. package/src/components/executiontasks/cancellation/CancelET.tsx +281 -0
  446. package/src/components/executiontasks/cancellation/CancellationSchema.ts +30 -0
  447. package/src/components/executiontasks/captureInput/CaptureInputSchema.ts +52 -0
  448. package/src/components/executiontasks/captureInput/CaptureText.tsx +172 -0
  449. package/src/components/executiontasks/captureInput/utils.ts +9 -0
  450. package/src/components/executiontasks/deliver/DeliverET.tsx +124 -0
  451. package/src/components/executiontasks/deliver/DeliverETInput.ts +52 -0
  452. package/src/components/executiontasks/deliver/SLDeliverET.tsx +522 -0
  453. package/src/components/executiontasks/display/DisplayModalET.tsx +174 -0
  454. package/src/components/executiontasks/display/DisplaySchema.ts +29 -0
  455. package/src/components/executiontasks/doodle/SignatureET.tsx +325 -0
  456. package/src/components/executiontasks/doodle/SignatureSchema.ts +52 -0
  457. package/src/components/executiontasks/dropCash/DropCashET.tsx +145 -0
  458. package/src/components/executiontasks/dropCash/DropCashSchema.ts +23 -0
  459. package/src/components/executiontasks/dropCash/SLDropCash.tsx +286 -0
  460. package/src/components/executiontasks/forms/FormGenerator.tsx +283 -0
  461. package/src/components/executiontasks/forms/FormSchema.ts +30 -0
  462. package/src/components/executiontasks/forms/widgets/DateTimeWidget.tsx +144 -0
  463. package/src/components/executiontasks/forms/widgets/DropdownWidget.tsx +52 -0
  464. package/src/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.tsx +158 -0
  465. package/src/components/executiontasks/forms/widgets/TimeRangeSelector.tsx +38 -0
  466. package/src/components/executiontasks/httpRequest/HttpEtUtils.ts +49 -0
  467. package/src/components/executiontasks/httpRequest/HttpRequestET.tsx +59 -0
  468. package/src/components/executiontasks/httpRequest/HttpRequestETSchema.ts +42 -0
  469. package/src/components/executiontasks/imageCapture/CaptureSchema.ts +94 -0
  470. package/src/components/executiontasks/imageCapture/CaptureUtils.ts +321 -0
  471. package/src/components/executiontasks/imageCapture/ImageCapture.tsx +457 -0
  472. package/src/components/executiontasks/imageCapture/camera.svg +3 -0
  473. package/src/components/executiontasks/imageCapture/circle-xmark.svg +5 -0
  474. package/src/components/executiontasks/payments/PaymentStyles.ts +93 -0
  475. package/src/components/executiontasks/payments/PaymentUtils.ts +7 -0
  476. package/src/components/executiontasks/payments/completePayment/CompletePaymentET.tsx +238 -0
  477. package/src/components/executiontasks/payments/completePayment/CompletePaymentSchema.ts +24 -0
  478. package/src/components/executiontasks/payments/init/InitPaymentET.tsx +246 -0
  479. package/src/components/executiontasks/payments/init/InitPaymentSchema.ts +38 -0
  480. package/src/components/executiontasks/payments/processPayment/ProcessPaymentET.tsx +273 -0
  481. package/src/components/executiontasks/payments/processPayment/ProcessPaymentSchema.ts +39 -0
  482. package/src/components/executiontasks/pickup/PickpSchema.ts +30 -0
  483. package/src/components/executiontasks/pickup/PickupET.tsx +126 -0
  484. package/src/components/executiontasks/pickup/SLPickupET.tsx +372 -0
  485. package/src/components/executiontasks/scan/ScanET.tsx +1059 -0
  486. package/src/components/executiontasks/scan/ScanSchema.ts +121 -0
  487. package/src/components/executiontasks/scan/constants.ts +6 -0
  488. package/src/components/executiontasks/scan/interfaces.ts +109 -0
  489. package/src/components/executiontasks/scan/modalConstant.ts +120 -0
  490. package/src/components/executiontasks/scan/sub_components/CScanner.tsx +107 -0
  491. package/src/components/executiontasks/scan/sub_components/DropDownUtils.ts +119 -0
  492. package/src/components/executiontasks/scan/sub_components/ERDropDown.tsx +134 -0
  493. package/src/components/executiontasks/scan/sub_components/SummaryPage.tsx +1296 -0
  494. package/src/components/executiontasks/scan/utils.ts +1108 -0
  495. package/src/components/executiontasks/validateOTP/ValidateOTPET.tsx +436 -0
  496. package/src/components/executiontasks/validateOTP/ValidateOTPSchema.ts +68 -0
  497. package/src/components/executiontasks/validateOTP/constants.ts +24 -0
  498. package/src/components/executiontasks/validateOTP/sub-components/OTPInput.tsx +83 -0
  499. package/src/components/executiontasks/validateOTP/utils.ts +180 -0
  500. package/src/components/executiontasks/verifyInput/VerifyInputSchema.ts +49 -0
  501. package/src/components/executiontasks/verifyLocation/GeofenceUtils.ts +55 -0
  502. package/src/components/executiontasks/verifyLocation/VerifyLocSchema.ts +56 -0
  503. package/src/components/executiontasks/verifyLocation/VerifyLocationET.tsx +69 -0
  504. package/src/components/executiontasks/verifyOtp/VerifyOtpET.tsx +96 -0
  505. package/src/components/executiontasks/verifyOtp/VerifyOtpSchema.ts +27 -0
  506. package/src/components/utils/index.ts +18 -0
  507. package/src/components/widgets/AlertDisplay.tsx +38 -0
  508. package/src/components/widgets/CancelOrderDialog.tsx +112 -0
  509. package/src/components/widgets/Card.tsx +99 -0
  510. package/src/components/widgets/GoBackModal.tsx +49 -0
  511. package/src/components/widgets/IconButton.tsx +32 -0
  512. package/src/components/widgets/ModalWidget.tsx +157 -0
  513. package/src/components/widgets/ProgressDialog.tsx +54 -0
  514. package/src/components/widgets/SearchBar.tsx +71 -0
  515. package/src/components/widgets/SnackBarCustom.tsx +212 -0
  516. package/src/components/widgets/SplitTextInput.tsx +116 -0
  517. package/src/components/widgets/TabsComponent.tsx +84 -0
  518. package/src/components/widgets/Toaster.ts +8 -0
  519. package/src/config/DispatchSDKConfig.ts +4 -0
  520. package/src/constants/apiConstants.ts +11 -0
  521. package/src/constants/constants.ts +12 -0
  522. package/src/constants/statuscode.ts +8 -0
  523. package/src/errors/BaseError.ts +16 -0
  524. package/src/errors/ErrorCodes.ts +38 -0
  525. package/src/events/EventDispatcher.ts +22 -0
  526. package/src/events/EventListener.ts +14 -0
  527. package/src/events/constants.ts +7 -0
  528. package/src/events/index.ts +3 -0
  529. package/src/events/interface.ts +1 -0
  530. package/src/icons/ScanIcon.tsx +24 -0
  531. package/src/icons/circleMark.svg +3 -0
  532. package/src/icons/file.tsx +24 -0
  533. package/src/icons/interface.ts +5 -0
  534. package/src/index.tsx +82 -0
  535. package/src/locale/Str.ts +15 -0
  536. package/src/locale/en.json +7 -0
  537. package/src/locale/i18n.ts +26 -0
  538. package/src/locale/util.ts +20 -0
  539. package/src/manager/dispatch/DispatchStateContainer.tsx +842 -0
  540. package/src/manager/dispatchCodes/EventCodeContainer.ts +75 -0
  541. package/src/manager/dispatchCodes/EventCodeRepo.ts +82 -0
  542. package/src/manager/dispatchCodes/ReasonCodeContainer.ts +121 -0
  543. package/src/manager/dispatchCodes/ReasonCodeRepo.ts +90 -0
  544. package/src/manager/dispatchCodes/reasonCodes.json +137 -0
  545. package/src/manager/jobRemoval/JobRemovalManager.ts +21 -0
  546. package/src/manager/location/LocationManager.ts +77 -0
  547. package/src/manager/sdk/DispatchSDKManager.ts +99 -0
  548. package/src/manager/sdk/DispatchSdkCache.ts +47 -0
  549. package/src/manager/sdk/callbacksHandler.ts +25 -0
  550. package/src/manager/syncmanager/AppSyncManager.ts +187 -0
  551. package/src/manager/syncmanager/DBConfig.ts +181 -0
  552. package/src/manager/syncmanager/NativeSyncManager.ts +14 -0
  553. package/src/manager/syncmanager/constants.ts +5 -0
  554. package/src/manager/syncmanager/database.ts +93 -0
  555. package/src/manager/syncmanager/document/DocumentHttpClient.ts +111 -0
  556. package/src/manager/syncmanager/document/DocumentManager.ts +143 -0
  557. package/src/manager/syncmanager/document/DocumentSyncManager.ts +233 -0
  558. package/src/manager/syncmanager/document/models.ts +4 -0
  559. package/src/manager/syncmanager/events/ETEventsManager.ts +647 -0
  560. package/src/manager/syncmanager/events/EventsGraphQLClient.ts +0 -0
  561. package/src/manager/syncmanager/events/EventsSyncManager.ts +490 -0
  562. package/src/manager/syncmanager/events/SyncHttpClient.ts +202 -0
  563. package/src/models/DispatchModels.ts +97 -0
  564. package/src/models/ReasonCodes.ts +12 -0
  565. package/src/models/auth.ts +43 -0
  566. package/src/models/execTasks/ETBaseModels.ts +113 -0
  567. package/src/models/execTasks/ETConfig.ts +94 -0
  568. package/src/models/execution.ts +9 -0
  569. package/src/models/fcm.ts +6 -0
  570. package/src/models/sdk.ts +35 -0
  571. package/src/native/signature/SignatureCapture.tsx +110 -0
  572. package/src/network/GraphQLClient.ts +147 -0
  573. package/src/network/NetworkClient.ts +58 -0
  574. package/src/network/NetworkUtils.ts +41 -0
  575. package/src/network/Queries.ts +46 -0
  576. package/src/network/client.ts +61 -0
  577. package/src/res/strings.ts +1 -0
  578. package/src/resources/Login.ts +36 -0
  579. package/src/resources/network.ts +13 -0
  580. package/src/styles/SdkColors.ts +24 -0
  581. package/src/styles/executionTasks/CommonStyles.ts +189 -0
  582. package/src/ui/screens/CancellationScreen.tsx +144 -0
  583. package/src/ui/screens/CaptureInputScreen.tsx +79 -0
  584. package/src/ui/screens/CompleteObjectiveScreen.tsx +72 -0
  585. package/src/ui/screens/DeliverScreen.tsx +136 -0
  586. package/src/ui/screens/DisplayScreen.tsx +52 -0
  587. package/src/ui/screens/DoodleScreen.tsx +107 -0
  588. package/src/ui/screens/DropCashScreen.tsx +132 -0
  589. package/src/ui/screens/ETScreensIndex.ts +35 -0
  590. package/src/ui/screens/FormsScreen.tsx +186 -0
  591. package/src/ui/screens/GeofenceScreen.tsx +54 -0
  592. package/src/ui/screens/HttpRequestScreen.tsx +47 -0
  593. package/src/ui/screens/ImageCaptureScreen.tsx +95 -0
  594. package/src/ui/screens/PaymentScreen.tsx +213 -0
  595. package/src/ui/screens/PickupScreen.tsx +112 -0
  596. package/src/ui/screens/ScanScreen.tsx +159 -0
  597. package/src/ui/screens/StartWorkFlowScreen.tsx +233 -0
  598. package/src/ui/screens/ValidateOTPScreen.tsx +62 -0
  599. package/src/ui/screens/WithBaseDispatchScreen.tsx +33 -0
  600. package/src/ui/uiConfig/RouteParams.ts +28 -0
  601. package/src/utils/ApiUtils.ts +157 -0
  602. package/src/utils/ExecTaskUtils.ts +214 -0
  603. package/src/utils/Logger.ts +110 -0
  604. package/src/utils/NetworkUtil.ts +50 -0
  605. package/src/utils/SdkUtils.ts +155 -0
  606. package/src/utils/SyncManagerUtils.ts +223 -0
  607. package/src/utils/fcm/FCM.ts +118 -0
  608. package/src/utils/fcm/FcmUtils.ts +130 -0
  609. package/src/utils/helper.ts +67 -0
  610. package/src/utils/hooks/useModal.tsx +67 -0
  611. package/src/utils/hooks/useTimer.ts +44 -0
  612. package/src/utils/loginHelper.ts +51 -0
  613. package/src/utils/storage.ts +292 -0
  614. package/src/utils/test.json +17 -0
  615. package/src/utils/utils.ts +30 -0
  616. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  617. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  618. package/android/gradlew +0 -185
  619. package/android/gradlew.bat +0 -89
@@ -0,0 +1,159 @@
1
+ import withBaseDispatchScreen from './WithBaseDispatchScreen';
2
+ import { RouteParams, getDataFromNextState } from '../uiConfig/RouteParams';
3
+ import React, { useEffect, useState } from 'react';
4
+ import type { BaseETProps } from '../../models/DispatchModels';
5
+ import DispatchStateContainer from '../../manager/dispatch/DispatchStateContainer';
6
+ import { EntityCode, ExecutionTaskID } from '../../models/execTasks/ETConfig';
7
+ import type { ScannerOutput } from '../../components/executiontasks/scan/ScanSchema';
8
+ import ScanET from '../../components/executiontasks/scan/ScanET';
9
+ import { onTaskStart } from '../../utils/ExecTaskUtils';
10
+ import { DispatchExecutor } from '@os1-platform/platform-coreos-execution-engine-sdk';
11
+ import Storage from '../../utils/storage';
12
+ import { SCAN_MERGED_OBJ_ID_OUTPUT } from '../../manager/syncmanager/constants';
13
+ import {
14
+ SCANNED_RECORD,
15
+ SCAN_MERGED_OBJ_ID_INTEFACE,
16
+ } from '../../components/executiontasks/scan/interfaces';
17
+
18
+ const ScanScreen = ({
19
+ route,
20
+ navigation,
21
+ baseETProps,
22
+ }: {
23
+ route: any;
24
+ navigation: any;
25
+ baseETProps: BaseETProps;
26
+ }) => {
27
+ const nextState = route.params[RouteParams.NEXT_STATES];
28
+ const { taskMeta, mergedObjectiveId, input, wfMeta, taskName } =
29
+ getDataFromNextState(nextState);
30
+
31
+ let _route = JSON.parse(JSON.stringify(route));
32
+ const firstInput = input;
33
+
34
+ const [inputs, setInputs] = useState({
35
+ ...firstInput,
36
+ wfMeta,
37
+ mergedObjectiveId,
38
+ });
39
+
40
+ useEffect(() => {
41
+ (async () => {
42
+ // Setup mergedIds in Shared Prefs
43
+ const prefixedMergedObjectiveId =
44
+ route.params[RouteParams.ROOT_META_DATA].prefixedMergedObjectiveId;
45
+
46
+ let storage = Storage.getInstance();
47
+ const _mergedIdsOut = await storage.getSharedItem(
48
+ SCAN_MERGED_OBJ_ID_OUTPUT
49
+ );
50
+ const mergedIdsOutput: SCAN_MERGED_OBJ_ID_INTEFACE = JSON.parse(
51
+ _mergedIdsOut || '{}'
52
+ );
53
+
54
+ if (_mergedIdsOut) {
55
+ const mergedIds: SCANNED_RECORD =
56
+ mergedIdsOutput[prefixedMergedObjectiveId];
57
+ const runningMergedIds = mergedObjectiveId;
58
+
59
+ // CHECK IF PREFIXED ID IS PRESENT IN SUCCESS | FAILURE;
60
+ if (mergedIds) {
61
+ mergedObjectiveId.forEach((ids: string) => {
62
+ const isDelivered = mergedIds.success.indexOf(ids) !== -1;
63
+ const isUnDelivered = mergedIds.failure.indexOf(ids) !== -1;
64
+ const isAlreadyPending = mergedIds.pending.indexOf(ids) !== -1;
65
+
66
+ if (!isDelivered && !isUnDelivered && !isAlreadyPending) {
67
+ mergedIds.pending.push(ids);
68
+ }
69
+ });
70
+ await storage.setSharedItem(
71
+ SCAN_MERGED_OBJ_ID_OUTPUT,
72
+ JSON.stringify({
73
+ ...mergedIdsOutput,
74
+ [prefixedMergedObjectiveId]: mergedIds,
75
+ })
76
+ );
77
+ } else {
78
+ const mergedIds: SCANNED_RECORD = {
79
+ success: [],
80
+ failure: [],
81
+ pending: [],
82
+ };
83
+ mergedObjectiveId.forEach((ids: string) => {
84
+ mergedIds.pending.push(ids);
85
+ });
86
+
87
+ await storage.setSharedItem(
88
+ SCAN_MERGED_OBJ_ID_OUTPUT,
89
+ JSON.stringify({
90
+ ...mergedIdsOutput,
91
+ [prefixedMergedObjectiveId]: mergedIds,
92
+ })
93
+ );
94
+ }
95
+ } else {
96
+ const mergedIds: SCANNED_RECORD = {
97
+ success: [],
98
+ failure: [],
99
+ pending: [],
100
+ };
101
+ mergedObjectiveId.forEach((ids: string) => {
102
+ mergedIds.pending.push(ids);
103
+ });
104
+
105
+ await storage.setSharedItem(
106
+ SCAN_MERGED_OBJ_ID_OUTPUT,
107
+ JSON.stringify({
108
+ ...mergedIdsOutput,
109
+ [prefixedMergedObjectiveId]: mergedIds,
110
+ })
111
+ );
112
+ }
113
+
114
+ onTaskStart(
115
+ route.params[RouteParams.NEXT_STATES],
116
+ route.params[RouteParams.ROOT_META_DATA].customEventsData
117
+ );
118
+
119
+ const result = await DispatchExecutor.getScannedShipmentsCount(
120
+ mergedObjectiveId // need to define and pass to props
121
+ );
122
+
123
+ setInputs((prev: any) => ({
124
+ ...prev,
125
+ scanCountLimit: result ? result.totalCount : 0,
126
+ }));
127
+ })();
128
+ }, []);
129
+
130
+ return (
131
+ <ScanET
132
+ {...inputs}
133
+ scanToMerge={inputs.scanToMerge || false}
134
+ mergedObjectiveId={mergedObjectiveId}
135
+ taskMeta={taskMeta}
136
+ navigation={navigation}
137
+ route={route}
138
+ taskName={taskName}
139
+ showProgress={baseETProps.showProgress}
140
+ onSubmitET={async (etOutput: ScannerOutput) => {
141
+ let scanETOutput: any = etOutput;
142
+
143
+ await DispatchStateContainer.getInstance().navigateToNextTask(
144
+ navigation,
145
+ _route,
146
+ scanETOutput,
147
+ true,
148
+ EntityCode.SCAN,
149
+ ExecutionTaskID.SCAN,
150
+ baseETProps,
151
+ false,
152
+ true
153
+ );
154
+ }}
155
+ />
156
+ );
157
+ };
158
+
159
+ export default withBaseDispatchScreen(ScanScreen);
@@ -0,0 +1,233 @@
1
+ import withBaseDispatchScreen from './WithBaseDispatchScreen';
2
+ import { Platform, StyleSheet, Text, View } from 'react-native';
3
+ import React, { useCallback, useEffect } from 'react';
4
+ import DispatchStateContainer from '../../manager/dispatch/DispatchStateContainer';
5
+ import type { BaseETProps } from '../../models/DispatchModels';
6
+ import LocationManager from '../../manager/location/LocationManager';
7
+ import { EntityCode, ExecutionTaskID } from '../../models/execTasks/ETConfig';
8
+ import { getBaseETResponse, onTaskStart } from '../../utils/ExecTaskUtils';
9
+ import { getEventCodeByET } from '../../manager/dispatchCodes/EventCodeContainer';
10
+ import { RouteParams } from '../uiConfig/RouteParams';
11
+ import { isMandatoryKeysPresent } from '../../utils/utils';
12
+ import Logger, { LOG_TYPE } from '../../utils/Logger';
13
+ import SdkUtils from '../../utils/SdkUtils';
14
+ import { showAlert } from '../../components/widgets/AlertDisplay';
15
+ import ErrorCodes, { MultiObjectiveError } from '../../errors/ErrorCodes';
16
+ import NativeSyncManager from '../../manager/syncmanager/NativeSyncManager';
17
+ import AppSyncManager from '../../manager/syncmanager/AppSyncManager';
18
+ import {
19
+ IDispatch,
20
+ IDispatchExecutor,
21
+ } from '@os1-platform/platform-coreos-execution-engine-sdk';
22
+
23
+ const instance = DispatchStateContainer.getInstance();
24
+ const TAG = 'StartWorkFlowScreen';
25
+
26
+ const StartWorkFlowScreen = ({
27
+ baseETProps,
28
+ route,
29
+ navigation,
30
+ }: {
31
+ baseETProps: BaseETProps;
32
+ route: any;
33
+ navigation: any;
34
+ }) => {
35
+ const showAlertMessage = useCallback(
36
+ (errorMessage: string, title: string) => {
37
+ showAlert(title, errorMessage, false, 'OK', () => {
38
+ navigation.goBack();
39
+ });
40
+ },
41
+ [navigation]
42
+ );
43
+ const navigateWithError = useCallback(
44
+ (errorCode: string, errorMessage: string) => {
45
+ if (route.params.initRoute) {
46
+ navigation.navigate({
47
+ name: route.params.initRoute,
48
+ params: { sdkError: { code: errorCode, message: errorMessage } },
49
+ merge: true,
50
+ });
51
+ } else {
52
+ showAlertMessage(errorMessage, 'Error');
53
+ }
54
+ },
55
+ [navigation, route.params.initRoute, showAlertMessage]
56
+ );
57
+ useEffect(() => {
58
+ (async () => {
59
+ try {
60
+ baseETProps.showProgress(true);
61
+ await SdkUtils.checkMandatory();
62
+ if (await LocationManager.getInstance().checkForLocationPermissions()) {
63
+ if (
64
+ !isMandatoryKeysPresent(route.params, [
65
+ 'success',
66
+ // 'objectives',
67
+ 'successRoute',
68
+ 'failureRoute',
69
+ 'mergedWI',
70
+ ])
71
+ ) {
72
+ navigateWithError(
73
+ ErrorCodes.InvalidArgumentError,
74
+ 'Missing or Invalid Route Params'
75
+ );
76
+ return;
77
+ }
78
+ if (Platform.OS === 'android') {
79
+ NativeSyncManager.stopSyncManager();
80
+ AppSyncManager.getInstance().isForceStartEnabled = false;
81
+ AppSyncManager.getInstance().isSyncActive = true;
82
+ }
83
+
84
+ instance.setSuccessRoute(route.params.successRoute);
85
+ instance.setFailureRoute(route.params.failureRoute);
86
+ // instance._jobObjectives = route.params.objectives;
87
+ /**
88
+ * Clear all prev state and Map before starting new objective / Merged Objective
89
+ */
90
+ instance.stateKeys = [];
91
+ instance.mappedStates.clear();
92
+ /* let nextStateList = await instance.bulkQueryNextET(
93
+ route.params.objectives
94
+ ); */
95
+
96
+ // const statusFilter =
97
+ // route.params.mergedWI.statusFilter.indexOf(
98
+ // IDispatchExecutor.ExecutionStatus.COMPLETED_FAILURE
99
+ // ) === -1
100
+ // ? route.params.mergedWI.statusFilter
101
+ // : [
102
+ // IDispatchExecutor.ExecutionStatus.READY,
103
+ // IDispatchExecutor.ExecutionStatus.IN_PROGRESS,
104
+ // ];
105
+ const statusFilter = route.params.mergedWI.statusFilter;
106
+
107
+ const prefixedMergedObjectiveId: string = route.params.mergedWI.mwId;
108
+ let nextStateData: IDispatch.IExecutionTaskQueryResponse = (
109
+ await instance.queryNextET(
110
+ [prefixedMergedObjectiveId],
111
+ statusFilter
112
+ )
113
+ )[0];
114
+
115
+ let updatedStatusFilter: IDispatchExecutor.ExecutionStatus[] = [];
116
+
117
+ if (
118
+ statusFilter.includes(
119
+ `${IDispatchExecutor.ExecutionStatus.COMPLETED_FAILURE}`
120
+ )
121
+ ) {
122
+ route.params.mergedWI.statusFilter = [
123
+ IDispatchExecutor.ExecutionStatus.READY,
124
+ IDispatchExecutor.ExecutionStatus.IN_PROGRESS,
125
+ ];
126
+ updatedStatusFilter = [
127
+ IDispatchExecutor.ExecutionStatus.READY,
128
+ IDispatchExecutor.ExecutionStatus.IN_PROGRESS,
129
+ ];
130
+ } else {
131
+ updatedStatusFilter = [...statusFilter];
132
+ }
133
+
134
+ route.params[RouteParams.ROOT_META_DATA] = {
135
+ meta: route.params.meta || {},
136
+ customEventsData: route.params.mergedWI.customEventsData,
137
+ statusFilter: updatedStatusFilter,
138
+ prefixedMergedObjectiveId,
139
+ };
140
+
141
+ // if (nextStateList != null && nextStateList.length > 0) {
142
+ if (nextStateData != null && Object.keys(nextStateData).length > 0) {
143
+ /* const wfMeta = JSON.parse(
144
+ nextStateList[0].nextState.data?.wfMeta || '{}'
145
+ ); */
146
+
147
+ const wfMeta = nextStateData.meta?.workflow;
148
+ if (
149
+ wfMeta?.enableMultiObjectiveFlow !== undefined &&
150
+ wfMeta?.enableMultiObjectiveFlow === false
151
+ ) {
152
+ navigateWithError(
153
+ ErrorCodes.MULTI_OBJECTIVE_ERROR,
154
+ MultiObjectiveError
155
+ );
156
+ }
157
+ if (nextStateData.taskId === ExecutionTaskID.START_WORKFLOW) {
158
+ const mergedObjectiveIds = nextStateData.mergedObjectiveIds;
159
+ onTaskStart(
160
+ nextStateData,
161
+ route.params[RouteParams.ROOT_META_DATA].customEventsData
162
+ );
163
+ const _input: any = nextStateData.input;
164
+ const _appRC = route.params.success
165
+ ? _input?.applicableReasons?.success
166
+ : _input?.applicableReasons?.failure;
167
+ let etResponse = {
168
+ ...(await getBaseETResponse(
169
+ EntityCode.START_WORKFLOW,
170
+ route.params.success,
171
+ getEventCodeByET(
172
+ ExecutionTaskID.START_WORKFLOW,
173
+ route.params.success,
174
+ _appRC
175
+ ),
176
+ '',
177
+ mergedObjectiveIds,
178
+ ExecutionTaskID.START_WORKFLOW
179
+ )),
180
+ };
181
+
182
+ route.params[RouteParams.NEXT_STATES] = nextStateData;
183
+ await instance.navigateToNextTask(
184
+ navigation,
185
+ route,
186
+ etResponse,
187
+ route.params.success,
188
+ EntityCode.START_WORKFLOW,
189
+ ExecutionTaskID.START_WORKFLOW,
190
+ baseETProps,
191
+ false
192
+ );
193
+ } else {
194
+ let rParams: any = {};
195
+ rParams[RouteParams.NEXT_STATES] = nextStateData;
196
+ rParams[RouteParams.ROOT_META_DATA] =
197
+ route.params[RouteParams.ROOT_META_DATA];
198
+ navigation.replace(nextStateData.taskId, rParams);
199
+ }
200
+ } else {
201
+ navigateWithError(
202
+ ErrorCodes.EXECUTION_ENGINE_ERROR,
203
+ 'Unable to start the given objective'
204
+ );
205
+ }
206
+ } else {
207
+ navigateWithError(
208
+ ErrorCodes.LOCATION_PERMISSION_DENIED,
209
+ 'Please enable Location permissions'
210
+ );
211
+ }
212
+ } catch (error: any) {
213
+ baseETProps.showProgress(false);
214
+ navigateWithError(ErrorCodes.UNEXPECTED_ERROR, error.message);
215
+ Logger.getInstance().logEvent(TAG, error.message, LOG_TYPE.SDK_ERROR);
216
+ }
217
+ })();
218
+ }, []);
219
+ return (
220
+ <View style={styles.container}>
221
+ <Text>Please wait...</Text>
222
+ </View>
223
+ );
224
+ };
225
+ export default withBaseDispatchScreen(StartWorkFlowScreen);
226
+
227
+ const styles = StyleSheet.create({
228
+ container: {
229
+ flex: 1,
230
+ justifyContent: 'center',
231
+ alignItems: 'center',
232
+ },
233
+ });
@@ -0,0 +1,62 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import withBaseDispatchScreen from './WithBaseDispatchScreen';
3
+ import type { BaseETProps } from '../../models/DispatchModels';
4
+ import { EntityCode, ExecutionTaskID } from '../../models/execTasks/ETConfig';
5
+ import DispatchStateContainer from '../../manager/dispatch/DispatchStateContainer';
6
+ import { RouteParams, getDataFromNextState } from '../uiConfig/RouteParams';
7
+ import ValidateOTPET from '../../components/executiontasks/validateOTP/ValidateOTPET';
8
+ import { handleDynamicValues, onTaskStart } from '../../utils/ExecTaskUtils';
9
+
10
+ const ValidateOTPScreen = ({
11
+ route,
12
+ navigation,
13
+ baseETProps,
14
+ }: {
15
+ route: any;
16
+ navigation: any;
17
+ baseETProps: BaseETProps;
18
+ }) => {
19
+ const nextState = route.params[RouteParams.NEXT_STATES];
20
+ const { taskMeta, mergedObjectiveId, input, wfMeta } =
21
+ getDataFromNextState(nextState);
22
+ const message = input?.message;
23
+ const firstInput = input;
24
+ const [_input, setInputs] = useState({ ...firstInput });
25
+
26
+ useEffect(() => {
27
+ onTaskStart(
28
+ route.params[RouteParams.NEXT_STATES],
29
+ route.params[RouteParams.ROOT_META_DATA].customEventsData
30
+ );
31
+ if (route.params[RouteParams.ROOT_META_DATA]) {
32
+ const updatedInput = handleDynamicValues(
33
+ route?.params[RouteParams.NEXT_STATES].input,
34
+ route.params[RouteParams.ROOT_META_DATA]
35
+ );
36
+ setInputs(updatedInput);
37
+ }
38
+ }, []);
39
+
40
+ return (
41
+ <ValidateOTPET
42
+ {..._input}
43
+ mergedObjectiveId={mergedObjectiveId}
44
+ taskMeta={taskMeta}
45
+ message={message}
46
+ navigation={navigation}
47
+ onSubmitET={async (validateOtpOutput) => {
48
+ await DispatchStateContainer.getInstance().navigateToNextTask(
49
+ navigation,
50
+ route,
51
+ validateOtpOutput,
52
+ validateOtpOutput.success,
53
+ EntityCode.VALIDATE_OTP_ET,
54
+ ExecutionTaskID.VALIDATE_OTP_ET,
55
+ baseETProps,
56
+ false
57
+ );
58
+ }}
59
+ />
60
+ );
61
+ };
62
+ export default withBaseDispatchScreen(ValidateOTPScreen);
@@ -0,0 +1,33 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { StyleSheet, View } from 'react-native';
3
+ import type { BaseETProps } from '../../models/DispatchModels';
4
+ import ProgressDialog from '../../components/widgets/ProgressDialog';
5
+
6
+ const withBaseDispatchScreen = (WrappedComponent: any) => {
7
+ return (props: any) => {
8
+ const [loading, setLoading] = useState(false);
9
+ useEffect(() => {
10
+ setLoading(false);
11
+ return () => {
12
+ setLoading(false);
13
+ };
14
+ }, []);
15
+ let baseProps: BaseETProps = {
16
+ showProgress: setLoading,
17
+ };
18
+
19
+ return (
20
+ <View style={styles.mainContainer}>
21
+ <WrappedComponent {...props} baseETProps={baseProps} />
22
+ <ProgressDialog visible={loading} label={'Please wait...'} />
23
+ </View>
24
+ );
25
+ };
26
+ };
27
+ export default withBaseDispatchScreen;
28
+
29
+ const styles = StyleSheet.create({
30
+ mainContainer: {
31
+ flex: 1,
32
+ },
33
+ });
@@ -0,0 +1,28 @@
1
+ import { IDispatch } from '@os1-platform/platform-coreos-execution-engine-sdk';
2
+
3
+ export const RouteParams = {
4
+ NEXT_STATES: 'next_states',
5
+ REASONS: 'reason_list',
6
+ ET_SUCCESS: 'etkSuccess',
7
+ ET_SUCCESS_RESPONSE: 'etkSuccessResponse',
8
+ CURRENT_ET_NAME: 'currentETName',
9
+ IS_LAST_ET: 'isLastTask',
10
+ EVENT_CODES: 'event_list',
11
+ APPLICABLE_CODES: 'applicable_codes',
12
+ IS_MERGED_OBJ_BASED_OUTPUT: 'isJobBasedOutput',
13
+ ROOT_META_DATA: 'rootMetaData',
14
+ CANCEL_EVENT: 'cancel_event',
15
+ HAS_MULTIPLE_ET: 'has_multiple_ets',
16
+ };
17
+
18
+ export function getDataFromNextState(
19
+ nextState: IDispatch.IExecutionTaskQueryResponse
20
+ ) {
21
+ const taskName = nextState.taskName;
22
+ const input = nextState.input;
23
+ const taskMeta = JSON.parse(nextState.meta?.task || '{}'); //nextState.meta?.task || {}; //JSON.parse(nextState.meta?.task || '{}');
24
+ const mergedObjectiveId = nextState.mergedObjectiveIds;
25
+ const wfMeta = JSON.parse(nextState.meta?.workflow || '{}'); //nextState.meta?.workflow || {}; //JSON.parse(nextState.meta?.workflow || '{}');
26
+
27
+ return { input, taskMeta, mergedObjectiveId, wfMeta, taskName };
28
+ }
@@ -0,0 +1,157 @@
1
+ import axios, { AxiosRequestConfig } from 'axios';
2
+ import { API_CONFIG } from '../constants/apiConstants';
3
+ import { getHeaders } from '../network/NetworkUtils';
4
+
5
+ export type HTTPMethod = 'PUT' | 'POST' | 'GET';
6
+ export type HeaderKey = string;
7
+ export type HeaderValue = string;
8
+ export type QueryParamKey = string;
9
+ export type QueryParamValue = string;
10
+ export type PathParamKey = string;
11
+ export type PathParamValue = string;
12
+
13
+ /**
14
+ * API headers
15
+ */
16
+ export type Headers = {
17
+ key?: HeaderKey;
18
+ value?: HeaderValue;
19
+ };
20
+
21
+ /**
22
+ * Query Params
23
+ */
24
+ export type QueryParams = {
25
+ key?: QueryParamKey;
26
+ value?: QueryParamValue;
27
+ };
28
+
29
+ /**
30
+ * Path Params
31
+ */
32
+ export type PathParams = {
33
+ key: PathParamKey;
34
+ value: PathParamValue;
35
+ };
36
+
37
+ /**
38
+ * request body object
39
+ */
40
+ export interface HTTPRequestBody {
41
+ [k: string]: unknown;
42
+ }
43
+
44
+ export interface APIData {
45
+ uri: string;
46
+ timeout?: number;
47
+ httpMethod: HTTPMethod;
48
+ headers?: Headers[];
49
+ requestBody?: HTTPRequestBody;
50
+ queryParams?: QueryParams[];
51
+ pathParams?: PathParams[];
52
+ responseJsonPath: string;
53
+ errorJsonPath: string;
54
+ }
55
+
56
+ export interface KeyValueArray {
57
+ key?: string;
58
+ value?: any;
59
+ }
60
+
61
+ export function getKeyValueFromArray() {
62
+ return (array?: KeyValueArray[]) => {
63
+ if (!array || array.length === 0) return {};
64
+ else {
65
+ const addItems: { [k: string]: any } = {};
66
+ array.forEach((item) => {
67
+ if (item.key && item.value)
68
+ addItems[item.key?.toLowerCase()] = item.value;
69
+ });
70
+ return addItems;
71
+ }
72
+ };
73
+ }
74
+
75
+ export const getAddHeaders = getKeyValueFromArray();
76
+ export const getQueryParams = getKeyValueFromArray();
77
+
78
+ export async function getApiResponse(apiData: APIData) {
79
+ let axiosConfig: AxiosRequestConfig = {
80
+ method: apiData.httpMethod,
81
+ timeout: apiData.timeout ?? API_CONFIG.timeout, // timeout in millis i.e 15s
82
+ url: apiData.uri,
83
+ headers: {
84
+ ...getAddHeaders(apiData.headers),
85
+ ...(await getHeaders('application/json')),
86
+ },
87
+ };
88
+
89
+ /**
90
+ * Path params example
91
+ * uri: {baseURI}/core/api/v1/dispatch-service/dispatches/{dispatchId}/jobs/{captureInput}
92
+ * pathParams: [
93
+ * {key:"baseURI",value:"https://delhivery.coreos-dev.fxtrt.io"},
94
+ * {key:"dispatchId",value:"dispatch:a62dc46d-9787-5b32-9b71-ff38bd1bdcae"},
95
+ * {key:"captureInput",value:"{{$.userInput.captureInput}}"}
96
+ * ]
97
+ */
98
+
99
+ if (apiData.pathParams) {
100
+ const params = apiData.pathParams;
101
+ params.forEach((param) => {
102
+ apiData.uri = apiData.uri.replace(`{${param.key}}`, param.value);
103
+ });
104
+ axiosConfig.url = apiData.uri;
105
+ }
106
+
107
+ /**
108
+ * Query params example
109
+ * uri: https://jsonplaceholder.typicode.com/comments
110
+ * queryParams: [
111
+ * {key:"postId",value:"{{$.userInput.captureInput}}"},
112
+ * ]
113
+ * finalURI: https://jsonplaceholder.typicode.com/comments?postId=1
114
+ */
115
+ if (apiData.queryParams) {
116
+ axiosConfig.params = { ...getQueryParams(apiData.queryParams) };
117
+ }
118
+
119
+ if (apiData.requestBody) {
120
+ axiosConfig.data = { ...apiData.requestBody };
121
+ }
122
+
123
+ return axios(axiosConfig);
124
+ }
125
+
126
+ export function parseBody(body: any, userInput: any) {
127
+ const requestBody = JSON.parse(JSON.stringify(body));
128
+ for (const key in requestBody) {
129
+ if (Object.prototype.hasOwnProperty.call(requestBody, key)) {
130
+ const value = requestBody[key];
131
+ if (typeof value === 'object') {
132
+ requestBody[key] = parseBody(value, userInput);
133
+ } else if (Array.isArray(value)) {
134
+ value.forEach((val) => {
135
+ requestBody[key] = parseBody(val, userInput);
136
+ });
137
+ } else {
138
+ const _userInputExpr = '$.userInput.';
139
+ if (typeof value === 'string' && value.includes(_userInputExpr)) {
140
+ const _userEnteredInput: string = value.split('.').pop() || '';
141
+ requestBody[key] = userInput[_userEnteredInput] || '';
142
+ }
143
+ }
144
+ }
145
+ }
146
+ return requestBody;
147
+ }
148
+
149
+ export function parseKeyValue(array: KeyValueArray[], userInput: any) {
150
+ return array.map((item) => {
151
+ const _userInputExpr = '$.userInput.';
152
+ if (item.value.includes(_userInputExpr)) {
153
+ const _userEnteredInput: string = item.value.split('.').pop() || '';
154
+ item.value = userInput[_userEnteredInput] || '';
155
+ }
156
+ });
157
+ }