@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.
- 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 +272 -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 +266 -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 +257 -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 +298 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_ValidateOtpStyles","_icons","_utils","_Scale","_ExecTaskUtils","e","__esModule","default","ContactCard","props","handleSelectContact","contactDetails","createElement","TouchableOpacity","activeOpacity","style","styles","contactCard","isSelected","selectedCard","onPress","View","rowContainer","RadioCheckedIcon","radioIcon","RadioUncheckedIcon","columnContainer","marginBottom","Text","contactTitle","padding","margin","value","maskContact","isNotNullOrEmpty","orderId","titleText","contactLabel","contactText","truncateOrderId","orderFrom","marginTop","sHeight","exports"],"sources":["ContactCard.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React from 'react';\nimport { Text, TouchableOpacity, View } from 'react-native';\n\n// Styles\nimport styles from '../ValidateOtpStyles';\n\n// Types\nimport { ContactTypes } from '../ValidateOTPSchema';\n\n// Icons\nimport { RadioCheckedIcon, RadioUncheckedIcon } from '../../../../icons';\n\n// Utilities\nimport { isNotNullOrEmpty, truncateOrderId } from '../utils';\nimport { sHeight } from '../../../../components/utils/Scale';\nimport { maskContact } from '../../../../utils/ExecTaskUtils';\n\ninterface ContactCardPropType {\n handleSelectContact: (contactDetails: ContactTypes) => void;\n contactDetails: ContactTypes;\n}\nexport const ContactCard = (props: ContactCardPropType) => {\n const { handleSelectContact, contactDetails } = props;\n return (\n <TouchableOpacity\n activeOpacity={0.75}\n style={[\n styles.contactCard,\n contactDetails?.isSelected && styles.selectedCard,\n ]}\n onPress={() => handleSelectContact(contactDetails)}\n >\n <View style={[styles.rowContainer]}>\n {contactDetails?.isSelected ? (\n <RadioCheckedIcon style={[styles.radioIcon]} />\n ) : (\n <RadioUncheckedIcon style={[styles.radioIcon]} />\n )}\n <View style={styles.columnContainer}>\n {/* Contact */}\n <View style={[styles.rowContainer, { marginBottom: 8 }]}>\n <Text style={[styles.contactTitle, { padding: 0, margin: 0 }]}>\n {contactDetails?.value && maskContact(contactDetails?.value)}\n </Text>\n </View>\n {isNotNullOrEmpty(contactDetails?.orderId) && (\n <View style={styles.rowContainer}>\n <Text style={[styles.titleText, styles.contactLabel]}>\n Order ID\n </Text>\n <Text style={[styles.titleText, styles.contactText]}>\n {contactDetails?.orderId &&\n truncateOrderId(contactDetails?.orderId)}\n </Text>\n </View>\n )}\n {isNotNullOrEmpty(contactDetails?.orderFrom) && (\n <View style={[styles.rowContainer, { marginTop: sHeight(4) }]}>\n <Text style={[styles.titleText, styles.contactLabel]}>\n Order From\n </Text>\n <Text style={[styles.titleText, styles.contactText]}>\n {contactDetails?.orderFrom}\n </Text>\n </View>\n )}\n </View>\n </View>\n </TouchableOpacity>\n );\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAMA,IAAAG,MAAA,GAAAH,OAAA;AAGA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAA8D,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAhB9D;;AAIA;;AAGA;;AAGA;;AAGA;;AASO,MAAMG,WAAW,GAAIC,KAA0B,IAAK;EACzD,MAAM;IAAEC,mBAAmB;IAAEC;EAAe,CAAC,GAAGF,KAAK;EACrD,oBACEb,MAAA,CAAAW,OAAA,CAAAK,aAAA,CAACb,YAAA,CAAAc,gBAAgB;IACfC,aAAa,EAAE,IAAK;IACpBC,KAAK,EAAE,CACLC,0BAAM,CAACC,WAAW,EAClB,CAAAN,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEO,UAAU,KAAIF,0BAAM,CAACG,YAAY,C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A,WAAA","ignoreList":[]}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
9
|
var _SplitTextInput = _interopRequireDefault(require("../../../widgets/SplitTextInput"));
|
|
10
10
|
var _CommonStyles = require("../../../../styles/executionTasks/CommonStyles");
|
|
11
11
|
var _ValidateOTPSchema = require("../ValidateOTPSchema");
|
|
@@ -13,9 +13,14 @@ var _constants = require("../constants");
|
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
17
|
+
// External imports
|
|
18
|
+
|
|
19
|
+
// Internal imports
|
|
20
|
+
|
|
16
21
|
const OTPInput = props => {
|
|
17
|
-
const maximumCodeLength = props.input.length;
|
|
18
|
-
const keyboardType = props.input.inputType === _ValidateOTPSchema.InputType.NUMBER ? 'number-pad' : 'default';
|
|
22
|
+
const maximumCodeLength = props.input.length || 6;
|
|
23
|
+
const keyboardType = props.input.inputType === _ValidateOTPSchema.InputType.NUMBER || _ValidateOTPSchema.InputType.NUMERIC ? 'number-pad' : 'default';
|
|
19
24
|
(0, _react.useEffect)(() => {
|
|
20
25
|
if (props.input.validationRegex && props.otpCode.length === maximumCodeLength) {
|
|
21
26
|
const regex = new RegExp(props.input.validationRegex);
|
|
@@ -23,7 +28,7 @@ const OTPInput = props => {
|
|
|
23
28
|
props.setHasError(hasError);
|
|
24
29
|
if (hasError) props.setErrorMessage(_constants.INVALID_REGEX);else props.setErrorMessage('');
|
|
25
30
|
}
|
|
26
|
-
}, [props.otpCode]);
|
|
31
|
+
}, [maximumCodeLength, props, props.otpCode]);
|
|
27
32
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
28
33
|
onPress: _reactNative.Keyboard.dismiss
|
|
29
34
|
}, /*#__PURE__*/_react.default.createElement(_SplitTextInput.default, {
|
|
@@ -47,7 +52,9 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
47
52
|
text: {
|
|
48
53
|
fontFamily: _reactNative.Platform.OS === 'android' ? _CommonStyles.Fonts.IBMPlexSans_400Regular : 'IBMPlexSans-Regular',
|
|
49
54
|
color: '#3D445C',
|
|
50
|
-
fontSize:
|
|
55
|
+
fontSize: 16,
|
|
56
|
+
lineHeight: 24,
|
|
57
|
+
fontWeight: '400',
|
|
51
58
|
textAlign: 'center'
|
|
52
59
|
},
|
|
53
60
|
errorMessage: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_SplitTextInput","_interopRequireDefault","_CommonStyles","_ValidateOTPSchema","_constants","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","OTPInput","props","maximumCodeLength","input","length","keyboardType","inputType","InputType","NUMBER","NUMERIC","useEffect","validationRegex","otpCode","regex","RegExp","hasError","test","setHasError","setErrorMessage","INVALID_REGEX","createElement","Fragment","Pressable","onPress","Keyboard","dismiss","styles","text","value","onChange","setOTPCode","maxLength","_default","exports","StyleSheet","create","fontFamily","Platform","OS","Fonts","IBMPlexSans_400Regular","color","fontSize","lineHeight","fontWeight","textAlign","errorMessage","marginTop","marginHorizontal"],"sources":["OTPInput.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n// External imports\nimport React, { useEffect } from 'react';\nimport { StyleSheet, Pressable, Keyboard, Platform } from 'react-native';\n\n// Internal imports\nimport SplitTextInput from '../../../widgets/SplitTextInput';\nimport { Fonts } from '../../../../styles/executionTasks/CommonStyles';\nimport { InputType, CaptureInput } from '../ValidateOTPSchema';\nimport { INVALID_REGEX } from '../constants';\n\nexport interface OTPInputProps {\n input: CaptureInput;\n otpCode: string;\n setOTPCode: (otpCode: string) => void;\n hasError: boolean;\n setHasError: (hasError: boolean) => void;\n setErrorMessage: (errorMessage: string) => void;\n}\n\nconst OTPInput = (props: OTPInputProps) => {\n const maximumCodeLength = props.input.length || 6;\n const keyboardType =\n props.input.inputType === InputType.NUMBER || InputType.NUMERIC\n ? 'number-pad'\n : 'default';\n\n useEffect(() => {\n if (\n props.input.validationRegex &&\n props.otpCode.length === maximumCodeLength\n ) {\n const regex = new RegExp(props.input.validationRegex);\n const hasError = !regex.test(props.otpCode);\n\n props.setHasError(hasError);\n if (hasError) props.setErrorMessage(INVALID_REGEX);\n else props.setErrorMessage('');\n }\n }, [maximumCodeLength, props, props.otpCode]);\n\n return (\n <>\n <Pressable onPress={Keyboard.dismiss}>\n <SplitTextInput\n styles={styles.text}\n value={props.otpCode}\n onChange={(text) => {\n if (props.input.validationRegex) {\n }\n if (props.hasError) {\n props.setErrorMessage('');\n props.setHasError(false);\n }\n props.setOTPCode(text);\n }}\n maxLength={maximumCodeLength}\n keyboardType={keyboardType}\n hasError={props.hasError}\n />\n </Pressable>\n </>\n );\n};\n\nexport default OTPInput;\n\nconst styles = StyleSheet.create({\n text: {\n fontFamily:\n Platform.OS === 'android'\n ? Fonts.IBMPlexSans_400Regular\n : 'IBMPlexSans-Regular',\n color: '#3D445C',\n fontSize: 16,\n lineHeight: 24,\n fontWeight: '400',\n textAlign: 'center',\n },\n errorMessage: {\n marginTop: 16,\n marginHorizontal: 10,\n color: '#DC2626',\n fontFamily:\n Platform.OS === 'android'\n ? Fonts.IBMPlexSans_400Regular\n : 'IBMPlexSans-Regular',\n fontSize: 12,\n lineHeight: 16,\n },\n});\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAA6C,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAA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b,CAAC;EACDC,YAAY,EAAE;IACZC,SAAS,EAAE,EAAE;IACbC,gBAAgB,EAAE,EAAE;IACpBP,KAAK,EAAE,SAAS;IAChBL,UAAU,EACRC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACrBC,mBAAK,CAACC,sBAAsB,GAC5B,qBAAqB;IAC3BE,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ResendOTPButton = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _ValidateOtpStyles = _interopRequireDefault(require("../ValidateOtpStyles"));
|
|
10
|
+
var _icons = require("../../../../icons");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
/* eslint-disable react-native/no-inline-styles */
|
|
13
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
14
|
+
|
|
15
|
+
// Styles
|
|
16
|
+
|
|
17
|
+
// Types
|
|
18
|
+
|
|
19
|
+
// Icons
|
|
20
|
+
|
|
21
|
+
const ResendOTPButton = props => {
|
|
22
|
+
var _props$resendOTP;
|
|
23
|
+
const {
|
|
24
|
+
timer,
|
|
25
|
+
resendConfig,
|
|
26
|
+
formattedTime,
|
|
27
|
+
handleResendOtp,
|
|
28
|
+
resendCount
|
|
29
|
+
} = props;
|
|
30
|
+
const enableRetry = props === null || props === void 0 || (_props$resendOTP = props.resendOTP) === null || _props$resendOTP === void 0 ? void 0 : _props$resendOTP.enableResends;
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.View, null, resendCount >= resendConfig.maxResends ? /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
32
|
+
disabled: true,
|
|
33
|
+
onPress: handleResendOtp
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
35
|
+
style: [_ValidateOtpStyles.default.resendOtpMsg, _ValidateOtpStyles.default.resendOtpBtn, {
|
|
36
|
+
color: '#E0E3EB'
|
|
37
|
+
}]
|
|
38
|
+
}, resendConfig.buttonTitle)), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
39
|
+
style: _ValidateOtpStyles.default.maxLimitReachBox
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.InfoExclamatoryDarkIcon, {
|
|
41
|
+
height: 22,
|
|
42
|
+
width: 22,
|
|
43
|
+
style: {
|
|
44
|
+
padding: 4
|
|
45
|
+
},
|
|
46
|
+
fill: '#525B7A'
|
|
47
|
+
}), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
48
|
+
style: _ValidateOtpStyles.default.maxLimitReachText
|
|
49
|
+
}, "Maximum resend limit reached."))) : Number(timer) !== 0 ? /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
50
|
+
style: _ValidateOtpStyles.default.resendOtpMsg
|
|
51
|
+
}, `${resendConfig.buttonTitle} ${timer ? `in ${formattedTime}` : ''}`) : /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
52
|
+
disabled: Boolean(timer) || resendCount >= resendConfig.maxResends || !enableRetry,
|
|
53
|
+
onPress: handleResendOtp
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
55
|
+
style: [_ValidateOtpStyles.default.resendOtpMsg, _ValidateOtpStyles.default.resendOtpBtn, !enableRetry && {
|
|
56
|
+
color: '#E0E3EB'
|
|
57
|
+
}]
|
|
58
|
+
}, resendConfig.buttonTitle)));
|
|
59
|
+
};
|
|
60
|
+
exports.ResendOTPButton = ResendOTPButton;
|
|
61
|
+
//# sourceMappingURL=ResendOTPButton.js.map
|
package/lib/commonjs/components/executiontasks/validateOTP/sub-components/ResendOTPButton.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_ValidateOtpStyles","_icons","e","__esModule","default","ResendOTPButton","props","_props$resendOTP","timer","resendConfig","formattedTime","handleResendOtp","resendCount","enableRetry","resendOTP","enableResends","createElement","View","maxResends","TouchableOpacity","disabled","onPress","Text","style","styles","resendOtpMsg","resendOtpBtn","color","buttonTitle","maxLimitReachBox","InfoExclamatoryDarkIcon","height","width","padding","fill","maxLimitReachText","Number","Boolean","exports"],"sources":["ResendOTPButton.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React from 'react';\nimport { Text, TouchableOpacity, View } from 'react-native';\n\n// Styles\nimport styles from '../ValidateOtpStyles';\n\n// Types\nimport { ResendOTPConfigType } from '../ValidateOTPSchema';\n\n// Icons\nimport { InfoExclamatoryDarkIcon } from '../../../../icons';\n\ninterface ResendOTPButtonPropType {\n timer: number;\n resendConfig: ResendOTPConfigType;\n resendCount: number;\n formattedTime: string;\n handleResendOtp: () => void;\n resendOTP?: any;\n}\n\nexport const ResendOTPButton = (props: ResendOTPButtonPropType) => {\n const { timer, resendConfig, formattedTime, handleResendOtp, resendCount } =\n props;\n const enableRetry = props?.resendOTP?.enableResends;\n return (\n <View>\n {resendCount >= resendConfig.maxResends ? (\n <View>\n <TouchableOpacity disabled onPress={handleResendOtp}>\n <Text\n style={[\n styles.resendOtpMsg,\n styles.resendOtpBtn,\n {\n color: '#E0E3EB',\n },\n ]}\n >\n {resendConfig.buttonTitle}\n </Text>\n </TouchableOpacity>\n\n <View style={styles.maxLimitReachBox}>\n <InfoExclamatoryDarkIcon\n height={22}\n width={22}\n style={{ padding: 4 }}\n fill={'#525B7A'}\n />\n <Text style={styles.maxLimitReachText}>\n Maximum resend limit reached.\n </Text>\n </View>\n </View>\n ) : Number(timer) !== 0 ? (\n <Text style={styles.resendOtpMsg}>\n {`${resendConfig.buttonTitle} ${timer ? `in ${formattedTime}` : ''}`}\n </Text>\n ) : (\n <TouchableOpacity\n disabled={\n Boolean(timer) ||\n resendCount >= resendConfig.maxResends ||\n !enableRetry\n }\n onPress={handleResendOtp}\n >\n <Text\n style={[\n styles.resendOtpMsg,\n styles.resendOtpBtn,\n !enableRetry && {\n color: '#E0E3EB',\n },\n ]}\n >\n {resendConfig.buttonTitle}\n </Text>\n </TouchableOpacity>\n )}\n </View>\n );\n};\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAMA,IAAAG,MAAA,GAAAH,OAAA;AAA4D,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAZ5D;AACA;;AAIA;;AAGA;;AAGA;;AAYO,MAAMG,eAAe,GAAIC,KAA8B,IAAK;EAAA,IAAAC,gBAAA;EACjE,MAAM;IAAEC,KAAK;IAAEC,YAAY;IAAEC,aAAa;IAAEC,eAAe;IAAEC;EAAY,CAAC,GACxEN,KAAK;EACP,MAAMO,WAAW,GAAGP,KAAK,aAALA,KAAK,gBAAAC,gBAAA,GAALD,KAAK,CAAEQ,SAAS,cAAAP,gBAAA,uBAAhBA,gBAAA,CAAkBQ,aAAa;EACnD,oBACEnB,MAAA,CAAAQ,OAAA,CAAAY,aAAA,CAACjB,YAAA,CAAAkB,IAAI,QACFL,WAAW,IAAIH,YAAY,CAACS,UAAU,gBACrCtB,MAAA,CAAAQ,OAAA,CAAAY,aAAA,CAACjB,YAAA,CAAAkB,IAAI,qBACHrB,MAAA,CAAAQ,OAAA,CAAAY,aAAA,CAACjB,YAAA,CAAAoB,gBAAgB;IAACC,QAAQ;IAACC,OAA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,CACLC,0BAAM,CAACC,YAAY,EACnBD,0BAAM,CAACE,YAAY,EACnB,CAACb,WAAW,IAAI;MACdc,KAAK,EAAE;IACT,CAAC;EACD,GAEDlB,YAAY,CAACmB,WACV,CACU,CAEhB,CAAC;AAEX,CAAC;AAACU,OAAA,CAAAjC,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -3,145 +3,266 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
6
|
+
exports.countType = exports.VALIDATE_OTP_SCREENS = exports.OTP_CONFIG = void 0;
|
|
7
|
+
exports.generateContactList = generateContactList;
|
|
8
|
+
exports.isNotNullOrEmpty = exports.getUniqueRefId = exports.getCount = exports.generateOTP = void 0;
|
|
9
|
+
exports.maskContactId = maskContactId;
|
|
10
|
+
exports.verifyOTP = exports.updateRetryCount = exports.updateResendCount = exports.truncateOrderId = exports.resetCount = exports.resendOTP = exports.parseResendConfig = void 0;
|
|
10
11
|
var jsonLogic = _interopRequireWildcard(require("json-logic-js"));
|
|
11
|
-
var _jsonpathPlus = require("jsonpath-plus");
|
|
12
12
|
var _Logger = _interopRequireWildcard(require("../../../utils/Logger"));
|
|
13
13
|
var _ApiUtils = require("../../../utils/ApiUtils");
|
|
14
14
|
var _constants = require("./constants");
|
|
15
|
+
var _storage = _interopRequireDefault(require("../../../utils/storage"));
|
|
16
|
+
var _constants2 = require("../../../manager/syncmanager/constants");
|
|
17
|
+
var _apiConstants = require("../../../constants/apiConstants");
|
|
18
|
+
var _uuidByString = _interopRequireDefault(require("uuid-by-string"));
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
23
|
+
let OTP_CONFIG = exports.OTP_CONFIG = /*#__PURE__*/function (OTP_CONFIG) {
|
|
24
|
+
OTP_CONFIG["OS1"] = "OTP_CONFIG";
|
|
25
|
+
OTP_CONFIG["CUSTOM"] = "Custom";
|
|
26
|
+
return OTP_CONFIG;
|
|
27
|
+
}({});
|
|
28
|
+
let countType = exports.countType = /*#__PURE__*/function (countType) {
|
|
29
|
+
countType[countType["RETRY"] = 0] = "RETRY";
|
|
30
|
+
countType[countType["RESEND"] = 1] = "RESEND";
|
|
31
|
+
return countType;
|
|
32
|
+
}({});
|
|
33
|
+
const VALIDATE_OTP_SCREENS = exports.VALIDATE_OTP_SCREENS = {
|
|
34
|
+
CONTACT_LIST: 'CONTACT_LIST',
|
|
35
|
+
OTP_VIEW: 'OTP_VIEW',
|
|
36
|
+
VERIFICATION_COMPLETE: 'VERIFICATION_COMPLETE'
|
|
19
37
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
value.forEach(val => {
|
|
29
|
-
requestBody[key] = parseBody(val, userInput);
|
|
30
|
-
});
|
|
31
|
-
} else {
|
|
32
|
-
if (typeof value === 'string' && isDyanmicValue(value) && value.includes('userInput')) {
|
|
33
|
-
if (value.includes('captureInput')) requestBody[key] = userInput.captureInput;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
38
|
+
const generateOTP = async (payload, props) => {
|
|
39
|
+
try {
|
|
40
|
+
var _props$otpGeneration;
|
|
41
|
+
const isCustomConfig = props.otpConfig === OTP_CONFIG.CUSTOM;
|
|
42
|
+
const apiData = (0, _ApiUtils.createApiData)(payload, props, isCustomConfig ? props === null || props === void 0 || (_props$otpGeneration = props.otpGeneration) === null || _props$otpGeneration === void 0 ? void 0 : _props$otpGeneration.uri : `{baseURI}${_apiConstants.ENDPOINTS.GENERATE_OTP_ENDPOINT}`, 'POST', null, isCustomConfig ? props.otpGeneration : undefined);
|
|
43
|
+
const apiResponse = await (0, _ApiUtils.getAxiosApiResponse)(apiData);
|
|
44
|
+
if (isCustomConfig && apiData.responseJsonLogic) {
|
|
45
|
+
return jsonLogic.apply(apiData.responseJsonLogic, apiResponse.data);
|
|
36
46
|
}
|
|
47
|
+
return apiResponse.data;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
var _error$response;
|
|
50
|
+
_Logger.default.getInstance().logEvent('~ generateOTP', error.message, _Logger.LOG_TYPE.SDK_ERROR);
|
|
51
|
+
console.error('error: ', JSON.stringify(error));
|
|
52
|
+
return (error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) ?? false;
|
|
37
53
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
};
|
|
55
|
+
exports.generateOTP = generateOTP;
|
|
56
|
+
const verifyOTP = async (payload, props) => {
|
|
57
|
+
try {
|
|
58
|
+
var _props$validationApi;
|
|
59
|
+
const isCustomConfig = props.otpConfig === OTP_CONFIG.CUSTOM;
|
|
60
|
+
const apiData = (0, _ApiUtils.createApiData)(payload, props, isCustomConfig ? props === null || props === void 0 || (_props$validationApi = props.validationApi) === null || _props$validationApi === void 0 ? void 0 : _props$validationApi.uri : `{baseURI}${_apiConstants.ENDPOINTS.VERIFY_OTP_ENDPOINT}`, 'POST', null, isCustomConfig ? props.validationApi : undefined);
|
|
61
|
+
const apiResponse = await (0, _ApiUtils.getAxiosApiResponse)(apiData);
|
|
62
|
+
if (isCustomConfig && apiData.responseJsonLogic) {
|
|
63
|
+
return jsonLogic.apply(apiData.responseJsonLogic, apiResponse.data);
|
|
44
64
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
65
|
+
return apiResponse.data;
|
|
66
|
+
} catch (error) {
|
|
67
|
+
var _error$response2;
|
|
68
|
+
_Logger.default.getInstance().logEvent('~ verifyOTP', error.message, _Logger.LOG_TYPE.SDK_ERROR);
|
|
69
|
+
console.error('error: ', JSON.stringify(error));
|
|
70
|
+
return (error === null || error === void 0 || (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data) ?? false;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
exports.verifyOTP = verifyOTP;
|
|
74
|
+
const resendOTP = async (payload, props) => {
|
|
50
75
|
try {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
headers: api.headers
|
|
58
|
-
};
|
|
59
|
-
if (api.requestBody) {
|
|
60
|
-
apiData.requestBody = api.requestBody;
|
|
76
|
+
var _props$resendApi;
|
|
77
|
+
const isCustomConfig = props.otpConfig === OTP_CONFIG.CUSTOM;
|
|
78
|
+
const apiData = (0, _ApiUtils.createApiData)(payload, props, isCustomConfig ? props === null || props === void 0 || (_props$resendApi = props.resendApi) === null || _props$resendApi === void 0 ? void 0 : _props$resendApi.uri : `{baseURI}${_apiConstants.ENDPOINTS.RESEND_OTP_ENDPOINT}`, 'POST', null, isCustomConfig ? props.resendApi : undefined);
|
|
79
|
+
const apiResponse = await (0, _ApiUtils.getAxiosApiResponse)(apiData);
|
|
80
|
+
if (isCustomConfig && apiData.responseJsonLogic) {
|
|
81
|
+
return jsonLogic.apply(apiData.responseJsonLogic, apiResponse.data);
|
|
61
82
|
}
|
|
62
|
-
|
|
63
|
-
|
|
83
|
+
return apiResponse.data;
|
|
84
|
+
} catch (error) {
|
|
85
|
+
var _error$response3;
|
|
86
|
+
_Logger.default.getInstance().logEvent('~ resendOTP', error.message, _Logger.LOG_TYPE.SDK_ERROR);
|
|
87
|
+
console.error('error: ', JSON.stringify(error));
|
|
88
|
+
return (error === null || error === void 0 || (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data) ?? false;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
exports.resendOTP = resendOTP;
|
|
92
|
+
const parseResendConfig = inputResendConfig => {
|
|
93
|
+
const resendConfig = _constants.DEFAULT_RETRY_CONFIG;
|
|
94
|
+
if (inputResendConfig) {
|
|
95
|
+
if (inputResendConfig.buttonTitle) {
|
|
96
|
+
resendConfig.buttonTitle = inputResendConfig.buttonTitle;
|
|
64
97
|
}
|
|
65
|
-
if (
|
|
66
|
-
|
|
98
|
+
if (inputResendConfig.enableDelay) {
|
|
99
|
+
resendConfig.enableDelay = inputResendConfig.enableDelay;
|
|
67
100
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
101
|
+
if (inputResendConfig.maxResends) {
|
|
102
|
+
resendConfig.maxResends = inputResendConfig.maxResends;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return resendConfig;
|
|
106
|
+
};
|
|
107
|
+
exports.parseResendConfig = parseResendConfig;
|
|
108
|
+
function maskContactId(contactId) {
|
|
109
|
+
const idString = String(contactId);
|
|
110
|
+
|
|
111
|
+
// Check if it's an email based on the presence of '@'
|
|
112
|
+
if (idString.includes('@')) {
|
|
113
|
+
// Split email into username and domain parts
|
|
114
|
+
const [username, domain] = idString.split('@');
|
|
115
|
+
|
|
116
|
+
// Show first 3 characters and replace the rest with asterisks
|
|
117
|
+
const visibleUsername = username.slice(0, 3) + '*'.repeat(username.length - 3);
|
|
118
|
+
return `${visibleUsername}@${domain}`;
|
|
119
|
+
} else {
|
|
120
|
+
// For non-email contact ID, show first 5 characters as asterisks and last 4 digits
|
|
121
|
+
const lastFourDigits = idString.slice(-4);
|
|
122
|
+
return `***** *${lastFourDigits}`;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const truncateOrderId = shipmentId => {
|
|
126
|
+
let displayShipmentId = '';
|
|
127
|
+
if ((shipmentId === null || shipmentId === void 0 ? void 0 : shipmentId.length) >= 16) {
|
|
128
|
+
const startingTen = shipmentId.slice(0, 5);
|
|
129
|
+
const lastTen = shipmentId.slice(-5);
|
|
130
|
+
displayShipmentId = `${startingTen}...${lastTen}`;
|
|
131
|
+
} else {
|
|
132
|
+
displayShipmentId = shipmentId;
|
|
133
|
+
}
|
|
134
|
+
return displayShipmentId;
|
|
135
|
+
};
|
|
136
|
+
exports.truncateOrderId = truncateOrderId;
|
|
137
|
+
const isNotNullOrEmpty = value => {
|
|
138
|
+
if (value === null || value === undefined) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
if (typeof value === 'string' && value.trim() === '') {
|
|
72
142
|
return false;
|
|
73
143
|
}
|
|
144
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
return true;
|
|
74
148
|
};
|
|
75
|
-
exports.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
149
|
+
exports.isNotNullOrEmpty = isNotNullOrEmpty;
|
|
150
|
+
function generateContactList(response, orderId) {
|
|
151
|
+
var _response$phone, _response$additionalP, _response$additionalE;
|
|
152
|
+
// Initialize an array to store the transformed contact list
|
|
153
|
+
const contactList = [];
|
|
154
|
+
|
|
155
|
+
// Handle the primary phone number
|
|
156
|
+
if ((_response$phone = response.phone) !== null && _response$phone !== void 0 && _response$phone.number) {
|
|
157
|
+
contactList.push({
|
|
158
|
+
id: response.id,
|
|
159
|
+
// Unique identifier
|
|
160
|
+
mode: 'PHONE',
|
|
161
|
+
type: 'PRIMARY',
|
|
162
|
+
index: 0,
|
|
163
|
+
value: response.phone.number,
|
|
164
|
+
// Actual phone number
|
|
165
|
+
orderId
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Handle additional phone numbers
|
|
170
|
+
if ((_response$additionalP = response.additionalPhone) !== null && _response$additionalP !== void 0 && _response$additionalP.length) {
|
|
171
|
+
response.additionalPhone.forEach((phone, idx) => {
|
|
172
|
+
if (phone !== null && phone !== void 0 && phone.number) {
|
|
173
|
+
contactList.push({
|
|
174
|
+
id: response.id,
|
|
175
|
+
// Unique identifier
|
|
176
|
+
mode: 'PHONE',
|
|
177
|
+
type: 'SECONDARY',
|
|
178
|
+
index: idx,
|
|
179
|
+
value: phone.number,
|
|
180
|
+
// Actual phone number
|
|
181
|
+
orderId
|
|
97
182
|
});
|
|
98
|
-
apiData.requestBody = parsedRequestBody;
|
|
99
183
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Handle the primary email
|
|
188
|
+
if (response.email) {
|
|
189
|
+
contactList.push({
|
|
190
|
+
id: response.id,
|
|
191
|
+
// Unique identifier
|
|
192
|
+
mode: 'EMAIL',
|
|
193
|
+
type: 'PRIMARY',
|
|
194
|
+
index: 0,
|
|
195
|
+
value: response.email,
|
|
196
|
+
// Actual email address
|
|
197
|
+
orderId
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Handle additional emails
|
|
202
|
+
if ((_response$additionalE = response.additionalEmail) !== null && _response$additionalE !== void 0 && _response$additionalE.length) {
|
|
203
|
+
response.additionalEmail.forEach((email, idx) => {
|
|
204
|
+
if (email !== null && email !== void 0 && email.id) {
|
|
205
|
+
contactList.push({
|
|
206
|
+
id: response.id,
|
|
207
|
+
// Unique identifier
|
|
208
|
+
mode: 'EMAIL',
|
|
209
|
+
type: 'SECONDARY',
|
|
210
|
+
index: idx,
|
|
211
|
+
value: email.id,
|
|
212
|
+
// Actual email address
|
|
213
|
+
orderId
|
|
103
214
|
});
|
|
104
|
-
apiData.pathParams = api.pathParams;
|
|
105
215
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return contactList;
|
|
219
|
+
}
|
|
220
|
+
const getUniqueRefId = (moId, progressGroupId, attemptCount) => {
|
|
221
|
+
var _refId$toString;
|
|
222
|
+
const refId = `${moId}${progressGroupId ? '::' + progressGroupId : ''}${attemptCount ? '::' + attemptCount : ''}`;
|
|
223
|
+
const _hashedRefId = (0, _uuidByString.default)(refId === null || refId === void 0 || (_refId$toString = refId.toString()) === null || _refId$toString === void 0 ? void 0 : _refId$toString.trim());
|
|
224
|
+
return _hashedRefId;
|
|
225
|
+
};
|
|
226
|
+
exports.getUniqueRefId = getUniqueRefId;
|
|
227
|
+
const updateRetryCount = async retryCount => {
|
|
228
|
+
let storage = _storage.default.getInstance();
|
|
229
|
+
await storage.setSharedItem(_constants2.SHARED_PREFERENCE_RETRY_COUNT, JSON.stringify(retryCount));
|
|
230
|
+
};
|
|
231
|
+
exports.updateRetryCount = updateRetryCount;
|
|
232
|
+
const updateResendCount = async retryCount => {
|
|
233
|
+
let storage = _storage.default.getInstance();
|
|
234
|
+
await storage.setSharedItem(_constants2.SHARED_PREFERENCE_RESEND_COUNT, JSON.stringify(retryCount));
|
|
235
|
+
};
|
|
236
|
+
exports.updateResendCount = updateResendCount;
|
|
237
|
+
const getCount = async type => {
|
|
238
|
+
const storage = _storage.default.getInstance();
|
|
239
|
+
let count = 0;
|
|
240
|
+
if (type === countType.RESEND) {
|
|
241
|
+
count = await storage.getSharedItem(_constants2.SHARED_PREFERENCE_RESEND_COUNT);
|
|
242
|
+
} else if (type === countType.RETRY) {
|
|
243
|
+
count = await storage.getSharedItem(_constants2.SHARED_PREFERENCE_RETRY_COUNT);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Parse and validate the count
|
|
247
|
+
if (count) {
|
|
248
|
+
try {
|
|
249
|
+
const parsedCount = JSON.parse(count);
|
|
250
|
+
if (typeof parsedCount === 'number') {
|
|
251
|
+
return parsedCount;
|
|
111
252
|
}
|
|
112
|
-
const apiResponse = await (0, _ApiUtils.getApiResponse)(apiData);
|
|
113
|
-
return jsonLogic.apply(api.responseJsonLogic, apiResponse.data);
|
|
114
253
|
} catch (error) {
|
|
115
|
-
|
|
116
|
-
return false;
|
|
254
|
+
console.warn('Invalid count value:', count);
|
|
117
255
|
}
|
|
118
256
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const value = validation.logic.value;
|
|
123
|
-
return value == otp;
|
|
124
|
-
}
|
|
125
|
-
// Invalid input received
|
|
126
|
-
else {
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
257
|
+
|
|
258
|
+
// Default to 0 if count is invalid
|
|
259
|
+
return 0;
|
|
129
260
|
};
|
|
130
|
-
exports.
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
retryConfig.buttonTitle = inputRetryConfig.buttonTitle;
|
|
136
|
-
}
|
|
137
|
-
if (inputRetryConfig.delay) {
|
|
138
|
-
retryConfig.delay = inputRetryConfig.delay;
|
|
139
|
-
}
|
|
140
|
-
if (inputRetryConfig.maxAttempt) {
|
|
141
|
-
retryConfig.maxAttempt = inputRetryConfig.maxAttempt;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return retryConfig;
|
|
261
|
+
exports.getCount = getCount;
|
|
262
|
+
const resetCount = async () => {
|
|
263
|
+
let storage = _storage.default.getInstance();
|
|
264
|
+
await storage.setSharedItem(_constants2.SHARED_PREFERENCE_RESEND_COUNT, JSON.stringify(0));
|
|
265
|
+
await storage.setSharedItem(_constants2.SHARED_PREFERENCE_RETRY_COUNT, JSON.stringify(0));
|
|
145
266
|
};
|
|
146
|
-
exports.
|
|
267
|
+
exports.resetCount = resetCount;
|
|
147
268
|
//# sourceMappingURL=utils.js.map
|