@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.
- package/android/build.gradle +38 -9
- package/android/gradle.properties +17 -2
- package/lib/commonjs/components/dispatch/DispatchExecNavigator.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/widgets/DateTimeWidget.js.map +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js +467 -287
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js +14 -1
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOtpStyles.js +270 -0
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOtpStyles.js.map +1 -0
- package/lib/commonjs/components/executiontasks/validateOTP/components/ContactListView.js +99 -0
- package/lib/commonjs/components/executiontasks/validateOTP/components/ContactListView.js.map +1 -0
- package/lib/commonjs/components/executiontasks/validateOTP/components/OTPView.js +195 -0
- package/lib/commonjs/components/executiontasks/validateOTP/components/OTPView.js.map +1 -0
- package/lib/commonjs/components/executiontasks/validateOTP/components/VerificationComplete.js +106 -0
- package/lib/commonjs/components/executiontasks/validateOTP/components/VerificationComplete.js.map +1 -0
- package/lib/commonjs/components/executiontasks/validateOTP/constants.js +12 -5
- package/lib/commonjs/components/executiontasks/validateOTP/constants.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/sub-components/ContactCard.js +68 -0
- package/lib/commonjs/components/executiontasks/validateOTP/sub-components/ContactCard.js.map +1 -0
- package/lib/commonjs/components/executiontasks/validateOTP/sub-components/OTPInput.js +12 -5
- package/lib/commonjs/components/executiontasks/validateOTP/sub-components/OTPInput.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/sub-components/ResendOTPButton.js +61 -0
- package/lib/commonjs/components/executiontasks/validateOTP/sub-components/ResendOTPButton.js.map +1 -0
- package/lib/commonjs/components/executiontasks/validateOTP/utils.js +235 -114
- package/lib/commonjs/components/executiontasks/validateOTP/utils.js.map +1 -1
- package/lib/commonjs/components/utils/Scale.js +22 -0
- package/lib/commonjs/components/utils/Scale.js.map +1 -0
- package/lib/commonjs/components/widgets/ConfirmCancelModal.js +47 -0
- package/lib/commonjs/components/widgets/ConfirmCancelModal.js.map +1 -0
- package/lib/commonjs/components/widgets/SnackBarCustom.js +36 -4
- package/lib/commonjs/components/widgets/SnackBarCustom.js.map +1 -1
- package/lib/commonjs/components/widgets/SplitTextInput.js +48 -18
- package/lib/commonjs/components/widgets/SplitTextInput.js.map +1 -1
- package/lib/commonjs/constants/apiConstants.js +4 -1
- package/lib/commonjs/constants/apiConstants.js.map +1 -1
- package/lib/commonjs/constants/constants.js +2 -1
- package/lib/commonjs/constants/constants.js.map +1 -1
- package/lib/commonjs/icons/icExclamationcircleo_dark.svg +3 -0
- package/lib/commonjs/icons/icFailed.gif +0 -0
- package/lib/commonjs/icons/icRadioChecked.svg +4 -0
- package/lib/commonjs/icons/icRadioUnchecked.svg +4 -0
- package/lib/commonjs/icons/icSuccess.gif +0 -0
- package/lib/commonjs/icons/index.js +28 -0
- package/lib/commonjs/icons/index.js.map +1 -0
- package/lib/commonjs/index.js +19 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/manager/sdk/DispatchSDKManager.js +5 -4
- package/lib/commonjs/manager/sdk/DispatchSDKManager.js.map +1 -1
- package/lib/commonjs/manager/sdk/callbacksHandler.js +9 -2
- package/lib/commonjs/manager/sdk/callbacksHandler.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/constants.js +3 -1
- package/lib/commonjs/manager/syncmanager/constants.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js +3 -2
- package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js +70 -80
- package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
- package/lib/commonjs/models/sdk.js +1 -0
- package/lib/commonjs/models/sdk.js.map +1 -1
- package/lib/commonjs/ui/screens/ValidateOTPScreen.js +132 -12
- package/lib/commonjs/ui/screens/ValidateOTPScreen.js.map +1 -1
- package/lib/commonjs/utils/ApiUtils.js +122 -3
- package/lib/commonjs/utils/ApiUtils.js.map +1 -1
- package/lib/commonjs/utils/ExecTaskUtils.js +67 -7
- package/lib/commonjs/utils/ExecTaskUtils.js.map +1 -1
- package/lib/commonjs/utils/context/valdiateOTPContext.js +11 -0
- package/lib/commonjs/utils/context/valdiateOTPContext.js.map +1 -0
- package/lib/commonjs/utils/helper.js.map +1 -1
- package/lib/commonjs/utils/hooks/useTimer.js +68 -30
- package/lib/commonjs/utils/hooks/useTimer.js.map +1 -1
- package/lib/module/components/dispatch/DispatchExecNavigator.js.map +1 -1
- package/lib/module/components/executiontasks/forms/widgets/DateTimeWidget.js.map +1 -1
- package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js +1 -1
- package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js +480 -290
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPSchema.js +14 -0
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/ValidateOtpStyles.js +264 -0
- package/lib/module/components/executiontasks/validateOTP/ValidateOtpStyles.js.map +1 -0
- package/lib/module/components/executiontasks/validateOTP/components/ContactListView.js +88 -0
- package/lib/module/components/executiontasks/validateOTP/components/ContactListView.js.map +1 -0
- package/lib/module/components/executiontasks/validateOTP/components/OTPView.js +194 -0
- package/lib/module/components/executiontasks/validateOTP/components/OTPView.js.map +1 -0
- package/lib/module/components/executiontasks/validateOTP/components/VerificationComplete.js +96 -0
- package/lib/module/components/executiontasks/validateOTP/components/VerificationComplete.js.map +1 -0
- package/lib/module/components/executiontasks/validateOTP/constants.js +11 -4
- package/lib/module/components/executiontasks/validateOTP/constants.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/sub-components/ContactCard.js +59 -0
- package/lib/module/components/executiontasks/validateOTP/sub-components/ContactCard.js.map +1 -0
- package/lib/module/components/executiontasks/validateOTP/sub-components/OTPInput.js +11 -5
- package/lib/module/components/executiontasks/validateOTP/sub-components/OTPInput.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/sub-components/ResendOTPButton.js +52 -0
- package/lib/module/components/executiontasks/validateOTP/sub-components/ResendOTPButton.js.map +1 -0
- package/lib/module/components/executiontasks/validateOTP/utils.js +219 -108
- package/lib/module/components/executiontasks/validateOTP/utils.js.map +1 -1
- package/lib/module/components/utils/Scale.js +14 -0
- package/lib/module/components/utils/Scale.js.map +1 -0
- package/lib/module/components/widgets/ConfirmCancelModal.js +40 -0
- package/lib/module/components/widgets/ConfirmCancelModal.js.map +1 -0
- package/lib/module/components/widgets/SnackBarCustom.js +36 -4
- package/lib/module/components/widgets/SnackBarCustom.js.map +1 -1
- package/lib/module/components/widgets/SplitTextInput.js +48 -19
- package/lib/module/components/widgets/SplitTextInput.js.map +1 -1
- package/lib/module/constants/apiConstants.js +4 -1
- package/lib/module/constants/apiConstants.js.map +1 -1
- package/lib/module/constants/constants.js +1 -0
- package/lib/module/constants/constants.js.map +1 -1
- package/lib/module/icons/icExclamationcircleo_dark.svg +3 -0
- package/lib/module/icons/icFailed.gif +0 -0
- package/lib/module/icons/icRadioChecked.svg +4 -0
- package/lib/module/icons/icRadioUnchecked.svg +4 -0
- package/lib/module/icons/icSuccess.gif +0 -0
- package/lib/module/icons/index.js +5 -0
- package/lib/module/icons/index.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/manager/sdk/DispatchSDKManager.js +5 -3
- package/lib/module/manager/sdk/DispatchSDKManager.js.map +1 -1
- package/lib/module/manager/sdk/callbacksHandler.js +12 -3
- package/lib/module/manager/sdk/callbacksHandler.js.map +1 -1
- package/lib/module/manager/syncmanager/constants.js +2 -0
- package/lib/module/manager/syncmanager/constants.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentHttpClient.js +3 -2
- package/lib/module/manager/syncmanager/document/DocumentHttpClient.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentSyncManager.js +70 -80
- package/lib/module/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
- package/lib/module/models/sdk.js +2 -0
- package/lib/module/models/sdk.js.map +1 -1
- package/lib/module/ui/screens/ValidateOTPScreen.js +139 -11
- package/lib/module/ui/screens/ValidateOTPScreen.js.map +1 -1
- package/lib/module/utils/ApiUtils.js +118 -2
- package/lib/module/utils/ApiUtils.js.map +1 -1
- package/lib/module/utils/ExecTaskUtils.js +66 -7
- package/lib/module/utils/ExecTaskUtils.js.map +1 -1
- package/lib/module/utils/context/valdiateOTPContext.js +4 -0
- package/lib/module/utils/context/valdiateOTPContext.js.map +1 -0
- package/lib/module/utils/helper.js +1 -0
- package/lib/module/utils/helper.js.map +1 -1
- package/lib/module/utils/hooks/useTimer.js +67 -30
- package/lib/module/utils/hooks/useTimer.js.map +1 -1
- package/lib/typescript/components/executiontasks/collectPayment/PaymentStyles.d.ts +3 -3
- package/lib/typescript/components/executiontasks/deliver/DeliverETInput.d.ts +0 -1
- package/lib/typescript/components/executiontasks/scan/modalConstant.d.ts +0 -1
- package/lib/typescript/components/executiontasks/validateOTP/ValidateOTPET.d.ts +3 -3
- package/lib/typescript/components/executiontasks/validateOTP/ValidateOTPSchema.d.ts +169 -5
- package/lib/typescript/components/executiontasks/validateOTP/ValidateOtpStyles.d.ts +255 -0
- package/lib/typescript/components/executiontasks/validateOTP/components/ContactListView.d.ts +3 -0
- package/lib/typescript/components/executiontasks/validateOTP/components/OTPView.d.ts +3 -0
- package/lib/typescript/components/executiontasks/validateOTP/components/VerificationComplete.d.ts +3 -0
- package/lib/typescript/components/executiontasks/validateOTP/constants.d.ts +11 -4
- package/lib/typescript/components/executiontasks/validateOTP/sub-components/ContactCard.d.ts +8 -0
- package/lib/typescript/components/executiontasks/validateOTP/sub-components/ResendOTPButton.d.ts +12 -0
- package/lib/typescript/components/executiontasks/validateOTP/utils.d.ts +31 -7
- package/lib/typescript/components/utils/Scale.d.ts +4 -0
- package/lib/typescript/components/widgets/ConfirmCancelModal.d.ts +9 -0
- package/lib/typescript/components/widgets/SnackBarCustom.d.ts +4 -8
- package/lib/typescript/components/widgets/SplitTextInput.d.ts +1 -1
- package/lib/typescript/components/widgets/Timer.d.ts +3 -3
- package/lib/typescript/constants/apiConstants.d.ts +3 -0
- package/lib/typescript/constants/constants.d.ts +1 -0
- package/lib/typescript/icons/index.d.ts +4 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/manager/sdk/callbacksHandler.d.ts +4 -1
- package/lib/typescript/manager/syncmanager/constants.d.ts +2 -0
- package/lib/typescript/models/execTasks/ETConfig.d.ts +1 -1
- package/lib/typescript/models/sdk.d.ts +3 -0
- package/lib/typescript/network/GraphQLClient.d.ts +4 -4
- package/lib/typescript/styles/executionTasks/CommonStyles.d.ts +2 -2
- package/lib/typescript/ui/screens/HttpRequestScreen.d.ts +0 -1
- package/lib/typescript/utils/ApiUtils.d.ts +6 -2
- package/lib/typescript/utils/ExecTaskUtils.d.ts +1 -0
- package/lib/typescript/utils/context/paymentContext.d.ts +0 -1
- package/lib/typescript/utils/context/valdiateOTPContext.d.ts +6 -0
- package/lib/typescript/utils/hooks/useModal.d.ts +0 -2
- package/lib/typescript/utils/hooks/useTimer.d.ts +7 -5
- package/package.json +46 -44
- package/src/components/dispatch/DispatchExecNavigator.tsx +1 -1
- package/src/components/executiontasks/forms/widgets/DateTimeWidget.tsx +2 -2
- package/src/components/executiontasks/imageCapture/CaptureUtils.ts +1 -1
- package/src/components/executiontasks/validateOTP/ValidateOTPET.tsx +654 -381
- package/src/components/executiontasks/validateOTP/ValidateOTPSchema.ts +193 -8
- package/src/components/executiontasks/validateOTP/ValidateOtpStyles.ts +296 -0
- package/src/components/executiontasks/validateOTP/components/ContactListView.tsx +109 -0
- package/src/components/executiontasks/validateOTP/components/OTPView.tsx +216 -0
- package/src/components/executiontasks/validateOTP/components/VerificationComplete.tsx +124 -0
- package/src/components/executiontasks/validateOTP/constants.ts +11 -4
- package/src/components/executiontasks/validateOTP/sub-components/ContactCard.tsx +72 -0
- package/src/components/executiontasks/validateOTP/sub-components/OTPInput.tsx +13 -7
- package/src/components/executiontasks/validateOTP/sub-components/ResendOTPButton.tsx +86 -0
- package/src/components/executiontasks/validateOTP/utils.ts +313 -143
- package/src/components/utils/Scale.ts +13 -0
- package/src/components/widgets/ConfirmCancelModal.tsx +49 -0
- package/src/components/widgets/SnackBarCustom.tsx +37 -13
- package/src/components/widgets/SplitTextInput.tsx +58 -21
- package/src/constants/apiConstants.ts +3 -0
- package/src/constants/constants.ts +2 -2
- package/src/icons/icExclamationcircleo_dark.svg +3 -0
- package/src/icons/icFailed.gif +0 -0
- package/src/icons/icRadioChecked.svg +4 -0
- package/src/icons/icRadioUnchecked.svg +4 -0
- package/src/icons/icSuccess.gif +0 -0
- package/src/icons/index.ts +5 -0
- package/src/index.tsx +2 -0
- package/src/manager/sdk/DispatchSDKManager.ts +6 -5
- package/src/manager/sdk/callbacksHandler.ts +29 -12
- package/src/manager/syncmanager/constants.ts +2 -0
- package/src/manager/syncmanager/document/DocumentHttpClient.ts +29 -29
- package/src/manager/syncmanager/document/DocumentSyncManager.ts +75 -84
- package/src/models/sdk.ts +6 -0
- package/src/ui/screens/ValidateOTPScreen.tsx +194 -32
- package/src/utils/ApiUtils.ts +131 -3
- package/src/utils/ExecTaskUtils.ts +77 -15
- package/src/utils/context/valdiateOTPContext.ts +9 -0
- package/src/utils/helper.ts +0 -1
- 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
|
-
|
|
10
|
-
|
|
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 =
|
|
36
|
-
fireEventWithScreenName({
|
|
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
|
-
:
|
|
59
|
-
?
|
|
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: '
|
|
120
|
+
justifyContent: 'flex-start',
|
|
121
|
+
gap: 16,
|
|
122
|
+
flexWrap: 'wrap',
|
|
94
123
|
},
|
|
95
124
|
splitBoxes: {
|
|
96
|
-
borderColor: '#
|
|
97
|
-
borderWidth:
|
|
98
|
-
borderRadius:
|
|
99
|
-
padding:
|
|
100
|
-
|
|
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: '#
|
|
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:
|
|
118
|
-
width:
|
|
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
|
|
Binary file
|
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
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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>,
|
|
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 =
|
|
49
|
-
if(token && token.length != 0){
|
|
65
|
+
let token = await this._callbackRefreshToken();
|
|
66
|
+
if (token && token.length != 0) {
|
|
50
67
|
let sdkConfig =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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',
|