@os1-platform/dispatch-mobile 3.0.4 → 3.1.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.
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 +272 -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 +266 -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 +257 -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 +298 -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,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1
2
  import type {
2
3
  HTTPRequestBody,
3
4
  PathParams,
@@ -8,6 +9,7 @@ import type {
8
9
  BaseETResponse,
9
10
  } from '../../../models/execTasks/ETBaseModels';
10
11
  import type { Headers, HTTPMethod } from '../httpRequest/HttpRequestETSchema';
12
+ import { SnackBarType } from 'src/components/widgets/SnackBarCustom';
11
13
 
12
14
  export interface API {
13
15
  uri: string;
@@ -17,8 +19,10 @@ export interface API {
17
19
  requestBody?: HTTPRequestBody;
18
20
  queryParams?: QueryParams[];
19
21
  pathParams?: PathParams[];
20
- responseJsonLogic: object;
21
- errorJsonLogic: object;
22
+ responseJsonPath: string | object;
23
+ errorJsonPath: string | object;
24
+ errorJsonLogic?: object | string;
25
+ responseJsonLogic?: object | string;
22
26
  }
23
27
 
24
28
  export type ValidationRegex = string; // Regex to validate strings
@@ -39,6 +43,7 @@ export interface GenerationLogic {
39
43
  export enum InputType {
40
44
  STRING = 'string',
41
45
  NUMBER = 'number',
46
+ NUMERIC = 'numeric',
42
47
  }
43
48
 
44
49
  export interface CaptureInput {
@@ -58,11 +63,191 @@ export interface Validation {
58
63
  logic: Logic;
59
64
  }
60
65
 
61
- export type ValidateOTPInput = BaseETRequest & {
62
- generationLogic?: GenerationLogic;
63
- captureInput: CaptureInput;
64
- validation: Validation;
65
- onSubmitET: (validateOTPOutput: ValidateOTPOutput) => void;
66
+ export enum OtpDeliveryMethodTypes {
67
+ PHONE = 'Phone',
68
+ EMAIL = 'Email',
69
+ BOTH = 'Both',
70
+ }
71
+ export interface ResendOTPConfigType {
72
+ buttonTitle?: string;
73
+ enableResends: boolean;
74
+ enableDelay: number;
75
+ maxResends: number;
76
+ }
77
+
78
+ export type GenerateOtpPayloadType = {
79
+ refId: string;
80
+ jobId: string;
81
+ objectiveId: string;
82
+ contactInfo: {
83
+ id: string; // Unique identifier for the contact (e.g., secure:1)
84
+ mode: 'PHONE' | 'EMAIL' | string; // Indicates whether it's a phone or email
85
+ type: 'PRIMARY' | 'SECONDARY' | string; // Indicates whether it's the primary or secondary contact
86
+ index: number; // Index of the contact in its respective array};
87
+ };
88
+ pathParams?: PathParams[];
89
+ meta: string | object;
66
90
  };
67
91
 
68
- export type ValidateOTPOutput = BaseETResponse;
92
+ export interface ResendOTPPayloadType {
93
+ refId: string;
94
+ meta: string | object;
95
+ contactInfo?: {
96
+ id: string; // Unique identifier for the contact (e.g., secure:1)
97
+ mode: 'PHONE' | 'EMAIL' | string; // Indicates whether it's a phone or email
98
+ type: 'PRIMARY' | 'SECONDARY' | string; // Indicates whether it's the primary or secondary contact
99
+ index: number; // Index of the contact in its respective array};
100
+ };
101
+ }
102
+
103
+ export type ResponseType = {
104
+ status: boolean;
105
+ data: {
106
+ result: {
107
+ resendCount: number;
108
+ retryCount: number;
109
+ message: string;
110
+ };
111
+ };
112
+ };
113
+
114
+ export type ErrorResponseType = {
115
+ code: string;
116
+ description: string;
117
+ additionalInfo: {
118
+ resendCount: number;
119
+ retryCount: number;
120
+ message: string;
121
+ };
122
+ };
123
+
124
+ export type PhoneType = {
125
+ number: string | null; // Can be null if missing
126
+ countryCode: string | null; // Can be null if missing
127
+ isMobile: boolean | null; // Can be null if missing
128
+ muteNotif: boolean | null; // Explicitly nullable
129
+ areaCode?: string | null;
130
+ };
131
+
132
+ export type EmailType = {
133
+ id: string | null; // Can be null if missing
134
+ muteNotif: boolean | null; // Explicitly nullable
135
+ };
136
+
137
+ export type EmailAndPhoneResponse = {
138
+ id: string; // Always present
139
+ name: string; // Always present, but defaults to 'Unknown' if missing
140
+ phone: PhoneType; // Always present, but fields inside can be null
141
+ email: string | null; // Can be null if no email is provided
142
+ additionalPhone: PhoneType[] | null; // Can be null if no additional phones are provided
143
+ primaryEmail: EmailType | null; // Can be null if no primary email is provided
144
+ additionalEmail: EmailType[] | null; // Can be null if no additional emails are provided
145
+ };
146
+
147
+ export interface ContactType {
148
+ id: string; // Unique identifier for the contact (e.g., secure:1)
149
+ mode: 'PHONE' | 'EMAIL' | string; // Indicates whether it's a phone or email
150
+ type: 'PRIMARY' | 'SECONDARY' | string; // Indicates whether it's the primary or secondary contact
151
+ index: number; // Index of the contact in its respective array
152
+ value: string; // Actual phone number or email address
153
+ orderId?: string | undefined | null; // Optional order ID associated with the contact
154
+ }
155
+
156
+ export type ContactTypes = ContactType & {
157
+ orderFrom?: string; // Optional source from which the order came
158
+ contactId?: string; // Optional contact ID, might be different from `id`
159
+ isSelected?: boolean; // Optional flag indicating if the contact is selected
160
+ };
161
+ export interface OtpInputConfigType {
162
+ inputType: InputType;
163
+ length: number;
164
+ validationRegex: string;
165
+ }
166
+
167
+ export interface SetSnackBarType {
168
+ show: boolean;
169
+ message: string;
170
+ type: SnackBarType;
171
+ }
172
+
173
+ export type OTPViewPropTypes = BaseETRequest & {
174
+ errorMessage: string;
175
+ handleBackNavigation: () => void;
176
+ setCurrentScreen: (screen: string) => void;
177
+ setPrevScreen: (screen: string) => void;
178
+ isContactVisited: boolean;
179
+ selectedContact: ContactTypes;
180
+ otpInputConfig: OtpInputConfigType;
181
+ otpCode: string;
182
+ setOTPCode: (otp: string) => void;
183
+ hasError: boolean;
184
+ setHasError: (value: boolean) => void;
185
+ setErrorMessage: (screen: string) => void;
186
+ loading: boolean;
187
+ setLoading: (value: boolean) => void;
188
+ setSnackBar: (values: SetSnackBarType) => void;
189
+ resendConfig: ResendOTPConfigType; // Config for retry of OTP
190
+ resendCount: number;
191
+ setResendCount: React.Dispatch<React.SetStateAction<number>>;
192
+ domain: string;
193
+ };
194
+
195
+ export type ContactListViewPropTypes = BaseETRequest & {
196
+ handleBackNavigation: () => boolean;
197
+ handleSelectContact: (contactDetails: ContactTypes) => void;
198
+ contactList: ContactTypes[];
199
+ setIsContactVisited: (value: boolean) => void;
200
+ domain: string;
201
+ };
202
+
203
+ export type OTP_CONFIG_TYPE = 'OS1 Configured API' | 'Custom';
204
+
205
+ export enum ValidationType {
206
+ ONLINE = 'Online (from API)',
207
+ OFFLINE = 'Offline (from Job)',
208
+ }
209
+
210
+ export type OTP_VALIDATION_TYPE =
211
+ | ValidationType.OFFLINE
212
+ | ValidationType.ONLINE;
213
+
214
+ export type ValidateOTPInput = BaseETRequest &
215
+ OTPViewPropTypes &
216
+ ContactListViewPropTypes & {
217
+ generationLogic?: GenerationLogic;
218
+ captureInput: CaptureInput;
219
+ validation: Validation;
220
+ onSubmitET: (validateOTPOutput: ValidateOTPOutput) => void;
221
+ otpLength: number;
222
+ inputType: InputType;
223
+ generateMessage: string;
224
+ validateMessage: string;
225
+ allowCancel?: boolean;
226
+ restrictCancel?: boolean;
227
+ allowBack?: boolean;
228
+ doorstepOTP: boolean;
229
+ otpDeliveryMethod: OtpDeliveryMethodTypes;
230
+ resendOTP: ResendOTPConfigType;
231
+ contacts: ContactType[] | any[];
232
+ otpConfig: OTP_CONFIG_TYPE;
233
+ resendApi: API;
234
+ otpGeneration: API;
235
+ validationApi: API;
236
+ offlineOtpValue: string | number;
237
+ showSummary: boolean;
238
+ verifyFor: string;
239
+ validateFor: string;
240
+ jobId: string;
241
+ orderData: any[];
242
+ workflowId: string;
243
+ refId: string;
244
+ maxRetries: number;
245
+ otpValidation: OTP_VALIDATION_TYPE;
246
+ progressGroup: string;
247
+ reattemptId: number;
248
+ isSelfLoop: boolean;
249
+ };
250
+
251
+ export type ValidateOTPOutput = BaseETResponse & {
252
+ retryCount: number;
253
+ };
@@ -0,0 +1,298 @@
1
+ import { Platform, StyleSheet } from 'react-native';
2
+ import { Fonts } from '../../../styles/executionTasks/CommonStyles';
3
+ import { sHeight, sWidth } from '../../../components/utils/Scale';
4
+ const styles = StyleSheet.create({
5
+ bottomView: {
6
+ padding: 16,
7
+ gap: 16,
8
+ flexDirection: 'row-reverse',
9
+ justifyContent: 'space-evenly',
10
+ backgroundColor: 'white',
11
+ borderTopWidth: 1,
12
+ borderColor: '#DDE3F9',
13
+ },
14
+ otpTitle: {
15
+ marginTop: 10,
16
+ marginBottom: 20,
17
+ fontFamily:
18
+ Platform.OS === 'android'
19
+ ? Fonts.IBMPlexSans_400Regular
20
+ : 'IBMPlexSans-Regular',
21
+ fontStyle: 'normal',
22
+ fontSize: 16,
23
+ lineHeight: 20,
24
+ letterSpacing: 0.25,
25
+ color: '#3D445C',
26
+ alignItems: 'center',
27
+ },
28
+ retryButton: {
29
+ alignItems: 'flex-start',
30
+ marginVertical: 10,
31
+ },
32
+ subText: {
33
+ justifyContent: 'center',
34
+ fontFamily:
35
+ Platform.OS === 'android'
36
+ ? Fonts.IBMPlexSans_400Regular
37
+ : 'IBMPlexSans-Regular',
38
+ fontStyle: 'normal',
39
+ fontSize: 14,
40
+ letterSpacing: 0.25,
41
+ lineHeight: 20,
42
+ textAlign: 'center',
43
+ color: '#000000',
44
+ marginBottom: 10,
45
+ },
46
+ modalContent: {
47
+ marginStart: 60,
48
+ marginEnd: 60,
49
+ flex: 1,
50
+ marginBottom: 60,
51
+ },
52
+ modalView: {
53
+ backgroundColor: 'white',
54
+ padding: 15,
55
+ borderRadius: 9,
56
+ },
57
+ // new design
58
+ titleContainer: {
59
+ backgroundColor: '#ECF0FF',
60
+ padding: 16,
61
+ },
62
+ titleText: {
63
+ fontFamily:
64
+ Platform.OS === 'android'
65
+ ? Fonts.IBMPlexSans_400Regular
66
+ : 'IBMPlexSans-Regular',
67
+ fontWeight: '400',
68
+ fontSize: 16,
69
+ lineHeight: 28,
70
+ color: '#3D445C',
71
+ },
72
+ contactListContainer: {
73
+ marginTop: sHeight(24),
74
+ gap: 16,
75
+ marginHorizontal: sWidth(16),
76
+ flex: 1,
77
+ },
78
+ headingTitle: {
79
+ lineHeight: 24,
80
+ },
81
+ contactCard: {
82
+ paddingHorizontal: sWidth(16),
83
+ paddingVertical: sWidth(12),
84
+ gap: 8,
85
+ borderRadius: 8,
86
+ backgroundColor: '#fff',
87
+ borderWidth: 1,
88
+ borderColor: '#E0E7FF',
89
+ marginBottom: sHeight(16),
90
+ // Shadow styling for iOS
91
+ shadowColor: '#000',
92
+ shadowOffset: { width: 0, height: 2 },
93
+ shadowOpacity: 0.1,
94
+ shadowRadius: 6,
95
+
96
+ // Elevation for Android
97
+ elevation: 2,
98
+ },
99
+ selectedCard: {
100
+ borderWidth: 1,
101
+ borderColor: '#5B80F7',
102
+ },
103
+ columnContainer: {
104
+ display: 'flex',
105
+ flexDirection: 'column',
106
+ alignContent: 'center',
107
+ flex: 1,
108
+ },
109
+ rowContainer: {
110
+ display: 'flex',
111
+ flexDirection: 'row',
112
+ alignContent: 'center',
113
+ gap: 8,
114
+ flex: 1,
115
+ marginBottom: sHeight(4),
116
+ },
117
+ contactTitle: {
118
+ fontFamily:
119
+ Platform.OS === 'android'
120
+ ? Fonts.IBMPlexSans_500Medium
121
+ : 'IBMPlexSans-Regular',
122
+ fontWeight: '500',
123
+ fontSize: 14,
124
+ lineHeight: 20,
125
+ color: '#3D445C',
126
+ },
127
+ contactLabel: {
128
+ color: '#A3AAC2',
129
+ lineHeight: 20,
130
+ fontSize: 14,
131
+ },
132
+ contactText: {
133
+ lineHeight: 20,
134
+ fontSize: 14,
135
+ },
136
+ radioIcon: {
137
+ height: sHeight(17),
138
+ width: sWidth(17),
139
+ marginTop: sHeight(2),
140
+ },
141
+ contactList: {
142
+ paddingBottom: sHeight(100),
143
+ },
144
+ otpContainer: {
145
+ marginTop: 24,
146
+ marginHorizontal: 16,
147
+ padding: 16,
148
+ gap: 16,
149
+ borderRadius: 8,
150
+ borderWidth: 1,
151
+ borderColor: '#E0E7FF',
152
+ backgroundColor: '#FFF',
153
+ shadowColor: '#000',
154
+ shadowOffset: { width: 0, height: 3 },
155
+ shadowOpacity: 0.1,
156
+ shadowRadius: 6,
157
+ elevation: 3, // Required for shadow on Android
158
+ },
159
+ otpTextMsg: {
160
+ fontFamily:
161
+ Platform.OS === 'android'
162
+ ? Fonts.IBMPlexSans_500Medium
163
+ : 'IBMPlexSans-Regular',
164
+ fontWeight: '500',
165
+ fontSize: 16,
166
+ lineHeight: 24,
167
+ color: '#3D445C',
168
+ },
169
+ resendOtpMsg: {
170
+ fontFamily:
171
+ Platform.OS === 'android'
172
+ ? Fonts.IBMPlexSans_400Regular
173
+ : 'IBMPlexSans-Regular',
174
+ fontWeight: '400',
175
+ fontSize: 16,
176
+ lineHeight: 24,
177
+ color: '#A3AAC2',
178
+ },
179
+ resendOtpBtn: {
180
+ fontFamily:
181
+ Platform.OS === 'android'
182
+ ? Fonts.IBMPlexSans_500Medium
183
+ : 'IBMPlexSans-Regular',
184
+ fontWeight: '500',
185
+ fontSize: 16,
186
+ lineHeight: 24,
187
+ color: '#5B80F7',
188
+ },
189
+ errorMessage: {
190
+ color: '#DC2626',
191
+ fontFamily:
192
+ Platform.OS === 'android'
193
+ ? Fonts.IBMPlexSans_400Regular
194
+ : 'IBMPlexSans-Regular',
195
+ fontWeight: '400',
196
+ fontSize: 12,
197
+ lineHeight: 16,
198
+ },
199
+ maxLimitReachBox: {
200
+ display: 'flex',
201
+ flexDirection: 'row',
202
+ gap: 8,
203
+ justifyContent: 'flex-start',
204
+ alignItems: 'center',
205
+ marginTop: sHeight(4),
206
+ },
207
+ maxLimitReachText: {
208
+ color: '#3D445C',
209
+ fontFamily:
210
+ Platform.OS === 'android'
211
+ ? Fonts.IBMPlexSans_400Regular
212
+ : 'IBMPlexSans-Regular',
213
+ fontWeight: '400',
214
+ fontSize: 14,
215
+ marginTop: -2,
216
+ lineHeight: 20,
217
+ },
218
+ responseCard: {
219
+ paddingVertical: sHeight(40),
220
+ gap: 16,
221
+ alignContent: 'center',
222
+ alignItems: 'center',
223
+ justifyContent: 'center',
224
+ borderRadius: 16,
225
+ borderColor: '#DDE3F9',
226
+ borderWidth: 1,
227
+ backgroundColor: '#fff',
228
+ marginHorizontal: 33, // Keeps horizontal margins
229
+ },
230
+ loadingCard: {
231
+ paddingVertical: sHeight(32),
232
+ paddingHorizontal: sHeight(16),
233
+ gap: 16,
234
+ alignItems: 'center', // Center the GIF horizontally
235
+ justifyContent: 'center', // Center the GIF vertically
236
+ borderRadius: 16,
237
+ borderColor: '#DDE3F9',
238
+ borderWidth: 1,
239
+ backgroundColor: '#fff',
240
+ marginHorizontal: 33,
241
+ },
242
+ otpResponseText: {
243
+ color: '#3D445C',
244
+ fontFamily:
245
+ Platform.OS === 'android'
246
+ ? Fonts.IBMPlexSans_500Medium
247
+ : 'IBMPlexSans-Regular',
248
+ fontWeight: '500',
249
+ fontSize: 18,
250
+ lineHeight: 18,
251
+ },
252
+ loadingText: {
253
+ color: '#3D445C',
254
+ fontFamily:
255
+ Platform.OS === 'android'
256
+ ? Fonts.IBMPlexSans_400Regular
257
+ : 'IBMPlexSans-Regular',
258
+ fontWeight: '400',
259
+ fontSize: 16,
260
+ lineHeight: 18,
261
+ letterSpacing: 0.25,
262
+ },
263
+ mainBtnStyles: {
264
+ display: 'flex',
265
+ flexDirection: 'row',
266
+ justifyContent: 'center',
267
+ alignItems: 'center',
268
+ flex: 1,
269
+ borderRadius: 8,
270
+ width: '100%',
271
+ backgroundColor: 'white',
272
+ },
273
+ disableBtn: {
274
+ borderWidth: 1,
275
+ borderColor: '#F9F9FB',
276
+ },
277
+ cancelBtnText: {
278
+ fontSize: 14,
279
+ fontFamily:
280
+ Platform.OS === 'android'
281
+ ? Fonts.IBMPlexSans_600SemiBold
282
+ : 'IBMPlexSans-Regular',
283
+ textAlign: 'center',
284
+ fontWeight: '600',
285
+ },
286
+ activeBtnText: {
287
+ fontSize: 14,
288
+ fontFamily:
289
+ Platform.OS === 'android'
290
+ ? Fonts.IBMPlexSans_500Medium
291
+ : 'IBMPlexSans-Regular',
292
+ fontWeight: '500',
293
+ color: '#fff',
294
+ textAlign: 'center',
295
+ },
296
+ });
297
+
298
+ export default styles;
@@ -0,0 +1,109 @@
1
+ /* eslint-disable react-native/no-inline-styles */
2
+ /* eslint-disable @typescript-eslint/no-unused-vars */
3
+ import React, { FC, useEffect, useLayoutEffect } from 'react';
4
+ import { BackHandler, FlatList, Text, View } from 'react-native';
5
+ import { useFocusEffect } from '@react-navigation/native';
6
+ import Icon from 'react-native-vector-icons/MaterialIcons';
7
+
8
+ // Styles
9
+ import styles from '../ValidateOtpStyles';
10
+
11
+ // Types
12
+ import { ValidateOTPInput } from '../ValidateOTPSchema';
13
+
14
+ // Sub-components
15
+ import { ContactCard } from '../sub-components/ContactCard';
16
+
17
+ // Analytics
18
+ import { fireEventWithScreenName } from '../../../../analytics/sentry/SentryAnalyticsUtils';
19
+ import {
20
+ ScreenNameSdkConstants,
21
+ SentryEventNameSdkConstants,
22
+ SeverityLevelValue,
23
+ } from '../../../../analytics/sentry/SentrySdkConstants';
24
+
25
+ export const ContactListView: FC<ValidateOTPInput> = (props) => {
26
+ useEffect(() => {
27
+ props.setIsContactVisited(true);
28
+ }, [props]);
29
+ // Handle back-button click
30
+ useFocusEffect(
31
+ React.useCallback(() => {
32
+ BackHandler.addEventListener(
33
+ 'hardwareBackPress',
34
+ props.handleBackNavigation
35
+ );
36
+ return () =>
37
+ BackHandler.removeEventListener(
38
+ 'hardwareBackPress',
39
+ props.handleBackNavigation
40
+ );
41
+ // eslint-disable-next-line react-hooks/exhaustive-deps
42
+ }, [])
43
+ );
44
+
45
+ useLayoutEffect(() => {
46
+ props.navigation.setOptions({
47
+ title: props.title,
48
+ headerLeft: () => {
49
+ return (
50
+ <Icon
51
+ onPress={() => {
52
+ props.handleBackNavigation();
53
+ const cta = 'Arrow Back';
54
+ fireEventWithScreenName({
55
+ severityLevel: SeverityLevelValue.LOG,
56
+ eventName: SentryEventNameSdkConstants.BUTTON_CLICKED,
57
+ screenName: ScreenNameSdkConstants.VALIDATE_OTP_ET_SCREEN,
58
+ cta: cta,
59
+ });
60
+ }}
61
+ name="arrow-back"
62
+ color={'black'}
63
+ size={25}
64
+ style={{
65
+ paddingRight: 15,
66
+ paddingTop: 5,
67
+ }}
68
+ />
69
+ );
70
+ },
71
+ });
72
+ }, [props.navigation, props, props.title]);
73
+
74
+ // *render contact card
75
+ const renderItem = ({ item }: { item: any }) => {
76
+ return (
77
+ <ContactCard
78
+ handleSelectContact={props.handleSelectContact}
79
+ contactDetails={item}
80
+ />
81
+ );
82
+ };
83
+
84
+ return (
85
+ <View style={{ flex: 1 }}>
86
+ <View style={styles.titleContainer}>
87
+ <Text style={styles.titleText}>
88
+ {props?.generateMessage?.toString()?.length > 0
89
+ ? props.generateMessage
90
+ : 'Proceed to OTP verification? A verification code will be sent to the customer'}
91
+ </Text>
92
+ </View>
93
+ <View style={styles.contactListContainer}>
94
+ <Text style={[styles.titleText, styles.headingTitle]}>
95
+ Select the contact to receive the OTP
96
+ </Text>
97
+ <FlatList
98
+ style={styles.contactList}
99
+ data={props.contactList}
100
+ showsVerticalScrollIndicator={false}
101
+ automaticallyAdjustKeyboardInsets={true}
102
+ nestedScrollEnabled
103
+ keyExtractor={(item: any) => item.value.toString()}
104
+ renderItem={renderItem}
105
+ />
106
+ </View>
107
+ </View>
108
+ );
109
+ };