@os1-platform/dispatch-mobile 1.0.7 → 1.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -26
- package/android/.gradle/6.8/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.8/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/configuration-cache/gc.properties +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/gradle.xml +13 -0
- package/android/.idea/misc.xml +4 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/.idea/workspace.xml +131 -0
- package/android/gradle.properties +1 -1
- package/android/local.properties +8 -0
- package/android/src/main/AndroidManifest.xml +0 -1
- package/lib/commonjs/components/dispatch/DispatchExecNavigator.js +46 -39
- package/lib/commonjs/components/dispatch/DispatchExecNavigator.js.map +1 -1
- package/lib/commonjs/components/executiontasks/ExecutionTasksIndex.js +14 -24
- package/lib/commonjs/components/executiontasks/ExecutionTasksIndex.js.map +1 -1
- package/lib/commonjs/components/executiontasks/cancellation/CancelET.js +142 -23
- package/lib/commonjs/components/executiontasks/cancellation/CancelET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/cancellation/CancellationSchema.js.map +1 -1
- package/lib/commonjs/components/executiontasks/captureInput/CaptureText.js +64 -16
- package/lib/commonjs/components/executiontasks/captureInput/CaptureText.js.map +1 -1
- package/lib/commonjs/components/executiontasks/deliver/DeliverET.js +6 -16
- package/lib/commonjs/components/executiontasks/deliver/DeliverET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js +68 -26
- package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/display/DisplayModalET.js +4 -13
- package/lib/commonjs/components/executiontasks/display/DisplayModalET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/doodle/DoodleUtils.js +0 -2
- package/lib/commonjs/components/executiontasks/doodle/DoodleUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/doodle/SignatureET.js +61 -28
- package/lib/commonjs/components/executiontasks/doodle/SignatureET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/dropCash/DropCashET.js +5 -19
- package/lib/commonjs/components/executiontasks/dropCash/DropCashET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js +62 -18
- package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/FormGenerator.js +112 -28
- package/lib/commonjs/components/executiontasks/forms/FormGenerator.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/widgets/DateTimeWidget.js +3 -26
- package/lib/commonjs/components/executiontasks/forms/widgets/DateTimeWidget.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/widgets/DropdownWidget.js +49 -0
- package/lib/commonjs/components/executiontasks/forms/widgets/DropdownWidget.js.map +1 -0
- package/lib/commonjs/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.js +1 -16
- package/lib/commonjs/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/widgets/TimeRangeSelector.js +0 -10
- package/lib/commonjs/components/executiontasks/forms/widgets/TimeRangeSelector.js.map +1 -1
- package/lib/commonjs/components/executiontasks/httpRequest/HttpEtUtils.js +4 -13
- package/lib/commonjs/components/executiontasks/httpRequest/HttpEtUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/httpRequest/HttpRequestET.js +0 -12
- package/lib/commonjs/components/executiontasks/httpRequest/HttpRequestET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/CaptureSchema.js.map +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js +7 -35
- package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js +74 -49
- package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/PaymentStyles.js +0 -4
- package/lib/commonjs/components/executiontasks/payments/PaymentStyles.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/PaymentUtils.js +0 -2
- package/lib/commonjs/components/executiontasks/payments/PaymentUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js +64 -17
- package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js +63 -24
- package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js +71 -22
- package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/pickup/PickupET.js +5 -15
- package/lib/commonjs/components/executiontasks/pickup/PickupET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js +60 -19
- package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/ScanET.js +843 -0
- package/lib/commonjs/components/executiontasks/scan/ScanET.js.map +1 -0
- package/lib/commonjs/components/executiontasks/scan/ScanSchema.js +6 -0
- package/lib/commonjs/components/executiontasks/scan/ScanSchema.js.map +1 -0
- package/lib/commonjs/components/executiontasks/scan/constants.js +19 -0
- package/lib/commonjs/components/executiontasks/scan/constants.js.map +1 -0
- package/lib/commonjs/components/executiontasks/scan/interfaces.js +29 -0
- package/lib/commonjs/components/executiontasks/scan/interfaces.js.map +1 -0
- package/lib/commonjs/components/executiontasks/scan/sub_components/CScanner.js +103 -0
- package/lib/commonjs/components/executiontasks/scan/sub_components/CScanner.js.map +1 -0
- package/lib/commonjs/components/executiontasks/scan/sub_components/DropDownUtils.js +74 -0
- package/lib/commonjs/components/executiontasks/scan/sub_components/DropDownUtils.js.map +1 -0
- package/lib/commonjs/components/executiontasks/scan/sub_components/ERDropDown.js +115 -0
- package/lib/commonjs/components/executiontasks/scan/sub_components/ERDropDown.js.map +1 -0
- package/lib/commonjs/components/executiontasks/scan/sub_components/ScanList.js +134 -0
- package/lib/commonjs/components/executiontasks/scan/sub_components/ScanList.js.map +1 -0
- package/lib/commonjs/components/executiontasks/scan/utils.js +373 -0
- package/lib/commonjs/components/executiontasks/scan/utils.js.map +1 -0
- package/lib/commonjs/components/executiontasks/scanner/CScanner.js +3 -21
- package/lib/commonjs/components/executiontasks/scanner/CScanner.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scanner/ScannerSchema.js +4 -9
- package/lib/commonjs/components/executiontasks/scanner/ScannerSchema.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scanner/ScannerUtils.js +7 -36
- package/lib/commonjs/components/executiontasks/scanner/ScannerUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scanner/returns/DropDownSelector.js +0 -5
- package/lib/commonjs/components/executiontasks/scanner/returns/DropDownSelector.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scanner/returns/DropDownUtils.js +0 -9
- package/lib/commonjs/components/executiontasks/scanner/returns/DropDownUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scanner/returns/RTReasonSelection.js +0 -14
- package/lib/commonjs/components/executiontasks/scanner/returns/RTReasonSelection.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scanner/returns/RTScan.js +1 -40
- package/lib/commonjs/components/executiontasks/scanner/returns/RTScan.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scanner/returns/ReasonDropDown.js +0 -17
- package/lib/commonjs/components/executiontasks/scanner/returns/ReasonDropDown.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scanner/returns/ScanList.js +0 -28
- package/lib/commonjs/components/executiontasks/scanner/returns/ScanList.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js +334 -0
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -0
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js +14 -0
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -0
- package/lib/commonjs/components/executiontasks/validateOTP/constants.js +37 -0
- package/lib/commonjs/components/executiontasks/validateOTP/constants.js.map +1 -0
- package/lib/commonjs/components/executiontasks/validateOTP/sub-components/OTPInput.js +59 -0
- package/lib/commonjs/components/executiontasks/validateOTP/sub-components/OTPInput.js.map +1 -0
- package/lib/commonjs/components/executiontasks/validateOTP/utils.js +147 -0
- package/lib/commonjs/components/executiontasks/validateOTP/utils.js.map +1 -0
- package/lib/commonjs/components/executiontasks/verifyLocation/GeofenceUtils.js +0 -13
- package/lib/commonjs/components/executiontasks/verifyLocation/GeofenceUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/verifyLocation/VerifyLocationET.js +4 -17
- package/lib/commonjs/components/executiontasks/verifyLocation/VerifyLocationET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/verifyOtp/VerifyOtpET.js +3 -18
- package/lib/commonjs/components/executiontasks/verifyOtp/VerifyOtpET.js.map +1 -1
- package/lib/commonjs/components/widgets/AlertDisplay.js +0 -5
- package/lib/commonjs/components/widgets/AlertDisplay.js.map +1 -1
- package/lib/commonjs/components/widgets/CancelOrderDialog.js +0 -12
- package/lib/commonjs/components/widgets/CancelOrderDialog.js.map +1 -1
- package/lib/commonjs/components/widgets/IconButton.js +34 -0
- package/lib/commonjs/components/widgets/IconButton.js.map +1 -0
- package/lib/commonjs/components/widgets/ProgressDialog.js +0 -7
- package/lib/commonjs/components/widgets/ProgressDialog.js.map +1 -1
- package/lib/commonjs/components/widgets/SnackBarCustom.js +38 -38
- package/lib/commonjs/components/widgets/SnackBarCustom.js.map +1 -1
- package/lib/commonjs/components/widgets/SplitTextInput.js +93 -0
- package/lib/commonjs/components/widgets/SplitTextInput.js.map +1 -0
- package/lib/commonjs/components/widgets/Toaster.js +0 -2
- package/lib/commonjs/components/widgets/Toaster.js.map +1 -1
- package/lib/commonjs/config/DispatchSDKConfig.js +4 -5
- package/lib/commonjs/config/DispatchSDKConfig.js.map +1 -1
- package/lib/commonjs/constants/apiConstants.js +15 -0
- package/lib/commonjs/constants/apiConstants.js.map +1 -0
- package/lib/commonjs/constants/constants.js +7 -3
- package/lib/commonjs/constants/constants.js.map +1 -1
- package/lib/commonjs/constants/statuscode.js +3 -5
- package/lib/commonjs/constants/statuscode.js.map +1 -1
- package/lib/commonjs/errors/BaseError.js +3 -8
- package/lib/commonjs/errors/BaseError.js.map +1 -1
- package/lib/commonjs/errors/ErrorCodes.js +7 -6
- package/lib/commonjs/errors/ErrorCodes.js.map +1 -1
- package/lib/commonjs/events/EventDispatcher.js +27 -0
- package/lib/commonjs/events/EventDispatcher.js.map +1 -0
- package/lib/commonjs/events/EventListener.js +20 -0
- package/lib/commonjs/events/EventListener.js.map +1 -0
- package/lib/commonjs/events/constants.js +13 -0
- package/lib/commonjs/events/constants.js.map +1 -0
- package/lib/commonjs/events/index.js +11 -0
- package/lib/commonjs/events/index.js.map +1 -0
- package/lib/commonjs/events/interface.js +2 -0
- package/lib/commonjs/events/interface.js.map +1 -0
- package/lib/commonjs/index.js +9 -23
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/manager/dispatch/DispatchStateContainer.js +527 -177
- package/lib/commonjs/manager/dispatch/DispatchStateContainer.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/EventCodeContainer.js +55 -4
- package/lib/commonjs/manager/dispatchCodes/EventCodeContainer.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/EventCodeRepo.js +70 -0
- package/lib/commonjs/manager/dispatchCodes/EventCodeRepo.js.map +1 -0
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeContainer.js +3 -29
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeContainer.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeRepo.js +6 -20
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeRepo.js.map +1 -1
- package/lib/commonjs/manager/jobRemoval/JobRemovalManager.js +27 -0
- package/lib/commonjs/manager/jobRemoval/JobRemovalManager.js.map +1 -0
- package/lib/commonjs/manager/location/LocationManager.js +3 -20
- package/lib/commonjs/manager/location/LocationManager.js.map +1 -1
- package/lib/commonjs/manager/sdk/DispatchSDKManager.js +8 -36
- package/lib/commonjs/manager/sdk/DispatchSDKManager.js.map +1 -1
- package/lib/commonjs/manager/sdk/DispatchSdkCache.js +6 -17
- package/lib/commonjs/manager/sdk/DispatchSdkCache.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/AppSyncManager.js +12 -46
- package/lib/commonjs/manager/syncmanager/AppSyncManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/DBConfig.js +13 -7
- package/lib/commonjs/manager/syncmanager/DBConfig.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/NativeSyncManager.js +0 -2
- package/lib/commonjs/manager/syncmanager/NativeSyncManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/database.js +28 -12
- package/lib/commonjs/manager/syncmanager/database.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js +0 -19
- package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentManager.js +3 -20
- package/lib/commonjs/manager/syncmanager/document/DocumentManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js +3 -52
- package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js +59 -25
- package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/events/EventsSyncManager.js +77 -90
- package/lib/commonjs/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/events/SyncHttpClient.js +27 -19
- package/lib/commonjs/manager/syncmanager/events/SyncHttpClient.js.map +1 -1
- package/lib/commonjs/models/DispatchModels.js +4 -5
- package/lib/commonjs/models/DispatchModels.js.map +1 -1
- package/lib/commonjs/models/ReasonCodes.js.map +1 -1
- package/lib/commonjs/models/execTasks/ETBaseModels.js.map +1 -1
- package/lib/commonjs/models/execTasks/ETConfig.js +28 -35
- package/lib/commonjs/models/execTasks/ETConfig.js.map +1 -1
- package/lib/commonjs/models/sdk.js +4 -5
- package/lib/commonjs/models/sdk.js.map +1 -1
- package/lib/commonjs/native/signature/SignatureCapture.js +3 -24
- package/lib/commonjs/native/signature/SignatureCapture.js.map +1 -1
- package/lib/commonjs/network/GraphQLClient.js +7 -35
- package/lib/commonjs/network/GraphQLClient.js.map +1 -1
- package/lib/commonjs/network/NetworkClient.js +2 -13
- package/lib/commonjs/network/NetworkClient.js.map +1 -1
- package/lib/commonjs/network/NetworkUtils.js +10 -8
- package/lib/commonjs/network/NetworkUtils.js.map +1 -1
- package/lib/commonjs/network/Queries.js +0 -2
- package/lib/commonjs/network/Queries.js.map +1 -1
- package/lib/commonjs/network/client.js +6 -21
- package/lib/commonjs/network/client.js.map +1 -1
- package/lib/commonjs/res/strings.js.map +1 -1
- package/lib/commonjs/resources/Login.js +4 -15
- package/lib/commonjs/resources/Login.js.map +1 -1
- package/lib/commonjs/resources/network.js +3 -8
- package/lib/commonjs/resources/network.js.map +1 -1
- package/lib/commonjs/styles/SdkColors.js +7 -7
- package/lib/commonjs/styles/SdkColors.js.map +1 -1
- package/lib/commonjs/styles/executionTasks/CommonStyles.js +42 -18
- package/lib/commonjs/styles/executionTasks/CommonStyles.js.map +1 -1
- package/lib/commonjs/ui/screens/CancellationScreen.js +36 -27
- package/lib/commonjs/ui/screens/CancellationScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CaptureInputScreen.js +6 -15
- package/lib/commonjs/ui/screens/CaptureInputScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CompleteObjectiveScreen.js +0 -19
- package/lib/commonjs/ui/screens/CompleteObjectiveScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/DeliverScreen.js +6 -15
- package/lib/commonjs/ui/screens/DeliverScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/DisplayScreen.js +7 -12
- package/lib/commonjs/ui/screens/DisplayScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/DoodleScreen.js +6 -16
- package/lib/commonjs/ui/screens/DoodleScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/DropCashScreen.js +6 -18
- package/lib/commonjs/ui/screens/DropCashScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ETScreensIndex.js +14 -16
- package/lib/commonjs/ui/screens/ETScreensIndex.js.map +1 -1
- package/lib/commonjs/ui/screens/FormsScreen.js +36 -15
- package/lib/commonjs/ui/screens/FormsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/GeofenceScreen.js +7 -13
- package/lib/commonjs/ui/screens/GeofenceScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HttpRequestScreen.js +5 -10
- package/lib/commonjs/ui/screens/HttpRequestScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ImageCaptureScreen.js +27 -14
- package/lib/commonjs/ui/screens/ImageCaptureScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentScreen.js +11 -23
- package/lib/commonjs/ui/screens/PaymentScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PickupScreen.js +9 -13
- package/lib/commonjs/ui/screens/PickupScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/RTScanScreen.js +8 -27
- package/lib/commonjs/ui/screens/RTScanScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ScanScreen.js +268 -0
- package/lib/commonjs/ui/screens/ScanScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/StartWorkFlowScreen.js +21 -30
- package/lib/commonjs/ui/screens/StartWorkFlowScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ValidateOTPScreen.js +49 -0
- package/lib/commonjs/ui/screens/ValidateOTPScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/WithBaseDispatchScreen.js +0 -10
- package/lib/commonjs/ui/screens/WithBaseDispatchScreen.js.map +1 -1
- package/lib/commonjs/ui/uiConfig/RouteParams.js +9 -1
- package/lib/commonjs/ui/uiConfig/RouteParams.js.map +1 -1
- package/lib/commonjs/utils/ApiUtils.js +115 -0
- package/lib/commonjs/utils/ApiUtils.js.map +1 -0
- package/lib/commonjs/utils/ExecTaskUtils.js +93 -31
- package/lib/commonjs/utils/ExecTaskUtils.js.map +1 -1
- package/lib/commonjs/utils/Logger.js +10 -29
- package/lib/commonjs/utils/Logger.js.map +1 -1
- package/lib/commonjs/utils/NetworkUtil.js +3 -19
- package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
- package/lib/commonjs/utils/SdkUtils.js +2 -31
- package/lib/commonjs/utils/SdkUtils.js.map +1 -1
- package/lib/commonjs/utils/SyncManagerUtils.js +25 -40
- package/lib/commonjs/utils/SyncManagerUtils.js.map +1 -1
- package/lib/commonjs/utils/fcm/FCM.js +35 -16
- package/lib/commonjs/utils/fcm/FCM.js.map +1 -1
- package/lib/commonjs/utils/fcm/FcmUtils.js +50 -25
- package/lib/commonjs/utils/fcm/FcmUtils.js.map +1 -1
- package/lib/commonjs/utils/helper.js +0 -5
- package/lib/commonjs/utils/helper.js.map +1 -1
- package/lib/commonjs/utils/hooks/useTimer.js +44 -0
- package/lib/commonjs/utils/hooks/useTimer.js.map +1 -0
- package/lib/commonjs/utils/loginHelper.js +6 -18
- package/lib/commonjs/utils/loginHelper.js.map +1 -1
- package/lib/commonjs/utils/storage.js +53 -32
- package/lib/commonjs/utils/storage.js.map +1 -1
- package/lib/commonjs/utils/utils.js +8 -11
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/module/components/dispatch/DispatchExecNavigator.js +46 -28
- package/lib/module/components/dispatch/DispatchExecNavigator.js.map +1 -1
- package/lib/module/components/executiontasks/ExecutionTasksIndex.js +3 -1
- package/lib/module/components/executiontasks/ExecutionTasksIndex.js.map +1 -1
- package/lib/module/components/executiontasks/cancellation/CancelET.js +145 -19
- package/lib/module/components/executiontasks/cancellation/CancelET.js.map +1 -1
- package/lib/module/components/executiontasks/cancellation/CancellationSchema.js.map +1 -1
- package/lib/module/components/executiontasks/captureInput/CaptureText.js +66 -9
- package/lib/module/components/executiontasks/captureInput/CaptureText.js.map +1 -1
- package/lib/module/components/executiontasks/deliver/DeliverET.js +6 -7
- package/lib/module/components/executiontasks/deliver/DeliverET.js.map +1 -1
- package/lib/module/components/executiontasks/deliver/SLDeliverET.js +69 -16
- package/lib/module/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
- package/lib/module/components/executiontasks/display/DisplayModalET.js +4 -3
- package/lib/module/components/executiontasks/display/DisplayModalET.js.map +1 -1
- package/lib/module/components/executiontasks/doodle/DoodleUtils.js.map +1 -1
- package/lib/module/components/executiontasks/doodle/SignatureET.js +64 -14
- package/lib/module/components/executiontasks/doodle/SignatureET.js.map +1 -1
- package/lib/module/components/executiontasks/dropCash/DropCashET.js +5 -6
- package/lib/module/components/executiontasks/dropCash/DropCashET.js.map +1 -1
- package/lib/module/components/executiontasks/dropCash/SLDropCash.js +62 -8
- package/lib/module/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
- package/lib/module/components/executiontasks/forms/FormGenerator.js +114 -14
- package/lib/module/components/executiontasks/forms/FormGenerator.js.map +1 -1
- package/lib/module/components/executiontasks/forms/widgets/DateTimeWidget.js +3 -15
- package/lib/module/components/executiontasks/forms/widgets/DateTimeWidget.js.map +1 -1
- package/lib/module/components/executiontasks/forms/widgets/DropdownWidget.js +39 -0
- package/lib/module/components/executiontasks/forms/widgets/DropdownWidget.js.map +1 -0
- package/lib/module/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.js +1 -5
- package/lib/module/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.js.map +1 -1
- package/lib/module/components/executiontasks/forms/widgets/TimeRangeSelector.js +0 -3
- package/lib/module/components/executiontasks/forms/widgets/TimeRangeSelector.js.map +1 -1
- package/lib/module/components/executiontasks/httpRequest/HttpEtUtils.js +4 -2
- package/lib/module/components/executiontasks/httpRequest/HttpEtUtils.js.map +1 -1
- package/lib/module/components/executiontasks/httpRequest/HttpRequestET.js +0 -3
- package/lib/module/components/executiontasks/httpRequest/HttpRequestET.js.map +1 -1
- package/lib/module/components/executiontasks/imageCapture/CaptureSchema.js.map +1 -1
- package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js +7 -10
- package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
- package/lib/module/components/executiontasks/imageCapture/ImageCapture.js +75 -35
- package/lib/module/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
- package/lib/module/components/executiontasks/payments/PaymentStyles.js.map +1 -1
- package/lib/module/components/executiontasks/payments/PaymentUtils.js.map +1 -1
- package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js +64 -6
- package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
- package/lib/module/components/executiontasks/payments/init/InitPaymentET.js +63 -11
- package/lib/module/components/executiontasks/payments/init/InitPaymentET.js.map +1 -1
- package/lib/module/components/executiontasks/payments/processPayment/ProcessPaymentET.js +71 -10
- package/lib/module/components/executiontasks/payments/processPayment/ProcessPaymentET.js.map +1 -1
- package/lib/module/components/executiontasks/pickup/PickupET.js +5 -6
- package/lib/module/components/executiontasks/pickup/PickupET.js.map +1 -1
- package/lib/module/components/executiontasks/pickup/SLPickupET.js +61 -10
- package/lib/module/components/executiontasks/pickup/SLPickupET.js.map +1 -1
- package/lib/module/components/executiontasks/scan/ScanET.js +833 -0
- package/lib/module/components/executiontasks/scan/ScanET.js.map +1 -0
- package/lib/module/components/executiontasks/scan/ScanSchema.js +2 -0
- package/lib/module/components/executiontasks/scan/ScanSchema.js.map +1 -0
- package/lib/module/components/executiontasks/scan/constants.js +7 -0
- package/lib/module/components/executiontasks/scan/constants.js.map +1 -0
- package/lib/module/components/executiontasks/scan/interfaces.js +21 -0
- package/lib/module/components/executiontasks/scan/interfaces.js.map +1 -0
- package/lib/module/components/executiontasks/scan/sub_components/CScanner.js +94 -0
- package/lib/module/components/executiontasks/scan/sub_components/CScanner.js.map +1 -0
- package/lib/module/components/executiontasks/scan/sub_components/DropDownUtils.js +66 -0
- package/lib/module/components/executiontasks/scan/sub_components/DropDownUtils.js.map +1 -0
- package/lib/module/components/executiontasks/scan/sub_components/ERDropDown.js +105 -0
- package/lib/module/components/executiontasks/scan/sub_components/ERDropDown.js.map +1 -0
- package/lib/module/components/executiontasks/scan/sub_components/ScanList.js +124 -0
- package/lib/module/components/executiontasks/scan/sub_components/ScanList.js.map +1 -0
- package/lib/module/components/executiontasks/scan/utils.js +358 -0
- package/lib/module/components/executiontasks/scan/utils.js.map +1 -0
- package/lib/module/components/executiontasks/scanner/CScanner.js +3 -8
- package/lib/module/components/executiontasks/scanner/CScanner.js.map +1 -1
- package/lib/module/components/executiontasks/scanner/ScannerSchema.js +3 -3
- package/lib/module/components/executiontasks/scanner/ScannerSchema.js.map +1 -1
- package/lib/module/components/executiontasks/scanner/ScannerUtils.js +6 -18
- package/lib/module/components/executiontasks/scanner/ScannerUtils.js.map +1 -1
- package/lib/module/components/executiontasks/scanner/returns/DropDownSelector.js +0 -2
- package/lib/module/components/executiontasks/scanner/returns/DropDownSelector.js.map +1 -1
- package/lib/module/components/executiontasks/scanner/returns/DropDownUtils.js +0 -5
- package/lib/module/components/executiontasks/scanner/returns/DropDownUtils.js.map +1 -1
- package/lib/module/components/executiontasks/scanner/returns/RTReasonSelection.js +0 -3
- package/lib/module/components/executiontasks/scanner/returns/RTReasonSelection.js.map +1 -1
- package/lib/module/components/executiontasks/scanner/returns/RTScan.js +1 -19
- package/lib/module/components/executiontasks/scanner/returns/RTScan.js.map +1 -1
- package/lib/module/components/executiontasks/scanner/returns/ReasonDropDown.js +0 -7
- package/lib/module/components/executiontasks/scanner/returns/ReasonDropDown.js.map +1 -1
- package/lib/module/components/executiontasks/scanner/returns/ScanList.js +0 -15
- package/lib/module/components/executiontasks/scanner/returns/ScanList.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js +325 -0
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -0
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPSchema.js +8 -0
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -0
- package/lib/module/components/executiontasks/validateOTP/constants.js +25 -0
- package/lib/module/components/executiontasks/validateOTP/constants.js.map +1 -0
- package/lib/module/components/executiontasks/validateOTP/sub-components/OTPInput.js +49 -0
- package/lib/module/components/executiontasks/validateOTP/sub-components/OTPInput.js.map +1 -0
- package/lib/module/components/executiontasks/validateOTP/utils.js +133 -0
- package/lib/module/components/executiontasks/validateOTP/utils.js.map +1 -0
- package/lib/module/components/executiontasks/verifyLocation/GeofenceUtils.js +0 -6
- package/lib/module/components/executiontasks/verifyLocation/GeofenceUtils.js.map +1 -1
- package/lib/module/components/executiontasks/verifyLocation/VerifyLocationET.js +4 -3
- package/lib/module/components/executiontasks/verifyLocation/VerifyLocationET.js.map +1 -1
- package/lib/module/components/executiontasks/verifyOtp/VerifyOtpET.js +4 -8
- package/lib/module/components/executiontasks/verifyOtp/VerifyOtpET.js.map +1 -1
- package/lib/module/components/widgets/AlertDisplay.js.map +1 -1
- package/lib/module/components/widgets/CancelOrderDialog.js +0 -2
- package/lib/module/components/widgets/CancelOrderDialog.js.map +1 -1
- package/lib/module/components/widgets/IconButton.js +26 -0
- package/lib/module/components/widgets/IconButton.js.map +1 -0
- package/lib/module/components/widgets/ProgressDialog.js +0 -2
- package/lib/module/components/widgets/ProgressDialog.js.map +1 -1
- package/lib/module/components/widgets/SnackBarCustom.js +36 -18
- package/lib/module/components/widgets/SnackBarCustom.js.map +1 -1
- package/lib/module/components/widgets/SplitTextInput.js +84 -0
- package/lib/module/components/widgets/SplitTextInput.js.map +1 -0
- package/lib/module/components/widgets/Toaster.js.map +1 -1
- package/lib/module/config/DispatchSDKConfig.js +3 -4
- package/lib/module/config/DispatchSDKConfig.js.map +1 -1
- package/lib/module/constants/apiConstants.js +7 -0
- package/lib/module/constants/apiConstants.js.map +1 -0
- package/lib/module/constants/constants.js +4 -2
- package/lib/module/constants/constants.js.map +1 -1
- package/lib/module/constants/statuscode.js +3 -5
- package/lib/module/constants/statuscode.js.map +1 -1
- package/lib/module/errors/BaseError.js +3 -6
- package/lib/module/errors/BaseError.js.map +1 -1
- package/lib/module/errors/ErrorCodes.js +5 -5
- package/lib/module/errors/ErrorCodes.js.map +1 -1
- package/lib/module/events/EventDispatcher.js +19 -0
- package/lib/module/events/EventDispatcher.js.map +1 -0
- package/lib/module/events/EventListener.js +13 -0
- package/lib/module/events/EventListener.js.map +1 -0
- package/lib/module/events/constants.js +6 -0
- package/lib/module/events/constants.js.map +1 -0
- package/lib/module/events/index.js +3 -0
- package/lib/module/events/index.js.map +1 -0
- package/lib/module/events/interface.js +2 -0
- package/lib/module/events/interface.js.map +1 -0
- package/lib/module/index.js +4 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/manager/dispatch/DispatchStateContainer.js +529 -151
- package/lib/module/manager/dispatch/DispatchStateContainer.js.map +1 -1
- package/lib/module/manager/dispatchCodes/EventCodeContainer.js +52 -2
- package/lib/module/manager/dispatchCodes/EventCodeContainer.js.map +1 -1
- package/lib/module/manager/dispatchCodes/EventCodeRepo.js +61 -0
- package/lib/module/manager/dispatchCodes/EventCodeRepo.js.map +1 -0
- package/lib/module/manager/dispatchCodes/ReasonCodeContainer.js +3 -16
- package/lib/module/manager/dispatchCodes/ReasonCodeContainer.js.map +1 -1
- package/lib/module/manager/dispatchCodes/ReasonCodeRepo.js +6 -14
- package/lib/module/manager/dispatchCodes/ReasonCodeRepo.js.map +1 -1
- package/lib/module/manager/jobRemoval/JobRemovalManager.js +20 -0
- package/lib/module/manager/jobRemoval/JobRemovalManager.js.map +1 -0
- package/lib/module/manager/location/LocationManager.js +3 -14
- package/lib/module/manager/location/LocationManager.js.map +1 -1
- package/lib/module/manager/sdk/DispatchSDKManager.js +8 -14
- package/lib/module/manager/sdk/DispatchSDKManager.js.map +1 -1
- package/lib/module/manager/sdk/DispatchSdkCache.js +6 -13
- package/lib/module/manager/sdk/DispatchSdkCache.js.map +1 -1
- package/lib/module/manager/syncmanager/AppSyncManager.js +12 -26
- package/lib/module/manager/syncmanager/AppSyncManager.js.map +1 -1
- package/lib/module/manager/syncmanager/DBConfig.js +9 -5
- package/lib/module/manager/syncmanager/DBConfig.js.map +1 -1
- package/lib/module/manager/syncmanager/NativeSyncManager.js.map +1 -1
- package/lib/module/manager/syncmanager/database.js +27 -3
- package/lib/module/manager/syncmanager/database.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentHttpClient.js +0 -7
- package/lib/module/manager/syncmanager/document/DocumentHttpClient.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentManager.js +3 -14
- package/lib/module/manager/syncmanager/document/DocumentManager.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentSyncManager.js +3 -35
- package/lib/module/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
- package/lib/module/manager/syncmanager/events/ETEventsManager.js +59 -18
- package/lib/module/manager/syncmanager/events/ETEventsManager.js.map +1 -1
- package/lib/module/manager/syncmanager/events/EventsSyncManager.js +77 -68
- package/lib/module/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
- package/lib/module/manager/syncmanager/events/SyncHttpClient.js +26 -11
- package/lib/module/manager/syncmanager/events/SyncHttpClient.js.map +1 -1
- package/lib/module/models/DispatchModels.js +3 -4
- package/lib/module/models/DispatchModels.js.map +1 -1
- package/lib/module/models/ReasonCodes.js.map +1 -1
- package/lib/module/models/execTasks/ETBaseModels.js.map +1 -1
- package/lib/module/models/execTasks/ETConfig.js +22 -29
- package/lib/module/models/execTasks/ETConfig.js.map +1 -1
- package/lib/module/models/sdk.js +3 -4
- package/lib/module/models/sdk.js.map +1 -1
- package/lib/module/native/signature/SignatureCapture.js +3 -18
- package/lib/module/native/signature/SignatureCapture.js.map +1 -1
- package/lib/module/network/GraphQLClient.js +6 -26
- package/lib/module/network/GraphQLClient.js.map +1 -1
- package/lib/module/network/NetworkClient.js +2 -6
- package/lib/module/network/NetworkClient.js.map +1 -1
- package/lib/module/network/NetworkUtils.js +10 -3
- package/lib/module/network/NetworkUtils.js.map +1 -1
- package/lib/module/network/Queries.js.map +1 -1
- package/lib/module/network/client.js +7 -17
- package/lib/module/network/client.js.map +1 -1
- package/lib/module/res/strings.js.map +1 -1
- package/lib/module/resources/Login.js +4 -13
- package/lib/module/resources/Login.js.map +1 -1
- package/lib/module/resources/network.js +3 -6
- package/lib/module/resources/network.js.map +1 -1
- package/lib/module/styles/SdkColors.js +6 -6
- package/lib/module/styles/SdkColors.js.map +1 -1
- package/lib/module/styles/executionTasks/CommonStyles.js +41 -7
- package/lib/module/styles/executionTasks/CommonStyles.js.map +1 -1
- package/lib/module/ui/screens/CancellationScreen.js +36 -14
- package/lib/module/ui/screens/CancellationScreen.js.map +1 -1
- package/lib/module/ui/screens/CaptureInputScreen.js +7 -4
- package/lib/module/ui/screens/CaptureInputScreen.js.map +1 -1
- package/lib/module/ui/screens/CompleteObjectiveScreen.js +0 -3
- package/lib/module/ui/screens/CompleteObjectiveScreen.js.map +1 -1
- package/lib/module/ui/screens/DeliverScreen.js +7 -4
- package/lib/module/ui/screens/DeliverScreen.js.map +1 -1
- package/lib/module/ui/screens/DisplayScreen.js +5 -4
- package/lib/module/ui/screens/DisplayScreen.js.map +1 -1
- package/lib/module/ui/screens/DoodleScreen.js +7 -4
- package/lib/module/ui/screens/DoodleScreen.js.map +1 -1
- package/lib/module/ui/screens/DropCashScreen.js +7 -7
- package/lib/module/ui/screens/DropCashScreen.js.map +1 -1
- package/lib/module/ui/screens/ETScreensIndex.js +3 -1
- package/lib/module/ui/screens/ETScreensIndex.js.map +1 -1
- package/lib/module/ui/screens/FormsScreen.js +34 -6
- package/lib/module/ui/screens/FormsScreen.js.map +1 -1
- package/lib/module/ui/screens/GeofenceScreen.js +5 -4
- package/lib/module/ui/screens/GeofenceScreen.js.map +1 -1
- package/lib/module/ui/screens/HttpRequestScreen.js +5 -3
- package/lib/module/ui/screens/HttpRequestScreen.js.map +1 -1
- package/lib/module/ui/screens/ImageCaptureScreen.js +25 -5
- package/lib/module/ui/screens/ImageCaptureScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentScreen.js +12 -10
- package/lib/module/ui/screens/PaymentScreen.js.map +1 -1
- package/lib/module/ui/screens/PickupScreen.js +7 -5
- package/lib/module/ui/screens/PickupScreen.js.map +1 -1
- package/lib/module/ui/screens/RTScanScreen.js +9 -13
- package/lib/module/ui/screens/RTScanScreen.js.map +1 -1
- package/lib/module/ui/screens/ScanScreen.js +259 -0
- package/lib/module/ui/screens/ScanScreen.js.map +1 -0
- package/lib/module/ui/screens/StartWorkFlowScreen.js +22 -9
- package/lib/module/ui/screens/StartWorkFlowScreen.js.map +1 -1
- package/lib/module/ui/screens/ValidateOTPScreen.js +39 -0
- package/lib/module/ui/screens/ValidateOTPScreen.js.map +1 -0
- package/lib/module/ui/screens/WithBaseDispatchScreen.js +0 -3
- package/lib/module/ui/screens/WithBaseDispatchScreen.js.map +1 -1
- package/lib/module/ui/uiConfig/RouteParams.js +9 -1
- package/lib/module/ui/uiConfig/RouteParams.js.map +1 -1
- package/lib/module/utils/ApiUtils.js +101 -0
- package/lib/module/utils/ApiUtils.js.map +1 -0
- package/lib/module/utils/ExecTaskUtils.js +92 -21
- package/lib/module/utils/ExecTaskUtils.js.map +1 -1
- package/lib/module/utils/Logger.js +9 -21
- package/lib/module/utils/Logger.js.map +1 -1
- package/lib/module/utils/NetworkUtil.js +3 -15
- package/lib/module/utils/NetworkUtil.js.map +1 -1
- package/lib/module/utils/SdkUtils.js +2 -15
- package/lib/module/utils/SdkUtils.js.map +1 -1
- package/lib/module/utils/SyncManagerUtils.js +25 -10
- package/lib/module/utils/SyncManagerUtils.js.map +1 -1
- package/lib/module/utils/fcm/FCM.js +35 -4
- package/lib/module/utils/fcm/FCM.js.map +1 -1
- package/lib/module/utils/fcm/FcmUtils.js +50 -7
- package/lib/module/utils/fcm/FcmUtils.js.map +1 -1
- package/lib/module/utils/helper.js +0 -3
- package/lib/module/utils/helper.js.map +1 -1
- package/lib/module/utils/hooks/useTimer.js +37 -0
- package/lib/module/utils/hooks/useTimer.js.map +1 -0
- package/lib/module/utils/loginHelper.js +6 -16
- package/lib/module/utils/loginHelper.js.map +1 -1
- package/lib/module/utils/storage.js +51 -29
- package/lib/module/utils/storage.js.map +1 -1
- package/lib/module/utils/utils.js +8 -6
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/typescript/components/executiontasks/CompletedWFSchema.d.ts +2 -2
- package/lib/typescript/components/executiontasks/ExecutionTasksIndex.d.ts +6 -2
- package/lib/typescript/components/executiontasks/cancellation/CancellationSchema.d.ts +10 -5
- package/lib/typescript/components/executiontasks/captureInput/CaptureInputSchema.d.ts +7 -7
- package/lib/typescript/components/executiontasks/deliver/DeliverETInput.d.ts +7 -7
- package/lib/typescript/components/executiontasks/display/DisplaySchema.d.ts +5 -5
- package/lib/typescript/components/executiontasks/doodle/SignatureSchema.d.ts +7 -7
- package/lib/typescript/components/executiontasks/dropCash/DropCashSchema.d.ts +2 -2
- package/lib/typescript/components/executiontasks/forms/FormSchema.d.ts +2 -2
- package/lib/typescript/components/executiontasks/forms/widgets/DateTimeWidget.d.ts +1 -1
- package/lib/typescript/components/executiontasks/forms/widgets/DropdownWidget.d.ts +9 -0
- package/lib/typescript/components/executiontasks/httpRequest/HttpRequestETSchema.d.ts +6 -6
- package/lib/typescript/components/executiontasks/imageCapture/CaptureSchema.d.ts +16 -11
- package/lib/typescript/components/executiontasks/payments/completePayment/CompletePaymentSchema.d.ts +2 -2
- package/lib/typescript/components/executiontasks/payments/init/InitPaymentSchema.d.ts +3 -3
- package/lib/typescript/components/executiontasks/payments/processPayment/ProcessPaymentSchema.d.ts +2 -2
- package/lib/typescript/components/executiontasks/pickup/PickpSchema.d.ts +3 -3
- package/lib/typescript/components/executiontasks/scan/ScanET.d.ts +16 -0
- package/lib/typescript/components/executiontasks/scan/ScanSchema.d.ts +70 -0
- package/lib/typescript/components/executiontasks/scan/constants.d.ts +6 -0
- package/lib/typescript/components/executiontasks/scan/interfaces.d.ts +41 -0
- package/lib/typescript/components/executiontasks/scan/sub_components/CScanner.d.ts +7 -0
- package/lib/typescript/components/executiontasks/scan/sub_components/DropDownUtils.d.ts +7 -0
- package/lib/typescript/components/executiontasks/scan/sub_components/ERDropDown.d.ts +17 -0
- package/lib/typescript/components/executiontasks/scan/sub_components/ScanList.d.ts +8 -0
- package/lib/typescript/components/executiontasks/scan/utils.d.ts +21 -0
- package/lib/typescript/components/executiontasks/scanner/ScannerSchema.d.ts +6 -6
- package/lib/typescript/components/executiontasks/scanner/returns/DropDownUtils.d.ts +1 -2
- package/lib/typescript/components/executiontasks/scanner/returns/RTReasonSelection.d.ts +1 -1
- package/lib/typescript/components/executiontasks/scanner/returns/ScanList.d.ts +1 -1
- package/lib/typescript/components/executiontasks/validateOTP/ValidateOTPET.d.ts +4 -0
- package/lib/typescript/components/executiontasks/validateOTP/ValidateOTPSchema.d.ts +54 -0
- package/lib/typescript/components/executiontasks/validateOTP/constants.d.ts +10 -0
- package/lib/typescript/components/executiontasks/validateOTP/sub-components/OTPInput.d.ts +12 -0
- package/lib/typescript/components/executiontasks/validateOTP/utils.d.ts +7 -0
- package/lib/typescript/components/executiontasks/verifyInput/VerifyInputSchema.d.ts +8 -8
- package/lib/typescript/components/executiontasks/verifyLocation/VerifyLocSchema.d.ts +9 -9
- package/lib/typescript/components/executiontasks/verifyOtp/VerifyOtpSchema.d.ts +3 -3
- package/lib/typescript/components/widgets/IconButton.d.ts +9 -0
- package/lib/typescript/components/widgets/SnackBarCustom.d.ts +9 -5
- package/lib/typescript/components/widgets/SplitTextInput.d.ts +12 -0
- package/lib/typescript/constants/apiConstants.d.ts +6 -0
- package/lib/typescript/constants/constants.d.ts +4 -2
- package/lib/typescript/errors/ErrorCodes.d.ts +3 -1
- package/lib/typescript/events/EventDispatcher.d.ts +5 -0
- package/lib/typescript/events/EventListener.d.ts +5 -0
- package/lib/typescript/events/constants.d.ts +5 -0
- package/lib/typescript/events/index.d.ts +2 -0
- package/lib/typescript/events/interface.d.ts +1 -0
- package/lib/typescript/index.d.ts +5 -4
- package/lib/typescript/manager/dispatch/DispatchStateContainer.d.ts +21 -8
- package/lib/typescript/manager/dispatchCodes/EventCodeContainer.d.ts +12 -1
- package/lib/typescript/manager/dispatchCodes/EventCodeRepo.d.ts +13 -0
- package/lib/typescript/manager/jobRemoval/JobRemovalManager.d.ts +6 -0
- package/lib/typescript/manager/sdk/DispatchSdkCache.d.ts +2 -0
- package/lib/typescript/manager/syncmanager/AppSyncManager.d.ts +1 -0
- package/lib/typescript/manager/syncmanager/DBConfig.d.ts +22 -2
- package/lib/typescript/manager/syncmanager/database.d.ts +5 -0
- package/lib/typescript/manager/syncmanager/document/models.d.ts +1 -1
- package/lib/typescript/manager/syncmanager/events/ETEventsManager.d.ts +5 -1
- package/lib/typescript/manager/syncmanager/events/EventsSyncManager.d.ts +5 -1
- package/lib/typescript/manager/syncmanager/events/SyncHttpClient.d.ts +3 -1
- package/lib/typescript/models/DispatchModels.d.ts +56 -1
- package/lib/typescript/models/ReasonCodes.d.ts +5 -0
- package/lib/typescript/models/auth.d.ts +1 -1
- package/lib/typescript/models/execTasks/ETBaseModels.d.ts +27 -8
- package/lib/typescript/models/execTasks/ETConfig.d.ts +8 -4
- package/lib/typescript/models/sdk.d.ts +5 -0
- package/lib/typescript/native/signature/SignatureCapture.d.ts +1 -1
- package/lib/typescript/network/NetworkUtils.d.ts +1 -5
- package/lib/typescript/styles/SdkColors.d.ts +1 -0
- package/lib/typescript/styles/executionTasks/CommonStyles.d.ts +36 -0
- package/lib/typescript/ui/screens/ETScreensIndex.d.ts +3 -1
- package/lib/typescript/ui/screens/ScanScreen.d.ts +3 -0
- package/lib/typescript/ui/screens/ValidateOTPScreen.d.ts +3 -0
- package/lib/typescript/ui/uiConfig/RouteParams.d.ts +8 -0
- package/lib/typescript/utils/ApiUtils.d.ts +61 -0
- package/lib/typescript/utils/ExecTaskUtils.d.ts +7 -2
- package/lib/typescript/utils/NetworkUtil.d.ts +1 -1
- package/lib/typescript/utils/SyncManagerUtils.d.ts +3 -1
- package/lib/typescript/utils/hooks/useTimer.d.ts +5 -0
- package/lib/typescript/utils/storage.d.ts +17 -0
- package/package.json +23 -24
- package/tsconfig.json +9 -8
- package/file_unzip.js +0 -5
- package/mobile-execution-lib-0.6.4.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DocumentSyncManager","EventsSyncManager","NetworkUtil","Logger","LOG_TYPE","NativeSyncManager","DispatchSdkCache","AppRegistry","Platform","BaseError","ErrorCodes","DEFAULT_INTERVAL","DEFAULT_NOTIFICATION_DESCRIPTION","DEFAULT_NOTIFICATION_TITLE","AppSyncManager","constructor","tenantBaseURL","retryCount","getInstance","init","initSyncManager","startSyncing","forceSync","_syncType","isAvailableAsync","forceDocumentSync","startSync","startDocumentSync","logEvent","SDK_INFO","isAppSyncPending","isSyncPending","initAppSync","syncRetryCount","instance","AppSyncNotInitialized","startAppSyncManager","stopSyncManager","sdkConfig","getObjectFromCache","KEYS","SDK_CONFIG","startSDKSyncManager","SDK_ERROR","isSyncActive","error","message","SDK_WARNING","registerSyncTask","registerHeadlessTask","getAllEvents","dispatchID","getAllDocuments","config","OS","retries","startSyncManager","notificationConfig","interval","title","description","then","catch"],"sources":["AppSyncManager.ts"],"sourcesContent":["import DocumentSyncManager from './document/DocumentSyncManager';\nimport EventsSyncManager from './events/EventsSyncManager';\nimport NetworkUtil from '../../utils/NetworkUtil';\nimport Logger, { LOG_TYPE } from '../../utils/Logger';\nimport NativeSyncManager from './NativeSyncManager';\nimport DispatchSdkCache from '../sdk/DispatchSdkCache';\nimport { AppRegistry, Platform } from 'react-native';\nimport { BaseError } from '../../errors/BaseError';\nimport ErrorCodes from '../../errors/ErrorCodes';\nimport type { SdkSyncType } from '../../models/DispatchModels';\nimport type { DocumentRow, EventRow } from './DBConfig';\nimport {\n DEFAULT_INTERVAL,\n DEFAULT_NOTIFICATION_DESCRIPTION,\n DEFAULT_NOTIFICATION_TITLE,\n} from '../../constants/constants';\nimport type { DispatchSDKConfig } from '../../models/sdk';\n\nexport default class AppSyncManager {\n private constructor(tenantBaseURL: string, retryCount: number) {\n DocumentSyncManager.getInstance().init(tenantBaseURL, retryCount);\n EventsSyncManager.getInstance().initSyncManager(tenantBaseURL, retryCount);\n }\n private static instance: AppSyncManager;\n public isSyncActive = false;\n\n /**\n *\n * @param forceSync - true/false - if true resets the retry count key and start the sync\n * @param syncType\n */\n public async startSyncing(forceSync: boolean, _syncType?: SdkSyncType) {\n if (await NetworkUtil.isAvailableAsync()) {\n if (forceSync) {\n await EventsSyncManager.getInstance().forceSync();\n await DocumentSyncManager.getInstance().forceDocumentSync();\n } else {\n await EventsSyncManager.getInstance().startSync();\n await DocumentSyncManager.getInstance().startDocumentSync();\n }\n } else {\n Logger.getInstance().logEvent(\n 'startSync',\n 'No network',\n LOG_TYPE.SDK_INFO\n );\n }\n }\n\n public async isAppSyncPending(): Promise<boolean> {\n return (\n (await EventsSyncManager.getInstance().isSyncPending()) ||\n (await DocumentSyncManager.getInstance().isSyncPending())\n );\n }\n public static initAppSync(\n tenantBaseURL: string,\n syncRetryCount: number\n ): AppSyncManager {\n if (!AppSyncManager.instance) {\n Logger.getInstance().logEvent(\n 'initAppSync',\n 'CREATING NEW INSTANCE',\n LOG_TYPE.SDK_INFO\n );\n AppSyncManager.instance = new AppSyncManager(\n tenantBaseURL,\n syncRetryCount\n );\n }\n return AppSyncManager.instance;\n }\n public static getInstance(): AppSyncManager {\n if (!AppSyncManager.instance)\n throw new BaseError(\n ErrorCodes.AppSyncNotInitialized,\n 'SDK sync Manager is not initialized'\n );\n else return AppSyncManager.instance;\n }\n\n public static async startAppSyncManager() {\n try {\n if (!AppSyncManager.instance) {\n NativeSyncManager.stopSyncManager();\n let sdkConfig =\n (await DispatchSdkCache.getInstance().getObjectFromCache(\n DispatchSdkCache.KEYS.SDK_CONFIG\n )) as DispatchSDKConfig;\n const retryCount = sdkConfig.syncRetryCount ?? 3;\n if (sdkConfig.tenantBaseURL != null && retryCount != null) {\n AppSyncManager.initAppSync(sdkConfig.tenantBaseURL, +retryCount);\n AppSyncManager.getInstance().startSDKSyncManager();\n } else {\n Logger.getInstance().logEvent(\n 'SYNC_MANAGER_ASM',\n 'TENANT BASE URL IS NULL',\n LOG_TYPE.SDK_ERROR\n );\n }\n } else if (await AppSyncManager.instance.isAppSyncPending()) {\n await AppSyncManager.instance.startSyncing(false);\n } else {\n NativeSyncManager.stopSyncManager();\n AppSyncManager.getInstance().isSyncActive = false;\n }\n } catch (error: any) {\n Logger.getInstance().logEvent(\n 'startAppSyncManager',\n `Unable to start App Sync Manager ${error.message}`,\n LOG_TYPE.SDK_WARNING\n );\n }\n }\n\n /**\n * Call this method from index file of the app\n */\n public static registerSyncTask() {\n AppRegistry.registerHeadlessTask(\n 'SYNC_MANAGER',\n () => AppSyncManager.startAppSyncManager\n );\n }\n\n public async getAllEvents(dispatchID?: string): Promise<EventRow[]> {\n return EventsSyncManager.getInstance().getAllEvents(dispatchID);\n }\n public async getAllDocuments(dispatchID?: string): Promise<DocumentRow[]> {\n return DocumentSyncManager.getInstance().getAllDocuments(dispatchID);\n }\n public startSDKSyncManager() {\n (async () => {\n const config = (await DispatchSdkCache.getInstance().getObjectFromCache(\n DispatchSdkCache.KEYS.SDK_CONFIG\n )) as DispatchSDKConfig;\n if (Platform.OS === 'android') {\n if (!this.isSyncActive) {\n this.isSyncActive = true;\n /**\n * Reset Retry Counter\n */\n EventsSyncManager.getInstance().retries = 0;\n DocumentSyncManager.getInstance().retries = 0;\n NativeSyncManager.startSyncManager(\n config?.notificationConfig?.interval ?? DEFAULT_INTERVAL,\n config?.notificationConfig?.title ?? DEFAULT_NOTIFICATION_TITLE,\n config?.notificationConfig?.description ??\n DEFAULT_NOTIFICATION_DESCRIPTION\n );\n } else {\n Logger.getInstance().logEvent(\n 'startNativeSyncManager',\n 'ANDROID SYNC SERVICE ALREADY RUNNING',\n LOG_TYPE.SDK_INFO\n );\n }\n } else {\n /**\n * For iOS we have to start Normal Foreground sync\n */\n this.startSyncing(true).then().catch();\n }\n })();\n }\n}\n"],"mappings":";;AAAA,OAAOA,mBAAP,MAAgC,gCAAhC;AACA,OAAOC,iBAAP,MAA8B,4BAA9B;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,MAAP,IAAiBC,QAAjB,QAAiC,oBAAjC;AACA,OAAOC,iBAAP,MAA8B,qBAA9B;AACA,OAAOC,gBAAP,MAA6B,yBAA7B;AACA,SAASC,WAAT,EAAsBC,QAAtB,QAAsC,cAAtC;AACA,SAASC,SAAT,QAA0B,wBAA1B;AACA,OAAOC,UAAP,MAAuB,yBAAvB;AAGA,SACEC,gBADF,EAEEC,gCAFF,EAGEC,0BAHF,QAIO,2BAJP;AAOA,eAAe,MAAMC,cAAN,CAAqB;EAC1BC,WAAW,CAACC,aAAD,EAAwBC,UAAxB,EAA4C;IAAA,sCAKzC,KALyC;;IAC7DjB,mBAAmB,CAACkB,WAApB,GAAkCC,IAAlC,CAAuCH,aAAvC,EAAsDC,UAAtD;IACAhB,iBAAiB,CAACiB,WAAlB,GAAgCE,eAAhC,CAAgDJ,aAAhD,EAA+DC,UAA/D;EACD;;EAID;AACF;AACA;AACA;AACA;EAC2B,MAAZI,YAAY,CAACC,SAAD,EAAqBC,SAArB,EAA8C;IACrE,IAAI,MAAMrB,WAAW,CAACsB,gBAAZ,EAAV,EAA0C;MACxC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CAAkDD,UAAlD,CAAP;EACD;;EACMT,mBAAmB,GAAG;IAC3B,CAAC,YAAY;MACX,MAAMW,MAAM,GAAI,MAAM/C,gBAAgB,CAACY,WAAjB,GAA+BqB,kBAA/B,CACpBjC,gBAAgB,CAACkC,IAAjB,CAAsBC,UADF,CAAtB;;MAGA,IAAIjC,QAAQ,CAAC8C,EAAT,KAAgB,SAApB,EAA+B;QAC7B,IAAI,CAAC,KAAKV,YAAV,EAAwB;UAAA;;UACtB,KAAKA,YAAL,GAAoB,IAApB;UACA;AACV;AACA;;UACU3C,iBAAiB,CAACiB,WAAlB,GAAgCqC,OAAhC,GAA0C,CAA1C;UACAvD,mBAAmB,CAACkB,WAApB,GAAkCqC,OAAlC,GAA4C,CAA5C;UACAlD,iBAAiB,CAACmD,gBAAlB,CACE,CAAAH,MAAM,SAAN,IAAAA,MAAM,WAAN,qCAAAA,MAAM,CAAEI,kBAAR,gFAA4BC,QAA5B,KAAwC/C,gBAD1C,EAEE,CAAA0C,MAAM,SAAN,IAAAA,MAAM,WAAN,sCAAAA,MAAM,CAAEI,kBAAR,kFAA4BE,KAA5B,KAAqC9C,0BAFvC,EAGE,CAAAwC,MAAM,SAAN,IAAAA,MAAM,WAAN,sCAAAA,MAAM,CAAEI,kBAAR,kFAA4BG,WAA5B,KACEhD,gCAJJ;QAMD,CAbD,MAaO;UACLT,MAAM,CAACe,WAAP,GAAqBU,QAArB,CACE,wBADF,EAEE,sCAFF,EAGExB,QAAQ,CAACyB,QAHX;QAKD;MACF,CArBD,MAqBO;QACL;AACR;AACA;QACQ,KAAKR,YAAL,CAAkB,IAAlB,EAAwBwC,IAAxB,GAA+BC,KAA/B;MACD;IACF,CA/BD;EAgCD;;AAlJiC;;gBAAfhD,c"}
|
|
1
|
+
{"version":3,"names":["DocumentSyncManager","EventsSyncManager","NetworkUtil","Logger","LOG_TYPE","NativeSyncManager","DispatchSdkCache","AppRegistry","Platform","BaseError","ErrorCodes","DEFAULT_INTERVAL","DEFAULT_NOTIFICATION_DESCRIPTION","DEFAULT_NOTIFICATION_TITLE","AppSyncManager","constructor","tenantBaseURL","retryCount","_defineProperty","getInstance","init","initSyncManager","startSyncing","forceSync","_syncType","isAvailableAsync","forceDocumentSync","startSync","startDocumentSync","logEvent","SDK_INFO","isAppSyncPending","isSyncPending","initAppSync","syncRetryCount","instance","AppSyncNotInitialized","startAppSyncManager","stopSyncManager","sdkConfig","getObjectFromCache","KEYS","SDK_CONFIG","startSDKSyncManager","SDK_ERROR","isSyncActive","error","message","SDK_WARNING","registerSyncTask","registerHeadlessTask","getAllEvents","dispatchID","getAllDocuments","config","OS","isForceStartEnabled","_config$notificationC","_config$notificationC2","_config$notificationC3","retries","startSyncManager","notificationConfig","interval","title","description","then","catch"],"sources":["AppSyncManager.ts"],"sourcesContent":["import DocumentSyncManager from './document/DocumentSyncManager';\nimport EventsSyncManager from './events/EventsSyncManager';\nimport NetworkUtil from '../../utils/NetworkUtil';\nimport Logger, { LOG_TYPE } from '../../utils/Logger';\nimport NativeSyncManager from './NativeSyncManager';\nimport DispatchSdkCache from '../sdk/DispatchSdkCache';\nimport { AppRegistry, Platform } from 'react-native';\nimport { BaseError } from '../../errors/BaseError';\nimport ErrorCodes from '../../errors/ErrorCodes';\nimport type { SdkSyncType } from '../../models/DispatchModels';\nimport type { DocumentRow, EventRow } from './DBConfig';\nimport {\n DEFAULT_INTERVAL,\n DEFAULT_NOTIFICATION_DESCRIPTION,\n DEFAULT_NOTIFICATION_TITLE,\n} from '../../constants/constants';\nimport type { DispatchSDKConfig } from '../../models/sdk';\n\nexport default class AppSyncManager {\n private constructor(tenantBaseURL: string, retryCount: number) {\n DocumentSyncManager.getInstance().init(tenantBaseURL, retryCount);\n EventsSyncManager.getInstance().initSyncManager(tenantBaseURL, retryCount);\n }\n private static instance: AppSyncManager;\n public isSyncActive = false;\n public isForceStartEnabled = true;\n\n /**\n *\n * @param forceSync - true/false - if true resets the retry count key and start the sync\n * @param syncType\n */\n public async startSyncing(forceSync: boolean, _syncType?: SdkSyncType) {\n if (await NetworkUtil.isAvailableAsync()) {\n if (forceSync) {\n EventsSyncManager.getInstance().forceSync();\n DocumentSyncManager.getInstance().forceDocumentSync();\n } else {\n EventsSyncManager.getInstance().startSync();\n DocumentSyncManager.getInstance().startDocumentSync();\n }\n } else {\n Logger.getInstance().logEvent(\n 'startSync',\n 'No network',\n LOG_TYPE.SDK_INFO\n );\n }\n }\n\n public async isAppSyncPending(): Promise<boolean> {\n return (\n (await EventsSyncManager.getInstance().isSyncPending()) ||\n (await DocumentSyncManager.getInstance().isSyncPending())\n );\n }\n public static initAppSync(\n tenantBaseURL: string,\n syncRetryCount: number\n ): AppSyncManager {\n if (!AppSyncManager.instance) {\n Logger.getInstance().logEvent(\n 'initAppSync',\n 'CREATING NEW INSTANCE',\n LOG_TYPE.SDK_INFO\n );\n AppSyncManager.instance = new AppSyncManager(\n tenantBaseURL,\n syncRetryCount\n );\n }\n return AppSyncManager.instance;\n }\n public static getInstance(): AppSyncManager {\n if (!AppSyncManager.instance)\n throw new BaseError(\n ErrorCodes.AppSyncNotInitialized,\n 'SDK sync Manager is not initialized'\n );\n else return AppSyncManager.instance;\n }\n\n public static async startAppSyncManager() {\n try {\n if (!AppSyncManager.instance) {\n NativeSyncManager.stopSyncManager();\n let sdkConfig =\n (await DispatchSdkCache.getInstance().getObjectFromCache(\n DispatchSdkCache.KEYS.SDK_CONFIG\n )) as DispatchSDKConfig;\n const retryCount = sdkConfig.syncRetryCount ?? 3;\n if (sdkConfig.tenantBaseURL != null && retryCount != null) {\n AppSyncManager.initAppSync(sdkConfig.tenantBaseURL, +retryCount);\n AppSyncManager.getInstance().startSDKSyncManager();\n } else {\n Logger.getInstance().logEvent(\n 'SYNC_MANAGER_ASM',\n 'TENANT BASE URL IS NULL',\n LOG_TYPE.SDK_ERROR\n );\n }\n } else if (await AppSyncManager.instance.isAppSyncPending()) {\n AppSyncManager.instance.startSyncing(false);\n } else {\n NativeSyncManager.stopSyncManager();\n AppSyncManager.getInstance().isSyncActive = false;\n }\n } catch (error: any) {\n Logger.getInstance().logEvent(\n 'startAppSyncManager',\n `Unable to start App Sync Manager ${error.message}`,\n LOG_TYPE.SDK_WARNING\n );\n }\n }\n\n /**\n * Call this method from index file of the app\n */\n public static registerSyncTask() {\n AppRegistry.registerHeadlessTask(\n 'SYNC_MANAGER',\n () => AppSyncManager.startAppSyncManager\n );\n }\n\n public async getAllEvents(dispatchID?: string): Promise<EventRow[]> {\n return EventsSyncManager.getInstance().getAllEvents(dispatchID);\n }\n public async getAllDocuments(dispatchID?: string): Promise<DocumentRow[]> {\n return DocumentSyncManager.getInstance().getAllDocuments(dispatchID);\n }\n public startSDKSyncManager() {\n (async () => {\n const config = (await DispatchSdkCache.getInstance().getObjectFromCache(\n DispatchSdkCache.KEYS.SDK_CONFIG\n )) as DispatchSDKConfig;\n if (Platform.OS === 'android') {\n if (!this.isSyncActive && this.isForceStartEnabled) {\n this.isSyncActive = true;\n\n /**\n * Reset Retry Counter\n */\n EventsSyncManager.getInstance().retries = 0;\n DocumentSyncManager.getInstance().retries = 0;\n NativeSyncManager.startSyncManager(\n config?.notificationConfig?.interval ?? DEFAULT_INTERVAL,\n config?.notificationConfig?.title ?? DEFAULT_NOTIFICATION_TITLE,\n config?.notificationConfig?.description ??\n DEFAULT_NOTIFICATION_DESCRIPTION\n );\n } else {\n Logger.getInstance().logEvent(\n 'startNativeSyncManager',\n 'ANDROID SYNC SERVICE ALREADY RUNNING',\n LOG_TYPE.SDK_INFO\n );\n }\n } else {\n /**\n * For iOS we have to start Normal Foreground sync\n */\n this.startSyncing(true).then().catch();\n }\n })();\n }\n}\n"],"mappings":";;;AAAA,OAAOA,mBAAmB,MAAM,gCAAgC;AAChE,OAAOC,iBAAiB,MAAM,4BAA4B;AAC1D,OAAOC,WAAW,MAAM,yBAAyB;AACjD,OAAOC,MAAM,IAAIC,QAAQ,QAAQ,oBAAoB;AACrD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OA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5D,mBAAmB,CAACmB,WAAW,EAAE,CAACyC,OAAO,GAAG,CAAC;UAC7CvD,iBAAiB,CAACwD,gBAAgB,CAChC,CAAAP,MAAM,aAANA,MAAM,wBAAAG,qBAAA,GAANH,MAAM,CAAEQ,kBAAkB,cAAAL,qBAAA,uBAA1BA,qBAAA,CAA4BM,QAAQ,KAAIpD,gBAAgB,EACxD,CAAA2C,MAAM,aAANA,MAAM,wBAAAI,sBAAA,GAANJ,MAAM,CAAEQ,kBAAkB,cAAAJ,sBAAA,uBAA1BA,sBAAA,CAA4BM,KAAK,KAAInD,0BAA0B,EAC/D,CAAAyC,MAAM,aAANA,MAAM,wBAAAK,sBAAA,GAANL,MAAM,CAAEQ,kBAAkB,cAAAH,sBAAA,uBAA1BA,sBAAA,CAA4BM,WAAW,KACrCrD,gCAAgC,CACnC;QACH,CAAC,MAAM;UACLT,MAAM,CAACgB,WAAW,EAAE,CAACU,QAAQ,CAC3B,wBAAwB,EACxB,sCAAsC,EACtCzB,QAAQ,CAAC0B,QAAQ,CAClB;QACH;MACF,CAAC,MAAM;QACL;AACR;AACA;QACQ,IAAI,CAACR,YAAY,CAAC,IAAI,CAAC,CAAC4C,IAAI,EAAE,CAACC,KAAK,EAAE;MACxC;IACF,CAAC,GAAG;EACN;AACF;AAACjD,eAAA,CArJoBJ,cAAc"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const DATABASE_NAME = 'DISPATCH_DB';
|
|
2
2
|
export const EVENTS_TABLE = 'EVENTS_TABLE';
|
|
3
3
|
export const REASONS_TABLE = 'REASONS_TABLE';
|
|
4
|
+
export const EVENT_CODES_TABLE = 'EVENT_CODES_TABLE';
|
|
4
5
|
export const EVENTS_COLUMNS = {
|
|
5
6
|
ID: 'id',
|
|
6
7
|
SEQUENCE: 'seq_number',
|
|
@@ -30,19 +31,22 @@ export const DOCUMENT_COLUMNS = {
|
|
|
30
31
|
JOB_ID: 'job_id',
|
|
31
32
|
OBJECTIVE_REF: 'objective_ref'
|
|
32
33
|
};
|
|
33
|
-
export let SyncMethod
|
|
34
|
-
|
|
35
|
-
(function (SyncMethod) {
|
|
34
|
+
export let SyncMethod = /*#__PURE__*/function (SyncMethod) {
|
|
36
35
|
SyncMethod["POST"] = "POST";
|
|
37
36
|
SyncMethod["PUT"] = "PUT";
|
|
38
37
|
SyncMethod["GET"] = "GET";
|
|
39
38
|
SyncMethod["DELETE"] = "DELETE";
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
return SyncMethod;
|
|
40
|
+
}({});
|
|
42
41
|
export const ReasonColums = {
|
|
43
42
|
CODE: 'reasonCode',
|
|
44
43
|
DESCRIPTION: 'description',
|
|
45
44
|
IS_ENABLED: 'isEnabled',
|
|
46
45
|
SYSTEM_DEFINED: 'isSystemDefined'
|
|
47
46
|
};
|
|
47
|
+
export const EventColumns = {
|
|
48
|
+
CODE: 'eventCode',
|
|
49
|
+
DESCRIPTION: 'description',
|
|
50
|
+
SUCCESS_EVENT: 'successEvent'
|
|
51
|
+
};
|
|
48
52
|
//# sourceMappingURL=DBConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DATABASE_NAME","EVENTS_TABLE","REASONS_TABLE","EVENTS_COLUMNS","ID","SEQUENCE","PAYLOAD","SYNCED","CONFIG","SYNC_TYPE","OBJECTIVE_REF","SYNC_ERROR","DISPATCH_ID","DOCUMENT_TABLE","DOCUMENT_COLUMNS","DATA","BASE64","FILE_PATH","FILE_NAME","FILE_TYPE","FMS_FOLDER_ID","FMS_ID","PRIORITY","DESCRIPTION","JOB_ID","SyncMethod","ReasonColums","CODE","IS_ENABLED","SYSTEM_DEFINED"],"sources":["DBConfig.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["DATABASE_NAME","EVENTS_TABLE","REASONS_TABLE","EVENT_CODES_TABLE","EVENTS_COLUMNS","ID","SEQUENCE","PAYLOAD","SYNCED","CONFIG","SYNC_TYPE","OBJECTIVE_REF","SYNC_ERROR","DISPATCH_ID","DOCUMENT_TABLE","DOCUMENT_COLUMNS","DATA","BASE64","FILE_PATH","FILE_NAME","FILE_TYPE","FMS_FOLDER_ID","FMS_ID","PRIORITY","DESCRIPTION","JOB_ID","SyncMethod","ReasonColums","CODE","IS_ENABLED","SYSTEM_DEFINED","EventColumns","SUCCESS_EVENT"],"sources":["DBConfig.ts"],"sourcesContent":["import type { SyncType } from '@os1-platform/mobile-execution-lib';\n\nexport const DATABASE_NAME = 'DISPATCH_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 OBJECTIVE_REF: 'objective_ref',\n SYNC_ERROR: 'sync_error',\n DISPATCH_ID: 'dispatch_id',\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};\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};\nexport type EventRow = {\n id: number;\n payload: string;\n synced: boolean;\n config: string;\n sync_type: string;\n objective_ref: string;\n sync_error: string;\n dispatch_id: string;\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 interface BulkEvent {\n syncType: SyncType;\n dispatchId: string;\n data: string;\n config: string;\n sequence: number;\n meta?: any;\n}\n"],"mappings":"AAEA,OAAO,MAAMA,aAAa,GAAG,aAAa;AAC1C,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,aAAa,EAAE,eAAe;EAC9BC,UAAU,EAAE,YAAY;EACxBC,WAAW,EAAE;AACf,CAAC;AAED,OAAO,MAAMC,cAAc,GAAG,iBAAiB;AAC/C,OAAO,MAAMC,gBAAgB,GAAG;EAC9BV,EAAE,EAAE,IAAI;EACRW,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,QAAQ;EAChBC,SAAS,EAAE,WAAW;EACtBC,SAAS,EAAE,WAAW;EACtBC,SAAS,EAAE,WAAW;EACtBZ,MAAM,EAAE,QAAQ;EAChBa,aAAa,EAAE,eAAe;EAC9BC,MAAM,EAAE,QAAQ;EAChBC,QAAQ,EAAE,UAAU;EACpBC,WAAW,EAAE,MAAM;EACnBZ,UAAU,EAAE,YAAY;EACxBC,WAAW,EAAE,aAAa;EAC1BY,MAAM,EAAE,QAAQ;EAChBd,aAAa,EAAE;AACjB,CAAC;AA6BD,WAAYe,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAMtB,OAAO,MAAMC,YAAY,GAAG;EAC1BC,IAAI,EAAE,YAAY;EAClBJ,WAAW,EAAE,aAAa;EAC1BK,UAAU,EAAE,WAAW;EACvBC,cAAc,EAAE;AAClB,CAAC;AAcD,OAAO,MAAMC,YAAY,GAAG;EAC1BH,IAAI,EAAE,WAAW;EACjBJ,WAAW,EAAE,aAAa;EAC1BQ,aAAa,EAAE;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","NativeSyncManager"],"sources":["NativeSyncManager.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\n\nconst { NativeSyncManager } = NativeModules;\n\ninterface SyncManagerInterface {\n startSyncManager(\n interval: number,\n notifTitle: string,\n notifText: string\n ): void;\n stopSyncManager(): void;\n}\n\nexport default NativeSyncManager as SyncManagerInterface;\n"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"names":["NativeModules","NativeSyncManager"],"sources":["NativeSyncManager.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\n\nconst { NativeSyncManager } = NativeModules;\n\ninterface SyncManagerInterface {\n startSyncManager(\n interval: number,\n notifTitle: string,\n notifText: string\n ): void;\n stopSyncManager(): void;\n}\n\nexport default NativeSyncManager as SyncManagerInterface;\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAE5C,MAAM;EAAEC;AAAkB,CAAC,GAAGD,aAAa;AAW3C,eAAeC,iBAAiB"}
|
|
@@ -3,19 +3,17 @@ import * as DBConfig from './DBConfig';
|
|
|
3
3
|
import { isEmptyOrBlank } from '../../utils/utils';
|
|
4
4
|
import { BaseError } from '../../errors/BaseError';
|
|
5
5
|
import BaseErrorCodes from '../../errors/ErrorCodes';
|
|
6
|
+
import Logger, { LOG_TYPE } from '../../utils/Logger';
|
|
6
7
|
let dbConnection;
|
|
7
|
-
|
|
8
8
|
function openDatabase() {
|
|
9
9
|
return SQLite.openDatabase(DBConfig.DATABASE_NAME);
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
export function executeQuery(query, args) {
|
|
13
12
|
return new Promise((resolve, reject) => {
|
|
14
13
|
if (isEmptyOrBlank(query)) {
|
|
15
14
|
reject(new BaseError(BaseErrorCodes.InvalidArgumentError, 'SQL Query is null or empty'));
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
if (!dbConnection) dbConnection = openDatabase();
|
|
20
18
|
dbConnection.transaction(tx => {
|
|
21
19
|
tx.executeSql(query, args, (_, sqlResultSet) => {
|
|
@@ -27,4 +25,30 @@ export function executeQuery(query, args) {
|
|
|
27
25
|
});
|
|
28
26
|
});
|
|
29
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);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
30
54
|
//# sourceMappingURL=database.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SQLite","DBConfig","isEmptyOrBlank","BaseError","BaseErrorCodes","dbConnection","openDatabase","DATABASE_NAME","executeQuery","query","args","Promise","resolve","reject","InvalidArgumentError","transaction","tx","executeSql","_","sqlResultSet","sqlError"],"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';\n\nlet dbConnection: WebSQLDatabase | null;\n\nfunction openDatabase(): WebSQLDatabase {\n return SQLite.openDatabase(DBConfig.DATABASE_NAME);\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"],"mappings":"AAAA,OAAO,KAAKA,
|
|
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"],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,aAAa;AACrC,OAAO,KAAKC,QAAQ,MAAM,YAAY;AAEtC,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,wBAAwB;AAClD,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,MAAM,IAAIC,QAAQ,QAAQ,oBAAoB;AAErD,IAAIC,YAAmC;AAEvC,SAASC,YAAYA,CAAA,EAAmB;EACtC,OAAOR,MAAM,CAACQ,YAAY,CAACP,QAAQ,CAACQ,aAAa,CAAC;AACpD;AAOA,OAAO,SAASC,YAAYA,CAC1BC,KAAa,EACbC,IAAW,EACY;EACvB,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtC,IAAIb,cAAc,CAACS,KAAK,CAAC,EAAE;MACzBI,MAAM,CACJ,IAAIZ,SAAS,CACXC,cAAc,CAACY,oBAAoB,EACnC,4BAA4B,CAC7B,CACF;MACD;IACF;IACA,IAAI,CAACT,YAAY,EAAEA,YAAY,GAAGC,YAAY,EAAE;IAChDD,YAAY,CAACU,WAAW,CAAEC,EAAE,IAAK;MAC/BA,EAAE,CAACC,UAAU,CACXR,KAAK,EACLC,IAAI,EACJ,CAACQ,CAAC,EAAEC,YAAY,KAAK;QACnBP,OAAO,CAACO,YAAY,CAAC;MACvB,CAAC,EACD,CAACD,CAAC,EAAEE,QAAQ,KAAK;QACfP,MAAM,CAACO,QAAQ,CAAC;QAChB,OAAO,KAAK;MACd,CAAC,CACF;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ;AAEA,OAAO,SAASC,gBAAgBA,CAACC,UAAuB,EAAoB;EAC1E,OAAO,IAAIX,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtC,IAAIU,aAA6B,GAAG,EAAE;IAEtC,IAAI,CAAClB,YAAY,EAAEA,YAAY,GAAGC,YAAY,EAAE;IAChDD,YAAY,CAACU,WAAW,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,YAJY,CAKD;MACH,CAAC,CAAC;IACJ,CAAC,EACAQ,KAAK,IAAK;MACTxB,MAAM,CAACyB,WAAW,EAAE,CAACC,QAAQ,CAC3B,wBAAwB,EACxBC,IAAI,CAACC,SAAS,CAACJ,KAAK,CAAC,EACrBvB,QAAQ,CAAC4B,SAAS,CACnB;MACDnB,MAAM,CAACc,KAAK,CAAC;MACb;IACF,CAAC,EACD,MAAM;MACJxB,MAAM,CAACyB,WAAW,EAAE,CAACC,QAAQ,CAC3B,4BAA4B,EAC5BC,IAAI,CAACC,SAAS,CAACR,aAAa,CAAC,EAC7BnB,QAAQ,CAAC6B,SAAS,CACnB;MACDrB,OAAO,CAAC,IAAI,CAAC;IACf,CAAC,CACF;EACH,CAAC,CAAC;AACJ"}
|
|
@@ -9,11 +9,9 @@ export default class DocumentHttpClient extends HttpClient {
|
|
|
9
9
|
constructor(baseURL) {
|
|
10
10
|
super(baseURL);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
12
|
async uploadDocument(document) {
|
|
14
13
|
if (document.base64 && document.data != null) {
|
|
15
14
|
const response = await this.uploadBase64File(document);
|
|
16
|
-
|
|
17
15
|
if (response && response.data != null && response.data.data != null && response.data.data.id && response.status === 202) {
|
|
18
16
|
return response.data.data.id;
|
|
19
17
|
} else {
|
|
@@ -22,10 +20,8 @@ export default class DocumentHttpClient extends HttpClient {
|
|
|
22
20
|
} else {
|
|
23
21
|
const uploadResponse = await this.uploadBinaryFile(document);
|
|
24
22
|
Logger.getInstance().logEvent('uploadDocument', JSON.stringify(uploadResponse), LOG_TYPE.SDK_INFO);
|
|
25
|
-
|
|
26
23
|
if (uploadResponse != null && uploadResponse.status === 202 && uploadResponse.body != null) {
|
|
27
24
|
var _JSON$parse, _JSON$parse$data;
|
|
28
|
-
|
|
29
25
|
FileSystem.deleteAsync(document.file_path).then().catch();
|
|
30
26
|
return (_JSON$parse = JSON.parse(uploadResponse.body)) === null || _JSON$parse === void 0 ? void 0 : (_JSON$parse$data = _JSON$parse.data) === null || _JSON$parse$data === void 0 ? void 0 : _JSON$parse$data.id;
|
|
31
27
|
} else {
|
|
@@ -33,7 +29,6 @@ export default class DocumentHttpClient extends HttpClient {
|
|
|
33
29
|
}
|
|
34
30
|
}
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
async uploadBase64File(document) {
|
|
38
33
|
let requestBody = JSON.stringify({
|
|
39
34
|
file: {
|
|
@@ -67,7 +62,6 @@ export default class DocumentHttpClient extends HttpClient {
|
|
|
67
62
|
}
|
|
68
63
|
});
|
|
69
64
|
}
|
|
70
|
-
|
|
71
65
|
async uploadBinaryFile(document) {
|
|
72
66
|
const sdkConfig = await cache.getObjectFromCache(cacheKeys.SDK_CONFIG);
|
|
73
67
|
const url = sdkConfig.tenantBaseURL + `/api/folders/${document.fms_folder_id}/files`;
|
|
@@ -99,6 +93,5 @@ export default class DocumentHttpClient extends HttpClient {
|
|
|
99
93
|
}
|
|
100
94
|
});
|
|
101
95
|
}
|
|
102
|
-
|
|
103
96
|
}
|
|
104
97
|
//# sourceMappingURL=DocumentHttpClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HttpClient","FileSystem","FileSystemUploadType","DispatchSdkCache","Logger","LOG_TYPE","cache","getInstance","cacheKeys","KEYS","DocumentHttpClient","constructor","baseURL","uploadDocument","document","base64","data","response","uploadBase64File","id","status","uploadResponse","uploadBinaryFile","logEvent","JSON","stringify","SDK_INFO","body","deleteAsync","file_path","then","catch","parse","requestBody","file","type","description","desc","tags","key","value","dispatch_id","job_id","objective_ref","file_name","fileName","sdkConfig","getObjectFromCache","SDK_CONFIG","instance","post","fms_folder_id","headers","accessToken","tenantID","url","tenantBaseURL","uploadAsync","httpMethod","uploadType","MULTIPART","fieldName","parameters"],"sources":["DocumentHttpClient.ts"],"sourcesContent":["import HttpClient from '../../../network/client';\nimport type { DocumentRow } from '../DBConfig';\nimport type { AxiosResponse } from 'axios';\nimport * as FileSystem from 'expo-file-system';\nimport { FileSystemUploadResult, FileSystemUploadType } from 'expo-file-system';\nimport DispatchSdkCache from '../../sdk/DispatchSdkCache';\nimport Logger, { LOG_TYPE } from '../../../utils/Logger';\nimport type { DispatchSDKConfig } from '../../../models/sdk';\n\nconst cache = DispatchSdkCache.getInstance();\nconst cacheKeys = DispatchSdkCache.KEYS;\nexport default class DocumentHttpClient extends HttpClient {\n constructor(baseURL: string) {\n super(baseURL);\n }\n public async uploadDocument(document: DocumentRow): Promise<string | null> {\n if (document.base64 && document.data != null) {\n const response = await this.uploadBase64File(document);\n if (\n response &&\n response.data != null &&\n response.data.data != null &&\n response.data.data.id &&\n response.status === 202\n ) {\n return response.data.data.id;\n } else {\n return null;\n }\n } else {\n const uploadResponse = await this.uploadBinaryFile(document);\n Logger.getInstance().logEvent(\n 'uploadDocument',\n JSON.stringify(uploadResponse),\n LOG_TYPE.SDK_INFO\n );\n if (\n uploadResponse != null &&\n uploadResponse.status === 202 &&\n uploadResponse.body != null\n ) {\n FileSystem.deleteAsync(document.file_path).then().catch();\n return JSON.parse(uploadResponse.body)?.data?.id;\n } else {\n return null;\n }\n }\n }\n\n public async uploadBase64File(document: DocumentRow): Promise<AxiosResponse> {\n let requestBody = JSON.stringify({\n file: {\n type: 'FILE',\n data: document.data,\n },\n description: document.desc,\n tags: [\n { key: 'dispatchId', value: document.dispatch_id },\n { key: 'jobId', value: document.job_id },\n { key: 'objectiveRef', value: document.objective_ref },\n { key: 'fileName', value: document.file_name },\n ],\n fileName: document.file_name,\n });\n const sdkConfig = (await cache.getObjectFromCache(\n cacheKeys.SDK_CONFIG\n )) as DispatchSDKConfig;\n return this.instance.post(\n `/api/folders/${document.fms_folder_id}/files`,\n requestBody,\n {\n headers: {\n 'accept': 'application/json',\n 'X-COREOS-REQUEST-ID': document.dispatch_id,\n 'X-COREOS-ACCESS': sdkConfig.accessToken ?? '',\n 'X-COREOS-TID': sdkConfig.tenantID ?? '',\n 'Content-Type': 'application/json',\n },\n }\n );\n }\n private async uploadBinaryFile(\n document: DocumentRow\n ): Promise<FileSystemUploadResult> {\n const sdkConfig = (await cache.getObjectFromCache(\n cacheKeys.SDK_CONFIG\n )) as DispatchSDKConfig;\n const url =\n sdkConfig.tenantBaseURL + `/api/folders/${document.fms_folder_id}/files`;\n return FileSystem.uploadAsync(url, document.file_path, {\n headers: {\n 'accept': 'application/json',\n 'Content-Type': 'multipart/form-data',\n 'X-COREOS-REQUEST-ID': document.dispatch_id,\n 'X-COREOS-TID': sdkConfig.tenantID ?? '',\n 'X-COREOS-ACCESS': sdkConfig.accessToken ?? '',\n },\n httpMethod: 'POST',\n uploadType: FileSystemUploadType.MULTIPART,\n fieldName: 'file',\n parameters: {\n tags: JSON.stringify([\n { key: 'dispatchId', value: document.dispatch_id },\n { key: 'jobId', value: document.job_id },\n { key: 'objectiveRef', value: document.objective_ref },\n { key: 'fileName', value: document.file_name },\n ]),\n },\n });\n }\n}\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["HttpClient","FileSystem","FileSystemUploadType","DispatchSdkCache","Logger","LOG_TYPE","cache","getInstance","cacheKeys","KEYS","DocumentHttpClient","constructor","baseURL","uploadDocument","document","base64","data","response","uploadBase64File","id","status","uploadResponse","uploadBinaryFile","logEvent","JSON","stringify","SDK_INFO","body","_JSON$parse","_JSON$parse$data","deleteAsync","file_path","then","catch","parse","requestBody","file","type","description","desc","tags","key","value","dispatch_id","job_id","objective_ref","file_name","fileName","sdkConfig","getObjectFromCache","SDK_CONFIG","instance","post","fms_folder_id","headers","accessToken","tenantID","url","tenantBaseURL","uploadAsync","httpMethod","uploadType","MULTIPART","fieldName","parameters"],"sources":["DocumentHttpClient.ts"],"sourcesContent":["import HttpClient from '../../../network/client';\nimport type { DocumentRow } from '../DBConfig';\nimport type { AxiosResponse } from 'axios';\nimport * as FileSystem from 'expo-file-system';\nimport { FileSystemUploadResult, FileSystemUploadType } from 'expo-file-system';\nimport DispatchSdkCache from '../../sdk/DispatchSdkCache';\nimport Logger, { LOG_TYPE } from '../../../utils/Logger';\nimport type { DispatchSDKConfig } from '../../../models/sdk';\n\nconst cache = DispatchSdkCache.getInstance();\nconst cacheKeys = DispatchSdkCache.KEYS;\nexport default class DocumentHttpClient extends HttpClient {\n constructor(baseURL: string) {\n super(baseURL);\n }\n public async uploadDocument(document: DocumentRow): Promise<string | null> {\n if (document.base64 && document.data != null) {\n const response = await this.uploadBase64File(document);\n if (\n response &&\n response.data != null &&\n response.data.data != null &&\n response.data.data.id &&\n response.status === 202\n ) {\n return response.data.data.id;\n } else {\n return null;\n }\n } else {\n const uploadResponse = await this.uploadBinaryFile(document);\n Logger.getInstance().logEvent(\n 'uploadDocument',\n JSON.stringify(uploadResponse),\n LOG_TYPE.SDK_INFO\n );\n if (\n uploadResponse != null &&\n uploadResponse.status === 202 &&\n uploadResponse.body != null\n ) {\n FileSystem.deleteAsync(document.file_path).then().catch();\n return JSON.parse(uploadResponse.body)?.data?.id;\n } else {\n return null;\n }\n }\n }\n\n public async uploadBase64File(document: DocumentRow): Promise<AxiosResponse> {\n let requestBody = JSON.stringify({\n file: {\n type: 'FILE',\n data: document.data,\n },\n description: document.desc,\n tags: [\n { key: 'dispatchId', value: document.dispatch_id },\n { key: 'jobId', value: document.job_id },\n { key: 'objectiveRef', value: document.objective_ref },\n { key: 'fileName', value: document.file_name },\n ],\n fileName: document.file_name,\n });\n const sdkConfig = (await cache.getObjectFromCache(\n cacheKeys.SDK_CONFIG\n )) as DispatchSDKConfig;\n return this.instance.post(\n `/api/folders/${document.fms_folder_id}/files`,\n requestBody,\n {\n headers: {\n 'accept': 'application/json',\n 'X-COREOS-REQUEST-ID': document.dispatch_id,\n 'X-COREOS-ACCESS': sdkConfig.accessToken ?? '',\n 'X-COREOS-TID': sdkConfig.tenantID ?? '',\n 'Content-Type': 'application/json',\n },\n }\n );\n }\n private async uploadBinaryFile(\n document: DocumentRow\n ): Promise<FileSystemUploadResult> {\n const sdkConfig = (await cache.getObjectFromCache(\n cacheKeys.SDK_CONFIG\n )) as DispatchSDKConfig;\n const url =\n sdkConfig.tenantBaseURL + `/api/folders/${document.fms_folder_id}/files`;\n return FileSystem.uploadAsync(url, document.file_path, {\n headers: {\n 'accept': 'application/json',\n 'Content-Type': 'multipart/form-data',\n 'X-COREOS-REQUEST-ID': document.dispatch_id,\n 'X-COREOS-TID': sdkConfig.tenantID ?? '',\n 'X-COREOS-ACCESS': sdkConfig.accessToken ?? '',\n },\n httpMethod: 'POST',\n uploadType: FileSystemUploadType.MULTIPART,\n fieldName: 'file',\n parameters: {\n tags: JSON.stringify([\n { key: 'dispatchId', value: document.dispatch_id },\n { key: 'jobId', value: document.job_id },\n { key: 'objectiveRef', value: document.objective_ref },\n { key: 'fileName', value: document.file_name },\n ]),\n },\n });\n }\n}\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,yBAAyB;AAGhD,OAAO,KAAKC,UAAU,MAAM,kBAAkB;AAC9C,SAAiCC,oBAAoB,QAAQ,kBAAkB;AAC/E,OAAOC,gBAAgB,MAAM,4BAA4B;AACzD,OAAOC,MAAM,IAAIC,QAAQ,QAAQ,uBAAuB;AAGxD,MAAMC,KAAK,GAAGH,gBAAgB,CAACI,WAAW,EAAE;AAC5C,MAAMC,SAAS,GAAGL,gBAAgB,CAACM,IAAI;AACvC,eAAe,MAAMC,kBAAkB,SAASV,UAAU,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CACC;IACvB,MAAMO,GAAG,GACPT,SAAS,CAACU,aAAa,GAAI,gBAAe5C,QAAQ,CAACuC,aAAc,QAAO;IAC1E,OAAOpD,UAAU,CAAC0D,WAAW,CAACF,GAAG,EAAE3C,QAAQ,CAACiB,SAAS,EAAE;MACrDuB,OAAO,EAAE;QACP,QAAQ,EAAE,kBAAkB;QAC5B,cAAc,EAAE,qBAAqB;QACrC,qBAAqB,EAAExC,QAAQ,CAAC6B,WAAW;QAC3C,cAAc,EAAEK,SAAS,CAACQ,QAAQ,IAAI,EAAE;QACxC,iBAAiB,EAAER,SAAS,CAACO,WAAW,IAAI;MAC9C,CAAC;MACDK,UAAU,EAAE,MAAM;MAClBC,UAAU,EAAE3D,oBAAoB,CAAC4D,SAAS;MAC1CC,SAAS,EAAE,MAAM;MACjBC,UAAU,EAAE;QACVxB,IAAI,EAAEhB,IAAI,CAACC,SAAS,CAAC,CACnB;UAAEgB,GAAG,EAAE,YAAY;UAAEC,KAAK,EAAE5B,QAAQ,CAAC6B;QAAY,CAAC,EAClD;UAAEF,GAAG,EAAE,OAAO;UAAEC,KAAK,EAAE5B,QAAQ,CAAC8B;QAAO,CAAC,EACxC;UAAEH,GAAG,EAAE,cAAc;UAAEC,KAAK,EAAE5B,QAAQ,CAAC+B;QAAc,CAAC,EACtD;UAAEJ,GAAG,EAAE,UAAU;UAAEC,KAAK,EAAE5B,QAAQ,CAACgC;QAAU,CAAC,CAC/C;MACH;IACF,CAAC,CAAC;EACJ;AACF"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
4
|
import { DOCUMENT_COLUMNS, DOCUMENT_TABLE } from '../DBConfig';
|
|
4
5
|
import * as Database from '../database';
|
|
5
6
|
export default class DocumentManager {
|
|
6
7
|
constructor() {}
|
|
7
|
-
|
|
8
8
|
static async getInstance() {
|
|
9
9
|
if (!DocumentManager.instance) {
|
|
10
10
|
let managerInstance = new DocumentManager();
|
|
11
11
|
await managerInstance.init();
|
|
12
12
|
DocumentManager.instance = managerInstance;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
14
|
return DocumentManager.instance;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
async init() {
|
|
19
17
|
await Database.executeQuery(`CREATE TABLE IF NOT EXISTS ${DOCUMENT_TABLE} (\
|
|
20
18
|
${DOCUMENT_COLUMNS.ID} INTEGER PRIMARY KEY AUTOINCREMENT,\
|
|
@@ -33,7 +31,6 @@ export default class DocumentManager {
|
|
|
33
31
|
${DOCUMENT_COLUMNS.SYNC_ERROR} TEXT,\
|
|
34
32
|
${DOCUMENT_COLUMNS.DESCRIPTION} TEXT);`, []);
|
|
35
33
|
}
|
|
36
|
-
|
|
37
34
|
async insertDocument(fmsFolderID, desc, dspID, jobID, objectiveRef, base64, fileName, fileType, data, filePath, priority) {
|
|
38
35
|
return await Database.executeQuery(`INSERT INTO ${DOCUMENT_TABLE}(\
|
|
39
36
|
${DOCUMENT_COLUMNS.DATA},\
|
|
@@ -49,7 +46,6 @@ export default class DocumentManager {
|
|
|
49
46
|
${DOCUMENT_COLUMNS.PRIORITY}) \
|
|
50
47
|
values (?,?,?,?,?,?,?,?,?,?,?)`, [data, dspID, jobID, objectiveRef, fmsFolderID, base64, filePath, fileName, fileType, desc, priority ? priority : 1]);
|
|
51
48
|
}
|
|
52
|
-
|
|
53
49
|
async getAllDocuments(dispatchID) {
|
|
54
50
|
if (!dispatchID) {
|
|
55
51
|
const resultSet = await Database.executeQuery(`SELECT * FROM ${DOCUMENT_TABLE};`, []);
|
|
@@ -60,23 +56,19 @@ export default class DocumentManager {
|
|
|
60
56
|
return resultSet.rows._array;
|
|
61
57
|
}
|
|
62
58
|
}
|
|
63
|
-
|
|
64
59
|
async getAllUnsyncedDocs() {
|
|
65
60
|
let resultSet = await Database.executeQuery(`SELECT * FROM ${DOCUMENT_TABLE} \
|
|
66
61
|
where ${DOCUMENT_COLUMNS.SYNCED} = 0;`, []);
|
|
67
62
|
return resultSet.rows._array;
|
|
68
63
|
}
|
|
69
|
-
|
|
70
64
|
deleteAllSyncedDocuments(dispatchID) {
|
|
71
65
|
return Database.executeQuery(`DELETE FROM ${DOCUMENT_TABLE}\
|
|
72
66
|
WHERE ${DOCUMENT_COLUMNS.SYNCED} = 1 and ${DOCUMENT_COLUMNS.DISPATCH_ID} = ?;`, [dispatchID]);
|
|
73
67
|
}
|
|
74
|
-
|
|
75
68
|
async markDocumentSynced(id, fmsID) {
|
|
76
69
|
if (!id || !fmsID) return;
|
|
77
70
|
await Database.executeQuery(`UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.SYNCED} = 1,${DOCUMENT_COLUMNS.FMS_ID} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [fmsID, id]);
|
|
78
71
|
}
|
|
79
|
-
|
|
80
72
|
async updateDocSyncError(id, uploadError) {
|
|
81
73
|
if (!id) throw new TypeError('Document ID cannot be null');
|
|
82
74
|
await Database.executeQuery(`UPDATE ${DOCUMENT_TABLE}\
|
|
@@ -84,15 +76,12 @@ export default class DocumentManager {
|
|
|
84
76
|
${DOCUMENT_COLUMNS.SYNC_ERROR} = ?\
|
|
85
77
|
WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [uploadError, id]);
|
|
86
78
|
}
|
|
87
|
-
|
|
88
79
|
async getUnsyncedDocument() {
|
|
89
80
|
let rs = await Database.executeQuery(`SELECT * from ${DOCUMENT_TABLE}\
|
|
90
81
|
WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0 \
|
|
91
82
|
ORDER BY ${DOCUMENT_COLUMNS.PRIORITY} ASC LIMIT 1;`, []);
|
|
92
83
|
return rs.rows._array;
|
|
93
84
|
}
|
|
94
|
-
|
|
95
85
|
}
|
|
96
|
-
|
|
97
86
|
_defineProperty(DocumentManager, "instance", void 0);
|
|
98
87
|
//# sourceMappingURL=DocumentManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DOCUMENT_COLUMNS","DOCUMENT_TABLE","Database","DocumentManager","constructor","getInstance","instance","managerInstance","init","executeQuery","ID","DATA","BASE64","FILE_PATH","DISPATCH_ID","JOB_ID","OBJECTIVE_REF","FILE_NAME","FILE_TYPE","SYNCED","FMS_ID","FMS_FOLDER_ID","PRIORITY","SYNC_ERROR","DESCRIPTION","insertDocument","fmsFolderID","desc","dspID","jobID","objectiveRef","base64","fileName","fileType","data","filePath","priority","getAllDocuments","dispatchID","resultSet","rows","_array","getAllUnsyncedDocs","deleteAllSyncedDocuments","markDocumentSynced","id","fmsID","updateDocSyncError","uploadError","TypeError","getUnsyncedDocument","rs"],"sources":["DocumentManager.ts"],"sourcesContent":["import { DOCUMENT_COLUMNS, DOCUMENT_TABLE, DocumentRow } from '../DBConfig';\nimport * as Database from '../database';\nimport type { SQLResultSet } from 'expo-sqlite';\n\nexport default class DocumentManager {\n private static instance: DocumentManager;\n\n private constructor() {}\n\n public static async getInstance(): Promise<DocumentManager> {\n if (!DocumentManager.instance) {\n let managerInstance = new DocumentManager();\n await managerInstance.init();\n DocumentManager.instance = managerInstance;\n }\n return DocumentManager.instance;\n }\n\n public async init(): Promise<void> {\n await Database.executeQuery(\n `CREATE TABLE IF NOT EXISTS ${DOCUMENT_TABLE} (\\\n ${DOCUMENT_COLUMNS.ID} INTEGER PRIMARY KEY AUTOINCREMENT,\\\n ${DOCUMENT_COLUMNS.DATA} TEXT,\\\n ${DOCUMENT_COLUMNS.BASE64} INTEGER NOT NULL DEFAULT 0,\\\n ${DOCUMENT_COLUMNS.FILE_PATH} TEXT,\\\n ${DOCUMENT_COLUMNS.DISPATCH_ID} TEXT NOT NULL,\\\n ${DOCUMENT_COLUMNS.JOB_ID} TEXT NOT NULL,\\\n ${DOCUMENT_COLUMNS.OBJECTIVE_REF} TEXT NOT NULL,\\\n ${DOCUMENT_COLUMNS.FILE_NAME} TEXT,\\\n ${DOCUMENT_COLUMNS.FILE_TYPE} TEXT,\\\n ${DOCUMENT_COLUMNS.SYNCED} INTEGER DEFAULT 0 NOT NULL,\\\n ${DOCUMENT_COLUMNS.FMS_ID} TEXT,\\\n ${DOCUMENT_COLUMNS.FMS_FOLDER_ID} TEXT,\\\n ${DOCUMENT_COLUMNS.PRIORITY} INTEGER NOT NULL DEFAULT 1,\\\n ${DOCUMENT_COLUMNS.SYNC_ERROR} TEXT,\\\n ${DOCUMENT_COLUMNS.DESCRIPTION} TEXT);`,\n []\n );\n }\n\n public async insertDocument(\n fmsFolderID: string | null,\n desc: string,\n dspID: string,\n jobID: string,\n objectiveRef: string,\n base64: boolean,\n fileName: string,\n fileType: string,\n data?: string | null,\n filePath?: string | null,\n priority?: number\n ): Promise<SQLResultSet> {\n return await Database.executeQuery(\n `INSERT INTO ${DOCUMENT_TABLE}(\\\n ${DOCUMENT_COLUMNS.DATA},\\\n ${DOCUMENT_COLUMNS.DISPATCH_ID},\\\n ${DOCUMENT_COLUMNS.JOB_ID},\\\n ${DOCUMENT_COLUMNS.OBJECTIVE_REF},\\\n ${DOCUMENT_COLUMNS.FMS_FOLDER_ID},\\\n ${DOCUMENT_COLUMNS.BASE64},\\\n ${DOCUMENT_COLUMNS.FILE_PATH},\\\n ${DOCUMENT_COLUMNS.FILE_NAME},\\\n ${DOCUMENT_COLUMNS.FILE_TYPE},\\\n ${DOCUMENT_COLUMNS.DESCRIPTION},\\\n ${DOCUMENT_COLUMNS.PRIORITY}) \\\n values (?,?,?,?,?,?,?,?,?,?,?)`,\n [\n data,\n dspID,\n jobID,\n objectiveRef,\n fmsFolderID,\n base64,\n filePath,\n fileName,\n fileType,\n desc,\n priority ? priority : 1,\n ]\n );\n }\n\n public async getAllDocuments(dispatchID?: string): Promise<DocumentRow[]> {\n if (!dispatchID) {\n const resultSet = await Database.executeQuery(\n `SELECT * FROM ${DOCUMENT_TABLE};`,\n []\n );\n return resultSet.rows._array;\n } else {\n const resultSet = await Database.executeQuery(\n `SELECT * FROM ${DOCUMENT_TABLE}\\\n WHERE ${DOCUMENT_COLUMNS.DISPATCH_ID} =?;`,\n [dispatchID]\n );\n return resultSet.rows._array;\n }\n }\n\n public async getAllUnsyncedDocs(): Promise<DocumentRow[]> {\n let resultSet = await Database.executeQuery(\n `SELECT * FROM ${DOCUMENT_TABLE} \\\n where ${DOCUMENT_COLUMNS.SYNCED} = 0;`,\n []\n );\n return resultSet.rows._array;\n }\n\n public deleteAllSyncedDocuments(dispatchID: string) {\n return Database.executeQuery(\n `DELETE FROM ${DOCUMENT_TABLE}\\\n WHERE ${DOCUMENT_COLUMNS.SYNCED} = 1 and ${DOCUMENT_COLUMNS.DISPATCH_ID} = ?;`,\n [dispatchID]\n );\n }\n\n public async markDocumentSynced(id: number, fmsID: string): Promise<void> {\n if (!id || !fmsID) return;\n await Database.executeQuery(\n `UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.SYNCED} = 1,${DOCUMENT_COLUMNS.FMS_ID} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`,\n [fmsID, id]\n );\n }\n\n public async updateDocSyncError(\n id: number,\n uploadError: string\n ): Promise<void> {\n if (!id) throw new TypeError('Document ID cannot be null');\n await Database.executeQuery(\n `UPDATE ${DOCUMENT_TABLE}\\\n SET \\\n ${DOCUMENT_COLUMNS.SYNC_ERROR} = ?\\\n WHERE ${DOCUMENT_COLUMNS.ID} = ?;`,\n [uploadError, id]\n );\n }\n\n public async getUnsyncedDocument(): Promise<DocumentRow[]> {\n let rs = await Database.executeQuery(\n `SELECT * from ${DOCUMENT_TABLE}\\\n WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0 \\\n ORDER BY ${DOCUMENT_COLUMNS.PRIORITY} ASC LIMIT 1;`,\n []\n );\n return rs.rows._array;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["DOCUMENT_COLUMNS","DOCUMENT_TABLE","Database","DocumentManager","constructor","getInstance","instance","managerInstance","init","executeQuery","ID","DATA","BASE64","FILE_PATH","DISPATCH_ID","JOB_ID","OBJECTIVE_REF","FILE_NAME","FILE_TYPE","SYNCED","FMS_ID","FMS_FOLDER_ID","PRIORITY","SYNC_ERROR","DESCRIPTION","insertDocument","fmsFolderID","desc","dspID","jobID","objectiveRef","base64","fileName","fileType","data","filePath","priority","getAllDocuments","dispatchID","resultSet","rows","_array","getAllUnsyncedDocs","deleteAllSyncedDocuments","markDocumentSynced","id","fmsID","updateDocSyncError","uploadError","TypeError","getUnsyncedDocument","rs","_defineProperty"],"sources":["DocumentManager.ts"],"sourcesContent":["import { DOCUMENT_COLUMNS, DOCUMENT_TABLE, DocumentRow } from '../DBConfig';\nimport * as Database from '../database';\nimport type { SQLResultSet } from 'expo-sqlite';\n\nexport default class DocumentManager {\n private static instance: DocumentManager;\n\n private constructor() {}\n\n public static async getInstance(): Promise<DocumentManager> {\n if (!DocumentManager.instance) {\n let managerInstance = new DocumentManager();\n await managerInstance.init();\n DocumentManager.instance = managerInstance;\n }\n return DocumentManager.instance;\n }\n\n public async init(): Promise<void> {\n await Database.executeQuery(\n `CREATE TABLE IF NOT EXISTS ${DOCUMENT_TABLE} (\\\n ${DOCUMENT_COLUMNS.ID} INTEGER PRIMARY KEY AUTOINCREMENT,\\\n ${DOCUMENT_COLUMNS.DATA} TEXT,\\\n ${DOCUMENT_COLUMNS.BASE64} INTEGER NOT NULL DEFAULT 0,\\\n ${DOCUMENT_COLUMNS.FILE_PATH} TEXT,\\\n ${DOCUMENT_COLUMNS.DISPATCH_ID} TEXT NOT NULL,\\\n ${DOCUMENT_COLUMNS.JOB_ID} TEXT NOT NULL,\\\n ${DOCUMENT_COLUMNS.OBJECTIVE_REF} TEXT NOT NULL,\\\n ${DOCUMENT_COLUMNS.FILE_NAME} TEXT,\\\n ${DOCUMENT_COLUMNS.FILE_TYPE} TEXT,\\\n ${DOCUMENT_COLUMNS.SYNCED} INTEGER DEFAULT 0 NOT NULL,\\\n ${DOCUMENT_COLUMNS.FMS_ID} TEXT,\\\n ${DOCUMENT_COLUMNS.FMS_FOLDER_ID} TEXT,\\\n ${DOCUMENT_COLUMNS.PRIORITY} INTEGER NOT NULL DEFAULT 1,\\\n ${DOCUMENT_COLUMNS.SYNC_ERROR} TEXT,\\\n ${DOCUMENT_COLUMNS.DESCRIPTION} TEXT);`,\n []\n );\n }\n\n public async insertDocument(\n fmsFolderID: string | null,\n desc: string,\n dspID: string,\n jobID: string,\n objectiveRef: string,\n base64: boolean,\n fileName: string,\n fileType: string,\n data?: string | null,\n filePath?: string | null,\n priority?: number\n ): Promise<SQLResultSet> {\n return await Database.executeQuery(\n `INSERT INTO ${DOCUMENT_TABLE}(\\\n ${DOCUMENT_COLUMNS.DATA},\\\n ${DOCUMENT_COLUMNS.DISPATCH_ID},\\\n ${DOCUMENT_COLUMNS.JOB_ID},\\\n ${DOCUMENT_COLUMNS.OBJECTIVE_REF},\\\n ${DOCUMENT_COLUMNS.FMS_FOLDER_ID},\\\n ${DOCUMENT_COLUMNS.BASE64},\\\n ${DOCUMENT_COLUMNS.FILE_PATH},\\\n ${DOCUMENT_COLUMNS.FILE_NAME},\\\n ${DOCUMENT_COLUMNS.FILE_TYPE},\\\n ${DOCUMENT_COLUMNS.DESCRIPTION},\\\n ${DOCUMENT_COLUMNS.PRIORITY}) \\\n values (?,?,?,?,?,?,?,?,?,?,?)`,\n [\n data,\n dspID,\n jobID,\n objectiveRef,\n fmsFolderID,\n base64,\n filePath,\n fileName,\n fileType,\n desc,\n priority ? priority : 1,\n ]\n );\n }\n\n public async getAllDocuments(dispatchID?: string): Promise<DocumentRow[]> {\n if (!dispatchID) {\n const resultSet = await Database.executeQuery(\n `SELECT * FROM ${DOCUMENT_TABLE};`,\n []\n );\n return resultSet.rows._array;\n } else {\n const resultSet = await Database.executeQuery(\n `SELECT * FROM ${DOCUMENT_TABLE}\\\n WHERE ${DOCUMENT_COLUMNS.DISPATCH_ID} =?;`,\n [dispatchID]\n );\n return resultSet.rows._array;\n }\n }\n\n public async getAllUnsyncedDocs(): Promise<DocumentRow[]> {\n let resultSet = await Database.executeQuery(\n `SELECT * FROM ${DOCUMENT_TABLE} \\\n where ${DOCUMENT_COLUMNS.SYNCED} = 0;`,\n []\n );\n return resultSet.rows._array;\n }\n\n public deleteAllSyncedDocuments(dispatchID: string) {\n return Database.executeQuery(\n `DELETE FROM ${DOCUMENT_TABLE}\\\n WHERE ${DOCUMENT_COLUMNS.SYNCED} = 1 and ${DOCUMENT_COLUMNS.DISPATCH_ID} = ?;`,\n [dispatchID]\n );\n }\n\n public async markDocumentSynced(id: number, fmsID: string): Promise<void> {\n if (!id || !fmsID) return;\n await Database.executeQuery(\n `UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.SYNCED} = 1,${DOCUMENT_COLUMNS.FMS_ID} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`,\n [fmsID, id]\n );\n }\n\n public async updateDocSyncError(\n id: number,\n uploadError: string\n ): Promise<void> {\n if (!id) throw new TypeError('Document ID cannot be null');\n await Database.executeQuery(\n `UPDATE ${DOCUMENT_TABLE}\\\n SET \\\n ${DOCUMENT_COLUMNS.SYNC_ERROR} = ?\\\n WHERE ${DOCUMENT_COLUMNS.ID} = ?;`,\n [uploadError, id]\n );\n }\n\n public async getUnsyncedDocument(): Promise<DocumentRow[]> {\n let rs = await Database.executeQuery(\n `SELECT * from ${DOCUMENT_TABLE}\\\n WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0 \\\n ORDER BY ${DOCUMENT_COLUMNS.PRIORITY} ASC LIMIT 1;`,\n []\n );\n return rs.rows._array;\n }\n}\n"],"mappings":";;;AAAA,SAASA,gBAAgB,EAAEC,cAAc,QAAqB,aAAa;AAC3E,OAAO,KAAKC,QAAQ,MAAM,aAAa;AAGvC,eAAe,MAAMC,eAAe,CAAC;EAG3BC,WAAWA,CAAA,EAAG,CAAC;EAEvB,aAAoBC,WAAWA,CAAA,EAA6B;IAC1D,IAAI,CAACF,eAAe,CAACG,QAAQ,EAAE;MAC7B,IAAIC,eAAe,GAAG,IAAIJ,eAAe,EAAE;MAC3C,MAAMI,eAAe,CAACC,IAAI,EAAE;MAC5BL,eAAe,CAACG,QAAQ,GAAGC,eAAe;IAC5C;IACA,OAAOJ,eAAe,CAACG,QAAQ;EACjC;EAEA,MAAaE,IAAIA,CAAA,EAAkB;IACjC,MAAMN,QAAQ,CAACO,YAAY,CACxB,8BAA6BR,cAAe;AACnD,sBAAsBD,gBAAgB,CAACU,EAAG;AAC1C,sBAAsBV,gBAAgB,CAACW,IAAK;AAC5C,sBAAsBX,gBAAgB,CAACY,MAAO;AAC9C,sBAAsBZ,gBAAgB,CAACa,SAAU;AACjD,sBAAsBb,gBAAgB,CAACc,WAAY;AACnD,sBAAsBd,gBAAgB,CAACe,MAAO;AAC9C,sBAAsBf,gBAAgB,CAACgB,aAAc;AACrD,sBAAsBhB,gBAAgB,CAACiB,SAAU;AACjD,sBAAsBjB,gBAAgB,CAACkB,SAAU;AACjD,sBAAsBlB,gBAAgB,CAACmB,MAAO;AAC9C,sBAAsBnB,gBAAgB,CAACoB,MAAO;AAC9C,sBAAsBpB,gBAAgB,CAACqB,aAAc;AACrD,sBAAsBrB,gBAAgB,CAACsB,QAAS;AAChD,sBAAsBtB,gBAAgB,CAACuB,UAAW;AAClD,sBAAsBvB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BR,cAAe;AACtC,oBAAoBD,gBAAgB,CAACmB,MAAO;AAC5C,uBAAuBnB,gBAAgB,CAACsB,QAAS,eAAc,EACzD,EAAE,CACH;IACD,OAAO6B,EAAE,CAACX,IAAI,CAACC,MAAM;EACvB;AACF;AAACW,eAAA,CAhJoBjD,eAAe"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
4
|
import DocumentManager from './DocumentManager';
|
|
4
5
|
import DocumentHttpClient from './DocumentHttpClient';
|
|
5
6
|
import { isEmptyOrBlank } from '../../../utils/utils';
|
|
@@ -11,52 +12,38 @@ export default class DocumentSyncManager {
|
|
|
11
12
|
get retries() {
|
|
12
13
|
return this._retries;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
15
|
set retries(value) {
|
|
16
16
|
this._retries = value;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
18
|
constructor() {
|
|
20
19
|
_defineProperty(this, "documentHttpClient", void 0);
|
|
21
|
-
|
|
22
20
|
_defineProperty(this, "inProgress", false);
|
|
23
|
-
|
|
24
21
|
_defineProperty(this, "docManager", void 0);
|
|
25
|
-
|
|
26
22
|
_defineProperty(this, "maxRetryCount", 3);
|
|
27
|
-
|
|
28
23
|
_defineProperty(this, "_retries", 0);
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
init(baseURL, retryCount) {
|
|
32
26
|
if (isEmptyOrBlank(baseURL)) throw new BaseError(BaseErrorCodes.InvalidBaseURL, InvalidBaseURL);
|
|
33
27
|
this.maxRetryCount = retryCount;
|
|
34
28
|
this.documentHttpClient = new DocumentHttpClient(baseURL);
|
|
35
29
|
}
|
|
36
|
-
|
|
37
30
|
static getInstance() {
|
|
38
31
|
if (!DocumentSyncManager.instance) {
|
|
39
32
|
DocumentSyncManager.instance = new DocumentSyncManager();
|
|
40
33
|
}
|
|
41
|
-
|
|
42
34
|
return DocumentSyncManager.instance;
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
async startDocumentSync() {
|
|
46
37
|
if (!this.inProgress && this._retries < this.maxRetryCount) {
|
|
47
38
|
this.inProgress = true;
|
|
48
39
|
const hasNetwork = await NetworkUtil.isAvailableAsync();
|
|
49
|
-
|
|
50
40
|
try {
|
|
51
41
|
this.checkForInitialization();
|
|
52
|
-
|
|
53
42
|
if (!this.docManager) {
|
|
54
43
|
this.docManager = await DocumentManager.getInstance();
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
if (hasNetwork) {
|
|
58
46
|
let documentRows = await this.docManager.getUnsyncedDocument();
|
|
59
|
-
|
|
60
47
|
if ((documentRows === null || documentRows === void 0 ? void 0 : documentRows.length) > 0) {
|
|
61
48
|
await this.uploadDocToServer(documentRows[0]);
|
|
62
49
|
} else {
|
|
@@ -67,7 +54,6 @@ export default class DocumentSyncManager {
|
|
|
67
54
|
}
|
|
68
55
|
} catch (error) {} finally {
|
|
69
56
|
this.inProgress = false;
|
|
70
|
-
|
|
71
57
|
if ((await this.isSyncPending()) && hasNetwork) {
|
|
72
58
|
await this.startDocumentSync();
|
|
73
59
|
}
|
|
@@ -76,66 +62,53 @@ export default class DocumentSyncManager {
|
|
|
76
62
|
Logger.getInstance().logEvent('startDocumentSync', 'sync already in progress ', LOG_TYPE.SDK_INFO);
|
|
77
63
|
}
|
|
78
64
|
}
|
|
79
|
-
|
|
80
65
|
async isSyncPending() {
|
|
81
66
|
if (!this.docManager) this.docManager = await DocumentManager.getInstance();
|
|
82
67
|
let leftDocuments = await this.docManager.getAllUnsyncedDocs();
|
|
83
68
|
return (leftDocuments === null || leftDocuments === void 0 ? void 0 : leftDocuments.length) > 0 && this._retries < this.maxRetryCount;
|
|
84
69
|
}
|
|
85
|
-
|
|
86
70
|
async insertDocument(fmsFolderID, data, base64, desc, dspID, jobID, objRef, filePath, fileType, fileName) {
|
|
87
71
|
let priority = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : 1;
|
|
88
72
|
if (isEmptyOrBlank(desc) || isEmptyOrBlank(dspID) || isEmptyOrBlank(jobID) || isEmptyOrBlank(objRef) || isEmptyOrBlank(fileType) || isEmptyOrBlank(fileName) || base64 && isEmptyOrBlank(data) || !base64 && isEmptyOrBlank(filePath)) throw new BaseError(BaseErrorCodes.InvalidArgumentError, InvalidArgumentsError);else {
|
|
89
73
|
var _this$docManager;
|
|
90
|
-
|
|
91
74
|
if (!this.docManager) {
|
|
92
75
|
Logger.getInstance().logEvent('insertDocument', 'INIT DOC SYNC AGAIN', LOG_TYPE.SDK_INFO);
|
|
93
76
|
this.docManager = await DocumentManager.getInstance();
|
|
94
77
|
}
|
|
95
|
-
|
|
96
78
|
let insertResponse = await ((_this$docManager = this.docManager) === null || _this$docManager === void 0 ? void 0 : _this$docManager.insertDocument(fmsFolderID, desc, dspID, jobID, objRef, base64, fileName, fileType, data, filePath, priority));
|
|
97
79
|
return insertResponse;
|
|
98
80
|
}
|
|
99
81
|
}
|
|
100
|
-
|
|
101
82
|
async forceDocumentSync() {
|
|
102
83
|
if (!this.docManager) this.docManager = await DocumentManager.getInstance();
|
|
103
84
|
this._retries = 0;
|
|
104
85
|
await this.startDocumentSync();
|
|
105
86
|
}
|
|
106
|
-
|
|
107
87
|
async updateDocument(documentRow, fmsID) {
|
|
108
88
|
if (!this.docManager) this.docManager = await DocumentManager.getInstance();
|
|
109
|
-
|
|
110
89
|
try {
|
|
111
90
|
await this.docManager.markDocumentSynced(documentRow.id, fmsID);
|
|
112
91
|
} catch (err) {
|
|
113
92
|
Logger.getInstance().logEvent('updateDocument', err.message, LOG_TYPE.SDK_WARNING);
|
|
114
93
|
}
|
|
115
94
|
}
|
|
116
|
-
|
|
117
95
|
async updateDocError(documentRow, uploadError) {
|
|
118
96
|
if (!this.docManager) this.docManager = await DocumentManager.getInstance();
|
|
119
|
-
|
|
120
97
|
try {
|
|
121
98
|
await this.docManager.updateDocSyncError(documentRow.id, uploadError);
|
|
122
99
|
} catch (err) {
|
|
123
100
|
Logger.getInstance().logEvent('updateDocError', err.message, LOG_TYPE.SDK_WARNING);
|
|
124
101
|
}
|
|
125
102
|
}
|
|
126
|
-
|
|
127
103
|
checkForInitialization() {
|
|
128
104
|
if (!this.documentHttpClient) {
|
|
129
105
|
throw new BaseError(BaseErrorCodes.SyncManagerNotInitialized, SyncManagerNotInitialized);
|
|
130
106
|
}
|
|
131
107
|
}
|
|
132
|
-
|
|
133
108
|
async uploadDocToServer(documentRow) {
|
|
134
109
|
try {
|
|
135
110
|
var _this$documentHttpCli;
|
|
136
|
-
|
|
137
111
|
let fmsID = await ((_this$documentHttpCli = this.documentHttpClient) === null || _this$documentHttpCli === void 0 ? void 0 : _this$documentHttpCli.uploadDocument(documentRow));
|
|
138
|
-
|
|
139
112
|
if (fmsID) {
|
|
140
113
|
this._retries = 0;
|
|
141
114
|
await this.updateDocument(documentRow, fmsID);
|
|
@@ -146,7 +119,6 @@ export default class DocumentSyncManager {
|
|
|
146
119
|
}
|
|
147
120
|
} catch (error) {
|
|
148
121
|
var _error$response, _error$response2;
|
|
149
|
-
|
|
150
122
|
this._retries++;
|
|
151
123
|
Logger.getInstance().logEvent('uploadDocToServer-sync-error', error.message, LOG_TYPE.SDK_ERROR);
|
|
152
124
|
await this.updateDocError(documentRow, JSON.stringify({
|
|
@@ -156,18 +128,14 @@ export default class DocumentSyncManager {
|
|
|
156
128
|
}));
|
|
157
129
|
}
|
|
158
130
|
}
|
|
159
|
-
|
|
160
131
|
async getAllDocuments(dispatchID) {
|
|
161
132
|
if (!this.docManager) this.docManager = await DocumentManager.getInstance();
|
|
162
133
|
return this.docManager.getAllDocuments(dispatchID);
|
|
163
134
|
}
|
|
164
|
-
|
|
165
135
|
async clearSyncedDocs(dspID) {
|
|
166
136
|
if (!this.docManager) this.docManager = await DocumentManager.getInstance();
|
|
167
137
|
if (dspID) await this.docManager.deleteAllSyncedDocuments(dspID);
|
|
168
138
|
}
|
|
169
|
-
|
|
170
139
|
}
|
|
171
|
-
|
|
172
140
|
_defineProperty(DocumentSyncManager, "instance", void 0);
|
|
173
141
|
//# sourceMappingURL=DocumentSyncManager.js.map
|