@os1-platform/dispatch-mobile 3.0.4 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/android/build.gradle +38 -9
  2. package/android/gradle.properties +17 -2
  3. package/lib/commonjs/components/dispatch/DispatchExecNavigator.js.map +1 -1
  4. package/lib/commonjs/components/executiontasks/forms/widgets/DateTimeWidget.js.map +1 -1
  5. package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js +1 -1
  6. package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
  7. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js +467 -287
  8. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
  9. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js +14 -1
  10. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -1
  11. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOtpStyles.js +270 -0
  12. package/lib/commonjs/components/executiontasks/validateOTP/ValidateOtpStyles.js.map +1 -0
  13. package/lib/commonjs/components/executiontasks/validateOTP/components/ContactListView.js +99 -0
  14. package/lib/commonjs/components/executiontasks/validateOTP/components/ContactListView.js.map +1 -0
  15. package/lib/commonjs/components/executiontasks/validateOTP/components/OTPView.js +195 -0
  16. package/lib/commonjs/components/executiontasks/validateOTP/components/OTPView.js.map +1 -0
  17. package/lib/commonjs/components/executiontasks/validateOTP/components/VerificationComplete.js +106 -0
  18. package/lib/commonjs/components/executiontasks/validateOTP/components/VerificationComplete.js.map +1 -0
  19. package/lib/commonjs/components/executiontasks/validateOTP/constants.js +12 -5
  20. package/lib/commonjs/components/executiontasks/validateOTP/constants.js.map +1 -1
  21. package/lib/commonjs/components/executiontasks/validateOTP/sub-components/ContactCard.js +68 -0
  22. package/lib/commonjs/components/executiontasks/validateOTP/sub-components/ContactCard.js.map +1 -0
  23. package/lib/commonjs/components/executiontasks/validateOTP/sub-components/OTPInput.js +12 -5
  24. package/lib/commonjs/components/executiontasks/validateOTP/sub-components/OTPInput.js.map +1 -1
  25. package/lib/commonjs/components/executiontasks/validateOTP/sub-components/ResendOTPButton.js +61 -0
  26. package/lib/commonjs/components/executiontasks/validateOTP/sub-components/ResendOTPButton.js.map +1 -0
  27. package/lib/commonjs/components/executiontasks/validateOTP/utils.js +235 -114
  28. package/lib/commonjs/components/executiontasks/validateOTP/utils.js.map +1 -1
  29. package/lib/commonjs/components/utils/Scale.js +22 -0
  30. package/lib/commonjs/components/utils/Scale.js.map +1 -0
  31. package/lib/commonjs/components/widgets/ConfirmCancelModal.js +47 -0
  32. package/lib/commonjs/components/widgets/ConfirmCancelModal.js.map +1 -0
  33. package/lib/commonjs/components/widgets/SnackBarCustom.js +36 -4
  34. package/lib/commonjs/components/widgets/SnackBarCustom.js.map +1 -1
  35. package/lib/commonjs/components/widgets/SplitTextInput.js +48 -18
  36. package/lib/commonjs/components/widgets/SplitTextInput.js.map +1 -1
  37. package/lib/commonjs/constants/apiConstants.js +4 -1
  38. package/lib/commonjs/constants/apiConstants.js.map +1 -1
  39. package/lib/commonjs/constants/constants.js +2 -1
  40. package/lib/commonjs/constants/constants.js.map +1 -1
  41. package/lib/commonjs/icons/icExclamationcircleo_dark.svg +3 -0
  42. package/lib/commonjs/icons/icFailed.gif +0 -0
  43. package/lib/commonjs/icons/icRadioChecked.svg +4 -0
  44. package/lib/commonjs/icons/icRadioUnchecked.svg +4 -0
  45. package/lib/commonjs/icons/icSuccess.gif +0 -0
  46. package/lib/commonjs/icons/index.js +28 -0
  47. package/lib/commonjs/icons/index.js.map +1 -0
  48. package/lib/commonjs/index.js +19 -0
  49. package/lib/commonjs/index.js.map +1 -1
  50. package/lib/commonjs/manager/sdk/DispatchSDKManager.js +5 -4
  51. package/lib/commonjs/manager/sdk/DispatchSDKManager.js.map +1 -1
  52. package/lib/commonjs/manager/sdk/callbacksHandler.js +9 -2
  53. package/lib/commonjs/manager/sdk/callbacksHandler.js.map +1 -1
  54. package/lib/commonjs/manager/syncmanager/constants.js +3 -1
  55. package/lib/commonjs/manager/syncmanager/constants.js.map +1 -1
  56. package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js +3 -2
  57. package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js.map +1 -1
  58. package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js +70 -80
  59. package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
  60. package/lib/commonjs/models/sdk.js +1 -0
  61. package/lib/commonjs/models/sdk.js.map +1 -1
  62. package/lib/commonjs/ui/screens/ValidateOTPScreen.js +132 -12
  63. package/lib/commonjs/ui/screens/ValidateOTPScreen.js.map +1 -1
  64. package/lib/commonjs/utils/ApiUtils.js +122 -3
  65. package/lib/commonjs/utils/ApiUtils.js.map +1 -1
  66. package/lib/commonjs/utils/ExecTaskUtils.js +67 -7
  67. package/lib/commonjs/utils/ExecTaskUtils.js.map +1 -1
  68. package/lib/commonjs/utils/context/valdiateOTPContext.js +11 -0
  69. package/lib/commonjs/utils/context/valdiateOTPContext.js.map +1 -0
  70. package/lib/commonjs/utils/helper.js.map +1 -1
  71. package/lib/commonjs/utils/hooks/useTimer.js +68 -30
  72. package/lib/commonjs/utils/hooks/useTimer.js.map +1 -1
  73. package/lib/module/components/dispatch/DispatchExecNavigator.js.map +1 -1
  74. package/lib/module/components/executiontasks/forms/widgets/DateTimeWidget.js.map +1 -1
  75. package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js +1 -1
  76. package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
  77. package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js +480 -290
  78. package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
  79. package/lib/module/components/executiontasks/validateOTP/ValidateOTPSchema.js +14 -0
  80. package/lib/module/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -1
  81. package/lib/module/components/executiontasks/validateOTP/ValidateOtpStyles.js +264 -0
  82. package/lib/module/components/executiontasks/validateOTP/ValidateOtpStyles.js.map +1 -0
  83. package/lib/module/components/executiontasks/validateOTP/components/ContactListView.js +88 -0
  84. package/lib/module/components/executiontasks/validateOTP/components/ContactListView.js.map +1 -0
  85. package/lib/module/components/executiontasks/validateOTP/components/OTPView.js +194 -0
  86. package/lib/module/components/executiontasks/validateOTP/components/OTPView.js.map +1 -0
  87. package/lib/module/components/executiontasks/validateOTP/components/VerificationComplete.js +96 -0
  88. package/lib/module/components/executiontasks/validateOTP/components/VerificationComplete.js.map +1 -0
  89. package/lib/module/components/executiontasks/validateOTP/constants.js +11 -4
  90. package/lib/module/components/executiontasks/validateOTP/constants.js.map +1 -1
  91. package/lib/module/components/executiontasks/validateOTP/sub-components/ContactCard.js +59 -0
  92. package/lib/module/components/executiontasks/validateOTP/sub-components/ContactCard.js.map +1 -0
  93. package/lib/module/components/executiontasks/validateOTP/sub-components/OTPInput.js +11 -5
  94. package/lib/module/components/executiontasks/validateOTP/sub-components/OTPInput.js.map +1 -1
  95. package/lib/module/components/executiontasks/validateOTP/sub-components/ResendOTPButton.js +52 -0
  96. package/lib/module/components/executiontasks/validateOTP/sub-components/ResendOTPButton.js.map +1 -0
  97. package/lib/module/components/executiontasks/validateOTP/utils.js +219 -108
  98. package/lib/module/components/executiontasks/validateOTP/utils.js.map +1 -1
  99. package/lib/module/components/utils/Scale.js +14 -0
  100. package/lib/module/components/utils/Scale.js.map +1 -0
  101. package/lib/module/components/widgets/ConfirmCancelModal.js +40 -0
  102. package/lib/module/components/widgets/ConfirmCancelModal.js.map +1 -0
  103. package/lib/module/components/widgets/SnackBarCustom.js +36 -4
  104. package/lib/module/components/widgets/SnackBarCustom.js.map +1 -1
  105. package/lib/module/components/widgets/SplitTextInput.js +48 -19
  106. package/lib/module/components/widgets/SplitTextInput.js.map +1 -1
  107. package/lib/module/constants/apiConstants.js +4 -1
  108. package/lib/module/constants/apiConstants.js.map +1 -1
  109. package/lib/module/constants/constants.js +1 -0
  110. package/lib/module/constants/constants.js.map +1 -1
  111. package/lib/module/icons/icExclamationcircleo_dark.svg +3 -0
  112. package/lib/module/icons/icFailed.gif +0 -0
  113. package/lib/module/icons/icRadioChecked.svg +4 -0
  114. package/lib/module/icons/icRadioUnchecked.svg +4 -0
  115. package/lib/module/icons/icSuccess.gif +0 -0
  116. package/lib/module/icons/index.js +5 -0
  117. package/lib/module/icons/index.js.map +1 -0
  118. package/lib/module/index.js +2 -0
  119. package/lib/module/index.js.map +1 -1
  120. package/lib/module/manager/sdk/DispatchSDKManager.js +5 -3
  121. package/lib/module/manager/sdk/DispatchSDKManager.js.map +1 -1
  122. package/lib/module/manager/sdk/callbacksHandler.js +12 -3
  123. package/lib/module/manager/sdk/callbacksHandler.js.map +1 -1
  124. package/lib/module/manager/syncmanager/constants.js +2 -0
  125. package/lib/module/manager/syncmanager/constants.js.map +1 -1
  126. package/lib/module/manager/syncmanager/document/DocumentHttpClient.js +3 -2
  127. package/lib/module/manager/syncmanager/document/DocumentHttpClient.js.map +1 -1
  128. package/lib/module/manager/syncmanager/document/DocumentSyncManager.js +70 -80
  129. package/lib/module/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
  130. package/lib/module/models/sdk.js +2 -0
  131. package/lib/module/models/sdk.js.map +1 -1
  132. package/lib/module/ui/screens/ValidateOTPScreen.js +139 -11
  133. package/lib/module/ui/screens/ValidateOTPScreen.js.map +1 -1
  134. package/lib/module/utils/ApiUtils.js +118 -2
  135. package/lib/module/utils/ApiUtils.js.map +1 -1
  136. package/lib/module/utils/ExecTaskUtils.js +66 -7
  137. package/lib/module/utils/ExecTaskUtils.js.map +1 -1
  138. package/lib/module/utils/context/valdiateOTPContext.js +4 -0
  139. package/lib/module/utils/context/valdiateOTPContext.js.map +1 -0
  140. package/lib/module/utils/helper.js +1 -0
  141. package/lib/module/utils/helper.js.map +1 -1
  142. package/lib/module/utils/hooks/useTimer.js +67 -30
  143. package/lib/module/utils/hooks/useTimer.js.map +1 -1
  144. package/lib/typescript/components/executiontasks/collectPayment/PaymentStyles.d.ts +3 -3
  145. package/lib/typescript/components/executiontasks/deliver/DeliverETInput.d.ts +0 -1
  146. package/lib/typescript/components/executiontasks/scan/modalConstant.d.ts +0 -1
  147. package/lib/typescript/components/executiontasks/validateOTP/ValidateOTPET.d.ts +3 -3
  148. package/lib/typescript/components/executiontasks/validateOTP/ValidateOTPSchema.d.ts +169 -5
  149. package/lib/typescript/components/executiontasks/validateOTP/ValidateOtpStyles.d.ts +255 -0
  150. package/lib/typescript/components/executiontasks/validateOTP/components/ContactListView.d.ts +3 -0
  151. package/lib/typescript/components/executiontasks/validateOTP/components/OTPView.d.ts +3 -0
  152. package/lib/typescript/components/executiontasks/validateOTP/components/VerificationComplete.d.ts +3 -0
  153. package/lib/typescript/components/executiontasks/validateOTP/constants.d.ts +11 -4
  154. package/lib/typescript/components/executiontasks/validateOTP/sub-components/ContactCard.d.ts +8 -0
  155. package/lib/typescript/components/executiontasks/validateOTP/sub-components/ResendOTPButton.d.ts +12 -0
  156. package/lib/typescript/components/executiontasks/validateOTP/utils.d.ts +31 -7
  157. package/lib/typescript/components/utils/Scale.d.ts +4 -0
  158. package/lib/typescript/components/widgets/ConfirmCancelModal.d.ts +9 -0
  159. package/lib/typescript/components/widgets/SnackBarCustom.d.ts +4 -8
  160. package/lib/typescript/components/widgets/SplitTextInput.d.ts +1 -1
  161. package/lib/typescript/components/widgets/Timer.d.ts +3 -3
  162. package/lib/typescript/constants/apiConstants.d.ts +3 -0
  163. package/lib/typescript/constants/constants.d.ts +1 -0
  164. package/lib/typescript/icons/index.d.ts +4 -0
  165. package/lib/typescript/index.d.ts +2 -0
  166. package/lib/typescript/manager/sdk/callbacksHandler.d.ts +4 -1
  167. package/lib/typescript/manager/syncmanager/constants.d.ts +2 -0
  168. package/lib/typescript/models/execTasks/ETConfig.d.ts +1 -1
  169. package/lib/typescript/models/sdk.d.ts +3 -0
  170. package/lib/typescript/network/GraphQLClient.d.ts +4 -4
  171. package/lib/typescript/styles/executionTasks/CommonStyles.d.ts +2 -2
  172. package/lib/typescript/ui/screens/HttpRequestScreen.d.ts +0 -1
  173. package/lib/typescript/utils/ApiUtils.d.ts +6 -2
  174. package/lib/typescript/utils/ExecTaskUtils.d.ts +1 -0
  175. package/lib/typescript/utils/context/paymentContext.d.ts +0 -1
  176. package/lib/typescript/utils/context/valdiateOTPContext.d.ts +6 -0
  177. package/lib/typescript/utils/hooks/useModal.d.ts +0 -2
  178. package/lib/typescript/utils/hooks/useTimer.d.ts +7 -5
  179. package/package.json +46 -44
  180. package/src/components/dispatch/DispatchExecNavigator.tsx +1 -1
  181. package/src/components/executiontasks/forms/widgets/DateTimeWidget.tsx +2 -2
  182. package/src/components/executiontasks/imageCapture/CaptureUtils.ts +1 -1
  183. package/src/components/executiontasks/validateOTP/ValidateOTPET.tsx +654 -381
  184. package/src/components/executiontasks/validateOTP/ValidateOTPSchema.ts +193 -8
  185. package/src/components/executiontasks/validateOTP/ValidateOtpStyles.ts +296 -0
  186. package/src/components/executiontasks/validateOTP/components/ContactListView.tsx +109 -0
  187. package/src/components/executiontasks/validateOTP/components/OTPView.tsx +216 -0
  188. package/src/components/executiontasks/validateOTP/components/VerificationComplete.tsx +124 -0
  189. package/src/components/executiontasks/validateOTP/constants.ts +11 -4
  190. package/src/components/executiontasks/validateOTP/sub-components/ContactCard.tsx +72 -0
  191. package/src/components/executiontasks/validateOTP/sub-components/OTPInput.tsx +13 -7
  192. package/src/components/executiontasks/validateOTP/sub-components/ResendOTPButton.tsx +86 -0
  193. package/src/components/executiontasks/validateOTP/utils.ts +313 -143
  194. package/src/components/utils/Scale.ts +13 -0
  195. package/src/components/widgets/ConfirmCancelModal.tsx +49 -0
  196. package/src/components/widgets/SnackBarCustom.tsx +37 -13
  197. package/src/components/widgets/SplitTextInput.tsx +58 -21
  198. package/src/constants/apiConstants.ts +3 -0
  199. package/src/constants/constants.ts +2 -2
  200. package/src/icons/icExclamationcircleo_dark.svg +3 -0
  201. package/src/icons/icFailed.gif +0 -0
  202. package/src/icons/icRadioChecked.svg +4 -0
  203. package/src/icons/icRadioUnchecked.svg +4 -0
  204. package/src/icons/icSuccess.gif +0 -0
  205. package/src/icons/index.ts +5 -0
  206. package/src/index.tsx +2 -0
  207. package/src/manager/sdk/DispatchSDKManager.ts +6 -5
  208. package/src/manager/sdk/callbacksHandler.ts +29 -12
  209. package/src/manager/syncmanager/constants.ts +2 -0
  210. package/src/manager/syncmanager/document/DocumentHttpClient.ts +29 -29
  211. package/src/manager/syncmanager/document/DocumentSyncManager.ts +75 -84
  212. package/src/models/sdk.ts +6 -0
  213. package/src/ui/screens/ValidateOTPScreen.tsx +194 -32
  214. package/src/utils/ApiUtils.ts +131 -3
  215. package/src/utils/ExecTaskUtils.ts +77 -15
  216. package/src/utils/context/valdiateOTPContext.ts +9 -0
  217. package/src/utils/helper.ts +0 -1
  218. package/src/utils/hooks/useTimer.ts +94 -36
