@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
@@ -1,3 +1,6 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ // External imports
3
+ import React, { useEffect, useRef, useState } from 'react';
1
4
  import {
2
5
  View,
3
6
  Text,
@@ -5,9 +8,16 @@ import {
5
8
  StyleSheet,
6
9
  TextInput,
7
10
  KeyboardTypeOptions,
11
+ Keyboard,
8
12
  } from 'react-native';
9
- import React, { useRef, useState } from 'react';
10
- import { ScreenNameSdkConstants, SentryEventNameSdkConstants, SeverityLevelValue } from '../../analytics/sentry/SentrySdkConstants';
13
+
14
+ // Internal imports
15
+ import { sHeight, sWidth } from '../utils/Scale';
16
+ import {
17
+ ScreenNameSdkConstants,
18
+ SentryEventNameSdkConstants,
19
+ SeverityLevelValue,
20
+ } from '../../analytics/sentry/SentrySdkConstants';
11
21
  import { fireEventWithScreenName } from '../../analytics/sentry/SentryAnalyticsUtils';
12
22
 
13
23
  export interface SplitTextInputProps {
@@ -32,18 +42,31 @@ const SplitTextInput = ({
32
42
  const [isInputBoxFocused, setIsInputBoxFocused] = useState(false);
33
43
 
34
44
  const handleOnPress = () => {
35
- const cta = "Split Text Input";
36
- fireEventWithScreenName({ severityLevel: SeverityLevelValue.LOG, eventName: SentryEventNameSdkConstants.BUTTON_CLICKED, screenName: ScreenNameSdkConstants.SPLIT_TEXT_INPUT_SCREEN, cta: cta });
45
+ const cta = 'Split Text Input';
46
+ fireEventWithScreenName({
47
+ severityLevel: SeverityLevelValue.LOG,
48
+ eventName: SentryEventNameSdkConstants.BUTTON_CLICKED,
49
+ screenName: ScreenNameSdkConstants.SPLIT_TEXT_INPUT_SCREEN,
50
+ cta: cta,
51
+ });
37
52
 
38
53
  setIsInputBoxFocused(true);
39
54
  inputRef.current.focus();
40
55
  };
41
56
 
42
57
  const handleOnBlur = () => {
43
-
44
58
  setIsInputBoxFocused(false);
59
+ inputRef.current.blur();
60
+ Keyboard.dismiss();
45
61
  };
46
62
 
63
+ useEffect(() => {
64
+ if (value?.length === maxLength) {
65
+ setIsInputBoxFocused(false);
66
+ inputRef.current.blur();
67
+ Keyboard.dismiss();
68
+ }
69
+ }, [maxLength, value?.length]);
47
70
  const boxDigit = (_: number, index: number) => {
48
71
  const digit = value[index] || '';
49
72
 
@@ -55,8 +78,9 @@ const SplitTextInput = ({
55
78
 
56
79
  const splitBoxesStyle = hasError
57
80
  ? widgetStyles.errorSplitBoxes
58
- : (isInputBoxFocused && isValueFocused) || value[index]
59
- ? widgetStyles.focusedSplitBoxes
81
+ : isInputBoxFocused && isValueFocused
82
+ ? // || value[index]
83
+ [widgetStyles.splitBoxes, widgetStyles.focusedSplitBoxes]
60
84
  : widgetStyles.splitBoxes;
61
85
 
62
86
  return (
@@ -79,33 +103,45 @@ const SplitTextInput = ({
79
103
  ref={inputRef}
80
104
  onBlur={handleOnBlur}
81
105
  keyboardType={keyboardType}
106
+ returnKeyLabel={'Done'}
107
+ returnKeyType="done"
108
+ onSubmitEditing={() => Keyboard.dismiss()}
109
+ onFocus={handleOnPress}
82
110
  />
83
111
  </>
84
112
  );
85
113
  };
86
114
 
87
115
  export default SplitTextInput;
88
-
89
116
  const widgetStyles = StyleSheet.create({
90
117
  splitContainer: {
91
118
  width: '100%',
92
119
  flexDirection: 'row',
93
- justifyContent: 'space-evenly',
120
+ justifyContent: 'flex-start',
121
+ gap: 16,
122
+ flexWrap: 'wrap',
94
123
  },
95
124
  splitBoxes: {
96
- borderColor: '#dddddd',
97
- borderWidth: 2,
98
- borderRadius: 5,
99
- padding: 12,
100
- minWidth: 50,
125
+ borderColor: '#DDE3F9',
126
+ borderWidth: 1,
127
+ borderRadius: 6,
128
+ padding: 8,
129
+ width: sWidth(36),
130
+ minWidth: sWidth(36),
131
+ maxWidth: sWidth(36),
132
+ flex: 1,
133
+ alignSelf: 'stretch',
134
+ minHeight: sHeight(48),
135
+ height: sHeight(48),
136
+ maxHeight: sHeight(48),
137
+ display: 'flex',
138
+ justifyContent: 'center',
139
+ alignContent: 'center',
101
140
  },
102
141
  focusedSplitBoxes: {
103
- borderColor: '#666666',
104
- borderWidth: 2,
105
- borderRadius: 5,
106
- padding: 12,
107
- minWidth: 50,
142
+ borderColor: '#5B80F7', // Override specific properties
108
143
  },
144
+
109
145
  errorSplitBoxes: {
110
146
  borderColor: '#DC2626',
111
147
  borderWidth: 2,
@@ -114,9 +150,10 @@ const widgetStyles = StyleSheet.create({
114
150
  minWidth: 50,
115
151
  },
116
152
  textInputHidden: {
117
- height: 30,
118
- width: 300,
153
+ height: sHeight(48),
154
+ width: '100%',
119
155
  position: 'absolute',
120
156
  opacity: 0,
157
+ backgroundColor: 'red',
121
158
  },
122
159
  });
@@ -7,6 +7,9 @@ export const ENDPOINTS = {
7
7
  GENERATE_QR: '/core/api/v1/payment-service/qrCode',
8
8
  PAYMENT_STATUS: '/core/api/v1/payment-service/status/',
9
9
  PAYMENT_MODES: '/core/api/v1/payment-service/config?isDefault=true',
10
+ GENERATE_OTP_ENDPOINT: '/otp/generate-otp',
11
+ VERIFY_OTP_ENDPOINT: '/otp/verify-otp',
12
+ RESEND_OTP_ENDPOINT: '/otp/resend-otp',
10
13
  };
11
14
 
12
15
  export const API_CONFIG = {
@@ -6,10 +6,10 @@ export const DEFAULT_PICKUP_TITLE = 'Pickup Order';
6
6
  export const DEFAULT_PICKUP_MESSAGE = 'Confirm Pickup of $ orders';
7
7
  export const DEFAULT_DELIVER_TITLE = 'Drop Order';
8
8
  export const DEFAULT_DELIVER_MESSAGE = 'Confirm Drop of $ orders';
9
- export const DEFAULT_SIGN_ET_MESSAGE =
10
- 'Please sign here';
9
+ export const DEFAULT_SIGN_ET_MESSAGE = 'Please sign here';
11
10
  export const REASON_NOT_USED = 'NOT_TO_BE_USED';
12
11
  export const GO_BACK_EVENT_CODE = 'E-099';
12
+ export const RETRY_LIMIT_REACHED_CODE = 'R-0066';
13
13
  export const PAYMENT_NOTIFICATION = 'PAYMENT_COMPLETED';
14
14
  export const EMAIL_REGEX = '^([a-z0-9_.+-]+)@([da-z.-]+).([a-z.]{2,6})$';
15
15
  export const PAYMENT_SUCCESS_DEFAULT_TIMEOUT = 3000;
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M8 0C3.58125 0 0 3.58125 0 8C0 12.4187 3.58125 16 8 16C12.4187 16 16 12.4187 16 8C16 3.58125 12.4187 0 8 0ZM8 15C4.14062 15 1 11.8594 1 8C1 4.14062 4.14062 1 8 1C11.8594 1 15 4.14062 15 8C15 11.8594 11.8594 15 8 15ZM8 5.75C8.41406 5.75 8.75 5.41437 8.75 5C8.75 4.58594 8.41406 4.25 8 4.25C7.58594 4.25 7.25 4.58437 7.25 5C7.25 5.41563 7.58437 5.75 8 5.75ZM9.5 11H8.5V7.5C8.5 7.225 8.275 7 8 7H7C6.725 7 6.5 7.225 6.5 7.5C6.5 7.775 6.725 8 7 8H7.5V11H6.5C6.225 11 6 11.225 6 11.5C6 11.775 6.225 12 6.5 12H9.5C9.77612 12 10 11.7761 10 11.5C10 11.225 9.775 11 9.5 11Z" fill="#525B7A"/>
3
+ </svg>
Binary file
@@ -0,0 +1,4 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="16" height="16" rx="8" fill="#5B80F7"/>
3
+ <circle cx="8" cy="8" r="3" fill="white"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect x="0.5" y="0.5" width="15" height="15" rx="7.5" fill="white"/>
3
+ <rect x="0.5" y="0.5" width="15" height="15" rx="7.5" stroke="#E0E3EB"/>
4
+ </svg>
Binary file
@@ -0,0 +1,5 @@
1
+ import RadioCheckedIcon from './icRadioChecked.svg';
2
+ import RadioUncheckedIcon from './icRadioUnchecked.svg';
3
+ import InfoExclamatoryDarkIcon from './icExclamationcircleo_dark.svg';
4
+
5
+ export { RadioCheckedIcon, RadioUncheckedIcon, InfoExclamatoryDarkIcon };
package/src/index.tsx CHANGED
@@ -46,6 +46,7 @@ import { fireEventWithScreenName } from './analytics/sentry/SentryAnalyticsUtils
46
46
  import { ScreenNameSdkConstants, SentryEventNameSdkConstants, SeverityLevelValue } from './analytics/sentry/SentrySdkConstants';
47
47
  import { DispatchAndUserData, SentryEvent } from './analytics/sentry/SentryModels';
48
48
  import DocumentManager from './manager/syncmanager/document/DocumentManager';
49
+ import {PhoneType, EmailType, EmailAndPhoneResponse } from './components/executiontasks/validateOTP/ValidateOTPSchema';
49
50
  export { DispatchExecutor, IDispatch, IDispatchExecutor };
50
51
  export { Storage, DispatchExecNavigator };
51
52
  export { ETSummary, CompleteSummary, ObjectiveSummary, DispatchSyncType };
@@ -80,3 +81,4 @@ export { Helper };
80
81
  //sentry function export
81
82
  export { SentryAnalyticsSingleton, fireEventWithScreenName, SeverityLevelValue, ScreenNameSdkConstants, SentryEventNameSdkConstants, DispatchAndUserData, SentryEvent };
82
83
  export { DocumentManager };
84
+ export { PhoneType, EmailType, EmailAndPhoneResponse };
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1
2
  import DispatchSdkCache from './DispatchSdkCache';
2
3
  import LocationManager from '../location/LocationManager';
3
4
  import AppSyncManager from '../syncmanager/AppSyncManager';
@@ -31,7 +32,6 @@ export class DispatchSDKManager {
31
32
  return DispatchSDKManager.instance;
32
33
  }
33
34
 
34
-
35
35
  /**
36
36
  * Call this init method with username,userID & authentication tokens
37
37
  * @param sdkConfig
@@ -83,13 +83,15 @@ export class DispatchSDKManager {
83
83
 
84
84
  if (
85
85
  sdkConfig.callbacks?.fetchPhoneNumbersCallback &&
86
- sdkConfig?.callbacks?.fetchDateTimeCallback &&
87
- sdkConfig?.callbacks?.tokenRefreshCallback
86
+ sdkConfig?.callbacks?.fetchDateTimeCallback &&
87
+ sdkConfig?.callbacks?.tokenRefreshCallback &&
88
+ sdkConfig?.callbacks?.fetchSDSEmailAndPhoneNumbersCallback
88
89
  ) {
89
90
  await callbackHandler.init(
90
91
  sdkConfig.callbacks.fetchPhoneNumbersCallback,
91
92
  sdkConfig.callbacks.fetchDateTimeCallback,
92
- sdkConfig.callbacks.tokenRefreshCallback
93
+ sdkConfig.callbacks.tokenRefreshCallback,
94
+ sdkConfig?.callbacks?.fetchSDSEmailAndPhoneNumbersCallback
93
95
  );
94
96
  }
95
97
  await dispatchExecutor.init(
@@ -107,5 +109,4 @@ export class DispatchSDKManager {
107
109
  public removeLocationUpdates() {
108
110
  LocationManager.getInstance().stopLocationUpdates();
109
111
  }
110
-
111
112
  }
@@ -1,7 +1,9 @@
1
- import { DispatchSDKConfig } from "src/models/sdk";
2
- import DispatchSdkCache from "./DispatchSdkCache";
3
- import { BaseError, } from "../../errors/BaseError";
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ import { DispatchSDKConfig } from 'src/models/sdk';
3
+ import DispatchSdkCache from './DispatchSdkCache';
4
+ import { BaseError } from '../../errors/BaseError';
4
5
  import ErrorCodes from '../../errors/ErrorCodes';
6
+ import { EmailAndPhoneResponse } from '../../components/executiontasks/validateOTP/ValidateOTPSchema';
5
7
 
6
8
  class CallbacksHandler {
7
9
  private _callbackToFetchPhoneNumbers!: (
@@ -10,16 +12,24 @@ class CallbacksHandler {
10
12
 
11
13
  private _callbackToFetchDateTime!: () => Promise<string>;
12
14
  private _callbackRefreshToken!: () => Promise<string>;
15
+ private _callbackfetchSDSEmailAndPhone: (
16
+ sdsIds: string[]
17
+ ) => Promise<Record<string, EmailAndPhoneResponse>>;
13
18
 
14
19
  public init(
15
20
  phoneCallback: (
16
21
  sdsIds: string[]
17
22
  ) => Promise<{ key: string; value: string[] }>,
18
- dateTimeCallBack: () => Promise<string>, tokenRefreshCallback: () => Promise<string>
23
+ dateTimeCallBack: () => Promise<string>,
24
+ tokenRefreshCallback: () => Promise<string>,
25
+ emailAndPhoneCallback: (
26
+ sdsIds: string[]
27
+ ) => Promise<Record<string, EmailAndPhoneResponse>>
19
28
  ) {
20
29
  this._callbackToFetchPhoneNumbers = phoneCallback;
21
30
  this._callbackToFetchDateTime = dateTimeCallBack;
22
31
  this._callbackRefreshToken = tokenRefreshCallback;
32
+ this._callbackfetchSDSEmailAndPhone = emailAndPhoneCallback;
23
33
  }
24
34
 
25
35
  public async getPhoneNumbers(
@@ -31,6 +41,13 @@ class CallbacksHandler {
31
41
  }
32
42
  }
33
43
 
44
+ // Method to get email and phone numbers
45
+ public async getEmailAndPhoneNumbers(
46
+ sdsIds: string[]
47
+ ): Promise<Record<string, EmailAndPhoneResponse>> {
48
+ return await this._callbackfetchSDSEmailAndPhone(sdsIds);
49
+ }
50
+
34
51
  public async getDateTime(): Promise<string | ''> {
35
52
  if (!this._callbackToFetchDateTime) return '';
36
53
  else {
@@ -39,28 +56,28 @@ class CallbacksHandler {
39
56
  }
40
57
 
41
58
  public async refresheAndUpdateToken() {
42
- if (!this._callbackRefreshToken){
59
+ if (!this._callbackRefreshToken) {
43
60
  throw new BaseError(
44
61
  ErrorCodes.SyncManagerNotInitialized,
45
62
  'Dispatch SDK Not Initalised'
46
63
  );
47
64
  } else {
48
- let token = await this._callbackRefreshToken();
49
- if(token && token.length != 0){
65
+ let token = await this._callbackRefreshToken();
66
+ if (token && token.length != 0) {
50
67
  let sdkConfig =
51
- (await DispatchSdkCache.getInstance().getObjectFromCache(
52
- DispatchSdkCache.KEYS.SDK_CONFIG
53
- )) as DispatchSDKConfig;
68
+ (await DispatchSdkCache.getInstance().getObjectFromCache(
69
+ DispatchSdkCache.KEYS.SDK_CONFIG
70
+ )) as DispatchSDKConfig;
54
71
  sdkConfig.accessToken = token;
55
72
  var headers = sdkConfig.headers;
56
- if(headers){
73
+ if (headers) {
57
74
  headers['x-coreos-access'] = token;
58
75
  sdkConfig.headers = headers;
59
76
  }
60
77
  let cache: DispatchSdkCache = DispatchSdkCache.getInstance();
61
78
  let keys = DispatchSdkCache.KEYS;
62
79
  cache.setObjectInCache(keys.SDK_CONFIG, sdkConfig);
63
- }else{
80
+ } else {
64
81
  throw new BaseError(
65
82
  ErrorCodes.ACCESS_TOKEN_EXPIRED,
66
83
  'Unable to refresh token'
@@ -6,3 +6,5 @@ export const SCAN_MERGED_OBJ_ID_OUTPUT = 'scanMergedObjectiveIDs';
6
6
  export const POD_DOC = 'POD_DOC';
7
7
  export const PROCESS_MAX_RETRIED_ROWS = true;
8
8
  export const MAX_RETRY_COUNT = 3;
9
+ export const SHARED_PREFERENCE_RESEND_COUNT = 'validateETResendCount';
10
+ export const SHARED_PREFERENCE_RETRY_COUNT = 'validateETRetryCount';
@@ -7,8 +7,7 @@ import DispatchSdkCache from '../../sdk/DispatchSdkCache';
7
7
  import Logger, { LOG_TYPE } from '../../../utils/Logger';
8
8
  import type { DispatchSDKConfig } from '../../../models/sdk';
9
9
  import RNFS from 'react-native-fs';
10
- import { stat } from 'react-native-fs';
11
- import { ScreenNameSdkConstants, SentryEventNameSdkConstants, SeverityLevelValue } from '../../../analytics/sentry/SentrySdkConstants';
10
+ import { SentryEventNameSdkConstants, SeverityLevelValue } from '../../../analytics/sentry/SentrySdkConstants';
12
11
  import { fireEventWithScreenName } from '../../../analytics/sentry/SentryAnalyticsUtils';
13
12
  import { flattenObject, isTokenExpired } from '../../../utils/utils';
14
13
  import callbackHandler from '../../../manager/sdk/callbacksHandler';
@@ -34,11 +33,11 @@ export default class DocumentHttpClient extends HttpClient {
34
33
  } else {
35
34
  info = String(response.status);
36
35
  }
37
- let extraParameters = {
36
+ let extraParameters = {
38
37
  response: info,
39
- fName: document.file_name && document.file_name.length != 0 ? document.file_name.substring(4): '',
40
- dName: document.fms_folder_id && document.fms_folder_id.length != 0 ? document.fms_folder_id.substring(4): '',
41
- dispId: document.dispatch_id && document.dispatch_id.length != 0 ? document.dispatch_id.substring(9): ''
38
+ fName: document.file_name && document.file_name.length != 0 ? document.file_name.substring(4) : '',
39
+ dName: document.fms_folder_id && document.fms_folder_id.length != 0 ? document.fms_folder_id.substring(4) : '',
40
+ dispId: document.dispatch_id && document.dispatch_id.length != 0 ? document.dispatch_id.substring(9) : ''
42
41
  };
43
42
 
44
43
  fireEventWithScreenName({
@@ -61,7 +60,7 @@ export default class DocumentHttpClient extends HttpClient {
61
60
  response.status === 202
62
61
  ) {
63
62
  return response.data.data.id;
64
- }else{
63
+ } else {
65
64
  return null;
66
65
  }
67
66
  } else {
@@ -77,11 +76,11 @@ export default class DocumentHttpClient extends HttpClient {
77
76
  } else {
78
77
  info = String(uploadResponse.status);
79
78
  }
80
- let extraParameters = {
79
+ let extraParameters = {
81
80
  response: info,
82
- fName: document.file_name && document.file_name.length != 0 ? document.file_name.substring(4): '',
83
- dName: document.fms_folder_id && document.fms_folder_id.length != 0 ? document.fms_folder_id.substring(4): '',
84
- dispId: document.dispatch_id && document.dispatch_id.length != 0 ? document.dispatch_id.substring(9): ''
81
+ fName: document.file_name && document.file_name.length != 0 ? document.file_name.substring(4) : '',
82
+ dName: document.fms_folder_id && document.fms_folder_id.length != 0 ? document.fms_folder_id.substring(4) : '',
83
+ dispId: document.dispatch_id && document.dispatch_id.length != 0 ? document.dispatch_id.substring(9) : ''
85
84
  };
86
85
 
87
86
  fireEventWithScreenName({
@@ -106,16 +105,17 @@ export default class DocumentHttpClient extends HttpClient {
106
105
  LOG_TYPE.SDK_ERROR
107
106
  );
108
107
  FileSystem.deleteAsync(document.file_path).then().catch(); // WE DELETE FILE HERE
109
- FileSystem.deleteAsync(document.processed_file_path).then().catch(); // WE DELETE FILE HERE
110
-
108
+ if (document?.processed_file_path != null && document?.processed_file_path != '') {
109
+ FileSystem.deleteAsync(document.processed_file_path).then().catch(); // WE DELETE FILE HERE
110
+ }
111
111
  return JSON.parse(uploadResponse.body)?.data?.id;
112
- }else{
112
+ } else {
113
113
  return null;
114
114
  }
115
115
  }
116
116
  }
117
117
 
118
- // This function will upload processed base64 data (overlayed base64 data ) if exist otherwise will uplaod original base 64 data for pod signature.
118
+ // This function will upload processed base64 data (overlayed base64 data ) if exist otherwise will uplaod original base 64 data for pod signature.
119
119
  public async uploadBase64File(document: DocumentRow): Promise<AxiosResponse> {
120
120
  let dataToUpload = document.data;
121
121
  if (
@@ -142,16 +142,16 @@ export default class DocumentHttpClient extends HttpClient {
142
142
  let sdkConfig = (await cache.getObjectFromCache(
143
143
  cacheKeys.SDK_CONFIG
144
144
  )) as DispatchSDKConfig;
145
- if(isTokenExpired(sdkConfig.accessToken)){
145
+ if (isTokenExpired(sdkConfig.accessToken)) {
146
146
  await callbackHandler.refresheAndUpdateToken();
147
147
  sdkConfig = (await cache.getObjectFromCache(
148
148
  cacheKeys.SDK_CONFIG
149
149
  )) as DispatchSDKConfig;
150
150
  }
151
- let extraParameters = {
152
- fName: document.file_name && document.file_name.length != 0 ? document.file_name.substring(4): '',
153
- dName: document.fms_folder_id && document.fms_folder_id.length != 0 ? document.fms_folder_id.substring(4): '',
154
- dispId: document.dispatch_id && document.dispatch_id.length != 0 ? document.dispatch_id.substring(9): ''
151
+ let extraParameters = {
152
+ fName: document.file_name && document.file_name.length != 0 ? document.file_name.substring(4) : '',
153
+ dName: document.fms_folder_id && document.fms_folder_id.length != 0 ? document.fms_folder_id.substring(4) : '',
154
+ dispId: document.dispatch_id && document.dispatch_id.length != 0 ? document.dispatch_id.substring(9) : ''
155
155
  };
156
156
 
157
157
  fireEventWithScreenName({
@@ -165,7 +165,7 @@ export default class DocumentHttpClient extends HttpClient {
165
165
  flattenObject(extraParameters),
166
166
  LOG_TYPE.SDK_ERROR
167
167
  );
168
-
168
+
169
169
  return this.instance.post(
170
170
  `/api/folders/${document.fms_folder_id}/files`,
171
171
  requestBody,
@@ -185,11 +185,11 @@ export default class DocumentHttpClient extends HttpClient {
185
185
  private async uploadBinaryFile(
186
186
  document: DocumentRow
187
187
  ): Promise<FileSystemUploadResult> {
188
-
188
+
189
189
  let sdkConfig = (await cache.getObjectFromCache(
190
190
  cacheKeys.SDK_CONFIG
191
191
  )) as DispatchSDKConfig;
192
- if(isTokenExpired(sdkConfig.accessToken)){
192
+ if (isTokenExpired(sdkConfig.accessToken)) {
193
193
  await callbackHandler.refresheAndUpdateToken();
194
194
  sdkConfig = (await cache.getObjectFromCache(
195
195
  cacheKeys.SDK_CONFIG
@@ -205,12 +205,12 @@ export default class DocumentHttpClient extends HttpClient {
205
205
 
206
206
  const url =
207
207
  sdkConfig.tenantBaseURL + `/api/folders/${document.fms_folder_id}/files`;
208
-
209
- let extraParameters = {
208
+
209
+ let extraParameters = {
210
210
  fSize: fileStat.size + " b",
211
- fName: document.file_name && document.file_name.length != 0 ? document.file_name.substring(4): '',
212
- dName: document.fms_folder_id && document.fms_folder_id.length != 0 ? document.fms_folder_id.substring(4): '',
213
- dispId: document.dispatch_id && document.dispatch_id.length != 0 ? document.dispatch_id.substring(9): ''
211
+ fName: document.file_name && document.file_name.length != 0 ? document.file_name.substring(4) : '',
212
+ dName: document.fms_folder_id && document.fms_folder_id.length != 0 ? document.fms_folder_id.substring(4) : '',
213
+ dispId: document.dispatch_id && document.dispatch_id.length != 0 ? document.dispatch_id.substring(9) : ''
214
214
  };
215
215
 
216
216
  fireEventWithScreenName({
@@ -224,7 +224,7 @@ export default class DocumentHttpClient extends HttpClient {
224
224
  flattenObject(extraParameters),
225
225
  LOG_TYPE.SDK_ERROR
226
226
  );
227
-
227
+
228
228
  return FileSystem.uploadAsync(url, filePathToUpload, {
229
229
  headers: {
230
230
  'accept': 'application/json',