@os1-platform/dispatch-mobile 3.1.9 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/android/.gradle/8.10.2/checksums/checksums.lock +0 -0
- package/android/.gradle/8.10.2/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.10.2/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.10.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/8.10.2/fileHashes/fileHashes.lock +0 -0
- package/android/.idea/caches/deviceStreaming.xml +25 -0
- package/android/build.gradle +3 -12
- package/android/gradle.properties +9 -4
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/dispatchsdk/utils/DispatchSdkUtils.kt +25 -10
- package/babel.config.js +1 -1
- package/lib/commonjs/analytics/sentry/SentrySdkConstants.js +4 -0
- package/lib/commonjs/analytics/sentry/SentrySdkConstants.js.map +1 -1
- package/lib/commonjs/components/executiontasks/captureInput/CaptureText.js +4 -4
- package/lib/commonjs/components/executiontasks/captureInput/CaptureText.js.map +1 -1
- package/lib/commonjs/components/executiontasks/collectPayment/components/CompletePayment.js +2 -2
- package/lib/commonjs/components/executiontasks/collectPayment/components/CompletePayment.js.map +1 -1
- package/lib/commonjs/components/executiontasks/collectPayment/components/InitPayment.js +4 -7
- package/lib/commonjs/components/executiontasks/collectPayment/components/InitPayment.js.map +1 -1
- package/lib/commonjs/components/executiontasks/collectPayment/components/PaymentContactDetails.js +7 -7
- package/lib/commonjs/components/executiontasks/collectPayment/components/PaymentContactDetails.js.map +1 -1
- package/lib/commonjs/components/executiontasks/collectPayment/components/ProcessPayment.js +20 -20
- package/lib/commonjs/components/executiontasks/collectPayment/components/ProcessPayment.js.map +1 -1
- package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js +4 -4
- package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/doodle/SignatureET.js +4 -4
- package/lib/commonjs/components/executiontasks/doodle/SignatureET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js +4 -4
- package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/FormGenerator.js +12 -33
- package/lib/commonjs/components/executiontasks/forms/FormGenerator.js.map +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js +4 -4
- package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js +4 -4
- package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js +4 -4
- package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js +4 -4
- package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/pickup/PickupET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js +4 -4
- package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/ScanET.js +4 -4
- package/lib/commonjs/components/executiontasks/scan/ScanET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/interfaces.js +17 -1
- package/lib/commonjs/components/executiontasks/scan/interfaces.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/sub_components/CScanner.js +4 -4
- package/lib/commonjs/components/executiontasks/scan/sub_components/CScanner.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/sub_components/DropDownUtils.js +1 -1
- package/lib/commonjs/components/executiontasks/scan/sub_components/DropDownUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/sub_components/ERDropDown.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/utils.js +12 -13
- package/lib/commonjs/components/executiontasks/scan/utils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/components/ContactListView.js +4 -5
- package/lib/commonjs/components/executiontasks/validateOTP/components/ContactListView.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/components/OTPView.js +4 -4
- package/lib/commonjs/components/executiontasks/validateOTP/components/OTPView.js.map +1 -1
- package/lib/commonjs/components/executiontasks/verifyOtp/VerifyOtpET.js +5 -9
- package/lib/commonjs/components/executiontasks/verifyOtp/VerifyOtpET.js.map +1 -1
- package/lib/commonjs/components/widgets/CancelOrderDialog.js +2 -2
- package/lib/commonjs/components/widgets/CancelOrderDialog.js.map +1 -1
- package/lib/commonjs/components/widgets/SnackBarCustom.js +0 -3
- package/lib/commonjs/components/widgets/SnackBarCustom.js.map +1 -1
- package/lib/commonjs/components/widgets/Timer.js.map +1 -1
- package/lib/commonjs/database/DBManager.js +112 -0
- package/lib/commonjs/database/DBManager.js.map +1 -0
- package/lib/commonjs/database/dbUpdate.json +6 -0
- package/lib/commonjs/manager/dispatch/DispatchStateContainer.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/EventCodeRepo.js +8 -9
- package/lib/commonjs/manager/dispatchCodes/EventCodeRepo.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeContainer.js +4 -4
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeContainer.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeRepo.js +13 -10
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeRepo.js.map +1 -1
- package/lib/commonjs/manager/location/LocationManager.js +0 -4
- package/lib/commonjs/manager/location/LocationManager.js.map +1 -1
- package/lib/commonjs/manager/sdk/DispatchSDKManager.js +7 -1
- package/lib/commonjs/manager/sdk/DispatchSDKManager.js.map +1 -1
- package/lib/commonjs/manager/sdk/callbacksHandler.js +1 -1
- package/lib/commonjs/manager/sdk/callbacksHandler.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/DBConfig.js +6 -2
- package/lib/commonjs/manager/syncmanager/DBConfig.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/database.js +117 -45
- package/lib/commonjs/manager/syncmanager/database.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentManager.js +17 -22
- package/lib/commonjs/manager/syncmanager/document/DocumentManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js +85 -75
- package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js +24 -26
- package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
- package/lib/commonjs/models/execTasks/ETConfig.js +1 -0
- package/lib/commonjs/models/execTasks/ETConfig.js.map +1 -1
- package/lib/commonjs/models/sdk.js.map +1 -1
- package/lib/commonjs/native/signature/SignatureCapture.js +2 -2
- package/lib/commonjs/native/signature/SignatureCapture.js.map +1 -1
- package/lib/commonjs/network/client.js.map +1 -1
- package/lib/commonjs/ui/screens/ValidateOTPScreen.js.map +1 -1
- package/lib/commonjs/utils/Constants.js.map +1 -1
- package/lib/commonjs/utils/Logger.js +1 -1
- package/lib/commonjs/utils/Logger.js.map +1 -1
- package/lib/commonjs/utils/SdkUtils.js +5 -3
- package/lib/commonjs/utils/SdkUtils.js.map +1 -1
- package/lib/commonjs/utils/SyncManagerUtils.js +2 -0
- package/lib/commonjs/utils/SyncManagerUtils.js.map +1 -1
- package/lib/module/analytics/sentry/SentrySdkConstants.js +4 -0
- package/lib/module/analytics/sentry/SentrySdkConstants.js.map +1 -1
- package/lib/module/components/executiontasks/captureInput/CaptureText.js +3 -3
- package/lib/module/components/executiontasks/captureInput/CaptureText.js.map +1 -1
- package/lib/module/components/executiontasks/collectPayment/components/CompletePayment.js +2 -2
- package/lib/module/components/executiontasks/collectPayment/components/CompletePayment.js.map +1 -1
- package/lib/module/components/executiontasks/collectPayment/components/InitPayment.js +3 -6
- package/lib/module/components/executiontasks/collectPayment/components/InitPayment.js.map +1 -1
- package/lib/module/components/executiontasks/collectPayment/components/PaymentContactDetails.js +6 -6
- package/lib/module/components/executiontasks/collectPayment/components/PaymentContactDetails.js.map +1 -1
- package/lib/module/components/executiontasks/collectPayment/components/ProcessPayment.js +18 -18
- package/lib/module/components/executiontasks/collectPayment/components/ProcessPayment.js.map +1 -1
- package/lib/module/components/executiontasks/deliver/SLDeliverET.js +3 -3
- package/lib/module/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
- package/lib/module/components/executiontasks/doodle/SignatureET.js +3 -3
- package/lib/module/components/executiontasks/doodle/SignatureET.js.map +1 -1
- package/lib/module/components/executiontasks/dropCash/SLDropCash.js +3 -3
- package/lib/module/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
- package/lib/module/components/executiontasks/forms/FormGenerator.js +11 -32
- package/lib/module/components/executiontasks/forms/FormGenerator.js.map +1 -1
- package/lib/module/components/executiontasks/imageCapture/ImageCapture.js +4 -4
- package/lib/module/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
- package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js +3 -3
- package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
- package/lib/module/components/executiontasks/payments/init/InitPaymentET.js +3 -3
- package/lib/module/components/executiontasks/payments/init/InitPaymentET.js.map +1 -1
- package/lib/module/components/executiontasks/payments/processPayment/ProcessPaymentET.js +3 -3
- package/lib/module/components/executiontasks/payments/processPayment/ProcessPaymentET.js.map +1 -1
- package/lib/module/components/executiontasks/pickup/PickupET.js.map +1 -1
- package/lib/module/components/executiontasks/pickup/SLPickupET.js +3 -3
- package/lib/module/components/executiontasks/pickup/SLPickupET.js.map +1 -1
- package/lib/module/components/executiontasks/scan/ScanET.js +3 -3
- package/lib/module/components/executiontasks/scan/ScanET.js.map +1 -1
- package/lib/module/components/executiontasks/scan/interfaces.js +16 -0
- package/lib/module/components/executiontasks/scan/interfaces.js.map +1 -1
- package/lib/module/components/executiontasks/scan/sub_components/CScanner.js +5 -5
- package/lib/module/components/executiontasks/scan/sub_components/CScanner.js.map +1 -1
- package/lib/module/components/executiontasks/scan/sub_components/DropDownUtils.js +2 -2
- package/lib/module/components/executiontasks/scan/sub_components/DropDownUtils.js.map +1 -1
- package/lib/module/components/executiontasks/scan/sub_components/ERDropDown.js.map +1 -1
- package/lib/module/components/executiontasks/scan/utils.js +13 -14
- package/lib/module/components/executiontasks/scan/utils.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/components/ContactListView.js +3 -4
- package/lib/module/components/executiontasks/validateOTP/components/ContactListView.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/components/OTPView.js +3 -3
- package/lib/module/components/executiontasks/validateOTP/components/OTPView.js.map +1 -1
- package/lib/module/components/executiontasks/verifyOtp/VerifyOtpET.js +6 -9
- package/lib/module/components/executiontasks/verifyOtp/VerifyOtpET.js.map +1 -1
- package/lib/module/components/widgets/CancelOrderDialog.js +1 -1
- package/lib/module/components/widgets/CancelOrderDialog.js.map +1 -1
- package/lib/module/components/widgets/SnackBarCustom.js +0 -2
- package/lib/module/components/widgets/SnackBarCustom.js.map +1 -1
- package/lib/module/components/widgets/Timer.js.map +1 -1
- package/lib/module/database/DBManager.js +104 -0
- package/lib/module/database/DBManager.js.map +1 -0
- package/lib/module/database/dbUpdate.json +6 -0
- package/lib/module/manager/dispatch/DispatchStateContainer.js.map +1 -1
- package/lib/module/manager/dispatchCodes/EventCodeRepo.js +7 -7
- package/lib/module/manager/dispatchCodes/EventCodeRepo.js.map +1 -1
- package/lib/module/manager/dispatchCodes/ReasonCodeContainer.js +4 -4
- package/lib/module/manager/dispatchCodes/ReasonCodeContainer.js.map +1 -1
- package/lib/module/manager/dispatchCodes/ReasonCodeRepo.js +13 -8
- package/lib/module/manager/dispatchCodes/ReasonCodeRepo.js.map +1 -1
- package/lib/module/manager/location/LocationManager.js +0 -4
- package/lib/module/manager/location/LocationManager.js.map +1 -1
- package/lib/module/manager/sdk/DispatchSDKManager.js +7 -1
- package/lib/module/manager/sdk/DispatchSDKManager.js.map +1 -1
- package/lib/module/manager/sdk/callbacksHandler.js +0 -2
- package/lib/module/manager/sdk/callbacksHandler.js.map +1 -1
- package/lib/module/manager/syncmanager/DBConfig.js +5 -1
- package/lib/module/manager/syncmanager/DBConfig.js.map +1 -1
- package/lib/module/manager/syncmanager/database.js +117 -43
- package/lib/module/manager/syncmanager/database.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentManager.js +16 -20
- package/lib/module/manager/syncmanager/document/DocumentManager.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentSyncManager.js +85 -75
- package/lib/module/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
- package/lib/module/manager/syncmanager/events/ETEventsManager.js +20 -22
- package/lib/module/manager/syncmanager/events/ETEventsManager.js.map +1 -1
- package/lib/module/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
- package/lib/module/models/execTasks/ETConfig.js +1 -0
- package/lib/module/models/execTasks/ETConfig.js.map +1 -1
- package/lib/module/models/sdk.js.map +1 -1
- package/lib/module/native/signature/SignatureCapture.js +2 -2
- package/lib/module/native/signature/SignatureCapture.js.map +1 -1
- package/lib/module/network/client.js.map +1 -1
- package/lib/module/ui/screens/ValidateOTPScreen.js.map +1 -1
- package/lib/module/utils/Constants.js.map +1 -1
- package/lib/module/utils/Logger.js +1 -1
- package/lib/module/utils/Logger.js.map +1 -1
- package/lib/module/utils/SdkUtils.js +5 -3
- package/lib/module/utils/SdkUtils.js.map +1 -1
- package/lib/module/utils/SyncManagerUtils.js +2 -0
- package/lib/module/utils/SyncManagerUtils.js.map +1 -1
- package/lib/typescript/babel.config.d.ts +1 -0
- package/lib/typescript/jest.config.d.ts +7 -0
- package/lib/typescript/jest.setup.d.ts +1 -0
- package/lib/typescript/scripts/bootstrap.d.ts +1 -0
- package/lib/typescript/{components → src/components}/executiontasks/scan/interfaces.d.ts +15 -0
- package/lib/typescript/{components → src/components}/executiontasks/validateOTP/ValidateOTPSchema.d.ts +1 -1
- package/lib/typescript/{components → src/components}/widgets/CancelOrderDialog.d.ts +1 -1
- package/lib/typescript/{components → src/components}/widgets/SnackBarCustom.d.ts +3 -2
- package/lib/typescript/src/components/widgets/Timer.d.ts +6 -0
- package/lib/typescript/src/database/DBManager.d.ts +1 -0
- package/lib/typescript/{manager → src/manager}/dispatchCodes/EventCodeRepo.d.ts +1 -1
- package/lib/typescript/{manager → src/manager}/dispatchCodes/ReasonCodeRepo.d.ts +5 -3
- package/lib/typescript/{manager → src/manager}/syncmanager/DBConfig.d.ts +5 -1
- package/lib/typescript/src/manager/syncmanager/database.d.ts +31 -0
- package/lib/typescript/{manager → src/manager}/syncmanager/document/DocumentManager.d.ts +2 -3
- package/lib/typescript/{manager → src/manager}/syncmanager/document/DocumentSyncManager.d.ts +1 -2
- package/lib/typescript/{network → src/network}/client.d.ts +2 -2
- package/lib/typescript/{utils → src/utils}/Constants.d.ts +4 -0
- package/package.json +76 -104
- package/src/components/executiontasks/captureInput/CaptureText.tsx +6 -6
- package/src/components/executiontasks/collectPayment/components/CompletePayment.tsx +2 -3
- package/src/components/executiontasks/collectPayment/components/InitPayment.tsx +3 -7
- package/src/components/executiontasks/collectPayment/components/PaymentContactDetails.tsx +3 -4
- package/src/components/executiontasks/collectPayment/components/ProcessPayment.tsx +4 -5
- package/src/components/executiontasks/deliver/SLDeliverET.tsx +3 -4
- package/src/components/executiontasks/doodle/SignatureET.tsx +4 -4
- package/src/components/executiontasks/dropCash/SLDropCash.tsx +3 -4
- package/src/components/executiontasks/forms/FormGenerator.tsx +38 -55
- package/src/components/executiontasks/imageCapture/ImageCapture.tsx +5 -7
- package/src/components/executiontasks/payments/completePayment/CompletePaymentET.tsx +3 -4
- package/src/components/executiontasks/payments/init/InitPaymentET.tsx +3 -4
- package/src/components/executiontasks/payments/processPayment/ProcessPaymentET.tsx +3 -4
- package/src/components/executiontasks/pickup/PickupET.tsx +3 -9
- package/src/components/executiontasks/pickup/SLPickupET.tsx +3 -4
- package/src/components/executiontasks/scan/ScanET.tsx +3 -4
- package/src/components/executiontasks/scan/interfaces.ts +16 -0
- package/src/components/executiontasks/scan/sub_components/CScanner.tsx +7 -6
- package/src/components/executiontasks/scan/sub_components/DropDownUtils.ts +2 -2
- package/src/components/executiontasks/scan/sub_components/ERDropDown.tsx +0 -1
- package/src/components/executiontasks/scan/utils.ts +13 -13
- package/src/components/executiontasks/validateOTP/ValidateOTPET.tsx +5 -0
- package/src/components/executiontasks/validateOTP/ValidateOTPSchema.ts +1 -1
- package/src/components/executiontasks/validateOTP/components/ContactListView.tsx +3 -11
- package/src/components/executiontasks/validateOTP/components/OTPView.tsx +3 -4
- package/src/components/executiontasks/verifyOtp/VerifyOtpET.tsx +8 -16
- package/src/components/widgets/CancelOrderDialog.tsx +2 -2
- package/src/components/widgets/SnackBarCustom.tsx +2 -4
- package/src/components/widgets/Timer.tsx +0 -1
- package/src/database/DBManager.ts +118 -0
- package/src/database/dbUpdate.json +6 -0
- package/src/manager/dispatch/DispatchStateContainer.tsx +5 -25
- package/src/manager/dispatchCodes/EventCodeRepo.ts +8 -12
- package/src/manager/dispatchCodes/ReasonCodeContainer.ts +5 -5
- package/src/manager/dispatchCodes/ReasonCodeRepo.ts +17 -15
- package/src/manager/location/LocationManager.ts +1 -8
- package/src/manager/sdk/DispatchSDKManager.ts +12 -4
- package/src/manager/sdk/callbacksHandler.ts +3 -8
- package/src/manager/syncmanager/DBConfig.ts +6 -1
- package/src/manager/syncmanager/database.ts +130 -71
- package/src/manager/syncmanager/document/DocumentManager.ts +19 -24
- package/src/manager/syncmanager/document/DocumentSyncManager.ts +95 -82
- package/src/manager/syncmanager/events/ETEventsManager.ts +30 -35
- package/src/manager/syncmanager/events/EventsSyncManager.ts +1 -1
- package/src/models/sdk.ts +2 -6
- package/src/native/signature/SignatureCapture.tsx +4 -3
- package/src/network/client.ts +2 -2
- package/src/ui/screens/ValidateOTPScreen.tsx +2 -4
- package/src/utils/Constants.ts +6 -1
- package/src/utils/Logger.ts +2 -1
- package/src/utils/SdkUtils.ts +6 -7
- package/src/utils/SyncManagerUtils.ts +1 -0
- package/tsconfig.build.json +1 -1
- package/tsconfig.json +2 -3
- package/lib/typescript/components/widgets/Timer.d.ts +0 -7
- package/lib/typescript/manager/syncmanager/database.d.ts +0 -7
- /package/lib/typescript/{analytics → src/analytics}/firebase/FirebaseLogging.d.ts +0 -0
- /package/lib/typescript/{analytics → src/analytics}/sentry/SentryAnalyticsSingleton.d.ts +0 -0
- /package/lib/typescript/{analytics → src/analytics}/sentry/SentryAnalyticsUtils.d.ts +0 -0
- /package/lib/typescript/{analytics → src/analytics}/sentry/SentryModels.d.ts +0 -0
- /package/lib/typescript/{analytics → src/analytics}/sentry/SentrySdkConstants.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/dispatch/DispatchExecNavigator.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/CompletedWFSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/ExecutionTasksIndex.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/cancellation/CancelET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/cancellation/CancellationSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/captureInput/CaptureInputSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/captureInput/CaptureText.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/captureInput/utils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/CollectPayment.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/CollectPaymentSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/PaymentStyles.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/PaymentUtils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/components/CompletePayment.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/components/CustomContactsModal.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/components/InitPayment.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/components/PaymentContactDetails.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/collectPayment/components/ProcessPayment.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/deliver/DeliverET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/deliver/DeliverETInput.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/deliver/SLDeliverET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/display/DisplayModalET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/display/DisplaySchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/doodle/SignatureET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/doodle/SignatureSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/dropCash/DropCashET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/dropCash/DropCashSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/dropCash/SLDropCash.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/forms/FormGenerator.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/forms/FormSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/forms/widgets/DateTimeWidget.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/forms/widgets/DropdownWidget.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/forms/widgets/QRBarcodeScannerWidget.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/forms/widgets/TimeRangeSelector.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/httpRequest/HttpEtUtils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/httpRequest/HttpRequestET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/httpRequest/HttpRequestETSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/imageCapture/CaptureSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/imageCapture/CaptureUtils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/imageCapture/ImageCapture.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/payments/PaymentStyles.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/payments/PaymentUtils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/payments/completePayment/CompletePaymentET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/payments/completePayment/CompletePaymentSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/payments/init/InitPaymentET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/payments/init/InitPaymentSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/payments/processPayment/ProcessPaymentET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/payments/processPayment/ProcessPaymentSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/pickup/PickpSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/pickup/PickupET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/pickup/SLPickupET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/scan/ScanET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/scan/ScanSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/scan/constants.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/scan/modalConstant.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/scan/sub_components/CScanner.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/scan/sub_components/DropDownUtils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/scan/sub_components/ERDropDown.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/scan/sub_components/SummaryPage.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/scan/utils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/ValidateOTPET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/ValidateOtpStyles.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/components/ContactListView.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/components/OTPView.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/components/VerificationComplete.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/constants.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/sub-components/ContactCard.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/sub-components/OTPInput.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/sub-components/ResendOTPButton.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/validateOTP/utils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/verifyInput/VerifyInputSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/verifyLocation/GeofenceUtils.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/verifyLocation/VerifyLocSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/verifyLocation/VerifyLocationET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/verifyOtp/VerifyOtpET.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/executiontasks/verifyOtp/VerifyOtpSchema.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/utils/Scale.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/utils/index.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/widgets/AlertDisplay.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/widgets/Card.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/widgets/ConfirmCancelModal.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/widgets/GoBackModal.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/widgets/IconButton.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/widgets/ModalWidget.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/widgets/ProgressDialog.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/widgets/SearchBar.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/widgets/SplitTextInput.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/widgets/TabsComponent.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/widgets/Toaster.d.ts +0 -0
- /package/lib/typescript/{config → src/config}/DispatchSDKConfig.d.ts +0 -0
- /package/lib/typescript/{constants → src/constants}/apiConstants.d.ts +0 -0
- /package/lib/typescript/{constants → src/constants}/constants.d.ts +0 -0
- /package/lib/typescript/{constants → src/constants}/statuscode.d.ts +0 -0
- /package/lib/typescript/{errors → src/errors}/BaseError.d.ts +0 -0
- /package/lib/typescript/{errors → src/errors}/ErrorCodes.d.ts +0 -0
- /package/lib/typescript/{events → src/events}/EventDispatcher.d.ts +0 -0
- /package/lib/typescript/{events → src/events}/EventListener.d.ts +0 -0
- /package/lib/typescript/{events → src/events}/constants.d.ts +0 -0
- /package/lib/typescript/{events → src/events}/index.d.ts +0 -0
- /package/lib/typescript/{events → src/events}/interface.d.ts +0 -0
- /package/lib/typescript/{icons → src/icons}/CircleMark.d.ts +0 -0
- /package/lib/typescript/{icons → src/icons}/FailedIcon.d.ts +0 -0
- /package/lib/typescript/{icons → src/icons}/FailureCloseIcon.d.ts +0 -0
- /package/lib/typescript/{icons → src/icons}/ScanIcon.d.ts +0 -0
- /package/lib/typescript/{icons → src/icons}/SuccessCompleteIcon.d.ts +0 -0
- /package/lib/typescript/{icons → src/icons}/file.d.ts +0 -0
- /package/lib/typescript/{icons → src/icons}/index.d.ts +0 -0
- /package/lib/typescript/{icons → src/icons}/interface.d.ts +0 -0
- /package/lib/typescript/{index.d.ts → src/index.d.ts} +0 -0
- /package/lib/typescript/{locale → src/locale}/Str.d.ts +0 -0
- /package/lib/typescript/{locale → src/locale}/i18n.d.ts +0 -0
- /package/lib/typescript/{locale → src/locale}/util.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/dispatch/DispatchStateContainer.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/dispatchCodes/EventCodeContainer.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/dispatchCodes/ReasonCodeContainer.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/jobRemoval/JobRemovalManager.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/location/LocationManager.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/sdk/DispatchSDKManager.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/sdk/DispatchSdkCache.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/sdk/callbacksHandler.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/syncmanager/AppSyncManager.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/syncmanager/NativeSyncManager.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/syncmanager/constants.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/syncmanager/document/DocumentHttpClient.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/syncmanager/document/models.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/syncmanager/events/ETEventsManager.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/syncmanager/events/EventsGraphQLClient.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/syncmanager/events/EventsSyncManager.d.ts +0 -0
- /package/lib/typescript/{manager → src/manager}/syncmanager/events/SyncHttpClient.d.ts +0 -0
- /package/lib/typescript/{models → src/models}/DispatchModels.d.ts +0 -0
- /package/lib/typescript/{models → src/models}/ReasonCodes.d.ts +0 -0
- /package/lib/typescript/{models → src/models}/auth.d.ts +0 -0
- /package/lib/typescript/{models → src/models}/execTasks/ETBaseModels.d.ts +0 -0
- /package/lib/typescript/{models → src/models}/execTasks/ETConfig.d.ts +0 -0
- /package/lib/typescript/{models → src/models}/execution.d.ts +0 -0
- /package/lib/typescript/{models → src/models}/fcm.d.ts +0 -0
- /package/lib/typescript/{models → src/models}/sdk.d.ts +0 -0
- /package/lib/typescript/{native → src/native}/LocationModule.d.ts +0 -0
- /package/lib/typescript/{native → src/native}/PermissionModule.d.ts +0 -0
- /package/lib/typescript/{native → src/native}/signature/SignatureCapture.d.ts +0 -0
- /package/lib/typescript/{network → src/network}/GraphQLClient.d.ts +0 -0
- /package/lib/typescript/{network → src/network}/NetworkClient.d.ts +0 -0
- /package/lib/typescript/{network → src/network}/NetworkUtils.d.ts +0 -0
- /package/lib/typescript/{network → src/network}/Queries.d.ts +0 -0
- /package/lib/typescript/{res → src/res}/strings.d.ts +0 -0
- /package/lib/typescript/{resources → src/resources}/Login.d.ts +0 -0
- /package/lib/typescript/{resources → src/resources}/network.d.ts +0 -0
- /package/lib/typescript/{styles → src/styles}/SdkColors.d.ts +0 -0
- /package/lib/typescript/{styles → src/styles}/executionTasks/CommonStyles.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/CancellationScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/CaptureInputScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/CollectPaymentScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/CompleteObjectiveScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/DeliverScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/DisplayScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/DoodleScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/DropCashScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/ETScreensIndex.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/FormsScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/GeofenceScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/HttpRequestScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/ImageCaptureScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/PaymentScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/PickupScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/ScanScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/StartWorkFlowScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/ValidateOTPScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/screens/WithBaseDispatchScreen.d.ts +0 -0
- /package/lib/typescript/{ui → src/ui}/uiConfig/RouteParams.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/ApiUtils.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/Enums.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/ExecTaskUtils.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/Logger.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/NetworkUtil.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/SdkUtils.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/SyncManagerUtils.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/context/paymentContext.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/context/valdiateOTPContext.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/fcm/FCM.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/fcm/FcmUtils.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/helper.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/hooks/useModal.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/hooks/useTimer.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/loginHelper.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/storage.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/utils.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","PermissionModule","LocationModule","LocationManager","constructor","_defineProperty","checkForLocationPermissions","
|
|
1
|
+
{"version":3,"names":["Platform","PermissionModule","LocationModule","LocationManager","constructor","_defineProperty","checkForLocationPermissions","OS","foregroundPermission","requestForegroundPermissions","startUpdates","stopLocationUpdates","getInstance","instance","startLocationUpdates","subscription","addLocationListener","location","lastLocationAndroid","console","log","getLastLocation","latitude","toString","longitude","accuracy","lastLocationiOS","removeLocationListener","error","_LocationManager"],"sources":["LocationManager.ts"],"sourcesContent":["import { EmitterSubscription, Platform } from 'react-native';\nimport PermissionModule from '../../native/PermissionModule';\nimport LocationModule, { LocationType } from '../../native/LocationModule';\n\nexport default class LocationManager {\n private static instance: LocationManager;\n private lastLocationAndroid: LocationType | null = null;\n private lastLocationiOS: LocationType | null = null;\n private stopUpdate: { remove(): void } | undefined;\n private subscription: EmitterSubscription | null = null;\n\n public async checkForLocationPermissions(): Promise<boolean> {\n if (Platform.OS === 'ios') {\n // old code checking for permissions using expo-location\n // let permissionResponse = await Location.getForegroundPermissionsAsync();\n // if (permissionResponse.status === 'granted') {\n // this.startUpdates();\n // return true;\n // } else {\n // let { status } = await Location.requestForegroundPermissionsAsync();\n // if (status === 'granted') {\n // this.startUpdates();\n // return true;\n // } else {\n // this.stopLocationUpdates();\n // return false;\n // }\n // }\n let foregroundPermission = await PermissionModule.requestForegroundPermissions();\n if (foregroundPermission) {\n this.startUpdates();\n return true;\n } else {\n this.stopLocationUpdates();\n return false;\n }\n }\n if (Platform.OS === 'android') {\n let foregroundPermission = await PermissionModule.requestForegroundPermissions();\n if (foregroundPermission) {\n this.startUpdates();\n return true;\n } else {\n this.stopLocationUpdates();\n return false;\n }\n }\n return true;\n }\n\n public static getInstance(): LocationManager {\n if (!LocationManager.instance) {\n LocationManager.instance = new LocationManager();\n }\n return LocationManager.instance;\n }\n\n public startUpdates() {\n if (Platform.OS === 'android') {\n LocationModule.startLocationUpdates();\n this.subscription = LocationModule.addLocationListener((location) => {\n if (location != null) {\n this.lastLocationAndroid = location\n }\n });\n }\n\n if (Platform.OS === 'ios') {\n console.log(\"startUpdates\");\n LocationModule.startLocationUpdates();\n // this.subscription = LocationModule.addLocationListener((location) => {\n // console.log('Location updated:', location);\n // if (location != null) {\n // this.lastLocationiOS = location\n // }\n // });\n }\n }\n\n public async getLastLocation(): Promise<DLocation> {\n if (Platform.OS === 'android' && this.lastLocationAndroid != null) {\n return {\n latitude: this.lastLocationAndroid.latitude.toString(),\n longitude: this.lastLocationAndroid.longitude.toString(),\n accuracy: this.lastLocationAndroid.accuracy.toString(),\n };\n }\n if (Platform.OS === 'ios') {\n this.lastLocationiOS = await LocationModule.getLastLocation();\n if (this.lastLocationiOS) {\n return {\n latitude: this.lastLocationiOS.latitude.toString(),\n longitude: this.lastLocationiOS.longitude.toString(),\n accuracy: this.lastLocationiOS.accuracy.toString(),\n };\n }\n }\n return {\n latitude: 'null',\n longitude: 'null',\n accuracy: 'null',\n };\n }\n\n\n public stopLocationUpdates() {\n try {\n // code for android\n if (Platform.OS === 'android') {\n if (this.subscription) {\n LocationModule.removeLocationListener(this.subscription);\n }\n }\n\n // code for ios\n if (Platform.OS === 'ios') {\n if (this.subscription) {\n LocationModule.removeLocationListener(this.subscription);\n }\n }\n } catch (error: any) { }\n }\n}\n\nexport interface DLocation {\n latitude: string;\n longitude: string;\n accuracy: string;\n}\n"],"mappings":";;;;AAAA,SAA8BA,QAAQ,QAAQ,cAAc;AAC5D,OAAOC,gBAAgB,MAAM,+BAA+B;AAC5D,OAAOC,cAAc,MAAwB,6BAA6B;AAE1E,eAAe,MAAMC,eAAe,CAAC;EAAAC,YAAA;IAAAC,eAAA,8BAEgB,IAAI;IAAAA,eAAA,0BACR,IAAI;IAAAA,eAAA;IAAAA,eAAA,uBAEA,IAAI;EAAA;EAEvD,MAAaC,2BAA2BA,CAAA,EAAqB;IAC3D,IAAIN,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;MACzB;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,IAAIC,oBAAoB,GAAG,MAAMP,gBAAgB,CAACQ,4BAA4B,CAAC,CAAC;MAChF,IAAID,oBAAoB,EAAE;QACxB,IAAI,CAACE,YAAY,CAAC,CAAC;QACnB,OAAO,IAAI;MACb,CAAC,MAAM;QACL,IAAI,CAACC,mBAAmB,CAAC,CAAC;QAC1B,OAAO,KAAK;MACd;IACF;IACA,IAAIX,QAAQ,CAACO,EAAE,KAAK,SAAS,EAAE;MAC7B,IAAIC,oBAAoB,GAAG,MAAMP,gBAAgB,CAACQ,4BAA4B,CAAC,CAAC;MAChF,IAAID,oBAAoB,EAAE;QACxB,IAAI,CAACE,YAAY,CAAC,CAAC;QACnB,OAAO,IAAI;MACb,CAAC,MAAM;QACL,IAAI,CAACC,mBAAmB,CAAC,CAAC;QAC1B,OAAO,KAAK;MACd;IACF;IACA,OAAO,IAAI;EACb;EAEA,OAAcC,WAAWA,CAAA,EAAoB;IAC3C,IAAI,CAACT,eAAe,CAACU,QAAQ,EAAE;MAC7BV,eAAe,CAACU,QAAQ,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AACD,QAAQ,CAAC,CAAC;UACpDE,QAAQ,EAAE,IAAI,CAACC,eAAe,CAACD,QAAQ,CAACF,QAAQ,CAAC;QACnD,CAAC;MACH;IACF;IACA,OAAO;MACLD,QAAQ,EAAE,MAAM;MAChBE,SAAS,EAAE,MAAM;MACjBC,QAAQ,EAAE;IACZ,CAAC;EACH;EAGOd,mBAAmBA,CAAA,EAAG;IAC3B,IAAI;MACF;MACA,IAAIX,QAAQ,CAACO,EAAE,KAAK,SAAS,EAAE;QAC7B,IAAI,IAAI,CAACQ,YAAY,EAAE;UACrBb,cAAc,CAACyB,sBAAsB,CAAC,IAAI,CAACZ,YAAY,CAAC;QAC1D;MACF;;MAEA;MACA,IAAIf,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;QACzB,IAAI,IAAI,CAACQ,YAAY,EAAE;UACrBb,cAAc,CAACyB,sBAAsB,CAAC,IAAI,CAACZ,YAAY,CAAC;QAC1D;MACF;IACF,CAAC,CAAC,OAAOa,KAAU,EAAE,CAAE;EACzB;AACF;AAACC,gBAAA,GAtHoB1B,eAAe;AAAAE,eAAA,CAAfF,eAAe","ignoreList":[]}
|
|
@@ -20,6 +20,7 @@ import { pushBulkEventForSync } from '../../utils/SyncManagerUtils';
|
|
|
20
20
|
import callbackHandler from './callbacksHandler';
|
|
21
21
|
import { DispatchExecutor as dispatchExecutor } from '@os1-platform/platform-coreos-execution-engine-sdk';
|
|
22
22
|
import { MAX_RETRY_COUNT } from '../syncmanager/constants';
|
|
23
|
+
import { initAndUpdateDatabase } from '../../database/DBManager';
|
|
23
24
|
export class DispatchSDKManager {
|
|
24
25
|
constructor() {
|
|
25
26
|
_defineProperty(this, "cache", DispatchSdkCache.getInstance());
|
|
@@ -49,11 +50,16 @@ export class DispatchSDKManager {
|
|
|
49
50
|
enableNative: true,
|
|
50
51
|
environment: sdkConfig.sentry.env,
|
|
51
52
|
dsn: sdkConfig.sentry.dsn,
|
|
52
|
-
tracesSampleRate: 1.0
|
|
53
|
+
tracesSampleRate: 1.0,
|
|
54
|
+
enableAutoSessionTracking: true,
|
|
55
|
+
enableAutoPerformanceTracing: false,
|
|
56
|
+
attachStacktrace: true,
|
|
57
|
+
maxBreadcrumbs: 50
|
|
53
58
|
});
|
|
54
59
|
}
|
|
55
60
|
await SdkUtils.checkMandatory();
|
|
56
61
|
await this.cache.setObjectInCache(this.keys.SDK_CONFIG, sdkConfig);
|
|
62
|
+
await initAndUpdateDatabase();
|
|
57
63
|
GraphQLClient.init(sdkConfig.tenantBaseURL);
|
|
58
64
|
AppSyncManager.initAppSync(sdkConfig.tenantBaseURL, sdkConfig.syncRetryCount ?? MAX_RETRY_COUNT);
|
|
59
65
|
LocationManager.getInstance().startUpdates();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DispatchSdkCache","LocationManager","AppSyncManager","Logger","ReasonCodeContainer","GraphQLClient","isMandatoryKeysPresent","isTokenExpired","BaseError","ErrorCodes","SdkUtils","Sentry","EventCodeRepo","Storage","pushBulkEventForSync","callbackHandler","DispatchExecutor","dispatchExecutor","MAX_RETRY_COUNT","DispatchSDKManager","constructor","_defineProperty","getInstance","KEYS","instance","initDispatchSDK","sdkConfig","_sdkConfig$sentry","_sdkConfig$callbacks","_sdkConfig$callbacks2","_sdkConfig$callbacks3","_sdkConfig$callbacks4","InvalidArgumentError","accessToken","ACCESS_TOKEN_EXPIRED","sentry","enabled","init","enableNative","environment","env","dsn","tracesSampleRate","checkMandatory","cache","setObjectInCache","keys","SDK_CONFIG","tenantBaseURL","initAppSync","syncRetryCount","startUpdates","eventMapping","saveEventCode","fetchReasonCode","setLogging","enableLogging","storage","callbacks","fetchPhoneNumbersCallback","fetchDateTimeCallback","tokenRefreshCallback","fetchSDSEmailAndPhoneNumbersCallback","_sdkConfig$callbacks5","storeMultipleKeysCallback","setSharedItems","readMultipleKeysCallback","getSharedItems","deleteMultipleKeysCallback","removeSharedItems","eventBulkSyncCallback","debugLevelLog","startSDKSyncManager","logCora","removeLocationUpdates","stopLocationUpdates","_DispatchSDKManager"],"sources":["DispatchSDKManager.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport DispatchSdkCache from './DispatchSdkCache';\nimport LocationManager from '../location/LocationManager';\nimport AppSyncManager from '../syncmanager/AppSyncManager';\nimport Logger from '../../utils/Logger';\nimport ReasonCodeContainer from '../dispatchCodes/ReasonCodeContainer';\nimport GraphQLClient from '../../network/GraphQLClient';\nimport { isMandatoryKeysPresent, isTokenExpired } from '../../utils/utils';\nimport { BaseError } from '../../errors/BaseError';\nimport ErrorCodes from '../../errors/ErrorCodes';\nimport SdkUtils from '../../utils/SdkUtils';\nimport * as Sentry from '@sentry/react-native';\nimport type { DispatchSDKConfig } from '../../models/sdk';\nimport EventCodeRepo from '../dispatchCodes/EventCodeRepo';\nimport Storage from '../../utils/storage';\nimport { pushBulkEventForSync } from '../../utils/SyncManagerUtils';\nimport callbackHandler from './callbacksHandler';\nimport { DispatchExecutor as dispatchExecutor } from '@os1-platform/platform-coreos-execution-engine-sdk';\nimport { MAX_RETRY_COUNT } from '../syncmanager/constants';\n\nexport class DispatchSDKManager {\n private static instance: DispatchSDKManager;\n private cache: DispatchSdkCache = DispatchSdkCache.getInstance();\n private keys = DispatchSdkCache.KEYS;\n\n private constructor() { }\n\n public static getInstance(): DispatchSDKManager {\n if (!DispatchSDKManager.instance) {\n DispatchSDKManager.instance = new DispatchSDKManager();\n }\n return DispatchSDKManager.instance;\n }\n\n /**\n * Call this init method with username,userID & authentication tokens\n * @param sdkConfig\n */\n public async initDispatchSDK(sdkConfig: DispatchSDKConfig) {\n if (\n !isMandatoryKeysPresent(sdkConfig, [\n 'tenantID',\n 'userID',\n 'userName',\n 'tenantBaseURL',\n 'domain',\n 'accessToken',\n ])\n ) {\n throw new BaseError(
|
|
1
|
+
{"version":3,"names":["DispatchSdkCache","LocationManager","AppSyncManager","Logger","ReasonCodeContainer","GraphQLClient","isMandatoryKeysPresent","isTokenExpired","BaseError","ErrorCodes","SdkUtils","Sentry","EventCodeRepo","Storage","pushBulkEventForSync","callbackHandler","DispatchExecutor","dispatchExecutor","MAX_RETRY_COUNT","initAndUpdateDatabase","DispatchSDKManager","constructor","_defineProperty","getInstance","KEYS","instance","initDispatchSDK","sdkConfig","_sdkConfig$sentry","_sdkConfig$callbacks","_sdkConfig$callbacks2","_sdkConfig$callbacks3","_sdkConfig$callbacks4","InvalidArgumentError","accessToken","ACCESS_TOKEN_EXPIRED","sentry","enabled","init","enableNative","environment","env","dsn","tracesSampleRate","enableAutoSessionTracking","enableAutoPerformanceTracing","attachStacktrace","maxBreadcrumbs","checkMandatory","cache","setObjectInCache","keys","SDK_CONFIG","tenantBaseURL","initAppSync","syncRetryCount","startUpdates","eventMapping","saveEventCode","fetchReasonCode","setLogging","enableLogging","storage","callbacks","fetchPhoneNumbersCallback","fetchDateTimeCallback","tokenRefreshCallback","fetchSDSEmailAndPhoneNumbersCallback","_sdkConfig$callbacks5","storeMultipleKeysCallback","setSharedItems","readMultipleKeysCallback","getSharedItems","deleteMultipleKeysCallback","removeSharedItems","eventBulkSyncCallback","debugLevelLog","startSDKSyncManager","logCora","removeLocationUpdates","stopLocationUpdates","_DispatchSDKManager"],"sources":["DispatchSDKManager.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport DispatchSdkCache from './DispatchSdkCache';\nimport LocationManager from '../location/LocationManager';\nimport AppSyncManager from '../syncmanager/AppSyncManager';\nimport Logger from '../../utils/Logger';\nimport ReasonCodeContainer from '../dispatchCodes/ReasonCodeContainer';\nimport GraphQLClient from '../../network/GraphQLClient';\nimport { isMandatoryKeysPresent, isTokenExpired } from '../../utils/utils';\nimport { BaseError } from '../../errors/BaseError';\nimport ErrorCodes from '../../errors/ErrorCodes';\nimport SdkUtils from '../../utils/SdkUtils';\nimport * as Sentry from '@sentry/react-native';\nimport type { DispatchSDKConfig } from '../../models/sdk';\nimport EventCodeRepo from '../dispatchCodes/EventCodeRepo';\nimport Storage from '../../utils/storage';\nimport { pushBulkEventForSync } from '../../utils/SyncManagerUtils';\nimport callbackHandler from './callbacksHandler';\nimport { DispatchExecutor as dispatchExecutor } from '@os1-platform/platform-coreos-execution-engine-sdk';\nimport { MAX_RETRY_COUNT } from '../syncmanager/constants';\nimport { initAndUpdateDatabase } from '../../database/DBManager';\n\nexport class DispatchSDKManager {\n private static instance: DispatchSDKManager;\n private cache: DispatchSdkCache = DispatchSdkCache.getInstance();\n private keys = DispatchSdkCache.KEYS;\n\n private constructor() { }\n\n public static getInstance(): DispatchSDKManager {\n if (!DispatchSDKManager.instance) {\n DispatchSDKManager.instance = new DispatchSDKManager();\n }\n return DispatchSDKManager.instance;\n }\n\n /**\n * Call this init method with username,userID & authentication tokens\n * @param sdkConfig\n */\n public async initDispatchSDK(sdkConfig: DispatchSDKConfig) {\n if (\n !isMandatoryKeysPresent(sdkConfig, [\n 'tenantID',\n 'userID',\n 'userName',\n 'tenantBaseURL',\n 'domain',\n 'accessToken',\n ])\n ) {\n throw new BaseError(ErrorCodes.InvalidArgumentError, 'Invalid/Missing Argument Passed in SdkConfig');\n }\n \n if (isTokenExpired(sdkConfig.accessToken)) {\n throw new BaseError(\n ErrorCodes.ACCESS_TOKEN_EXPIRED,\n 'JWT Token Expired!'\n );\n }\n \n if (sdkConfig.sentry && sdkConfig.sentry?.enabled) {\n Sentry.init({\n enableNative: true,\n environment: sdkConfig.sentry.env,\n dsn: sdkConfig.sentry.dsn,\n tracesSampleRate: 1.0,\n enableAutoSessionTracking: true,\n enableAutoPerformanceTracing: false,\n attachStacktrace: true,\n maxBreadcrumbs: 50,\n });\n }\n \n await SdkUtils.checkMandatory();\n \n await this.cache.setObjectInCache(this.keys.SDK_CONFIG, sdkConfig);\n await initAndUpdateDatabase()\n GraphQLClient.init(sdkConfig.tenantBaseURL);\n AppSyncManager.initAppSync(\n sdkConfig.tenantBaseURL,\n sdkConfig.syncRetryCount ?? MAX_RETRY_COUNT\n );\n LocationManager.getInstance().startUpdates();\n if (sdkConfig.eventMapping) {\n EventCodeRepo.getInstance().saveEventCode(sdkConfig.eventMapping);\n }\n await ReasonCodeContainer.getInstance().fetchReasonCode();\n \n Logger.getInstance().setLogging(sdkConfig.enableLogging ?? true, sdkConfig);\n let storage = Storage.getInstance();\n\n if (\n sdkConfig.callbacks?.fetchPhoneNumbersCallback &&\n sdkConfig?.callbacks?.fetchDateTimeCallback &&\n sdkConfig?.callbacks?.tokenRefreshCallback &&\n sdkConfig?.callbacks?.fetchSDSEmailAndPhoneNumbersCallback\n ) {\n await callbackHandler.init(\n sdkConfig.callbacks.fetchPhoneNumbersCallback,\n sdkConfig.callbacks.fetchDateTimeCallback,\n sdkConfig.callbacks.tokenRefreshCallback,\n sdkConfig?.callbacks?.fetchSDSEmailAndPhoneNumbersCallback\n );\n }\n await dispatchExecutor.init(\n {\n storeMultipleKeysCallback: storage.setSharedItems,\n readMultipleKeysCallback: storage.getSharedItems,\n deleteMultipleKeysCallback: storage.removeSharedItems,\n eventBulkSyncCallback: pushBulkEventForSync,\n },\n sdkConfig.debugLevelLog ? 'debug' : 'emerg'\n );\n AppSyncManager.getInstance().startSDKSyncManager();\n Logger.getInstance().logCora(\"Info\", \"Dispatch SDK Initialized\");\n }\n\n public removeLocationUpdates() {\n LocationManager.getInstance().stopLocationUpdates();\n }\n}\n"],"mappings":";;;;AAAA;AACA,OAAOA,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAAe,MAAM,6BAA6B;AACzD,OAAOC,cAAc,MAAM,+BAA+B;AAC1D,OAAOC,MAAM,MAAM,oBAAoB;AACvC,OAAOC,mBAAmB,MAAM,sCAAsC;AACtE,OAAOC,aAAa,MAAM,6BAA6B;AACvD,SAASC,sBAAsB,EAAEC,cAAc,QAAQ,mBAAmB;AAC1E,SAASC,SAAS,QAAQ,wBAAwB;AAClD,OAAOC,UAAU,MAAM,yBAAyB;AAChD,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,OAAO,KAAKC,MAAM,MAAM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BAAkB","ignoreList":[]}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
|
-
|
|
6
4
|
import DispatchSdkCache from './DispatchSdkCache';
|
|
7
5
|
import { BaseError } from '../../errors/BaseError';
|
|
8
6
|
import ErrorCodes from '../../errors/ErrorCodes';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DispatchSdkCache","BaseError","ErrorCodes","CallbacksHandler","constructor","_defineProperty","init","phoneCallback","dateTimeCallBack","tokenRefreshCallback","emailAndPhoneCallback","_callbackToFetchPhoneNumbers","_callbackToFetchDateTime","_callbackRefreshToken","_callbackfetchSDSEmailAndPhone","getPhoneNumbers","sdsIds","getEmailAndPhoneNumbers","getDateTime","refresheAndUpdateToken","SyncManagerNotInitialized","token","length","sdkConfig","getInstance","getObjectFromCache","KEYS","SDK_CONFIG","accessToken","headers","cache","keys","setObjectInCache","ACCESS_TOKEN_EXPIRED","callbackHandler"],"sources":["callbacksHandler.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["DispatchSdkCache","BaseError","ErrorCodes","CallbacksHandler","constructor","_defineProperty","init","phoneCallback","dateTimeCallBack","tokenRefreshCallback","emailAndPhoneCallback","_callbackToFetchPhoneNumbers","_callbackToFetchDateTime","_callbackRefreshToken","_callbackfetchSDSEmailAndPhone","getPhoneNumbers","sdsIds","getEmailAndPhoneNumbers","getDateTime","refresheAndUpdateToken","SyncManagerNotInitialized","token","length","sdkConfig","getInstance","getObjectFromCache","KEYS","SDK_CONFIG","accessToken","headers","cache","keys","setObjectInCache","ACCESS_TOKEN_EXPIRED","callbackHandler"],"sources":["callbacksHandler.ts"],"sourcesContent":["import { DispatchSDKConfig } from '../../models/sdk';\nimport DispatchSdkCache from './DispatchSdkCache';\nimport { BaseError } from '../../errors/BaseError';\nimport ErrorCodes from '../../errors/ErrorCodes';\nimport { EmailAndPhoneResponse } from '../../components/executiontasks/validateOTP/ValidateOTPSchema';\n\nclass CallbacksHandler {\n private _callbackToFetchPhoneNumbers!: (\n sdsIds: string[]\n ) => Promise<{ key: string; value: string[] }>;\n\n private _callbackToFetchDateTime!: () => Promise<string>;\n private _callbackRefreshToken!: () => Promise<string>;\n private _callbackfetchSDSEmailAndPhone: (\n sdsIds: string[]\n ) => Promise<Record<string, EmailAndPhoneResponse>>;\n\n public init(\n phoneCallback: (sdsIds: string[]) => Promise<{ key: string; value: string[] }>,\n dateTimeCallBack: () => Promise<string>,\n tokenRefreshCallback: () => Promise<string>,\n emailAndPhoneCallback: (sdsIds: string[]) => Promise<Record<string, EmailAndPhoneResponse>>\n ) {\n this._callbackToFetchPhoneNumbers = phoneCallback;\n this._callbackToFetchDateTime = dateTimeCallBack;\n this._callbackRefreshToken = tokenRefreshCallback;\n this._callbackfetchSDSEmailAndPhone = emailAndPhoneCallback;\n }\n\n public async getPhoneNumbers(\n sdsIds: string[]\n ): Promise<{ key: string; value: string[] } | null> {\n if (!this._callbackToFetchPhoneNumbers) return null;\n else {\n return await this._callbackToFetchPhoneNumbers(sdsIds);\n }\n }\n\n // Method to get email and phone numbers\n public async getEmailAndPhoneNumbers(\n sdsIds: string[]\n ): Promise<Record<string, EmailAndPhoneResponse>> {\n return await this._callbackfetchSDSEmailAndPhone(sdsIds);\n }\n\n public async getDateTime(): Promise<string | ''> {\n if (!this._callbackToFetchDateTime) return '';\n else {\n return await this._callbackToFetchDateTime();\n }\n }\n\n public async refresheAndUpdateToken() {\n if (!this._callbackRefreshToken) {\n throw new BaseError(\n ErrorCodes.SyncManagerNotInitialized,\n 'Dispatch SDK Not Initalised'\n );\n } else {\n let token = await this._callbackRefreshToken();\n if (token && token.length != 0) {\n let sdkConfig =\n (await DispatchSdkCache.getInstance().getObjectFromCache(\n DispatchSdkCache.KEYS.SDK_CONFIG\n )) as DispatchSDKConfig;\n sdkConfig.accessToken = token;\n var headers = sdkConfig.headers;\n if (headers) {\n headers['x-coreos-access'] = token;\n sdkConfig.headers = headers;\n }\n let cache: DispatchSdkCache = DispatchSdkCache.getInstance();\n let keys = DispatchSdkCache.KEYS;\n cache.setObjectInCache(keys.SDK_CONFIG, sdkConfig);\n } else {\n throw new BaseError(\n ErrorCodes.ACCESS_TOKEN_EXPIRED,\n 'Unable to refresh token'\n );\n }\n }\n }\n}\nconst callbackHandler = new CallbacksHandler();\nexport default callbackHandler;\n"],"mappings":";;;AACA,OAAOA,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,SAAS,QAAQ,wBAAwB;AAClD,OAAOC,UAAU,MAAM,yBAAyB;AAGhD,MAAMC,gBAAgB,CAAC;EAAAC,YAAA;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;EAAA;EAWdC,IAAIA,CACTC,aAA8E,EAC9EC,gBAAuC,EACvCC,oBAA2C,EAC3CC,qBAA2F,EAC3F;IACA,IAAI,CAACC,4BAA4B,GAAGJ,aAAa;IACjD,IAAI,CAACK,wBAAwB,GAAGJ,gBAAgB;IAChD,IAAI,CAACK,qBAAqB,GAAGJ,oBAAoB;IACjD,IAAI,CAACK,8BAA8B,GAAGJ,qBAAqB;EAC7D;EAEA,MAAaK,eAAeA,CAC1BC,MAAgB,EACkC;IAClD,IAAI,CAAC,IAAI,CAACL,4BAA4B,EAAE,OAAO,IAAI,CAAC,KAC/C;MACH,OAAO,MAAM,IAAI,CAACA,4BAA4B,CAACK,M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AACA,MAAMC,eAAe,GAAG,IAAI/B,gBAAgB,CAAC,CAAC;AAC9C,eAAe+B,eAAe","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ export let DispatchSyncType = /*#__PURE__*/function (DispatchSyncType) {
|
|
|
4
4
|
DispatchSyncType["DISPATCH_SUB_STATUS_UPDATE"] = "DISPATCH_SUB_STATUS_UPDATE";
|
|
5
5
|
return DispatchSyncType;
|
|
6
6
|
}({});
|
|
7
|
-
export const DATABASE_NAME = '
|
|
7
|
+
export const DATABASE_NAME = 'DispatchSDK_DB';
|
|
8
8
|
export const EVENTS_TABLE = 'EVENTS_TABLE';
|
|
9
9
|
export const REASONS_TABLE = 'REASONS_TABLE';
|
|
10
10
|
export const EVENT_CODES_TABLE = 'EVENT_CODES_TABLE';
|
|
@@ -60,6 +60,10 @@ export const EventColumns = {
|
|
|
60
60
|
DESCRIPTION: 'description',
|
|
61
61
|
SUCCESS_EVENT: 'successEvent'
|
|
62
62
|
};
|
|
63
|
+
export const VERSION_TABLE = 'VERSION_TABLE';
|
|
64
|
+
export const VERSION_COLUMNS = {
|
|
65
|
+
VERSION_NO: 'versionNo'
|
|
66
|
+
};
|
|
63
67
|
|
|
64
68
|
// NEW CODE
|
|
65
69
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DispatchSyncType","DATABASE_NAME","EVENTS_TABLE","REASONS_TABLE","EVENT_CODES_TABLE","EVENTS_COLUMNS","ID","SEQUENCE","PAYLOAD","SYNCED","CONFIG","SYNC_TYPE","META","SYNC_ERROR","DISPATCH_ID","DATA_LENGTH","ATTEMPT_COUNT","DOCUMENT_TABLE","DOCUMENT_COLUMNS","DATA","BASE64","FILE_PATH","FILE_NAME","FILE_TYPE","FMS_FOLDER_ID","FMS_ID","PRIORITY","DESCRIPTION","JOB_ID","OBJECTIVE_REF","GEO_TIMESTAMP","PROCESSED_FILE_PATH","SyncMethod","ReasonColums","CODE","IS_ENABLED","SYSTEM_DEFINED","EventColumns","SUCCESS_EVENT","WORKFLOW_INSTANCE_TABLE","WORKFLOW_INSTANCE_COLUMNS","WORKFLOW_INSTANCE_ID","MERGED_WORKFLOW_INSTANCE_ID","SCANNABLE_ID","INITIAL_MERGED_WORKFLOW_INSTANCE_ID","STATUS","JOB_WF_ID","DISPLAY_DATA","WORKFLOW_ID"],"sources":["DBConfig.ts"],"sourcesContent":["import { IDispatch } from '@os1-platform/platform-coreos-execution-engine-sdk';\nexport type ExecEngineSyncType = IDispatch.SyncType;\n\nexport enum DispatchSyncType {\n DEFAULT = 'DEFAULT',\n DISPATCH_UPDATE = 'DISPATCH_UPDATE',\n DISPATCH_SUB_STATUS_UPDATE = 'DISPATCH_SUB_STATUS_UPDATE',\n}\n\nexport const DATABASE_NAME = '
|
|
1
|
+
{"version":3,"names":["DispatchSyncType","DATABASE_NAME","EVENTS_TABLE","REASONS_TABLE","EVENT_CODES_TABLE","EVENTS_COLUMNS","ID","SEQUENCE","PAYLOAD","SYNCED","CONFIG","SYNC_TYPE","META","SYNC_ERROR","DISPATCH_ID","DATA_LENGTH","ATTEMPT_COUNT","DOCUMENT_TABLE","DOCUMENT_COLUMNS","DATA","BASE64","FILE_PATH","FILE_NAME","FILE_TYPE","FMS_FOLDER_ID","FMS_ID","PRIORITY","DESCRIPTION","JOB_ID","OBJECTIVE_REF","GEO_TIMESTAMP","PROCESSED_FILE_PATH","SyncMethod","ReasonColums","CODE","IS_ENABLED","SYSTEM_DEFINED","EventColumns","SUCCESS_EVENT","VERSION_TABLE","VERSION_COLUMNS","VERSION_NO","WORKFLOW_INSTANCE_TABLE","WORKFLOW_INSTANCE_COLUMNS","WORKFLOW_INSTANCE_ID","MERGED_WORKFLOW_INSTANCE_ID","SCANNABLE_ID","INITIAL_MERGED_WORKFLOW_INSTANCE_ID","STATUS","JOB_WF_ID","DISPLAY_DATA","WORKFLOW_ID"],"sources":["DBConfig.ts"],"sourcesContent":["import { IDispatch } from '@os1-platform/platform-coreos-execution-engine-sdk';\nexport type ExecEngineSyncType = IDispatch.SyncType;\n\nexport enum DispatchSyncType {\n DEFAULT = 'DEFAULT',\n DISPATCH_UPDATE = 'DISPATCH_UPDATE',\n DISPATCH_SUB_STATUS_UPDATE = 'DISPATCH_SUB_STATUS_UPDATE',\n}\n\nexport const DATABASE_NAME = 'DispatchSDK_DB';\nexport const EVENTS_TABLE = 'EVENTS_TABLE';\nexport const REASONS_TABLE = 'REASONS_TABLE';\nexport const EVENT_CODES_TABLE = 'EVENT_CODES_TABLE';\n\nexport const EVENTS_COLUMNS = {\n ID: 'id',\n SEQUENCE: 'seq_number',\n PAYLOAD: 'payload',\n SYNCED: 'synced',\n CONFIG: 'config',\n SYNC_TYPE: 'sync_type',\n META: 'meta',\n SYNC_ERROR: 'sync_error',\n DISPATCH_ID: 'dispatch_id',\n DATA_LENGTH: 'data_length',\n ATTEMPT_COUNT: 'attempt_count',\n};\n\nexport const DOCUMENT_TABLE = 'DOCUMENTS_TABLE';\nexport const DOCUMENT_COLUMNS = {\n ID: 'id',\n DATA: 'data',\n BASE64: 'base64',\n FILE_PATH: 'file_path',\n FILE_NAME: 'file_name',\n FILE_TYPE: 'file_type',\n SYNCED: 'synced',\n FMS_FOLDER_ID: 'fms_folder_id',\n FMS_ID: 'fms_id',\n PRIORITY: 'priority',\n DESCRIPTION: 'desc',\n SYNC_ERROR: 'sync_error',\n DISPATCH_ID: 'dispatch_id',\n JOB_ID: 'job_id',\n OBJECTIVE_REF: 'objective_ref',\n ATTEMPT_COUNT: 'attempt_count',\n GEO_TIMESTAMP: 'geo_timestamp',\n PROCESSED_FILE_PATH: 'processed_file_path',\n};\nexport type DocumentRow = {\n id: number;\n data: string;\n base64: boolean;\n file_path: string;\n file_name: string;\n file_type: string;\n synced: boolean;\n fms_folder_id: string;\n fms_id: string;\n priority: number;\n desc: string;\n sync_error: string;\n dispatch_id: string;\n job_id: string;\n objective_ref: string;\n geo_timestamp: string;\n processed_file_path: string;\n attempt_count: number;\n};\nexport type EventRow = {\n id: number;\n payload: string;\n synced: boolean;\n config: string;\n sync_type: ExecEngineSyncType | DispatchSyncType;\n objective_ref: string;\n sync_error: string;\n dispatch_id: string;\n attempt_count: number;\n};\n\nexport enum SyncMethod {\n POST = 'POST',\n PUT = 'PUT',\n GET = 'GET',\n DELETE = 'DELETE',\n}\nexport const ReasonColums = {\n CODE: 'reasonCode',\n DESCRIPTION: 'description',\n IS_ENABLED: 'isEnabled',\n SYSTEM_DEFINED: 'isSystemDefined',\n};\nexport interface ReasonsRow {\n description: string;\n isEnabled: boolean;\n reasonCode: string;\n isSystemDefined: boolean;\n}\n\nexport interface EventsRow {\n description: string;\n successEvent: boolean;\n eventCode: string;\n}\n\nexport const EventColumns = {\n CODE: 'eventCode',\n DESCRIPTION: 'description',\n SUCCESS_EVENT: 'successEvent',\n};\n\nexport const VERSION_TABLE = 'VERSION_TABLE';\nexport const VERSION_COLUMNS = {\n VERSION_NO: 'versionNo'\n};\n\n// NEW CODE\nexport interface BulkEvent {\n syncType: ExecEngineSyncType | DispatchSyncType;\n dispatchId: string;\n data: any;\n meta?: any; // updatedBy, code, status, timestamp, [{jobId,wfId}]\n}\n\n// OLD CODE\n// export interface BulkEvent {\n// syncType: SyncType;\n// dispatchId: string;\n// data: string;\n// config: string;\n// sequence: number;\n// meta?: any;\n// }\n\nexport interface WFUpdateBulkEventData {\n [customETName: string]: EventETData;\n}\n\nexport interface EventETData {\n output: any;\n}\n\nexport interface WIUpdateOutputPayload {\n dispatchId: string;\n updatedBy: any;\n workflows: Array<WorkflowUpdatePayload>;\n}\n\nexport interface WorkflowUpdatePayload {\n status: string;\n timestamp: number;\n attemptId: 1;\n code: string;\n data: any;\n meta?: any;\n __unmerged?: Array<UnmergedData>;\n}\n\nexport interface UnmergedData {\n workflowInstanceId: string;\n jobId: string;\n data?: any;\n}\n\nexport interface CustodyData {\n dispatchId: string;\n jobId: string;\n custodyEntity: string;\n custodyLocationId: string;\n custodyEntityAmount: number;\n custodyEntityId: string;\n}\n\nexport const WORKFLOW_INSTANCE_TABLE = 'WF_INSTANCE_TABLE';\nexport const WORKFLOW_INSTANCE_COLUMNS = {\n WORKFLOW_INSTANCE_ID: 'WFIId',\n MERGED_WORKFLOW_INSTANCE_ID: 'MWFIId',\n JOB_ID: 'jobId',\n SCANNABLE_ID: 'scannableId',\n INITIAL_MERGED_WORKFLOW_INSTANCE_ID: 'InitialMWFIId',\n STATUS: 'status',\n JOB_WF_ID: 'jobWfId',\n DISPLAY_DATA: 'displayData',\n WORKFLOW_ID: 'WFId',\n};\n\nexport interface SyncManagerPayload {\n data: {\n action: ExecEngineSyncType | DispatchSyncType;\n payload: any;\n };\n length: number;\n}\n"],"mappings":"AAGA,WAAYA,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAM5B,OAAO,MAAMC,aAAa,GAAG,gBAAgB;AAC7C,OAAO,MAAMC,YAAY,GAAG,cAAc;AAC1C,OAAO,MAAMC,aAAa,GAAG,eAAe;AAC5C,OAAO,MAAMC,iBAAiB,GAAG,mBAAmB;AAEpD,OAAO,MAAMC,cAAc,GAAG;EAC5BC,EAAE,EAAE,IAAI;EACRC,QAAQ,EAAE,YAAY;EACtBC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE,QAAQ;EAChBC,SAAS,EAAE,WAAW;EACtBC,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,YAAY;EACxBC,WAAW,EAAE,aAAa;EAC1BC,WAAW,EAAE,aAAa;EAC1BC,aAAa,EAAE;AACjB,CAAC;AAED,OAAO,MAAMC,cAAc,GAAG,iBAAiB;AAC/C,OAAO,MAAMC,gBAAgB,GAAG;EAC9BZ,EAAE,EAAE,IAAI;EACRa,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,QAAQ;EAChBC,SAAS,EAAE,WAAW;EACtBC,SAAS,EAAE,WAAW;EACtBC,SAAS,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
|
-
|
|
1
|
+
var _SQLDatabase;
|
|
2
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
2
5
|
import * as DBConfig from './DBConfig';
|
|
3
6
|
import { isEmptyOrBlank } from '../../utils/utils';
|
|
4
7
|
import { BaseError } from '../../errors/BaseError';
|
|
5
8
|
import BaseErrorCodes from '../../errors/ErrorCodes';
|
|
6
9
|
import Logger, { LOG_TYPE } from '../../utils/Logger';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
import { openDatabaseSync } from 'expo-sqlite';
|
|
11
|
+
|
|
12
|
+
// Legacy type for backward compatibility
|
|
13
|
+
|
|
14
|
+
class SQLDatabase {
|
|
15
|
+
constructor() {
|
|
16
|
+
_defineProperty(this, "db", void 0);
|
|
17
|
+
this.db = openDatabaseSync(DBConfig.DATABASE_NAME);
|
|
18
|
+
}
|
|
19
|
+
static getInstance() {
|
|
20
|
+
if (!SQLDatabase.instance) {
|
|
21
|
+
SQLDatabase.instance = new SQLDatabase();
|
|
16
22
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
return SQLDatabase.instance;
|
|
24
|
+
}
|
|
25
|
+
executeSetDataQuery(query, args) {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
if (isEmptyOrBlank(query)) {
|
|
28
|
+
reject(new BaseError(BaseErrorCodes.InvalidArgumentError, 'SQL Query is null or empty'));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const result = this.db.runSync(query, args);
|
|
33
|
+
const sqlResultSet = {
|
|
34
|
+
insertId: result.lastInsertRowId,
|
|
35
|
+
rowsAffected: result.changes,
|
|
36
|
+
rows: {
|
|
37
|
+
_array: [],
|
|
38
|
+
length: 0,
|
|
39
|
+
item: index => null
|
|
40
|
+
}
|
|
41
|
+
};
|
|
20
42
|
resolve(sqlResultSet);
|
|
21
|
-
}
|
|
22
|
-
reject(
|
|
23
|
-
|
|
24
|
-
});
|
|
43
|
+
} catch (error) {
|
|
44
|
+
reject(error);
|
|
45
|
+
}
|
|
25
46
|
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
}
|
|
48
|
+
executeGetDataQuery(query, args) {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
if (isEmptyOrBlank(query)) {
|
|
51
|
+
reject(new BaseError(BaseErrorCodes.InvalidArgumentError, 'SQL Query is null or empty'));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const result = this.db.getAllSync(query, args);
|
|
56
|
+
const sqlResultSet = {
|
|
57
|
+
insertId: undefined,
|
|
58
|
+
rowsAffected: 0,
|
|
59
|
+
rows: {
|
|
60
|
+
_array: result,
|
|
61
|
+
length: result.length,
|
|
62
|
+
item: index => result[index] || null
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
resolve(sqlResultSet);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
reject(error);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
executeBulkQuery(_queryData) {
|
|
72
|
+
return new Promise(async (resolve, reject) => {
|
|
73
|
+
try {
|
|
74
|
+
await this.db.withExclusiveTransactionAsync(async () => {
|
|
75
|
+
for (const _q of _queryData) {
|
|
76
|
+
this.db.runSync(_q.query, _q.args);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
Logger.getInstance().logEvent('executeBulkQuery success: ', JSON.stringify(_queryData.length + ' queries executed'), LOG_TYPE.SDK_DEBUG);
|
|
80
|
+
resolve(true);
|
|
81
|
+
} catch (error) {
|
|
82
|
+
Logger.getInstance().logEvent('executeBulkQuery err: ', JSON.stringify(error), LOG_TYPE.SDK_ERROR);
|
|
83
|
+
reject(error);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Executes an array of SQL DML statements.
|
|
90
|
+
*
|
|
91
|
+
* @param {Array<{query: string, args: any[]}>} input - The array of queries to execute.
|
|
92
|
+
* @return {Promise<SQLResultSet>} A promise that resolves with the SQL result set.
|
|
93
|
+
*/
|
|
94
|
+
executeStatementsInTxn(input) {
|
|
95
|
+
return new Promise(async (resolve, reject) => {
|
|
96
|
+
if (input.some(_i => isEmptyOrBlank(_i.sqlSmt))) {
|
|
97
|
+
reject(new Error('Statement is null or empty'));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const resultSet = [];
|
|
102
|
+
await this.db.withExclusiveTransactionAsync(async () => {
|
|
103
|
+
for (const item of input) {
|
|
104
|
+
const result = await this.db.runAsync(item.sqlSmt, item.args);
|
|
105
|
+
const sqlResultSet = {
|
|
106
|
+
insertId: result.lastInsertRowId,
|
|
107
|
+
rowsAffected: result.changes,
|
|
108
|
+
rows: {
|
|
109
|
+
_array: [],
|
|
110
|
+
length: 0,
|
|
111
|
+
item: index => null
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
resultSet.push(sqlResultSet);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
resolve(resultSet);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
reject(error);
|
|
120
|
+
}
|
|
51
121
|
});
|
|
52
|
-
}
|
|
122
|
+
}
|
|
53
123
|
}
|
|
124
|
+
_SQLDatabase = SQLDatabase;
|
|
125
|
+
_defineProperty(SQLDatabase, "instance", void 0);
|
|
126
|
+
const Database = SQLDatabase.getInstance();
|
|
127
|
+
export default Database;
|
|
54
128
|
//# sourceMappingURL=database.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["DBConfig","isEmptyOrBlank","BaseError","BaseErrorCodes","Logger","LOG_TYPE","openDatabaseSync","SQLDatabase","constructor","_defineProperty","db","DATABASE_NAME","getInstance","instance","executeSetDataQuery","query","args","Promise","resolve","reject","InvalidArgumentError","result","runSync","sqlResultSet","insertId","lastInsertRowId","rowsAffected","changes","rows","_array","length","item","index","error","executeGetDataQuery","getAllSync","undefined","executeBulkQuery","_queryData","withExclusiveTransactionAsync","_q","logEvent","JSON","stringify","SDK_DEBUG","SDK_ERROR","executeStatementsInTxn","input","some","_i","sqlSmt","Error","resultSet","runAsync","push","_SQLDatabase","Database"],"sources":["database.ts"],"sourcesContent":["import * as DBConfig from './DBConfig';\nimport { isEmptyOrBlank } from '../../utils/utils';\nimport { BaseError } from '../../errors/BaseError';\nimport BaseErrorCodes from '../../errors/ErrorCodes';\nimport Logger, { LOG_TYPE } from '../../utils/Logger';\nimport type { ExecQuery } from '../../utils/Constants';\nimport { openDatabaseSync, SQLiteDatabase } from 'expo-sqlite';\n\n// Legacy type for backward compatibility\nexport interface SQLResultSet {\n insertId?: number;\n rowsAffected: number;\n rows: {\n _array: any[];\n length: number;\n item: (index: number) => any;\n };\n}\n\n\nclass SQLDatabase {\n private static instance: SQLDatabase;\n private db: SQLiteDatabase;\n\n private constructor() {\n this.db = openDatabaseSync(DBConfig.DATABASE_NAME);\n }\n\n public static getInstance(): SQLDatabase {\n if (!SQLDatabase.instance) {\n SQLDatabase.instance = new SQLDatabase();\n }\n return SQLDatabase.instance;\n }\n\n executeSetDataQuery(query: string, args: any[]): Promise<SQLResultSet> {\n return new Promise((resolve, reject) => {\n if (isEmptyOrBlank(query)) {\n reject(new BaseError( BaseErrorCodes.InvalidArgumentError, 'SQL Query is null or empty'));\n return;\n }\n try {\n const result = this.db.runSync(query, args);\n const sqlResultSet: SQLResultSet = {\n insertId: result.lastInsertRowId,\n rowsAffected: result.changes,\n rows: {\n _array: [],\n length: 0,\n item: (index: number) => null\n }\n };\n resolve(sqlResultSet);\n } catch (error) {\n reject(error);\n }\n });\n }\n\n executeGetDataQuery(query: string, args: any[]): Promise<any> {\n return new Promise((resolve, reject) => {\n if (isEmptyOrBlank(query)) {\n reject(new BaseError( BaseErrorCodes.InvalidArgumentError, 'SQL Query is null or empty'));\n return;\n }\n \n try {\n const result = this.db.getAllSync(query, args);\n const sqlResultSet: SQLResultSet = {\n insertId: undefined,\n rowsAffected: 0,\n rows: {\n _array: result,\n length: result.length,\n item: (index: number) => result[index] || null\n }\n };\n resolve(sqlResultSet);\n } catch (error) {\n reject(error);\n }\n });\n }\n\n executeBulkQuery(_queryData: ExecQuery[]): Promise<boolean> {\n return new Promise(async (resolve, reject) => {\n try {\n await this.db.withExclusiveTransactionAsync(async () => {\n for (const _q of _queryData) {\n this.db.runSync(_q.query, _q.args);\n }\n });\n \n Logger.getInstance().logEvent(\n 'executeBulkQuery success: ',\n JSON.stringify(_queryData.length + ' queries executed'),\n LOG_TYPE.SDK_DEBUG\n );\n resolve(true);\n } catch (error) {\n Logger.getInstance().logEvent(\n 'executeBulkQuery err: ',\n JSON.stringify(error),\n LOG_TYPE.SDK_ERROR\n );\n reject(error);\n }\n });\n }\n\n /**\n * Executes an array of SQL DML statements.\n *\n * @param {Array<{query: string, args: any[]}>} input - The array of queries to execute.\n * @return {Promise<SQLResultSet>} A promise that resolves with the SQL result set.\n */\n executeStatementsInTxn(input: { sqlSmt: string; args: any[] }[]): Promise<SQLResultSet[]> {\n return new Promise(async (resolve, reject) => {\n if (input.some((_i) => isEmptyOrBlank(_i.sqlSmt))) {\n reject(new Error('Statement is null or empty'));\n return;\n }\n\n try {\n const resultSet: SQLResultSet[] = [];\n \n await this.db.withExclusiveTransactionAsync(async () => {\n for (const item of input) {\n const result = await this.db.runAsync(item.sqlSmt, item.args);\n const sqlResultSet: SQLResultSet = {\n insertId: result.lastInsertRowId,\n rowsAffected: result.changes,\n rows: {\n _array: [],\n length: 0,\n item: (index: number) => null\n }\n };\n resultSet.push(sqlResultSet);\n }\n });\n\n resolve(resultSet);\n } catch (error) {\n reject(error);\n }\n });\n }\n}\n\nconst Database = SQLDatabase.getInstance();\nexport default Database;\n"],"mappings":";;;;AAAA,OAAO,KAAKA,QAAQ,MAAM,YAAY;AACtC,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,wBAAwB;AAClD,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,MAAM,IAAIC,QAAQ,QAAQ,oBAAoB;AAErD,SAASC,gBAAgB,QAAwB,aAAa;;AAE9D;;AAYA,MAAMC,WAAW,CAAC;EAIRC,WAAWA,CAAA,EAAG;IAAAC,eAAA;IACpB,IAAI,CAACC,EAAE,GAAGJ,gBAAgB,CAACN,QAAQ,CAACW,aAAa,CAAC;EACpD;EAEA,OAAcC,WAAWA,CAAA,EAAgB;IACvC,IAAI,CAACL,WAAW,CAACM,QAAQ,EAAE;MACzBN,WAAW,CAACM,QAAQ,GAAG,IAAIN,WAAW,CAAC,CAAC;IAC1C;IACA,OAAOA,WAAW,CAACM,QAAQ;EAC7B;EAEAC,mBAAmBA,CAACC,KAAa,EAAEC,IAAW,EAAyB;IACrE,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO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B,GAAG,EAAE;QAEpC,MAAM,IAAI,CAAC1C,EAAE,CAAC6B,6BAA6B,CAAC,YAAY;UACtD,KAAK,MAAMR,IAAI,IAAIgB,KAAK,EAAE;YACxB,MAAM1B,MAAM,GAAG,MAAM,IAAI,CAACX,EAAE,CAAC2C,QAAQ,CAACtB,IAAI,CAACmB,MAAM,EAAEnB,IAAI,CAACf,IAAI,CAAC;YAC7D,MAAMO,YAA0B,GAAG;cACjCC,QAAQ,EAAEH,MAAM,CAACI,eAAe;cAChCC,YAAY,EAAEL,MAAM,CAACM,OAAO;cAC5BC,IAAI,EAAE;gBACJC,MAAM,EAAE,EAAE;gBACVC,MAAM,EAAE,CAAC;gBACTC,IAAI,EAAGC,KAAa,IAAK;cAC3B;YACF,CAAC;YACDoB,SAAS,CAACE,IAAI,CAAC/B,YAAY,CAAC;UAC9B;QACF,CAAC,CAAC;QAEFL,OAAO,CAACkC,SAAS,CAAC;MACpB,CAAC,CAAC,OAAOnB,KAAK,EAAE;QACdd,MAAM,CAACc,KAAK,CAAC;MACf;IACF,CAAC,CAAC;EACJ;AACF;AAACsB,YAAA,GAhIKhD,WAAW;AAAAE,eAAA,CAAXF,WAAW;AAkIjB,MAAMiD,QAAQ,GAAGjD,WAAW,CAACK,WAAW,CAAC,CAAC;AAC1C,eAAe4C,QAAQ","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
4
4
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
5
|
import { DOCUMENT_COLUMNS, DOCUMENT_TABLE } from '../DBConfig';
|
|
6
6
|
import { MAX_RETRY_COUNT, PROCESS_MAX_RETRIED_ROWS } from '../constants';
|
|
7
|
-
import
|
|
7
|
+
import Database from '../database';
|
|
8
8
|
export default class DocumentManager {
|
|
9
9
|
constructor() {}
|
|
10
10
|
static async getInstance() {
|
|
@@ -16,7 +16,7 @@ export default class DocumentManager {
|
|
|
16
16
|
return DocumentManager.instance;
|
|
17
17
|
}
|
|
18
18
|
async init() {
|
|
19
|
-
await Database.
|
|
19
|
+
await Database.executeSetDataQuery(`CREATE TABLE IF NOT EXISTS ${DOCUMENT_TABLE} (\
|
|
20
20
|
${DOCUMENT_COLUMNS.ID} INTEGER PRIMARY KEY AUTOINCREMENT,\
|
|
21
21
|
${DOCUMENT_COLUMNS.DATA} TEXT,\
|
|
22
22
|
${DOCUMENT_COLUMNS.BASE64} INTEGER NOT NULL DEFAULT 0,\
|
|
@@ -35,10 +35,10 @@ export default class DocumentManager {
|
|
|
35
35
|
${DOCUMENT_COLUMNS.DESCRIPTION} TEXT);`, []);
|
|
36
36
|
}
|
|
37
37
|
async truncateDocumentTable() {
|
|
38
|
-
await Database.
|
|
38
|
+
await Database.executeSetDataQuery(`DELETE FROM ${DOCUMENT_TABLE};`, []);
|
|
39
39
|
}
|
|
40
40
|
async insertDocument(fmsFolderID, desc, dspID, base64, fileName, fileType, data, filePath, geoTimeStamp, processedFilePath, priority) {
|
|
41
|
-
return await Database.
|
|
41
|
+
return await Database.executeSetDataQuery(`INSERT INTO ${DOCUMENT_TABLE}(\
|
|
42
42
|
${DOCUMENT_COLUMNS.DATA},\
|
|
43
43
|
${DOCUMENT_COLUMNS.DISPATCH_ID},\
|
|
44
44
|
${DOCUMENT_COLUMNS.FMS_FOLDER_ID},\
|
|
@@ -54,54 +54,50 @@ export default class DocumentManager {
|
|
|
54
54
|
}
|
|
55
55
|
async getAllDocuments(dispatchID) {
|
|
56
56
|
if (!dispatchID) {
|
|
57
|
-
const resultSet = await Database.
|
|
57
|
+
const resultSet = await Database.executeGetDataQuery(`SELECT * FROM ${DOCUMENT_TABLE};`, []);
|
|
58
58
|
return resultSet.rows._array;
|
|
59
59
|
} else {
|
|
60
|
-
const resultSet = await Database.
|
|
60
|
+
const resultSet = await Database.executeGetDataQuery(`SELECT * FROM ${DOCUMENT_TABLE}\
|
|
61
61
|
WHERE ${DOCUMENT_COLUMNS.DISPATCH_ID} =?;`, [dispatchID]);
|
|
62
62
|
return resultSet.rows._array;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
async getAllUnsyncedDocs() {
|
|
66
66
|
if (PROCESS_MAX_RETRIED_ROWS) {
|
|
67
|
-
let resultSet = await Database.
|
|
68
|
-
WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0;`, []);
|
|
67
|
+
let resultSet = await Database.executeGetDataQuery(`SELECT * from ${DOCUMENT_TABLE} WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0;`, []);
|
|
69
68
|
return resultSet.rows._array;
|
|
70
69
|
} else {
|
|
71
|
-
let resultSet = await Database.
|
|
70
|
+
let resultSet = await Database.executeGetDataQuery(`SELECT * from ${DOCUMENT_TABLE}\
|
|
72
71
|
WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0 AND ${DOCUMENT_COLUMNS.ATTEMPT_COUNT} < ${MAX_RETRY_COUNT};`, []);
|
|
73
72
|
return resultSet.rows._array;
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
deleteAllSyncedDocuments(dispatchID) {
|
|
77
|
-
return Database.
|
|
76
|
+
return Database.executeSetDataQuery(`DELETE FROM ${DOCUMENT_TABLE}\
|
|
78
77
|
WHERE ${DOCUMENT_COLUMNS.SYNCED} = 1 and ${DOCUMENT_COLUMNS.DISPATCH_ID} = ?;`, [dispatchID]);
|
|
79
78
|
}
|
|
80
79
|
async markDocumentSynced(id, fmsID) {
|
|
81
80
|
if (!id || !fmsID) return;
|
|
82
|
-
await Database.
|
|
81
|
+
await Database.executeSetDataQuery(`UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.SYNCED} = 1,${DOCUMENT_COLUMNS.FMS_ID} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [fmsID, id]);
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
// This function will actualy update the document row with sync and attempt count.
|
|
86
85
|
async markDocumentSyncedWithAttempt(id, fmsID, attempt, sync) {
|
|
87
86
|
if (!id) return;
|
|
88
|
-
await Database.
|
|
87
|
+
await Database.executeSetDataQuery(`UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.SYNCED} = ?,${DOCUMENT_COLUMNS.FMS_ID} = ?,${DOCUMENT_COLUMNS.ATTEMPT_COUNT} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [sync, fmsID, attempt, id]);
|
|
89
88
|
}
|
|
90
89
|
// This function is updating processed_file_path column for the base64 overlayed data and overlayed image file for POD. Also if it is base 64 then it is also storing temprary file path in file_path as original bae64 image.
|
|
91
90
|
async updateProcesedFilePath(id, origialFilePath, processedFilePath) {
|
|
92
91
|
if (!id || !processedFilePath) return;
|
|
93
|
-
await Database.
|
|
92
|
+
await Database.executeSetDataQuery(`UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.FILE_PATH} = ?, ${DOCUMENT_COLUMNS.PROCESSED_FILE_PATH} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [origialFilePath, processedFilePath, id]);
|
|
94
93
|
}
|
|
95
94
|
async updateDocSyncError(id, uploadError) {
|
|
96
95
|
if (!id) throw new TypeError('Document ID cannot be null');
|
|
97
|
-
await Database.
|
|
98
|
-
SET \
|
|
99
|
-
${DOCUMENT_COLUMNS.SYNC_ERROR} = ?\
|
|
100
|
-
WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [uploadError, id]);
|
|
96
|
+
await Database.executeSetDataQuery(`UPDATE ${DOCUMENT_TABLE} SET ${DOCUMENT_COLUMNS.SYNC_ERROR} = ? WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [uploadError, id]);
|
|
101
97
|
}
|
|
102
98
|
async updateDocPriority(id, priority) {
|
|
103
99
|
if (!id) throw new TypeError('Document ID cannot be null');
|
|
104
|
-
await Database.
|
|
100
|
+
await Database.executeSetDataQuery(`UPDATE ${DOCUMENT_TABLE}\
|
|
105
101
|
SET \
|
|
106
102
|
${DOCUMENT_COLUMNS.PRIORITY} = ?\
|
|
107
103
|
WHERE ${DOCUMENT_COLUMNS.ID} = ?;`, [priority, id]);
|
|
@@ -109,12 +105,12 @@ export default class DocumentManager {
|
|
|
109
105
|
async getUnsyncedDocument() {
|
|
110
106
|
// If it is allowed max_retried_rows are allowed to process then it will refetch those data which are even have tried max attempt otherwise it will skip those events.
|
|
111
107
|
if (PROCESS_MAX_RETRIED_ROWS) {
|
|
112
|
-
let rs = await Database.
|
|
108
|
+
let rs = await Database.executeGetDataQuery(`SELECT * from ${DOCUMENT_TABLE}\
|
|
113
109
|
WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0 \
|
|
114
110
|
ORDER BY ${DOCUMENT_COLUMNS.PRIORITY} ASC LIMIT 1;`, []);
|
|
115
111
|
return rs.rows._array;
|
|
116
112
|
} else {
|
|
117
|
-
let rs = await Database.
|
|
113
|
+
let rs = await Database.executeGetDataQuery(`SELECT * from ${DOCUMENT_TABLE}\
|
|
118
114
|
WHERE ${DOCUMENT_COLUMNS.SYNCED} = 0 AND ${DOCUMENT_COLUMNS.ATTEMPT_COUNT} < ${MAX_RETRY_COUNT} \
|
|
119
115
|
ORDER BY ${DOCUMENT_COLUMNS.PRIORITY} ASC LIMIT 1;`, []);
|
|
120
116
|
return rs.rows._array;
|