@@ -313,7 +313,7 @@ export default class DocumentSyncManager {
313
313
  processedPath
314
314
  );
315
315
  } catch (err: any) {
316
- let cta = 'updateDocument-updateDocumentProcessedPath'
316
+ let cta = 'updateDocument-updateDocumentProcessedPath-Error'
317
317
  fireEventWithScreenName({
318
318
  severityLevel: SeverityLevelValue.ERROR,
319
319
  eventName: SentryEventNameSdkConstants.APP_ERROR,
@@ -364,104 +364,95 @@ export default class DocumentSyncManager {
364
364
 
365
365
  // This function will generate overlay image and update documents table for processed_file_path columns with overlayed image path.
366
366
  private async processImageData(documentRow: DocumentRow) {
367
+ let extra = {
368
+ msg: '',
369
+ fName: documentRow.file_name && documentRow.file_name.length != 0 ? documentRow.file_name.substring(4) : '',
370
+ dName: documentRow.fms_folder_id && documentRow.fms_folder_id.length != 0 ? documentRow.fms_folder_id.substring(4) : '',
371
+ dispId: documentRow.dispatch_id && documentRow.dispatch_id.length != 0 ? documentRow.dispatch_id.substring(9) : ''
372
+ };
367
373
  // If processed_file_path of overlayed image already existing then do not generate it again.
368
374
  if (
369
375
  documentRow.processed_file_path === null ||
370
376
  documentRow.processed_file_path === ''
371
377
  ) {
372
- let cta = 'processImageData-started';
373
- let extra = {
374
- msg: 'processImageData-started',
375
- fName: documentRow.file_name && documentRow.file_name.length != 0 ? documentRow.file_name.substring(4) : '',
376
- dName: documentRow.fms_folder_id && documentRow.fms_folder_id.length != 0 ? documentRow.fms_folder_id.substring(4) : '',
377
- dispId: documentRow.dispatch_id && documentRow.dispatch_id.length != 0 ? documentRow.dispatch_id.substring(9) : ''
378
- };
379
- fireEventWithScreenName({
380
- severityLevel: SeverityLevelValue.LOG,
381
- eventName: SentryEventNameSdkConstants.APP_LOG,
382
- screenName: cta,
383
- cta: cta,
384
- extraParams: extra,
385
- });
386
- Logger.getInstance().logEvent(
387
- cta,
388
- flattenObject(extra),
389
- LOG_TYPE.SDK_ERROR
390
- );
391
- let pFilePath = 'processed_' + documentRow.file_name; // File name for processed file.
392
- let strGeoStamp = documentRow.geo_timestamp; // Saved geostamp string
393
- let objGeoStamp = JSON.parse(strGeoStamp); // Conversion to geostamp object
394
- let dateTime = objGeoStamp.dateTime; // Date time stamp in UTC format
395
- let lat = objGeoStamp.lat; // Latitide
396
- let lng = objGeoStamp.lng; // Longitude
397
- let accuracy = objGeoStamp.accuracy; // Location accuracy
398
- let strDMS = latlngToDms(`${lat}, ${lng}`); // Location in degree format
399
- let strDMSWithAccuracy = strDMS;
400
- if (accuracy !== '') {
401
- strDMSWithAccuracy = strDMS + ' (Accuracy: ' + accuracy + 'm)'; // Appedning accuracy in location
402
- }
403
- let fontSize = 14;
404
- if (Platform.OS !== 'android') {
405
- fontSize = 28;
406
- }
407
- const options = {
408
- backgroundImage: { // Image for overlay
409
- src: documentRow.file_path,
410
- scale: 1,
411
- },
412
- watermarkTexts: [
413
- {
414
- text: `${dateTime}\n${strDMSWithAccuracy}`, //Overlay text
415
- position: {
416
- position: Position.topLeft, // Overlay text position
417
- },
418
- style: { // Style for overlay
419
- color: '#ffffff',
420
- fontSize: fontSize,
421
- fontName: 'Arial',
422
- textBackgroundStyle: {
423
- padding: '1% 1%',
424
- type: TextBackgroundType.none,
425
- color: '#444444CC',
378
+ try {
379
+ let cta = 'processImageData-started';
380
+ extra.msg = cta;
381
+ Logger.getInstance().logEvent(
382
+ cta,
383
+ flattenObject(extra),
384
+ LOG_TYPE.SDK_ERROR
385
+ );
386
+ let pFilePath = 'processed_' + documentRow.file_name; // File name for processed file.
387
+ let strGeoStamp = documentRow.geo_timestamp; // Saved geostamp string
388
+ let objGeoStamp = JSON.parse(strGeoStamp); // Conversion to geostamp object
389
+ let dateTime = objGeoStamp.dateTime; // Date time stamp in UTC format
390
+ let lat = objGeoStamp.lat; // Latitide
391
+ let lng = objGeoStamp.lng; // Longitude
392
+ let accuracy = objGeoStamp.accuracy; // Location accuracy
393
+ let strDMS = latlngToDms(`${lat}, ${lng}`); // Location in degree format
394
+ let strDMSWithAccuracy = strDMS;
395
+ if (accuracy !== '') {
396
+ strDMSWithAccuracy = strDMS + ' (Accuracy: ' + accuracy + 'm)'; // Appedning accuracy in location
397
+ }
398
+ let fontSize = 14;
399
+ if (Platform.OS !== 'android') {
400
+ fontSize = 28;
401
+ }
402
+ const options = {
403
+ backgroundImage: { // Image for overlay
404
+ src: documentRow.file_path,
405
+ scale: 1,
406
+ },
407
+ watermarkTexts: [
408
+ {
409
+ text: `${dateTime}\n${strDMSWithAccuracy}`, //Overlay text
410
+ position: {
411
+ position: Position.topLeft, // Overlay text position
412
+ },
413
+ style: { // Style for overlay
414
+ color: '#ffffff',
415
+ fontSize: fontSize,
416
+ fontName: 'Arial',
417
+ textBackgroundStyle: {
418
+ padding: '1% 1%',
419
+ type: TextBackgroundType.none,
420
+ color: '#444444CC',
421
+ },
426
422
  },
427
423
  },
428
- },
429
- ],
430
- scale: 0,
431
- quality: 100,
432
- filename: pFilePath,
433
- saveFormat: ImageFormat.jpg, // Saving in jpeg format
434
- };
435
- let processedFilePath = await Marker.markText(options); // Generating overlay image
436
- if (processedFilePath !== null && processedFilePath !== '') {
437
- let completeFilePath = processedFilePath;
438
- // If processd image file path does not have prefix file:// then we are addding manually
439
- if (!processedFilePath.includes('file')) {
440
- completeFilePath = 'file://' + processedFilePath;
424
+ ],
425
+ scale: 0,
426
+ quality: 100,
427
+ filename: pFilePath,
428
+ saveFormat: ImageFormat.jpg, // Saving in jpeg format
429
+ };
430
+ let processedFilePath = await Marker.markText(options); // Generating overlay image
431
+ if (processedFilePath !== null && processedFilePath !== '') {
432
+ let completeFilePath = processedFilePath;
433
+ // If processd image file path does not have prefix file:// then we are addding manually
434
+ if (!processedFilePath.includes('file')) {
435
+ completeFilePath = 'file://' + processedFilePath;
436
+ }
437
+ // Updating document document table with overlayed image path
438
+ this.updateDocumentProcessedPath(
439
+ documentRow,
440
+ documentRow.file_path, //original file path catprued from camera
441
+ completeFilePath // completeFilePath is the path with file:// of processed file
442
+ );
443
+ documentRow.processed_file_path = completeFilePath;
441
444
  }
442
- // Updating document document table with overlayed image path
445
+ } catch (error: any) {
443
446
  this.updateDocumentProcessedPath(
444
447
  documentRow,
445
448
  documentRow.file_path, //original file path catprued from camera
446
- completeFilePath // completeFilePath is the path with file:// of processed file
449
+ documentRow.file_path // completeFilePath is the path with file:// of processed file
447
450
  );
448
- documentRow.processed_file_path = completeFilePath;
451
+ documentRow.processed_file_path = ""
449
452
  }
450
453
  }
451
454
  let cta = 'processImageData-completed';
452
- let extra = {
453
- msg: 'processImageData-completed',
454
- fName: documentRow.file_name && documentRow.file_name.length != 0 ? documentRow.file_name.substring(4) : '',
455
- dName: documentRow.fms_folder_id && documentRow.fms_folder_id.length != 0 ? documentRow.fms_folder_id.substring(4) : '',
456
- dispId: documentRow.dispatch_id && documentRow.dispatch_id.length != 0 ? documentRow.dispatch_id.substring(9) : ''
457
- };
458
- fireEventWithScreenName({
459
- severityLevel: SeverityLevelValue.LOG,
460
- eventName: SentryEventNameSdkConstants.APP_LOG,
461
- screenName: cta,
462
- cta: cta,
463
- extraParams: extra,
464
- });
455
+ extra.msg = cta;
465
456
  Logger.getInstance().logEvent(
466
457
  cta,
467
458
  flattenObject(extra),
package/src/models/sdk.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ import { EmailAndPhoneResponse } from '../components/executiontasks/validateOTP/ValidateOTPSchema';
1
3
  import type { EventCodes } from './ReasonCodes';
2
4
 
3
5
  export interface DispatchSDKConfig {
@@ -6,6 +8,7 @@ export interface DispatchSDKConfig {
6
8
  userName: string;
7
9
  tenantBaseURL: string;
8
10
  domain: string;
11
+ validateOtpDomain: string;
9
12
  env: ENV;
10
13
  headers?: { [key: string]: any };
11
14
  enableLogging?: boolean;
@@ -30,6 +33,9 @@ export interface DispatchSDKConfig {
30
33
  ) => Promise<{ key: string; value: string[] }>;
31
34
  fetchDateTimeCallback?: () => Promise<string>;
32
35
  tokenRefreshCallback?: () => Promise<string>;
36
+ fetchSDSEmailAndPhoneNumbersCallback: (
37
+ sdsIds: string[]
38
+ ) => Promise<Record<string, EmailAndPhoneResponse>>;
33
39
  };
34
40
  etConfig: {
35
41
  phoneCode: string;
@@ -1,13 +1,51 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ // External Libraries
1
3
  import React, { useEffect, useState } from 'react';
4
+ import { SafeAreaProvider } from 'react-native-safe-area-context';
5
+
6
+ // SDKs and Platform Libraries
7
+ import { DispatchExecutor } from '@os1-platform/platform-coreos-execution-engine-sdk';
8
+
9
+ // Utility and Manager Imports
10
+ import Storage from '../../utils/storage';
11
+ import callbackHandler from '../../manager/sdk/callbacksHandler';
12
+ import Logger, { LOG_TYPE } from '../../utils/Logger';
13
+ import { handleDynamicValues, onTaskStart } from '../../utils/ExecTaskUtils';
14
+ import { RouteParams, getDataFromNextState } from '../uiConfig/RouteParams';
15
+ import { PROGRESS_GROUP } from '../../utils/Constants';
16
+ import DispatchStateContainer from '../../manager/dispatch/DispatchStateContainer';
2
17
  import withBaseDispatchScreen from './WithBaseDispatchScreen';
3
- import type { BaseETProps } from '../../models/DispatchModels';
18
+ import { BaseETProps } from '../../models/DispatchModels';
19
+ import DispatchSdkCache from '../../manager/sdk/DispatchSdkCache';
20
+ import { DispatchSDKConfig } from '../../models/sdk';
21
+ import Helper from '../../utils/helper';
22
+
23
+ // Network Client
24
+ import NetworkClient from '../../network/NetworkClient';
25
+
26
+ // Models and Constants
4
27
  import { EntityCode, ExecutionTaskID } from '../../models/execTasks/ETConfig';
5
- import DispatchStateContainer from '../../manager/dispatch/DispatchStateContainer';
6
- import { RouteParams, getDataFromNextState } from '../uiConfig/RouteParams';
28
+
29
+ // Components
7
30
  import ValidateOTPET from '../../components/executiontasks/validateOTP/ValidateOTPET';
8
- import { handleDynamicValues, onTaskStart } from '../../utils/ExecTaskUtils';
9
- import { ScreenNameSdkConstants, SentryEventNameSdkConstants, SeverityLevelValue } from '../../analytics/sentry/SentrySdkConstants';
31
+ import {
32
+ generateContactList,
33
+ getUniqueRefId,
34
+ resetCount,
35
+ } from '../../components/executiontasks/validateOTP/utils';
36
+ import { ContactType } from '../../components/executiontasks/validateOTP/ValidateOTPSchema';
37
+
38
+ // Analytics
39
+ import {
40
+ ScreenNameSdkConstants,
41
+ SentryEventNameSdkConstants,
42
+ SeverityLevelValue,
43
+ } from '../../analytics/sentry/SentrySdkConstants';
10
44
  import { fireEventWithScreenName } from '../../analytics/sentry/SentryAnalyticsUtils';
45
+ import { ValidateOTPContext } from '../../utils/context/valdiateOTPContext';
46
+
47
+ // Storage
48
+ let storage = Storage.getInstance();
11
49
 
12
50
  const ValidateOTPScreen = ({
13
51
  route,
@@ -18,14 +56,116 @@ const ValidateOTPScreen = ({
18
56
  navigation: any;
19
57
  baseETProps: BaseETProps;
20
58
  }) => {
59
+ const helperInstance = Helper.getInstance();
21
60
  const nextState = route.params[RouteParams.NEXT_STATES];
22
- const { taskMeta, mergedObjectiveId, input, wfMeta } =
61
+ const { taskMeta, mergedObjectiveId, input, wfMeta, taskName } =
23
62
  getDataFromNextState(nextState);
24
63
  const message = input?.message;
64
+ const workflowId = mergedObjectiveId[0]?.split('#')[1]?.toString();
65
+ let _route = JSON.parse(JSON.stringify(route));
25
66
  const firstInput = input;
26
- const [_input, setInputs] = useState({ ...firstInput });
67
+ const [_input, setInputs] = useState({
68
+ ...firstInput,
69
+ wfMeta,
70
+ workflowId,
71
+ });
72
+ const [contactList, setContactList] = useState<ContactType[] | any[]>([]);
73
+ // state to store orders data
74
+ const [orderData, setOrderData] = useState<any>([]);
75
+ const [contextData, setContextData] = useState<any>();
76
+ const [isSelfLoopTrue, setSelfLoop] = useState(false);
77
+
78
+ async function getSdkConfig() {
79
+ const cache = DispatchSdkCache.getInstance();
80
+ const _sdkConfig: DispatchSDKConfig = await cache.getObjectFromCache(
81
+ DispatchSdkCache.KEYS.SDK_CONFIG
82
+ );
83
+
84
+ const networkInstance = new NetworkClient(
85
+ _sdkConfig.validateOtpDomain ?? ''
86
+ );
87
+ setContextData({ _sdkConfig, networkInstance });
88
+ return { _sdkConfig, networkInstance };
89
+ }
90
+
91
+ const getSelfLoopBool = async () => {
92
+ try {
93
+ const splitArr = mergedObjectiveId[0]?.split('#');
94
+ const isSelfLoopTrue: boolean = await helperInstance.isSelfLoopExistOnET(splitArr[1], taskName)
95
+ setSelfLoop(isSelfLoopTrue);
96
+ } catch (error) {
97
+ console.log('isSelfLoopTrue code execution error', error);
98
+ }
99
+ };
27
100
 
28
101
  useEffect(() => {
102
+ // fetch Contact details & mapped contact list
103
+ const fetchContactDetails = async () => {
104
+ const rootMetaData = route.params[RouteParams.ROOT_META_DATA];
105
+ if (!rootMetaData) return; // Exit early if ROOT_META_DATA is not available
106
+
107
+ let progressGroup: string | null = null;
108
+ let reattemptId: number | string | null = null;
109
+
110
+ // Fetch the progress group with error handling
111
+ try {
112
+ progressGroup = await storage.getSharedItem(PROGRESS_GROUP, false);
113
+ reattemptId = await DispatchExecutor.getAttemptCountByMoId(
114
+ mergedObjectiveId[0]
115
+ );
116
+ const refId = getUniqueRefId(
117
+ mergedObjectiveId[0],
118
+ progressGroup,
119
+ Number(reattemptId)
120
+ );
121
+ setInputs({ ..._input, progressGroup, reattemptId, refId });
122
+ } catch (error: any) {
123
+ Logger.getInstance().logEvent(
124
+ '~ getPaymentStatus triggered ',
125
+ JSON.stringify(error?.response?.data || error),
126
+ LOG_TYPE.SDK_ERROR
127
+ );
128
+ }
129
+
130
+ try {
131
+ // Get objective task details
132
+ const { contact } = await DispatchExecutor.getObjectiveTaskDetails(
133
+ mergedObjectiveId[0],
134
+ progressGroup,
135
+ rootMetaData.statusFilter
136
+ );
137
+
138
+ // Fetch contact details and generate contact list
139
+ const contactDetails = await callbackHandler.getEmailAndPhoneNumbers(
140
+ contact
141
+ );
142
+
143
+ // Fetch and set order data
144
+ const data = await DispatchExecutor.filterWFIData(
145
+ taskName,
146
+ mergedObjectiveId,
147
+ 100,
148
+ 0
149
+ );
150
+ if (data?.data) {
151
+ setOrderData(data.data);
152
+ }
153
+
154
+ // If valid contact details, generate and set contact list
155
+ if (contactDetails?.[contact[0]]) {
156
+ const mappedContacts = generateContactList(
157
+ contactDetails[contact[0]],
158
+ data?.data[0]?.displayInfo?.orderId ?? null
159
+ );
160
+ setContactList(mappedContacts);
161
+ }
162
+ } catch (error) {
163
+ // Handle any unexpected errors in the process
164
+ console.error('Error fetching contact details:', error);
165
+ }
166
+ };
167
+
168
+ // fetch & update dynamic inputs
29
169
  onTaskStart(
30
170
  route.params[RouteParams.NEXT_STATES],
31
171
  route.params[RouteParams.ROOT_META_DATA].customEventsData
@@ -37,36 +177,58 @@ const ValidateOTPScreen = ({
37
177
  );
38
178
  setInputs(updatedInput);
39
179
  }
40
- }, []);
41
-
42
- useEffect(() => {
180
+ //fire sentry event
43
181
  (async () => {
44
- //fire sentry event
45
- fireEventWithScreenName({severityLevel:SeverityLevelValue.LOG, eventName:SentryEventNameSdkConstants.VERIFY_OTP_ET_OPENED, screenName:ScreenNameSdkConstants.VERIFY_OTP_ET_SCREEN});
182
+ fireEventWithScreenName({
183
+ severityLevel: SeverityLevelValue.LOG,
184
+ eventName: SentryEventNameSdkConstants.VERIFY_OTP_ET_OPENED,
185
+ screenName: ScreenNameSdkConstants.VERIFY_OTP_ET_SCREEN,
186
+ });
187
+ //get SDK config
188
+ await getSdkConfig();
189
+ //get self loop boolean
190
+ await getSelfLoopBool();
46
191
  })();
47
- }, []);
48
192
 
193
+ fetchContactDetails();
194
+ // eslint-disable-next-line react-hooks/exhaustive-deps
195
+ }, []);
49
196
 
50
197
  return (
51
- <ValidateOTPET
52
- {..._input}
53
- mergedObjectiveId={mergedObjectiveId}
54
- taskMeta={taskMeta}
55
- message={message}
56
- navigation={navigation}
57
- onSubmitET={async (validateOtpOutput) => {
58
- await DispatchStateContainer.getInstance().navigateToNextTask(
59
- navigation,
60
- route,
61
- validateOtpOutput,
62
- validateOtpOutput.success,
63
- EntityCode.VALIDATE_OTP_ET,
64
- ExecutionTaskID.VALIDATE_OTP_ET,
65
- baseETProps,
66
- false
67
- );
68
- }}
69
- />
198
+ <SafeAreaProvider>
199
+ <ValidateOTPContext.Provider
200
+ value={{
201
+ sdkConfig: contextData?._sdkConfig,
202
+ networkInstance: contextData?.networkInstance,
203
+ }}
204
+ >
205
+ <ValidateOTPET
206
+ {..._input}
207
+ route={route}
208
+ isSelfLoop={isSelfLoopTrue}
209
+ mergedObjectiveId={mergedObjectiveId}
210
+ workflowId={workflowId}
211
+ taskMeta={taskMeta}
212
+ message={message}
213
+ contacts={contactList || []}
214
+ orderData={orderData}
215
+ navigation={navigation}
216
+ onSubmitET={async (validateOtpOutput) => {
217
+ await DispatchStateContainer.getInstance().navigateToNextTask(
218
+ navigation,
219
+ _route,
220
+ validateOtpOutput,
221
+ validateOtpOutput.success,
222
+ EntityCode.VALIDATE_OTP_ET,
223
+ ExecutionTaskID.VALIDATE_OTP_ET,
224
+ baseETProps,
225
+ false
226
+ );
227
+ await resetCount();
228
+ }}
229
+ />
230
+ </ValidateOTPContext.Provider>
231
+ </SafeAreaProvider>
70
232
  );
71
233
  };
72
234
  export default withBaseDispatchScreen(ValidateOTPScreen);
@@ -1,6 +1,9 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1
2
  import axios, { AxiosRequestConfig } from 'axios';
2
3
  import { API_CONFIG } from '../constants/apiConstants';
3
4
  import { getHeaders } from '../network/NetworkUtils';
5
+ import { RouteParams } from '../ui/uiConfig/RouteParams';
6
+ import { parseRequestBody } from './ExecTaskUtils';
4
7
 
5
8
  export type HTTPMethod = 'PUT' | 'POST' | 'GET';
6
9
  export type HeaderKey = string;
@@ -49,8 +52,10 @@ export interface APIData {
49
52
  requestBody?: HTTPRequestBody;
50
53
  queryParams?: QueryParams[];
51
54
  pathParams?: PathParams[];
52
- responseJsonPath: string;
53
- errorJsonPath: string;
55
+ responseJsonPath: string | object;
56
+ errorJsonPath: string | object;
57
+ errorJsonLogic?: object | string;
58
+ responseJsonLogic?: object | string;
54
59
  }
55
60
 
56
61
  export interface KeyValueArray {
@@ -119,11 +124,134 @@ export async function getApiResponse(apiData: APIData) {
119
124
  if (apiData.requestBody) {
120
125
  axiosConfig.data = { ...apiData.requestBody };
121
126
  }
122
- // console.log('axiosConfig: ', JSON.stringify(axiosConfig));
127
+ console.log('axiosConfig: ', JSON.stringify(axiosConfig));
123
128
 
124
129
  return axios(axiosConfig);
125
130
  }
126
131
 
132
+ // new
133
+ export async function getAxiosApiResponse(apiData: APIData) {
134
+ let axiosConfig: AxiosRequestConfig = {
135
+ method: apiData.httpMethod,
136
+ timeout: apiData.timeout ?? API_CONFIG.timeout, // timeout in millis i.e 15s
137
+ url: apiData.uri,
138
+ headers: {
139
+ ...getAddHeaders(apiData.headers),
140
+ ...(await getHeaders('application/json')),
141
+ },
142
+ };
143
+
144
+ // Handle path parameters
145
+ if (apiData.pathParams) {
146
+ const params = apiData.pathParams;
147
+ params.forEach((param) => {
148
+ apiData.uri = apiData.uri.replace(`{${param.key}}`, param.value);
149
+ });
150
+ axiosConfig.url = apiData.uri;
151
+ }
152
+
153
+ // Handle query parameters
154
+ if (apiData.queryParams) {
155
+ axiosConfig.params = { ...getQueryParams(apiData.queryParams) };
156
+ }
157
+
158
+ // Handle request body
159
+ if (apiData.requestBody) {
160
+ axiosConfig.data = { ...apiData.requestBody };
161
+ }
162
+
163
+ console.log('axiosConfig: ', JSON.stringify(axiosConfig));
164
+
165
+ try {
166
+ // Make the API call
167
+ const response = await axios(axiosConfig);
168
+ return response;
169
+ } catch (error: any) {
170
+ console.error('API Error:', error);
171
+
172
+ let customError = {
173
+ ...error,
174
+ data: {
175
+ message: error?.response?.data?.message,
176
+ additionalInfo: error?.response?.data?.additionalInfo,
177
+ status: error?.response?.data?.status,
178
+ },
179
+ };
180
+
181
+ // console.log('Formatted Error:', customError);
182
+ // Throw the custom error for the caller to handle
183
+ throw customError;
184
+ }
185
+ }
186
+
187
+ // To generate an common payload for APIS as per config
188
+ export const createApiData = (
189
+ payload: any,
190
+ props: any,
191
+ endpoint: string,
192
+ httpMethod: HTTPMethod,
193
+ headers: Headers[] | null,
194
+ customApiConfig?: Partial<APIData>
195
+ ): APIData => {
196
+ const baseApiData: APIData = {
197
+ errorJsonPath: '',
198
+ responseJsonPath: '',
199
+ uri: endpoint,
200
+ httpMethod: httpMethod ?? 'POST',
201
+ timeout: 15000,
202
+ headers: headers ?? [],
203
+ responseJsonLogic: '',
204
+ errorJsonLogic: '',
205
+ requestBody: payload,
206
+ pathParams: [{ key: 'baseURI', value: props.domain }],
207
+ };
208
+
209
+ if (customApiConfig) {
210
+ Object.assign(baseApiData, {
211
+ httpMethod: customApiConfig.httpMethod ?? baseApiData.httpMethod,
212
+ timeout: customApiConfig.timeout ?? baseApiData.timeout,
213
+ headers: customApiConfig.headers ?? baseApiData.headers,
214
+ responseJsonLogic: customApiConfig.responseJsonLogic,
215
+ errorJsonLogic: customApiConfig.errorJsonLogic,
216
+ errorJsonPath: customApiConfig.errorJsonPath ?? baseApiData.errorJsonPath,
217
+ responseJsonPath:
218
+ customApiConfig.responseJsonPath ?? baseApiData.responseJsonPath,
219
+ });
220
+
221
+ if (customApiConfig.requestBody) {
222
+ const inputMeta =
223
+ props?.route?.params[RouteParams.NEXT_STATES]?.meta?.task;
224
+ const parsedInputMeta = inputMeta ? JSON.parse(inputMeta) : {};
225
+ console.log('parsedInputMeta', parsedInputMeta);
226
+
227
+ const metaData = {
228
+ meta: { task: parsedInputMeta },
229
+ };
230
+ const updatedPayload = {
231
+ ...payload,
232
+ ...metaData,
233
+ };
234
+ console.log('updatedPayload', updatedPayload);
235
+ baseApiData.requestBody = parseRequestBody(
236
+ customApiConfig.requestBody,
237
+ updatedPayload
238
+ );
239
+
240
+ console.log('baseApiData.requestBody', baseApiData.requestBody);
241
+ }
242
+ if (customApiConfig.pathParams) {
243
+ baseApiData.pathParams = customApiConfig.pathParams;
244
+ }
245
+ if (customApiConfig.queryParams) {
246
+ baseApiData.queryParams = customApiConfig.queryParams;
247
+ }
248
+ }
249
+
250
+ console.log('baseApiData', baseApiData);
251
+
252
+ return baseApiData;
253
+ };
254
+
127
255
  export function parseBody(body: any, userInput: any) {
128
256
  const requestBody = JSON.parse(JSON.stringify(body));
129
257
  for (const key in requestBody) {